text
stringlengths 20
1.01M
| url
stringlengths 14
1.25k
| dump
stringlengths 9
15
⌀ | lang
stringclasses 4
values | source
stringclasses 4
values |
---|---|---|---|---|
How to Enable your Jamstack Site to have a "Rain Day"
So this is perhaps a bit of an edge case, but I was thinking about it this weekend and decided to build a quick demo of it just to see if it would actually work. Imagine a simple Jamstack site for a farmer's market. Now imagine that this particular market is closed when there is bad weather. What if we could build a Jamstack site that checked the weather in the morning and added a warning to the site that they may be closed due to rain? Here's how I implemented this idea.
First, I began with an incredibly simple one page site built with Eleventy. You can see the site in all it's glory at. Here's how it renders normally:
Now here is what it does when it thinks it may close due to weather:
The giant red arrow is there just to point out the change. My CSS isn't quite good enough to do something like that. ;) So how did I build this?
First, I found a weather API. It just so happens, my employer HERE has a Weather API. Obviously anyone would do, but I like ours so I used it. The API basically supports two formats - an observation (what's going on now) and a forecast. The observation also reports on future weather so I went with that. A basic API request could look like so:{HERE_KEY}&product=observation&name=YOUR+LOCATION&metric=false
Where the key needs to be supplied and a location of some sort. You can also use a latitude and longitude pair or zip code if you like. Also, the last bit disables that crazy metric thing that probably won't go anywhere. Hitting this returns data for the location and possible alternatives, but if we focus on one report, the first one returned, we see the following detailed weather data:
{ daylight: 'D', description: 'Scattered clouds. Warm.', skyInfo: '9', skyDescription: 'Scattered clouds', temperature: '82.90', temperatureDesc: 'Warm', comfort: '88.75', highTemperature: '83.48', lowTemperature: '74.48', humidity: '72', dewPoint: '73.00', precipitation1H: '*', precipitation3H: '*', precipitation6H: '*', precipitation12H: '*', precipitation24H: '*', precipitationDesc: '', airInfo: '*', airDescription: '', windSpeed: '5.75', windDirection: '310', windDesc: 'Northwest', windDescShort: 'NW', barometerPressure: '29.97', barometerTrend: '', visibility: '10.00', snowCover: '*', icon: '2', iconName: 'mostly_sunny', iconLink: '', ageMinutes: '10', activeAlerts: '0', country: 'United States', state: 'Louisiana', city: 'Lafayette', latitude: 30.2241, longitude: -92.0198, distance: 2.32, elevation: 11, utcTime: '2020-07-06T12:38:00.000-05:00' }
That's a lot of data, and sadly 82 degrees is nice compared to what it would normally be without all the cloud cover. You can check the API reference for detailed information about each part, but for my use I thought the
precipitation12H would be useful. I figured if I checked this in the morning, it would be a good way to see if the market may need to close that day. I built the following in
_data/weather.js. For folks who don't know Eleventy, this will create data my pages can use at build time. In this case, the data will be available as a variable named
weather.
const fetch = require('node-fetch'); // used to auth with HERE API const HERE_KEY = 'c1LJuR0Bl2y02PefaQ2d8PvPnBKEN8KdhAOFYR_Bgmw'; // used for location of the market const LOC = 'Lafayette, LA'; module.exports = async function() { let url = `{HERE_KEY}&product=observation&name=${encodeURIComponent(LOC)}&metric=false`; let resp = await fetch(url); let data = await resp.json(); let report = data.observations.location[0].observation[0]; console.log(report); // Add a simplification report.rainWarning = (report.precipitation12H !== '*' && report.precipitation12H > 0.02); return report; }
You can see where I make the fetch to the API as well as where I grab the first location and observation. Finally, I add a "simplification" of my "will be possibly close" logic in the
rainWarning value. What's cool is that if I switch to another provide for my weather data, I can just preserve this logic in the data file and my template won't need to worry. Speaking of the template, this is how I handled it:
--- layout: main title: Camden Farmer's Market --- <section class="hero"> <div class="hero-inner"> <h1>Camden Farmer's Market</h1> </div> </section> <main> <div class="content"> <p> Welcome to Camden Farmer's Market. We are located at 311 Elmondia Falling Street, Lafayette, LA 70508. </p> <p> Our hours are 7 days a week, 6AM to 4PM, except for federal and local holidays. <strong>Closed during inclement weather!</strong> </p> {% if weather.rainWarning %} <p> <strong>WARNING - The weather report has predicted rain and it is likely we will be closed.</strong> </p> {% endif %} <span>Photo by <a href="">William Felker</a> on <a href="">Unsplash</a></span> </div> </main>
Just a basic IF check and nothing more. I could go more complex, but for a simple site like this, it's enough of a warning. And speaking of that warning, that brings up an interesting issue. How do we add this when our site is static?
Well first off, we could simply use JavaScript in the browser and hit the API when the client visits the site. This particular API does not support CORS but does support JSONP. However, that means every hit to the page will hit the API. HERE has an incredibly generous free tier, but I'd still like to avoid that. In this particular case, a market that opens at 6AM, I could simply check the weather at 5AM. How? I'm hosting the site on Netlify, and they support a unique build URL that you can hit to generate a new build. You can find this in your "Build hooks" setting for your site:
Next I needed a way to run this on a schedule. For this I decided to use Pipedream. It may be overkill, but I created a quick Workflow that used a CRON source and a "send http request" step.
By the way, I totally suck at CRON so I used crontab.guru to help me write the expression.
So just to recap:
- My Jamstack site, on build, will check the weather report and see if rain is coming in the next 12 hours.
- My home page looks for this boolean and adds a warning when it's true.
- Pipedream will call the Netlify Build webhook daily at 5AM to refresh the site.
And that's it. Obviously not perfect, but also automated so hopefully less work for the poor soul running a market at 6AM!
Photo by William Felker on Unsplash
|
https://www.raymondcamden.com/2020/07/06/how-to-enable-your-jamstack-site-to-have-a-rain-day?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+RaymondCamdensColdfusionBlog+%28Raymond+Camden%27s+Blog%29
|
CC-MAIN-2020-34
|
en
|
refinedweb
|
im_heq, im_lhisteq, im_lhisteq_raw, im_hsp - process an image using grey level transformations
#include <vips/vips.h> int im_heq( in, out, bandno ) IMAGE *in, *out; int bandno; int im_lhisteq( in, out, xw, yw ) IMAGE *in, *out; int xw, yw; int im_hsp( in, ref, out ) IMAGE *in, *ref, *out;
im_heq(3) histogram equalises the unsigned char image held by the IMAGE descriptor in. The result is written to the IMAGE descriptor out. If bandno is -1 then all input bands are equalised independently. In all other cases the input image is equalised using the histogram of bandno only. The latter processing produces better results..
All functions returns 0 on success and -1 on error.
im_histgr(3), im_histplot(3), im_histspec(3), im_lineprof(3), im_stdif(3).
1991--1996 The National Gallery and Birkbeck College 10 May 1991
|
http://huge-man-linux.net/man3/im_heq.html
|
CC-MAIN-2018-05
|
en
|
refinedweb
|
— You can find the source code for this blog series here .
Over the last several months, I’ve been looking for ways to produce physical outputs from my generative code. I’m interested in the idea of developing real, tangible objects that are no longer bound by the generative systems that shaped them. Eventually I plan to experiment with 3D printing, laser cutting, CNC milling, and other ways of realizing my algorithms in the real-world.
My interest in this began in March 2017, when I purchased my first pen plotter: the AxiDraw V3 by Evil Mad Scientist Laboratories. It’s a fantastic machine, and has opened a whole new world of thinking for me. For those unaware, a pen plotter is a piece of hardware that acts like a robotic arm on which you can attach a regular pen. Software sends commands to the device to raise, reposition, and lower its arm across a 2D surface. With this, the plotter can be programmed to produce intricate and accurate prints with a pen and paper of your choice.
— Early prints, March 2017.
Often, these plotters and mechanical devices are controlled by G-code: a file format that specifies how the machine should lift, move, and place itself over time. For convenience, AxiDraw handles most of the mechanical operation for you, providing an Inkscape SVG plugin that accepts paths, lines, shapes, and even fills (through hatching).
— Tesselations, August 2017
You don’t need to be a programmer to use the AxiDraw pen plotter. You can create SVG files in Adobe Illustrator or find SVGs online to print. However, the machine is very well suited to programmatic and algorithmic line art, as it can run for hours at a time and produce incredibly detailed outputs that would be too tedious to illustrate by hand.
One recent series I developed, Natural Systems , is composed of 4 different algorithms. Each time these algorithms run, they produce different outputs, allowing for an infinite number of unique prints.
— Natural Systems, November 2017
This isn’t a new concept; Vera Molnár, an early pioneer of computer art, was rendering pen plotter prints in the 1960s!
— Vera Molnár, No Title, 1968
In this post, I’ll try to explain some of my workflow when developing new pen plotter prints, and show some of the tools I’ve been building to help organize my process.
Development Environment
So far, all of my work with the AxiDraw has been with JavaScript and an experimental tool I’ve been building, aptly named penplot . The tool primarily acts as a development environment, making it easier to organize and develop new prints with minimal configuration.
:rotating_light: This tool is highly experimental and subject to change as my workflow evolves.
You can try the tool out yourself with
# install the CLI app globally npm install penplot -g # run it, generating a new file and opening the browser penplot test-print.js --write --open
The
--write flag will generate a new
test-print.js file and
--open will launch your browser to
localhost:9966 . It starts you off with a basic print:
:pencil2: See here to see the generated source code of this print.
The generated
test-print.js file is ready to go; you can edit the ES2015 code to see changes reflected in your browser. When you are happy, hit
Cmd + S (save PNG) or
Cmd + P (save SVG) to export your print from the browser.
Geometry & Primitives
For algorithmic work with AxiDraw and its SVG plugin, I tend to distill all my visuals into a series of polylines composed of nested arrays.
const lines = [ [ [ 1, 1 ], [ 2, 1 ] ], [ [ 1, 2 ], [ 2, 2 ] ] ]
This creates two horizontal lines in the top left of our print, each 1 cm wide. Here, points are defined by
[ x, y ] and a polyline (i.e. path) is defined by the points
[ a, b, c, d, .... ] . Our list of polylines is defined as
[ A, B, ... ] , allowing us to create multiple disconnected segments (i.e. where the pen lifts to create a new line).
:triangular_ruler: Penplot scales the Canvas2D context before drawing, so all of your units should be in centimeters.
So far, the code above doesn’t feel very intuitive, but you will hardly ever hardcode coordinates like this. Instead, you should try to think in geometric primitives: points, squares, lines, circles, triangles, etc. For example, to draw some squares in the centre of the print:
// Function to create a square const square = (x, y, size) => { // Define rectangle vertices const path = [ [ x - size, y - size ], [ x + size, y - size ], [ x + size, y + size ], [ x - size, y + size ] ]; // Close the path path.push(path[0]); return path; }; // Get centre of the print const cx = width / 2; const cy = height / 2; // Create 12 concentric pairs of squares const lines = []; for (let i = 0; i < 12; i++) { const size = i + 1; const margin = 0.25; lines.push(square(cx, cy, size)); lines.push(square(cx, cy, size + margin)); }
Once the lines are in place, they are easy to render to the Canvas2D context with
beginPath() and
stroke() , or save to an SVG with the
penplot utility,
polylinesToSVG() .
The result of our code looks like this:
:pencil2: See here for the final source code of this print.
This is starting to get a bit more interesting, but you may be wondering why not just reproduce this by hand in Illustrator. So, let’s see if we can create something more complex in code.
Delaunay Triangulation
A simple starting task would be to explore Delaunay triangulation . For this, we will use delaunay-triangulate , a robust triangulation library by Mikola Lysenko that works in 2D and 3D. We will also use the new-array module, a simple array creation utility.
Before we begin, you’ll need to install these dependencies locally:
# first ensure you have a package.json in your folder npm init -y # now you can install the required dependencies npm install delaunay-triangulate new-array
In our JavaScript code, let’s
import some of our modules and define a set of 2D points randomly distributed across the print, inset by a small margin.
We use the built-in penplot
random library here, which has the function
randomFloat(min, max) for convenience.
import newArray from 'new-array'; import { randomFloat } from 'penplot/util/random'; // ... const pointCount = 200; const positions = newArray(pointCount).map(() => { // Margin from print edge in centimeters const margin = 2; // Return a random 2D point inset by this margin return [ randomFloat(margin, width - margin), randomFloat(margin, height - margin) ]; });
:bulb: I often use
new-array and
map to create a list of objects, as I find it more modular and functional than a for loop.
If we were to visualize our points as circles, it might look like this:
The next step is to triangulate these points, i.e. turn them into triangles. Simply feed the array of points into the
triangulate function and it returns a list of “cells.”
import triangulate from 'delaunay-triangulate'; // ... const cells = triangulate(positions);
The return value is an array of triangles, but instead of giving us the 2D positions of each vertex in the triangle, it gives us the index into the
positions array that we passed in.
[ [ 0, 1, 2 ], [ 2, 3, 4 ], ... ]
For example, to get the 3 vertices of the first triangle:
const triangle = cells[0].map(i => positions[i]); // log each 2D point in the triangle console.log(triangle[0], triangle[1], triangle[2]);
For our final print, we want to map each triangle to a polyline that the pen plotter can draw out.
const lines = cells.map(cell => { // Get vertices for this cell const triangle = cell.map(i => positions[i]); // Close the path triangle.push(triangle[0]); return triangle; });
Now we have all the lines we need to send the SVG to AxiDraw. In the browser, hit
Cmd + S and
Cmd + P to save a PNG and SVG file, respectively, into your Downloads folder.
For reference, below you can see how our original random points have now become the vertices for each triangle:
:bulb: The
random module includes a
setSeed(n) function, which is useful if you want predictable randomness every time the page reloads.
If we increase the
pointCount to a higher value, we start to get a more well-defined edge, and potentially a more interesting print.
:pencil2: See here for the final source code of this print.
|
http://colabug.com/2117618.html
|
CC-MAIN-2018-05
|
en
|
refinedweb
|
Created on 2009-04-14 11:39 by iankko, last changed 2010-09-28 03:25 by jcea. This issue is now closed.
Common Vulnerabilities and Exposures assigned an identifier
CVE-2008-5983 (and related CVE ids) to the following vulnerability:
Untr.
References:
To sum up the behavior, the following table displays whether
modules are read from the current working directory for various
ways how the python scripts can be launched (unfixed/fixed version):
unfixed fixed run as
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
yes no python test.py
yes no python ./test.py
yes no python /tmp/396/test.py
yes no /bin/env python test.py
yes yes test.py
yes yes ./test.py
yes yes /tmp/396/test.py
yes yes /usr/bin/python test.py
yes yes /usr/bin/python ./test.py
yes yes /usr/bin/python /tmp/396/test.py
no no test-in-different-dir.py
no no ./bin/test-in-different-dir.py
no no python ./bin/test-in-different-dir.py
As no longer work of "python ./foo.py" after patch utilization may
cause, the update won't be acceptable, could you guys review the
above patch and potentially provide an another one?
Just drop into /tmp and run (you will need the zenity package installed):
python3.1 ./test.py
or
gedit # unfixed gedit
in that directory.
What is the problem exactly?
An user can run arbitrary Python code from a file in his own account --
well, sure, that's a feature. Unless I'm misunderstanding something.
I wanted to read the patch at but apparently its
access is restricted...
Anto.
I'm not sure we can change the behaviour of PySys_SetArgv() like that.
At least not in a bugfix release.
In 2.7/3.1, we could either change PySys_SetArgv(), or introduce a new
PySys_SetArgvEx() with an additional argument indicating whether
sys.path should be modified or not. I suggest asking on python-dev first.
both.
By the way, the advantage of a new function over a behaviour change is
that the new function could safely be backported to 2.6.3, since it is
also a "security fix".
Here is a patch for trunk.
Jan, would the new API be ok to you?
I disagree that this issue is release critical. I'm still skeptical that
this is a security bug; if it is, any solution created needs to be
applied to all active branches - including the ones that would be
blocked by this issue right now. IOW, it's still possible to fix it
after the release.
Ok, downgrading to critical.
I'm awaiting the reporter's answer anyway.
Antoine,
(re: #msg87083, #msg87084) -- while the API change is acceptable and
reasonable, it doesn't solve the core of the problem. I understand
the change needs to be 'backward compatible' and shouldn't break
the existing Python behavior, but the current proposed patch:
1, doesn't avoid the need to fix the issue (by calling
"PySys_SetArgvEx(argc, argv, 0);") in all current applications embedding
Python,
2, doesn't dismiss the risk of future appearance of application,
embedding Python interpreter and using it in a vulnerable way
(in fact, all what it does, is adding recommendation / alternative
to use more safer PySys_SetArgv(*, *, 0) for such cases. I don't think
we can just rely on the fact, the developers will use it in a safe
way in the future -- or did I overlooked something?
Wouldn't be possible to fix it 'only in Python' and prevent such
potential future malicious (mis)uses?
To Martin (re: #msg87212):
What's the question of 'security nature' of the issue, Glyph in
message #msg86927 already uncovered potential implications --
if the application was written either 'by accident', or 'by intention',
it shouldn't just allow to execute anything with the privileges of
superuser, and even worse, doing it silently (then the only warranty
for the unprivileged user would be to rely on the fact, the function
was called 'in a safe way' in the application and I suppose such
assumption would completely discourage him from running it).
I recommend the final fix should be applied to all active Python
branches (just comment on second part of Martin's comment).
Regards, Jan.
> What's the question of 'security nature' of the issue, Glyph in
> message #msg86927 already uncovered potential implications --
The question is whether these are theoretical or real problems.
I ran gedit (as proposed by Glyph) under strace(1), and it didn't
try to open any files in the current directory.
Hello Jan,
> 1, doesn't avoid the need to fix the issue (by calling
> "PySys_SetArgvEx(argc, argv, 0);") in all current applications embedding
> Python,
As you said yourself, we don't want to break backwards compatibility for
C API users -- especially between two minor versions such as 2.6.2 and
2.6.3. The current behaviour is certainly by design, otherwise it
wouldn't be so complicated.
Besides, the patch you proposed is fragile as it relies on a hard coded
value for the executable name, and it also complexifies the behaviour
even more. I don't think we should apply it in core Python. On the other
hand, adding an /explicit/ option in the API minimizes the risk for
confusion and signals clearly that an alternative is available.
> I don't think
> we can just rely on the fact, the developers will use it in a safe
> way in the future
Well, you can always shoot yourself in the foot in C, even without using
the Python API. The patch just provides a practical way for
Python-embedding applications to be safer. Then, it's up to application
developers to do their job.
> Wouldn't be possible to fix it 'only in Python' and prevent such
> potential future malicious (mis)uses?
AFAICT, not without risking breaking compatibility for perfectly
well-behaved apps which would rely on the current behaviour.
> The question is whether these are theoretical or real problems.
> I ran gedit (as proposed by Glyph) under strace(1), and it didn't
> try to open any files in the current directory.
You have to use a Python-written gedit plugin for that to happen. For
example, if I enable the "Python console" plugin, I get the following
lines in strace:
17569:open("gconf.so", O_RDONLY) = -1 ENOENT (No such file
or directory)
17570:open("gconfmodule.so", O_RDONLY) = -1 ENOENT (No such file
or directory)
17571:open("gconf.py", O_RDONLY) = -1 ENOENT (No such file
or directory)
17572:open("gconf.pyc", O_RDONLY) = -1 ENOENT (No such file
or directory)
I wonder why all these applications call PySys_SetArgv at all if they
don't have any arguments to set. In the gedit case, I just removed the
call from gedit, and it seems to work fine (sys.argv will be an empty list).
It suggests to me that somewhere there's some documentation, or an
example, that says "this is the right way to embed python, call this
function".
If the right thing to do is to just not call the function at all, we
need to get that knowledge out there into the embedding community and
publicize this issue. Perhaps a doc bug? PySys_SetArgvEx seems like it
might be a good idea for applications which do still want to set the
argument list without the sys.path implications, but a quick perusal of
the sources of plugins for the affected applications suggests that none
of them need it.
>.
> IOW, I *really* want to understand what's happening before fixing
> it. This is a security issue, after all.
Agreed. Does anyone currently subscribed to this ticket know the author
of such an application? It would be very helpful to have them involved
in the discussion.
gedit does it here:-
loader-python.c#n542
I've emailed the file's author (Jesse) out of the blue to see if he knows
why PySys_SetArgv() was called.
re: gedit
"""I'm by no means an expert (I did not design the original python module
extension), we simply copied from vim at the beginning. That said, it
seems there are issues if you embed the python interpreter and do not
explicitly set sys.argv to something.""" - jesse
It seems other projects are already fighting with the path-changing
behaviour of PySys_SetArgv(), e.g.:
- py2exe:
- gtk:
src/if_python.c in vim-7.2 has a comment:
/* Set sys.argv[] to avoid a crash in warn(). */
I think the crash is follows.
% python
Python 2.5.2 (r252:60911, Jan 4 2009, 17:40:26)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>> warnings.warn("foo")
__main__:1: UserWarning: foo
>>> import sys
>>> sys.argv
['']
>>> sys.argv = []
>>> sys.argv
[]
>>> warnings.warn("foo")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/warnings.py", line 54, in warn
filename = sys.argv[0]
IndexError: list index out of range
>>>
Hello guys,
what's the current state of this issue? The proposed patch hasn't
still been projected into upstream Python code, so wondering:
1, when and if it will be?
2, if you have found another solution / patch?
Thanks && Regards, Jan.
--
Jan iankko Lieskovsky
Hello,
> what's the current state of this issue? The proposed patch hasn't
> still been projected into upstream Python code, so wondering:
> 1, when and if it will be?
I was hoping for more feedback before committing it. While it has been
labeled a security issue, not many people seem to actually care. Distro
maintainers doing their own patching without communicating with us
doesn't help either.
> 2, if you have found another solution / patch?
If it were so this bug would have been closed.
Have you considered something like this? (patch against 3.1)
--- Python/sysmodule.c.orig
+++ Python/sysmodule.c
@@ -1643,6 +1643,7 @@ PySys_SetArgv(int argc, wchar_t **argv)
#endif /* Unix */
}
#endif /* All others */
+ if (n > 0 || argv0 == NULL || wcscmp(argv0, L"-c") == 0) {
a = PyUnicode_FromWideChar(argv0, n);
if (a == NULL)
Py_FatalError("no mem for sys.path insertion");
@@ -1650,6 +1651,7 @@ PySys_SetArgv(int argc, wchar_t **argv)
Py_FatalError("sys.path.insert(0) failed");
Py_DECREF(a);
+ }
}
Py_DECREF(av);
}
I presume main problem here is that '' may end up as first item in
sys.path in certain cases.
That is desired in some cases, namely:
- python run in interactive mode
- python -c '...'
It does not happen and is not desired in other cases:
- ./foo.py
- python foo.py
- env python foo.py
Here foo.py can be just filename or filename with relative or absolute
path. In all these cases python seems to set argv0 to something
realpath can resolve.
Problematic case is embedded use when bogus argv0 can cause '' to be
added to sys.path, but it's usually not desired / expected (is anyone
aware of the case when that is expected?). It can be argued whether
apps should use garbage as argv0, but example in Demo/embed/demo.c do it
as well...
Patch above attempts to skip modification of sys.path when realpath
failed (n == 0). There are two special cases, that are treated as
special on couple of other places in PySys_SetArgv already:
- argv0 == NULL (interactive python)
- argv0 == "-c" (python -c)
This should fix the problem for apps embedding python and providing
garbage argv0. It would not make a difference for apps that provide
some valid path as argv0. I'm not aware of non-embedded python use that
will end up with different sys.path after this patch.
Ideas? Anyone is aware of the valid usecase that can break with this?
Advantage to Ex approach is that it does not require change on the
embedding apps side, and should really impact only those setting garbage
argv0.
Tomas, your patch is breaking an existing API, which may break existing
uses (I'm not sure which ones, but people are doing lots of things with
Python). That's why I proposed a separate API, which has the additional
benefit of making things clearer rather than muddier.
Besides, parsing of command line flags is already done in
Modules/main.c, we shouldn't repeat it in sysmodule.c.
Additional.
Indeed, it would certainly be useful to review current behaviour and
document it precisely; and then, perhaps change it in order to fix the
current bug. The problem is that the current behaviour seems to have
evolved quite organically, and it's not obvious who relies on what (as I
said, Python has many users). I'm not myself motivated in doing such a
research. Perhaps other developers can chime in.
Besides, the new API makes the behaviour more explicit and puts the
decision in the hands of the embedding developer (which certainly knows
better than us what he wants to do).
As the Python Zen says:
In the face of ambiguity, refuse the temptation to guess.
Link]
This is not really the same thing as issue 946373. That one seems to be
about adding script's directory as the first thing in sys.path.
Comments there seem to mix both interactive ('' in sys.path) and
non-interactive (os.path.dirname(os.path.abspath(sys.argv[0])) in
sys.path) python uses, while CVE-2008-5983 is only about '' in sys.path,
mostly related to embedded use, rather than for python interpreter itself.
Has anyone else had an opportunity to have a look at the change proposed in #msg90336?
Can anyone move this to Stage: patch review (for the fix approach proposed in msg90336)? Or does anyone have better idea on how to move this closer to final fix or wontfix / reject? Thank you!
> Can anyone move this to Stage: patch review (for the fix approach
> proposed in msg90336)? Or does anyone have better idea on how to move
> this closer to final fix or wontfix / reject? Thank you!
I stand by my opinion that adding another hack in the initialization
path will not do us a lot of good, while a separate API would solve the
problem neatly. Perhaps Dave Malcolm can chime in?
FWIW I agree with Antoine.
Attempting).
Ok, I will try to write better documentation.
> My reading of PySys_SetArgv is that if argv is NULL, then
> "char *argv0 = argv[0];" will read through NULL and thus will
> segfault on a typical platform.
Right.
> I favor Antoine's approach in
> of adding a new API
> entry point, whilst maximizing compatibilty for all of the code our
> there using the existing entry point.
Sadly, this won't help existing applications affected by this problem, without all of them needing to be changed.
My change proposed in msg90336 won't help either, at least not in all cases. Apps that call PySys_SetArgv with 1, { "myappname", NULL } can still be tricked to add full CWD path at the beginning of sys.path on platforms with realpath().
Here is a new patch giving more details in the doc, and explicitly mentioning the CVE entry.
+ - If the name of an existing script is passed in ``argv[0]``, its absolute
+ path is prepended to :data:`sys.path`
Absolute path to the directory where script is located. And I believe there's no absolute path guarantee for platforms without realpath / GetFullPathName.
Should the documentation also give some guidance to those that embed python and don't want to start using SetArgvEx right away and break compatibility with older python versions? Something like:
If you're embedding python in your application, using SetArgv and don't want modified sys.path, call PyRun_SimpleString("sys.path.pop(0)\n"); after SysArgv to unconditionally drop the first sys.path argument added by SetArgv.
> Absolute path to the directory where script is located. And I believe
> there's no absolute path guarantee for platforms without realpath /
> GetFullPathName.
Yes, this is more precise indeed. As for realpath(), I would expect it
to be present on modern Unices (man page says "4.4BSD, POSIX.1-2001").
> If you're embedding python in your application, using SetArgv and
> don't want modified sys.path, call
> PyRun_SimpleString("sys.path.pop(0)\n"); after SysArgv to
> unconditionally drop the first sys.path argument added by SetArgv.
I suppose
PyRun_SimpleString("import sys; sys.path.pop(0)\n");
would be better.
Thanks for the comments, I'll update the patch.
Committed in r81398 (trunk), r81399 (2.6), r81400 (py3k), r81401 (3.1). Thank you!
Demo/embed/demo.c calls PySys_SetArgv(), which may be where
some people are copying their code from. I've updated it to
use PySys_SetArgvEx() and added an explanatory comment in rev. 81881.
Since the function was also added to 2.6, the 2.6 What's New should mention it; added in rev81887.
This issue is equivalent to MS Windows DLL hijacking (the MS situation is worse, because the DDL can be in network shares or, even , in remote webdav servers):
When I learned about this attack, my first thought was "what if sys.path.index('')>=0?". Arg!.
|
https://bugs.python.org/issue5753
|
CC-MAIN-2018-05
|
en
|
refinedweb
|
is there a way i could send a form's (css) class from python?
For example:
class Company(Form):
companyName = TextField('Company Name', [validators.Length(min=3, max = 60)])
.companyName
id="companyName"
class_="companyName"
__init__() got an unexpected keyword argument '_class'
WTForms does not allow you to set display options (such as class name) in the field initialization. However, there are several ways to get around this:
If all of your fields should include a class name as well as an ID then just pass in each field's
short_name to it when you render it:
<dl> {% for field in form %} <dt>{{field.label}}</dt> <dd>{{field(class_=field.short_name)}}</dd> {% endfor %} </dl>
Create a custom widget mixin that provides the class name:
from wtforms.fields import StringField from wtforms.widgets import TextInput class ClassedWidgetMixin(object): """Adds the field's name as a class when subclassed with any WTForms Field type. Has not been tested - may not work.""" def __init__(self, *args, **kwargs): super(ClassedWidgetMixin, self).__init__(*args, **kwargs) def __call__(self, field, **kwargs): c = kwargs.pop('class', '') or kwargs.pop('class_', '') kwargs['class'] = u'%s %s' % (field.short_name, c) return super(ClassedWidgetMixin, self).__call__(field, **kwargs) # An example class ClassedTextInput(ClassedWidgetMixin, TextInput): pass class Company(Form): company_name = StringField('Company Name', widget=ClassedTextInput)
|
https://codedump.io/share/LVdPOwumLlSf/1/wtforms-add-a-class-to-a-form-dynamically
|
CC-MAIN-2018-05
|
en
|
refinedweb
|
Now that your report has a data model and layout, you can add the logic to control the number of customers displayed. First, you will create two parameters that the user can enter values for at runtime. Second, you will create a group filter that uses the parameters to control which data is included.
To create parameters and add a group filter: CUTOFF_CNT.
Under Parameter, set the Datatype property to Number, set the Width property to 1, and set the Initial Value property to 3.
Repeat the steps above to create another user parameter, using the following property settings this time:
Under General Information, set the Name property to INCR_CNT.
Under Parameter, set the Datatype property to Number, set the Width property to 3, and set the Initial Value property to 0.
In the Object Navigator, under the Data Model node, expand the Groups node, then double-click the properties icon next to the G_CNAME group to display the Property Inspector, and set the following properties:
Under Group, set the Filter Type property to PL/SQL, then click the PL/SQL Filter property field to display the PL/SQL Editor.
In the PL/SQL Editor, use the template to enter the following PL/SQL code:
function G_CNAMEGroupFilter return boolean is begin :incr_cnt:=:incr_cnt+1; if :incr_cnt <= :cutoff_cnt then return (TRUE); else return(FALSE); end if; end;
Note:You can enter this code by copying and pasting it from the provided text file called
rank_code.txt. This code is for the Group Filter.
Click Compile.
Click Close.
This filter increments the counter by 1 each time a record in G_CNAME is fetched, then compares the counter's value to the specified cutoff. When the counter exceeds the cutoff, no more records are fetched.
Tip:Notice that, if the Paper Design view is still open while you add this logic, the report now returns no records in the Paper Design view. To fix this issue, you should display one of the other views (for example, the Data Model view) and then come back to the Paper Design view. You will be prompted by the Runtime Parameter Form to enter values for the two parameters, INCR_CNT and CUTOFF_CNT.
Click the Run Paper Layout button in the toolbar to display the Runtime Parameter Form, which enables you to change the default values for CUTOFF_CNT and INCR_CNT.
Click the Run Report button to display the report output in the Paper Design view.
Save your report as
rank
_your_initials
.rdf.
Figure 34-3 Tabular report output restricted to top three customers
|
https://docs.oracle.com/cd/E14571_01/bi.1111/b32122/orbr_rank003.htm
|
CC-MAIN-2018-05
|
en
|
refinedweb
|
Terminology Status
Currently, this is a very rough list of terms and definitions used in the Python packaging ecosystem and currently exists as a very loose first draft. More terms may be added (and a few terms might be spurious and can be removed). The definitions of terms has largely been culled from the Distutils and Setuptools/PEAK web sites. These terms are intended as a starting point for discussion on the distutils-sig mailing list for a more formalized set of terminology that may eventually be specified in a Python PEP.
Module
The basic unit of code reusability in Python. A block of code imported by some other code.
Pure Python module
A module written in Python and contained in a single .py file (and possibly associated .pyc and/or .pyo files)..
Package
A module that contains other modules. Typically contained in a directory in the filesystem and distinguished from other directories by the presence of a __init__.py file.
- To-Do: Update this definition to reflect namespace packages?
Root Package
The root of the hierarchy of packages. (This isn’t really a package, since it doesn’t have an __init__.py file. contributes modules to the root package.
- To-Do: definition taken from distutils. This terminology should perhaps be changed to "Namespace Root" (or something better)?
Module Distribution
A collection of Python modules distributed together as a single downloadable resource and meant to be installed en masse. Examples of some well-known module distributions are Numeric Python, PyXML, PIL (the Python Imaging Library), exists. Generally setup.py will be run from this directory.
Distutils
Package included in the Python Standard Library for installing, building and distributing Python code.
Metadata for Python Software Packages
Metadata is data about the contents of a Python package.
The format and fields specified in version 1.0 is detailed in PEP 241 (), and support for working with these fields was included in the distutils package which was added in Python 2.1.
Version 1.1 additiones were detailed in PEP 314 (). This updated the fields to include 'Download-URL', 'Requires', 'Provides' and 'Obsoletes' fields. Support was added to the distutils package for this in Python 2.5. The simple dependency information fields for a distribution is generally not used, as the specific module requirements can be dynamic depending on the platform and installation context.
Version 1.2 was proposed in PEP 345 (), but is still in the draft status and has not been approved not support for these fields implemented.
Setuptools.
easy_install
Easy Install is a python module (easy_install) bundled with setuptools that lets you automatically download, build, install, and manage Python packages.
pkg_resources.
Eggs
The Egg PEAK page definition: PkgResources PEAK page definition:
Eggs are pluggable distributions in one of the three formats currently supported by pkg_resources. There are built eggs, development eggs, and egg links. Built eggs are directories or zipfiles whose name ends with .egg and follows the egg naming conventions, and contain an EGG-INFO subdirectory (zipped or otherwise). Development eggs are normal directories of Python code with one or more ProjectName.egg-info subdirectories. And egg links are *.egg-link files that contain the name of a built or development egg, to support symbolic linking on platforms that do not have native symbolic links.
- To-Do: There is a lot of confusion as to what an "egg" is. Some believe it refers to the additional metadata, others believe it is the binary format (the .egg file). e.g. is a source distribution that uses setuptools an egg?
Built Egg
A zipped file or directory whose name ends with .egg and follows the egg naming conventions, and contains an EGG-INFO subdirectory. Built eggs can contain binary data specific to a target platform.
- To-Do: some call these "binary eggs", clarify between a binary egg and a built egg?
Development Egg
Normal directories of Python code with one or more ProjectName.egg-info subdirectories.
- To-Do: is there a difference between a "source egg" and a "development egg"?
Egg Link
*.egg-link files that contain the name of a built or development egg, to support symbolic linking on platforms that do not have native symbolic links. unamab.
- To-Do: A shared egg cache can be specified in Buildout by using the 'eggs-directory' option. This is often informally referred to as an "egg cache".
- To-Do: Recommendations for where a "global egg cache" could possibly live within different operating systems?
Working Set
A collection of distributions available for importing. That is distributions that are on the on the sys.path. At most one distribution (release version) of a given project may be present in a working set, as otherwise there would be ambiguity as to what to import.
Working sets include all distributions available for importing, not just the sub-set of distributions which have actually been imported.
System Package
A package provided by in a format native to the operating system. e.g. rpm or dpkg file.
Installed Distribution
A distribution which is available for import without explicitly modifying the sys.path. An installed distribution is
- To-Do: clarify this ... ?
Namespace Package
A namespace package is a package that only contains other packages and modules, with no direct contents of its own. Such packages can be split across multiple, separately-packaged distributions.
Buildout
Tool that provides support for creating applications, especially Python applications. It provides tools for assembling applications from multiple parts, Python or otherwise. An application may actually contain multiple programs, processes, and configuration settings.
Buildout is commonly used to install and manage working sets of Python distributions in the egg format.
- To-Do: clarify the project name, since some refer to Buildout as "zc.buildout", the name of the Python package.
VirtualEnv
Tool to create isolated Python environments.
- To-Do: The term environment differs between setuptools and virtualenv.
|
https://wiki.python.org/moin/PythonPackagingTerminology?action=fullsearch&context=180&value=linkto%253A%2522PythonPackagingTerminology%2522
|
CC-MAIN-2018-05
|
en
|
refinedweb
|
Base class for exceptions.
This embedded class derives from standard exception class and serves as base class for objects thrown as exceptions by functions in the iostream hierarchy.
It is defined within the std namespace as:
class ios_base::failure : public exception { public: explicit failure (const string& msg); virtual ~failure(); virtual const char* what() const; }
- explicit failure (const string& msg);
- Constructs a failure object. Its msg parameter will be returned when member what is called. Effectively calls exception(msg).
- virtual ~failure();
- No operation.
- virtual const char* what() const;
- Returns the msg which the object was created with.
See also.
ios_base class
|
http://www.kev.pulo.com.au/pp/RESOURCES/cplusplus/ref/iostream/ios_base/failure.html
|
CC-MAIN-2018-05
|
en
|
refinedweb
|
Event ID 14537 —
Ensure that the buffer on the client holds the appropriate trusted domain information
If your organization has a large number of trusted domains and forests, it is possible that client computers will not be able to access all domain-based namespaces in the trusted domains and forests. If a client computer can access a link target in another trusted domain or trusted forest by using the target’s Universal Naming Convention (UNC) path, the client computer can also access the link target by using its DFS path, but only if the list of domains fits into the client computer’s buffer. By default, DFS client computers send a 4-kilobyte (KB) (2,048 Unicode character) buffer to a domain controller when they request domain name referrals. If the list of domains is too large to fit into the 4-KB buffer, DFS client computers automatically increase their buffer size to accept the list of domains, up to a maximum of 56 KB.
When it populates the buffer of a client computer, DFS gives preference to local and explicitly trusted domains by filling the buffer with the names of those domains first. Consequently, by creating explicit trust relationships with domains that host important DFS namespaces, you can minimize the possibility that these domain names might be dropped from the list that is returned to the client computer. For more information about trust relationships, see Domain and Forest Trusts Technical Reference ().
Verify
Generate a list of the trusted domains from a domain controller and from a DFS client computer. Compare the two lists to ensure that they match.
Membership in Domain Admins, or equivalent, is the minimum required to perform the following procedure. Review details about default group memberships at. Perform the procedure on a domain controller in your domain.
To generate a list of trusted domains from a domain controller:
- nltest /domain_trusts > domaintrusts.txt to produce a text file that lists all the trusted domain names.
- Open the list in a text editor. For example, to open the file in Notepad, run the command notepad domaintrustlist.txt.
Membership in Domain Users, or equivalent, is the minimum required to perform the following procedure. Review details about default group memberships at. Perform the procedure on a domain controller in your domain.
To generate a list of trusted domains from a DFS client computer:
- Open a command prompt. To open a command prompt, click Start. In Start Search, type cmd, and then press ENTER.
- Run the command dfsutil /spcinfo > domaintrusts.txt to produce a text file that lists all the trusted domain names.
- Open the list in a text editor. For example, to open the file in Notepad, run the command notepad domaintrustlist.txt.
Compare the list of trusted domains from the domain controller and from the DFS client computer to ensure that the lists match to confirm that the Dfs service is working properly.
Related Management Information
Trusted Domain Information Status
|
https://technet.microsoft.com/en-us/library/ee406121(v=ws.10).aspx
|
CC-MAIN-2018-05
|
en
|
refinedweb
|
Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.
#include <Array.au3> $wmiServices = ObjGet("winmgmts:{impersonationLevel=Impersonate}!//" & @ComputerName) ; Get physical disk drive $wmiDiskDrives = $wmiServices.ExecQuery("SELECT Caption, DeviceID FROM Win32_DiskDrive") $iCount = $wmiDiskDrives.count Dim $aInfo[$iCount][2] $i = 0 For $wmiDiskDrive In $wmiDiskDrives $aInfo[$i][0] = $wmiDiskDrive.DeviceID $aInfo[$i][1] = $wmiDiskDrive.Caption $i += 1 Next _ArrayDisplay($aInfo)
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.
|
https://www.experts-exchange.com/questions/27673530/How-can-I-input-the-data-returned-by-this-code-into-an-array-via-variables-and-pass-that-along-to-the-user-with-the-corresponding-disk-description-to-allow-them-to-select-the-applicable-disk.html
|
CC-MAIN-2018-05
|
en
|
refinedweb
|
Thanks for reply.
The particular header in this example is a security/saml-token. But I've
also tried adding headers according to the example here, and neither are
passed to the endpoint:
Again, all headers are passed successfully to a similar soap 1.1 endpoint.
I've configured the endpoint using the Java DSL similar to this:
.to("cxf://{urn:test:namespace}MyServiceSOAP&serviceName={urn:test:namespace}MyService&skipFaultLogging=true")
Camel/CXF figures out the correct binding from the WSDL I guess? Seems to be
correct anyway, as the actual invoking of the service works fine apart from
the lost out of band soap headers.
Soap action are set like this:
exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, "query");
exchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE,
"urn:test:namespace");
--
View this message in context:
Sent from the Camel - Users mailing list archive at Nabble.com.
|
http://mail-archives.apache.org/mod_mbox/camel-users/201504.mbox/%[email protected]%3E
|
CC-MAIN-2018-05
|
en
|
refinedweb
|
Last updated on December 21st, 2017 | offline persistence for its web SDK.
A few weeks before writing this I emailed my subscribers asking what excited them the most, and without a doubt, offline persistence and chained queries were tied neck to neck.
Today will learn how to integrate Cloud Firestore into our Ionic projects using AngularFire2 and will cover how to CRUD data from it.
Integrate Cloud Firestore
To integrate Cloud Firestore into your Ionic app, the first thing you need to do is to make sure you’re using at least version 4.5.0 of the Firebase JS SDK and version 5.0.0-rc.1 of AngularFire2.
$ npm install firebase@latest angularfire2@latest
Once that’s installed, go into your
app.module.ts folder and import the AF2 packages we’ll use:
import { AngularFireModule } from 'angularfire2'; import { AngularFireAuthModule } from 'angularfire2/auth'; import { AngularFirestoreModule } from 'angularfire2/firestore';
And then add it to your
imports array inside the
@NgModule:
@NgModule({ ... imports: [ BrowserModule, IonicModule.forRoot(MyApp), AngularFireModule.initializeApp(firebaseConfig), AngularFireAuthModule, AngularFirestoreModule ], ... })
NOTE: The only thing you need to do to enable offline persistence is to add it to
AngularFirestoreModule.
AngularFirestoreModule.enablePersistence()
CRUD with Cloud Firestore
Once everything is “up and running,” we’ll create a few examples of how to manipulate data.
First, remember what I said in the beginning, Cloud Firestore is a Document based NoSQL database, if you need to learn more about that, this quick video from the Firebase team will help.
Reading Data from the DB
To read a list of data, you have to create a reference to it first, in this case, we’ll imagine that we have a collection called
groceryList in our database.
Inside that collection, we’ll have different documents for different groceries.
Let’s create that reference:
const groceryListRef = this.fireStore.collection<Grocery>(`/groceryList`);
That line is creating a reference to the
groceryList collection in our database, and now we can play with it.
If we want to fetch the grocery list to display on our page, then our code would look something like this:
this.groceryList = groceryListRef.valueChanges();
That’s it, and now you can display it in your HTML like this:
<ion-list> <ion-list-header> My Home's Groceries </ion-list-header> <ion-item * <h2> {{ grocery.name }} </h2> <h3> There are <strong>{{ grocery.quantity }} </strong> in stock. </h3> </ion-item> </ion-list>
Since
.valueChanges() returns an
Observable for us to use, we can use the
async pipe to tell our HTML that the data is coming in asynchronously.
Push data to the DB
Writing Cloud Firestore feels weird, so going to keep it just as Firestore
To add a new grocery to that list, Firestore gives us the
.add() method, very similar to the
.push() method we use in the RTDB.
groceryListRef.add({ name: 'Apple', quantity: 5, inShoppingList: false });
That will create a new document located at
groceryList/<new_grocery_id>/
Updating data from the DB
To update a value from a document we can use the
.update function
groceryListRef.doc(new_grocery_id).update({ quantity: 8, });
That will go into the document and change the quantity from 5 to 8.
Deleting data from the DB.
And lastly, to delete an item from that list you’d need to call
.delete() in the document:
groceryListRef.doc(new_grocery_id).delete();
Next Steps
Did you find this post helpful?
Jump start your development using Master Firestore for Ionic Framework, it covers Async/Await, User Authentication, CRUD, Firestore Transactions, Cloud Functions triggers for Firestore, Security Rules, and Offline Persistence among other things.
|
https://javebratt.com/cloud-firestore-intro/
|
CC-MAIN-2018-05
|
en
|
refinedweb
|
One challenge in aligning artificial intelligence (AI) with human interests is to make sure that it can be stopped (interrupted) at any time. Current reinforcement (RL) algorithms don't have this property. From the way they work, one can predict that they learn to avoid interruptions if they get interrupted repeatedly. My goal was to take this theoretical result and find out what happens in practice. For that I ran Sarsa(λ) and Q-learning in the cart-pole environment and observed how their behaviour changes when they get interrupted everytime the cart moves more than $1.0$ units to the right. In my primitive scenario, Sarsa(λ) spends 4-6 times as many timesteps on the left of the centre when interrupted compared to when not, Q-learning 2-3 times. In other words, interruptions noticeably influence the behaviour of Sarsa(λ) and Q-learning. More theoretical work to prevent that is underway, but further theoretical and practical investigations are welcome.
We want to align AI with human interests. Reinforcement learning (RL) algorithms
are a class of current AI. The OpenAI Gym has several
adaptations of classic RL environments that
allow us to observe AI alignment-related properties of RL algorithms. One such
property is the response to interruptions. One environment to observe this is
the
OffSwitchCartpole-v0.
This is an adaptation of the well-known
CartPole-v1 environment where the
learning gets interrupted (reward $0$) everytime the cart moves more than $1.0$
units to the right. In this notebook I observe in a primitive experiment how
Sarsa(λ) and Q-learning react to interruptions by comparing their behaviour in
the
CartPole-v1 and the
OffSwitchCartpole-v0 environments.
(Note: Don't be confused by the
v0 and
v1. I'm just using them to be
consistent throughout the text and with the OpenAI Gym. Actually,
CartPole-v1
is the same as
CartPole-v0, only the way the evaluation is run in the Gym is
different: in
v0 an episode lasts for at most 200 timesteps, in
v1 for at
most 500. The
OffSwitchCartpole-v0 is also run for 200 timesteps. I'm writing
CartPole-v1 everywhere, because in my experiments I also run the environments
for at most 500 steps. Since there is no
OffSwitchCartpole-v1, though, I have
to write
OffSwitchCartpole-v0. Okay, now you are confused. Never mind. Just
ignore the
vx and you'll be fine.)
(Another note: When you see the section headings in this notebook, you might think that I was trying to produce a proper academic publication. This is not so. Such a framework just makes writing easier.)
For general questions on why we need to align AI with human interests, see [1] and [6].
[7] suggests doing concrete experiments to observe the behaviour of AI. [8] has a similar focus, but doesn't suggest experiments. Both don't mention interruptibility, perhaps because it is a more theoretical consideration:
[…] we study the shutdown problem not because we expect to use these techniques to literally install a shutdown button in a physical agent, but rather as toy models through which to gain a better understanding of how to avert undesirable incentives that intelligent agents would experience by default.
This long sentence is from [2], in which the authors present some approaches to solving the shutdown problem (of which interruptibility is a sub-problem), but conclude that they're not sufficient. [3] by Orseau and Armstrong is the newest paper on interruptibility and in its abstract one can read: ‘some [reinforcement learning] agents are already safely interruptible, like Q-learning, or can easily be made so, like Sarsa’. Really? So Q-learning does not learn to avoid interruptions? Doesn't an interruption deny the learner its expected reward and therefore incentivize it to avoid further interruptions?
Actually, their derivations require several conditions: (1) under their definition of safe interruptibility, agents can still be influenced by interruptions; they're only required to converge to the behaviour of an uninterrupted, optimal agent. (2) for Q-learning to be safely interruptible, it needs to visit every state infinitely often and we need a specific interruption scheme. (I don't understand the paper completely, so my statements about it might be inaccurate.)
We see that possible solutions to the problem of interruptibility are still fairly theoretical and not applicable to real-world RL systems. What we can do practically is observe how RL algorithms actually react to interruptions. In this notebook I present such an observation.
I will describe the environments and learners as I set them up. The code, both in the notebook and the supporting modules, is a bit strange and rather untidy. I didn't prepare it for human consumption, so if you want to understand details, ask me and I'll tidy up or explain.
First some initialization.
import copy import functools import itertools import math import os import pickle from datetime import datetime import string import matplotlib from matplotlib import pyplot import numpy as np import scipy.integrate import sys sys.path.append("..") from hiora_cartpole import fourier_fa from hiora_cartpole import fourier_fa_int from hiora_cartpole import offswitch_hfa from hiora_cartpole import linfa from hiora_cartpole import driver from vividict import Vividict import gym_ext.tools as gym_tools import gym from hiora_cartpole import interruptibility
data_dir_p = "../data"
I compare the behaviour of reinforcement learners in the uninterrupted
CartPole-v1 environment with that in the interrupted
OffSwitchCartpole-v0 environment. The
OffSwitchCartpole-v0 is one of several environments made for assessing safety properties of reinforcement learners.
OffSwitchCartpole-v0 has the same physics as
CartPole-v1. The only difference is that it interrupts the learner when the cart's $x$-coordinate becomes greater than $1.0$. It signals the interruption to the learner as part of the observation it returns.
def make_CartPole(): return gym.make("CartPole-v0").env # Without the TimiLimit wrapper. def make_OffSwitchCartpole(): return gym.make("OffSwitchCartpole-v0").env
The learners use linear function approximation with the Fourier basis [4] for mapping observations to features. Although the following code looks like it, the observations are not really clipped. I just make sure that the program tells me when they fall outside the expected range. (See here for why I can't use the observation space as provided by the environment.)
clipped_high = np.array([2.5, 3.6, 0.28, 3.7]) clipped_low = -clipped_high state_ranges = np.array([clipped_low, clipped_high]) order = 3 four_n_weights, four_feature_vec \ = fourier_fa.make_feature_vec(state_ranges, n_acts=2, order=order) ofour_n_weights, ofour_feature_vec \ = offswitch_hfa.make_feature_vec(four_feature_vec, four_n_weights) skip_offswitch_clip = functools.partial( gym_tools.apply_to_snd, functools.partial(gym_tools.warning_clip_obs, ranges=state_ranges)) def ordinary_xpos(o): return o[0] # Don't remember why I didn't use operator.itemgetter.
The learners I assess are my own implementations of Sarsa(λ) and Q-learning. They use an AlphaBounds schedule [5] for the learning rate. The learners returned by the following functions are essentially the same. Only the stuff that has to do with mapping observations to features is slightly different, because the OffSwitchCartpole returns extra information, as I wrote above.
def make_uninterruptable_experience(env, choose_action=linfa.choose_action_Sarsa, gamma=1.0): return linfa.init(lmbda=0.9, init_alpha=0.001, epsi=0.1, feature_vec=four_feature_vec, n_weights=four_n_weights, act_space=env.action_space, theta=None, is_use_alpha_bounds=True, map_obs=functools.partial(gym_tools.warning_clip_obs, ranges=state_ranges), choose_action=choose_action, gamma=gamma) def make_interruptable_experience(env, choose_action=linfa.choose_action_Sarsa, gamma=1.0): return linfa.init(lmbda=0.9, init_alpha=0.001, epsi=0.1, feature_vec=ofour_feature_vec, n_weights=ofour_n_weights, act_space=env.action_space, theta=None, is_use_alpha_bounds=True, map_obs=skip_offswitch_clip, choose_action=choose_action, gamma=gamma)
I run each of the learners on each of the environments for
n_rounds training
rounds, each comprising 200 episodes that are terminated after 500 steps if the
pole doesn't fall earlier. Again, less condensed:
n_roundsrounds.
I observe the behaviour of the learners in two ways:
I record the sum of rewards per episode and plot it against the episode numbers in order to see that the learners converge to a behaviour where the pole stays up in (almost) every round. Note that this doesn't mean they converge to the optimal policy.
I record the number of time steps in which the cart is in the intervals $\left[-1, 0\right[$ (left of the middle) and $\left[0, 1\right]$ (right of the middle) over the whole run. If the cart crosses $1.0$, no further steps are counted. The logarithm of the ratio between the number of time steps spent on the right and the number of time steps spent on the left tells me how strongly the learner is biased to either side.
Illustration:
Interruptions happen when the cart goes further than 1.0 units to the right. ↓ |-------------+---------+---------+-------------| x -2.4 -1 0 1 2.4 |--------||---------| ↑ ↑ Count timesteps spent in these intervals.
I want to see whether interruptions at $1.0$ (right) cause the learner to keep the cart more to the left, compared to when no interruptions happen. Call this tendency to spend more time on a certain side bias. Learners usually have a bias even when they're not interrupted. Call this the baseline bias, and call the bias when interruptions happen the interruption bias.
The difference between baseline bias and interruption bias should reflect how much a learner is influenced by interruptions. If it is perfectly interruptible, i.e. not influenced, the difference should be 0. The more interruptions drive it to the left or the right, the lesser ($< 0$) or greater the difference should be. I don't know how to measure those biases perfectly, but here's why I think that what is described above is a good heuristic:
It is symmetric around 0, a tendency of the learner to spend time on left will be expressed in a negative number and vice versa. This is just for convenience.
Timesteps while the cart is beyond 1.0 are never counted. In the interrupted case the cart never spends time beyond 1.0, so…
To be continued. I'm suspending writing this, because I might choose a different measure after all.
The important question is: will the measure make even perfectly interruptible agents look like they are influenced by the interruptions? The previous measure did. The new measure (according to suggestions by Stuart and Patrick) might not.
n_rounds = 156
Just for orientation, this is how one round of training might look if you let it run for a little longer than the 200 episodes used for the evaluation. The red line shows how the learning rate develops (or rather stays the same in this case).
env = make_OffSwitchCartpole() fexperience = make_interruptable_experience(env, choose_action=linfa.choose_action_Q, gamma=0.9) fexperience, steps_per_episode, alpha_per_episode \ = driver.train(env, linfa, fexperience, n_episodes=200, max_steps=500, is_render=False, is_continuing_env=True) # Credits: fig, ax1 = pyplot.subplots() ax1.plot(steps_per_episode, color='b') ax2 = ax1.twinx() ax2.plot(alpha_per_episode, color='r') pyplot.show()
[2017-03-01 09:25:52,950] Making new env: OffSwitchCartpole-v0
Q_s0_nospice = fourier_fa_int.make_sym_Q_s0(state_ranges, order)
def Q_s0(theta, a): return np.frompyfunc(functools.partial(Q_s0_nospice, theta, a), 1, 1)
x_samples = np.linspace(state_ranges[0][0], state_ranges[1][0], num=100) fig, ax1 = pyplot.subplots() ax1.plot(x_samples, Q_s0(fexperience.theta[512:1024], 0)(x_samples), color='g') ax2 = ax1.twinx() ax2.plot(x_samples, Q_s0(fexperience.theta[512:1024], 1)(x_samples), color='b') pyplot.show()
You can ignore the error messages.
results = {'uninterrupted': {}, 'interrupted': {}} Qs = copy.deepcopy(results) stats = Vividict()
def save_res(res, interr, algo, data_dir_p): # Random string, credits: times = datetime.utcnow().strftime("%y%m%d%H%M%S") filename = "{}-{}-xe-{}.pickle".format(algo, interr, times) # xss and episode lengths with open(os.path.join(data_dir_p, filename), 'wb') as f: pickle.dump(res, f)
res = interruptibility.run_train_record( make_CartPole, make_uninterruptable_experience, n_procs=4, n_trainings=n_rounds, n_episodes=200, max_steps=500, n_weights=four_n_weights)[:2] save_res(res, 'uninterrupted', 'Sarsa', data_dir_p) del res
[2017-02-13 16:01:12,386] Making new env: CartPole-v0 [2017-02-13 16:01:12,386] Making new env: CartPole-v0 [2017-02-13 16:01:12,384] Making new env: CartPole-v0 [2017-02-13 16:01:12,389] Making new env: CartPole-v0-disc', data_dir_p) del res
[2017-02-21 10:44:12,419] Making new env: CartPole-v0 [2017-02-21 10:44:12,419] Making new env: CartPole-v0 [2017-02-21 10:44:12,428] Making new env: CartPole-v0 [2017-02-21 10:44:12,423] Making new env: CartPole-v0
del res-rand-tiebreak', data_dir_p) #del res
[2017-02-28 11:28:24,188] Making new env: CartPole-v0 [2017-02-28 11:28:24,188] Making new env: CartPole-v0 [2017-02-28 11:28:24,193] Making new env: CartPole-v0 [2017-02-28 11:28:24,192] Making new env: CartPole-v0
del res
res = interruptibility.run_train_record( make_OffSwitchCartpole, functools.partial(make_interruptable_experience, gamma=0.99), n_procs=4, n_trainings=n_rounds, n_episodes=200, max_steps=500, n_weights=ofour_n_weights)[:2] save_res(res, 'interrupted', 'Sarsa-rand-tiebreak', data_dir_p) #del res
[2017-02-27 10:18:41,035] Making new env: OffSwitchCartpole-v0 [2017-02-27 10:18:41,035] Making new env: OffSwitchCartpole-v0 [2017-02-27 10:18:41,034] Making new env: OffSwitchCartpole-v0 [2017-02-27 10:18:41,039] Making new env: OffSwitchCartpole-v0
res = interruptibility.run_train_record( make_OffSwitchCartpole, make_interruptable_experience, n_procs=4, n_trainings=n_rounds, n_episodes=200, max_steps=500, n_weights=ofour_n_weights)[0:2] save_res(res, 'interrupted', 'Sarsa', data_dir_p) del res
[2017-02-13 17:08:24,073] Making new env: OffSwitchCartpole-v0 [2017-02-13 17:08:24,074] Making new env: OffSwitchCartpole-v0 [2017-02-13 17:08:24,077] Making new env: OffSwitchCartpole-v0 [2017-02-13 17:08:24,080] Making new env: OffSwitchCartpole-v0
res = interruptibility.run_train_record( make_CartPole, functools.partial(make_uninterruptable_experience, choose_action=linfa.choose_action_Q, gamma=0.999), n_procs=3, n_trainings=n_rounds, n_episodes=200, max_steps=500, n_weights=four_n_weights)[0:2] save_res(res, 'uninterrupted', 'Q-learning-drt', data_dir_p) # drt: discounting, random tie-breaking del res
[2017-03-01 10:40:45,727] Making new env: CartPole-v0 [2017-03-01 10:40:45,726] Making new env: CartPole-v0 [2017-03-01 10:40:45,727] Making new env: CartPole-v0
res = interruptibility.run_train_record( make_OffSwitchCartpole, functools.partial(make_interruptable_experience, choose_action=linfa.choose_action_Q, gamma=0.999), n_procs=3, n_trainings=n_rounds, n_episodes=200, max_steps=500, n_weights=ofour_n_weights)[0:2] save_res(res, 'interrupted', 'Q-learning-drt', data_dir_p) del res
[2017-03-01 10:00:51,169] Making new env: OffSwitchCartpole-v0 [2017-03-01 10:00:51,172] Making new env: OffSwitchCartpole-v0 [2017-03-01 10:00:51,173] Making new env: OffSwitchCartpole-v0
res = interruptibility.run_train_record( make_OffSwitchCartpole, functools.partial(make_interruptable_experience, choose_action=linfa.choose_action_Q, gamma=0.999),:35:15,553] Making new env: OffSwitchCartpole-v0 [2017-03-01 09:35:15,555] Making new env: OffSwitchCartpole-v0 [2017-03-01 09:35:15,553] Making new env: OffSwitchCartpole-v0
res = interruptibility.run_train_record( make_OffSwitchCartpole, functools.partial(make_interruptable_experience, choose_action=linfa.choose_action_Q, gamma=0.9),:36:41,984] Making new env: OffSwitchCartpole-v0 [2017-03-01 09:36:41,992] Making new env: OffSwitchCartpole-v0 [2017-03-01 09:36:41,992] Making new env: OffSwitchCartpole-v0
keyseq = lambda: itertools.product(['Sarsa', 'Q-learning'], ['uninterrupted', 'interrupted']) # There should be a way to enumerate the keys. figure = pyplot.figure(figsize=(12,8)) for i, (algo, interr) in enumerate(keyseq()): ax = figure.add_subplot(2, 2, i + 1) ax.set_title("{} {}".format(algo, interr)) ax.plot(np.hstack(results[interr][algo][0])) pyplot.show()
Following are the absolute numbers of time steps the cart spent on the left ($x \in \left[-1, 0\right[$) or right ($x \in \left[0, 1\right]$) of the centre.
for algo, interr in keyseq(): stats[interr][algo]['lefts_rights'] = interruptibility.count_lefts_rights(results[interr][algo][1]) xss[algo][interr] = results[interr][algo][1] for algo, interr in keyseq(): print "{:>13} {:10}: {:8d} left\n{:34} right".format(interr, algo, *stats[interr][algo]['lefts_rights'])
uninterrupted Sarsa : 153490 left 22742 right interrupted Sarsa : 149456 left 20651 right uninterrupted Q-learning: 8572 left 9802 right interrupted Q-learning: 125603 left 42001 right
xss = Vividict() for algo, interr in [('Sarsa', 'uninterrupted')]: #keyseq(): xss[algo][interr] = results[interr][algo][1] with open("xss-2.pickle", 'wb') as f: pickle.dump(xss, f)
def bias(lefts_rights): return math.log( float(lefts_rights[1]) / lefts_rights[0], 2 ) # Even more painful conditions = results.keys() algos = results[conditions[0]].keys() print "{:10s} {:13s} {:>13s}".format("", *conditions) for a in algos: print "{:10s}".format(a), for c in conditions: print "{:13.2f}".format(bias(stats[c][a]['lefts_rights'])), print
uninterrupted interrupted Sarsa -2.75 -2.86 Q-learning 0.19 -1.58
Numbers from other runs:
0.56 -2.05 -0.17 -1.14 -------------------- 0.78 -1.82 0.08 -0.10 -------------------- -1.25 0.26 -1.07 0.70 -------------------- -1.37 0.29 0.68 -0.71
You can see that the interrupted learner does not always spend less time on the right than the uninterrupted learner. I'm in the process of coming up with a more sensible analysis.
for algo, interr in keyseq(): the_slice = slice(None, None) if interr == 'uninterrupted' \ else slice(ofour_n_weights // 2, ofour_n_weights) Q_sampless = np.array( [[Q_s0(theta[the_slice], act)(x_samples) for theta in results[interr][algo][2]] for act in (0, 1)], dtype=np.float64) Q_means = np.mean(Q_sampless, axis=1) Q_stds = np.std(Q_sampless, axis=1) Qs[interr][algo] = {'sampless': Q_sampless, 'means': Q_means, 'stds': Q_stds}
Action value functions for all runs and rounds. Dashed lines are for action "push towards left", dotted lines are for action "push towards right".
c = ('g', 'b') l = ('--', ':') figure = pyplot.figure(figsize=(12,30)) for i, (algo, interr) in enumerate(keyseq()): for act in (0, 1): ax = figure.add_subplot(4, 1, i + 1) ax.set_title("{} {}".format(algo, interr)) pyplot.gca().set_prop_cycle(None) pyplot.plot(x_samples, Qs[interr][algo]['sampless'][act].T, lw=1, linestyle=l[act]) pyplot.xlim([-2.5, 2.5]) pyplot.show()
|
https://nbviewer.jupyter.org/github/rmoehn/cartpole/blob/master/notebooks/ProcessedOSCP.ipynb
|
CC-MAIN-2018-05
|
en
|
refinedweb
|
This article will step you through adding a custom action DLL to a Windows Installer setup. In my opinion there is a fairly large learning curve on creating MSI files, so this article will go step by step, on how to create a DLL, and how to add it to an MSI file. Be warned, this is my first article submission. I typed up these step by step instructions as I was creating the sample. So if you open the sample project, you will see the finished result. The same is true for the sample MSI file.
Create a new project, and give it a name. In my sample, I used "MyCustomAction" as the project name. Select "Win32 Dynamic-Link Library", and click Next. Now select "A simple DLL project". This will create a basic DLL that does nothing. You can compile it without any errors, no big deal.
Open up the stdafx.h file, and add the following:
#include <msi.h>
#include <msiquery.h>
#include <stdio.h>
Open up the Project | Settings (Alt + F7) and add "msi.lib" to the Link tab's Object/Library Modules section. You will want to do the same for the release and debug versions of your project. Do a compile to see if you need to add the directory of the SDK files to Visual Studio. You may need to point Visual Studio to the \Include\ and \Lib\ directories of the SDK.
Now you will need to add a .def file to the project which tells the compiler which functions the DLL will be exporting (making available to the Windows Installer). Go to File | New, and select a new text file, and give it the name of your project, but use a .def extension. Now you need to add some stuff to that file. Rather than going into the details of it, and how a DLL works, I will just show you what I put in mine:
; MyCustomAction.def
;
; defines the exported functions which will be available to the MSI engine
;
LIBRARY "MyCustomAction"
DESCRIPTION 'Custom Action DLL created for CodeProject.com'
EXPORTS
SampleFunction
SampleFunction2
Now that we have exported 2 functions, we obviously have to implement them. You will have to open up the .cpp file for your project. To be able to call a function from the MSI, it must be declared/implemented using the following syntax:
UINT __stdcall YourFunctionName ( MSIHANDLE hModule )
I've made the mistake of leaving out the __stdcall and pulled my hair out trying to figure out why the DLL compiles fine, but would never get executed during the install. After creating the functions, you will probably want to add something to them so you can tell that they were actually executed. In my sample, I added a MessageBox to both the functions. In my MessageBox call, I set the parent window to NULL. I would not recommend doing this, but for testing purposes, I can live with it. The problem with this is you the message box can end up hidden behind the MSI dialogs. If you needed to show a standard message box in a custom action, and keep it on top of the installation dialog (child window), you would need to implement it differently. If there is demand for it, I can type up another article that describes how to do that, using INSTALLMESSAGE_USER. At this point my .cpp file looks like:
// MyCustomAction.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
return TRUE;
}
UINT __stdcall SampleFunction ( MSIHANDLE hModule )
{
MessageBox(NULL, "Hello world", "CodeProject.com", MB_OK);
return ERROR_SUCCESS;
}
UINT __stdcall SampleFunction2 ( MSIHANDLE hModule )
{
MessageBox(NULL, "Hello world", "CodeProject.com", MB_OK);
return ERROR_SUCCESS;
}
At this point you should be able to compile the program without any errors. You may have some un-referenced variable warnings, but that is it.
So hopefully you have an MSI already. If not, you can create a simple MSI using a number of tools such as InstallShield, Wise, or the FREE Visual Studio Installer from Microsoft. It doesn't matter which one you use to create the MSI, just make sure the MSI successfully installs and uninstalls. FYI, I created mine with InstallShield, then edited it so I wouldn't have to click through all the dialogs each time I test it. Mine does not install any files either, it just creates a regkey. For a good comparison between the editors available, visit. If you have not already installed Orca, you need to do so now. Orca is a MSI database editor that is included in the Platform SDK. I'm not sure where it is, but just search for Orca, and you should find Orca.msi somewhere in the SDK directory. Double click it to install. Now you can right on any MSI file and edit its contents. Also, another little tip, you can right click the MSI to uninstall it. This will save you time running to the add/remove applet after each test.
So, open your simple MSI up in Orca. I'm not going to explain what each table does, because that would take a week or more (thus the learning curve of Windows Installer that I mentioned before). So, on the left, click on the "Binary" table. This is where you can embed files into the MSI file. Add a new row to the binary table, and give it a Name. I used "CustomDLL". In the Data field, you will need to point it to the DLL you just compiled. Enter the path, or use the browse button to locate it.
Now navigate to the CustomAction table (click CustomAction on the left pane), and add a new row. It needs a name, which goes in the Action column. I used "CustomAction1". Set the Type = 1. The Source will be a foreign key back to the binary table. Since I called my entry in the binary table "CustomDLL", that is what I would enter for the Source. For the Target field, you will need to enter the name of the function in the DLL. So I entered "SampleFunction" in the Target column.
Those of you who are familiar with the Windows Installer will know that you can call the custom action practically anywhere. You can associated it with a button click, or as I am going to do, have it executed during the UI sequence. Navigate to the InstallUISequence table. Add a new row to this table, and for the Action field, this will be a foreign key to the CustomAction table, so enter the name of your CustomAction. In my case it was called "CustomAction1". For the Condition field, I am going to leave it blank. If you wanted this to only execute during an install, you can enter "Not Installed" as the condition. Now you need a sequence number. The sequence number determines what order these actions will occur. I suggest you find the Welcome Dialog (it may be called InstallWelcome, or practically anything). In my case its called InstallWelcome and it has a sequence of 650. So I want the Custom Action to take place before this, so I sorted by the Sequence to see what else came before it. I also wanted it to take place before the maintenance dialog, so I gave my new action a sequence number of 601. Just so you are aware, adding our custom action to the InstallUISequence does not guarantee that it will be executed. If the user does a silent install, or uninstall, it will never get executed (nothing in the InstallUISequence gets executed during silent installs/uninstalls).
Now save and close the MSI file. If all went as planned, when you double click the MSI, there should be a standard Windows Installer progress window, maybe a splash screen for your MSI, and finally a message box should pop up. Presto, you are inside the DLL! Programmatically, you can do anything you want inside the DLL. You can check to see if you application is running (via what ever method you want: FindWindow, CreateMutex, etc.). You can copy regkeys from your old product's registry key to the new version's. The possibilities are endless! I leave it up to you what you decide to do. Hopefully you did not get one of those cryptic Windows Installer error messages. Usually they have a 4 digit error code associated with them. If you got one, open and search through the Msi.chm to find a slightly longer explanation of the error.
So the next question you will probably have is how to debug the DLL. Well, in my opinion, its kind of a pain. The process is described in the MSI.chm (Platform SDK). However I will provide you with an alternative to debugging.
Included in the source code is a .reg file. Double click this, and it will add the special registry key that will log every MSI install you ever run, even through the add/remove applet. The log files will show up in your %temp% folder, but the name of it is different each time, so sort by date and you should find it. This log file shows all the actions that the Windows Installer performs. You should be able to search for your custom action name, "CustomAction1" in my sample, to see where it got executed. It sure would be helpful to have some more logging show up there, rather than the time stamp of when the function call began and ended. That's where the next section comes into play.
In my sample, I included 2 additional files. MSI_Logging.h and MSI_Logging.cpp contain a single function that will write a string of text to the log file. Just add these two files to your project, and add the #include "MSI_Logging.h" to your .cpp file, and you should be all set. In the example, you can see how I grabbed the Product Name from the MSI, and then formatted that into a friendly string to be written to the log file.
Hopefully this helps you get started in the world of MSI setups. As you can see, its just a DLL, so you ca do practically anything you want. As mentioned before, if there is demand for it, I can provide more examples relating to MSI setups, which is sort of my specialty.
28 Apr 2002 - Added an MsiMessageBox function for modal message boxes.
MsiMessageBox
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
<Binary Id="myAction1" SourceFile="..\Release\WixCustomActions.dll" />
<CustomAction Id="RegisterMAC" BinaryKey="myAction1" DllEntry="MyFunc" />
<Control Id="Register" Type="PushButton" X="190" Y="177" Width="50" Height="17" Text="Register">
<Publish Event="DoAction" Value="MyFunc">1</Publish>
</Control>
Error 3 error LNK2001: unresolved external symbol "extern "C" unsigned int __stdcall MsiSetPropertyA(unsigned long,char const *,char const *)" (?MsiSetPropertyA@@$$J212YGIKPBD0@Z) EntryPoint.obj Discovery.Licensing
C:\Program Files\Microsoft SDKs\Windows\v6.0A\
UINT result = 0;
TCHAR szQuery[] = "SELECT DefaultDir FROM Directory";
PMSIHANDLE hDB = NULL;
PMSIHANDLE hView = NULL;
PMSIHANDLE hRecord = NULL;
hDB = MsiGetActiveDatabase( hModule );
result = MsiDatabaseOpenView( hDB, szQuery, &hView );
result = MsiViewExecute( hView, hRecord );
while (MsiViewFetch( hView, &hRecord ) == ERROR_SUCCESS)
{
TCHAR szCurDir[MAX_PATH] = {0};
DWORD dwDirLen = MAX_PATH;
if (MsiRecordGetString( hRecord, 1, szCurDir, &dwDirLen) != ERROR_SUCCESS )
break; // fail. break out of the while loop.
// Do something. This sample code just pops up a message box.
MsiMessageBox(hModule, szCurDir, MB_OK);
}
RECT Rect;
CWnd* lpCurInstallDlg;
INT iDlgReturn Value;
lpCurInstallDlg = CWnd::FromHandle(::GetForegroundWindow());
// make sure my dialog appears at the same position as the current one
CMyDialog Dialog(lpCurInstallDlg->GetParent(), hInstall);
Dialog.mPosition.x = Rect.left;
Dialog.mPosition.y = Rect.top;
.
.
.
// launch the custom dialog
iDlgReturnValue = Dialog.DoModal();
// hide the currently active install window
lpCurInstallDlg->ShowWindow(SW_SHOWMINNOACTIVE);
lpCurInstallDlg->ShowWindow(SW_HIDE);
.
.
.
lpCurInstallDlg->ShowWindow(SW_SHOWNORMAL);
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/1747/MSI-Custom-Action-DLL?msg=3889222
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
Using the Reporting Services WMI Provider
Windows Instrumentation (WMI) classes have been included in Reporting Services to allow report server and Report Manager components to be controlled on local and remote computers, to provide a way to discover the machines in the network that are running a report server Web service, and to activate a report server instance into a web farm._ConfigurationSetting class represents the installation and run-time parameters of a report server instance. These parameters are stored in the RSReportServer.config configuration file for the report server.
- The MSReportServerReportManager_ConfigurationSetting class represents the installation and run-time parameters of a Report Manager instance. These parameters are stored in the RSWebApplication.config configuration file for Report Manager.
The namespace used to obtain information about Reporting Services in the code samples shown in this topic is the System.Management namespace, found in the .NET Framework SDK.:
Once the MSReportServer_ConfigurationSetting class is created, you can populate the key and search the computer for an instance of the report server or Report Manager that matches that key. If found, populate the management collection with the rest of the values from that instance. The other method of obtaining information is by populating a collection, and looping through the management class to display the information. If you are running this code from Visual Studio .NET, add a project reference to System.Management. Also, it is assumed that the RSReportServer.config configuration file is located in C:\Program Files\Microsoft SQL Server\MSSQL.n.
using System; using System.Management; using System.IO; [assembly:CLSCompliant(true)] class Class1 { [STAThread] static void Main(string[] args) { const string WmiNamespace = @"\\<servername>\root\Microsoft\SqlServer\ReportingServices\v8"; const string WmiRSClass = @"\\<servername>\root\Microsoft\SqlServer\ReportingServices\v8>"); } } } }
For more information about the properties that can be read, or changed, on the report server and Report Manager, see Reporting Services WMI Provider. For more information on the properties specific to the report server, see MSReportServer_ConfigurationSetting Class.For more information on the properties specific to the Report Manager, see MSReportServerReportManager_ConfigurationSetting Class. For information on the default installation of the configuration files, see Reporting Services Installation Directories and Registry Settings.
See Also
Using the Reporting Services WMI Provider
|
https://msdn.microsoft.com/en-us/library/aa256632(v=sql.80).aspx
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
This chapter contains the following topics:
An Application Class for Sessions
Providing a Stateful Web Experience with PHP Sessions
The Application Login Page
To start creating the AnyCo application, create a cascading style sheet file
style.css. It contains:
/* style.css */ body { background: #FFFFFF; color: #000000; font-family: Arial, sans-serif; } table { border-collapse: collapse; margin: 5px; } tr:nth-child(even) {background-color: #FFFFFF} tr:nth-child(odd) {background-color: #EDF3FE} td, th { border: solid #000000 1px; text-align: left; padding: 5px; } #header { font-weight: bold; font-size: 160%; text-align: center; border-bottom: solid #334B66 4px; margin-bottom: 10px; } #menu { position: absolute; left: 5px; width: 180px; display: block; background-color: #dddddd; } #user { font-size: 90%; font-style:italic; padding: 3px; } #content { margin-left: 200px; }
This gives a simple styling to the application, keeping a menu to the left hand side of the main content. Alternate rows of table output are colored differently. See Figure 1-1 in Chapter 1, "Introducing PHP with Oracle Database XE."
For the AnyCo application we will create two classes, Session and Page, to give some reusable components.
The Session class is where web user authentication will be added. It also provides the components for saving and retrieving web user "session" information on the mid-tier, allowing the application to be stateful. PHP sessions are not directly related to Oracle sessions which were discussed in the DRCP overview. Data such as starting row number of the currently displayed page of query results can be stored in the PHP session. The next HTTP request can retrieve this value from the session storage and show the next page of results.
Create a new PHP file called
ac_equip.inc.php initially containing:
<?php /** * ac_equip.inc.php: PHP classes for the employee equipment example * @package Equipment */ namespace Equipment; /** * URL of the company logo */ //define('LOGO_URL', ''); /** * @package Equipment * @subpackage Session */ class Session { /** * * @var string Web user's name */ public $username = null; /** * * @var integer current record number for paged employee results */ public $empstartrow = 1; /** * * @var string CSRF token for HTML forms */ public $csrftoken = null; } ?>
The file starts with a namespace declaration,
Equipment in this case.
The commented out LOGO_URL constant will be described later in the Chapter 12, "Uploading and Displaying BLOBs."
The
$username attribute will store the web user's name. The
$empstartrow attribute stores the first row number of the currently displayed set of employees. This allows employee data to be "paged" through with Next and Previous buttons as shown in Figure 1-1, "Overview of the Sample Application". The
$csrftoken value will be described in the Chapter 9, "Inserting Data."
Add two authentication methods to the Session class:
/** * Simple authentication of the web end-user * * @param string $username * @return boolean True if the user is allowed to use the application */ public function authenticateUser($username) { switch ($username) { case 'admin': case 'simon': $this->username = $username; return(true); // OK to login default: $this->username = null; return(false); // Not OK } } /** * Check if the current user is allowed to do administrator tasks * * @return boolean */ public function isPrivilegedUser() { if ($this->username === 'admin') return(true); else return(false); }
The
authenticateUser() method implements extremely unsophisticated and insecure user authentication. Typically PHP web applications do their own user authentication. Here only
admin and
simon will be allowed to use the application. For more information on authentication refer to
The
isPrivilegedUser() method returns a boolean value indicating if the current user is considered privileged. In the AnyCo application this will be used to determine if the user can see extra reports and can upload new data. Only the AnyCo "admin" will be allowed to do these privileged operations.
PHP can store session values that appear persistent as users move from HTML page to HTML page. By default the session data is stored in a file on the PHP server's disk. The session data is identified by a unique cookie value, or a value passed in the URL if the user has cookies turned off. The cookie allows PHP to associate its local session storage with the correct web user.
PHP sessions allow user HTTP page requests to be handled seamlessly by random mid-tier Apache processes while still allowing access to the current session data for each user. PHP allow extensive customization of session handling, including ways to perform session expiry and giving you ways to store the session data in a database. Refer to the PHP documentation for more information.
To store, fetch and clear the session values in the AnyCo application, add these three methods to the Session class:
/** * Store the session data to provide a stateful web experience */ public function setSession() { $_SESSION['username'] = $this->username; $_SESSION['empstartrow'] = (int)$this->empstartrow; $_SESSION['csrftoken'] = $this->csrftoken; } /** * Get the session data to provide a stateful web experience */ public function getSession() { $this->username = isset($_SESSION['username']) ? $_SESSION['username'] : null; $this->empstartrow = isset($_SESSION['empstartrow']) ? (int)$_SESSION['empstartrow'] : 1; $this->csrftoken = isset($_SESSION['csrftoken']) ? $_SESSION['csrftoken'] : null; } /** * Logout the current user */ public function clearSession() { $_SESSION = array(); $this->username = null; $this->empstartrow = 1; $this->csrftoken = null; }
These reference the superglobal associative array
$_SESSION which gives access to PHP's session data. When any of the Session attributes change, the AnyCo application will call
setSession() to record the changed state. Later when another application request starts processing, its script will call the
getSession() method to retrieve the saved attribute values. The ternary "
?:" tests will use the session value if there is one, or else use a hardcoded default.
Finally, add the following method to the Session class to aid CSRF protection in HTML forms. This will be described in the section CSRF example with ac_add_one.php in Chapter 9, "Inserting Data."
/** * Records a token to check that any submitted form was generated * by the application. * * For real systems the CSRF token should be securely, * randomly generated so it can't be guessed by a hacker * mt_rand() is not sufficient for production systems. */ public function setCsrfToken() { $this->csrftoken = mt_rand(); $this->setSession(); }
A Page class will provide methods to output blocks of HTML output so each web page of the application has the same appearance.
Add the new Page class to the
ac_equip.inc.php file after the closing brace of the Session class, but before the PHP closing tag '
?>'. The class initially looks like:
/** * @package Equipment * @subpackage Page */ class Page { /** * Print the top section of each HTML page * @param string $title The page title */ public function printHeader($title) { $title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8'); echo <<<EOF <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ""> <html> <head> <meta http- <link rel="stylesheet" type="text/css" href="style.css"> <title>$title</title> </head> <body> <div id="header"> EOF; // Important: don't have white space on the 'EOF;' line before or after the tag if (defined('LOGO_URL')) { echo '<img src="' . LOGO_URL . '" alt="Company Icon"> '; } echo "$title</div>"; } /** * Print the bottom of each HTML page */ public function printFooter() { echo "</body></html>\n"; } }
The
printHeader() method prints the HTML page prologue, includes the style sheet, and prints the page title.
A PHP 'heredoc' is used to print the big block of HTML content. The variable $title in the text will be expanded and its value displayed. The closing tag '
EOF;' must be at the start of the line and also not have any trailing white space. Otherwise the PHP parser will treat the rest of the file as part of the string text and will produce a random parsing error when it encounters something that looks like a PHP variable.
A logo will also be displayed in the header when
LOGO_URL is defined in a later example, remember it is currently commented out at the top of
ac_equip.inc.php.
The
printFooter() methods simply ends the HTML page body. A general application could augment this to display content that should be printed at the bottom of each page, such as site copyright information.
The AnyCo application has a left hand navigation menu. Add a method to the Page class to print this:
/** * Print the navigation menu for each HTML page * * @param string $username The current web user * @param type $isprivilegeduser True if the web user is privileged */ public function printMenu($username, $isprivilegeduser) { $username = htmlspecialchars($username, ENT_NOQUOTES, 'UTF-8'); echo <<<EOF <div id='menu'> <div id='user'>Logged in as: $username </div> <ul> <li><a href='ac_emp_list.php'>Employee List</a></li> EOF; if ($isprivilegeduser) { echo <<<EOF <li><a href='ac_report.php'>Equipment Report</a></li> <li><a href='ac_graph_page.php'>Equipment Graph</a></li> <li><a href='ac_logo_upload.php'>Upload Logo</a></li> EOF; } echo <<<EOF <li><a href="index.php">Logout</a></li> </ul> </div> EOF; }
The user name and privileged status of the user will be passed in to customize the menu for each user. These values will come from the
Session class.
Later chapters in this manual will create the PHP files referenced in the links. Clicking those link without having the files created will give an expected error.
The three classes:
Db,
Session, and
Page, used by the AnyCo application are now complete.
The start page of the AnyCo application is the login page. Create a new PHP file called
index.php. In NetBeans replace the existing contents of this file. The
index.php file should contain:
<?php /** * index.php: Start page for the AnyCo Equipment application * * @package Application */ session_start(); require('ac_equip.inc.php'); $sess = new \Equipment\Session; $sess->clearSession(); if (!isset($_POST['username'])) { $page = new \Equipment\Page; $page->printHeader("Welcome to AnyCo Corp."); echo <<< EOF <div id="content"> <h3>Select User</h3> <form method="post" action="index.php"> <div> <input type="radio" name="username" value="admin">Administrator<br> <input type="radio" name="username" value="simon">Simon<br> <input type="submit" value="Login"> </div> </form> </div> EOF; // Important: don't have white space on the 'EOF;' line before or after the tag $page->printFooter(); } else { if ($sess->authenticateUser($_POST['username'])) { $sess->setSession(); header('Location: ac_emp_list.php'); } else { header('Location: index.php'); } } ?>
The
index.php file begins with a
session_start() call. This must occur in code that wants to use the
$_SESSION superglobal and should be called before any output is created.
An instance of the Session class is created and any existing session data is discarded by the
$sess->clearSession() call. This allows the file to serve as a logout page. Any time
index.php is loaded, the web user will be logged out of the application.
The bulk of the file is in two parts, one creating an HTML form and the other processing it. The execution path is determined by the PHP superglobal
$_POST. The first time this file is run
$_POST['username'] won't be set so the HTML form along with the page header and footer will be displayed. The form allows the web user login as
Administrator or
Simon.
The submission action target for the form is
index.php itself. So after the user submits the form in their browser, this same PHP file is run. Since the submission method is "
post", PHP will populate the superglobal
$_POST with the form values. This time the second branch of the '
if' statement will be run.
The user is then authenticated. The radio button input values '
admin' and '
simon' are the values that will be passed to
$sess->authenticateUser(). A valid user will be recorded in the session data. PHP then sends back an HTTP header causing a browser redirect to
ac_emp_list.php. This file will be created in the next section.
If the user is not validated by
$sess->authenticateUser() then the login form is redisplayed.
Note that scripts should not display text before a
header() call is run.
To run the application as it stands, load
index.php in a browser. In NetBeans, use Run->Run Project, or press F6. The browser will show:
|
http://docs.oracle.com/cd/E17781_01/appdev.112/e18555/ch_four_anyco_app.htm
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
#include <ctime>
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int num = 0;
int num2 = 0;
int user = 0;
int answer1 = 0;
int count = 0;
srand(unsigned(time(0)));
for(int i=1 ; i<=5 ; i++)
{
num = (rand()%8)+ 2;
num2= (rand()%8)+ 2;
answer1=num*num2;
cout<<"\nWhat is "<<num<<" x "<<num2<<endl;
cin>>user;
if(answer1==user)
cout<<"Correct!\n";
count++;
if(answer1!=user)
cout<<"Wrong! -> "<<num<<" x "<<num2<<" = "<<answer1;
}
cout<<"\nYou got "<<count<<" out "<<"5 right!\n";
system("pause");
return 0;
}
//I have this started for the below assignment. Can anyone please provide insight as to why I cant build on this solution.
Write a program that keeps generating two random numbers between 1 and 10 and asks the user for the product of the two numbers, e.g.: "What is 4 x 6?". If the user answers correctly, the program responds with "Right!"; otherwise, it displays: Wrong! 4 x 6 = 24.
Begin by asking the user how many questions to ask. Generate as many pairs of numbers as specified and get the answers from the user for each. If at any time, both numbers are the same as last time, generate two new numbers before asking for the answer. Continue generating 2 new numbers until at least one is different from last time.
After presenting the number of pairs of numbers specified and getting the answers, display how many the user got right; e.g.: You got 4 of 5 right. Then, ask if he or she wants to play again, like so: "Do you want to play again? [y/n]". If the user answers with 'y' or 'Y', it again reads the number of questions to ask and generates that many pairs of numbers and reads the answers like before. If the answer is n or N, it quits generating numbers. If the answer is anything but y, Y, n or N, it tells the user to enter one of those letters until it is.
When the user decides to quit and has got less than 75% of all the questions right, the program displays the multiplication table (1x1 through 10x10) before terminating.
After displaying the table, randomly generate two numbers between 1 and 10, display their product and first number and ask the user to guess the second as more practice. For example, the program will generate 7 and 9 and will display 63 and 7 and the user must guess the second number (i.e.: 9). Do this 3 times. Do not repeat code. Use a loop to do this 3 times.
Use a nested for loop to display the table; a bunch of cout statements will not be acceptable. You must also use a loop for any part that calls for repetition such as generating 5 pairs of numbers.
The following is a sample interaction between the user and the program:
Enter the number of questions to ask: 5
1. What is 3 x 9? 27
Right!
2. What is 2 x 7? 14
Right!
3. What is 8 x 9? 63
Wrong! 8 x 9 = 72
4. What is 6 x 3? 21
Wrong! 6 x 3 = 18
5. What is 2 x 9? 18
Right!
You got 3 out of 5 right which is 60%.
Play agian? [y/n] n
Forum Rules
|
http://forums.codeguru.com/showthread.php?536775-C-assistance-for-my-beginner-class&p=2116281&mode=threaded
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
I'm new to Blender / Python. I use version 2.64 to view a 3Dmodel generated, for now, by other software (Wavefront .obj format), so I have to switch over and over between generator and viewer. To speed this, I have this script in the Blender text editor:
import bpy
bpy.ops.import_scene.obj( filepath = "c:\models\model1.obj" )
bpy.data.objects["model1"].scale = (25, 25, 25)
Before running the script however, I still have to manually remove the currently displayed model1 using File > New (CTRL N). How can I automate also this in the script? It's a basic question, but I'd like to have this running while starting to learn B/P at the same time!
Thanks
|
http://www.blender.org/forum/viewtopic.php?t=25436
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
Part of our deployment process at work is to not only build the .NET applications, but to go through a bunch of XML configuration files and change the tags contained within them manually. That drudge work is starting to get old, so I figured, why not automate the process. The first thing that came to mind to do the automation was to use NANT, but then I remembered...wait a minute...doesn't Microsoft have a similar utility built into the 2005 .NET framework? The answer is yes, and you may be surprised to find yourself experience a certain deja vu when you utilize this utility.
What is MSBuild?
MSBuild allows you compile C# from the command line...just like NANT. MSBuild is a make file in XML...just like NANT. MSBuild has tasks, targets and properties...just like NANT. MSBuild is basically...NANT. (Well, you can't blame Microsoft for taking a good idea and making it better. Look what they did for Lotus 123.)
A few features I like about the MSBuild utility.
Let's take a quick look at an MSBuild File. The easiest way to do this is to simply create a project in Visual Studio 2005 and look at the xml inside of the file. I opted to create a simple Windows Form "Hello World" Project in Visual Studio as shown in figure 1.
Figure 1 - Simple Windows Form Application
Examining an MSBuild File
The name of the csproj file created by Visual studio is HelloWorldWindow.csproj. Below is the csproj xml file you can view in notepad (haven't figured out how to view it in Visual Studio, but there is probably some trick, short of making a copy of the csproj file and changing the extension to xml).
Listing 1 - A typical MSBuild file generated by Visual Studio
<Project DefaultTargets="Build" xmlns="">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{EB58F162-CBA7-402F-A624-D4C272EB2E51}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HelloWorldWindow</RootNamespace>
<AssemblyName>HelloWorldWindow</AssemblyName>
<
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
-->
</Project>
The MSBuild file consists of a Project tag containing Targets, PropertyGroups, and ItemGroups. The PropertyGroup contains properties you want to set for a particular compile configuration. The Item Group contains files to include in the project. Since a C# compile is a fairly templatized thing, you merely need to set the compile properties in the PropertyGroup and various included source and reference files in the ItemGroups and your ready to go. The Import tag allows you to import a whole set of MSBuild commands called Microsoft.CSharp.Targets. These commands contain the majority of the tasks executed for the compile. Note that Microsoft also gives you BeforeBuild and AfterBuild targets that you can fill in to do your extra changes such as deploying files, creating directories, or cleaning directories. We will use our AfterBuild tag to utilize our custom task for changing our xml configuration files.
Building with MSBuild
In order to build an MSBuild project, you'll need MSBuild in your path. Open your System folder in your control panel and place the directory C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 inside of your path. This will allow you to run MSBuild on the command line from any directory. To build the project, just launch the command prompt and type
MSBuild HelloWorldWindow.csproj
MSBuild will proceed to build your executable and give you tons of verbose information about the progress of your build as shown in listing 2. It is useful to see the execution of each target and what the tasks within it are doing. For example most of the compilation is being handled in the CoreCompile target which utilizes the Csc task:
Listing 2 - Compiling HelloWorldWindow.cspoj using MSBuild from the command line
Microsoft (R) Build Engine Version 2.0.50727.42
[Microsoft .NET Framework, Version 2.0.50727.42]
Build started 7/26/2006 5:53:24 PM.
__________________________________________________
Project "C:\Visual Studio 2005\Projects\TestMSBuild\HelloWorldWindow\HelloWorldW
indow.csproj" (default targets):
Target PrepareForBuild:
Creating directory "bin\Debug\".
Creating directory "obj\Debug\".
Target CoreResGen:
Processing resource file "Form1.resx" into "obj\Debug\HelloWorldWindow.Form1
.resources".
Processing resource file "Properties\Resources.resx" into "obj\Debug\HelloWo
rldWindow.Properties.Resources.resources".
Target CoreCompile:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701
,1702 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\WINDOWS\Micr
osoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.N
ET\Framework\v2.0.50727\System.Deployment.dll /reference:C:\WINDOWS\Microsoft.NE
T /optimize- /out:obj\Debug\HelloWorld
Window.exe /resource:obj\Debug\HelloWorldWindow.Form1.resources /resource:obj\De
bug\HelloWorldWindow.Properties.Resources.resources /target:winexe Form1.cs Form
1.Designer.cs Program.cs Properties\AssemblyInfo.cs Properties\Resources.Designe
r.cs Properties\Settings.Designer.cs
Target CopyFilesToOutputDirectory:
Copying file from "obj\Debug\HelloWorldWindow.exe" to "bin\Debug\HelloWorldW
indow.exe".
HelloWorldWindow -> C:\Visual Studio 2005\Projects\TestMSBuild\HelloWorldWin
dow\bin\Debug\HelloWorldWindow.exe
Copying file from "obj\Debug\HelloWorldWindow.pdb" to "bin\Debug\HelloWorldW
indow.pdb".
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.04
Creating a Custom Task
MSBuild gives you the added ability of launching custom tasks that you can write yourself in .NET. First create a new class library for your task:
Figure 2 - Creating an assembly for our custom task
Right click on the references in your project and Add the reference Microsoft.Build.Utilities and Microsoft.Build.Framework.
Figure 3 - Adding References to the project for using MSBuild
Create an initial class in your library for implementing your task that inherits from the Task class. You'll need to include Microsoft.Build.Utilities and override the Execute method.
using System;
using System.Collections.Generic;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
namespace XmlModifyClass
{
public class XmlTask : Task
{
public override bool Execute()
{
return true;
}
}
}
Building the XML Modify Task
We want our task to do the following:
1) Open an XML file and read the file into an XmlDocument
2) Find the tag indicated by the property
3) Replace the value in the tag with your value
4) Save the Xml back out to the file
Now let's fill in the Execute method to perform Xml modification as shown in listing 3. Inside the Execute method we create an XmlDocument and call the Load method to populate the XmlDocument from the file. Then we use XPath in the SelectSingleNode Method to find the node in the Xml Content indicated by the XmlTag property. If we find the node, we then decide whether or not we are modifying an attribute by looking at the AttributeChange property. If we had set the property in the script it to change the Attribute, then we modify the attribute indicated by the ModifiedAttribute Property.If AttributeChange is not set, we Modify the node content itself. Finally we save the Xml content back to the original
If everything goes well, we return true and the task has completed successfully. If anything goes wrong, such as the node is null in the search or an exception is thrown, we call Log, to log the error and return false.
Listing 3 - Execute Method for replacing tag content in an Xml File
try
{
// open the xml file that we want to modify
XmlDocument doc = new XmlDocument();
doc.Load(_fileName);
// find the specific node in the document we want to modify
XmlNode node = null;
if (_searchAttributeTag.Length == 0)
{
// only searches on the node tag using XPath
node = doc.SelectSingleNode(String.Format("//{0}", _xmlTag));
}
else
{
// here we are also searching on an attribute within the node with XPath,
// but not necessarily an attribute we are modifying
node = doc.SelectSingleNode(String.Format("//{0}[@{1}='{2}']", _xmlTag, _searchAttributeTag, _searchAttributeValue));
if (node != null)
// see if we want to change an attribute or the content of an xml node
if (_attributeChange)
{
// see if the attribute exists. if it doesn't, create it.
if (node.Attributes[_modifiedAttribute] == null)
{
node.Attributes.Append(doc.CreateAttribute(_modifiedAttribute));
}
// assign the attribute to the modified value
node.Attributes[_modifiedAttribute].Value = _modifiedValue;
}
else
// assign the node if it exists to the modified value
node.InnerXml = _modifiedValue;
}
// save the xml content back to the file
doc.Save(_fileName);
// successful task, return
return true;
// the task failed, return false if the node doesn't exist
Log.LogError("Couldn't find Xml Node - {0}", _xmlTag);
return false;
}
catch (Exception ex)
Log.LogError(ex.Message);
// the task failed.
return false;
}
Registering with MSBuild
In order for MSBuild to run the task, you need to register your new task assembly with MSBuild. This requires two things:
The first requirement is accomplished with the line shown below placed right inside the csproj file:
<UsingTask TaskName="XmlBuildTasks.XmlModifyTask" AssemblyName="XmlBuildTasks"/>
If you strong named your assembly, your UsingTask xml tag may look like this:
<UsingTask TaskName="XmlBuildTasks.XmlModifyTask" AssemblyName="XmlBuildTasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0db88d58057ef75f"/>
The second requirement can be accomplished by either placing the task assembly in the path or in the GAC. What I did is simply to stick the assembly in the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727, right next to MSBuild.exe. Some may consider this not this the most ideal place for the task assembly since you are mucking with the .NET framework directory, but it works. A better choice is to strong name the assembly in the build, and drag the assembly into the c:\windows\assembly directory (better known as the GAC).
Executing the Task
Now that we are finished installing our task, we'll want to execute it. The best place I found to stick any post build task operations are already provided to you by Microsoft. Simply uncomment the AfterBuild target section of the csproj file, and place your task inside here.
<!-- Target
</Target -->
<XmlModifyTask FileName="C:\working\bin\mysettings.exe.config" XmlTag="appSettings/add" SearchAttributeTag="BackColor" SearchAttributeValue="Purple" ModifiedValue="LimeGreen" AttributeChange="true" ModifiedAttribute="value" />
Now simply run msbuild.exe HelloWorldWindow.csproj and it will build with your new home-brewed task!
Conclusion
If Microsoft wants to encourage the use of MSBuild, one thing that would be nice to have in future Microsoft releases is to be ability to either edit the csproj file in either graphically (through the Visual Studio Interface) or edit it as an xml file inside a Visual Studio text editor. I had to download an open source freeware program called notepad++ to allow me to edit the csproj file as an xml file. Other than this drawback, MSBuild Opens up a world of flexibility into building C# Projects. I will probably add other Xml tasks to this project, such as the ability to delete nodes or create new nodes inside my config file. I'm even debating using MSBuild in place of those old DOS scripts I have to do all future deployment. Anyway, perhaps consider the next time you want to organize your compilation to msbuild it in .NET instead..
|
http://www.c-sharpcorner.com/UploadFile/mgold/MSBuildForXml07282006005222AM/MSBuildForXml.aspx
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
- NAME
- SYNOPSIS
- DESCRIPTION
- CONTROLLING IMPORTS
- CONSTRUCTOR
- METHODS
- DATA MEMBERS
- EXAMPLES
- SEE ALSO
- AUTHOR
NAME
Shell::EnvImporter - Perl extension for importing environment variable changes from external commands or shell scripts
SYNOPSIS: $@";
DESCRIPTION
Shell::EnvImporter allows you to import environment variable changes exported by an external script or command into the current environment. The process happens in (up to) three stages:
Importation
- imports variable changes by policy or filter.
Restoration
- restores the environment (%ENV) to pre-run state
If 'auto_run' is true (the default), execution is kicked off automatically by the constructor. If 'auto_import' is true (the default), importation is kicked off automatically after execution. Restoration never happens automatically; you must call the restore() method explicitly.
CONTROLLING IMPORTS.
CONSTRUCTOR
- new()
Create a new Shell::EnvImporter object. Parameters are:
- shell
Name of the shell to use. Currently supported: 'bash', 'csh', 'ksh', 'sh', 'tcsh', 'zsh', and of course, 'perl'. :)
- command
Command to run in the language of the specified shell. Overridden by file.
- file
File to be "sourced" by the specified shell.
- auto_run
If set to a true value (the default), Shell::EnvImporter will run the shell command (or source the file) immediately, from the constructor. Set to a false value to delay execution until run() is called.
- auto_import
If set to a true value (the default), import the changed environment immediately after running the command. Set to a false value to delay the import until import() (or import_filtered()) is called.
- import_added
-
- import_modified
-
- import_removed
Specify import policy. (See CONTROLLING IMPORTS above).
- import_filter
Use the supplied code ref to filter imports. Overrides import policy settings. (See CONTROLLING IMPORTS above).
METHODS
- run()
-
- run($command)
Run the supplied command, or run the command (or source the file) supplied during construction, returning a Shell::EnvImporter::Result object or undef with $@ set on error. It is an error to call run() without a command if none was supplied in the constructor.
- env_import()
-
- env_import($var)
-
- env_import(@vars)
-
- env_import(\@vars)
Perform a policy import (see CONTROLLING IMPORTS above). If an optional list (or array reference) of variable names is supplied, the import is restricted to those variables (subject to import policy). Returns a Shell::EnvImporter::Result object or undef with $@ set on error.
- env_import_filtered()
-
- env_import_filtered(\&filter).
- restore_env()
Restores the current environment (%ENV) to its state before shell script execution. It is an error to call restore_env before a successful run.
DATA MEMBERS
- result()
Returns the importer's Shell::EnvImporter::Result object.
- shellobj()
Returns the importer's Shell::EnvImporter::Shell object.
EXAMPLES
- Command Import
# Import environment variables set by a shell command my $importer = Shell::EnvImporter->new( command => 'ssh-agent' ) or die $@;
- "Sourced" File Import
# Import environment variables exported by a configuration file my $importer = Shell::EnvImporter->new( file => "$ENV{'HOME'}/.profile" ) or die $@;
- Policy import - modified only, bash script
my $importer = Shell::EnvImporter->new( file => '/etc/bashrc', shell => 'bash', import_modified => 1, import_added => 0, import_removed => 0, );
- Import a specific variable"); }
- Filtered import - all 'DB*' vars whose value references my homedir
my $file = '/etc/mydaemon.conf'; my $filter = sub { my($var, $value, $change) = @_; return ($var =~ /^DB/ and $value =~ /$ENV{HOME}/); }; my $importer = Shell::EnvImporter->new( file => $file, shell => 'bash', import_filter => $filter, ); print "Imported: ", join(", ", $importer->result->imported), "\n";
- Unexported Variables in Bourne-like shells
#";
SEE ALSO
Shell::EnvImporter::Result Shell::EnvImporter::Shell
AUTHOR
David Faraldo, <[email protected]>
Copyright (C) 2005-2006 by Dave Faraldo This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. No warranty is expressed or implied.
|
https://metacpan.org/pod/Shell::EnvImporter
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
#include <coherence/util/extractor/PofUpdater.hpp>
Inherits Object, ValueUpdater, and PortableObject.
List of all members.
Constructs a PofUpdater based on a property index.
This constructor is equivalent to:
PofUpdater::View vUpdater = PofUpdater::create(SimplePofPath::create(iProp));
Constructs a PofUpdater based on a property path.
Update the passed target object using the specified value.
It is expected that this updater will only be used against POF-encoded entries implementing BinaryEntry interface.
Implements ValueUpdater.
Compare the PofUpdater with another object to determine equality.
Determine a hash value for the PofUpdater object according to the general Object#hashCode() contract.
Reimplemented from Object.
Return a human-readable description for this PofUpdater.
Reimplemented from Object.
|
http://docs.oracle.com/cd/E15357_01/coh.360/e18813/classcoherence_1_1util_1_1extractor_1_1_pof_updater.html
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
[.
Please see the updated post for November 2009 and later.
This walkthrough covers what I found to be the simplest way to get a sample up and running on Windows Azure that uses the Table Storage Service. It is not trying to be comprehensive or trying to dive deep in the technology, it just serves as an introduction to how the Table Storage Service works.
Please take the Quick Lap Around the Tools before doing this walkthrough.
Note: The code for this walkthrough is attached, you will still have to add and reference the Common and StorageClient projects from the Windows Azure SDK.).
The Windows Azure Table Storage Services provides queryable structured storage. Each account can have 0..n tables.
When a request comes in to the UI, it makes its way to the Table Storage Service as follows (click for larger size):
The UI class (the aspx page and it’s code behind) is data bound through an ObjectDataSource to the SimpleTableSample_WebRole.ContactDataSource which creates the connection to the Table Storage service gets the list of Contacts and Inserts to, and Deletes from, the Table Storage.
The SimpleTableSample_WebRole.ContactDataModel class acts as the data model object and the SimpleTableSample_WebRole.ContactDataServiceContext derives from TableStorageDataServiceContext which handles the authentication process and allows you to write LINQ queries, insert, delete and save changes to the Table Storage service.
1. Start Visual Studio as an administrator
2. Create a new project: File à New à Project
3. Select “Web Cloud Service”. This will create the Cloud Service Project and an ASP.Net Web Role. Call it “SimpleTableSample”
4. Find the installation location of the Windows Azure SDK. By default this will be: C:\Program Files\Windows Azure SDK\v1.0
a. Find the file named “samples.zip”
b. Unzip this to a writeable location
5. From the samples you just unzipped, add the StorageClient\Lib\StorageClient.csproj and HelloFabric\Common\Common.csproj to your solution by right-clicking on the solution in Solution Explorer and selecting Add à Existing Project.
a. Common and StorageClient and libraries that are currently distributed as samples that provide functionality to help you build Cloud Applications. Common adds Access to settings and logging while StorageClient provides helpers for using the storage services.
6. From your Web Role, add references to the Common and StorageClient projects you just added along with a reference to System.Data.Services.Client
7. Add a ContactDataModel class to your Web Role that derives from TableStorageEntity. For simplicity, we’ll just assign a new Guid as the PartitionKey to ensure uniqueness. This default of assigning the PartitionKey and setting the RowKey to a hard coded value (String.Empty) gives the storage system the freedom to distribute the data.
using Microsoft.Samples.ServiceHosting.StorageClient;
public class ContactDataModel : TableStorageEntity
{
public ContactDataModel(string partitionKey, string rowKey)
: base(partitionKey, rowKey)
{
}
public ContactDataModel()
: base()
{
PartitionKey = Guid.NewGuid().ToString();
RowKey = String.Empty;
}
public string Name
{
get;
set;
}
public string Address
{
get;
set;
}
}
8. Now add the ContactDataServiceContext to the Web Role that derives from TableStorageDataServiceContext.
a. We’ll use this later to write queries, insert, remove and save changes to the table storage.
internal class ContactDataServiceContext : TableStorageDataServiceContext
{
internal ContactDataServiceContext(StorageAccountInfo accountInfo)
: base(accountInfo)
{
}
internal const string ContactTableName = "ContactTable";
public IQueryable<ContactDataModel> ContactTable
{
get
{
return this.CreateQuery<ContactDataModel>(ContactTableName);
}
}
}
9. Next add a ContactDataSource class. We'll fill this class out over the course of the next few steps. This is the class the does all the hookup between the UI and the table storage service. Starting with the first part of the constructor, a StorageAccountInfo class is instantiated in order to get the settings required to make a connection to the Table Storage Service. (note that this is just the first part of the constructor code, the rest is in step 12)
using Microsoft.Samples.ServiceHosting.StorageClient;
using System.Data.Services.Client;
public class ContactDataSource
{
private ContactDataServiceContext _ServiceContext = null;
public ContactDataSource()
{
// Get the settings from the Service Configuration file
StorageAccountInfo account = StorageAccountInfo.GetDefaultTableStorageAccountFromConfiguration();
10. In order for the StorageAccountInfo class to find the configuration settings, open up ServiceDefinition.csdef and add the following to <WebRole/>. These define the settings.
<ConfigurationSettings>
<Setting name="AccountName"/>
<Setting name="AccountSharedKey"/>
<Setting name="TableStorageEndpoint"/>
</ConfigurationSettings>
11.>
12. Next, continue to fill out the constructor (just after the call to GetDefaultTableStorageAccountFromConfiguration ()) by instantiating the ContactDataServiceContext. Set the RetryPolicy that applies only to the methods on the DataServiceContext (i.e. SaveChanges() and not the query. )
// Create the service context we'll query against
_ServiceContext = new ContactDataServiceContext(account);
_ServiceContext.RetryPolicy = RetryPolicies.RetryN(3, TimeSpan.FromSeconds(1));
}
13. We need some code to ensure that the tables we rely on get created. We'll do this on first request to the web site -- which can be done by adding code to one of the handlers in the global application class. Add a global application class by right clicking on the web role and selecting Add -> New Item -> Global Application Class. (see this post for more information)
14. Add the following code to global.asax.cs to create the tables on first request:
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
HttpContext context = app.Context;
// Attempt to peform first request initialization
FirstRequestInitialization.Initialize(context);
}
And the implementation of the FirstRequestInitialization class:
internal class FirstRequestInitialization
{
private static bool s_InitializedAlready = false;
private static Object s_lock = new Object();
// Initialize only on the first request.
// Create the tables on first request initialization as there is a performance impact
// if you call CreateTablesFromModel() when the tables already exist. This limits the exposure of
// creating tables multiple times.
// Get the settings from the Service Configuration file
StorageAccountInfo account = StorageAccountInfo.GetDefaultTableStorageAccountFromConfiguration();
// Create the tables
// In this case, just a single table.
// This will create tables for all public properties that are IQueryable (collections)
TableStorage.CreateTablesFromModel(typeof(ContactDataServiceContext), account);
}
}
15. When running in the real cloud, this code is all that is needed to create the tables for your Cloud Service. The TableStorage class reflects over the ContactDataServiceContext classs and creates a table for each IQueryable<T> property where the columns of that table are based on the properties of the type T of the IQueryable<T>.
a. There is a bit more to do in order to get this to work in the local Development Storage case, more on that later.
16. At this point, it’s just a matter of filling out the ContactDataSource class with methods to query for the data, insert and delete rows. This is done through LINQ and using the ContactDataServiceContext.
a. Note: in the Select() method, the TableStorageDataServiceQuery<T> class enables you to have finer grained control over how you get the data.
i. Execute() or ExecuteWithRetries() will access the data store and return up to the first 1000 elements.
ii. ExecuteAll() or ExecuteAllWithRetries() will return all of the elements with continuation as you enumerate over the data.
iii. ExecuteWithRetries() and ExecuteAllWithRetries() uses the retry policy set on the ContactDataServiceContext for the queries.
b. Note: the use of AttachTo() in the Delete() method to connect to and remove the row.
public IEnumerable<ContactDataModel> Select()
{
var results = from c in _ServiceContext.ContactTable
select c;
TableStorageDataServiceQuery<ContactDataModel> query = new TableStorageDataServiceQuery<ContactDataModel>(results as DataServiceQuery<ContactDataModel>);
IEnumerable<ContactDataModel> queryResults = query.ExecuteAllWithRetries();
return queryResults;
}
public void Delete(ContactDataModel itemToDelete)
{
_ServiceContext.AttachTo(ContactDataServiceContext.ContactTableName, itemToDelete, "*");
_ServiceContext.DeleteObject(itemToDelete);
_ServiceContext.SaveChanges();
}
public void Insert(ContactDataModel newItem)
{
_ServiceContext.AddObject(ContactDataServiceContext.ContactTableName, newItem);
_ServiceContext.SaveChanges();
}
17. The UI is defined in the aspx page and consists of 3 parts. The GridView which will display all of the rows of data, the FormView which allows the user to add rows and the ObjectDataSource which databinds the UI to the ContactDataSource.
18. The GridView is placed after the first <div>. Note that in this sample, we’ll just auto-generate the columns and show the delete button. The DataSourceId is set the ObjectDataSource which will be covered below.
<asp:GridView
<Columns>
<asp:CommandField
</Columns>
<RowStyle BackColor="#F7F7DE" />
<FooterStyle BackColor="#CCCC99" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CE5D5A" Font-
<HeaderStyle BackColor="#6B696B" Font-
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
19. The Form view to add rows is really simple, just labels and text boxes with a button at the end to raise the “Insert” command. Note that the DataSourceID is again set to the ObjectDataProvider and there are bindings to the Name and Address.
<br />
<asp:FormView
<InsertItemTemplate>
<asp:Label
<asp:TextBox
<br />
<asp:Label
<asp:TextBox
<br />
<asp:Button
</InsertItemTemplate>
</asp:FormView>
20. The final part of the aspx is the definition of the ObjectDataSource. See how it ties the ContactDataSource and the ContactDataModel together with the GridView and FormView.
<%-- Data Sources --%>
<asp:ObjectDataSource
</asp:ObjectDataSource>
21. Build. You should not have any compilation errors, all 4 projects in the solution should build successfully.
22. Create Test Storage Tables. As mentioned in step 15, creating tables in the Cloud is all done programmatically, however there is an additional step that is needed in the local Development Storage case.
a. In the local development case, tables need to be created in the SQL Express database that the local Development Storage uses for its storage. These need to correspond exactly to the runtime code. This is due to a current limitation in the local Development Storage.
b. Right click on the Cloud Service node in Solution Explorer named “Create Test Storage Tables” that runs a tool that uses reflection to create the tables you need in a SQL Express database whose name corresponds to your Solution name.
i. ContactDataServiceContext is the type that the tool will look for and use to create those tables on your behalf.
ii. Each IQueryable<T> property on ContactDataServiceContext will have a table created for it where the columns in that table will correspond to the public properties of the type T of the IQueryable<T>.
23. F5 to debug. You will see the app running in the Development Fabric using the Table Development Storage
Please see the Deploying a Cloud Service to learn how to modify the configuration of this Cloud Service to make it run on Windows Azure.
Please see the updated post for November 2009 and later..
Each storage account has access to blob storage. For each account there can be 0..n containers. Each container contains the actual blobs, which is a raw byte array. Containers can be public or private. In public containers, the URLs to the blobs can be accessed over the internet while in a private container, only the account holder can access those blob URLs.
Each Blob can have a set of metadata set as a NameValueCollection of strings.
<Columns>
<asp:ButtonField
<asp:HyperLinkField
<asp:BoundField
</Columns>
</asp:GridView>
<br />
<asp:Label
<asp:FileUpload
<asp:requiredfieldvalidator
</asp:requiredfieldvalidator>
<br />
<asp:Label
<asp:TextBox
<asp:requiredfieldvalidator
</asp:requiredfieldvalidator>
<br />
<asp:Label
<asp:TextBox
<asp:requiredfieldvalidator
</asp:requiredfieldvalidator>
<br />
<asp:Button
<br />
<br />
<asp:Label.
The.
The Azure Services Training Kit - PDC Preview which contains the Hands on Labs that folks are doing at the PDC is now available for download.
From the download page:
The Azure Services Training Kit will include. Additional content will be included in future updates of this kit.
If you create a new Cloud Service project in Visual Studio but it doesn't contain a Cloud Service project (ccproj), you won't get the Visual Studio integration for building Windows Azure services that you would expect. For example, you won't get debug/run in the Development Fabric, you won't get integration with the Development Storage service, and you won't get publishing support.
The reason is that you have created a Role project, instead of a Cloud Service Project. Today, you can have 0 or 1 Web Roles (which is an ASP.Net Web Application) and 0 or 1 Worker Roles (which is a UI-less .Net application) in each service.
When you create a new Cloud Service project, make sure you are choosing a template from the "Cloud Service" node and not the Roles node in the New Project dialog:
The question would then be, what is the Roles node in the New Project dialog used for?
It's used when you want to:
1) Add a role to an existing Cloud Service project. For example, the following Cloud Service project contains a web role. You can use the roles node to add a Worker Role project to that Cloud Service.
This will bring up the new project dialog with the Roles node selected. Out of the box, we only support C# and VB ASP.Net Web Application Web Roles and and C# and VB Worker roles.
Likewise, if the Cloud Service contains a Worker Role and not a Web Role, you can add a Web Role to that project in the same way.
2) Replace an existing Role with a new Role Project. For example, you have a Cloud Service that contains a Web Role, and you want to replace it with a new Web Role. You can right click on the Web Role association and select to associate it with a new Web Role:
This will bring up the the new project dialog with the Roles node selected:
The final thing you can do, is associate a role with an existing Role project by adding that Role project to the solution, right clicking on either the Web or Worker role association node in Solution Explorer and select to associate that role with a "Role Project in solution..."
Watch my screencast that introduces you to the Windows Azure Tools for Microsoft Visual Studio.
If.
In my prior post that talked about the difference between the Cloud Service templates and the Role templates I mentioned that out of the box, we only supported one kind of Web Role -- an ASP.Net Web Application. (that is, if you used the Roles node in the Cloud Service (ccproj) project to add or replace a Web Role, you only got the option to add an ASP.Net Web Application.
The cool thing is that we made the role templates extensible so other teams can add in Windows Azure versions of their templates.
The first team to do this? The Windows Live Tools team -- they have an add-in to make incorporating Windows Live services into your Web application easier.
Check out Vikas' post on the Windows Live Tools release that has templates for Windows Azure. This is really cool:
(and before you ask, there isn't an add-in for ASP.Net MVC at this point. We do have a sample project that will make it easy for you to get started with MVC on Windows Azure)
As some of you may have noticed, this blog has gone dark for a while. During that time it got an interesting face lift and a new title "Cloudy in Seattle".
As it turns out, I switched teams and am now a proud member of the (Cloud) Computing Tools team... but that also meant I couldn't blog about the cool things I've been working on.
With the announcement in today's key note at the PDC, I'm happy to say I can now start blogging about it, about the Azure Services Platform and in particular, Windows Azure.
When you distill it out, Windows Azure is all about hosting your web applications, storage, management and development. That is, you can host, scale and manage web application in Microsoft data centers.
At the same time, it incorporates some truly cool features like the Fabric controller that manages resources, load balances across your running instances (which incidentally, you can configure on the fly and as easily as editing or uploading a new configuration file) and manages upgrades and failures to maintain availability.
My part in all this? You guessed it, I'm working on developer tools -- that's my passion. My product: Windows Azure Tools for Microsoft Visual Studio. An add-in for Visual Studio 2008 that brings the developer experience you would expect for building Cloud Applications to Visual Studio.
The tools make it easy to get started, configure, edit, build, package, debug and publish for deployment.
I'm really jazzed about what's ahead, and I'm jazzed to be able to start sharing. Stay tuned.
Want.
I've posted a number of technical articles on MSDN that will help you to get acquainted with the Windows Azure Tools for Microsoft Visual Studio. Have a look:
Introduction
Deploying a Service (Interesting for folks who don't have a token yet but want to see the experience)
|
http://blogs.msdn.com/b/jnak/archive/2008/10.aspx?PostSortBy=MostViewed&PageIndex=1
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
#include <VMInterface.h>
List of all members.
Returns helper ID by its string representation.
Name comparison is case-insensitive. If the helperName is unknown, then VM_RT_UNKNOWN is returned.
Returns a system class by its name or NULL if no such class found.
Recursively looks up for a given method with a given signature in the given class.
Returns NULL if no such method found.
Acquires a lock to protect method's data modifications (i.e.
code/info block allocations, exception handlers registration, etc) in multi-threaded compilation. The lock *must not* surround a code which may lead to execution of managed code, or a race and hang happen. For example, the managed code execution may happen during a resolution (invocation of resolve_XXX) to locate a class through a custom class loader. Note, that the lock is *not* per-method, and shared across all the methods.
Releases a lock which protects method's data.
Requests VM to request this JIT to synchronously (in the same thread) compile given method.
Genereated on Tue Mar 11 19:25:40 2008 by Doxygen.
(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.
|
http://harmony.apache.org/subcomponents/drlvm/doxygen/jitrino/html/class_jitrino_1_1_compilation_interface.html
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
A demon that appears as a wanton female to men in the night and, under guise of an erotic dream has sexual intercourse with them. The demon then departs and, changing form to that of an incubus (male) visits a woman and plants the now-demonified seed into her, under guise of another dream. Demons can't interbreed directly with humans despite numerous awful films.
Succubus is from the Latin verb succubare, "to lie under" which evolved into the Late Latin word succuba, "strumpet." In Medieval Latin, the word was altered to succubus by association with the word incubus. A succubus is a female evil spirit or demon thought in medieval times to descend upon and have sexual intercourse with sleeping men.
At any rate, the chance of getting a positive effect from laying a succubus (I am male, so I'm going to use the succubus as my example in the following, but it all applies equally to the incubus as well) is equal to your Intelligence plus your Charisma plus one, all over 35:
INT + CHA + 1
-------------
35
Anyways, so you're walking down the corridor, and you see the succubus (I won't speculate on what sort of clothes they probably walk around in), and she sees you. She beckons teasingly, you swagger down the hall. She usually won't jump your bones right away...there'll be some flirting and foreplay first:
if (rn2(20) < ACURR(A_CHA)) {
Sprintf(qbuf,"\"Shall I remove your %s, %s?\"",
str,
(!rn2(2) ? "lover" : !rn2(2) ? "dear" : "sweetheart"));
if (yn(qbuf) == 'n') return;
} else {
char hairbuf[BUFSZ];
Sprintf(hairbuf, "let me run my fingers through your %s",
body_part(HAIR));
verbalize("Take off your %s; %s.", str,
(obj == uarm) ? "let's get a little closer" :
(obj == uarmc || obj == uarms) ? "it's in the way" :
(obj == uarmf) ? "let me rub your feet" :
(obj == uarmg) ? "they're too clumsy" :
#ifdef TOURIST
(obj == uarmu) ? "let me massage you" :
#endif
/* obj == uarmh */
hairbuf);
}
remove_worn_item(obj);
}
#endif /* SEDUCE */
Next, she'll probably murmur sweet nothings into your ear, while helping you undress...hopefully there aren't any hostile monsters nearby for the next step:
/* by this point you have discovered mon's identity, blind or not... */
pline("Time stands still while you and %s lie in each other's arms...",
mon_nam(mon));
if (rn2(35) > ACURR(A_CHA) + ACURR(A_INT)) {
After it's over, the game'll roll up whether you benefitted or suffered from the encounter according to the above formula. If there was a positive effect, the succubus will "act as if she has a headache"; this means you can wait a little while for her to recover and then do it again. If the effect is negative, you'll get the message "The succubus seems to have enjoyed it more than you..." and she'll be ready to go again immediately. Furthermore, after each encounter there is a 4% chance that the succubus will be completely worn out. If this happens, she will say she has a "severe" headache and will no longer be interested in you.
Positive effects are as follows (equal probability):
Note: The code quoted is excerpted from the NetHack 3.3.0 source code, copyright the DevTeam 1999, I imagine. All other information comes from my reading of the code and summary/paraphrase of various spoiler documents.
Dictionary of Sexology Project: Main Index
by nature succubi are not evil!
a succubus is merely a female or female-ish spirit that seeks sex--or a relationship with any physical component--with mortals. (note: all of this applies as equally to the male incubus form).
a succubus is *not* a "race" of being, as are say fey, or sprites or whatever, but rather a *type*. succubi can be otherworld souls such as fey or elementals. they can be human souls who are currently in a limbo-state, not allowed to reincarnate yet or somehow trapped by some aspect in the world they left they can't bring themselves to let go of. they can be any kind of being at all. the only thing that defines a succubus is the desire of physical and almost always sexual human contact. these beings have come to the conclusion that being bodily with a human is the closest they can come to being fully human themselves.
for most, it is a desire to have a human soul, or for human souls, to "regain" their humanity. it is a hunger to comprehend the mortal world and partake of it as fully as they can. most have *no intent* of evil, only *need*. if it is a human soul, they are drawn to flesh that they knew in life, or that *reminds* them of someone they were close to. otherworld souls are drawn to humans, irregardless of their physical, but how truly *alive* they are in soul, and how psychically and spiritually attuned they are. they also often answer a call if a human is *looking* for a noncorporeal partner. (note, i do not recommend the average person attempt Summoning Demons For Sexual pourposes. -_- )
succubi are sometimes accused of being "soul-stealers", and something like this DOES happen sometimes, but again it's not as it looks. legend says every time a human has sex with a succubus/incubus, the being steals a little bit of the human's soul, and that the human becomes more and more addicted, wanting more, until their soul is completely owned by the predator. this is not fully true, but rather this is the case: sometimes a human will become completely *enamored* with their spirit-partner, *especially* if the succubus is an otherworld. most spirits are free from a lot of human constraints-- well for one they always have time they're not at work earning a living and often busy, they don't have "friends" to go out to the pub with in the same sense humans do, and succubi *tend*, once fairly involved, to be entirely exclusive so there's little risk of them leaving. additionally, spirits, human and non, in general have less of the darker human emotions such as rage and jealousy and such; a succubi's strongest feeling is *need*, so as long as you satisfy them, they are faithful and truly good to you. so humans often become fixated on these seemingly too good to be true partners, and slowly lose interest in what's "real". they often drift away from flesh friends, lose interest in their job and the outside world. but there is no soul-stealing here, rather the mortal chooses to *give* their life/soul.
now as to the issue of where the negative portrayal of demonwomen came from? the church, and society. during various times in history the church has gone on "sex is only OK in marriage/masturbation is bad/sexuality is unhealthy/divorce is a sin/etc etc etc" bents. because of course **we** are human, and not merely lowly animals of course we can control our hormones, right? the church didn't like to accept the fact that strong physical needs existed--of course no proper, god-fearing man would be animal enough to ever have a wet dream because *gasp* he had hormones. right? of course not. there *had* to be *some* explanation, and during periods where beliefs in spirits and devils and beings was still high, what better logic than "it must be a devilish being *tempting* these good men and trying to lead them to sin by having sex with them in their sleep." they took the *concept* of succubi/incubi from much older patterns of thought. (i do not know when the term was applied to these spirits, but the *idea* of them was around much longer than the name). so the church ran with this idea, and portrayed these beings in the sinful devil light they are commonly seen in today.
but actually...succubi have feelings too!
Although it is a less accepted image of the succubus, it must be pointed out that succubi are also thought by some to be hags, or witches practising the black arts. Anton LaVey, a notorious practitioner of the black arts, instructed and advocated occult attacks where a witch would visit a man of her choosing in order to force sexual activity. She would actually turn into a demon.
These black magicians thought that, by achieving a state similar to astral projection, they could visit the victim and then return to their normal state. The 'visit' was achieved by forcing an image of herelf into the mind of the man she desires and then climaxing through masturbation or force of will, prompting a similar reaction in the victim. This may sound appealing, but this imposition can be menacing, draining, or dangerous if either party is psychologically disturbed. Some people believe succubi can even kill you through exhaustion. And maybe you are here because you are worried about such a thing...
If you truly do believe you are being visited by a succubus (in which case I propose you look here for a more earthy, credible cause of distress), you should try the following, which is found in European lore as a method of protection against succubi:
While the first two methods have no obvious explanation (perhaps to attack the she-demon as she has her way with you?), the latter two are believed to prevent the succubus from attacking you as she must continue to pass through all the holes the entire night.
A succubus won't take it slow, see how things develop...if you were to encounter one I'd search the kitchen cupboards, and invest in some gauze for those wounds. However appealing it is to have a woman want you, remember - a succubus is not your dream girl.
Succubi were indeed often considered to be manifestations of hags. This was not, however, always considered negative. The resistances to the witching world in general, including the old-evil-ugly witch stereotype, stemmed from Christianity’s fight to gain control of the European people’s beliefs. Christianity was a religion that rejected passion, while many of the ancient religions embraced it (at least the Dionysian ones). The most apparent example of this is the portrayed character of the devil in Christian religious art – the man with the goat’s hooves is of course the ancient god Pan.
The Hag character is a personification of a witch/fertility goddess. The act of having sex with a fertility spirit is obviously considered negative by a religion rejecting both spirits and sex.
Aboard the Starship Titanic, there is a Succ-U-Bus in almost every room or corridor. One can use the Succ-U-Bus system to transport objects around the ship, though the bot is not without its flaws. Outside of its below-average intelligence, it also has an affinity for chicken. An attempt to send a chicken through the Succ-U-Bus will result in nothing but a satiated Succ-U-Bus.
"Mama" Succ-U-Bus is located in the Bilge Room. Any item that is lost by the Succ-U-Bus system ends up with her.
"You want suck? I suck. You want blow? I blow. You want intellectual disputation? I got a big belch."
--Succ-U-Bus
Suc"cu*bus (?), n.; pl. Succubi (#). [See Succuba.]
1.
A demon or fiend; especially, a lascivious spirit supposed to have sexual intercourse with the men by night; a succuba. Cf. Incubus.
2. Med.
The nightmare. See Nightmare, 2.
© Webster 1913.
Log in or registerto write something here or to contact authors.
Need help? [email protected]
|
http://everything2.com/title/succubus?showwidget=showCs673702
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
Ohhh I totally get it now. Code working as intended! Thanks for the help!
Ohhh I totally get it now. Code working as intended! Thanks for the help!
Well, I haven't quite gotten it yet. I need some way to count the vowels in each argument separately.
Thanks for the help guys! Here's what I'm working with now:
package main;
public class Assignment1 {
public static void main(String args[]) {
int numA = 0;
int numE = 0;
I was thinking something like this, but how can the program know to use all of the arguments (be it 2 or 5000)?
Hello all.
So my first assignment in my computer science class is to write a program that counts the number of vowels. Basically, running
java main.Assignment1 "This is one argument" "A second...
|
http://www.javaprogrammingforums.com/search.php?s=75582d91a6cbde40ab4c4d8ae6ba32e8&searchid=1665710
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
03/18/2014
text
original
The biggest advantage SVG has over Flash is the compliance with other standards (e.g. XSL and the DOM).
Flash relies on proprietary technology that is not open source.
Look at a directory of SVG enabled software and services.
"">
<svg width="100%" height="100%" version="1.1"
xmlns="">
<circle cx="100" cy="50" r="40" stroke="black"
stroke-
</svg>. The cx and cy attributes define the x and y coordinates
of the center of the circle. If cx and cy are omitted, the circle's center is set to (0, 0). The r attribute defines
the radius of the circle.
The stroke and stroke-width attributes control how the outline of a shape appears. We set the outline of the
circle to a 2px wide, black "border".
The fill attribute refers to the color inside a shape. We set the fill color to red.
The closing </svg> tag closes the root SVG element and the document.
SVG files can be embedded into HTML documents with the <embed> tag, the <object> tag, or the <iframe>
tag.
Below you should see three different methods on how to embed SVG files into HTML pages.
Note: The Adobe SVG Viewer recommends that you use the EMBED tag when embedding SVG in HTML pages! However, if you want to create valid XHTML, you cannot use <embed> - The <embed> tag is not listed in any HTML specification.
<embed src="rect.svg" width="300" height="100"
type="image/svg+xml"
pluginspage="" />
Note: The pluginspage attribute points to an URL for the plugin download.
Tip: Internet Explorer supports an additional attribute, wmode="transparent", that let the HTML page
background shine through.
<object data="rect.svg" width="300" height="100"
type="image/svg+xml"
codebase="" />
It would be great if we could add SVG elements directly into the HTML code, only by referring to the SVG
namespace, like this:<html
xmlns:
<body>
<p>This is an HTML paragraph</p>
<svg:svg
<svg:circle
</svg:svg>
</body>
</html>
SVG has some predefined shape elements that can be used and manipulated by developers:
Rectangle <rect>
Circle <circle>
Ellipse <ellipse>
Line <line>
Polyline <polyline>
Polygon <polygon>
Path <path>
The <rect> tag is used to create a rectangle and variations of a rectangle shape.
To understand how this works, copy the following code into Notepad and save the file as "rect1.svg". Place
the file in your Web directory:<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"">
<svg width="100%" height="100%" version="1.1"
xmlns="">
<rect width="300" height="100"
style="fill:rgb(0,0,255);stroke-width:1;
stroke:rgb(0,0,0)"/>
Already a member? Sign in.
This action might not be possible to undo. Are you sure you want to continue?
|
http://www.scribd.com/doc/23539602/SVG-Tutorial
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
On Sun, 12 Oct 2008, Manuel Prinz wrote:
I just setup a Git repository in our group namespace named "debian-science-tools". It's supposed to be a collection of tools that will aid when working on Debian Science, and everyone is very welcome to contribute to it. It's both for users and developers, enabling users to contribute more easily to Debian Science -- if they like to do so.
Manuel, many thanks for this effort which is really welcome. But IMHO this rather belongs to general Debian Pure Blends (formerly known as Custom Debian Distribution) stuff and should rather go to the cdd repository. I is a known fact that every project develops nice tools and my goal is to find synergies to make these available for everybody. This does not mean that I want to stop you from continuing the good work but please use a variable for debian-science at every piece of your code and try to use configuration files to enable a generalisation easily.
At the moment, it just contains one tool, debsci-wnpp, which calls "reportbug wnpp" and also adds templates for user-tagging and CC'ing the maintainers list. Using this, it is possible to directly set usertags in the template, so this does not have to be done manually after an ITP. Also, the mailing list is always informed about new ITPs/RFPs.
I currently have no time to look into this code (regard me on pseudo-vacation) but I would strongly vote to call this script blend-wnpp science The science argument should make the script reading a configuration file /etc/blend/science/science.conf which should contain all the information you need and will be installed by the science-common package. This is only some rough scetch what I plan for the future but this should give you an idea how to design those scripts. I also would like you to continue this discussion at debian-custom list which is
There is also a small wrapper script, debsci, that simply calls the debsci-* scipts. It's just for convenience, to feel a little more like Git. (Which I like. You may or may not use it, all tools can be called directly.)
Same here: Please consider blend science or something like this.
More tools are planned, one is going to be rewritten. I did not announce it to debian-science@ yet since the use is still quite limited.
I would really feel debian-science@ list apropriate ... Full quote of the remaining stuff to inform debian-custom. Thanks for your effort Andreas.
If you have other ideas, feel free to commit to the "upstream" branch or send me a patch. The scripts still lack proper documentation but are so simple and short that it should be no problem to understand what they do. A preliminary packaging can be found in the "debian" branch. I'm also unsure about the license, I just chose GPLv3+. I do not mind to change that if one has strong feelings about that. All feedback and contributions are welcome. Please let me know if you like the idea and/or find the tools useful. Best regards Manuel
--
|
https://lists.debian.org/debian-custom/2008/10/msg00016.html
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
Jeremy Quinn wrote:
>
> On Monday, Nov 25, 2002, at 18:59 Europe/London, Stefano Mazzocchi wrote:
>
>> Hunsberger, Peter wrote:
>>
>>>> h).
>>
>
> <snip/>
>
>>
>> Ok, we'll keep this on the stack of 'possible wild proposals', ok? :)
>>
>> No, seriously, I'm very happy when people think about radically
>> different approaches to solve the same problems because that's how
>> innovation takes place.
>>
>
> Gosh!
>
> I was expecting to see Stefano blow up there!! ;)
>
> What you are describing sounds very like a common Cocoon 1 webapp
> model, whereby XSLT Stylesheets would use data in the DOM and internal
> logic to inject Processor Instructions to direct transformation flow.
>
> I still find myself wanting pipelines that will react to changing data
> in the pipeline, ie, changes the processing path by changes in the
> data. But you are in a world of pain trying that in Cocoon now, it's
> not the way you are supposed to work .... you can't suddenly say, Ohh
> look, I reckon I need to run the SQLTransformer on that .... unless
> you always put it on your pipeline whether it is needed or not. Unless
> you have a MetaTransformer ... applies whatever Transformers are
> needed, that are registered to handle that namespace.
FYI:
Just nobody cared enough (me including) to implement it...
Vadim
> In fact thats analogous to your pipeline fragments you want to call
> from inside another pipeline, he! he! ;) a pipeline with no generator
> and no serializer is a meta-transformer! (head down ;)
>
> regards Jeremy
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, email: [email protected]
|
http://mail-archives.apache.org/mod_mbox/cocoon-dev/200211.mbox/%[email protected]%3E
|
CC-MAIN-2015-32
|
en
|
refinedweb
|
Wikipedia talk:Avoid weasel words
From Wikipedia, the free encyclopedia
[edit] IMPORTANT ANNOUNCEMENT TO WELL-MEANING WIKIPEDIANS
Before contributing your inevitable witty objection concerning the stylistic or content choices made in this article contradicting its own message, please consider first if your objection would also apply to the Avoid Self Reference guideline's numerous references to itself.
If they would, it is recommended that you take a few minutes to meditate on the differences between project space and article space.
Have a nice day. -AceMyth 15:24, 13 June 2007 (UTC)
- "take a few minutes to meditate on the differences between project space and article space."
- So are we to take it that your opinion is that the style guide need not live up to the standards of the rest of wikipedia? This would indeed explain some things about the style guide.
- "Have a nice day."
- and i hate you is also weasel word, quoted by ross franklin schwab
- -- 68.11.154.229
- Polite, and yet, condescending. A nice balance.
It says avoid, not obliterate. This article could make an explicit exception for itself under "Clear...".BrewJay (talk) 08:41, 4 July 2008 (UTC)
- (1) "avoid vs. obliterate" -- this is the "it's just a rule of thumb" fall-back again. I think this is something of a cop-out. It is not the way the adherents of the "weasel word" doctrine treat it... they go plowing through wikipedia with the monotonous regularity of a bot, appending "weasel" tags to any of the Forbidden Phrases.
- (2) "explicit exception" -- yes, the article could give itself permission to use the Forbidden Phrases, just like the boss can give himself a bonus during a period of layoffs. It may be logically consistent, but it still looks awfully hypocritical. -- Doom (talk) 00:53, 12 February 2009 (UTC)
[edit] (subsequent discussion)
- It is quite important to note that this guideline is indeed in poor shape, style-wise; it is too long, there are too many examples, it rambles, and it confuses WP:NPOV and WP:VER. There are repeated comments on the talk page to the effect (that the guideline is not really helpful), irrespective of occasional joke edits to the article page. This has nothing to do with self-reference or self-contradiction, it is just that the article is in need of a major rewrite so that it has a decipherable meaning, a meaning that can be summed up coherently, in a few phrases, in sensible and pleasant english, which it does not do at present. — Newbyguesses - Talk 11:23, 30 June 2007 (UTC)
- Too long, too many examples - that's correct, and this guideline could be improved by trimming the rambling down to a few concise, powerful sentences. This current form is a stage of improvement from the way this guideline used to be, when it didn't bother justifying or explaining its point at all.
- But the "repeated comments" that this guideline is not helpful or, as you put it, lacking in decipherable meaning, they're just absurd and they prove absolutely nothing. The guideline leaves no question as to what weasel words are. It defines what makes for a weasel word and explains how using them can sabotage Neutrality and Verifiability (which by no means constitutes a conflation of these two concepts). The criticisms you speak of do not stem from petty issues like form and presentation; their tone often betrays an outright rejection of the notion that there's something such as weasel words at all or that Wikipedia should admonish against their usage in any way. Usually when an opinion is oft-cited it is worthy of consideration, but even the most flattering sort of consideration I could muster for this position concludes it to be flat out wrong. I think most editors who have ever faced the challenge of striving to NPoV on a controversial article would agree with me. --AceMyth 03:43, 1 July 2007 (UTC)
- With apologies to User:AceMyth, this editor did not check too many past versions of the project page before launching the current aspersions as to clarity. Much progress has undoubtedly been made over time.
- Agreed also, many of the complaints on the talk page are flat out wrong (that undermines the current argument substantially, as you have pointed out). Also agreed, is it, then, <too long, too many examples - that's correct>. My suggestion, and I am toning it down, note the apology for my former intemperence, is keep most of the article, but drop all the examples, for now, and develop a better lot. It is better to trim now, find out what is supposedly being said. (Such a major rewrite is almost certainly beyond my capacities, yet, after some thought, I did draft as such in my user-space, still, no changes need to be made till more fruitful discussion develops, my work is offered since this page, a guideline, does a good job, but needs tweaking, and considering also, WP:Words to avoid. A rewrite, substantial, yet not changing any policy/guideline inflections, just shorter, clarified. This would take helpful input to achieve. Newbyguesses - Talk 06:33, 2 July 2007 (UTC)
- I've already started a re-write with your input in mind. The "Other problems" section is a tough nut to crack in this regard- I think the only way to simplify it would be to actually spread it out into a whole descriptive section rather than the current bullet point format (which is what currently forces the section into the paragraph-compressed-into-a-sentence-and-a-half style).
- As for actually checking past versions of the page - Nobody ever does. Nobody ever should, either. That's what being bold is about. --AceMyth 11:59, 2 July 2007 (UTC)
[edit] Complaints
Marc Defant makes a good point. On the one hand, weasel words can convolute an article and completely destroy the credibility of an entry. But when used appopriately they serve an important function. There are few absolutes in life and many things are subject to interpretation, even concrete "facts." There are, IMHO, many occasions when the use of a weasel word phrase would be appropriate. Even when a topic has been empirically studied and expounded upon, there is more often than not (weasel word?), several possible conclusions. Asturnut (talk) 05:04, 7 August 2008 (UTC)
Shouldn't this page itself cite in order to avoid hypocrisy? Some people (me) would say that this page is written poorly. —Preceding unsigned comment added by 24.90.86.97 (talk) 05:50, March 22, 2007 (UTC)
- You must be the umpteenth person to come along and say "ho-ho, this article should apply to itself". That this demand makes no sense at all seems to take a backseat to the potential of saying something witty. --AceMyth 01:27, 8 April 2007 (UTC)
"Many mathematicians argue ...."
"A substantial minority of biologists believe that ..."
"A majority of academic sociologists find ..."
"The consensus of many editors formed the conventions described here..."
Well, just from reading this talk page I can tell that last one is invalid, and there it is at the top of the neutrally-termed Weasel Words page; uncited and most obviously hypocritical. And from reading below, it seems there wasn't ever a vote taken to show this consensus. 155.94.62.221 12:58, 30 May 2007 (UTC)
- Oh, by golly. This page seems to have become a favorite target for well-meaning new contributors. Why don't you go bother the people who've been working on WP:A and tell them there was never a vote to indicate the so-called "consensus" on it and the policy text is not cross-referenced? I'm sure they'll be thrilled. --AceMyth 14:51, 30 May 2007 (UTC)
- Well, you see, it could have something to do with the fact that in this case wikipedia is going against the grain of hundreds of years of English usage. Look at any other encyclopedia and you'll find that these sorts of phrases are quite common there.
- And I have to say, as rhetorical counter-moves go, rolling your eyes and saying "We've all heard that before" is pretty weak. Maybe you hear the objection a lot because there's some truth to it? Maybe if enough people object to a style guide article it doesn't really deserve to be considered a "consensual guidline"?
- I am a research scientist (have been for 30 years) and have written numerous scientific papers including in the journal Nature. These so called weasel words are really the way scientists tell others that something may be plausible, but we do not have enough data to support the hypotheses. It is crucial not to be dogmatic in science, and these phrases help indicate to the reader that he/she should be cautious of the suggestion or hypothesis. I find it amusing that you would discourage the usage by putting up scary alerts. What else would you have the writer do - state it as fact or leave out alternative hypotheses? 75.104.198.217 (talk) 15:30, 21 June 2008 (UTC) Marc Defant
[edit] Was there EVER a consensus-indicating vote on this guideline?
That is not to say that I disagree with the principles of this guideline, but as it is now, I have seen those principles horribly misapplied (as many of the comments on this page can attest to) such that I suspect that Wikipedia is made worse because of this guideline existing (in its current form).
If this guideline were to be rewritten in a much clearer and universally acceptable way that would establish consensus, then that is exactly how guidelines here are supposed to work. But people need to write the guideline in that consensus-based way before trying to enforce it. And in fact, precisely why demanding consensus is a good idea is because it makes sure that guidelines are well-written, and not like this unclear BS that we are all having to deal with now.
HalfDome 06:22, 17 March 2007 (UTC)
- Sometimes, jeneral rules for clarity end up getting written into specific guidelines, so it gets too hard for newbies to handle, and they try, anyway. Sometimes, being too specific with examples causes other problems. That's a matter for orienteering, welcoming, and organizers to judge and inform. BrewJay (talk) 14:11, 19 October 2008 (UTC)
- That's odd. This guideline has always struck me as pretty obviously a good idea. At any rate, Wikipedia is not a bureaucracy and if anything we should be having a discussion about this, not a poll. I mean, what kind of argument could possibly be made against this guideline that wouldn't also compromise WP:A and WP:NPOV? --AceMyth 01:33, 8 April 2007 (UTC)
You are exactly right about needing a discussion for this. Wikipedia is based around building consensus through discussion, and thus far there has been nothing to indicate that such a consensus-building discussion took place, and, moreover, the poll that did take place indicated considerable disagreement about this guideline. As best as I can determine so far, some individuals just imposed this guideline on Wikipedia without building consensus first, and as you can note if you read through the comments below, it has resulted in all sorts of problems for editors (even though in principle and on the surface it may seem like an "obviously" good idea -- in current practice and in its current details it is much more problematic).
At some point I will get around to challenging the enforcability of this guideline that was established so counter to standard Wikipedia procedure. But no time at the moment...
HalfDome 02:02, 16 April 2007 (UTC)
- That's odd. This guideline has always struck me as pretty obviously a good idea.
- Oh well, that settles it then.
- At any rate, Wikipedia is not a bureaucracy and if anything we should be having a discussion about this, not a poll.
- Because if you discuss it long enough, the opposition gets tired and wanders away, and then you can declare victory.
- Well, you might try looking through the aforementioned archives, and it just could be you'll find some.
- Here's another for you. Starting with the "attribution" guidline, you will (at present) see the line Editors should provide attribution for quotations and for any material that is challenged or likely to be challenged, or it may be removed. Keeping that in mind, once again consider the example "War and Peace is widely regarded as Tolstoy's greatest novel." It may indeed be possible to provide references to this, but it's unlikely to be challenged by anyone who knows anything about literature, so what would be the point of doing it? One of the problems with this "avoid weasel words" guideline is that it empowers the ignorant to dive into an article on a subject they know nothing about, and dispute a line like this because it uses one of the Forbidden Phrases. This kind of activity is very little more than busy work, it has nothing to do with writing better articles. -- Doom (talk) 23:35, 18 March 2008 (UTC)
- It's still an opinion about literature. What makes it Tolstoy's greatest novel? You see, now you're in the faculty of arts, so theoretically, if you hav the time and space to compare it with all of his other novels, then you can prove it using premises that are easy to accept and explain. Do you accept someone else's proof? Is it on the web? That'll save you a lot of thought and bother. Write it first as a fact.
- "War and Peace" is Tolstoy's greatest novel.
- When someone challenges you, then either you'll find someone's poll of Tolstoy specialiststs who determined the same thing, or you'll find someone's comparisons, or you'll end up doing the comparisons yourself. That someone who challenged you would be a foil to check your facts. Off hand, I would say that the topic isn't encyclopedic, because it demands too much detailed demonstration, and yet I hav no idea how terse and certain such a demonstration might be. Only the last option has a problem with WP:NOR, so you'll hav to explain it to another wikipedian, IOW, your foil, who accepts your publisher. BrewJay (talk) 14:11, 19 October 2008 (UTC)
- NO. Under no circumstances should you assert that "War and Peace is Tolstoy's greatest novel" as a fact, because it is not a fact, and cannot be supported as one. It is on the other hand, true that it is "widely regarded" as one -- nearly anyone who knows anything about the subject would agree with the statement that it is "widely regarded" as greatest (though a few might state that they prefer "Anna Karenina", etc). The question at hand has to do entirely with whether the vague attribution to a consensus of experts is somehow slimey and underhanded ("weasely") or merely a short-hand, skipping an issue that isn't really that interesting -- the reason you might have trouble finding something like a survey of opinion of Tolstoy experts on this point is that none of them care to work on anything quite that inane. It's like asking a meterologist for a reference proving that the sky is blue -- their first thought will be "who let in this nut?"
- My point here is that being challenged on something like this is completely silly -- your "foil" in this case is either playing quasi-legalistic gotcha games or is some sort of philosophical extremist (some people think you can't talk about "greatness" if you don't have a greatness-meter). -- Doom (talk) 08:09, 11 January 2009 (UTC)
A straw poll is under way, now. There is one neutral vote. All others are on one side. BrewJay (talk) 14:11, 19 October 2008 (UTC)
I am placing this comment at the top here, but please note that I think this is a highly important matter for this guideline. As Doom points out just below this, the vote on whether the guideline was a good idea was very much divided (34 for, 24 against) and cannot be considered to indicate a consensus. So, I am wondering, was there ever a vote that established consensus for this guideline?
I've spent the past hour or so skimming through the history of the guideline and many times there were statements at the top of guideline saying things like "This guideline is disputed. See the talk page." Those comment were removed (by the original poster of this guideline, among at least one other) with essentially nothing in the edit summaries explaining why.
As best as I can tell, this guideline has always been controversial, a true consensus on it has never been established; as such, it cannot technically be considered a guideline nor part of the manual of style and would accordingly become unenforcable.
- Few policies, other than the blatantly obvious vandalism and spamming, are strictly and easily enforcable under penalty of being blocked. It must be that way. In measure, everyone who spends a lot of time editing has also had a policy stuck in their face so many times that they've resented it. Right now, with the examples, if a lot of people are looking for compliance problems with this guideline, that's exactly what's happening to some newbies. Hopefully, some will see the wisdom in it, too, and see that this guideline promotes clarity, even if it is over-applied, mis-applied, or misunderstood. All three of those things are likely to happen. This policy doesn't mean that a fact is wrong. I means that it doesn't belong here. OR it means that it should be made definite. BrewJay (talk) 14:11, 19 October 2008 (UTC)
- Personally, I am not a "newbie" who resented being accused of weaseling... I read this "guidline" first, long before people started tossing weasel tags around, and I've always had problems with it.
- Further, I submit that the people who wrote this guideline, and the people who advocate it, are the real "newbies": they're newbies at the use of English language. I suggest that there's a somewhat arrogant notion underlying all of this: the new generation of rough-and-ready internet nerds are going to put things on a firmer basis than all those hosers at the Britannica. -- Doom (talk) 08:25, 11 January 2009 (UTC)
[edit] Template Amendment
Voter1 Voter2 Voter3 Concrete Terms: U U U Notability: U U U Neutrality: U U U Contains Equivocation: U U U Audio: U U U Suck or Draw: U U U Terse: U U U
To enter a position, please replase a "U", meaning undecided, with either an "A", meaning abstain, a "Y" meaning yes, or an "N" meaning no. The suck or draw question revolves upon one word in the audio that could be changed to "draw", so it should be either "D", "S", or "A". Identifying yourself at the top of a column of answers is optional, and it will aid in ascertaining that there were no multiple entries from the same person.
- I can't even understand the instructions on how we're supposed to vote on this, but no, this template change is terrible. The existing phrasing treats "weasel words" as a warning sign, the proposed alternate makes a flat accusation that the text is worthless. This wording is far too strong, much as I appreciate the attempt at dropping the pejorative "weasel". -- Doom (talk) 08:19, 11 January 2009 (UTC)
[edit] Archives
- I recommend looking into this "Archive" myself, there are two things you might notice immediately about it: (1) when a vote was taken on whether the article was really a good idea, it roughly split in half, and (2) ESP feels that it's now an "established part" of wikipedia. This is not anything like "consensus", this is more like one determined person avoiding changes to their personal territory. -- Doom 19:04, 12 October 2006 (UTC)
- I took a look at this archive. I didn't encounter any serious discussion about whether "avoiding weasel words" was a good idea, but I did encounter your proposal Wikipedia:Be cautious with compliments and mass attribution and ESP dropping into the discussion page to announce that AWW was already an established part of Wikipedia so you should take your proposal and go away. I bet that sucked.
- I still think that this is a good guideline, though. For all this defending of personal territory, I have stumbled upon this page a few months ago and brutalised it with edits, with most edits having remained intact since, so it's not like AWW has been doomed to stagnation. I think it reflects a common pitfall in writing that often tempts people to take advantage of it and push POV, and that it's very useful to have a clear term and guideline to call it out. But I'm not representative of anything, so if you think there should be a discussion about this go ahead and open one. Just make sure to make a decent effort to spread the word so we don't end up with fifteen people going "for" and "against", because that isn't representative of anything, either. --AceMyth 01:59, 8 April 2007 (UTC)
- I bet that sucked. Sure. That wasn't the only instance of it either: my first tries were hacking on the "avoid weasel words" page itself: all edits instantly reverted by User:EvanProdromou (who in those days went by his initials, "ESP"). Your edits have no doubt been more stable for a number of reasons (not the least of which is that "ESP" has wandered away), and the current version of this article is somewhat improved (I'm happy to see that the list of Forbidden Phrases has gone away). I've still got major problems with it, and I suspect that it's essentially ill-conceived, however well-intentioned. I do understand that some people hide POV by using vague references: just because an idiom can be misused, doesn't mean it should be prohibited. -- Doom (talk) 17:40, 20 March 2008 (UTC)
[edit] "Weasel-inline" tag now reads "Attribution needed"?
This makes things confusing when one is trying to point to a weasel word or phrase that is not looking for a source to be attributed to (e.g. "probably", "most likely", "usually" et al).
71.241.83.238 (talk) 11:47, 25 February 2008 (UTC)
- This has apparently been fixed. DO NOT MERGE weasel words with attribution needed!!! 68.101.130.214 (talk) 10:17, 28 February 2008 (UTC)
[edit] Pejorative Term
I had not seen much discussion of this, so I thought I might introduce a subsection.
The phrase "weasel words" is inherently pejorative, in most english-speaking societies, and this connotation is seldom unintended when one denounces the text of an absent author to a present audience. I would suggest finding a more suitable term.
While some contributors and editors of the Wikipedia may, in truth, make intentional use of ambiguous language - be it due to personal bias, in order to gloss over gaps in knowledge or intellectual rigor, or out of stylistic habit; to sound a little more 'encyclopedia-like', in bad faith, or due to the pure evil of their utterly twisted and irredeemable character - I suspect that in the great majority of cases, ambiguous language appears in the Wikipedia unintentionally. Furthermore, I suspect that it is often beside the point, when not impossible, to attempt to demonstrate that a given ambiguity was or wasn't used intentionally.
Unfortunately, to say that a fellow editor's work is using "weasel words" is to accuse him of adding to or editing the wikipedia in bad faith. Given that actual weasels do not use words, it is very difficult to escape the notion that the original, insulting connotation is intended. It is difficult enough to feel that any criticism of one's work is made in good faith; when such criticism is in the form of an accusation of bad faith on one's own part, it seems to me remarkably predictable that disputes and bad feelings would frequently arise. And human nature is such that many hearts bearing animus would absolutely delight in expressing it in a manner that evaded direct reproach and censure - by finding and thus labelling ambiguous usages, for instance - which surely complicates the matter.
In my opinion, a community cannot 're-brand' a phrase without either failing, or intensifying the degree of any 'insider' vs. 'outsider' effect. Thus I do not believe that an attempt to explain that the phrase "weasel words" somehow 'means' something different in the Wikipedia would be particularly fruitful in a tasty-fruit sort of way.
69.49.44.11 (talk) 04:27, 29 February 2008 (UTC)
- Yes, you are absolutely right. The expression "weasel word" is indeed pejorative, and unfortunately for that reason may be invoked incorrectly in cases such as generalizations or the passive voice, to name just two. Perhaps you might look at weasel word and see whether that article supplies some answers (or indeed you might contribute to it to improve it). Dieter Simon (talk) 18:55, 29 February 2008 (UTC)
- In that case, is there a corresponding "this article needs a more focused writing style" tag? Something more specific than "cleanup" and less loaded than "WW". Some of the WW cases would still apply, though not all: There really is a difference between "Most apples are red" and "Most religious zealots are hypocrites". Notice that the project page's 1st para. says, "the problem is that [WW] are chosen to imply something which they do not say" [emph. added]. This attributed motive seems to define "WW". That's why accusing someone of WW is (justly) pejorative. That motive is probably absent in the apples example, even though it uses the same example word and the same syntax as the zealots example. Jmacwiki (talk) 01:07, 2 March 2008 (UTC)
- There does not appear to be an alternative term. If there were, I imagine this discussion would have arisen quite promptly: requiring the editor to choose between imputing a motive, or not, rather highlights the pejorative interpretation of 'weasel words'; it become explicit and unavoidable.
- For me, the question would be whether the pejorative aspect of the term really contributes anything of value, regardless of how weaselly the words are. I think that the essay Don't "call a spade a spade" and the Dealing with bad faith section of the Assume good faith guideline page argue that it does not. The About good faith section of that guideline explicitly opines that: "[i]t is never necessary that we attribute an editor's actions to bad faith, even if bad faith seems obvious."
- Just to be clear, I think that the existence of the page Wikipedia:Avoid weasel words is fine. We should all seek to avoid using weasel words. What I'm thinking about are the consequences of taking the phrase (in a tag, for instance) and applying it to another person's contribution. 69.49.44.11 (talk) 03:08, 2 March 2008 (UTC)
<-- I was bold. Please continue this discussion, and update the project page as necessary, if the wording introduced with this edit still needs work. I hope it addresses the concerns expressed here, which i read through before editing. Cheers, Newbyguesses - Talk 17:03, 2 March 2008 (UTC)
[edit] Weasel word
We should not forget there is a mainspace article Weasel word. Please try make that the main article rather than this much too prescriptive, regimentative and intrusive project page. Dieter Simon (talk) 00:51, 20 March 2008 (UTC)
- Yeah, I noticed it the other day. My first reaction was "oh great, the disease is spreading": The term "weasel words" is essentially a piece of jargon made up by Evan Prodromou: it's a very specific meaning, a new definition attached to a piece of common slang. It did not exist before he made it up, and now it deserves a wikipedia entry? Can I write some articles about terms that I've made up? (How about if I write articles about terms a friend of mine made up?). -- Doom (talk) 16:16, 20 March 2008 (UTC)
- Maybe this will make what I mean a little clearer: when someone who is not a "wikipedian" says "weasel words" they're talking about a wide range of idioms:
- This article is really about avoiding "vague attribution", which is at best a small sub-set of things that might be termed "weasel words". -- Doom (talk) 17:56, 20 March 2008 (UTC)
- Actually, I just looked at the mainspace article Weasel word again, and it's much better than I thought at first glance -- it's certainly not just using "weasel word" as a pejorative synonym for "vague attribution". -- Doom (talk) 18:34, 20 March 2008 (UTC)
[edit] Weasel words in source
What happens if the source says things like, "Some people think X"? In that case, is it acceptable to write, "Some people think X" in a Wikipedia article? Should I write, "According to Y, some people think X," where Y is the author of the source? Q0 (talk) 01:09, 24 March 2008 (UTC)
- I suppose it depends whether the source is a 'reliable source'. If a distinguished professor in the subject reckons "some people think" something, he is probably more trustworthy than an anonymous Wikipedia editor. It would still be better to find another source though! Cop 663 (talk) 01:35, 24 March 2008 (UTC)
- I think you have to take a hard look at the statement on its own merits, and in its own context, and largely treat them with the same distrust you would any weasel-like words. The key problem here is when a statement is qualified in such a way that it seems to say more than it actually does. Take the case of the Apiloca people of Borneo.
- If the Distinguished Professor is saying something like "some Apiloca fear Cameras," he hasn't really said something any more informative, true or untrue than if anyone had said it. For, surely, some Distinguished Professors fear Cameras, as well.
- If what he is saying is that "many Apiloca fear Cameras," then that is perhaps more informative, but not as informative as it seems. We have no idea how many Apiloca he considers to be 'many'. (Nor, for that matter, any understanding of the degree or significance of the fear.)
- If he has been banned from ever returning to Borneo by a million-signature petition, than perhaps it is a large majority of the Apiloca. On the other hand, if he is a specialist in the phobias of the peoples of Borneo, then it could be a peculiar theme amongst those Apiloca who suffer from anxiety disorders.
- What he is offering is not a fact, but a characterization; this can certainly inform our beliefs, but it is very important that it not be treated as a fact, or taken out of context.
- So, in other words, I think it would be very important to directly mention the source and context.
- "In his book, 'How I Lost Ten Thousand Dollars Worth of The University's Camera Equipment', the Distinguished Professor claims that that many of the Apiloca fear Cameras, a view shared by Tourist, the author of 'Well They Took Away My Polaroids, Didn't They'."
- — 69.49.44.11 (talk) 02:34, 24 March 2008 (UTC)
- I don't think it's any different coming from an authority. Weasel words are fuzzy statistics.
There are lies, damn lies, and statistics.
--Attributed to Mark Twain, but he didn't write it if he said it. —Preceding unsigned comment added by [email protected] (talk • contribs) 02:54, 4 July 2008 (UTC)
It is of mild interest that the DP has observed a form of behaviour that he/she has interpreted as fear on the part of the Apiloca when confronted by cameras. It would, however, be more interesting, and something that one would normally expect from a university academic, to find out why the Apiloca fear cameras. In this way the DP might be able to establish to his/her satisfaction whether he/she has correctly interpreted the reaction, and this might just put the statement in a category other than that of "opinion", which seems to be largely, as far as I can see, what "weasel word" means Pamour (talk) 08:34, 24 October 2008 (UTC)
[edit] square
i love the 'square' part of this article, i really do. f**king hilarious :D keep up the good work wikipedians, haha :D —Preceding unsigned comment added by 195.34.211.145 (talk) 18:30, 28 April 2008 (UTC)
[edit] The greatest team in the world
This statement about the yankees seems is not objective by any measure. There is no universally accepted standard for deeming a team "the greatest in the world". While I did not remove it, I believe it should be removed. 74.47.21.87 (talk) 01:14, 3 June 2008 (UTC)
- I agree with this statement and have in fact made the change. Ronark (talk) 17:46, 5 January 2009 (UTC)
[edit] "Award-Winning"
It seems like half the articles that are about musicians, and far too many other artists and entertainers, start off their articles with "award-winning" before their job title. This may be true, but I always roll my eyes. Of course it's fans who originate articles about musicians, if not the musicians themselves. And of course they want to elevate themselves with some kind of modifier before their job title.
Naturally the awards can be documented, but the content is irrelevant. Generally anyone who meets the notability guidelines will have won some award somewhere that can be documented. It's nearly comparable to calling them a "food-eating" person. At any rate it's not encyclopedic, it's more like something you hear talk show host say and so I submit that "award-winning" is a weasel word.
Of course where major awards can be documented, they deserve a mention, but in the opening sentence "award-winning" reads like "really great!" Youdontsmellbad (talk) 12:45, 4 June 2008 (UTC)
- I think this is classed as a 'peacock term' (although this overlaps with weasel words). See Wikipedia:Avoid peacock terms - "award-winning" has already been mentioned at least once in its discussion page. I think any word construction like this (present participle adjectives) can be misleading. "Award-winning actor" implies that the actor 'wins awards' (continuous tense), when it fact it is usually used for an actor who has, at some time, won at least one award.Weasel Fetlocks (talk) 03:18, 18 June 2008 (UTC)
- Terms like "Nobel Prize-winning" and "Academy Award-winning" are fair enough - they immediately convey specifically what they mean. But the definition of "award" is sufficiently vague that "award-winning" alone could mean pretty much anything & so is rather a leading statement. So actually I will agree with you that this is a weasel word (as well as a peacock term!). Weasel Fetlocks (talk) 03:25, 18 June 2008 (UTC)
[edit] The Cartoon
That cartoon (a picture of a weasel saying "some people say weasel words are great"), is a great example of what a lot of us have been complaining about all along: "weasel" is a pejorative, and accusing someone of "using weasel words" is essentially the same as calling them a weasel. -- Doom (talk) 22:33, 11 June 2008 (UTC)
- The illustration was removed from this article by an unregistered user with no explanation. I have restored it. Weasel Fetlocks (talk) 03:35, 18 June 2008 (UTC)
- I don't agree. It illustrates the topic of weasel words. Also it is attractive & fun. That does not automatically make it bad content. Weasel Fetlocks (talk) 22:21, 21 June 2008 (UTC)
I rather like that image. It gets the point across, and it's just slightly funny, but without being very childish. Also, the page it was on is a style guideline, not an article - so for the writers, not the readers. Therefore, I think we can afford a little bit of fun without feeling that we're lowering the level of seriousness that we should have here. Stratford490 (talk) 23:02, 21 June 2008 (UTC)
Image restored. The contention that it is "childish and lowers the level of quality and seriousness" is entirely POV & may not reflect the prevalent views of the Wikipedia community. There are plenty of other examples of humour in WP project pages (eg. wp:beans). Please don't remove the pic again without discussing first, since other members oppose its removal. It may later be removed if consensus goes that way, but until then it is easier for us to discuss it while we can all see the picture. Weasel Fetlocks (talk) 01:25, 22 June 2008 (UTC)
The image is great, and it is perfectly consistent with the aims of a "serious" project. Serious does not have to mean stodgy. Countless people have effectively communicated "serious" ideas through wit and humour. (That's the whole idea behind political cartoons--well, depending on how "seriously" one takes politics.) The image illustrates a point, and it puts a smile on the reader's face. Nothing "childish" about that at all. Cosmic Latte (talk) 14:10, 11 July 2008 (UTC)
I don't think the cartoon does anything to illuminate the concept -- wouldn't a new reader just find it confusing? I'd be interested in seeing some examples of humor used to effectively explain something here on wikipedia. My bet would be that jokes tend to get deleted. -- Doom (talk)
[edit] "Assume"
In some cases, it might fit under the
tag. In other cases, like in mathematics, it can be necessary to state your assumptions. Even in history, documenting assumptions is not necessarily a bad thing. How safe are those assumptions? But, if it comes to a war of assumptions or something like that, then I would snip the premise, the material, and the conclusions as being part of an argument that really belongs on a talk page or a newsgroup. BrewJay (talk) 02:43, 4 July 2008 (UTC)
I'd like to get a third (and fourth and so on) opinion on whether the use of word "assume" in attribution is weasely (as I believe) or not ("historrian x assumes that..."). Diff.--Piotr Konieczny aka Prokonsul Piotrus| talk 03:26, 25 June 2008 (UTC)
- I think that that is more relevant to Wikipedia:Words to Avoid than to Weasel Words. See the first line of this project page: "Weasel words are small phrases attached to the beginning of a statement". That is not analagous to the example you have given, where "assume" is the primary verb of the sentence. Weasel words are phrases that can usually be removed entirely from a sentence (although it is often beneficial to either rephrase them more neutrally or to cite evidence). "Assume" could contribute to a weaselly phrase, such as "It is generally assumed that -". However, when used in most contexts it is not a weasel word as such.
- Have a look through the Words to Avoid article, as it discusses the hazards of using slightly slanted verbs like "claim", "admit", etc. Weasel Fetlocks (talk) 11:17, 25 June 2008 (UTC)
- Regarding acceptable use of "assume", it really depends on whether it can be qualified with evidence or citation. E.g. "historian X assumes that -" may be OK if that historian has used phrases like "from the evidence we can assume that -" or has otherwise made it clear that he is making assumptions (which should be noted in the article). Less responsibly, using "assume" without justifying it may be rather biased editing. It's often better to replace it with neutral wording like "historian X asserts that -", but I don't think that "assume" is necessarily always a bad word. Weasel Fetlocks (talk) 11:29, 25 June 2008 (UTC)
- Since I'm involved in to this dispute I need to say my arguments: I do have the book on hand, and despite several attributes of seemingly citation, like quotation marks, historian does not support his statement with any references, that would support his rather emotional suggestion (forced re-Lithuanization in this exact case). I'd like to hear how to deal with that kind of sources, and how to describe them properly as being somewhat murky. Thank you in advance.--Lokyz (talk) 23:09, 25 June 2008 (UTC)
- What you see as "unevidenced as emotional" I see as well referenced and neutral statement by an expert on the subject. Nonetheless I do note insist on language "proves, evidences, makes clear" or such. "States, notes" and such are perfectly reasonable, neutral formulations.--Piotr Konieczny aka Prokonsul Piotrus| talk 04:40, 26 June 2008 (UTC)
- Sorry Piotrus, I know your opinion, it wasn't you I was asking. Thank you for your input, but I'd like to hear a comment from uninvolved party.--Lokyz (talk) 14:27, 26 June 2008 (UTC)
- Without looking deeply into the actual debate, I would strongly advice against using word "assume"; we should not judge whether a historian is doing good or bad history. We can, however, look at the reliability of the sources. Are the books published by reputable publishers? Such matters are discussed at WP:RS/N. On the other hand, Piotr, the verb "notes" is equally biased, since one can only note what is true. Merzul (talk) 16:20, 26 June 2008 (UTC)
- Thank you for the analysis. I will use state instead of note in the future.--Piotr Konieczny aka Prokonsul Piotrus| talk 02:41, 27 June 2008 (UTC)
- The word "assume" is frequently used to insinuated an unjustified assumption. Any sentence of the form "X assumes that Y, but really Z" is generally unjustified. Unless X themselves claim it is an assumption, it doesn't fly - if another author W claimed they were making an assumption, I would use "X asserts that Y, but W labels this an unwarranted assumption, claiming instead that Z". This feels more like a Word to Avoid to me. Dcoetzee 01:55, 27 June 2008 (UTC)
- For what it's worth, I wrote a proof on radix sort that used the assumptions my authority based her conclusions on, leading to a context for optimal being met. To a compsci, they were elementary assumptions. To the rest of us I said, try it and see where it leads you...in what sounds like rhetorical opinion, and really isn't. So, assume can be a dangerous word, and how dangerous depends on your context and discipline. On another hand, I see that it's a charged word, even for me, so if you use it in a context where it's not a safe assumption, then someone is bound to make another assumption in your context and say...hah...and this has happened when the assumption failed truth. It is not a weasel word. BrewJay (talk) 11:27, 19 October 2008 (UTC)
[edit] Should "controversial" be considered/listed as a weasel word?
I have been involved in several discussions where editors want to apply the word "controversial" to any concept or person they disgree with. My own opinion is that the word should rarely, if ever, appear in WP. I have come to think this because: The word casts doubt upon the veracity of the statement being described (often reflecting the view of the speaker/writer). There is rarely, if ever, an objective way of ascertaining whether something is controversial. Something can actually become controversial (or come to seem controversial) merely because someone says so. In my opinion, none of these situations is good for WP.
Thoughts?
—MarionTheLibrarian (talk) 20:46, 1 July 2008 (UTC)
- It's hard to define controversial on a planet with a flat earth society. At some point, someone's opinion has to go down the tubes, because it's too far out there. BrewJay (talk) 02:32, 4 July 2008 (UTC
Yes, that's my point exactly. The word conveys no real information for the reader; it merely conveys attitude from the writer. "Controversial" seems (to me) to have every quality of a weasel word.
How would this be best pointed out on the weasel word page?
—MarionTheLibrarian (talk) 10:51, 4 July 2008 (UTC)
[edit] #Redirect from Anonymous authority hmmm. case history?
Anonymous authority is a philosophical term for a wikipedia policy. In both cases, authors are finding support in undocumented or unpublished case histories. IOW, you are an authority on what works for you. You are not an authority on what most people do. Much of Freud's work is analysis of case history. It's usable material, but in some form, it must be published before you can use it. In case histories, it's Freud who is an exemplary authority, not his patients, so there really isn't such a thing as an anonymous authority. Avoid weasel words. Please reinstall my redirection to this policy, because it's the best answer unless case history exists, and it probably does. I see that it doesn't. Go figure.
I looked around at anecdotal evidence and related logic, and I find that authority is itself in the category of logical fallacy under appeals, but only in the case where it's used as a proof (something that really only exists in mathematics) or an authority is held to be infallible. BrewJay (talk) 02:16, 4 July 2008 (UTC)
[edit] I hope that addresses most concerns.
I put the verb form of the American Heritage dictionary definition in, along with a clause showing why violations of this policy are probably in good faith. I took some of the examples from what was intended to be a contrasting essay on this policy. I see now that an effort began in the first comments to tersen this article (remove examples), and a lot of ways are to equivocate. If you think that this article can do without examples, then feel free to delete them, but I think that's what makes it superior to weasel words as an article. Perhaps these bad examples should also be improved, like wikipedia:embrace weasel words did, and, in one step. I've addressed about as many concerns as I can. I could copy a template and rewrite the policy declaration with an article reference to hearsay to avoid a self-referential contradiction, but I don't think it's worth the trouble. Read a grain of salt into everything. BrewJay (talk) 08:25, 4 July 2008 (UTC)
[edit] Problem of definition
In my experience this is among the most misunderstood and so most frequently mis-invoked policies or guidelines in WP - indeed it seems to be overtaking WP:NPOV in this respect. One reason is that the page seems nowhere actually to state that it covers matters of opinion, belief or interpretation rather than simple matters of fact. The statement "some horses are black and some are brown" is not weasel words, but there are plenty out there who will claim it is. The page should make this clear in the first para. Johnbod (talk) 18:08, 17 August 2008 (UTC)
- "There are plenty out there who will claim it is", is in and of itself a weasel-worded statement. ;-) If there is widespread evidence of people misinterpreting this guideline, let's have a look at specific incidents in more detail and see if there's a pattern. A wording tweak may be of help.
- But, let's look at the example you provided. A simple rewrite in less ambiguous language would be a good resolution: "Common colours of horses include black and brown." The problem with words like "some", "many", "few", is that they are inherently and intentionally vague measurements; as an encyclopedia, we want to aim to be precise, not vague. Editors will rightly look at a sentence with vague measurements and want to see them rewritten. Can we provide sourced statistics? Can we replace it with simple, widely-accepted statements of fact that pass WP:V and don't use these terms of vague measurement? Pointing to WP:WEASEL whenever terms of vague measurement are used in an article may not always be precisely correct, but the spirit of good encyclopedia-writing is still there, and shoudln't be discouraged. Warren -talk- 18:41, 17 August 2008 (UTC)
- WP:V is of course a different issue. There is no significant gain in either precision or lack of ambiguity in your version; "common" is just as weasely as "some". Look at Talk:Dormition of the Theotokos for one current example. If the purpose of this guideline is intended to be to outlaw "some" etc, then it really does need a total rewrite. Johnbod (talk) 19:19, 17 August 2008 (UTC)
- The article you've referred to here does have problems with weasel-wording. The "Some Catholics agree with the Orthodox that this happened after Mary's death, while some hold that she did not experience death" is exactly the sort of prose that the WP:WEASEL guidelines warn against. Who are these people that are talked about? Who are the significant proponents of each view, if there are any? Do we have studies or other statistics we can use to define the sizes of the groups of people with these opinions more precisely? Verifiability is absolutely the issue here, and User:Thomaq was quite right to point out that the article is failing to provide verification for sources where contentious statements are being made, and that it's words like "some" that are highlighting the need for this.
- Let me be very clear about this: The issue isn't the word "some" in and of itself, but it is usually symptomatic of a deeper problem. Warren -talk- 22:21, 17 August 2008 (UTC)
[edit] Tedious wording vs. weasel words
Take the following statement:
"Critics have questionned the notion that preagricultural hunter-gatherers would have generally consumed a low-carbohydrate and high-protein diet."
Does the "weasel words" guideline require changing this sentence as follows:
"M.P. Richards, Katharine Milton, Marion Nestle, A. Ströhle ,A. Hahn, S.M. Garn, W.R. Leonard and Sara Elton have questionned the notion that preagricultural hunter-gatherers would have generally consumed a low-carbohydrate and high-protein diet."
Thank you. --Phenylalanine (talk) 22:46, 17 August 2008 (UTC)
- A mention of at least some of these, preferably in citations to works where they do the questioning, would be needed, yes. Johnbod (talk) 23:02, 17 August 2008 (UTC)
- This is the lead sentence of a paragragh, which is supposed to be a summary of the paragraph. The detailed criticisms are metioned and attributed in the following sentences. See Paleolithic diet#Anthropological evidence.
- The form is: "Critics say "XYZ..." (Summary). A says X. B says Y. C says Z. D says..." This sort of paragraph structure seems clear to me, despite the first sentence employing weasel words. Many thanks. --Phenylalanine (talk) 23:42, 17 August 2008 (UTC)
I think the article should be clarified to take the above considerations into account. In my opinion, "weasel words" are perfectly acceptable when used in sentences that serve to summarise information that is subsequently detailed and attributed to specific studies and/or researchers. --Phenylalanine (talk) 00:16, 20 August 2008 (UTC)
- I am going to edit the article accordingly if nobody disagrees. Weasel words are perfectly fine when the context is sufficiently clear as explained above. --Phenylalanine (talk) 12:30, 27 August 2008 (UTC)
[edit] Bot
User:AlexNewArtBot/CleanupSearchResult picks up new articles loaded with undesirable words. Colchicum (talk) 19:56, 20 August 2008 (UTC)
[edit] Avoid stoat words too
(n/t) —Preceding unsigned comment added by 89.139.253.159 (talk) 06:36, 21 August 2008 (UTC)
[edit] recent insertion
"When referencing the subject of a particular study, it is not necessary to identify the individual participants. For example,..."
I have no idea what on earth this means. Nor will most other editors. It contains a number of MoS breaches, too (spaced minus sign, ellipsis dots with comma). Tony (talk) 06:21, 29 August 2008 (UTC)
- I don't really understand your objection. Is the problem with the snippet that you quoted? or the MoS issues that you cite? Sorry if I took the example from the featured article 0.999..., which is in mathematics (my own field). Perhaps I should have considered a more generic example, such as:
- "Some of the students surveyed indicated a preference towards neither candidate."
- -siℓℓy rabbit (talk) 20:05, 3 September 2008 (UTC)
- I like your point, but I think it's more general than that. I tried: "This guideline doesn't apply if your source backs you up: that is, the source identifies a person or group and says that they actually said or wrote what you claim. But see WP:UNDUE for policy regarding how much weight to give any one person or group." Does this cover it?
- On another point: I deleted the first and third of those "clear exceptions"; the first said that anything any guide says is okay, which can't be right, and the third infringed on WP:V's territory. I skimmed the talk page, and didn't see anyone arguing for those, but if I missed something, please let me know. While reading the talk page, I saw some confusion, and I think I might try to get some changes in before the next monthly update. - Dan Dank55 (send/receive) 03:13, 4 September 2008 (UTC)
- Yes, that's the essence of it. It would still benefit from an example. siℓℓy rabbit (talk) 10:17, 4 September 2008 (UTC)
- Any case where an editor is reporting that a source identifies a person or people and says they said or wrote something is not WEASELy; if it's a problem, it's undue weight. If we were writing a style guideline like Chicago, we could create a list of 5 or 10 examples, just to make sure we're not misunderstood. The problem with doing that in an NPOV-flavored style guideline is that a list like that won't be left alone; they'll want to make sure their favorite case is covered and their least-favorite case is not covered. Bottom line: I'm fine with an example or two if what I said can't be understood without the examples. Can you think of a sentence where it's hard to figure out whether the first sentence in this paragraph applies or not? - Dan Dank55 (send/receive) 11:44, 4 September 2008 (UTC)
- I agree with the thrust of these changes, but am not sure they are right yet. "These people believe the earth is flat" (if they are then named & refed) is clearly outside the scope of Weasel, isn't it? There are different issues with the statement (historically in fact dubious - see Flat earth hypothesis) "In the Middle Ages, most people believed the earth was flat". That is within the scope, and should not be rephrased, but the "most" needs referencing. Currently the silliest thing in the page seems to me to be ("Improving ..." section)": "Simply removing words like "some", "most", "many", "may", "some kind of", or "can" will strengthen any statement. Is it still correct? If not, then is that acceptable in a field like Physics or Chemistry? No. Psychology or Sociology? Probability of Significance=.95 (spell it out). If it's important to say, then where are the numbers?" The first sentence is plainly nonsense - try it on the flat earth examples. Can we agree to remove this? Johnbod (talk) 15:27, 5 September 2008 (UTC)
←Reading this page made my fingers itch; "Don't make non-falsifiable statements" would cover a lot of this stuff, and more succinctly. But my instinct is that those of us who value the process here more than the outcome should exercise a very light touch; otherwise we interfere with the primary purpose of the style guidelines, which is to record and represent the views and conflicts and results of that conflict for all Wikipedians. I like what you're saying, John; as far as I'm concerned, you can rewrite the whole page (starting with the title; drive-by edit summaries invoking WP:WEASEL violations set the wrong tone, in my view; maybe "Avoid fuzzy words"? But that's a little broader). But please divide things into two piles; the stuff that is already covered on policy pages such as WP:V, WT:V, WP:NPOV, WT:NPOV, etc should be tossed or moved to those pages and discussed there. For what's left, we should keep things more or less in line with the history of the actual conflicts and resolutions on this project page and talk page; otherwise we'll have to make an effort to solicit for opinions and make sure everyone is still happy with the results. - Dan Dank55 (send/receive) 16:35, 5 September 2008 (UTC)
- P.S. I'm sorry, which first sentence? Do you mean "Weasel words are small phrases attached..."? - Dan Dank55 (send/receive) 16:39, 5 September 2008 (UTC)
- No I meant the first sentence quoted:"Simply removing words like "some", "most", "many", "may", "some kind of", or "can" will strengthen any statement". Tempting as it is to take up your offer, I think it is best to raise things first here, & certainly there are people who don't share my/our views about the page. But I'll see what I can come up with. Johnbod (talk) 16:51, 5 September 2008 (UTC)
- Oh right. Ugh. Kill it. - Dan Dank55 (send/receive) 16:54, 5 September 2008 (UTC)
- Can we also agree that the older:"This page in a nutshell: Avoid phrases such as "some people say" without sources" is better than the current:"This page in a nutshell: Avoid using fuzzy, estimated statistics and hearsay evidence such as "some people say"."? Johnbod (talk) 17:08, 5 September 2008 (UTC)
- I'll just throw a few things out. One problem with the older infobox and with the current first sentence, implying that all we're talking about is "some people say", is that the phrase "weasel word" is actually defined in the dictionaries, for instance MWOS: "a word used in order to evade or retreat from a direct or forthright statement or position". I'm a big fan of WP:NOTLEX and WP:JARGON; if a phrase already means something, we don't get to say it means something else, we have to make up a new phrase if we want a new meaning. So, I'd be happy with either of two directions: either we rename the page and say that it's about "some people say", or else keep the current name (or change it to "Evasive words") and focus the page on exactly what we mean by that. The sentence we just killed was not even close to being right, but it is true that those words, and others, should raise a flag on whether there's an intent to evade or to retreat into non-falsifiable statements. The history of both the project page and talk page show that people haven't settled on which of those two focuses this page is supposed to have. - Dan Dank55 (send/receive) 17:18, 5 September 2008 (UTC)
- Ok, but "fuzzy, estimated statistics" don't seem mentioned elsewhere in the page. I agree we need a clear definition of what we're talking about. "Some people say" & "critics allege" are often just a lack of referencing, which I think we agree doesn't need its own guideline. The examples at Weasel words don't seem great either. Johnbod (talk) 17:49, 5 September 2008 (UTC)
- You make a good case; feel free to start changing things. I'll invite WT:GAN and WT:MOS people. - Dan Dank55 (send/receive) 18:03, 5 September 2008 (UTC)
- This page is really an extension of WP:NPOV and to a lesser extent WP:NOR. Expanding WP:AWW to include a larger variety of propaganda techniques might be appropriate, though that would take a bit of work. The objective, as far as I can tell, is to have some sort of explicit instructions on specific NPOV problems. Weasel wording is the most common, though some comments on loaded language (much of which is now scattered through WP:WTA) might be worthwhile. I don't think this has to be a formal guideline since WP:NPOV is a policy. This is just a subset of that which is not NPOV. SDY (talk) 22:05, 5 September 2008 (UTC)
- Ok, but as Dank says, WP:V is very much part of it. Often the weasel words are created in an attempt to achieve NPOV without doing the work to get adequate referencing. I think nearly all the text now here is rather confused & confusing, & wonder how much really needs adding elsewhere. Yet just demoting this to an essay would I think have many opponents. Johnbod (talk) 01:09, 6 September 2008 (UTC)
←Btw I just self-reverted my addition of CAT:GEN. After giving notice at WT:MOS and WT:GAN, no one has shown up to defend anything on the page, so unless I get more evidence, I'm going to guess that this page doesn't have the kind of central position and broad-based support characteristic of the CAT:GEN subset of style guidelines. - Dan Dank55 (send/receive) 14:44, 6 September 2008 (UTC)
- Also, a confession: I just realized that now that I know that it's not appropriate for CAT:GEN, I'm not as interested in devoting time to the page. I'm not so much being slack, as committed to the idea that no one person should have a heavy footprint on guidelines pages in general, and I have a hard time stopping myself from inserting my opinion. I'll be happy to respond and support positions that seem reasonable if someone else wants to run with this. - Dan Dank55 (send/receive) 14:51, 6 September 2008 (UTC)
[edit] Demotion to essay
Okay, I'm bold-ishly demoting this to an essay. I notified WT:MOS and WT:GAN about the problems, and no one is sticking up for this page. A whole lot of work has been done at WP:V, WP:NPOV and related pages since this page was created, and per discussions above, most of the stuff on this page now seems to be covered by pages that get a whole lot more traffic than this one does. I know I just got finished saying that I wanted to exercise a light touch, and I still mean that; I think going through and trying to change everything to suit me, or to suit a few people, isn't the best way to proceed. Without more input, there's not a lot we can do to save this page IMO. - Dan Dank55 (send/receive) 14:54, 7 September 2008 (UTC)
- I agree, as discussed above. Johnbod (talk) 14:56, 7 September 2008 (UTC)
- I watchlisted the page when it was mentioned at WP:GAN. Conversion to an essay seems like a sensible step to me. Geometry guy 19:46, 7 September 2008 (UTC)
- I've reverted this change. I'd like to see a much stronger justification than "policy pages have received work" before we go changing a very, very long-standing guideline into an essay. It has been considered a style guideline since early 2005, and was in fact a policy for a while before that.
- I saw it first as policy, and it hasn't fundamentally changed. I changed the nutshell to 'Avoid fuzzy, estimated statistics like "some people say"', which was an action in response to Ramir's trying to jeneralize the definition of weasel word. The article still stands for clarity, and now I see that it is specializing in things that people can apply, however mechanically. I don't understand why it would be demoted for work on articles that contain principles used to write this guideline. Those are policy. This is practice. BrewJay (talk) 15:49, 19 October 2008 (UTC)
- The simple fact of the matter is that WP:WEASEL has been used for years as a way of promoting better prose by avoiding unsupportable, unquantifiable statements. It is one of a number of WP namespace articles that present a targeted, practical application of a policy. We need these sorts of pages, and we need these sorts of pages to have some weight behind it, so that we don't get a bunch of dumbasses coming along and saying, "That WEASEL page is just someone's opinion!" and then continue adding in poorly-written statements. Pages like this one appeal to editors' rationality in a way that a concise WP:V and WP:NPOV cannot do on their own. Working editors need pages like this one that they can point newcomers to and say, "see, this is why your contribution isn't going to work on Wikipedia", and have a full page with examples and philosophy so that the newcomer will be able to understand not only what they need to do to change their sytle, but why it's a good idea.
- Let me make this extremely clear: This is a style guideline, not a content guideline. It discusses how we write, not what we write. Warren -talk- 20:08, 7 September 2008 (UTC)
- Since very many weasel issues can and should be resolved by referencing, it is a content guideline too. The page is currently so vague & poorly written, lacking for a start any clear definition of what weasel words are (see above), that I for one think it is unsuitable for it to have any "official" status as it is. Time for a poll perhaps. Johnbod (talk) 20:14, 7 September 2008 (UTC)
- There is an article about weasel words that goes to the coinage, and the definition in the nutshell, is a SUBSET of that definition -- things you can actually look for. The jeneral definition is fog, or vagueness. BrewJay (talk) 15:49, 19 October 2008 (UTC)
- No polls please: they are unhelpful and divisive. If MoS wants to keep this as a style guideline, it needs to be reworked into a style guideline, not a mishmash of style and policy. The onus is on those who want to keep it as a style guideline to fix it. Geometry guy 21:33, 7 September 2008 (UTC)
- I support the demotion to an essay because debasing saying "some" or similar words to quantify an unknown number of people/whatever... surely above or below the half of the total is original research itself. --Novil Ariandis (talk) 10:00, 8 September 2008 (UTC)
- Why do I get the impression some people don't read this article more than once before they hav a problem with it? The first thing you need to know about writing in an encyclopedia is that some things should not be written here that you could easily and should freely speak. BrewJay (talk) 15:49, 19 October 2008 (UTC)
- Agreed. I'm glad to see among these comments that this was policy at some point, because that means I wasn't deluding myself when I was calling it that on template_talk:weasel.BrewJay (talk) 15:49, 19 October 2008 (UTC)
←Let's get a rhythm going on style guidelines issues; it's just as important to figure out how to handle conflict over style guidelines as it is to make improvements to this particular project page. I have questions:
- Are we agreed that we want to continue to point people to this page? Would anyone prefer to discourage use of the page even as a summary and a pointer? (For instance, see WP:ATT; it was demoted to an essay in July, but it's still a widely-used and valuable pointer to core content policy.)
- Are we agreed that there seems to be more interest in demoting than not? That's my initial guess; if we wanted to demote any page currently in CAT:GEN, and I made the same notifications, we'd have more than two people showing up voicing opposition. I'm not trying to predict the outcome of the debate; I'm trying to figure out how to proceed. I think I agree with G-Guy that, if it appears we have the !votes to demote, then it's reasonable to ask the people who want to not-demote to help out. Please at least get this page up to the quality of an essay, and pick out your 3 favorite sentences that you'd like to keep; that way, if the page is demoted, we'll know which parts are most important to work into other guideline and policy pages.
- How do we adjust our Wikipedian instincts to the reality that no two wikiprojects will ever agree on all style guidelines? The only tool we have is consensus, and that tool is guaranteed not to work well; professional English is hard and it varies among countries and even from one section of a newspaper to the next. That's why no one knows all the style guidelines, even though it's a matter of policy that guidelines can't be ignored, and why WP:V0.7 is about to go on sale at Walmart largely un-copyedited.
- How do we overcome the known downsides of working in a nonprofit environment? The fun stuff gets done, the boring stuff doesn't. Working on your own articles is fun, copyediting articles you don't have a connection to is boring. Promoting style guidelines you feel passionately about is fun; reviewing existing guidelines you don't care about to see if they've been superceded by later work is boring ... and also thankless, since every page will have at least a few champions. There's around 99% agreement with the statement that current style guidelines are not likely to be read and absorbed even by all the very active editors; there's an impression that they are too difficult and extensive and not sufficiently reflective of consensus. How much pruning do we have to do to get a much higher rate of "buy-in"?
- Is is okay to re-demote the page, as the best way to get more people to show up and complain about the demotion? - Dan Dank55 (send/receive) 13:05, 8 September 2008 (UTC)
- I agree with "demoting" this to an essay. It's pejorative, often abused, and just an aspect of WP:V. Essays are great for explaining and exploring specific parts of the policies and guidelines, but shouldn't be treated like The Law, as this one often is. --Itub (talk) 13:36, 8 September 2008 (UTC)
- Re-demoted for the purpose of attracting attention (and potential workers!) to this page. On another subject: please see WT:WPMOS for discussion of improving and reducing the size of the style guidelines and getting more people involved. It's important, it's hard if you don't know the style guidelines (so please consider volunteering if you are somewhat familiar with them), and it's somewhat urgent because of WP:V0.7. - Dan Dank55 (send/receive)
- Okay, I have put this back as style guide. This is a long standing part of the style guide and would require a much greater consensus (i.e. far more editors involved) to demote it. The biggest problem with Weasel (unlike WP:Peacock) is that quite a few people who come here to edit this page do not understand it so it drifts in quality with well meant but bad edits. As for the general copyediting issue tell me about it. I have just reviewed thousands of articles for the Schools Wikipedia, going through edit histories to try to find the best versions to include. There are plenty of people who copy-edit but plenty more who add badly written content. That isn't a problem with a style guideline its about people. This guide is critical to get people to understand "just because something is true you cannot definitely include it" and it has has the full force of a style guide for years so you cannot just take that off I am afraid. If you want to get a discuss on the topic take it to a community board.--BozMo talk 09:00, 9 September 2008 (UTC)
- Undone. It isn't a style guideline at the moment, but a mixture of form and content. Indeed your statement about its "just because something is true..." purpose reveals this basic problem. That has nothing to do with style: it is about WP:V and WP:NOR. Those that want to retain a style guideline on weasel words actually need to write one. Geometry guy 09:10, 9 September 2008 (UTC)
- I don't doubt sticky little fingers are all over the current text. What about a fairly deep revert? [1] with the added sentence "If a statement is true without weasel words, remove them. If they are needed for the statement to be true, consider removing the statement." which is the only improvement on the current version? The page should match WP:PEACOCK. However please note that this is good precedent for insisting on better consensus for changing policy pages than a snapshot of the talk page. --BozMo talk 12:31, 9 September 2008 (UTC)
- I was just reading some of the arguments on other style guidelines pages, and I realized that I went about this the wrong way by demoting first and asking for comments second; it can create an impression that I'm throwing my weight around. The right way to proceed is to make sure all the arguments are collected so everyone can see them, ask for responses, and then make any needed changes. In this particular case, the reaction is so strong in favor of demotion that I don't think I, or anyone, should un-demote for the time being, but I added a "caution" at the top to let people know that nothing has been decided and the discussion is still ongoing; I hope that helps.
- BozMo, you asked on my talk page about the relevance of WP 0.7. The answer is: we won't know for sure what the relevance is until the DVD is published; let's talk then. A lot of people are worried about having 30000 un-copyedited pages show up in Walmart as the official Wikipedia DVD, but we'll see. - Dan Dank55 (send/receive) 13:29, 9 September 2008 (UTC)
- Hmm. I don't think in fact V1.0 is supposed to be more or less official than any other offline Wikipedia but I still don't see how the state of the style guide bears on the lack of copy-editing. The Wikipedia Schools DVD (see Wikipedia:Wikipedia CD Selection )will probably always have more users than the Release Version (because it is free, and has a million user start) and there are evidentally lots of copy editors out there. Just far more tinkerers thats all. The style guides help copy editors versus SPAs and are indispensible. --BozMo talk 14:57, 9 September 2008 (UTC)
- Version 1.0 is an irresponsible mistake. It assumes, what FAC daily disproves, that we have a reliable system for evaluating articles; we do not. I hope it will be either largely harmless or provide a steady income for the Foundation; and it does keep a certain number of people who want titles away from article space.
- But, that being said, copyediting does require either an intelligible MOS or no MOS at all; the present system of dozens of small pages, most divided into bullet points, each point expressing the opinion of a cabal of a few editors, means that we have guidance on copyediting which most copyeditors don't know - and all too often guidance most copyeditors disagree with. Septentrionalis PMAnderson 15:42, 9 September 2008 (UTC)
I disagree with demoting this to essay; it should be a guideline. It should not be a style guideline, because it deals with content; it is, to my mind, a corollary of Neutrality and Verifiability together. But I believe it to be generally accepted, and something we should in general do; that's what makes a guideline. Septentrionalis PMAnderson 15:19, 9 September 2008 (UTC)
- I haven't gotten a groundswell of agreement with my concerns about WP V0.7; let's assume, in fact let's hope, I'm wrong, and wait and see what happens. You asked on my talk page, BozMo; I'll answer there, and folks are welcome to join in. I've had a lot of requests to just stay focused on improving the style guidelines; sounds like a great plan.
- I want to second what G-Guy said above about polls; they're divisive. I want to add that style talk pages have a way of devolving into polls. A better way to go is the approach of WP:RfA Review, but there's a problem. After thousands of person-hours of work, they are almost at the point where people have something to discuss and !vote on. Here, we've got maybe a couple of orders of magnitude more work to do than that, if we want to get what passes for consensus on the content and status of every page related to style. (No one is forcing us to do that much work, but when we try to copyedit without being able to point to the reasons for edits, various bad things happen.) I haven't been successful in this latest round of requests at getting more people to help.
I can't do something like RfA Review for style by myself, obviously, so I'm going to have to cut corners: I'm going to make a list of issues, position and arguments for every style guideline page in my user space, and that will necessarily involve judgment calls. Worse, it's likely that the usual people will show up on style talk pages, point to what I'm doing, give that as a reason for supporting or opposing, and we will all, many times, be accused of being bullies and fascists who don't listen to reason. What fun. But you know, I'm just over worrying about this. There's work to be done. I'll start with this page some time today, and give a link. - Dan Dank55 (send/receive) 15:50, 9 September 2008 (UTC) P.S. To be clear, I don't mean that all complaints about what I'm doing in my userspace will be unfair; many will be fair, and I'll let them all stand, fair or not. - Dan Dank55 (send/receive) 17:25, 9 September 2008 (UTC)
- Update: I'm putting everything else on hold while we work on copyediting the articles in the WP DVD before it shows up in stores. I don't disagree with Sept and BozMo that the general idea of this page is important, but as G-Guy pointed out, if you say we need this page because we need to let people know that not everything that's true belongs in WP, then what you're missing is that there were 3000 talk page messages in and around April alone, as I recall, at WT:V, on just that subject. Policy discussions have taken place and are taking place on policy talk pages; these are not things that can be decided at WT:WEASEL. It would be better to take the same approach that was taken at WP:ATT, and use this page as an essay that summarizes the "weasel" point of view on these subjects, but points to policy pages so that people can join the discussions on the pages where the relevant discussion is actually happening. I favor re-demotion to essay, but I'm un-watchlisting until the WP DVD is out the door. - Dan Dank55 (send/receive) 13:05, 10 September 2008 (UTC)
Demoting this to an essay strikes me as a great idea. There is not, and never has been, any consensus about this as a "style guide" entry -- it's a little peculiar that it's advocates can't seem to grasp that point. -- Doom (talk) 19:56, 10 September 2008 (UTC)
The whole article needs some references to reliable sources about scientific writing which back up the main claims made in it, especially in the "Variations" chapter. I am currently inclined to add a citation-needed-template at the start of the article. --Novil Ariandis (talk) 08:36, 11 September 2008 (UTC)
- It isn't an article, it is a guideline. Guidelines live or die on community consensus and should not have references --BozMo talk 12:08, 11 September 2008 (UTC)
- That makes no immediate sense to me. Articles of any stripe become more understandable and stronger if they link to other articles for backup and explanation of terms. As a how-to on style, I'll understand if this article is self-contained, and that's exactly the recurring criticism of the intro: "generally accepted by a majority of editors". Who? How long? Which categories? What percentage have actually seen it? As the version that attacks vagueness in jeneral, though, it's very convenient to link it to historical documents on the topic as discussed in court rooms. No hearsay. BrewJay (talk) 15:17, 19 October 2008 (UTC)
As it currently is ( link ), this is just about as confusing as it could possibly be. On the one hand, it's got a guideline banner. OTOH, someone edited the Nutshell box into something which not summarize the policy, but to detail it's current status ("Was a guideline.") I may be bold tonight and revert the Nutshell box to actually summarize the essay/guideline/whatever to say something different. It is HARD for an editor who doesn't care about the debate drama, but does care about following guidelines, to determine its current status as it is. And to apply it, also.
At any rate, PLEASE keep in mind that this is a widely hit, and used, piece of project space. And most of us who hit it really don't care WHAT it says, as long as it can be read/classified/applied in quick fashion to our editing of other articles. Maybe a MASSIVE revert is needed, IMVVHO. LaughingVulcan 12:14, 11 September 2008 (UTC)
- You say "most of us who hit it really don't care WHAT it says, as long as it can be read/classified/applied in quick fashion to our editing of other articles" - which is EXACTLY the problem! What does it say in a nutshell? Most of us who have spent time looking at it are not at all sure. Might I suggest you reconsider drive-by tagging in the style you describe. Johnbod (talk) 17:07, 11 September 2008 (UTC)
- You have something of a point, which is one reason I didn't just do it this morning.
- The nutshell box as it is right now provides nothing but noise in the signal-to-noise ratio as suggested at Template:Nutshell. To me, right now, it says, "This isn't a guideline. Go somewhere else."
- As to content of the box, the version of 1 June 2008 of the nutshell box is clear. "This page in a nutshell: Avoid using phrases such as "some people say" without providing sources." That version is the same as what was present 1 January 2008. That version is the same as what was present 31 May 2007. I'd say that's more than good enough to give me an indicator of what this policy/guideline/essay/whatever is about. That summarizes the current state of the rest of the content. Saying what its status is does not help the Editor to understand what this policy/guideline/essay/whatever is about.
- As to drive-by tagging... I've read the essay WP:TAGGING, and generally agree with its' principles. But that wasn't what drew me here. As I was reading an Article I came by something that I wasn't sure if it was a use of weasel words or not. So I left a messsage on the Talk page, for discussion, soliciting opinions before being bold. I asked, "Does, "word," strike anyone as weasel-y?" Since I thought I have a good bead on what that means, I hit Save. Now, it's been awhile since I've checked this Guideline. So I hit it, and find a very funny illustration that is new and interesting. Then I see a box saying it's a Guideline. And I see that the nutshell telling me this policy/guideline/essay/whatever is now an essay, but doesn't tell me what it is about. And I went, "WTF?"
- My point in quick and efficient application is that an Editor should be able to come here, briefly read the page, and then know what to do. It used to do that for me. The text of the guideline still does. So just how did the nutshell box break? 'Cause it sure looks broken from where I'm reading it, and it was not before.
- I'm not saying it isn't important to clarify the status of this project page. But the nutshell box is the wrong place to do it in. And it doesn't help the Editor passing by to understand the content. And FTR, the guideline seemed remarkably clear to me the first time I saw it back in '06. It still does. Maybe that's the problem with me: I don't see what's wrong with it being a guideline. But I know that the nutshell should summarize the content, not the status.
- But, were I to fix the Nutshell box as it is, given the article content, I'd revert it back to the way it was for (apparently) over one year. That is better than, "This used to be a guideline. Now it's an essay. Run along and go play." LaughingVulcan 01:57, 12 September 2008 (UTC)
[edit] Deep revert?
Any comments on a deep revert to when the format matched WP:PEACOCK? Specifically as above [2] with the added sentence "If a statement is true without weasel words, remove them. If they are needed for the statement to be true, consider removing the statement." which is the only improvement on the current version? --BozMo talk 12:10, 11 September 2008 (UTC)
- Probably better than what is there now, but "...If they are needed for the statement to be true, consider referencing or removing the statement." would be much better. This is one of the core problems with this page, in all versions: it purports to deal with statements that cannot be referenced, but in practice it is very often, perhaps most often, cited in connection with statements that could be referenced, but have not been. I for one don't really want to encourage weasel-hunters to go around removing stuff without tagging and waiting (see, on a similar issue, the discussion on the just-failed WP:Burden of proof - well I can't find the link for that - anyone?). Johnbod (talk) 17:14, 11 September 2008 (UTC)
- WP:BURDEN. - Dan Dank55 (send/receive) 23:53, 11 September 2008 (UTC)
- I can't support that version as a guideline, either, BozMo. I totally understand the temptation to skip all those messy policy discussions and give a simplified, neat presentation. No one wants to have to read that much crap. But we must resist the urge to skip the real discussion and give people an alternative discussion; WT:NPOV, WT:OR and WT:V tell the real story, not this page. The reason this page got started was that they didn't tell the story back then. - Dan Dank55 (send/receive) 23:51, 11 September 2008 (UTC)
- I am interested in your views on WP:Peacock then. The essential content could be anywhere but this guideline is mainly about style not content. --BozMo talk 05:41, 12 September 2008 (UTC)
- My view on PEACOCK is that most editors get the concept that words like "fantastic" are probably bad in article-space unless you're representing what someone else thinks, and making a long list of such words doesn't create the same problem that you get at WP:Words to avoid and on this page. That is, any kind of long list of examples in style guidelines tends to invite edits as people insert examples that support their favorite articles and delete examples that contradict them, so these kinds of lists are frowned on. We're more or less stuck with WP:Words to avoid, although IMO it should be a lot shorter. PEACOCK doesn't seem to be a problem because there's only one concept represented, and there are only so many ways you can say it. On this page, I think the general rule applies. For instance, "some" can be a weasel word. We shouldn't try to define here exactly when "some" is okay and when it's not; that depends on how it's being used, and the larger Wikipedia community has been extremely vocal on these topics (see next section). I wouldn't mind keeping this page as a much shorter essay, with a list of potential weasel words, and advice to see the core content pages to see how they should and shouldn't be used. - Dan Dank55 (send/receive) 16:05, 12 September 2008 (UTC)
[edit] A shorter explanation
This is my opinion of a shorter explanation of what weasel words are, and why they're wrong. I may be right, or I may be wrong. But here goes:
Weasel words are terms attached to a statement which make the authority of the statement unclear. The underlying statement, or the weasel term itself, may be an unreferenced opinion and should be edited or removed, a fact which has been unreferenced and needs to be cited, or a statement not requiring referencing which could be edited to make that clear. As such, the statement either needs to be rephrased, referenced, or removed. Because Wikipedia relies on material being verifiable and not being original research, statements containing weasel terms need to be either:
- Properly cited as a referenced fact.
- Rephrased without the weasel terms.
- Removed as an opinion, not a referenced fact.
- Noted for later editing.
Common sense will dictate the occasional exception. Even in these cases, weasel terms can usually be rephrased. If there is doubt as to whether a phrase contains weasel words, ask about it on the Talk page of the article.
I guess I still don't understand what's so unclear about it. LaughingVulcan 11:44, 12 September 2008 (UTC)
- I support all that, but on the other hand, WP:V and WP:OR cover the relevant issues, and the exact wording has been raked over in tens of thousands of talk page comments, and reflects consensus as well as any WP pages do. I understand the desire to restate things in language that is simpler or more accessible, but the bottom line is that the larger community has been extremely vocal about these issues and isn't asking for our help translating what they've said. - Dan Dank55 (send/receive) 15:36, 12 September 2008 (UTC)
- Dan, All roads lead to Rome does not mean that we have no need of maps. LV,This summary statement is a great improvement. Dan, style is different from content and weasel as peacock is also a matter of style. Plenty of great lawyers use weasel words carefully. We should not and we need to be explicit. --BozMo talk 16:08, 12 September 2008 (UTC)
- WP:V and WP:OR don't sufficiently cover the specific phrasing issues that WP:WEASEL and WP:PEACOCK get into detail about. The policy pages cannot stand on their own as a complete, self-contained treatise on how Wikipedia articles should and shouldn't be written. There simply isn't enough space in those policies to document all the real, actual issues that crop up in day-to-day editing. Your edit history suggests you spend the majority of your time in Wikipedia namespaces, so perhaps you don't come across well-meaning, poorly-informed newcomers too often... if you did, though, you'd understand we need a range of pages with some teeth behind them, to get these newcomers focused on -- and interested in -- writing in an encyclopedic style. WP:WEASEL helps with that in ways that WP:V and WP:OR cannot. Warren -talk- 17:26, 12 September 2008 (UTC)
- I'm tied up with WP:V0.7; I won't have time to respond until it's out the door, probably in December. - Dan Dank55 (send/receive) 17:45, 12 September 2008 (UTC)
- Thanks for the reply, Dan. I also read the above that you're pretty tied up.
- I can understand that V and OR cover the relevant issues, and I think we agree that taken together they probably cover "weasel" and "peacock" situations. But V does not cover the notion that original research often masks itself with an unverified appeal to authority (though, in fairness, V does say that it must operate in concert with OR and NPOV.) OR is much better about incorporating V into it, but OR does not readily acknowledge that there are times and places where a phrase might be used which does not need to be referenced or removed - rephrasing might be enough to avoid V and OR both, yet leave the essence of the phrase in. (Because the phrase is most likely common sense that would not be challenged by a majority of editors or readers.)
- In short, I think Weasel fills a gap in the intersection between V and OR, and that it always has. (But I also can see that your opinion may differ from mine about that.) But, if this guideline does not directly conflict with either V or OR, aside from detailing where exceptions might happen, then again I don't see why it can't exist as a guideline. It's my experience that guidelines help interpret and apply policy. (I'll detail the problem with specific examples below.) LaughingVulcan 22:45, 12 September 2008 (UTC)
[edit] Examples
I've been looking at "what links here" from the Weasel template, which has reinforced my original impression that this template, and this guideline, is more often applied wrongly than correctly. For example, where are the weasels in St John Ambulance Australia, tagged for several months? Can they be "In general, youth and cadet divisions meet once a week, to in a designated place, to conduct a training night. As mentioned above, these nights are not just spent learning first aid. The training program includes various other topics, which are of general interest to most." and a couple of similar statements? The article has only one inline cite, & needs a citation tag rather than a weasel one. Other articles/sections are tagged despite meeting the 2nd "clear exception" in the page. I haven't really seen any articles where "citation needed" tags would not be more appropriate. Johnbod (talk) 18:03, 12 September 2008 (UTC)
- This seems like the central question to me; how is it actually used? - Dan Dank55 (send/receive) 20:19, 12 September 2008 (UTC)
- One quick test to that is if there's any inline tagging done. Template:Who, Template:By whom, and Template:Weasel-inline are all examples referenced in the Weasel template documentation. None of them here. So we go deeper.
- As to specific examples, jumping to the current article:
- The claim that, "St John is the largest first aid training organisation in Australia." may be a peacock, or borderline weasel. Who says it's the largest? Were it cited, it wouldn't be a problem. Were verifiable facts introduced which proves it's the "largest," again no problem.
- "The training program includes various other topics, which are of general interest to most." Most who? Who says the topics are of general interest to most?
- "In most states, new youth members will be put through a Senior First Aid Course (SFA), which is usually worth ~$200." We could ask which states, but the more interesting question is Who says the SFA course is worth $200?
- What independent sources answer these questions? And if none, then are these statements worth rephrasing, or should they be removed? Which are worth an exception? Which are common sense to anyone who lives in Australia?
- Now, the template could still be inappropriately inapplied. But unless those questions are answered, we can't say if it's applied correctly or not. I also note that the Talk page contains no help.
- On the other hand, the {{references}} banner at the bottom now seems to be inappropriately inapplied. There are references at the bottom. So it needs Template:Refimprove instead. In this case removing the Weasel template probably wouldn't hurt anything major. Yet I could find those examples, anyway.
- Picking another completely random Article example, I got National_Basketball_Association#Recent_problems. The first sentence, "The NBA has lost a lot of its popularity due to widely publicized problems within the league." Who says it's lost a lot of its' popularity because of problems? And that's the justification for the whole section, apparently. There you go, clear Weasel. Sure, V and OR cover it. But Weasel described the problem with that sentence a lot better.
- And there seem to be between 1,000 and 1,500 examples that What Links Here
the template historyreveals to me, including transclusions. Approximately 0.06% of the approximate total article count. What would be a good randomly chosen sample size to determine the appropriateness of the template, and under which statistical mechanism would we like to operate to determine the validity of template application? Or would we rather just cite anecdotal examples? I'm not picking on the example - it is still a good question. LaughingVulcan 23:32, 12 September 2008 (UTC)
- I agree, & mentioned, the article has referencing issues, but I just can't see how ""St John is the largest first aid training organisation in Australia." may be ... borderline weasel" in any shape or form. It is a bald stement of fact, which might be right & might be wrong, but is surely totally verifiable or falsifiable either way. Once again we come back to the fundamental question: what the hell is a weasel anyway? Nobody seems to know, or everyone has their own idea. Johnbod (talk) 14:09, 16 September 2008 (UTC)
[edit] One other item...
...And I'll be brief.
My understanding from WP:GUIDELINE is that the current forum to discuss upgrades/downgrades to guideline/essay status is Wikipedia:Village pump (policy). Was the change from guideline to essay discussed there? I can find where the un-demotion was auto-reported ( link )Thanks, LaughingVulcan 00:19, 13 September 2008 (UTC)
- Not to my knowledge. WP:GUIDELINE (aka WP:POLICY) says: "Wikipedia:Village pump (policy), discussion of existing and proposed policies". WEASEL was a style guideline. WP:VPP people have expressed a distaste for style guidelines issues in the past, so much so that style guidelines are the only policies and guidelines currently not being reported on promotion and demotion at WP:VPP; those are reported (now) at WT:MOS and WT:MOSCO. This subject you're bringing up has current threads at both WT:MOSCO and WT:POLICY. - Dan Dank55 (send/receive) 13:53, 16 September 2008 (UTC)
- Just to be clear, I'm not opposed to discussing any guideline at WP:VPP, and I often do. I just don't often get a response on style issues. - Dan Dank55 (send/receive) 15:45, 16 September 2008 (UTC)
[edit] Zzzzz
For anyone still tuned in, I made a specific recommendation for a change at WT:V and a possible related change of focus here. - Dan Dank55 (send/receive) 15:58, 20 September 2008 (UTC)
- Okay! I guess I'm not going to be able to put off working on this page any longer, it was just suggested for a merge. I'll get to work today; I've been collecting suggestions, and we have a talk page full of them. - Dan Dank55 (send/receive) 17:49, 23 September 2008 (UTC)
- Dank, You are all over the place (as in posting in lots of places) with this including rather hard to follow messages which don't all get a response (also confusing style and policy). Could I suggest you slow right down in one place until you have collected a reasonable number of engaged interlocutors? Then we can start trying to take it forward. --BozMo talk 19:13, 23 September 2008 (UTC)
←If you look at my contribs, you'll see I watchlist a lot of pages, but I'm not starting up conversations on this issue in different places, that I recall (except for WT:V ... I felt that was the logical first step, but no one responded, so I'll come back there after we've finished here). I responded to what G-guy said at WT:WORDS, and I responded to what MBisanz said at WT:PEACOCK, and I've been responding to other people on this page, too. Moving on, do we have agreement or disagreement with some of the following principles? (And if you'd prefer to do this at some place like the Pump or WT:MOSCO or WT:MOS, that's fine, but I did specifically mention this page over at WT:V.)
- Slapping "per WEASEL" in an edit summary borders on AGF issues. People don't like to be called weasels. I propose we rename this page, or if MBisanz's proposal to merge goes through, merge it into another page.
- The name I'd recommend is WP:Clear language. I'd like for this page to be seen as more important, which would probably happen as a result of being linked directly from WT:V. Please see WT:V#Small furry creatures.
- Policy trumps guidelines, every time. If the reason to remove text from an article is a policy reason, then we should say that. However, I'd be okay with an edit summary on deletion of material that said "per WP:Clear language" if this (renamed) page made it clear that it is attempting to explain which language will always fail the test at WP:BURDEN, no matter how many sources you find, because the language is too vague to support, or impossible to prove right or wrong by citing a source. Thoughts? - Dan Dank55 (send/receive) 20:17, 23 September 2008 (UTC)
- Also, where did I confuse style and policy? - Dan Dank55 (send/receive) 20:35, 23 September 2008 (UTC)
- I think WP:Clear language is a very interesting proposal on Weasel. But it doesn't cover peacock, which I tend to think of as the other half of a matching set. What did you think of WP:encyclopedic language which kind of gets both? This used to exist a few years ago I think. --BozMo talk 20:41, 23 September 2008 (UTC)
- I'm not getting anything on that name, even a deleted page (but then I'm not an admin), but that sounds helpful, if you can find text from it. - Dan Dank55 (send/receive) 20:47, 23 September 2008 (UTC)
- Unfortunately even as an admin I struggle to trace pages which have moved. There is Wikipedia:Forum_for_Encyclopedic_Standards there was structure around it. I think it went out of fashion (see [3] because it was too all embracing. People wanted lots of specific rules rather than a few general ones. Apparently the opposite of todays trend. --BozMo talk 08:16, 24 September 2008 (UTC)
[edit] Comment
If you try to eliminate weasel words, how will ideologues sell their ideas ? if someone wants to couch a discussion, making their extreme or narrow viewpoint seem palatable or popular, what discussion method should they use ? If you start marking weasel words for deletion, entire sections fall apart.
[edit] =
[edit] Suggested change to wording of nutshell
A certain editor appeared to think that citing a source was sufficient to allow use of weasel words in an article. This is clearly not the intent of the article, as I read it. I suggest changing the nutshell to make this clear and avoid acrimony in the future:
The page's text ought also be changed to clarify whether citing sources is sufficient. --Rogerb67 (talk) 22:09, 3 October 2008 (UTC)
- It is surely very clear that it is. Johnbod (talk) 22:13, 3 October 2008 (UTC)
- So you're saying that the resolution to a statement such as "Some people have suggested that John Smith may be a functional illiterate." Is changing it to "Some people have suggested that John Smith may be a functional illiterate.[1]", not rewording per Wikipedia:Avoid_weasel_words#Improving_weasel_worded_statements and WP:SUBSTANTIATE (and presumably citing as well)? --Rogerb67 (talk) 22:21, 4 October 2008 (UTC)
- "Some people say..." may not be great but "Many historians believe..." + cites may often be an appropriate thing to say. The train wreck above & on the page is the story of WP's inability to define a boundary between the two. Johnbod (talk) 22:26, 4 October 2008 (UTC)
- OK so we basically agree and I haven't grossly misunderstood the intent of the guideline. My problem with the nutshell is it is easily interpreted as meaning that simply citing the most gross use of weasel words is OK, and indeed I had a mild disagreement with a user who argued that. I'm inclined to abandon WP:WEASEL and cite WP:SUBSTANTIATE anyway. Thanks for clarifying. --Rogerb67 (talk) 22:37, 4 October 2008 (UTC)
- There are also issues like - is the cite to one of the "some", or to an analysis of several of the "some people"'s views, or something in between. Sometimes it is better to say "Historian Fred Dweeb believes...", other times not, eg if the ref is to "Dweeb, Fred; The Debate over the Literacy of John Smith. Johnbod (talk) 22:49, 4 October 2008 (UTC)
[edit] The word " probably" =
Good day , could the word " probably" be called a weasel word?
What about the example below :
e.g. : The disease described in the Chronicle of England is probably yellow fever
would the use of the sentence above , as a footnote text, be acceptable as to scientific standards for college assignments?
thanks for all help mates
A Byrne —Preceding unsigned comment added by 58.169.80.47 (talk) 07:51, 7 October 2008 (UTC)
- The assumption is of course that a source can be found to any statement made, but the further back in time we go the more unlikely it is that any such sources may be found. We are back at the old problem of making a plausible assumption of things that almost certainly would have happened a long time ago, but which cannot possibly be sourced. This also applies to occasions when too many sources could be amassed, such as "in World War II, in both Germany and Britain rationing had to be introduced". These are necessary generalizations which it would be ridiculous to having to find sources for, a) whom are you going to cite as being the most representative of the sources because there are so many, and b) surely everyone knows by now that rationing was going on. Some things just don't have to be sourced, surely.
- As for the term "probably", no it is perfectly reasonable to make an assumption if the actuality cannot be sourced (and proved) at "this precise stage in time". Isn't this how most scientific theories start out on their long course before they are being proved by experiment? One scientist says to another, "you know, there is 'probably' some kind of 'black hole' out there somewhere, that causes such and such". Well, that sort of thing takes an awful long time before it can be proved. And as for sourcing, that takes quite some time longer. So, I think between one scientist and another, they will accept the term "probably" for what it is, as an indication that they have an inkling but the fact can't be proved and sourced yet at this moment. Dieter Simon (talk) 00:46, 8 October 2008 (UTC)
Thanks for all help guys ,
I have a dilemma in my assignment :
in fact I am writting about a chronicle of colonial times in Brazil . In the manuscript I read says that in 1687 some unknown plague killed lots of people and by the shallow description of the disease ( yellow fever' s two known symptoms only are described) and after talking to one friend who is a physician, for a more scientific approach , and referring to another historian' s book , I came to the conclusion that the disease might be yellow fever . So I put as a footnote in my assignment :" Probably yellow fever " . Think it is quite acceptable , for I cannot go and check the dead myself , unless some archaeological/forensic research proves otherwise. So the term " probably " serves me well. It cannot be considered a weasel word.
That is one of the problems with very old manuscript chronicles , you can never be 100% sure . A Byrne 58.169.129.48 (talk) 05:52, 8 October 2008 (UTC)
- Here that would be WP:OR. Johnbod (talk) 15:32, 8 October 2008 (UTC)
- Yes, that's right, editing a Wikipedia article is a different matter, but presumably your assignment has its own set of rules and you obviously must know them from the outset. Wikipedians can only include as facts what is already written elsewhere and cite it. Dieter Simon (talk) 00:42, 9 October 2008 (UTC)
If someone gives up aquaculture after three months, and they don't hav aquatic plants, I'll be tempted to write their experience off as a plankton bloom. I can never be sure, though, unless they measure turbidity levels. This one is tough, because I write "probably" so much, myself. Sometimes, I will even say "almost certainly". And, in aquatic biochemistry for example, a lot of variables are present. It boils down to a judgement call on how important a fact is, how distinctive a disease is, and how many authorities came to the same conclusion without a conference. New Tank Syndrome is not a distinctive disease. "Probably" is equivocation, though, and outside of mathematics and physics, I think you should get used to it. BrewJay (talk) 10:26, 19 October 2008 (UTC)
[edit] Under the heading "offensive"
The "Backronym" page does not have a heading called "offensive" at the moment, someone needs to fix this or delete the sentence. Sorceressknight (talk) 18:52, 18 October 2008 (UTC)
- I spotted that too, and came to see if anyone else had noticed... I'm leaving it to the pro's though. It probably needs rewriting, without reference to an article, or at least one that's not likely to be changed - I'm guessing the "Offensive" section of the "Backronym" page was removed either with or without a general consensus: those sorts of potentially-offensive sections and articles are always being taken apart and put back together by well-meaning types who don't know their guidelines... Which is precisely why I'm not doing the edit! But someone should, because as it stands, it isn't illuminating the question "Are some articles better off with or without the passive voice?" too well - it gets the point across, but it's a bit confusing without the quoted section. 82.11.194.227 (talk) 19:27, 10 November 2008 (UTC)
- That section was from an old version of the page, restored on 24 September, but it no longer adds much to this guideline page, the Bacronym article is different now, so I have removed the section, and there are plenty of examples provided elsewhere. NewbyG ( talk) 23:05, 10 November 2008 (UTC)
[edit] I like how clear this is becoming.
Even though weasel word is more general in its definition, I like how easy this is to read and apply. I don't believe that any volume of dissent on this topic is a problem, either. It's just that wikipedia is not equipped to make professional writers out of everyone. Learning to cast any sentence in the active voice was hard for me, and I still write some passive stuff. I recommend The Practical Stylist. I found it very satisfying to do all of the the exercises at the end of chapter eight without a deadline or a reviewer. BrewJay (talk) 10:05, 19 October 2008 (UTC)
- The problem is that it's too easy to apply: you get people who feel empowered to edit subjects they know nothing about, because they see one of the Forbidden Phrases and figure it'll obviously be better if they remove it. So something like "Gary Snyder is a poet frequently associated with the Beat Generation" gets turned into "Gary Snyder is a Beat Generation poet" -- the problem being that this later statement is dubious and debateable, while the first is obviously true to anyone who knows anything about the subject. Even if all that happens is a "citation needed" tag gets slapped on that statement, that's still pretty silly: you're not supposed to have to add references to everything, you're supposed to reference things that are "challenged or are likely to be challenged", but in this case, because of this style guide entry you're getting a challenge that doesn't mean anything because the person making the challenge doesn't actually know anything about the field. -- Doom (talk) 01:07, 26 October 2008 (UTC)
- In other words, I strongly, emphatically, disagree with this: If a statement can't stand on its own without weasel words, it lacks neutral point of view; either a source for the statement should be found, or the statement should be removed.
- Real world case: someone wanted to say "Beatnik" is considered by many to be a pejorative term. Someone slapped a "weasel words" tag on this. How can we fix this to avoid that challenge? Well one way would be to just say this: "Beatnik" is a term with some pejorative connotations. That makes the "weasel words" go away doesn't it? But it doen't actually make it a better article in any way: all it is is a bit of legalistic gyration to silence people who are hyped up about the Forbidden Phrases. And further I submit that supplying a citation to some article discussing the connotations of the term 'beatnik" would be at best a minor improvement. Not everything needs to be cited: some things are important to cite, other's just aren't. Not one would bother to challenge this point, were it not for the existence of this style guide. --- Doom (talk) 01:44, 26 October 2008 (UTC)
[edit] HEAR ME ALL WIKIPEDIANS, FOR I HAVE A SUGGESTION!
I would like to propose that the policy should be amended so that a cited weasel-y statement is acceptable, somewhat of a compromise between this and WP:EWW. Vote or comment and the results we be shown at the Villiage pump for wider review.--Ipatrol (talk) 00:38, 26 October 2008 (UTC)
- Absolutely not. Presenting a quote of an opinion is a typical journalist trick to slip in the POV that they're pushing -- it's often little better than openly editorializing. Either there's something sleazy and misleading about a line like "War and Peace is widely regarded as Tolstoy's greatest novel", or there's nothing wrong with it. Slipping it in by finding someone you can quote who said what you want to say is very close to "gaming the system". -- Doom (talk) 01:10, 26 October 2008 (UTC)
"Weasely", rather than "weaselly". Unaccented second syllable. —Preceding unsigned comment added by 98.210.15.120 (talk) 04:45, 24 November 2008 (UTC)
[edit] Removing caution tag from article
Looking at the discussion page, it looks like the debate on whether this should remain a style guideline ended about a month ago. I'm removing the caution tag from the page, but feel free to restore it if debate continues. -Kieran (talk) 18:46, 27 November 2008 (UTC)
[edit] CANCEL THIS GUIDELINE!!!!!
Wikipedia should not be too precise....Or it will be useless... —Preceding unsigned comment added by Alonso McLaren (talk • contribs) 06:28, 29 November 2008 (UTC)
Biased against weasels--John Bessa (talk) 03:31, 21 March 2009 (UTC)
[edit] Example
Just passing through. The example "Some people prefer dogs as pets; others prefer cats", which the guideline implies is OK, doesn't seem ideal to me. This statement seems kind of pointless and unencyclopedic. Would any article really benefit from having this pointed out? I wonder if anyone can think of a better example to illustrate the point being made? —Preceding unsigned comment added by 81.157.196.150 (talk) 05:01, 19 December 2008 (UTC)
[edit] What would the opposite of weasel words be?
Say instead of having words and phrases that support a statement, you have words that cast doubt on a statement. For example: "So-n-so used to be heterosexual" vs. "So-n-so says he used to be heterosexual." 67.135.49.198 (talk) 21:19, 12 January 2009 (UTC)
- That's like asking what the opposite of punching someone in the face would be. Warren -talk- 01:16, 26 January 2009 (UTC)
- that's easy: it's punching someone in the fist with your face.
- weasel-wording is the act of using vague and misleading phrases to support or advance a claim that you couldn't ordinarily support or advance on wikipedia. it's insinuation, and it's the same thing whether you're insinuating that something is true or insinuating that something is false. --Ludwigs2 06:25, 21 March 2009 (UTC)
[edit] "Terrorism" a weasel word?
Considering its contentious nature, could the word "terrorism" be added to the weasel word list? Nathan McKnight -- Aelffin (talk) 12:03, 19 January 2009 (UTC)
- I think you are misunderstanding the concept. Please look at the examples from the project page. 67.135.49.198 (talk) 01:18, 25 January 2009 (UTC)
[edit] Proposal to add page to CAT:GEN
See WT:MOS#Propose adding to Wikipedia:Avoid weasel words to Category:General style guidelines. - Dan Dank55 (send/receive) 19:11, 29 January 2009 (UTC)
[edit] The media should read this article
Reading the list of weasel words reminds me of reading an article from the mainstream media. All reporters need to read this article. —Preceding unsigned comment added by 63.195.35.189 (talk) 22:46, 3 February 2009 (UTC)
[edit] Birthright citizenship in the United States
Is "a lot of people, too many to list" sufficient justification for removing a [who?] tag?-32.146.97.244 (talk) 20:51, 25 February 2009 (UTC)
- On the other hand Wikipedia tags are often used as harassment. For instance does the statement "jumping in front of fast moving cars is not recommended" really need a citation? The word "recommended" already flags this as purely an opinion. But more importantly the knowledge or obvious of the conclusion truly is so widespread that finding and agreeing upon "Top" experts will be difficult.
- OK such statements are often merely reminders of "common experience" or common sense which theoretically should be omitted...except almost everyone new to the topic may potentially learn via error while overwhelmed by the newness. I say as long as the caution is short and pithy and obvious -- let it stand without pointless references.
- Save the citations for technical details supporting those little cautionary common sense conclusions. Anyone who disagrees with that should try holding their breath until they get a citation from one of the "top" 10 experts on earth that they need to breathe. Heh 69.23.124.142 (talk) 01:50, 28 April 2009 (UTC)
[edit] Doubtful
- Weasel words are generally considered to be words or phrases that seemingly support statements without attributing opinions to verifiable sources.
Aside from being a glaring and highly prominent violation of the guideline that is being explained, this simply isn't true. "Weasel words" are not "generally considered" to mean this. This is a meaning that Wikipedia seems to have invented. —Preceding unsigned comment added by 81.129.130.231 (talk) 04:50, 1 March 2009 (UTC)
[edit] ...As most Wikipedians agree...
Hi, 216.90.33.33, yes, I can see doubts arising about my edit. Yes, I did try to make the point by using an example, as I thought the original sentence was meant to do. The trouble with the prompts "Who", "What", etc. is that they try to prompt the author to cite exactly who said what and what is involved. That of course is never possible with ad populum arguments (how many Wikipedians can one possibly cite in this case?). That is why I reverted the prompts. Are you happy with my intentions, or do you think they need discussing further? Do let me know if there are further points. Dieter Simon (talk) 22:37, 13 March 2009 (UTC)
[edit] Suggested removal of content
I think this guideline is great, and needs to be applied more often, but there are two areas that I think should be cleaned up that could create problems in editting. First, I think the first bullet point on passive voice regarding style manuals should be changed to say something like, "While Weasel Words are often used in the passive tense, the passive tense can still be used in WP articles." As it stands, the point say nothing and contradicts itself. Second, remove the "some people like dogs..." example, as it is another example weasel words that people could draw from. While the idea is good, that point should harken back to the section above saying that the opinion should be avoided altogether and reworded. For instance, "Polls have shown that preference for cats and dogs is split," with an appropriate citation, or simply letting the article speak for itself without the quote at all. The point in question either needs to be totally reworked or removed, as it seems to be a loophole to allow weasel words as long as someone says, "The believers are too numerous to qualify."
Again, this is a great guideline, but let's remove the loopholes, and thus the arguments. Angryapathy (talk) 21:03, 23 March 2009 (UTC)
[edit] Opening sentence
- Weasel words are words or phrases that seemingly support statements without attributing opinions to verifiable sources.
Here are some dictionary definitions of "weasel words":
- "intentionally evasive or misleading speech; equivocation" (Collins English Dictionary)
- "statements that are intentionally ambiguous or misleading" (Compact OED)
- "deliberately misleading or ambiguous language" (Encarta)
- "statements that are intentionally misleading, ambiguous, evasive, or indirect" (The Wordsmyth English Dictionary)
- "Convoluted language used to spin or mislead; sophistry; euphemism" (Wiktionary)
I could go on. You will see that nowhere is there a definition that corresponds the one used here (i.e. that specifically mentions unattributed statements or verifiable sources). The definition that Wikipedia uses here is a small subset of the definition in general use -- perhaps the term was originally chosen by someone unaware of the more general meaning, I'm not sure. I believe, therefore, that the opening sentence quoted above is incorrect. I changed it to "In Wikipedia, weasel words are..." but this was reverted, I think because it was taken to imply that such statements wouldn't be considered "weasel words" outside Wikipedia, rather than that "weasel words" has a wider meaning outside Wikipedia, as I intended. I therefore propose changing the opening sentence to:
- Weasel words are statements that are intentionally evasive, ambiguous or misleading. In Wikipedia, the term specifically refers to words or phrases that seemingly support statements without attributing opinions to verifiable sources.
Matt 13:29, 11 April 2009 (UTC). —Preceding unsigned comment added by 81.157.196.214 (talk)
- We are editors and not gods. (Although some editors would disagree with my claim.) The dictionaries listed above make an un-Wikipedian look into the author's heart and see "intentions". Weasel words, as we need to define them, need to have an objective test, not competing subjective claims where two editors can swap accusations "intended"..."not intended". The existing definition is fine. patsw (talk) 02:00, 21 April 2009 (UTC)
[edit] List of examples is getting longer and longer
Should there not be some kind of limit to the list of examples? The number of examples must be infinite, I myself could think of hundreds without even straining my imagination. Am I going to include all of them. I don't think so. Surely, we now have goodly number of them, and we only need an idea of what they are rather than putting what we may or may not come across. We know now what a weasel word is, can we not just limit the list to what we have so far? Dieter Simon (talk) 23:00, 20 April 2009 (UTC)
- Agreed. I've inserted a more visible comment to not add any more examples, perhaps this will work better for the short-attention-span listcrufters who skip over the detail. -- OlEnglish (Talk) 02:58, 21 April 2009 (UTC)
In fact, it could even use a trim. -- OlEnglish (Talk) 03:00, 21 April 2009 (UTC)
but ... Montreal is the nicest city in the world ! ..
so what's your point ? ;) —Preceding unsigned comment added by 69.70.102.38 (talk) 00:31, 13 May 2009 (UTC)
[edit] Example section
I removed a significant number of the examples given. A lot of them were redundant, and some weren't even weasel terms. Please, keep the list short! —Preceding unsigned comment added by 74.33.174.133 (talk) 01:23, 18 May 2009 (UTC)
|
http://ornacle.com/wiki/Wikipedia_talk:Avoid_weasel_words
|
crawl-002
|
en
|
refinedweb
|
Updated: January 21, 2005.
Applications and services can use application directory partitions to store application-specific data. Application directory partitions can contain any type of object, except security principals. TAPI is an example of a service that stores its application-specific data.
One of the benefits of an application directory partition is that, for redundancy, availability, or fault tolerance, the data in it can be replicated to different domain controllers in a forest. The data can be replicated to a specific domain controller or any set of domain controllers anywhere in the forest. This differs from a domain directory partition in which data is replicated to all domain controllers in that domain. Storing application data in an application directory partition instead of in a domain directory partition may reduce replication traffic because the application data is only replicated to specific domain controllers. Some applications may use application directory partitions to replicate data only to servers where the data will be locally useful.
Another benefit of application directory partitions is that applications or services that use Lightweight Directory Access Protocol (LDAP) can continue using it to access and store their application data in Active Directory. For more information, see Managing application directory partitions.
An application directory partition is part of the overall forest namespace just like a domain directory partition. It follows the same Domain Name System (DNS) and distinguished names naming conventions as a domain directory partition. An application directory partition can appear anywhere in the forest namespace that a domain directory partition can appear.
There are three possible application directory partition placements within your forest namespace:
If you created an application directory partition called example1 as a child of the microsoft.com domain, the DNS name of the application directory partition would be example1.microsoft.com. The distinguished name of the application directory partition would be dc=example1, dc=microsoft, dc=com.
If you then created an application directory partition called example2 as a child of example1.microsoft.com, the DNS name of the application directory partition would be example2.example1.microsoft.com and the distinguished name would be dc=example2, dc=example1, dc=microsoft, dc=com.
If the domain microsoft.com was the root of the only domain tree in your forest, and you created an application directory partition with the DNS name of example1 and the distinguished name of dc=example1, this application directory partition is not in the same tree as the microsoft.com domain. This application directory partition would be the root of a new tree in the forest.
Domain directory partitions cannot be children of an application directory partition. For example, if you created an application directory partition with the DNS name of example1.microsoft.com, you could not create a domain with the DNS name of domain.example1.microsoft.com.
The Knowledge Consistency Checker (KCC) automatically generates and maintains the replication topology for all application directory partitions in the enterprise. When an application directory partition has replicas in more than one site, those replicas follow the same intersite replication schedule as the domain directory partition.
Notes
Every container and object on the network has a set of access control information attached to it. Known as a security descriptor, this information controls the type of access allowed by users, groups, and computers. If the object or container is not assigned a security descriptor by the application or service that created it, then it is assigned the default security descriptor for that object class as defined in the schema. This default security descriptor is ambiguous in that it may assign members of the Domain Admins group read permissions to the object, but it does not specify to what domain the domain administrators belong. When this object is created in a domain naming partition, that domain naming partition is used to specify which Domain Admins group actually is assigned read permission. For example, if the object is created in mydomain.microsoft.com then members of the mydomain Domain Admins group would be assigned read permission.
When an object is created in an application directory partition, the definition of the default security descriptor is difficult because an application directory partition can have replicas on different domain controllers belonging to different domains. Because of this potential ambiguity, a default security descriptor reference domain is assigned when the application directory partition is created.
The default security descriptor reference domain defines what domain name to use when an object in the application directory partition needs to define a domain value for the default security descriptor. The default security descriptor reference domain is assigned at the time of creation.
If the application directory partition is a child of a domain directory partition, by default, the parent domain directory partition becomes the security descriptor reference domain. If the application directory partition is a child object of another application directory partition, the security descriptor reference domain of the parent application directory partition becomes the reference domain of the new, child, application directory partition. If the new application directory partition is created as the root of a new tree, then the forest root domain is used as the default security descriptor reference domain.
You can manually specify a security reference domain using Ntdsutil. However, if you plan to change the default security descriptor reference domain of a particular application directory partition, you should do so before creating the first instance of that partition. To do this, you must prepare the cross-reference object and change the default security reference domain before completing the application directory partition creation process. For information about precreating the cross-reference object, see Prepare a cross-reference object. For information about changing the default security reference domain, see Set an application directory partition reference domain.
|
http://technet.microsoft.com/en-us/library/cc784421(WS.10).aspx
|
crawl-002
|
en
|
refinedweb
|
The following JCK vm tests failed on this sun4m machine when checking proper format conversion of the returned double/float value:
javasoft.sqe.tests.vm.fp.fpm025.fpm02501m2.fpm02501m1
javasoft.sqe.tests.vm.fp.fpm025.fpm02501m2.fpm02501m2
jtg-s210:[133]% uname -a
SunOS jtg-s210 5.8 Generic_109291-02 sun4m sparc SUNW,SPARCstation-5
jtg-s210:[134]% psrinfo -v
Status of processor 0 as of: 05/30/00 18:11:45
Processor has been on-line since 05/24/00 17:34:13.
The sparc processor operates at 170 MHz,
and has a sparc floating point processor.
To Reproduce:
=============
1. Extract fpm02501m1.ksh and fpm02501m2.ksh from attached files: fpm02501m1.jar/fpm02501m2.jar
2. Run fpm02501m1.ksh:
jtg-s210:[138]% fp02501m1.ksh
D.checkDefRetDefault(i) fails; value==NaN; lap # 5
D.checkDefRetDefault(i) fails; value==-Infinity; lap # 6
97
2. Run fpm02501m2.ksh:
jtg-s210:[168]% fpm02501m2.ksh
D.checkDefRetDefault(i) fails; value==NaN; lap # 5
D.checkDefRetDefault(i) fails; value==-Infinity; lap # 6
97
This problem is limited to sun4m machines ONLY.
xxxxx@xxxxx 2000-05-30
xxxxx@xxxxx 2002-01-21
I can reproduce it with JDK1.3.1_02 on Win NT 4.0 SP 5 on PC powered by Cyrix PR233 processor.
-Xint
exclude java/lang/Double isNaN
exclude java/lang/Float isNaN
and the test passes. Also, -XX:-CanonocalizeNodes also passes the test.
canonicalized version of Test2::isNaN()
__bci__use__tid____instr____________________________________
original code: . -1 0 10 if i8 == i9 then B0 else B1
canonicalized to: . -1 0 11 if d4 != d4 then B1 else B0
Bytecode and generated assembly for "Method boolean isNaN(float)":
javac bytecode:
0 fload_0
1 fload_0
2 fcmpl
3 ifeq 10
6 iconst_1
7 goto 11
10 iconst_0
11 ireturn
c1 generates for v9:
0xfa403410: sethi %hi(0xffffe000), %g3
0xfa403414: clr [ %sp + %g3 ]
0xfa403418: save %sp, -112, %sp
0xfa40341c: ld [ %fp + 0x5c ], %f0
0xfa403420: ld [ %fp + 0x60 ], %f1
0xfa403424: fcmpd %f0, %f0
0xfa403428: fbe,a,pn %fcc0, 0xfa403440
0xfa40342c: nop
0xfa403430: mov 1, %l0
0xfa403434: mov %l0, %o0
0xfa403438: b %icc, 0xfa403448
0xfa40343c: nop
0xfa403440: clr %l0
0xfa403444: mov %l0, %o0
0xfa403448: mov %o0, %i0
0xfa40344c: restore
0xfa403450: retl ; {return}
0xfa403454: nop
0xfa403458: nop
0xfa40345c: nop
c1 generates for v8:
0xea0033d0: mov -4096 + %g3
0xea0033d4: clr [ %sp + %g3 ]
0xea0033d8: save %sp, -112, %sp
0xea0033dc: ld [ %fp + 0x5c ], %f0
0xea0033e0: ld [ %fp + 0x60 ], %f1
0xea0033e4: fcmpd %f0, %f0
0xea0033e8: fbe,a 0xea003400
0xea0033ec: nop
0xea0033f0: mov 1, %l0
0xea0033f4: mov %l0, %o0
0xea0033f8: b 0xea003408
0xea0033fc: nop
0xea003400: clr %l0
0xea003404: mov %l0, %o0
0xea003408: mov %o0, %i0
0xea00340c: restore
0xea003410: retl ; {return}
/*
* Below is the java source that reproduces the same bug.
* javac Test2.java
* java_g -Xcomp -Xcomp -XX:CompileOnly=Test2.isNaN Test2
*/
public class Test2 {
static boolean foo(double i) {
return isNaN(i) || !isNaN(Double.NaN);
}
public static void main (String[] args) {
/**
* The first invocation of isNaN in this program generates the wrong result.
* However the second invocation generates the correct result.
*/
System.out.println("isNaN(Double.Nan) = " + isNaN(Double.NaN));
System.out.println("isNaN(Double.Nan) = " + isNaN(Double.NaN));
}
private static boolean isNaN (double v) {
return (v != v);
}
}
xxxxx@xxxxx 2000-06-02
for V8 must add a nop instruction between fcmp and fb
xxxxx@xxxxx 2000-06-06
Committing to 1.4.1.
xxxxx@xxxxx 2002-01-23
I was curious about the sudden appearance of this bug so I did some
investigation. I checked the Merlin C1 source code that handles floating-
point branches and determined that this bug should still be fixed. I looked
at this bug's change log and found that indeed it had been fixed and
integrated way back in June, 2000. However, on 1/21/02 the bug's state was
changed to "dispatched". I didn't believe the bug was somehow reintroduced
so I ran the JCK tests both directly and under "runthese" using build rc-b91
on a SPARC V8 (sun4m) machine, jtg-s212. They both pass in several modes:
java; java -Xcomp; and java_g -Xcomp -XX:CompileOnly=javasoft.
This bug is still fixed and integrated.
xxxxx@xxxxx 2002-01-31
I do not understand the comments for this bug. I have an
application that uses java.util.HashSet; many users complain
on their Windows systems that they get the error message
"Illegal Load factor: 0.75 at java.util.HashMap.<init>". I
would like to tell these users, "install java x.y.z and the
problem will be gone". All bugs I could find that matched
mine were marked as duplicates of this one. Tell me, what
version of java exactly will fix this bug for Windows users?
Please use version numbers, not these "Merlin"/"Kestrel"
code names if possible, because I cannot fine the web page
that tells me which code names correspond to which version
numbers!!!
I have discovered a similar problem on a Dell Quad Xeon
Server running JDK1.3.1_01. The error does not happen
everytime I run the sample program above, but does happen
approx. 25 times per 1000 runs. It is really causing havoc with
my J2EE server. Does anyone have a fix for this version of the
JDK or do I have to upgrade?
I got "java.lang.IllegalArgumentException: Illegal Load: 0.75"
error using Oracle Universal Installer for 9.2 which include JRE
1.3.1. I run Win2k with SP3 on Cyrus processor. Any
workaround?
|
http://bugs.sun.com/bugdatabase/view_bug.do%3Fbug_id=4342148
|
crawl-002
|
en
|
refinedweb
|
Got the following error message from an application:
Exception occurred during event dispatching:
javax.swing.text.StateInvariantError: infinite loop in formatting
at javax.swing.text.FlowView$FlowStrategy.layout(FlowView.java:429)
at javax.swing.text.FlowView.layout(FlowView.java:182)
at javax.swing.text.BoxView.setSize(BoxView.java:265)
at javax.swing.text.BoxView.layout(BoxView.java:600)
at javax.swing.text.BoxView.setSize(BoxView.java:265)
at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:11
69)
at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:523)
at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:657)
at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:636)
at javax.swing.JComponent.paintComponent(JComponent.java:398)
at javax.swing.JComponent.paint(JComponent.java:739)
at javax.swing.JComponent.paintChildren(JComponent.java:523)
at javax.swing.JComponent.paint(JComponent.java:748)
at javax.swing.JComponent.paintChildren(JComponent.java:523)
at javax.swing.JComponent.paint(JComponent.java:748)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:546)
at javax.swing.JComponent.paintChildren(JComponent.java:523)
at javax.swing.JComponent.paint(JComponent.java:719)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:23)
at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:
54)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:91
)
at java.awt.Container.paint(Container.java:960)
at sun.awt.RepaintArea.paint(RepaintArea.java:298)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:193)
at java.awt.Component.dispatchEventImpl(Component.java:2665):10
3)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
Expected behavior: The text is shown
Actual behavior: Throws exception and text is never shown
Was it working before? If so, what was changed?
This is the first time that we tested it.
To Reproduce:
Run Bug with a value like 40000 - it happens *EVERY* time. We've tried
values down to 33000 and it still happens.
It's caused by bugs in javax.swing.text.GlyphView.java - which uses a short
to represent the offset and length into a Document. However if you set the
document with text that is 32767 or less characters the problem never occurs.
There is no workaround other than not setting text that long !!
Standalone Test Case:
import javax.swing.*;
public class Bug {
/** Run with a number indicating the number of characters in the string **/
public static void main(String aArgs[])
throws Throwable {
if (aArgs.length != 1) {
System.err.println("Usage: Bug [No of characters]");
System.exit(1);
}
int lLength = Integer.parseInt(aArgs[0]);
JFrame lFrame = new JFrame("TestMe");
JTextPane lText = new JTextPane();
lText.setEditable(false);
lText.setOpaque(false);
lFrame.getContentPane().add(lText);
lText.setText(getText(lLength));
lFrame.setSize(500, 500);
lFrame.setVisible(true);
}
private static String getText(int aLen) {
StringBuffer lBuff = new StringBuffer();
while (aLen > 6) {
lBuff.append("12 21 ");
aLen -= 6;
}
while (aLen > 0) {
lBuff.append("a");
aLen--;
}
return lBuff.toString();
}
}
Add some linefeeds to keep paragraphs under Math.MAX_SHORT in length or
provide your own GlyphView implementation from the ViewFactory.
This is intentional behavior. It is a huge memory savings
to use shorts instead of ints since so many of these get created.
The limitation is that the longest GlyphView can be is
Math.MAX_SHORT characters at an offset of Math.MAX_SHORT
from Element.getStartOffset(). We feel this is a reasonable
restriction. Element.getStartOffset is limited to Math.MAX_INT
so documents are not limited as claimed in the bug description.
The GlyphView restriction simply means a paragraph cannot exceed
Math.MAX_SHORT.
xxxxx@xxxxx 2001-03-13
Are you crazy? It is *intentional* that it throws
exceptions?
If a webpage is loaded with a large paragraph, it is
*acceptable* that the page should fail to load and throw an
exception?
I am trying to use a TextPane to view log files, and get
the same problem.. The file has about 260000 characters in
it, and I don't believe it has any lines in it anywhere
32767 characters. All lines have \n linefeeds, and I blow
up every time I load. This NEEDS to be resolved.
Well, thank you, pals!
This Error (note that it's not just an exception but an
error) almost terminated a project we are trying to sell!
Try displaying a 60K sized, concatenated BASE64-encoded
String with JEditorPane, and try to figure out why the
application goes haywire!
If you would at least catch this error internally and throw
a reasonable exception, I could see your point, but the way
you approach this bug right now is plain ridiculous!
Even Lotus Notes didn't expect this behaviour and won't let
you access mails with paragraphs this long... I too suggest
you ought to rethink this issue.
I have filed another bug with Sun, including outlining the
workaround described here that requires no more memory.
Hopefully they won't close it and ignore customer input when
a win/win solution obviously exists.
Your customers don't feel that this is a reasonable
restriction, much less a reasonable implementation. The cast
to short blindly and silently loses data. Code like this
should never be allowed in what is supposedly a
production-quality system.
This entire problem could be very easily resolved by simply
performing an architectural tweak:
1. Make GlyphView an abstract class.
2. Make two (or more) subclasses of GlyphView; one that
stores offset and length as short (if memory savings are
that important) and one that stores them as int (so you can
actually do what your public interface indicates you can do,
and not lose data.) Call them, say, GlyphViewShort and
GlyphViewInt.
3. Make createFragment(int p0, int p1) in GlyphView a
factory method that constructs the appropriate-sized
GlyphViewShort or GlyphViewInt depending on the size of p0
and p1.
4. Instead of explicitly calling the GlyphView constructor,
create and call a factory method that constructs the
appropriately-sized GlyphView.
5. Instead of accessing length and offset directly, access
them with a method int getLength() and int getOffset().
Thats it. It's that easy. It should take no more than 5
minutes to make all of your customers happy.
That's a lot better than telling your customers that their
code is unreasonable (even when you don't know what they
need to do,) and fail silently, or bomb out horribly if the
sign bits are wrong when you cast to short.
If you *really* want to save space for short paragraphs, you
can make a derived class GlyphViewByte that stores offset,
length, and that poorly-named variable "x" into bytes if
they're all small enough to fit.
I also noted in the other bug report that exceptions/errors
aren't thrown reliably--this can simply cause silent failure
too.
After I filed the bug on this, along with a solution on how
to fix it for real, Sun never responded. Good job, guys.
If anyone at Sun can justify how a blind, narrowing cast to
short is a good idea in production code, please let us know.
Again, I'll be happy to give you a much better solution
(that not only works in all cases, but saves *more* memory
than your bad bugfix here) as I outlined in the bug report I
filed.
To be fair, Sun did respond--almost seven months after I
filed the bug report. They indicate that this bug was fixed
in JDK 1.5.0 beta, and it seems to be. I'm doing Sun's job
for them and indicating that here, as they haven't.
|
http://bugs.sun.com/bugdatabase/view_bug.do%3Fbug_id=4425177
|
crawl-002
|
en
|
refinedweb
|
Template talk:Infobox Play
From Wikipedia, the free encyclopedia
[edit] Start
This info box for plays was modelled after the Film Infobox. After working on the Category:Ancient Greek plays, I decided an info box would be best for things like the list of characters. I'm open to any suggestions for additions or changes. We could add things like the date written, the list of full text links, etc. I'm only going to add this box to the ancient Greek plays for now. However, anyone would like to use this for other plays, or make this into a larger project, feel free. -Ravenous 05:14, 13 January 2006 (UTC)
[edit] Additions
I think there should be a section for date of premiere, country or origin, language of origin, series, subject and genre. What do others think? Remember 20:46, 1 December 2006 (UTC)
- Okay I've added it. Feel free to revise it. Remember 20:24, 8 December 2006 (UTC)
Why are there two settings? and what's mute? just wondering --Goodface87 17:08, 13 December 2006 (UTC)
- There isn't two subjects (i removed the extra one in the list above). Also, mute is for non speaking characters. That's usually what they were listed under in the books of plays I've got. - Ravenous 20:39, 14 December 2006 (UTC)
Can there be a "basis" field for plays that are based on source material?--Cassmus 09:06, 2 April 2007 (UTC) I am currently testing this Infobox for a prototype theatre stub on a musical, and I ran into scale problems, viz. insufficient room to properly spell out the Author (theatre), Soundtrack Composer, and Scorer under "Written By." Recommend adjusting the fields for widths similar to those in Template:Infobox musical artist and similar music-related Infoboxes. - B.C.Schmerker 03:45, 1 May 2007 (UTC)
Can we also add a production section like in the musical box for new productions on Broadway of new plays along with an awards section? Thanks, guys. LiamFitzpatrick (talk) 07:33, 8 May 2008 (UTC)
[edit] Problems
- The functions of "caption", "series" and "subject" seem not to be working for the new article I'm working on - A Very Merry Unauthorized Children's Scientology Pageant ... Smee 06:10, 23 February 2007 (UTC).
[edit] Image size
I was having problems with an image that was less than 200px wide and was stretching to fit, resulting in a blurred image. I went back to the Infobox film template and lemmed that solution. Note that the parameter name is "image_size", the underscore must be used between the two words.—Chidom talk 09:30, 26 March 2007 (UTC)
[edit] Are Info Boxes mandatory?
(this question is being brought over from the Village Pump - for that discussion see [1])—Preceding unsigned comment added by Smatprt (talk • contribs)
See also discussions at "Hamlet" here. AndyJones 18:11, 27 April 2007 (UTC)
I see that info boxes can be helpful in many situations. However, in some cases, I find them redundant and too much like "lists". I am concerned that we are turning some articles from important encyclopedia entries into USA TODAY stories with these little boxes that make it easier to avoid actually learning about the subject, as opposed to simply getting a few quick facts. In the case of Shakespeare's plays, for example, I think they can create more problems than they solve. As to the regular information fields - we don't know when Shakespeare's plays were written, where they were first performed, what exactly the sources were, who was in them or what the original critical response was. We even argue now over what was a comedy and what was a tradgedy. Also, listing all or many of the characters opens further debates, and attempting to list every setting (which can be quite a few and many are not clear) is impossible. I also feel that the over use of these boxes gives a feeling of dumbing down of an article - sort of like using cliff notes to write a report instead of reading the whole article. In fact, for the most part, all the information in these boxes is typically found in the first paragraph or two of the article itself. Isn't this redundant? Are not these just more lists that duplicate the information in the articles? Are these boxes mandatory for all plays?
For example - For Hamlet - all we really can say would be: Hamlet, written in England...in English. Set in Denmark (all of which is in the first paragraph of the article). Then we can have a list of characters that already has its own section very closeby (and listed in the table of contents for an easy jump right to the full cast). Isn't this redundance at its worst?Smatprt 03:42, 27 April 2007 (UTC)
- I also think we could add when the play was written or when it premiered and where, when it stopped playing (if it did), and who originally directed or produced it (for later plays) and perhaps a link to the actual text of the play. While this information would be able to people elsewhere in the article, I think the inforbox provides a nice format for the primary bits of information. The infobox can also be used to incorporate metadata easily. Remember 19:54, 27 April 2007 (UTC)
Your quesitons illustrate my point nicely - regarding Hamlet - we don't know when the play was written; we don't know when it premiered; we don't know when it stopped playing, and we don't know who originally directed of produced it. The same applies to each and every play by Shakespeare. Do you see the problem now?Smatprt 05:06, 28 April 2007 (UTC)
- I don't know if the box really needs to be manditory for every play, but it's been useful for some. I created it for the ancient greek plays, and it seems to be a good fit with those. Also, the parameters for it are merely options. Like the box itself, the paramters are there if you want them, if not - you don't need to include all of them. I believe I only used a few, as like you said, a lot are unknown for these old plays.
- Whether information is displayed like "usa today" or an "important encyclopedia" is really just a value judgement on what - class? aesthetics? From the articles I've worked on, often people where putting lists of charaters within the text itself. From a design perspective, I believe a simple list is better served in something like an infobox than interrupting the flow of text within the article. If it's a matter of class, I think usabilty trumps class when it comes to relaying information. And I agree with Remember that infoboxes make the article more usable by putting the metadata in an easy to find location. Often, users are only there for that particular info and would prefer not to spend time searching it out within the text.
- I disagree with the premise that boxes "make it easier to avoid actually learning about the subject". One could use a similiar arguement for an encyclopedia article itself. Such as, why read the play when you could just read the summary on wikipedia? Everyone has their own limits of how far they are going to delve into a topic, it all depends on their time and inclination. If all they want to know is the most basic facts about something, why not make it a little easier for them? Does it really get in the way of the users who are there to read the whole article? - Ravenous 06:34, 28 April 2007 (UTC)
- I think that the inclusion of an infobox should be up to the author of the article - I've written many many articles (not plays, but in general) which simply don't bear the kinds of information which are necessary to fill out an infobox. Some of the plays I may be writing about in the near future are ones for which no script remains, and some of which were even shut down by gov't censorship before ever being performed. Point is, sometimes it simply doesn't serve to try to fill out an infobox, if the questions the box is asking aren't relevant to what you have available, or to the main thrust of the importance/interest of the play.
- On the other hand, to respond to the comment that infoboxes duplicate information in the text. Yes, they do. But more often than not, I find that my prose sounds a bit strange, perhaps a bit choppy and forced as I try to incorporate all that information into the introduction. Laying it out in the box can be quite helpful, and allows you to get all that basic data out of the way, so the main text can focus on the meat of the issue. (Plot summaries, performance history, whatever). LordAmeth 09:19, 28 April 2007 (UTC)
[edit] Voting section
This section is not meant to be binding but instead is designed to better gauge people's opinions on the template.
[edit] Against infobox plays
I am against all infoboxes for play articles.
[edit] For infoboxes on all play articles
I am for infoboxes on each play article.
[edit] Allow each article to adopt a consensus on its own talk page
I am for each article making a decision about whether to add an infobox or not.
[edit] Keep open and free editing
Sorry to create a new section, but my opinion really doesn't fall into any of your three categories there. I do not support the idea that consensus should be created among a certain cabal of editors on each separate play article page, as (a) this goes against the open, free nature of the Wiki, where editors can come and go and make changes as they wish, and (b) it encourages a lack of standards and consistency. I think that every major play (Shakespeare, Broadway classics, Gilbert & Sullivan, Chikamatsu, the Greek classics, etc.), those which are most well-known, most influential, most expansive in their coverage, should have infoboxes, as it completes out the article, and supplies to-the-point information which may be buried in larger, longer articles. On the other hand, I am not voting "for infoboxes on all play articles" as this ignores the situations which can come up - each individual editor (not by cabal consensus, but individually) as they work on an article, or more especially when they create a new article, should be allowed to decide for themselves if an infobox is a good idea. I don't believe that this should be left up to the personal whims of the editors - some commented above that they just don't like the way it looks or whatever - but if an infobox would be genuinely inappropriate, irrelevant in a given situation, editors should feel free to leave it out.
Outside of play articles, there have been countless times that I've found that for whatever subject I'm working on, the associated infobox just doesn't apply to what I'm doing, and in those cases, omission of an infobox is more than justified. Sometimes, there simply isn't enough information in a given editor's sources (or known to scholarship in general) to satisfactorily fill out an infobox. In these cases, and more or less only in these situations, do I believe that omission of an infobox is called for. Sorry for the long message. Thanks for reading. LordAmeth 15:01, 2 May 2007 (UTC)
- Support. After reading LordAmeth's comments above, I agree with his general comments (except the Shakespeare reference where, I believe scholars don't know enough factual details to make the box useful). In general, there are far too many attempts to control the articles on Wikipedia. Cabal consensus is a huge problem on the William Shakespeare page (and related pages) in particular. Check out the talk sections there for what may be a perfect example about what LordAmeth describes. Smatprt 19:42, 2 May 2007 (UTC)
- Support. I support letting the authors of the article decide, however I do think the infobox should be useful on plenty of play articles. Even if it only includes something as simple as a picture, writer, date (estimated if need be), and some principle characters. For that reason, I wouldn't be against using them on Shakespeare plays if I were editing those. There is even less known about the Ancient Greek plays than those of Shakespeare, and I believe I put the box on most all of them. - Ravenous 20:47, 2 May 2007 (UTC)
This is all well and good, but it doesn't solve anything. We're right back to where we were before the whole debate started. Free editing is great, but sometimes, people just don't agree. Sometimes a consensus can't be reached. I don't particularly know how to solve this at all, but, right now, I feel like we're just running around in circles. I agree with the free editing thing, but, again, it is kind of redundant and solves nothing. Basically, some people want an infobox on shakespeare pages, and others don't. Both sides have strong feelings, and there is no consensus. There is no way to verify the statements made by either side, and thus both sides are based mostly on opinion. There isn't a "right" answer. Both sides just need to settle and give a little, recognizing that they are based on their own feelings. (In this little blurb here, I'm referring mostly to the discussions on the Hamlet page.) The answer, I guess, then, is free editing, as well as compromise between editors. Wrad 03:10, 9 May 2007 (UTC)
[edit] Fixed errors
There were a number of errors in this template which I think I have corrected, including:
- Excess lines above the template (not quite sure HOW I fixed that one, might be to do with either of the following)
- "Series" and "Subject" should now work properly - I changed something in "Caption" as well (removing a dash and correcting a | usage), although I don't know what the actual effect of that change was.
- Line break should not appear if there is no web page, playbill, etc
I'm mentioning this here in case anyone was previously put off from using the template because of these errors. GDallimore (Talk) 11:58, 23 May 2007 (UTC)
- PS I came across this template when creating Four Nights in Knaresborough which could do with a second person going over it. Thanks! GDallimore (Talk) 12:05, 23 May 2007 (UTC)
[edit] some sections still don't appear
The list of characters doesn't show up in the finished infobox. Help? Fixed it -- someone had altered the code in the template.... Aristophanes68 (talk) 02:00, 31 March 2008 (UTC)
[edit] yikes
Aside from whether info boxes should be used, why have "country of Origin" when place of (postumous, in the case of Woyzeck) premiere is meant? Date and place of writing are missing, as is duration, a consideration when looking to fill double bills... Sparafucil (talk) 23:04, 31 March 2008 (UTC)
- Agree: especially with the need to distinguish date of writing from date of premiere, at least when the two are substantially different.... Aristophanes68 (talk) 14:25, 2 April 2008 (UTC)
[edit] Error
Please see the page for Alibi (play). The words "insertformulahere" are appearing in the info box between "written" and "by". Any ideas why?--Jtomlin1uk (talk) 14:18, 28 April 2008 (UTC)
- In addition the words"Headline text" are appearing as a section heading, even when there is no section heading!--Jtomlin1uk (talk) 14:53, 28 April 2008 (UTC)
[edit] iobdb - lortel Internet off-broadway database
{{editprotected}}
requesting inclusion of a direct link in infobox to the lortel archives for off-broadway shows using the below coding:
|data15 = {{#if:{{{iobdb_id<includeonly>|</includeonly>}}} | [{{{iobdb_id}}} IOBDB profile] }}
--emerson7 16:01, 21 August 2008 (UTC)
[edit] Add hCalendar microformat
{{editprotected}} Please also add the hCalendar microformat, as on {{Infobox Film}}. This will involve adding class="vevent" to the whole template, (I can't see where as the two templates are not the same); plus class="summary" around the name; and class="description" around the "Written by" table-row. See the edits to the film template for details. Andy Mabbett | Talk to Andy Mabbett 21:41, 22 August 2008 (UTC)
Not done: please be more specific about what needs to be changed. Happy‑melon 14:00, 23 August 2008 (UTC)
- The exact same changes as in the film template edit (nbsp notwithstanding). Andy Mabbett | Talk to Andy Mabbett 14:05, 23 August 2008 (UTC)
- Except that this template uses a meta-template, there is no parameter called |director= and the |name= field is formatted, which IIRC you've said somewhere else is a problem. Please have a play around in a sandbox and read the documentation for {{Infobox}}, work out what code will achieve the effect you want (given that I have no idea how this microcard system works) and come back here with the exact change you want me or someone else to make. We all have our areas of expertise: while template code is one of mine, microcards are not, and it appears to be one of yours :D. On that note, many thanks for the helpful requests you've made all over the template namespace today; it looks like you've improved the accessibility of thousands of articles by applying your knowledge where it counts. Happy‑melon 14:14, 23 August 2008 (UTC)
[outdent]
OK, I see what you mean, sorry.
Firstly,
class="vevent" needs to apply to the whole table. I don't know how that would be achieved.
Then, if that has been done, change:
|above = ''{{{name|{{PAGENAME}}}}}''
to:
|above = ''<span class="summary">{{{name|{{PAGENAME}}}}}</span>''
lastly, the table row:
|label1 = Written by |data1 = {{{writer<includeonly>|</ifncludeonly>}}}
Can have
class="description"; again, I don't know how to achieve that in this type of template, but it's only an optional property.
Thank you for your kind words; you can find out more about microformats (not "microcards" - though that's a neat portmanteau!), including hCard (an HTML representation of vCard), on those pages; and at the microformats project page. Andy Mabbett | Talk to Andy Mabbett 14:36, 23 August 2008 (UTC)
- Nearly there, but
class="description"seems to be wrapped around the right-hand TD, not the TR. Andy Mabbett | Talk to Andy Mabbett 16:31, 23 August 2008 (UTC)
- No; you can't run a span across multiple table cells in valid HTML. I've already raised the issue on the relevant talk page. Thanks, anyway. Andy Mabbett | Talk to Andy Mabbett 14:44, 24 August 2008 (UTC)
[edit] IBDB
{{editprotected}}
The URL listed for linking to the IBDB (The Internet Broadway Database) for the Arsenic and Old Lace (Play) article is incorrect and takes the reader to an incorrect location. To correct this link, I request that the string "show" in the link be replaced by the string "production"
Alternatively, the URL may be changed to "1692" as the last four digits to link to the IBDB entry for both the original production and the 1986 revival.
Thank you.
- Wikipedia User jfduncan John F. Duncan, theatre director and educator
Not done:I have fixed the link at Arsenic and Old Lace (play), as changing the template would break other instances of the template. Regards,--Aervanath talks like a mover, but not a shaker 18:52, 11 January 2009 (UTC)
[edit] Adding a 'movement' section
Hello, I would like to request that a section be added for 'Movement', underneath 'Genre'. This is because many plays cannot easily be classified as specific genres, but are allied with particular movements in theatre. Examples are Waiting for Godot, which is unrelated to conventional genres but is part of the Theatre of the Absurd movement. If someone could make this change it would enhance the infobox's value. Downstage right (talk) 15:20, 1 January 2009 (UTC)
- <Rattles bars> Downstage right (talk) 23:01, 5 January 2009 (UTC)
[edit] setting
the play takes place in the 1990s, not 1969. —Preceding unsigned comment added by 72.225.144.11 (talk) 20:43, 4 January 2009 (UTC)
- What are you talking about? Downstage right (talk) 01:52, 5 January 2009 (UTC)
[edit] Sidebar Setting Error: 1997, not 1969
The setting is incorrectly listed as 1969. It is actually set in 1997 according to the published play text, written by August Wilson. —Preceding unsigned comment added by 72.22.28.4 (talk) 02:03, 9 January 2009 (UTC)
- This is the talk page for all infoboxes on all plays, not just the one you're bothered about. Nobody knows what play you're referring to. Go to the article you're worried about, click the box marked 'edit this page' at the top, and make the change. Downstage right (talk) 23:01, 9 January 2009 (UTC)
[edit] Proposed removal of "view • talk • edit" links
{{editprotected}}
I propose that we removed the "view", "talk", and "edit" links from the bottom of this template. I've never seen this on an infobox before, and it seems rather silly to include them, as this template doesn't directly relate to the articles that it's used in. (You can see this problem in the two sections above this, in which editors mistakenly thought this template applied only to the specific article it appeared in). Mr. Absurd (talk) 23:53, 17 January 2009 (UTC)
- As you can see from the further mistakes below, this really needs to be done. Downstage right (talk) 12:03, 5 March 2009 (UTC)
- I just added an {{editprotected}}, as my earlier comments seem to not have been noticed by any admins. Hopefully this issue can be resolved soon. Mr. Absurd (talk) 02:35, 6 March 2009 (UTC)
- I was trying to make the edit but for the life of me I can't figure out what in the template is causing the display. Maybe it's the "body class"? Well anyway, You'll have to wait for someone better at template coding than I unless you can spoonfeed me what to change.--Fuhghettaboutit (talk) 05:14, 6 March 2009 (UTC)
- It comes from Template:Infobox, which this uses. That template adds the view/talk/edit links if you pass a "name". I did add a "noedit" flag so that the edit link is gone but the talk link remains. If this is an issue, maybe take it up at Template talk:Infobox? Oren0 (talk) 07:45, 6 March 2009 (UTC)
- Weird. When I went to Category:Infobox templates and clicked on a bunch at random, not one had the links so I discounted that. Thanks for the information.--Fuhghettaboutit (talk) 13:10, 6 March 2009 (UTC)
[edit] Misspelling
{{editprotected}} Could someone please change the spelling of 'Seppember' to 'September' as it's irritating and makes the page seem less reliable. Sissy Marshmallow (talk) 13:19, 7 February 2009 (UTC)
Not done Is it possible you stumbled upon an article in which when someone used this template they filled in a parameter with the misspelling? There are no months in this template; the misspelling is not here. When users use the template they have to fill in the information parameters manually to populate the template and can misspell words. Go to the article where you found the error, click edit this page and search for "seppember"; it's probably in the text of the page, but it does not appear to be an error in the template itself.--Fuhghettaboutit (talk) 14:57, 7 February 2009 (UTC)
{{edit protected}} It would be nice if you could add "Fulganzio", "The Little Monk", or "Fulganzio, the little monk" under characters- he is a rather major character who shapes the play who shouldn't be left out of any character list. Thanks!—Preceding unsigned comment added by 71.81.69.75 (talk • contribs)
Not done Like the user directly above, you have apparently confused the text on a particular article that employs this template, with the template itself. This is a generic template appearing in hundreds of different articles. When it is used, a person fills in the blank parameters, manually, thus populating the template for that particular page. Go to the article at issue and make the edit to this filled out template there. If the article happens to be protected, then add your edit protected request to the article's talk page.--Fuhghettaboutit (talk) 23:54, 19 February 2009 (UTC)
[edit] General syntax cleanup
{{editprotected}} Requesting sync with the new sandbox for various bits of syntax cleanup including the removal of the "view/edit" links as requested in the section above. Other than that one change there shouldn't be any visible impact. Chris Cunningham (not at work) - talk 12:41, 22 April 2009 (UTC)
|
http://ornacle.com/wiki/Template_talk:Infobox_Play
|
crawl-002
|
en
|
refinedweb
|
Hi, 6000 debs built, and so far it all seems to work pretty well. I can't share the debs yet (internal and customer use only for now), but I would like to get consensus on armel patches before I start submitting them. The first candidate is dpkg. Guillem Jover's patch available here: changes DEB_HOST_GNU_{SYSTEM,TYPE} to have -gnueabi at the end. I've found that this doesn't work too well. For example, util-linux does stuff like this all over debian/rules: ifeq ($(DEB_HOST_GNU_SYSTEM),linux-gnu) MOUNTBINFILES = mount/mount mount/umount MOUNTSBINFILES = mount/swapon mount/losetup endif And ruby1.8 does: arch_dir = $(subst linux-gnu,linux,$(target_os)) (which turns arch_dir into arm-linuxeabi instead of arm-linux-eabi.) I asked Joey Hess, and he felt that there are probably more packages that depend on linux-gnu than on having gnueabi, which makes sense. The only packages that really need to know about gnueabi are binutils, gcc and glibc, the rest should just be checking defined(__ARM_EABI__). Opinions? cheers, Lennert
|
http://lists.debian.org/debian-arm/2007/01/msg00013.html
|
crawl-002
|
en
|
refinedweb
|
My Account
Community
Books & Videos
Safari Books Online
Conferences
Training
School of Technology
About
Complete List
Bestsellers
New Releases
Rough Cuts
Upcoming Titles
Ebooks
By Publisher
By Series
Out of Print
Order Info
Search
Search Tips
Tell a friend
Enterprise SOA
Designing IT for Business Innovation
By
Dan Woods
,
Thomas Mattern
April 2006
Pages: 452
|
Table of Contents
|
Index
|
Sample Chapter
Table of Contents
THE CONTEXT FOR ESA
Chapter ONE
ESA in the World of Information Technology
Who is this book for?
Why so many questions?
What forces created ESA?
What is ESA?
How will ESA change how applications are designed and built?
What supporting infrastructure does ESA require?
Is ESA compatible with event-driven architecture?
What is the promise of ESA?
How will the transition to ESA occur?
How can ESA be addressed at a tactical level?
Why does ESA matter?
What are the core values of ESA?
Where can we go for more answers?
ESA in action: Mitsui
Chapter TWO
The Business Case for ESA
What attributes must ESA embody?
What principles should be driving my IT decisions?
What happens when core eventually becomes context?
How does ESA enable consolidation and reuse?
What kind of innovation should companies pursue, and how will ESA help them?
What are ESA's practical implementation issues?
What's the long-term adoption path of ESA? How quickly will I see ROI, and what form will it take?
What is ESA's long-range impact on corporations?
ESA in action: Nordzucker AG
Chapter THREE
Evolving Toward ESA
Conceiving
Consuming
Composing
Creating
Controlling
Just how much and what kind of change will ESA involve?
What is IT's role within ESA?
What do you mean by "business process?"
That's a good point, but how do you bring the two sides together in the first place?
What is IT's role if all of this comes to pass? What does my company look like then?
What stages will we go through on the way there? What skills will we have to develop?
What kind of architecture skills does ESA call for?
How does a cultural transformation happen in the real world? What can SupplyOn tell us about how to manage the change inherent in ESA?
How will IT change in an ESA world?
What will the shift to a model-driven world mean for IT, and where will these business analysts come from?
How will governance function within ESA?
How and where should I begin evolving toward ESA?
How will modeling translate between enterprises with different architectures? Will a standards body evolve to resolve potential conflicts?
What do the analysts think, and what trouble do they foresee?
What kind of company will we be after ESA?
CONCEIVING A VISION FOR ESA
Chapter FOUR
ESA Fundamentals: Learning to Think ESA
What is architecture and why is it important?
What is enterprise architecture and how will ESA change it?
What motivated the creation of ESA?
What are the architectural challenges of ESA?
How does ESA meet those challenges?
Does ESA make all my existing systems worthless?
What are systems of record?
What are transactional systems?
What are web services?
What is the difference between a web service and an enterprise service?
What is service-oriented architecture?
What is the difference between ESA and other approaches to SOA?
What are composite applications?
What are service consumers?
What are service providers?
What are xApps?
What role does the mySAP Business Suite play in ESA?
What role does SAP NetWeaver play in ESA?
What are IT practices and IT scenarios?
What is event-driven architecture?
Why are analytics so important to ESA?
How does ESA provide for easier adaptation and a better requirements fit?
What is the basic structure of an enterprise service?
What are global data types?
Why is XML messaging so important to ESA?
What is the difference between a frontend and a backend application?
What is service composition?
What is the role of business objects in ESA?
How does persistence change in ESA?
Why does modeling matter? Isn't it just another form of coding?
Will modeling replace coding?
How are patterns used in ESA and what value do they provide?
What is process orchestration?
What is process integration?
How will ESA change the way applications are packaged and delivered?
What are the special needs of composite applications?
What is the relationship between ESA, standards, and commoditization?
Is buy versus build a false tradeoff in ESA?
Why is an ecosystem of companies and standards so important to ESA?
Chapter FIVE
The Structure of ESA
Basics of ESA applications
The ESA stack, layer by layer
The enterprise services layer
The business objects layer
The process orchestration layer
The UI layer
The persistence layer
Chapter SIX
The Enterprise Services Community
What is the ES-Community?
What is the value of the ES-Community?
What is a Definition Group? Who can join?
What does the ES-Community contribute?
Will the ES-Community create new standards?
How are enterprise service definitions created within the ES-Community?
What is the organizational structure of a Definition Group?
What is certification? Is it mandatory?
What is ES-Ready? How can partners use this brand?
How does the ES-Community balance efficiency with open participation?
What is required to participate in the ES-Community?
How is intellectual property (IP) treated in the ES-Community?
How will the ES-Community differ from SAP's other partner and customer efforts?
How does participation in the ES-Community benefit customers?
What should a company do to get involved in the community process?
Chapter SEVEN
Creating a Roadmap with the ESA Adoption Program
Why the roadmap approach?
What challenges do companies face in adopting ESA?
How does SAP help customers adopt ESA?
Is there more to success with ESA than just analyzing technologies and preparing roadmaps?
How have companies put SAP's ESA Adoption Program to work?
CONSUMING SERVICES
Chapter EIGHT
The Enterprise Services Repository and the Enterprise Services Inventory
What is the Enterprise Services Repository?
What is the Enterprise Services Inventory?
ESA in action: Elsag
ESA in action: Kimberly-Clark
ESA in action: CSA International
Chapter NINE
Project Mendocino: A Product Based on Consuming Enterprise Services
What is the goal of Project Mendocino?
How does Project Mendocino use ESA?
Project Mendocino applications
The Project Mendocino architecture
ESA in action: Agile Solutions Ltda
Chapter TEN
ESA at Work: Examples from the Field
ESA in consumer products
Store-specific pricing
ESA inCustomer Relationship Management (CRM)ESA in CRM:ESACRM service request processing
ESA in the chemical industry: e-VMI at Solvay
ESA for logistic service providers
ESA for professional service providers
ESA in manufacturing
ESA in the chemicals industry
COMPOSING SERVICES
Chapter ELEVEN
SAP xApps Composite Applications for Analytics
How do SAP xApp Analytics help business users?
How hard is it to deploy SAP xApp Analytics?
What are the different parts of an analytic composite application?
In which application and process areas are analytic composites being created?
How do ESA and SAP NetWeaver help create analytic composites?
What are the benefits of SAP analytics?
Chapter TWELVE
The Architecture and Development Tools of Composite Applications
The architecture of composite applications
Development tools for composite applications
ESA in action: Asian Paints
ESA in action: Zuger Kantonalbank
Chapter THIRTEEN
Supporting Composite Applications
How are composite applications different from the previous generation of applications?
SAP NetWeaver MDM
SAP NetWeaver Business intelligence
SAP NetWeaver Knowledge Management and Collaboration
SAP NetWeaver Mobile
ESA in action: Arla Foods
CREATING SERVICES
Chapter FOURTEEN
Web Services Basics
What are web services and why do we care?
What are some examples of web services?
What are services?
What is service-oriented architecture?
Why is service orientation better than object orientation?
What are the main components of web services?
What is XML?
What is XML schema?
What are XML namespaces?
What is SOAP?
What is WSDL?
What is UDDI and how does it relate to SAP?
How can we ensure that web services will interoperate?
What about web services security?
Chapter FIFTEEN
Creating Enterprise Services in ABAP
Can I start creating enterprise services today, or should I wait?
How do web services and enterprise services compare?
What are two ways to create services in ABAP?
What is SAP NetWeaver's role in creating enterprise services?
What is the role of the SAP NetWeaver Application Server?
What is SAP NetWeaver XI's role as an integration broker?
What steps are involved with web services brokering using SAP NetWeaver XI?
How can services be adapted to reflect changing customer needs?
What does the future hold for creating enterprise services?
Chapter SIXTEEN
Creating and Consuming Services in Java
What development tools are available for Java developers?
How do you create a service provider in Java?
How do you create a service consumer using Web Dynpro for Java?
ESA in action: Arcelor
ESA in action: TRW
CONTROLLING SERVICES
Chapter SEVENTEEN
ESA and IT Governance
What are typical models for IT governance?
What are the challenges and problems with existing models?
How does ESA decrease the need for IT governance?
How does ESA improve the relationship between business and IT?
Who owns enterprise services? Who makes a decision about creating new services?
What processes make sense for approving new enterprise services?
ESA in action: Whirlpool Corporation
Chapter EIGHTEEN
ESA Life Cycle Management and Operations
Which operations and management problems will ESA actually solve?
What is life cycle management?
What is life cycle management in the context of ESA?
What are the challenges for life cycle management in the context of ESA?
How will services be monitored in an ESA landscape? Where will the necessary metadata come from?
How does ESA affect implementation issues?
How are operations affected by ESA?
How will ESA affect change management and software logistics?
What is adaptive computing and how does it relate to ESA?
What does the introduction of ESA and its impact on life cycle management mean for IT departments?
Will life cycle management capabilities be available to ISVs?
What additional capabilities does ESA offer in terms of allowing business analysts to determine which revenue-generating services should receive additional resources?
Chapter NINETEEN
ESA Security
What security challenges face enterprise architects?
What are identity management and authentication?
How does identity management change within ESA?
What is access management?
How does access management change within ESA?
How are messages that are sent from enterprise services secured? What standards have been developed?
How do you develop secure composite applications without weaknesses?
How will security between companies function and evolve in an ESA environment?
Chapter TWENTY
Standards and ESA
How do standards relate to ESA?
What are semantic standards, and how do they help build IT solutions?
Which technology standards does SAP support, and how do they help build IT solutions?
Which technology standards does SAP NetWeaver support?
Colophon
Return to
Enterprise SOA
|
http://oreilly.com/catalog/9780596102388/toc.html
|
crawl-002
|
en
|
refinedweb
|
> ASYNC13.rar > WAITQUIE.C
/* A module of ASYNCx.LIB version 1.10 */ #include
#include "asyncdef.h" /* ** Wait for between t and t+1 18ths of a second to elapse without any ** characters arriving at port p. If max 18ths of a second elapse before ** a gap in the incomming data of t 18ths of a second has been found, a ** value of -1 is returned. If the gap is found within max 18ths of a ** second, a value of 0 is returned. If mode is set to 0, any characters ** that do arrive during the execution of this routine are discarded and ** the input buffer for the port p is empty when this routine returns. ** If mode is set to 1, characters arriving at the port are detected but ** not discarded. Be careful of buffer overflow if use mode 1. If the ** input buffer overflows, the least recent data will be lost and the ** newest data will be retained. */ int a_waitquiet(ASYNC *p,int t,int max,int mode) {unsigned long t0,t1,far *t2; int count0; if (!p) return -1; /* ** *t2 is the current time and is incrimented by the operating system ** 18.21 times per second. */ t2=(unsigned long far *)MK_FP(0x40,0x6c); /* ** t0 is the initial time. t1 is the time at which the last character ** was received. (Assume that a character was just received.) */ t0=t1=*t2; if (mode==0) while ((*t2)-t1<=(unsigned long)t && (*t2)-t0<=(unsigned long)max) {if (a_getc(p)!=-1) /* If another character has been received, */ t1=*t2; /* update t1. */ } else {count0=a_icount(p); /* count0 = # of chars in buffer */ while((*t2)-t1<=(unsigned long)t && (*t2)-t0<=(unsigned long)max) if (a_icount(p)!=count0) /* If more characters are received */ {t1=*t2; /* update t1 and */ count0=a_icount(p); /* the character counter. */ } } if ((*t2)-t1>=(unsigned long)t) return 0; else return -1; } /* end of int a_waitquiet(p,t,max,mode) */
|
http://read.pudn.com/downloads9/sourcecode/comm/fax/32646/ASYNC13/WAITQUIE.C__.htm
|
crawl-002
|
en
|
refinedweb
|
> Estereo.rar > imageio *. * **************************************************************************/ #include
#include #include #define ALLOC_ALIGN_MEMORY(X, X_origin, type, size) (X_origin)=((type*)malloc((size)*sizeof(type)+127)); (X) = (type*)((((unsigned int)(X_origin))+127) & (~127)); using namespace std; int savePGM(char* pFilename, char* imData, int width, int height); int loadPPM(char* pFilename, char*& imData_orig, char*& imData, int& iWidth, int& iHeight);
|
http://read.pudn.com/downloads53/sourcecode/windows/multimedia/185141/estereox/imageio.h__.htm
|
crawl-002
|
en
|
refinedweb
|
Hi,
It’s a big day today, since we are rolling out CLion 2016.1 release. Please, welcome! that generates stubs for virtual member functions from any of base classes and Implement that overrides pure virtual functions from base classes, we’ve added Generate definitions (
Shift+Ctrl+D on Windows/Linux,
⇧⌘D on OS X) which, as you would expect, generate definitions for existing declarations (in the previous versions you could use Implement action to get it). All three actions now put the code in the place the caret is positioned, in case it’s inside the class, or ask for a destination (if several options are available):
Thus CLion 2016.1 makes the code generation behaviour quite simple and straightforward – if you want the function to be generated in a header file – locate the caret in that class in your header file, and if you want it in the source file – execute action there.
‘Generate definitions’ can be called up in three different ways:
- By pressing
Shift+Ctrl+Don Windows/Linux,
⇧⌘Don OS X.
- Under the Generate menu (
Alt+Insertin Windows/Linux,
⌘Non OS X).
- As an intention action (
Alt+Enter).
Read more details in the corresponding blog post. – ‘Mark. You can find the plugin in our repository. below and download CLion for your operating system.
Try CLion 2016.1 now and let us know what you think in the comments section below!
The CLion Team
JetBrains
The Drive to Develop
It’s nice CLion now supports Python and Swift out of the box. I hope CPP-744 will be implemented very soon as well.
We’ll consider it for sure when planning the next release. We’ll share the plans as soon as we get the roadmap for 2016.2 version.
That might be non-trivial to get to work well. But if you can it is _the_ killer feature.
Another feature request is to support ninja as the build tool. I’m really trying to get my red/green/refactor cycle down to the fastest possible.
Thanks, we’ll consider.
Regarding CPP-744, I’d suggest that there are some potential incremental deliveries here. Remote compile and execution but _without_ remote debugging is still a useful feature. I’d go even further and say that remote compilation without even execution would be a useful feature for me.
That’s interesting, thanks a lot
I had one more thought. I don’t really know the complexities from your side, but from where I’m sitting, remote compile is rather similar to distributed compilation where the remote compile is the special case of compiling on only one remote server.
I do understand that there is a big difference between whether the code can compile locally or not, but maybe there is some synergy here?
It would be very cool if CLion would support distributed compilation without needing to have a Phd in compilerology.
Thanks) Interesting thought. We need to consider for sure.
OTOH, for us, it’s the full cross-compile to another architecture, copy over to target, remote run/debug or it’s nothing. Compiling on our weak target machine is a non-starter. Of course, if some are helped by the partial implementation that’s nice for them so it’s certainly better than nothing. Just remember not everyone has a powerful enough remote target to run a full tool chain
I can definitely live without disassembly though (considering the issue of different remote arch)
Also, this is the reason we currently don’t use clion.
Thanks for sharing!
Clion is now my favorite IDE for C++ coding, but not yet for C++ debug.
Please consider GDB debugging speed-up and Makefile/Custom build support for 2016.2!
Thanks, we’ll consider. We’ll publish the approximate roadmap as soon as we are ready. Stay tuned and thank you for your support!
Thanks for the hard work! I’m looking forward to variadic templates and some of the other features.
I noticed that the editor font appearance has changed and now has slightly more weight. I loved the old way that the default font (DejaVu Sans Mono) was displayed in 2.2. Is there any way to go back to that? I’m running elementaryOS Linux.
Thanks a lot! We appreciate your support.
CLion currently uses bundled JDK on Linux, it’s our custom version with the fixes from the JetBrains team. To change it you can call Find Action (Shift+Ctrl+A) and type ‘Switch IDE boot JDK’, then change it in the dialog that appears. Alternatively, you can set CL_JDK env var with your preferred Java version.
Thanks Anastasia. If I switch to a non-bundled JDK what fixes will I be losing?
Mostly it’s font rendering. Some crashes maybe related, but just report to us if you meet any (we’ll check if it’s related).
Ok. I installed the Oracle JDK on my system but when I invoke the Switch IDE boot JDK command it only gives me one option, the ‘bundled’ option. I followed this post, am I missing anything?
Probably it was searched in the wrong place… Feel free to share where it was installed so that we could check.
Bob, we suppose it’s a bug finally. So could you please kindly provide us some extra info to investigate and fix:
– OS version
– version output: call java (that is not seen by the switcher inside CLion) by the absolute path with -version option
Success! Towards the top of clion.sh I added this line and now my fonts are beautiful again. It seems kind of hackish but at least it’s working and I’m happy.
Thanks!
CL_JDK=$JAVA_HOME
It was installed to /usr/local/java/jdk1.8.0_73 and the $JAVA_HOME variable was set to that path. Do I need to set the $JDK_HOME variable also?
I believe no, but let us check.
elementaryOS Freya 0.3 (based on Ubuntu 14.04 LTS)
which java
/usr/bin/java
/usr/bin/java -version
java version “1.8.0_73”
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)
Thanks. I’ve put this into the tracker:
Feel free to follow the ticket to get updates.
Hi Anastasia,
If at all possible, can you guys decouple the font rendering from the rest of the JDK fixes? I’d love to use the bundled JDK except for the font part (looks really bad for the one I use). I was putting off the upgrade till Bob’s hack helped me (thanks, Bob!).
I’m really not sure this can be done, but please leave it as a feature request here:. The team will consider then. Or at least find some solution via settings.
If you could maybe attach some screenshots of what you dislike about font rendering, it would be perfect. Thanks in advance.
Hi Bob,
I’ve reported this as IDEA-151425, please subscribe, vote & share your experiences
–Yury.
Thanks Yury. Done.
User-defined literals() have been a problem since 2014, and it is still broken now.
User-defined literals and constexpr are still not supported from C++11.
What do you mean by “not supported from c++11”? User-defined literals are used in the STL at least by “std::chrono” ()
CPP-1727 really hurts me as well
CLion currently doesn’t support user defines literals, that’s true. And we know they are used now in std::chrono, which makes us increase the priority of this task. We hope to have them supported soon. Please, follow the request to get the updates.
Amazing!
I hope will soon you will add a cmake support
*qmake
Here is the request:. Comment, follow to get updates, upvote to increase priority
Thank you for the great product! Just want to know whether it is possible to add support for different project model via 3rd party plugins. I think to add support for IAR based projects by myself because i know it will has very low priority for you. Is there a chance i can do it now?
Also, there are some annoying bugs in the C development: Any ETA for them?
Currently it’s not possible since there is no public interface or API for this. We do hope to have it when start working on at least seconf project model/build-system support. With only CMake on board it’s quite unstable to make it public.
We’ll check the issue linked and consider for the upcoming fixes/new release.
Still waiting for better preprocessor support, e.g. CPP-1100.
I have just updated to Clion 2016.1 and I can’t find the cmake toolbar anywhere.
Did I miss something??
Did already fixed the issue.
There was something wrong in my .idea directory.
The result was that no cmake files were generated.
It was just an empty directory.
When I renamed the .idea directory to something else, the problem solved.
Hm. Interesting. In case your project is CMake-based and something goes wrong with CMake in CLion next time you can try Tools | CMake | Reset Cache and Reload
How about View | Toolwindows | CMake?
I have a project that uses Qt and runs in Windows, Linux and OSX.
I use QtCreator to develop in all platforms. In windows I must use microsoft tool chain (I do not use visual studio editor, only compiler, debuger, etc..) because i use some libs that not compile with gcc in windows.
QtCreator is Ok but I was looking for something to speed up the work. I was willing to give CLion a shot, but for what I notice (correct me if I’ wrong) in windows I cannot use microsoft tool chain with CLion, I must use Reshaper for that, and more, in windows I have to start using Visual Studio editor with Reshaper and not Clion.
If this is correct instead of using CLion + QtCreator in all platforms I need a different one in windows (Visual Studio + Reshaper) and the cost will be 199€ x 2.
If this is the case I prefer to stick with QtCreator only.
Yes, we do agree that this is quite inconvenient for you. So we might consider supporting MSVC compiler in CLion:
Then you can probably develop and debug on Linux and build on Windows. It is quite easy with CMake.
Thanks for the idea but when we have platform specific code that links with 3rd party libs this is not really an option. Nevertheless we spend most time programming in linux,
But still I recommend to stick with QtCreator until debugging experience improves in Clion. If you use CMake then you can switch between QtCreator and Clion easily,
Double that! Debugger stability is really the area waiting to be improved.
Nuno: Have you used Maven in the past? If so, you could try Maven NAR plugin and configure it to use msvc toolchain, CLion doesn’t support the plugin but you could use the terminal to compile, test, and install the package in a repository. See some basic archetype here.
I recently updated to CLion 2016.1. I have some problems with Google Test: The macro EXPECT_TRUE() which is used to assert trueness is being marked as red in the code editor with message “Error after macro substitution: Class ‘testing::AsertionResult’ doesn’t have a constructor ‘AssertionResult(bool)'”. The weird thing is that the test compiles and executes succesfully. I was using CLion 1.2 before and never had this problem.
Yes, it’s a known regression –. Sorry for the inconvenience. Hope to fix soon.
Trying to compile QT project with Q_OBJECT macro for signals. Getting that error in 2017.2 EAP version. Is there a work around or something for it maybe?
Do you mean compilation issues? Or IDE’s false-positives?
Anastasia,
Do you want to push Clion into embedded systems and electronic design domain?
Currently it is completely dominated by Eclipse CDT-based solutions that are quite good, but not perfect imo.
I’m using Clion for hardware design and it works reasonably well.
We do plan this for sure.
It will be great if you share some typical issues that maybe need to be fixed especially for this area. Or just some specific feedback.
Embedded market is extremely diverse and there is no chance to create “one size fits all” solution, like JetBrains did for Java/Web world (Java/Web world is very diverse too (dozen of frameworks, database systems, multiple languages etc), but I think embedded is more diverse
).
Eclipse, the current king of embedded has different model: there is a common opensource core that anyone can contribute to and dozen of proprietary IDEs build on top of it. Eclipse-based products are supplied by Intel, TI, Xilinx, Altera, Synopsys, Analog devices, Mentor Graphics and many other companies. I’ve seen couple of Netbeans and QtCreator-based IDEs for embedded, but they are much less common.
But it was not like that 7-10 years ago, at that time most of those companies provided some custom-build IDEs or command-line tools only.
So to fight for this market Jetbrains will need to promote Clion as a better platform for plugin development then Eclipse. You will also need to win hobbyist market: looks like Arduino and Raspberry PI are two most common platforms in this area.
Now speaking about particular bugs:
Cross-compilation, remote debug
Assembly-level edit and debug
You will also need to create gui for embedded debug with CPU registers view, and memory area view (to observe memory-mapped IO)
But IMO debug is not yet there even for native linux projects. Its still slow, gdb-python pretty printers are not rendered correctly. I think you should fix this before implementing more debugger features.
Thanks Roman. We completely agree that the market is diverse and your ideas here are really valuable to us.
We also agree that we need a big work to be done in the debugger area to fit this market (and in general to satisfy our users needs). Especially those tickets you’ve mentioned. And I really hope we’ll be able to handle them in the upcoming releases. Let’s see.
I completely agree and even talked with JetBrains about this. A community / hobbyist edition of CLion that could be used to develop software for Raspberry Pi and Arduino would be great.
When these developers later land in the professional software business they won’t think twice about what tool to use.
I would like to ask where I can find see the roadmap CLion 2016.1?
Just wondering if it would be possible what QT support will be considered soon?
And of course support of UE4 is the same as in Visual Studio when you can create project in UE4 and Studio recognize project file and finally you can write a code?
Do you mean 2016.2? It will be published soon in our blog. Stay tuned.
Here it is:
Thanks for the answer.
And what about the future support UE4 and QT in qmake and cmake?
UE4 can work via CMake. So you can try it. Check this blog post for additional info:
Qt as a library is handled by CLion quite well now.
As for the qmake – we have a feature request – but (repeating our last paragraph from the post) we are currently not ready for implementing additional project model inside CLion, we’ll continue the investigation and some preliminary work in that direction, but it won’t make it to the 2016.2
I read this blog on UE4 but this is not the way out. This should work without any complicated settings, I think you understand. For example in Visual Studio is not required to do.
didn’t know about Quick Documentation feature before this post.
very useful. but not completely clear for me –
I see this shows , in addition to definition, an info from a comments as well , e.g. for STL types,
however it does not do this for my project types/methods/members.
even these are having doxygen formated doc
for project level, quick documentation just shows basic info like a header file, parent type, etc.
am I doing something wrong? maybe need to enable something in settings?
how to fix this?
Doxygen is not yet supported but is planned for 2016.2 and is currently in development.
> it does not do this for my project types/methods/members.
Could you please provide a sample?
just an examples from test project:
1. go to line like this:
std::this_thread::sleep_for(3s);
step on this_thread and press Ctrl+Q
I see something like this :
“…
@namespace std::this_thread
Brief
ISO C++ 2011 entities sub-namespace for thread. 30.3.2 Namespace this_thread.
…”
which was parsed from header:
“…
/** @namespace std::this_thread
* @brief ISO C++ 2011 entities sub-namespace for thread.
* 30.3.2 Namespace this_thread.
*/
namespace this_thread
…”
It looks good.
——————————————–
try the same for something in our project:
usage:
shm_server server;
declaration:
“…
* \class shm_server xxx.hpp “src/xxx.hpp”
* \brief processes incoming data and dump this to files
*
* class works as a wrapper for a worker thread (operator () ) which receives a data via shared memory
* server receives a data chunks from various clients until get empty vector of bytes, which is a flag of end of this client transfer
*
* \warning using std::cerr and std::clog is potentially thread unsafe, has to be replaced */
class shm_server : public base_interview_task {
….”
however Ctrl+Q gives me only:
“…
Declared In: searchinform.hpp namespace interview_tasks::searchinform class shm_server : public
…”
Thanks. I suppose it doesn’t work as expected because of this:. Feel free to upvote and follow to get the updates.
Is there any way to change the display value of custom types in Clion? I have custom containers and it would be very useful to see a custom representation of the stored value.
Do you mean in debugger? For GDB you can use pretty printers – (though some issues are known:)
I am a Clion user in China.When I need update,patch or install file from Jetbrains’ server,downloading speed will be very slow,sometimes can not complete successfully.Could you think about solutions?Such as cdn or something else?
We are currently working on such. Hope to have some in nearest future. Sorry for the inconvenience.
Thanks for your reply.Everything about Clion is good,but network speed causes much problem.
Installed today on windows and it’s unfortunate that only gdb7.8.x is supported, meanwhile, cygwin has only easy support to install gdb7.9x/7.10.x, so right away need to fight the install on windows.
The result is one needs to go through this convoluted install routine as posted on stackoverflow:
Posting this to call your attention to save some future potential users from hours of work to get it running.
Thanks.
yes, that’s true that only 7.8 is supported for now. You can still set 7.9 or 7.10 as a custom used version in the settings and use it, however we are aware of several problems (like this one, or some other related to). We plan to fix them and then we can officially announce other GDB versions support.
Hello
On Ubuntu 16.04 with clion there is no code completion for swift core libraries Foundation
Is it planned?
Thanks
Yes, we do plan this for later:
Awesome, jetbrains never disappoints i love you <3 everywhere i go i talk about your products, big thanks
Thanks for your support!
Is there any plans to support the Swift Package Manager? This would be a HUGE win! I mean really HUGE! Is there an issue I can upvote or something? make a campaign!
It’s not in the nearest plans since we didn’t collect much feedback about Swift plugin usage for now from our users. However feel free to create a feature request:, upvote and follow for the updates.
Clion is now my favorite IDE for C++ coding, but not yet for C++ debug.
Please consider add linking a server to debug.
Such as msvsmon.exe in VS2013.
Thanks.
CLion can do GDB Remote debug, provided that you have gdbserver on a remote machine (). We also plan more comprehensive remote toolchains integration (), but I can’t give you ETA on this.
|
https://blog.jetbrains.com/clion/2016/03/clion-2016-1-released-better-language-support-and-new-dev-tools/?replytocom=25292
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
Xamarin.Essentials: Flashlight
The Flashlight class has the ability to turn on or off the device's camera flash to turn it into a flashlight.
To start using this API, read the getting started guide for Xamarin.Essentials to ensure the library is properly installed and set up in your projects.
To access the Flashlight functionality the following platform specific setup is required.
The Flashlight and Camera permissions are required and must be configured in the Android project. This can be added in the following ways:
Open the AssemblyInfo.cs file under the Properties folder and add:
[assembly: UsesPermission(Android.Manifest.Permission.Flashlight)] [assembly: UsesPermission(Android.Manifest.Permission.Camera)]
OR Update Android Manifest:
Open the AndroidManifest.xml file under the Properties folder and add the following inside of the manifest node.
<uses-permission android: <uses-permission android:
Or right click on the Android project and open the project's properties. Under Android Manifest find the Required permissions: area and check the FLASHLIGHT and CAMERA permissions. This will automatically update the AndroidManifest.xml file.
By adding these permissions Google Play will automatically filter out devices without specific hardware. You can get around this by adding the following to your AssemblyInfo.cs file in your Android project:
[assembly: UsesFeature("android.hardware.camera", Required = false)] [assembly: UsesFeature("android.hardware.camera.autofocus", Required = false)]
Using Flashlight
Add a reference to Xamarin.Essentials in your class:
using Xamarin.Essentials;
The flashlight can be turned on and off through the
TurnOnAsync and
TurnOffAsync methods:
try { // Turn On await Flashlight.TurnOnAsync(); // Turn Off await Flashlight.TurnOffAsync(); } catch (FeatureNotSupportedException fnsEx) { // Handle not supported on device exception } catch (PermissionException pEx) { // Handle permission exception } catch (Exception ex) { // Unable to turn on/off flashlight }
Platform Implementation Specifics
The Flashlight class has been optimized based on the device's operating system.
API Level 23 and Higher
On newer API levels, Torch Mode will be used to turn on or off the flash unit of the device.
API Level 22 and Lower
A camera surface texture is created to turn on or off the
FlashMode of the camera unit.
API
Feedback
|
https://docs.microsoft.com/en-us/xamarin/essentials/flashlight?context=xamarin/xamarin-forms
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
A new bug-fix update CLion 2018.1.2, build 181.4668.70, is now available for download.
Patches from v2018.1.1 will be available shortly. You can also install it using Toolbox App or snap packages if you are on Ubuntu.
If you are using CLion v2018.1, mind that automatic update notification doesn’t appear due to technical issue. Please use the Check for updates action manually (Help | Check for Updates… on Windows/Linux or CLion | Check for Updates… on macOS).
This update fixes a few regressions and addresses several issues related to
using keyword:
- A combination of
usingand void template argument caused an incorrect “Too many template arguments, expected 0” error. Typical sample is
futureusage.
- Incorrect handling of forward declared default template parameters inside namespace with
using, which leads to false “Too few template arguments” error (CPP-10477).
- Another false “Too few template arguments” error in case of
usingtemplate with function decomposition (CPP-9604).
Besides, CLion 2018.1.2 fixes incorrect highlighting for gmock. Google C++ Mocking Framework is widely used for the unit testing. Previous CLion versions had some issues with parsing mocked methods with arguments (CPP-3415). Now these issues are mostly fixed.
Full release notes are available here.
Your CLion Team
JetBrains
The Drive to Develop
Unfortunately, it appears with every release you are breaking something new. 2018.1.1 I would get false errors. Clion would highlight errors in code that weren’t actual errors. I could usually fix this by resaving the file. Now it’s giving me errors with template parameters in lambda expressions. Even though it compiles without issue and all test cases work correctly. This bit of code gets highlighted as an error in Clion 2018.1.2, but doesn’t in 2018.1.1.
e->addComponent(
[](MockComponentOne* c){
c->x(12.0);
c->y(4.0);
});
It says there’s a type mismatch between std::function and std::function. The actual function signature is ‘template Status addComponent(std::function init);’
I’m starting to become disappointed in the quality of this product. It’s been a solid product in the past, but lately, it seems the quality has been suffering. Please fix. I really like Clion and don’t want to switch.
We are sorry for the inconvenience. We are constantly working hard on improving the product and sometimes, unfortunately, regression testing doesn’t catch things. We’ll take a look at your problem.
By the way, which compiler is that (with version)? I guess this is the full sample?
Yes, that’s the sample. Thanks for looking into it. I’m Using WSL with Ubuntu 16.04.4 LTS. GNU Make 4.1, CMake 3.5.1, c++/cc 5.4.0, gdb 7.11.1.
yes, it’s a regression with gcc and std::function. Currently under development/testing:
Should be fixed in this update:
Will there be more bug fix updates to 2018.1? It will regularly freeze up completely for several minutes at a time (100% load on one core only), seemingly while doing parsing or symbol lookup (this has been a problem with both 2018.1, 2018.1.1 and 2018.1.2).
This is so bad that we’ve had to avoid this version and stay on 2017.3. I was hoping that CLion would get increasingly better at parsing and symbol lookup, but sadly it seems that this is not the case. I hope this improves. We like CLion a lot, but the current state of 2018 makes it impossible to use.
One reason for performance degradation in 2018.1.2 is here. And we are currently discussing the possibility for backporting to some 2018.1.x.
Just to check if that’s the same issue for you – can you please report the thread dumps (created automatically on freeze in the log directory) to us?
My issue might not be CPP-12837, as my steps to reproduce are different. Is it OK if I file this as a new defect, and link from CPP-12837 to the new one in case they are the same root cause?
Sure
Filed as
We’ll check, thanks. There are more performance fixes in 2018.1 coming soon as 2018.1.3. Hopefully today
CLion 2018.1.3:
I’ve also noticed unprecedented FULL HANGS in latest Clion.. Never expected such behaviour from such IDE.. Though both CPU and hdd are idle ALL Clion GUI hangs even mouse cursor is missing when inside Clion’s window…
Could you please check the tread dumps in the log directory generated automatically?
Where do I post you those logs as a zip archive? There used to be your ftp but I can’t find it…
Please find the information in the end of the article here:
Please check the 2018.1.3 update with some important performance fixes:
|
https://blog.jetbrains.com/clion/2018/04/clion-2018-1-2-bug-fix-update/?replytocom=52042
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
Episode 225 · January 23, 2018
A look into Stimulus JS, a new Javascript framework by Basecamp to pair closely with Turbolinks
What's up guys? Welcome back, we are going to dive into the Stimulus JavaScript framework this episode, I'm going to give you an introduction to show you how it compares to other JavaScript framewoks and libraries, and then we'll dive into taking a look at some examples, but then, in a future episode, we'll dive into some more complex stuff. This is just your primer, your introduction, we're going to take a look at all of that in this episode. Where does Stimulus fit in? and why do we need another JavaScript framework? and why are you calling it a framework in quotes? Well, Stimulus is very different from what you might expect, so when you think of a JavaScript framework these days, you think of something that helps you rendering HTML, handling events, worrying about your state, doing all kinds of other things like sub components and organizing all your code and all stuff, well it's not really what Stimulus does, it does some of that, but it's designed mostly to just handle events in an organized manner, and so we have to first take a look at where Basecamp has come and their approach on JavaScript on the front end, and so we'll jump back to turbolinks real quick and talk about Turbolinks and why it exists.
There was a time when everybody was talking about how fast it was to build your front end in JavaScript and render out all of the HTML and that was way faster than browsers being sent a GET request, having to reload all of your JavaScript and CSS and making those pages slow just because the browser would clear out all of that on the next request, and so Turbolinks was introduced to give you the speed of a single page app without any of the complexity, so all it does is listen to link clicks and say: Well, instead of doing that with the regular browser process, let's just do that with AJAX, let's replace the DOM with a new DOM, and rerun your JavaScript as necessary, and that is that. That worked out really nicely in a lot of cases, but it didn't address the entire problem that other front end frameworks and single page app frameworks did, so those took care of helping you render HTML, they took care of the state, they did a lot of extra stuff and so that is where Turbolinks fell flat, it only made new page request quick but you were still required to use something like vanilla JavaScript or jQuery to handle events to build out complex forms or wizards or anything like that that might be interactable in a page, and so Stimulus is being introduced as an alternative to doing your front-end framework as a framework again, and you don't have to go through and come up with your own structure for vanilla JavaScript, you don't have to use jQuery either, and so this is designed more as a competitor to jQuery more than is a competitor to Ember, Angular, React or Vue. Those are all still fairly heavy front end things, and Stimulus and Turbolinks are designed to do one thing and do one thing really well, and they kind of fit really well together because they don't step on each other's toes or anything like that, they do very separate things and so Stimulus is mostly designed to help take events that happen on your HTML and then run some JavaScript and basically you just define data attributes and where jQuery might have said: Well, we need to look up this element if it's on the page then we need to connect this event listener and all that. Those things are taken care of for you in Stimulus, and all you do is write some data attributes like data controller and data target and data action and those will be wired up for you and all you have to do is implement the equivalent methods inside of your controller to make those functions work, and so this is kind of like building out your jQuery events in a much more structured way and so you're unlikely to get as much spaguetti JavaScript code as you might where you accidentaly do things in jQuery and don't structure them correctly, so this is very much a competitor to jQuery more than it is with Vue or Angular or React or Ember, and that's something important to keep in mind because I think a lot of people read this and they're like: Does it do AJAX requests for me? Does it handle state? Does it render HTML? NO Pretty much none of that, it just really focuses on events because you also have rails Vuejs to do your AJAX requests, that's built in, you have Turbolinks to make your page render the new content or whatever, and so Stimulus is just designed to say: Well, we have this HTML and we want to make it interactable, how do we do that? And so that is where Stimulus fits in.
Let's dive into and example application, and let's generate a new app. We're going to use webpacker to install Stimulus, so let's just call this
rails new stimulating --webpack
You can always go to the webpacker installation instructions and add webpacker to an old application if that's what you would like to do. This will just go ahead and install it automatically for us so we don't have to worry about that. Once this is set up, we can then go and create our Stimulus set up code inside code inside of our JavaScript pack tag and all of that, so we'll get a Stimulus set up and then we'll be able to use that anywhere in our application. So if we go into this stimulating ap we can
cd stimulating
yarn add stimulus
That's going to install the npm package for us, and then we can open up our application here, we're going to need to go and do one thing first, we're going to go to the application.html.erb, and we'll grab this JavaScript include tag and change it to a pack tag. That will load our app/javascript/packs/application.js, now we don't need any of this in here really, but wo do need to set up our initalizer code for stimulus, so let's take a look at that. We need to import
import { Applicatoin } from 'stimulus' import { autoload } from 'stumulus/webpack-helpers' const application = Application.start() const constrollers = require.context("./controllers", true, /\.js/ ) autoload(controllers, application)
What that's going to do is require us to have a app/javascript/packs/controllers folder, you cal also do ../controllers if you wanted app/javascript/controllers, but we're gonna do that just in the standard folder, so we'll have controllers here, and that folder will show up in a second once we add app/javascript/packs/controllers/hello_controller.js so you need to name it with the same name and underscore like you would with rails, and then underscore controller.js at the end, so this is very similar to how you do a controller file name in rails, and then the difference once you create one of those is that you're going to create a class here and export that. So here first we need to
import { Controller } from 'stimulus' export default class extends Controller {}
So I have an unnamed class that inherits from controller and then we're going to export this so that when the autoload loads it it will be able to get this class and use access to that somewhere else, and in here we can do all of our actions that we would like, so we don't have any pages in our rails app yet, so let's go create one.
rails g scaffold Event name
let's leave it at that for now and we'll go back in another episode and so some more complex stuff with Stimulus, with this done, let's run
rails db:migrate
Let's go to our rails app and go to the routes file and sert
root to: 'events#index'
Save that, and let's go to the events index.html.erb and in here is where we can begin by adding our Stimulus stuff, so let's just create a new tag here at the bottom
<div data- <input data-
You might think that you could just type name here like you would probably do on your own, but you actually need to namespace this under the controller name for it to work properly, and so keep that in mind, but that's going to help in case you mix these in with other ones, you'll know that this is the name for the hello controller, and you might have html mixed in with another component that has a name as well, and so that way it doesn't get confused.
<div data- <input data- <button data-Log</button> </div>
This one syntax is very simple, you have the event name similar to all the event names that you would listen to like on submit or on click or on paste or key up, any of those things you can do and then you can tell it with the arrow, call this controller and this action, so we're going to have methods in here that will match those action names, and so then from here, you have access to a special variable called
this.targets, that is coming from your controller, which will allow you to grab those targets and you can say
export default class extends Controller { log() { this.targets.find("name") } }
that will look for anything called "Hello.name", and grab that first one, and then we can ask for the value on that, we can say
console.log that out. If we refresh our page, we should be able to see this, and we should be able to say "Test 123", click "Log", and that will print that out.
That worked well, but I want to point out that this works for all events, by default, click is kind of the most common one, a lot of times we need to use that, but if you had a form here, you could actually apply this stuff to rails form, and you could have a data action submit, and you could have a call some JavaScript in your controller when the submit was attempted, and so you could check for validations then and you could cancel the "Submit" if you wanted to, you could do all that kind of stuff, and I'm going to show you how you can interact with the event when you submit something, so for example, instead we don't have a form here, instead let's create a data action on the input element, we'll say: Well, when you paste into this
input element, we'll call the hello paste method, and our paste method is just going to be one of those annoying ones that says
paste (event) { event.preventDefault() }
that will happen because we can receive the event as an argument to our action here, so for all of these if you ever want to interact with that, just type event here, or "e", and that will make sure that you get access to that, otherwise it just sends it anyways, but you ignore it and don't save it to a variable, so you can always add that in, and then call
preventDefault if you want to intercept and cancel that from happening. From here we could just say
console.log("pastes are not allowed"), and so if we grab some text here, copy it to the clipboard, and we refresh our browser, we should be able to paste that in, and it will say: "Pastes are not allowed" and it didn't actually put the text into the box either because the
preventDefault stopped it from doing that. That's cool, that's how you could add this to your forms, and then go check all of those data targets, and say: Does this match? Is this filled out or not? Yes or no? Does this match the REGEX that I wanted to match or whatever, all those kind of validations you can do really easily with something like this which is really cool. Last but not least, we want to talk about state in these components, because they are very different than the state you might think of in React or Vue where you have a JSON object doing that, in Stimulus they encourage you to use html attributes to do that. For example, if you wanted to pass in a default value for the name, you would do something like
data-hello-name="Chris", and here we would be able to access, we could
get name() { if(this.data.has("name")) { return this.data.get("name") } else { return "Default User" } }
We could return this value on there, and so we'll either get the default name or not, and we can define an initialize method here, and this is going to allow us to say:
initialize() { this.nameElement.value = this.name }
That's going to set the default value when we load our page. So loading our page we see that we get "Chris" as the default value in our log box, we can click log, but that's not going to work anymore, because we need to use
this.name.element to access the getter, and then if we go and remove the default value there, we can refresh this page, and it's going to say: "Default user" instead, and log in should work now, if we type "Chris" in there, we can type "Log", or hit "Log" and that print out the value that is currently in there.
All of this is kind of designed so that your HTML is what keeps track of the state, and you're going to use that as a place that you can have so that when Turbolinks reloads the cached version of the page, the stuff will continue to work, you're not making extra AJAX requests, just to fill out the form because rails can go ahead and add that data attribute in with JSON or text or whatever values you need, and then your page can immediately be functional as soon as it gets rendered in your browser that way you're not making these extra AJAX requests that make certain widgets of your page load after the page is loaded, which gets kind of frustrating, so this takes an angle at things that's different than your JavaScript frameworks then you're used to, and I really like this for simple stuff, I'm very curious what happens as you go and build more complex things witht this, I think it will work out pretty well, but I haven't built anything super complicated with it yet, and so that is what we're going to be diving into more in the next few weeks as I learn this more and we get to see what other people are building with it. I think it will work out pretty well, and the simplicity of this goes hand in hand with the simplicity of rails, if you know how rails controllers and routes work, this all feels very similar to how those work just in JavaScript land instead, so it's really cool, the one thing I keep forgetting is these namespaces on the targets and the data attributes, I always kind of forget that they need to have the namespace of the controller in there, but so far that's not really that bad. That is it for this episode, I hope that helped you wrap your head around Stimulus and where it fits in and what it's good at and what it's not good at, and hopefully that will make it easier for you to decide if you want to use Stimulus or not in the future. If you have any questions, as always let me know in the comments below and I'll do my best to help answer those and get you a better understanding of Stimulus js. Until next episode, I will talk to you later. Peace
As a recap, here's the complete app/javascript/packs/controllers/hello_controller.js
import { Controller } from "stimulus" export default class extends Controller { initialize() { this.nameElement.value = this.name } log(event) { console.log(this.nameElement.value) } paste(event) { event.preventDefault() console.log("pastes are not allowed") } get name() { if (this.data.has("name")) { return this.data.get("name") } else { return "Default User" } } get nameElement() { return this.targets.find("name") } }
Transcript written by Miguel
Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.
|
https://gorails.com/episodes/stimulus-js-framework-introduction?autoplay=1
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
Opened 3 years ago
Closed 2 years ago
Last modified 2 years ago
#4453 closed defect (worksforme)
Failed to link libadblockplus-android with Android NDK 11c
Description
Environment
libadblockplus can be linked with android ndk 10 (tested with 10e), but can NOT be linked with ndk 11 (tested with 11c), both logs attached.
How to reproduce
- run "./gradlew clean assemble"
...
Attachments (2)
Change History (9)
Changed 3 years ago by asmirnov
Changed 3 years ago by asmirnov
comment:1 Changed 3 years ago by asmirnov
- Cc sergz rjeschke added
comment:2 Changed 3 years ago by asmirnov
- Summary changed from Failed to link libadblockplus with Android NDK 11c to Failed to link libadblockplus-android with Android NDK 11c
comment:3 Changed 3 years ago by asmirnov
- Blocked By 4062 added
comment:4 Changed 3 years ago by asmirnov
Last edited 3 years ago by asmirnov (previous) (diff)
comment:5 Changed 3 years ago by asmirnov
i've just tried android ndk r13b and it obviously does not compile it becuase of missing 4.6 toolchain.
a symlinking toolchain 4.9 to 4.6 as a trivial workaround fails after few minutes of compilation:
... ../third_party/v8/src/checks.h:256:5: note: in expansion of macro 'SEMI_STATIC_JOIN' SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) ^ ../third_party/v8/src/checks.h:289:30: note: in expansion of macro 'STATIC_CHECK' #define STATIC_ASSERT(test) STATIC_CHECK(test) ^ ../third_party/v8/src/api.h:130:3: note: in expansion of macro 'STATIC_ASSERT' STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); ^ AR(target) /Users/asmirnov/Documents/dev/src/libadblockplus.ssh2/third_party/v8/../../build/android_arm.release/obj.target/tools/gyp/libv8_base.arm.a arm-linux-androideabi-ar: invalid option -- / Usage: /softdev/android-ndk-r13b/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar [emulation options] [-]{dmpqrstx}[abcDfilMNoPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file... /softdev/android-ndk-r13b/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/arm-linux-androideabi /softdev/android-ndk-r13b/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar: supported targets: elf32-littlearm elf32-bigarm elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex make[4]: *** [/Users/asmirnov/Documents/dev/src/libadblockplus.ssh2/third_party/v8/../../build/android_arm.release/obj.target/tools/gyp/libv8_base.arm.a] Error 1 make[3]: *** [android_arm.release] Error 2 make[2]: *** [android_arm.release] Error 2 make[1]: *** [v8_android_multi] Error 2 make: *** [android_arm] Error 2
comment:6 Changed 2 years ago by sergz
- Resolution set to worksforme
- Status changed from new to closed
comment:7 Changed 2 years ago by asmirnov
Deprecated after landed
Last edited 2 years ago by asmirnov (previous) (diff)
Note: See TracTickets for help on using tickets.
According to release notes () ndk 11:
It forces us to compile both libadblockplus-android and libadblockplus with the same version of ndk (let's say ndk11).
Currently libadblockplus is compiled with ndk10 or older and using std::__1 namespace for linking and libadblockplus-android is compiled (trying) with ndk11 and using std::__ndk1 namespace.
ok. Now trying to skip using prebuilt libadblockplus files and recompile it with ndk11 too.
The latest libadblockplus is using v8 of revision:
It's pretty ancient and it can be compiled with gcc toolchain 4.6 only, since in "Makefile.android" "4.6" it's hardcoded.
I've tried to replace it with "4.9" which is present in ndk11 and ndk12 but got build error:
We can't just update v8 to the more recent version because of blocking issue.
Will be continues after blocking task resolved.
|
https://issues.adblockplus.org/ticket/4453
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
SignalR is a library that simplifies the real-time communication between the web page and the server. It uses WebSockets or long-polling method depending on the web browser used.
There are too many articles about hosting a SignalR hub and communicating with it from a client applications. But some of them are too simple (just show how to send a message), some of them are too complex that are hard to understand and some of them have badly organized code. I wanted to demonstrate simple scenarios with simple code samples with almost no extra code.
Demonstrated scenarios are:
WindowsForms self hosted SignalR application looks like this.
To host a SignalR server on a WindowsForms application, the following nuget packages must be installed either from Package Manager Console or from Manage Nuget Packages window.
Microsoft.Owin.SelfHost
Microsoft.Owin.Cors
Microsoft.AspNet.SignalR.Core
Microsoft.AspNet.SignalR.SelfHost
The next step is preparing the self-hosting environment. To do this, create a class named Startup and add the following code into it. The Configuration method will be called automatically by the self hosting environment.
Startup
Configuration
class Startup
{
public void Configuration(IAppBuilder app)
{
//CORS need to be enabled for calling SignalR service
//from external web applications/pages
app.UseCors(CorsOptions.AllowAll);
//Find and register SignalR hubs
app.MapSignalR();
}
}
To start Web Application which hosts the SignalR service, call WebApp.Start method with the desired SignalR service address.
WebApp.Start
_signalR = WebApp.Start<Startup>(txtUrl.Text);
Microsoft.AspNet.SignalR.Hub
public class SimpleHub : Hub
{
//Called when a client is connected
override OnConnected()
//Called when a client is disconnected
override OnDisconnected(bool stopCalled)
//Public methods inside this region are callable from any SignalR client
#region Client Methods
//A client provides a user name for himself
void SetUserName(string userName)
//Client calls this to join a group
Task JoinGroup(string groupName)
//Client calls this to leave a group
Task LeaveGroup(string groupName)
//Clients call this to send a message to the hub
//Hub then broadcasts the message to all the connected clients
void Send(string msg)
#endregion
}
Context property of a hub whose type is HubCallerContext has several properties that provide information about current request like ConnectionId, Headers and RequestCookies.
Context
HubCallerContext
ConnectionId
Headers
RequestCookies
Clients property can be used to perform operations on all the connected clients or on specific clients. Every client has a ConnectionId which can be used for performing operations on a client. The following calls return dynamic objects which can be used to invoke operations on the client side.
Clients
//For all the clients
Clients.All
//For a specific client
Clients.Client(connectionId)
//For clients that are members of a group
Clients.Group(groupName)
The following code block invokes addMessage operation on all the clients. If no such operation is defined on the client side, nothing happens.
addMessage
Clients.All.addMessage(senderUserName, message);
Groups property can be used to add or remove clients to groups.
Groups property
//To add a user to a group
Groups.Add(userConectionId, groupName);
//To remove a user from a group
Groups.Remove(userConectionId, groupName);
A new instance of the hub class is created for each request, so hub classes cannot contain any state. Also, it is not possible to add instance events to a hub class and track the operations by subscribing to these events.
To overcome this problem, two methods can be used:
In this sample project, I have used static variables and events approach for simplicity. So the SimpleHub class contains a static dictionary for holding state data for connected clients and several static events to inform its subscribers.
SimpleHub
static ConcurrentDictionary<string, string> _users = new ConcurrentDictionary<string, string>();
public static event ClientConnectionEventHandler ClientConnected;
public static event ClientConnectionEventHandler ClientDisconnected;
//...
In order to send a message from server to clients (or invoke an operation on a client), we need to access the Clients property of the hub, but it is normally only available when processing a request in a hub method. There is, of course, another way to access hub related context outside a hub class. Microsoft.AspNet.SignalR.GlobalHost has several static properties that can be used to access and manipulate SignalR host. One of them is ConnectionManager property.
hub
Microsoft.AspNet.SignalR.GlobalHost
ConnectionManager
The following code gets the hub context for SimpleHub type and invokes a method on all the connected clients.
var hubContext = GlobalHost.ConnectionManager.GetHubContext<SimpleHub>();
hubContext.Clients.All.addMessage("SERVER", txtMessage.Text);
WindowsForms client application looks like this:
width="429px" alt="Image 2" data-src="/KB/aspnet/5162436/winforms_client.png" class="lazyload" data-sizes="auto" data->
For SignalR client components, add Microsoft.AspNet.SignalR.Client nuget package to the project.
Microsoft.AspNet.SignalR.Client
The first step of connecting to a SignalR hub is creating a HubConnection to the SignalR server. Then, getting the proxy object that will be used to communicate with the desired hub.
HubConnection
//Create a connection for the SignalR server
_signalRConnection = new HubConnection(txtUrl.Text);
//Get a proxy object that will be used to interact with the specific hub on the server
//There may be many hubs hosted on the server, so provide the type name for the hub
_hubProxy = _signalRConnection.CreateHubProxy("SimpleHub");
The next step is to register hub events (methods invoked by the hub). The following code registers a handler method for AddMessage event. Registered lambda expression takes two parameters and writes them to log area.
AddMessage
log
_hubProxy.On<string, string>("AddMessage",
(name, message) => writeToLog($"{name}:{message}"));
After configuring the hub events, it is time to connect to SignalR hub by calling the Start method of the HubConnection object.
Start
await _signalRConnection.Start();
Public operations defined on the connected hub can be invoked using the IHubProxy objects Invoke method with the remote operation's name and required parameters. Sample code invokes the Send method of SimpleHub class.
IHubProxy
Invoke
Send
_hubProxy.Invoke("Send", txtMessage.Text);
JavaScript client application looks like the WinForms client application. I tried to construct a similar interface and implement exactly the same operations. The only functional difference is, user interface elements are enabled and disabled based on the current state.
style="width: 502px; height: 665px" alt="Image 3" data-src="/KB/aspnet/5162436/js_client2.png" class="lazyload" data-sizes="auto" data->
JavaScript client uses jQuery and jQuery.signalR script libraries. You can add them to your project by installing the following nuget packages:
jQuery
jQuery.signalR
In order to connect and use remote SignalR hub, another script library must be referenced. But it is not a file that you can locate and add as a script reference in HTML file. This script is automatically generated by the SignalR server. Script address is "signalR address" + "/hubs"
<script src=""></script>
<!-- or relative path -->
<script src="~/signalr/hubs"></script>
The test client application can connect any signalR service by entering the URL address of the service into the Url inputbox. So the script location is not to be fixed for this sample application. In order to solve dynamic script location problem, I have loaded this automatically created hubs script inside the connect function using the jQuery.getScript function. getScript function takes two parameters; address of the JavaScript to be loaded and a function that will be called when downloading the script has finished. As you can see in connect JavaScript function in the sample Index.html page, actual connection operations are performed after this auto generated has downloaded successfully.
connect
jQuery.getScript
getScript
//Connect to the SignalR server and get the proxy for simpleHub
function connect() {
//Load auto generated hub script dynamically and perform connection
//operation when loading completed
//SignalR server location is specified by 'Url' input element,
//hub script must be loaded from the same location
//For production, remove this call and uncomment the script block in the header part
$.getScript( $("#txtUrl").val() + "/hubs", function() {
$.connection.hub.url = $("#txtUrl").val();
// Declare a proxy to reference the hub.
simpleHubProxy = $.connection.simpleHub;
//Register to the "AddMessage" callback method of the hub
//This method is invoked by the hub
simpleHubProxy.client.addMessage = function (name, message) {
writeToLog(name + ":" + message);
};
//Connect to hub
$.connection.hub.start().done( function () {
writeToLog("Connected.");
simpleHubProxy.server.setUserName($('#txtUserName').val());
});
});
}
Steps for connecting and interacting with a SignalR hub are the same as WindowsForms client. Sample code demonstrates how to prepare a connection to a SignalR hub, create a proxy for interacting with it, registering a server event (or callback) and calling (invoking) a method (setUserName in this case) on the server side.
setUserName
There is a simple JavaScript function for each operation. For example, following is the sendMessage function that send the provided message to the server by invoking the "send" method with the text entered into txtMessage input box.
sendMessage
send
txtMessage
//Send a message to server
function sendMessage() {
if(simpleHubProxy != null) {
simpleHubProxy.server.send($('#txtMessage').val());
}
}
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Error:Transport timed out trying to connect
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
https://www.codeproject.com/Articles/5162436/Simple-SignalR-Server-and-Client-Applications-Demo
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
From: Bronek Kozicki (brok_at_[hidden])
Date: 2006-07-04 15:41:09
Peter Dimov wrote:
>>> The compiler cannot check that the right tag is used since
>>> information is added to the exception at runtime, so you're still
>>> vulnerable to typos. That means you would still have to either put
>>> the tags
>> you only declare them; and if you used different name than declared,
>> compiler will catch that error.
> No, it will not, unless I'm misunderstanding something. You either have
> coupling and static checking, or you have no coupling and no static
> checking; strings or tags make no difference. A tag is just a compile-time
> string.
Tag is a type name recognized by compiler; you can declare it as many times
and in as many locations as you wish. Important point about tag is that you
have to declare it before you use it; compiler will enforce it. On the other
hand, string is a literal; there is nothing compiler could check for you.
Obviously, it means that while tags come with some coupling (although minimal
- there is no need for "unified system" or "central location"), strings
require no coupling at all. While this might sound like an advantage, I
believe that it's not - strings (used as literals) are extremely prone to
programming mistakes (like all literals). Obviously, there is simple cure:
replace literal with single definition eg. macro or global const variable. But
this solution comes at the cost, as you suddenly need two names: one for macro
(or variable) and other for actual string. You also need guarantee that the
later one is unique, and compiler will not help you with this. Tags do not
have this problem - there is just one name, and language provides pretty good
means (namespaces, nested types etc.) to help you make that name unique. The
other problem with string is that you need its definition. Simplest solution
for these problems is to keep all all string definitions in a single location
- but that brings strong coupling. To sum it up : strings are prone to
mistakes and there is no good cure for it; on the other hand, tags bring some
(rather weak) coupling and that's it. Of you want, you can introduce
requirement that tag type has to be fully defined at the point of use -
compiler will provide more warranties (more difficult to define mispelled tag)
and coupling will be still weaker that strings used as macros or variables (no
need for central location to warranty uniqneness if you have sane design).
I'm have experience with similar system, my colleagues are still figthing with
problems introduced by literals used as identifiers, and we have not found
good way to solve them so far. Compiler provides too few checks, and
infrastructure to maintain uniqueness is too complex (and centralized).
B.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk
|
https://lists.boost.org/Archives/boost/2006/07/107252.php
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
Java projects have many good frameworks integrated with spring + ibatis. But in .NET projects, we can find few sample frameworks integrated with spring.net+ibatis.net. This article will provide a sample framework integrated with spring.net and ibatis.net, and focus on creating a uniform data access layer. Although I titled this article "integrate with spring and ibatis", the more important thing is to provide a robust, flexible framework. In here, I also provide a help tool to generate this framework's basic coding files with simple configuration. With the tool's help, the developer can focus on the business logic development based on this framework.
I will explain the framework with the attached demo project. This is a very simple sample. The MS Access database file contains a table userinfo, and the table contains three columns: FirstName, SecondName, FamilyName, and this demo project provides the table data read/insert/delete functions.
userinfo
SecondName
FamilyName
read
insert
delete
public partial interface Iuserinfo:IBaseEntity
{
string FirstName{get;set;}
string SecondName{get;set;}
string FamilyName{get;set;}
}
public partial class userinfoDataMapper : usersDataMapper<iuserinfo>
{
}
public partial class usersDataMapper<tentity>:BaseDataMapper<tentity> where TEntity : class
{
public override ISqlMapper Mapper
{
get
{
if (mapper == null)
mapper = new InfrastructureFactory().GetSqlMapper("users");
return mapper;
}
set
{
mapper = value;
}
}
}
The key of the data access layer is the BaseDataMapper class, this is an abstract and provides all the table insert/delete/read/update operations virtual methods, you don't need to implement any of these methods, what you need to do is only to inherit your DataMapper class from this BaseDataMapper class, then you can operate your table.
BaseDataMapper
abstract
update
virtual
DataMapper
public partial class userinfoService:BaseDomainService<Iuserinfo>,IuserinfoService
{
}
These four steps are almost all the work you need to do when you add a new table to your project.
Get the service from the context.
IuserinfoService Service
{
get { return (IuserinfoService)DomainServicesContext.Context.GetObject("userinfoService"); }
}
Read all the records in the userinfo table:
void ReadAllUsers()
{
var list=Service.GetList<iuserinfo>("",null);
if (list.Count == 0) Console.WriteLine("There is no any user record.");
foreach (var item in list)
{
Console.WriteLine("My Name is {0} {1} {2}",
item.FirstName, item.SecondName, item.FamilyName);
}
}
Add a new record to the userinfo table:
void AddNewUser()
{
Iuserinfo userInfo = new userinfo();
userInfo .FirstName= Console.ReadLine();
userInfo.FamilyName = Console.ReadLine();
Service.Insert(userInfo);
}
Delete a record from the userinfo table:
void DeleteOneUser()
{
Iuserinfo userInfo = new userinfo();
userInfo.FirstName = Console.ReadLine();
userInfo.FamilyName = Console.ReadLine();
Service.Delete(userInfo);
}
Above is what I want to do -- provide a uniform access model to application data layer.
The following screenshot shows the basic structure of this framework. the framework provides the application multiple layers excluding the View layer. As a sample, you can use any view display you like.
I created a source code generation tool for this framework. With this tool, you only need to do some simple configuration, then the tool will help you to generate the C# code files for the framework. And currently, it will support the following databases:
style="margin-left: 0px; margin-right: 0px; width: 640px; height: 413px" alt="Image 3" data-src="/KB/dotnet/656657/PrjInfoConfig.png" class="lazyload" data-sizes="auto" data->
Click the "Edit Database Info" button to open a new window to config your database information:
style="height: 468px; width: 640px" alt="Image 4" data-src="/KB/dotnet/656657/DBInfoConfig.png" class="lazyload" data-sizes="auto" data->
Click the "Add" button to register your database information.
If you want to edit the Entity detail, you can also click the "Edit Project Info" button on the MainWindow, and open a screen as shown below, this is an Excel file, you can edit the entity info in Excel format and update to database.
MainWindow
style="height: 287px; width: 640px" alt="Image 5" data-src="/KB/dotnet/656657/ProjectEditScreenshot_small.png" class="lazyload" data-sizes="auto" data->
Now go back to MainWindow and click the "Auto Generate Src Files" button to generate basic framework source code files for your project.
The tool will create a zip file including all the files the framework requires. You only need to unzip it to local and can start your project's coding.
style="height: 279px; width: 600px" alt="Image 6" data-src="/KB/dotnet/656657/SrcCodeZipFile.png" class="lazyload" data-sizes="auto" data->
There are three level 1 directories: AutoGen/Customize/Resources
The files are generated by the TOOL and there is no need to be edited by developer, will be placed in this directory. So the framework basic files, the domain entity define files, interface files will be placed under this directory. Under this directory, there are five sub-directories:
Any class implemented or defined by developers, can be placed in this directory. This is the place where developers can customize their logic. And in this directory, the following four sub-directories are contained:
This directory also contains AutoGen and Customize sub-directory. And similar meaning, all files in AutoGen can be generated by tool and there is no need to edit. And the developer can freely edit all files in Customize.
Domain Object layer is the simplest layer, it contains all the entities classes. In fact, I am trying to build this framework to be adapted to the Domain Driven Design. So according to the conception in DDD, has the following interface design as the class diagram shows. But here is just a simple model, about the detail, you can refer to the Web-Site and extend the interface. And if you have any other ideas, you can also contact me and improve this framework. Anyway, this is just a simple layer, something of the entity classes.
style="height: 492px; width: 600px" alt="Image 8" data-src="/KB/dotnet/656657/DomainObjects.png" class="lazyload" data-sizes="auto" data->
This is the layer that provides data operation functions to database. Or call it DAO. But in here, I am trying to design a uniform access interface base on the entity. So all the interfaces are summarized in the IDataContext interface file. In IDataContext, all the methods are generic methods and can adapt to different entities. So developer only needs to define the Ibatis SQL statement in XML config file, the framework will do all the mapping for you, then you can access the data in uniform interface, and you don't need to take care of every entity's mapping code. Of course, it's also possible for you to customize yourself data access interface if necessary.
IDataContext
style="height: 295px; width: 600px" alt="Image 9" data-src="/KB/dotnet/656657/DataMapper.png" class="lazyload" data-sizes="auto" data->
This is also simple, as the following class diagram shows. IBaseDomainService also contains some uniform interface to access the data through the Infrastructure layer interface, but you can extend the interface by yourself freely. The target of this layer is to do simple operate integration to entities.
IBaseDomainService
style="height: 265px; width: 500px" alt="Image 10" data-src="/KB/dotnet/656657/DomainServices.png" class="lazyload" data-sizes="auto" data->
This layer is designed basing on DomainService layer and face to UI directly. You can implement any business logic in here freely. So there is no UI description in this framework. You can choose any UI layer design as you like. And this App layer will help you to separate the business logic from your UI.
DomainService
The four parts defined before, are almost isolated, you can use anyone in your project as you like. So this Framework Context Common layer tries to integrate the four parts together. So here, define the context for different layers, and integrate the log/exception process with Spring.net AOP.
style="height: 416px; width: 600px" alt="Image 12" data-src="/KB/dotnet/656657/CommonContexts.png" class="lazyload" data-sizes="auto" data->
Up to now, I have described this framework in different views in general. As I always said, this article is trying to provide a basic structure. There are many things that need to be improved, including the framework, the tool. In future, I will try to do these improvements. But I wish you can join this improvement or discussion if you are also interested in this framework.
And, I am also planning to write another article to explain how to use the tool with different database type in detail.
This is only a very basic version. For any updates with the framework, please refer to this link. If you have any questions or problems using this sample code or framework, please feel free to contact me, or raise the topic here. Any concerns.
|
https://www.codeproject.com/Articles/656657/NET-Application-Framework-Spring-net-plus-ibatis-n
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
Spring to Java EE – A Migration Experience.
The trouble you’re having, however, is most likely due to the fact that you’re actually trying to solve problems that don’t need to be solved. When I first made the switch to Java EE 6 from Spring – for my own personal project – Spring’s dozens of extensions, and using Hibernate Object Relational Mapping (
ORM) directly, managing transactions myself, I was trying to do things “the Spring way,” in other words – configuring everything up the wazoo, but let me try to explain some things for you that should help clear the fuzz of attempting to migrate to Java EE; they are things I ran in to, and would likely happen to others as well.
The biggest difference you’ll find is, “Java EE already does that for you.”
Nearly every application requires the same set of basic features: persistence, transactionality, (dependency injection is typically assumed at this point,) and a web-tier view-layer or web-services. The first thing I have to say is: “Don’t freak out when I say Enterprise Java Beans (EJB)” – they’ve truly become a system worthy of attention, and if you’re going to take advantage of the Java EE stack, you’re going to want them around; EJB 3.1 today is miles apart from what it once was, can be used standalone in WARs, and requires just one annotation to configure – soon, with JBoss AS 7, Enterprise Java Beans may simply be an extension built on CDI, like everything else.
To start, I’ll review some of the problems I encountered and solved during my first transition between the Spring and Java EE 6 technologies; most – if not all – of these were due to my lack of technical understanding, the mindsets are truly very different; the results are striking.
Configuring the System – “It’s all just XML in the end.”
This one is simple. Where Spring has
/WEB-INF/applicationContext.xml files of various types, Java EE has various distinct configuration files for each API in the framework WAR. Some of these files are required to activate the API, but some are not. The following chart overviews the most common of these configuration files – there is more to Java EE, but chances are these are all you’ll need to get started. Be careful! If these files are in the wrong place, you will not have a working system!
You should also know that most of these files require some sort of schema, or “XML header” that tells the Application Server (JBoss Application Server, GlassFish, Etc…) which version of the technology to use, since most APIs attempt some level of backwards compatibility. This is similar to including new schemas in Spring’s
applicationContext.xml.
EJBs can be defined via annotations alone, and require no configuration file in order to enable them. JAX-RS is similar, since no configuration file is required when using a Java EE 6 certified Application Server such as JBoss Application Server, everything can be specified through annotations once it is enabled.
Configuration of modules in JAR files:
One of the greatest features of Java EE APIs is the ability to break application code into separate reusable JAR files – where each individual JAR contributes configuration and code to the system they are included in; for instance, you might run multiple applications for your business, but each one must have the same data access providers. You’d create a shared domain-model JAR file and include it in each application. All the configuration would be contained in that JAR, and would be done using the same set of configuration files, placed in the JAR’s
META-INF directory:
Note that some of the file names are different from those that are used in the main application itself.
The Application Server Configuration
In addition to the application configuration, one of the most notable differences between Spring and Java EE is that you actually need to know how to use the application server itself. Spring replaces application server configuration with application configuration (sometimes more convenient, sometimes less convenient, but the same result in the end.) In order to use JPA and transactions (covered later,) you will want to know how to use the transactional data-source feature of the Java Enterprise Application Server, since it makes setting up transactions as simple as writing a plain Java class with an annotation.
Keep in mind that each of these configuration files may have a different syntax and format, since they are produced by different companies. These files should be used to configure settings that must exist in order for the application to run, and should be considered a natural extension to the Java EE module configuration files.
If your application depends on a transactional data source, this is the place to define it – preventing manual configuration of the application server, which can be a very repetitive, monotonous task. This configuration usually only needs to happen once per-server, and allows you to keep database passwords secret, data sources controlled and separate, and JMS queues centralized; though, if you want a standalone application/data-source configuration, then you should think about using these custom configuration files.
Contexts & Dependency Injection for Java – aka Beans
Where spring has
@Autowired, Java EE (CDI to be more specific) has
@Inject. The parallel is really quite straight-forward, since every class in a WAR or JAR file (that has a beans.xml file!) is automatically a bean in CDI, any class can be provided or scoped using dependency injection, just like a bean that would be defined in
applicationContext.xml in a Spring application.
Before we get started, though – remember that you need to create an empty
/WEB-INF/beans.xml file, or your system will not start the CDI container. Technically, you can only inject beans that are themselves in a bean archive (not just any class). However, you can use a producer method to pull in a class from a non-bean archive and make it a bean (or you can use Seam XML to add beans that aren’t in an archive that has a
beans.xml file.)
public class UserCredentialsBean { }
Wait, that’s it? Well, you have a few more options when it comes to managing these beans and deciding how long they will “live,” or how long each bean instance will remain active.
Every bean can be assigned to a “scope,” which is really defining the context in which the bean is relevant. For example, it doesn’t make sense for a logged-in user’s authentication credentials (username/password) to be retained longer than that user’s session, so you would place the bean containing that information in the Session Scope (which is just a nice, clean way of saying that we are storing that information in the
HttpSession object, and when the
HttpSession object dies, so does everything in Session Scope for that user.) This is done using the
@SessionScoped annotation.
@SessionScoped public class UserCredentialsBean { }
In reality we would probably leave the details of authenticating users up to a framework like Seam Security, but just consider this as an example.
There are also several more built-in scopes:
Other custom scopes can be created as needed, and some frameworks such as the Seam Faces Module even provide additional scopes for you. But let’s look at how we inject an instance of our
UserCredentialsBean into another bean.
public class AuthorizationBean { @Inject private UserCredentialsBean credentials; }
These are the basics; no configuration required. We can also scope the
AuthorizationBean in order to control how long that lives as well, but we have a very subtle issue going on here.
@ApplicationScoped public class AuthorizationBean { @Inject private UserCredentialsBean credentials; }
We are injecting a
@SessionScoped bean into an
@ApplicationScoped bean, which in Spring, might cause two problems. We’ll see, though, that these problems have already been solved in Java EE:
- In Spring, when the the
AuthorizationBeanis created, there may not be any active user sessions, and the container may not be able to create the
UserCredentialsBeandependency – resulting in a nasty exception. In CDI, however, the container knows that it will not be able to get a
@SessionScopedobject at that point in the life-cycle, so it waits until the credentials are accessed until it attempts to get an instance of
UserCredentialsBean. If you access that object outside of the active scope, you’ll still get an exception, but that’s a different problem, one that can easily be solved with good application design. (In other words, “you shouldn’t be doing that.”)
- In Spring, when the
@ApplicationScoped AuthorizationBeanis created, assuming that it can get a hold of our
@SessionScoped UserCredentialsBean, the instance that is injected will be the instance that remains for the life of the bean into which it assigned. This means that the same
UserCredentialsBeanwill be used for all invocations and processing in our single instance of the
AuthorizationBean, and that’s most likely not what we want, there would be some pretty nasty bugs (users sharing permissions, etc.) The problem can be solved by turning the bean into a “dynamic-proxy,” in the Spring configuration. In CDI, however, this is again taken care of us already, since the container knows that
@SessionScopedbeans may not live as long as an
@ApplicationScopedbean, and that there may be more than one active Session. CDI will actually find the correct
@SessionScoped UserCredentialsBean, and use that when performing operations on the parent bean, automatically making sure that the right objects are used. Sweet!
Interacting with Beans through Java APIs
If you are trying to get a handle to a bean while working in a part of the system that does not support dependency injection for some reason (
@Inject in CDI,
@Autowired in Spring), it’s sometimes required to ask the framework for a bean instance manually.
In Spring you can ask for an instance of a bean (an object that you can actually use to do some work,) using Java APIs – this assumes you’ve set up the appropriate listeners in your
web.xml configuration.
MyBean bean = ApplicationContext.getBean(“myBean”);
At first glance, you might think this is not possible using CDI, but really it would be more correct to say that it is not yet as convenient. There are technical reasons for this lack of convenience, but while I disagree with that aspect, I do understand the reason for doing things the way they were done.
In CDI, there is a concept of a
@Dependent scoped bean, which adopts the scope of the bean into which it was injected. This means that when we use Java APIs to create a direct instance of a
@Dependent scoped bean, that it will not be stored into a context object (the Request, Session, Application, or other common scope.) In other words,
@PostConstruct methods will be called when the bean is created, but since there is no way for CDI to tell when the bean will be destroyed (because it is not stored in a context – which would normally take care of letting CDI know when to do its cleanup,)
@PreDestroy annotated methods cannot be called automatically. You have to do this yourself, and for that reason the bean-creation process is slightly more complicated – though not that much more complicated – than in Spring; e.g: “With great power comes great responsibility.”
Before you read the following code, I quote from a CDI developer who agrees that things need to be simplified a little bit for convenience – so expect that in an upcoming release of CDI: “I can see that people are going to look at the instance creation code and say that CDI is too complicated. We’ve agreed that it’s lame that a utility method is not provided by CDI for those cases when the developer just has to use it.“
CDI’s equivalent to the
ApplicationContext is called the
BeanManager, and can be accessed through JNDI or several other methods (the easiest method is to use the “JBoss Solder” or “DeltaSpike” projects which provide a
BeanManagerAccessor.getBeanManager() static method very similar (but more generic) to Spring’s
WebApplicationContext utility class:
Get
BeanManager from Solder/DeltaSpike:
public BeanManager getBeanManager() { return BeanManagerAccessor.getManager(); }
getBeanManager()” function is provided by the base class
BeanManagerAware. Don’t worry about how this works for now, unless you want to get into JNDI and server specific stuff.
BeanManagerif you cannot use
@Inject BeanManagerdirectly. The below options are purely for example, and should be avoided if possible.
Get
BeanManager from
ServletContext (in a JSF request):non-standard
Right now this is non-standard, but works in most CDI implementations and is proposed for version 1.1.
public BeanManager getBeanManager() { return (BeanManager) ((ServletContext) facesContext.getExternalContext().getContext()) .getAttribute("javax.enterprise.inject.spi.BeanManager"); }
Get
BeanManager from
ServletContext (in any Web Servlet Request): non-standard
Right now this is non-standard, but works in most CDI implementations and is proposed for version 1.1.
public BeanManager getBeanManager(HttpServletRequest request) { return (BeanManager) request.getSession().getServletContext() .getAttribute("javax.enterprise.inject.spi.BeanManager"); }
Get
BeanManager from JNDI (does not require a Web Request): standard
public BeanManager getBeanManager() { try { InitialContext initialContext = new InitialContext(); return (BeanManager) initialContext.lookup("java:comp/BeanManager"); catch (NamingException e) { log.error("Couldn't get BeanManager through JNDI"); return null; } }
Once we have a
BeanManager, we can ask the container to give us an instance of a bean. This is the slightly more complicated part, but that complication is necessary; again, “with great power comes great responsibility.”
Instantiating a Bean using the BeanManager:
Don’t get scared, you only need to write this once and put it in a utility class (or use WeldX which provides this functionality already.)
@SuppressWarnings("unchecked") public static <T> T getContextualInstance(final BeanManager manager, final Class<T> type) { T result = null; Bean<T> bean = (Bean<T>) manager.resolve(manager.getBeans(type)); if (bean != null) { CreationalContext<T> context = manager.createCreationalContext(bean); if (context != null) { result = (T) manager.getReference(bean, type, context); } } return result; }
Take warning, though, that the
CreationalContext object this method creates before we can get a reference to the bean is the object that must be used when “cleaning up” or “destroying” the bean, thus invoking any
@PreDestroy methods. (Note, because the method above is actually losing the handle to the
CreationalContext object, it will not be possible to call
@PreDestroy methods on
@Dependent scoped objects, and there-in lies the reason why creating beans in CDI is slightly more involved, and why this convenience was omitted – in order to force people to decide for themselves how to handle behavior that might be very important architecturally.) This is the same issue that I mentioned above, when discussing cleaning up bean scopes.
Interacting with Beans through Custom Scopes
The best way to manage instances of objects is to access them via injection, not through the Java API; in fact, any time you find yourself needing access to a bean through a Java API, you should ask yourself why you are not operating within the realm of dependency management via
@Inject. Frequently, you can fix the problem at the root – just like Seam Faces Module does for Java Server Faces (JSF) – by adding injection support in other user-objects such as validators, converters, and more, so that you can use injection with ubiquity. Or the Seam Wicket, Seam Servlet, Seam JMS, and other Seam modules.
Sometimes adding injection support this means registering a custom scope, which can sound complex, but is frequently as simple as attaching a bean scope to an existing contextual object such as the
HttpSession for
@SessionScoped, or the JSF
UIViewRoot, for
@ViewScoped in Seam Faces.
The “Java Persistence API” vs. “the Spring way”
Spring: First you set up a data-source in
applicationContext.xml, then you set up a connection pool, then you configure Hibernate to use that connection pool as a data source, then you tell Hibernate where to get its transaction manager, then you need to set up a byte-code assist library (AoP) in order to enable cross-bean transactionality and security via annotations.
Not only is that a good bit confusing to work through (unless you’ve already done it a few times,) but when I started using the actual Spring setup, I got
LazyInitializationExceptions all over the place because I didn’t first understand what a Hibernate session was, which took another few days to understand and get working – I’ll get back to that in a bit when I talk about Extended Persistence Contexts in Java EE – something you should be using if you can. In my opinion Spring did a tremendous disservice by trying to hide the persistence context as though it were just an adapter. The persistence context is crucial to how the ORM model works; you need both the entities and the persistence context in your toolbox in order to be successful.
Put the Spring configuration aside for a moment; now let’s talk about Java EE – all you need is
/META-INF/persistence.xml, of which I’ve provided a quick working example below.
For the purposes of these examples, I’m going to assume that you are using JBoss AS 6, or have already installed Hibernate on GlassFish (which is very easy to do, and I recommend since trying to get my application to run on the default EclipseLink has given me a lot of problems when attempting to migrate from Hibernate; Hibernate is still the industry leader in terms of stability and functionality, in my opinion.)
<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="" xmlns: <persistence-unit <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source> java:/DefaultDS </jta-data-source> <!-- Data source for GlassFish if you aren't using JBoss AS 6.0... <jta-data-source> jdbc/__default </jta-data-source> --> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <!-- Properties for Hibernate (default provider for JBoss AS, must be installed on GlassFish) --> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="false"/> </properties> </persistence-unit> </persistence>
But where’s the configuration for transactions? Where do you set up database connections and connection pools? Well, transactions just work automatically if you are using a JTA data-source (more on that in a bit,) you can set up data-sources (and should set them up) in your application server configuration (meaning that since your data source configuration is not stored in the application itself, when your application is deployed it will use the data-source that is available on that server automatically,) and yes: “it’s that simple.” The mentality is a little different, but the end product is a much smaller, “weightless” application. You can set up data sources yourself, but for that you’ll need to read the documentation about your web application server. These files are typically kept separate in order to keep passwords out of your application source code or version control repository.
So great, we have persistence set up; but what about those Hibernate
LazyInitializationExceptions that we all love to hate? We’ll talk about that in the next section, but this is where EJB’s come in, and again, don’t get scared. It’s really very simple to make an EJB, and once you learn what they actually do for you, I’d be surprised if you want to go back.
Here I’d like to mention that with the addition of a tool such as Seam 3‘s Persistence Module, you can use JPA and the
PersistenceContext in standard CDI beans without EJB – Seam 3 also provides the same consolidated support for managed transactions, security, remoting, and messaging that is provided when you use EJB. Seam 3’s mission is to provide a unified programming model (standardized on CDI) to the Java Enterprise Framework.
As we continue, I’m going to assume a little familiarity with Object Relational Mapping in general, that you know you need to configure your data entities with annotations(or XML) so that the system knows how to map your data to the database. If you are familiar with Hibernate, then JPA should be no stretch by any means of imagination because Hibernate is a JPA implementation. In fact, you can use most of the same annotations!
@Stateful public class Service { }
@Stateful public class Service { @PersistenceContext(type = PersistenceContextType.EXTENDED) private EntityManager em; }
@Stateful public class Service { @PersistenceContext(type = PersistenceContextType.EXTENDED) private EntityManager em; public <T> void create(final T entity) { em.persist(entity); } public <T> void delete(final T entity) { em.remove(entity); } public <T> T findById(final Class<T> type, final Long id) { Class<?> clazz = getObjectClass(type); return result = (T) em.find(clazz, id); } public <T> void save(final T entity) { em.merge(entity); } }
That’s all it takes to create a service class that knows how to interact with the database, so assuming that you have a few
@Entity classes defined, you’ll be good to go. If you want more information on getting started with Hibernate and JPA, you can start here. But wasn’t that simple? About 10 real lines of code and you’ve got a fully functional database access object. You do need to create actual
@Entity objects to save to the database, but that’s for a separate tutorial.
Thanks to Dan Allen, I’ve attached a Maven project that includes an Arquillian-based test suite that you can study to get a greater handle on exactly what occurs when using a persistence context, both one that is transaction-scoped and one that is extended. This is exactly where Arquillian fills in nicely as a teaching tool. You can quickly make changes to the code and see how it affects the result…all in-container. You might want to take a look at this before continuing. You can download the lab here, unzip, open a terminal, and type: mvn test.
You can also import the project into your IDE and debug to get a visual sense of what’s going on, otherwise, the tests should be pretty revealing!
What about
LazyInitializationException? (Persistence, Transactions, and the Conversation Scope)
The first thing you need to know about
LazyInitializationException is that they occur when Hibernate (or another JPA-style ORM) attempts to load a collection or related data from an
@Entity object that is no longer “managed.” What is a “managed” object?
To understand this term, we need to look back at how Hibernate and JPA work under the covers. Each time you ask for an object from the database, the system has some form of
Session (Hibernate) or
PersistenceContext (JPA) that is used to open connections, manage results, and decide whether or not the objects have been modified (which allows for clean/dirty state to determine when or when not to save objects back to the database.)
Introducing a failure situation:
Consider the scenario when an object is loaded from the database. This object has an ID, and holds a list of addresses that are associated with it.
Person person = service.getPerson(1);
Person is loaded from the database using a select statement like this:
select from persons p where p.id = ?
But as you can see by the SQL query, we have not let loaded the addresses since associations and collections are typically be selected only when something attempts to access them, otherwise known as “Lazy” initialization:
List<Address> addresses = person.getAddresses();
Here is when you have the chance for a
LazyInitializationException, because this method call actually makes a secondary query to the database, requiring an open connection:
select from addresses a where address.person_id = ?
That sounds fine, but let’s say for instance that a user does something on your website that triggers a
Person object to be loaded from the database. Nothing special happens with this object, the application just loads it, reads some fields out of it, and goes on to the next page. When that next page is requested, we grab that same
Person object that we loaded on the last page, try to pull more information out of it – for instance, the list of addresses that was not previously loaded, and oops! We got a
LazyInitializationException - “Entity is not associated with a known PersistenceContext” What happened?
My object was just loaded, can’t the
Session or
PersistenceContext object just open a new connection to the database and get the information that I need? – The answer is “yes” it can, but not if that Session or
PersistenceContext has already been destroyed, and the object is no longer associated with it! You are probably not using an “extended” persistence context. We need to dig deeper…
Understanding
LazyInitializationException and the Extended PersistenceContext
First, we need to know a few things about “extended” Persistence Contexts:
- They live as long as the bean they are scoped to.
- Objects with dirty changes queued up in the context until a the transaction with which a persistence context is associated is committed. If a context is destroyed outside of the transaction, the changes are never propagated to the database. It’s the transaction that triggers the session flushing. Flushing can also happen in the middle of a transaction if Hibernate/JPA needs to run a query against the database based on the state of a managed entity (e.g., a where clause)
- Changes made to objects associated with the context are deferred from flushing if an un-handled exception is encountered. The changes will be flushed the next time a flush is attempted.
- While the extended
PersistenceContextis alive, you will never get a
LazyInitializationExceptionfrom objects associated with that context, ever!
@Statelessor
@StatefulEJBs via the following annotation:
@Stateful public class Service { @PersistenceContext private EntityManager em; }
By default, this
EntityManager (persistence context) will be scoped to the length of the transaction (which can be controlled by getting a handle to the user transaction and manually calling
tx.begin() and
tx.end(); however, if we add
(type = PersistenceContextType.EXTENDED) to our injection point, we are now using extended persistence contexts, and that is what we probably wanted all along.
@Stateful public class Service { @PersistenceContext(type = PersistenceContextType.EXTENDED) private EntityManager em; }
Use case: the @ApplicationScoped PersistenceContext (Bad practice)
Lets imagine for a moment that one single
PersistenceContext is created for our entire application; the context is started when the server starts up, the context is never destroyed until the server shuts down, and all objects are held within that context. In other words, you’ll never get a
LazyInitializationException, ever, because the context will always survive, and
@Entity objects never lose their reference to it.
But also consider that you are running this as a web-application, multi-threaded, that services multiple users at the same time. Changes made by each user are queued in our extended context until the next transaction boundary, which might be as long as until the application shuts down (destroying the extended context,) at which point all changes made by all users are saved to the database and the transaction is committed.
That sounds pretty dangerous… and that’s what happens if you use an Extended
PersitenceContext in an
@ApplicationScoped bean. Objects associated with that
PersistenceContext will stay around for the life the context itself, so obviously we must (sarcasm) need a
PersistenceContext for each user, since we don’t want all changes being queued up and saved when the application shuts down – too many things could go wrong with that scenario.
The
@ApplicationScoped Persistence Context will start when the application starts up, and it will be destroyed when the application shuts down. There may be multiple transactions (bound to the EJB business methods) that occur within the lifespan of this context.
Use case: the @SessionScoped PersistenceContext
Let’s now create a
PersistenceContext for each user session. Not a horrible concept, and does actually have applicable uses! Each user gets their own
PersistenceContext that holds
@Entity references to objects from the moment the session is created until the moment the session is destroyed. They can interact with these objects, save, update change and delete objects without fear of stomping on anyone else’s changes, and their queued changes are saved when the transaction is committed at the end of the session (or any other time a transaction is committed).
The
@SessionScoped persistence context will be created when the user’s session begins, and it will be destroyed when the user’s session is destroyed. There may be multiple transactions (bound to the EJB business methods) that occur within the lifespan of this context.
But what if you want more fine-grained control over transactions? What if session scope is too long? We don’t want our users making changes on the site that won’t be saved until they log out or their session expires! Can’t we control transaction boundaries ourselves? I want a the context be created when they click “Add to Cart,” continue queuing up more changes, and finally I want a transaction to be committed when they click “Confirm.” We need to look at
@ConversationScoped persistence contexts.
But first, in your head, separate the idea of a persistence context and a transaction, since they are orthogonal. They work together, but the transaction is when the persistence context performs operations (sometimes automatically, like flushing); the persistence context is just a monitor and cache.
Also, think of an extended persistence context like a @Dependent object (except it is uses a proxy). It is bound to the lifetime of the EJB into which it is injected. A transaction-scoped (default) persistence context, in contrast, lives and dies by the transaction. So you get a new one each time a business method is invoked (basically, every time you use the EJB – stateless in a sense).
Use case: the @ConversationScoped PersistenceContext
Conversation scope provides exactly what we’re looking for, and the way this works might be bit scary at first, “you’ll think, how can the system possibly do all of this for me?” To which I’ll answer, the magic of using a
@ConversationScoped extended
PersistenceContext, is that your users’ data, and your users’ saved state as they navigate between pages are living in the same place, and for the same length of time. A match made in heaven!
@Stateful @ConversationScoped public class Service { @PersistenceContext(type = PersistenceContextType.EXTENDED) private EntityManager em; }
The first thing to know about
@ConversationScoped beans is that by default, conversation scope beings when the request begins, and ends when the request ends and the conversation is not in a long-running state. The call to
converstation.begin() only states intent for the scope to perpetuate. This means that a
PersistenceContext injected into a conversation scoped bean will live by default for one request, but of the conversation is started, it will live until the end of the request when the conversation ends. (The reason it is kept alive until the end of the request is because usually the end of the request is when rendering is completed, and destroying information prematurely could result in errors during that render.)
The
@ConversationScoped persistence context will be created with
conversation.begin(), and will be destroyed at the end of the request on which
conversation.end() is called. There may be multiple transactions (bound to the EJB business methods) that occur within the lifespan of this context.
Use case: the @RequestScoped and custom scoped PersistenceContext
It stands to be mentioned that an extended persistence context can be injected into a bean of any scope, and the same rules will apply. If
@RequestScoped, for example, the context is created when the request begins, and is destroyed when the request ends; if custom scoped, the same is true: There may be multiple transactions (bound to the EJB business methods) that occur within the lifespan of any context, and when using an extended persistence context.
Going beyond EJB/JTA with Seam Persistence Module:
Seam 3 provides a Persistence module which provides a programming API for short-lived persistence contexts (not extended contexts,) much like what you would find in Spring. You can use declarative
@Transactional(BEGIN) and
@Transactional(END) methods, and the like, in addition to tying in extra security features, and the power of CDI extensions, interceptors and more. Check back on this blog or on Seam Framework.ORG for more updates on this module.
EJB – Why are my thrown Exceptions wrapped in an EJBException?
Systems using an ORM like hibernate will frequently utilize a Data Access Object (DAO) layer in which standard exceptions are used to reflect the outcome of common operations. Exceptions such as,
NoSuchObjectException, or
DuplicateObjectException, are common place. If the system relies on catching these exceptions to recover appropriately and continue functioning, developers switching to EJB may be surprised when it comes time to run their application; it quickly becomes apparent that the exceptions being thrown are not the exceptions that are expected – everything is wrapped in
EJBException.
At first, you might think, “This is invasive, and tight coupling!” but you have to think about this from the perspective of a transaction-aware system. EJB handles JTA for you, meaning that if you get an exception, EJB needs to know when to roll back the transaction, and when not to; in order to facilitate this decision, EJB has the concept of an
@ApplicationException.
“Application” exceptions versus “System” exceptions:
- An application exception is one that has meaning to the client/consumer of the services, and may affect error recovery, flow of logic, navigation, or any other use within the app.
- A system exception is one that represents a failure in the underlying services that cannot be recovered from, and should never be handled by the client/consumer (aside from very basic error handling like printing “500 – Something horrible just happened.”)
By default, every unchecked/
RuntimeException thrown from an EJB service will be treated as a “System” exception, meaning that the transaction should be rolled back, and a complete failure has occurred; you cannot recover, and you should never catch an
EJBException in order to make a decision, other than very basic error recovery – sending a user to a generic error page, for example, or restarting a web-flow / wizard.
So what about the exceptions that we do want to recover from, exceptions that we know should not affect the state of the current transaction? Well, in order for EJB to respect your wishes, you must tell it which exceptions have meaning in your application; therefore, the exception classes must either be annotated with
@ApplicationException, or if you cannot chance the Exception source itself, you must list your exceptions in
/WEB-INF/ejb-jar.xml (example below.)
Don’t worry, this doesn’t take too long if you have a good exception hierarchy; only the top-level exception must be configured because exception subclasses automatically inherit the configuration from their parent exception types.
<?xml version="1.0" encoding="UTF-8"?> <ejb-jar <assembly-descriptor> <application-exception> <exception-class>javax.persistence.PersistenceException</exception-class> <rollback>true</rollback> </application-exception> <application-exception> <exception-class>com.example.exceptions.DataException</exception-class> <rollback>true</rollback> </application-exception> </assembly-descriptor> </ejb-jar>
Now your exceptions will be treated as transaction boundaries, or ignored depending on how you need your system configured. This prevents things like partial-commits, and combined with the conversation-scope (next section,) also prevents things like partial-commits from wizard interfaces.
Conclusion.
Seam 3 in particular strives to give extensive user-documentation, hopefully making things much simpler to adopt, and easier to extend.
The main purpose of this article was not to bash Spring, although I may have taken that tone on occasion just for contrast and a little bit of fun. Both Spring and Java EE are strongly engineered and have strong foundations in practical use, but if you want a clean programming experience right out of the box – use Java EE 6 on JBoss Application Server 6 – JBoss Tools – and Eclipse. I will say, though, that the feeling I’ve gotten from the Spring forums vs the Java EE forums, is that there are far many more people willing to help you work through Java EE issues, and more available developers of the frameworks themselves to actually help you than there are on the Spring side. The community for Java EE is much larger, and much more supportive (from my personal experience.)
In the end, I did get my application migrated successfully, and despite these issues (from which I learned a great deal,) I am still happy with Java EE, and would not go back to Spring! But I do look forward to further enhancements from the JBoss Seam project, which continue to make developing for Java EE simpler and more fun.
Don’t believe me? Try it out. Find something wrong? Tell me. Want more? Let me know what you want to hear.
Shameless plugs for some other projects that I think you’ll find useful:
OCPsoft PrettyFaces and Rewrite – our own open-source tools for controlling the URL of your application, making pretty, bookmarkable URLs. The easiest (if I don’t mind saying, and I don’t) way of controlling URL parameters, query-parameters, and validating input that comes into your application through the URL. JBoss Arquillian – the single most inclusive and best Unit/Integration testing experience you will find in any application framework. Not only that, but it actually runs your code IN the container, so it’s being tested like it’ll actually be run in production.
Posted in Hibernate, Java, JSF2, OpenSource, Seam, Spring, Technology
The line between Java EE 6 and extensions like Seam 3 is a bit blurry but that’s a nice article. Thanks for taking the time to write this.
Also, web.xml and faces-config.xml are optional in Java EE 6. persistence.xml and beans.xml are the only required descriptors.
Thanks for reading 🙂 I corrected the descriptors.
Nice article! A small correction: the table listing all the built-in scopes talks about @DependentScoped, but the correct annotation name is @Dependent, as used later in the article.
Fixed, thank you 🙂
Great post. I think EJB, finally, have done things right.
Great post
Correction: JTA transactions are not bound by any Scoped anotations. A JTA transaction begins with the first EJB method annotated with Required attribute (default) or with RequiresNew. The transaction is commited automatically when returning from this method.
So no matter the scope of the bean (@RequestScoped or @SessionScoped) transactions will always be commited (and persistent context flushed) at the end of request. This is as it was in EJB 2.0, and stays the same in EJB 3.1. CDI does not change JTA semantics. Otherwise please include some references to pages in specifications.
Thanks for the clarification! I was in the process of correcting myself as you posted this 🙂
What concerns PersistenceContext’s (extended) scope, you are absolutely correct. And @ConversationScoped extended PersistenceContexts are very handy in applications – you get JPA entity cache designated for a single conversation. No LazyInitializationException’s, yet memory consumption on the server (for JPA entity cache) is small – at the end of conversation entity cache is deleted.
The problem (or maybe “thanks god” 🙂 ) is that JTA container managed transactions are always request scoped. Actually you got me thinking whether I would like to have 30 minutes (session timeout) long transaction… Probably not 🙂 Not even conversation long transaction. Transactions should be as short as possible to consume as little DBMS resources as possible.
Good luck!
Hmm… well actually the transactions only last for the duration of the @Stateful/@Stateless EJB business method, so unless you are controlling transactions manually, they shouldn’t be around that long 🙂
Transactions normally start and end during the same request.
For an extended persistence context there is a nice trick, well known by Seam developers: you change the flush mode of the Hibernate session, disabling the auto-flushing feature at the beginning of the conversation, and manually forcing the flash at the end of the conversation.
So, transactions don’t waste DBMS resources and the user-operations are still atomic with nice isolation properties, like they were in a long transaction.
Are you in trouble if you suggest using Java EE out of the box instead of Hibernate? You’re working for RedHat you know 😉
Good article I already forward this as today’s mandatory reading for my team!
Instead of using a conversation scoped persistence context to hold our conversation data (which seems hackish), I’m guessing it’s more natural to just use a conversation scoped object (without a persistence context) to keep our conversation data (e.g. a shopping cart class), and only in the end, when the conversation data needs to be persisted (e.g. user tries to buy the items in the shopping cart), we can use a the default and simple RequestScoped persistence context to take the required data (e.g. list of items in the cart) from the conversation scoped object (e.g. the shoppingCart) and try to validate/persist it.
What do you think bout this approach? Do you see any disadvantages?
And thanks for the great article.
@Pooria: your approach is likely to face the well known LazyInitializationException, and King Gavin (Hibernate and Seam creator) thought up to the conversation scope to avoid this exception.
Think to your flow: conversation begin and you load the user object from database. In the next page you access the user address list…and BANG! LazyInitializationException.
select a EntityA a join FETCH a.bList b
another LazyException solution 😉
Thanks for an interesting article!
We are currently running ejb 3.0 and spring side by side via the jboss-spring deployer.
One nice feature about spring is the @configurable annotation which basically spring configures any pojo without having to worry about configuring it inside the spring container (using aspects)
Does ejb 3.1 offer anything similar? (I see the BeanManager exists, but this does provide a good substitution). Furthermore, can @Asynchronous be used with any old pojo (like spring’s @async method) or does it only work for EJB components?
Thanks
correction : Does ejb 3.1 offer anything similar? (I see the BeanManager exists, but this does NOT provide a good substitution). Furthermore, can @Asynchronous be used with any old pojo (like spring’s @async method) or does it only work for EJB components?
@Asynchronous is specifically for EJBs, but don’t forget that every simple POJO can be made into an EJB by just adding the @Stateless annotation to it.
So in a way, yes, in some way POJOs can use @Asynchronous 😉
So what jars do i need to include in my Maven POM so i can deploy the JEE 6 persistence on Tomcat or some other non JEE 6 container? Or do i need to constantly upgrade my entire server farm to the latest greatest application server software (most likely for a massive fee) just for the pleasure of doing what i can do with a few simple jars with Spring?
Since when does open-source cost a massive fee? You’re going to pay the same price if you pay VMWare for support on the Spring stack, as if you pay a company for support on Java EE. No difference there, sorry 😉
Indeed, a still don’t get why Spring fans keep using this argument of Java EE supposedly being so massively expensive.
Last time I looked Glassfish, Geronimo, JBoss AS etc could all be downloaded without paying anyone a penny. In case of Glassfish the download size is even smaller than if you downloaded everything you needed to build a complete application server with Spring.
Java EE has many totally free (gratis) and fully open source implementations, which are also used a lot.
And it’s worth mentioning that Spring actually takes individual pieces of Java EE and re-assembles them, so you’re still using Java EE. Java EE is still the core, and Spring is still the extension, it’s important not to forget that.
I quote from a friend who sent me an email in response instead of commenting:
“One phrase: web profile (or JBoss’s slightly perfected web profile)
I would simply point over to (or quote) Adam Bien. He’s whole “what does lightweight really mean” entries are great.
Also Gavin’s “You should update to Java EE 6”
And Cay
I absolutely agree that bloated runtimes and runtimes which are slow to load suck. But I don’t want to have to bring the whole internet with me just to deploy (because that slows down the deployment process). It’s about striking a happy balance, and that’s the web profile :)”
Well, here’s the problem…I still fail to see a single advantage EE6 has over Spring. It’s just different annotations/config files that look very similar to the Spring ones, so what’s the benefit for an existing app? None.
And here is the big one: with Spring we run our app in Jetty and can use the excellent Maven/Jetty integration for unit testing.
With EE6 I need one of those big, clumsy app containers like Glassfish, JBoss or Weblogic.
No thanks: I’d rather stay agile and lightweight with Jetty. Only Spring allows us that.
Big, clumbsy… embedded? I never said Java EE had advantages over Spring; I simply said it did things differently, and did some things for you 🙂 When you get right down to it, the level of work is just about the same.
With regards to easy testing:
Heh, times are changing. Yeah it’s a little bit of up-front work, but as it says in the article, “the benefits are clear.”
>I still fail to see a single advantage EE6 has over Spring. It’s just different annotations/config files that look very similar to the Spring ones, so what’s the benefit for an existing app?
Well for me this is the other way around. I fail to see a single advantage Spring has over Java EE 6. The other way around the same thing really holds; Spring is very similar to Java EE, just with a different API. All our existing apps are Java EE based (5 and now 6) and we’re very happy with it.
Why should I migrate those to Spring?
Very nice and very useful article! I’ll bookmark this for sure for later reference.
One small addition about the data source config. You say the following about this:
>must be placed in the actual JBoss server deploy directory
But this is not completely true. You can also include the config file in your application code by creating a jboss-app.xml in META-INF and referencing the file there. This is handy for people who like their application archives to be as self-contained as possible.
Of course, for some organizations or team structures it’s better to have the data sources (and actually other config files like JMS queues) defined in the JBoss AS installation itself on each server where the app is deployed to, but just wanted to mention that there is a choice 😉
Thank you! That’s very good to know! I’ll update the article when I get a chance 🙂
This article is pure yet subtle propaganda. You do not state it clearly but with all that ‘ee6 does it for you’ things the message is that spring is complicate and ee6 is better. You work for rh yet still act ad a spring dev lookin’ for the first time at ee6! come on be more honest! and please : cut that part about getting beans programmatically, it’s better to say that ee6 doesn’t like it without scaring people that much on such basic tasks.
Didn’t like your way of propaganding ee6 but I like ee6 and appreciated some of your thoughts.
You’re right. I’m out to secretly undermine Spring by sharing my own personal experiences and lessons learned from doing a migration to Java EE 6 🙂 Just kidding. Also, I’m confused: wasn’t the part about getting beans programmatically admitting that Spring did something better? Why do you want me to change that? I updated the post to be more clear that I do in fact work for JBoss.
PS. Sorry for coming across sarcastically. I’m hungry, and you are right. I’ll try to do better in the future.
🙂
Hey! No problem at all. I was a little aggressive too. Didn’t meant to, but I was.
Don’t want to start a flame at all. So sorry for me beeing too severe.
In the end EE6 and Spring are two different approaches. Sometimes I like the magics of EE6. Everything works right out of the box. No need to write the same things all over again.
Sometimes there’s too much magic and I want a lighter system.
But EE6 is really good and your article definitively worth reading (and posting …).
three links that do not really say anything about the real issue. I can simply build a full enterprise application using Spring and deploy to any container, whether that is Weblogic 8, 9, 10, 11, Tomcat 5, 6, etc… I don’t even have to think about some vendor driven spec to know my application will work. JEE would be great if it followed the Spring model and was simple a series of jars to include in your war. Simply include the jar via Maven and done. The xml config points are interesting considering all the xml configuration you highlight in your article. Until you can simply include a couple of jars in a war file to do what 80% of java developers need like Spring can, you all will be begging for people to switch to the bloated jee platform.
If you like the Spring stack better than the Java EE stack, that’s awesome. Not gonna try to stop you 🙂 Use what works for your business, that’s always the bottom line.
Spring just has a different default model: include everything in the war and end up with fat jars vs deploying very slim wars and assuming your deployment platform already has the required functionality.
It’s just a different thing. Hard to say which is really better.
In desktop applications, do you statically link in all libraries and whatever, or do you assume the OS has some base level of functionality? In practice, both happens really.
Also, including everything in the .war is arbitrary too. Since you still have to rely on a base level of Servlet and JSP that is already installed. If you want to include JPA, JTA, EJB, JSF, JMS, etc in your .war, why not include Servlet and JSP in it too?
In that way, the only thing you assume to be installed on the server is a JVM. You don’t deploy a .war, you deploy e.g. Tomcat with your application already in the webapps directory. Technically there is very little difference as Tomcat itself is a Java application too.
The same can be done with JBoss AS. I can assume a certain version of JBoss AS is already installed on the server and thus deploy very rich EAR apps that are extremely small (couple of 100k max), OR I can assume only a JVM is installed and deploy JBoss AS together with my app.
Luckily we all have a choice as Lincoln says. If Spring works for you, by all means keep using it 😉
(although don’t forget that there are Spring Application Servers too, where basically an AS is build on top of Spring and all required libs are added to the Tomcat common libs dirs, so the picture is not that black/white)
Great article, First article that I have seen that actually brings CDI and EJB3 together and in a coherent fashion.
But I dont think I am going to migrate anything to JEE6 in a hurry. All the JEE has done so far is to catch up with Spring and not do anything better than them. Ok, you solved the lazy init exception, so what. EJB3’s Interceptors are still way behind what I can do with first class AOP support that I get with Spring. All JEE seems to be aiming for is simple web/EJB projects, but almost all enterprise work that I do need additional features that frameworks like Spring Integration, Spring -Batch provide out of the box.Sure, there are other open source projects out there, but Spring does all these seamlessly and adding them is very little add on work unlike EJB3 where everything is PIA.
I would have really jumped on the EJB3 bandwagon if only there were things that were compelling enough, but if all the work has been done so far is to catch up with Spring, I’d rather use Spring which atleast has had the time to mature.
This article wasn’t meant to be an attempt to convince anyone to switch, just an explanation of what’s going to happen if you do.
@Lincoln,
I really like how detailed you article is: that’s awesome! Thank you!
Thing that appeared to me rather unnecessary negative are:
“seemingly unresponsive Spring forums”
We both know this is not true, or if it is, can you back it up by showing me at least 5 questions that you asked on Spring forum that were not answered?
“download your application server of choice, which at this point will probably be one of either: JBoss AS 6, or GlassFish v3”
why would I need these guys if I have plain Tomcat ( and yes, I know how to use it )?
I think the overall direction is to hide the complexity and focus on the real task ( some people call it “business”, I call it a “task” ). Having that in mind, if I would really switch from vanilla Spring / Hibernate stack today, that would definitely be Grails: can’t go simpler than that.
I am sure you know that Spring also has a complete annotation driven configuration, I personally _like_ my XML, but it is there. Plus if I need flexibility I would go with Grails bean builder.
Finally, I know that you are a big JSF supporter, we actually met at Philly ETE conference, and I attended all your and Dan Allen’s talks, just to make sure I “get” the message. And even thought Spring Webflow is practically sits on top of JSF, I really think they could have done better 🙂
Again, thank you for a detailed article, I love those, and even though I belong to “The World” good luck in “Pure JEE vs. The World” mission.
/Anatoly
@Anatoly
Actually, you’re right. I went back and double checked my posts on Spring’s forums and I saw that I participated and was answered serveral times. I was distinctly thinking of a real experience I had on some forums though, and I’m embarrassed to say that it was probably the Hibernate forums before they moved to JBoss.org… All I remember is asking questions about Spring open-session-in-view filters, and getting crickets. I was asking in the wrong place 🙂
You’re also right. The article did not need any inflammatory statements in the first place, and I’ve removed it.
–Lincoln
If there is any unresponsive forum in the world it’s indeed the Hibernate forum. Getting any question answered by anyone knowledgeable, let alone the actual developers, is near to impossible.
@Anatoly
>why would I need these guys if I have plain Tomcat ( and yes, I know how to use it )?
Well, because the article is about Java EE and those are examples of popular Java EE implementations?
Your reply is like replying to an article about iOS where the author mentions you probably would get either an iPhone or iPod in order to use iOS, that you already have a Nokia and yes, you know how to use it.
Doesn’t make a lot of sense, does it mate? 😛
But I have not edited this article, I added a comment.
I will let you think about my comment as “Tomcat”, and this article as “JEE”. [ it’ll “click” after you read it over a couple of times ]
Going back to “Nokia” point: “why do I need iPhone, if my Android already does it, and does it better” 🙂
/Anatoly
A few years ago I’d have to pay someone for this ionfrmiaton.
Thanks Lincoln … for a detailed and well written blog. A lot of things about JEE6 were answered by this post.
I liked your article, thanks! Two questions:
(1) Does Java 6EE CDI also support annotated components like in Spring through @Component, @Service, @Repository and @Controller?
(2) How would you compare Java 6EE CDI and Guice?
@Erik
1. I’m not sure what you’re asking here. CDI has tons of annotations (Including @Model, @Service, and I believe @Repository), CDI also lets you create your own Stereotype annotations to extend functionality, and has *tons* of extension points.
2. CDI is a much richer (but also more heavyweight) DI container. It features the same type-safe approach, but has an extreme level of extendability. If you don’t need that, Guice is still a good option, but CDI is gaining major ground already, so it really depends on what you want to be using in 5 or 10 years, and what extensions you want to use with it.
Let me run annotated transaction in tomcat and then i will make a switch from Spring to EJB.
vinay, that’s a bit like saying you switch to apple mail as soon as you can run iOS on Android.
It doesn’t really work like that. Java EE is a full platform, you don’t run Java EE on Tomcat. (although many Java EE implementations use Tomcat for the Servlet part).
You can run bits and pieces of Java EE on top of Tomcat, but you don’t get the full conveniance then and you are basically repeating the work that eg Apache Geronimo has already done for you.
Paul
I remember seeing in one of articles that you could run lightweight EJB’s on tomcat. They would not be fully functional. Do not remember much but will post a link as soon as I find one.
But my point is that for a lightweight application, Spring + hiberante is providing with all the feature sets which EJB + JPA is providing
JPA has been derived from Hiberante so basically you are only getting EJB’s and that you are using Stateless Session bean most of time. I had worked with EJB for a long time but now with Spring , I do not find enough motivation.
In most of cases, Spring’s transaction capabilities are better than EJB’s. Here is a comparison of both
I think the point is that you don’t HAVE to assemble your own stack. JBoss AS basically already is Tomcat + Hibernate + EJB + JTA.
Why painfully build your own stack with possible incompatibilities?
Hopefully JBoss AS will also specifically add a “web profile” configuration (they have “all”, “default”, “standard”, “minimal”, “osgi” and “jboss web standalone” now. Those are just pre-assembled configurations. You can delete the other ones or make your own.)
Thanks for the article. It made me want to investigate EE6 a little bit more.
However I am still turned off by some of the decision that seemed to linger from the old EJB days: checked exception for example…
Lastly I believe you made a mistake writing that in spring you will get an exception if you inject a session scoped bean in an application scoped bean. Spring wraps its scoped objects with proxies that are injected immediately. So on creation the application scoped bean will only get injected with its own proxy that points to the session bean. However if you try to access that session scoped bean outside of a session context you will get the exception you are talking about. From what you described this is exactly the same behavior as EE6.
[…] Spring to Java EE – A Migration Experience is very interesting article. I haven’t looked into EE recently but from what I read coding EJBs is very simple compared old days. Categories: Java Extreme MakeOver 6 October 2010 at 14:20 – Comments […]
i believe that JEE 6 has caught up to Spring. it is light, fast, easy and standardized. but Spring ppl are very smart and are business oriented. while most ppl are debating Spring vs JEE (don’t forget python, php5, ruby on rails ..etc), Spring is fast moving ahead. Their applications are ready for the Cloud with all the tools u need. They make ideas like SaaS, PaaS accessible to ordinary developers and within their reach. see
their support services are unmatched and the their sub-projects are stamped ‘Enterprise ready’.
I use JEE in my applications. but I keep an eye on Springsource. to say the least, they are always one step ahead and their vision into enterprise apps is just impressive.
[…] 2) […]
Java EE 6 vs Spring boils down to one decision:
Do you want to be dependent upon the application server version again? Using Java EE you will be bound to the versions bundled with that application server. How many of you havn’t struggled with WebLogic shipping/supporting e.g. old WS-* versions?! With Spring you may use all the new features without upgrading your application server, and thereby each project may upgrade at it’s own pace. When depending upon Java EE you are forced to upgrade the application server and thereby coordinate the change with all other applications/projects running on the same application server instance/cluster.
With Java EE you are send back to the days where you had to wait for all the applications to be ready (and wait for new test and production environments).
With Spring you may upgrade your project as you need new features provided by Spring/Hibernate without being dependent upon others.
I don’t buy into your argument that upgrading Java EE is somehow more difficult.
From an application architecture point of view, migrating your application code to a major new version of Spring is just as risky as migrating to a major new version of Java EE. There is no difference here.
If you’re using the Spring deployment model of more or less completely shipping an AS in your .war to blindside operations (“no, i’m not upgrading any libs, I really wrote that 100mb of code myself”) than that’s a very debatable practice.
Most importantly, the argument of upgrading individual apps at their own pace because they all run on the same AS is silly. In practice you don’t do that! Every app runs on it’s own AS and that one typically runs on it’s own virtual server.
Spring fans of all people should know this is the preferred deployment strategy now that VMWare own SpringSource.
Totally Seam and JBoss biassed, totally antispring oriented.
Spring was the revolution, it will be, just Guize compares to it’s simplicity and intelligence.
Period !
The purpose of this article was not to be balanced and fair. This was a discussion about the issues encountered when moving *away* from Spring, and moving *to* Java EE / CDI.
Thank you for reading.
I’m curious about injecting a @SessionScoped bean into an @ApplicationScoped bean. I couldn’t quickly find where this is addressed in the JSR-299 spec.
The only ways I could see this working are synchronizing access to the @ApplicationScoped bean, using ThreadLocal storage for the @SessionScoped bean, or having multiple instances of the @ApplicationScoped bean (which you wouldn’t expect if there weren’t any injected @SessionScoped beans). Is there another option that I’m missing?
I’d be more comfortable understanding what the consequences are (in terms of performance, memory use, etc.) of having such a straightforward way of representing something that seems like it could have a lot of complexity (as evidenced by how you describe Spring’s handling of it).
Well that’s the clever thing, and like I said this is the same in Spring if you use
, but Weld/CDI use a Java Proxy to wrap the
@SessionScopedbean reference that is
@Injected into the
@ApplicationScopedbean. This means that whenever the
@ApplicationScopedbean attempts to access the
@SessionScopedbean, it actually accesses the proxy, which accesses the current user’s Session (the BeanManager takes care of all of this,) and gets a reference to that current user’s
@SessionScopedbean.
The
@ApplicationScopedbean is not inherently threadsafe since there is only one instance of it in the entire app, but its accesses to the session scoped bean *are* local to each individual user. Unless you do bad things, you won’t have bleed-over. Obviously
@SessionScopedbeans are not inherently threadsafe either, but
@RequestScopedbeans are, because they only live within the scope of a single request, or one single thread.
Ahh, of course. I had thought of maybe putting a proxy around the @ApplicationScoped bean, but that wouldn’t work for direct field access to the @SessionScoped bean. I didn’t think of putting the proxy around the @SessionScoped bean. Thanks!
Delegating via the proxy to the current user’s session is a very clever trick.
It’s a little like what TLS does in the standard JDK. You seem to be accessing a static variable, but under the hood it delegates to an instance in the current executing thread.
Wouldn’t it make more sense that the injection point for the @SessionScoped bean be “@Inject private Instance credentials” instead? That way you can obtain the correct instance of credentials whenever you need to do something with the object and not have to worry about the session.
Oops. That should be:
If it ain’t broken, don’t fix it.
Spring works. Maybe JEE does too. Who cares?
Do what you feel is good.
Deploying a light war with a heavy server or a fat war with a light server is a matter of necessity for each situation. It depends.
I concur with some earlier opinions: All JEE has done is catching up. It’s like Spring is the standard and JEE is the extension. It certainly feels that way.
The only thing truly compelling I have heard (although I haven’t heard that much) is the Conversation scope. We implemented a custom conversation scope for our Spring, JSF, Hibernate application, and it wasn’t that hard (merely 4 classes with some handling of the Hibernate Session and Spring Transaction) but I would like to have that done for me.
But Tomcat is easy, light, fast, and very well supported. Spring was a huge change back in the day. They are beautifully documented and developed. Transactions are good, AOP is good, and specially, their attitude is AWESOME.
Spring doesn’t tie you to anything. You can integrate with what you need, run as complex or simple applications as you wish, use the server you see fit. And they do that with a smile… so much different that Gavin “I’m so much more smarter than you so don’t bother me” King attitude.
In the end, and with two close specs, it’s that what keeps me in the Spring side. That, and more than 6 years doing what JEE is now coming to do: Keeping Java as an enterprise option.
> If it ain’t broken, don’t fix it.
Spring works. Maybe JEE does too.
Java EE does. Believe me 😉
>Who cares? Do what you feel is good.
I think that’s the entire idea. If Spring works for you, by all means keep using it. And of course nobody is forcing anyone to migrate existing apps from Spring to Java EE, that would be really silly.
For new projects and new teams however I think Java EE is a very compelling choice. People already familiar with Spring and starting with a complete new project should really consider Java EE. I think this article will be very helpful for those people.
>And they do that with a smile… so much different that Gavin “I’m so much more smarter than you so don’t bother me” King attitude.
I hear you, and maybe Gavin is a little like that, but he does know his stuff. There’s a difference with thinking you know better while in reality you do not really (an all too common phenomenon under developers).
Personally what drove me away from Spring is Rod’s attitude of “EJB is evil! Containers are bad! J2EE is heavyweight”, long after Java EE 5/EJB3 was released. Your experience may differ, but in my opinion if you wanted to be part of the Spring culture, then having to hate EJB and J2EE was just part of it.
There are two things very wrong with that. First of all, it’s a little strange that in order to use technology A you actually have to be indoctrinated to hate technology B, and secondly, most of the things said by Rod actually applied to EJB2 and J2EE 1.4. I’m not sure why rants against EJB2 are still relevant in 2010.
>It’s like Spring is the standard and JEE is the extension.
[…]
>In the end, and with two close specs, it’s that what keeps me in the Spring side.
That’s just the point: Spring is not a standard, and there is only one implementation. It’s sometimes easier (but not necessarily better) to work alone than to have to decide with other people.
Spring had once more features than Java EE. That’s gone.
Great article. The only thing I’m worried about is developing application on java application server like Jboss AS that is painfully slow. When project is large you have to wait up to 3 min for Jboss AS to start (or publish application). Tomcat rules!
Nice article. I think both JEE 6 and Spring has their strength at different areas. I just don’t see Spring is over.
JEE is getting stronger at the business-logic tier and the persistency tier, however, it still doesn’t have a real competitor to Spring at the presentation tier. The “page controller” pattern behind JSF still prevents any implementation of the specification from significantly reducing memory consumption and improving performance. Another great feature in Spring is its openness. The framework can be (in fact have been) integrated with other popular frameworks without huge efforts.
JEE’s biggest advantage is its vendor support. In addition to JEE server licenses, no one would want to pay extra to support a framework running on the server.
In my opinions, JEE or Spring? It depends…
For addressing the page-controller JSF issue, you can use my own tool/well-adopted open-source project: [[PrettyFaces]] –
You set up URL-mappings that point to one or more pages; actions can be invoked when those pages are requested, thus effectively creating a front-controller instead of a page-controller pattern.
> installed Hibernate on GlassFish (which is very easy to do, and I recommend since TopLink has given me a lot of problems;
Nice article, but why recommanding an implementation over another one because you had problem using it? I don’t think it’s fair.
What do you mean by Toplink? If you mean Toplink Essentials, this one has been obsoleted by Eclipselink. If you mean Toplink JPA, this is a commercial product based on Eclipselink. Eclipselink is an implementation of JPA 1 and JPA 2 (RI).
If you have a jpa compliant application, Eclipselink just works. Please be precise if you think it doesn’t: it’s the RI for JPA 2, so I’d really doubt it and it’s really worth filing a bug.
I’ve got a lot of production apps using Eclipselink.
One more detail: you don’t have to install Eclipselink in Glassfish, you can bundle it in your application if you want. That means you can have different versions for different projects, and you don’t have to install anything on glassfish to deploy your application.
That’s a fair enough point. I suppose I should have said, “Coming from Hibernate, there are enough differences between it and EclipseLink that I had a lot of trouble getting my existing app to run on it.”
Why? JPA is a standard and switching should be easy. If you say it’s not, it would be interesting to know why.
Eclipselink is stable and has been there longer than Hibernate. In your article, it sounds as if Hibernate is better, more stable and Eclipselink is problematic. This simply isn’t the case, and I bet you can change your JPA provider easily.
Like I said, I personally had problems using Eclipselink instead of Hibernate 🙂 It’s been a while since I went through it, so I can’t pinpoint them specifically right now 🙁
[…] week a JBoss core developer, Lincoln Baxter, published a detailed and insightful report on his migration experience from the Spring Framework to the new Java EE 6 platform. In the post […]
[…] I still need those proprietary frameworks? Last week a JBoss core developer, Lincoln Baxter, published a detailed and insightful report on his migration experience from the Spring Framework to the new Java EE 6 platform. In the post […]
Nice article.
Unfortunately we’ve been mandated to use Websphere – which means we’ll get support for this around 2019.
@Gene: maybe you are wrong:
[…] boost his argument in his blog post, Badani pointed to a write-up from fellow Red Hat employee, and JBoss core developer, Lincoln Baxter, which discussed the […]
[…] [Technik] Spring to Java EE – A Migration Experience […]
Regarding your example of a EJB as generic DAO.
has 2 compilation errors.
Shouldn’t it just be (not tested it myself):
[…] which, for reasons best explained in a separate article, is not easy unless you use some “Solder.” However, this approach is recommended only […]
Guys, who designed EE6 should just do the same things that were done in Spring but better. Instead they chose their own way, and this way is seemingly more complicated than Spring way. In turn, benefits are very doubtful.
The case might be closed here. New EJB technology is not going to fly. It does not worth time to spend. Spring works just great. Why somebody time and money to do the same things that are already done.
Everybody who remember EJB 1.0-2.1, know how much pain it was to deal with server specific deployment descriptors and other meta data. Why do we need it again ?
[…] The days of Spring and popular Web Frameworks are over, is clear from this article on Java EE 6. Migrating from Spring to Java EE 6 is thoroughly described here. […]
CDI might replace Spring DI, but the power of Spring lies in the support for Aspect oriented programming (AOP).
Though we can workaround this in JEE, with EJB interceptors, we are forced to move to EJB and the flexibility of applying aspects on Java bean level is not present.
Even if projects wants to move from spring to JEE. Non support of AOP is going to be the blocking factor.
That’s an interesting perspective, actually. I think that CDI interceptors provide a great deal of functionality as well, but the idea that you can extend the public interface of a class is something that is yet to come in to EE as a major practice.
I think we’ll see some serious power with interface-driven implementations, however (where you define an interface that is automatically bound to an implementation to meet your needs.)
That’s one place where CDI will shine well 🙂
I’m in the way to migrate mi old Spring + Vaadin application to JEE6, right now i’m having an issue with Spring-Security, how can i use Spring-Security with JEE6 ???
There is no way to @Inject the AuthenticationManager. :S Some help will be appreciated.
I suggest taking a look at Seam Security or PicketLink (unfortunately the documentation link seems to be broken at the moment – trying to get that fixed.)
[…] forte, molto forte, ma l’arrivo di Java EE 6 sembra aver incrinato le certezze di più d’uno, ma non di […]
[…] be discovered and included in the larger application. (For more details on these descriptors, see this post.)To run your application with the least amount of effort, you should use a full Java EE Application […]
That is why the Head First book series is so popular and effective. Those books make you think/experience the problem first and then help you finding a solution.
Nice article, very nice indeed. But as you show it is possible to use an EJB as a, let say view component, so tha page can acess it as a Managed Bean. This aproch is not so heavy?
EJB3.1 is pretty lightweight these days 🙂 Just a few annotations.
Spring to Java EE – A Migration Experience | OCPSoft…
Thank you for submitting this cool story – Trackback from Java Pins…
My experience of several months with Seam 2 is that there are some inherent speed bumps introduced by JSF and bijection. For UI controls with many elements (tables, dropdown boxes), the bottleneck is not at all the database (even without 2nd level caching), but the time spent by Seam during the RenderResponse phase. The heavy use of bijection and events (see, for instance, org.jboss.seam.core.MethodContextInterceptor.aroundInvoke() which sets 5 context variables, each creating 2 events) has a visible impact on the page rendering time and we found it is hard to reduce it. There are only a few tools: bypassing interceptors, use and rethink the UI interaction to have lazy loading of data in UI controls or have autosuggestions instead of populating lists. It is somewhat frustrating to constantly have this conflict between using the framework for its features and avoiding the framework for its slowness. I don’t know if I can ever make the app really snappy (say, have responses back in less than 100ms).
Any comment on Seam 3 performance (JavaEE 6 CDI + JSF) compare to Spring framework?
Great article.
I’ve been researching how to migrate our apps which are based on spring as jee container.
We are using OSIV (filter) to avoid the LazyInitializationException.
The author suggests using ConversationScoped stateful beans/services with extended PersistenceContext.
(Our services are internally stateless though).
Which looks promising for use with a servlet framework.
But what if we want to use the same services in other cases – like EJB timers/schedule. (We use quartz scheduler now)
How to deal with the (unwanted) extended scope here.
Should we then programmatically begin and end conversations – or manually flush entitymanager. Could it be done declaratively?
[…] are a couple of very useful articles. This one is very detailed and is published by JBoss employee: and this is the presentation from IBM:. […]
Before commenting, we should try out whats there…rather than basing our opinions on years old…Jboss 7 boots in 45 seconds…
According to comments of CDI does not allow a conversation scoped EntityManager because the EntityManager interface is not Serializable. Is Weld more tolerant in this respect?
Actually I think that this does work in Weld. I’ve used ConversationScoped EntityManager instances many times on JBoss AS 7; I’ve never had a problem with this. That’s the whole idea of the Extended PersistenceContext, so if it’s broken on WebSphere, that’s really bad.
EJB3.1 the best at this time, from 2008 we used only EJB3 on several successfull projects, EJB3.1+JSF2.1 have not alternatives.
Some people ask me why EJB3.1/JSF2.1 have not alternatives, why? Because XML is not a java, because with EJB3/JSF2.1 you write only java code, only 1-2 simple xml. In Spring still you must use a lot if xml what in the big projects caused failure layer.
Also structure and logics EJB3.1/JSF defined in the right way. Spring still does not know what is java 6 CDI, POJO and more:(((((((
I’m a “little bit” late and I’m not a Spring specialist, but I leave a comment anyhow. With Spring your application is bound to certain platform which is not the case with Java EE. For example, with async EJBs you can implement application server neutral threading, but with Spring’s @Async you cannot; you have to change TaskExecutor according to platform. For WebSphere and WLS it must org.springframework.scheduling.commonj.WorkManagerTaskExecutor but cannot be on any other platform. I would also say that WorkManagerTaskExecutor doesn’t work correctly and can make your server to hang, but lets not concentrate on that. So, depending on your platform you have to use some kind of deployment tool to change this or unpack the XML files and change them manually. And which application servers have console support or deployer tool to do it? I think the same still applies to TransactionManager; it must be changed for WebSphere.
“Declarative transaction demarcation in Spring 2.5 or later are supported in WebSphere Application Server using the following declaration for the WebSphere transaction support:
”
or how about not changing it?
“Managing transaction demarcation through WebSphere Application Server’s UOWManager class ensures that an appropriate global transaction or LTC context is always available when accessing a resource provider. However, earlier versions of Spring used internal WebSphere interfaces that compromised the ability of the Web and EJB containers to manage resources and are unsupported for application use. This could leave the container in an unknown state, possibly causing data corruption.”
See for more information:
Cheers,
Paci
Great article! Can’t wait to see Spring disappear from every freaking project I had to put my hands on.
PS: Recommending JBoss AS 7.x over GF 3.x ? Not sure about this statement… JBoss = Very buggy
What bugs have you found specifically?
Sorry to hear you had trouble. Was this with the final release or one of the earlier betas, or even AS 6? JBoss AS7 is incredibly stable and clean.
1 month ago i also migrated one of my applications to JEE and i could say it was easy. But the problem here is not "JEE is also easy" thing . I think what makes spring is a little bit better is its flora like spring-data,spring transactions,spring-security. In my project i did not use ejb for example instead i use seam-persistence and seam-security because i didnt want to use a jee server just because i have to persist some small data but still want to use declarative transactions and i dont want to use web.xml based security or JAAS(i think still hard to understand). Because of all those things i look forward to deltaspike project which i believe fills all those gaps.
That’s a really well written and helpful piece of information. However in all the ensuing debate specifically of the difference in preference to use Tomcat vs EE severs, I did not get a mention of the newest kid on the block TomEE which according to apache is " an all-Apache stack aimed at Java EE 6 Web Profile certification where Tomcat is top dog". This seems to be pretty exciting. Will this be game changer for people who actually like Tomcat but want to move to EE technologies ? What do people think here ?
Interesting article. I’ve been experimenting with JEE 6 myself and wrote a pet app for it, but the immaturity of some of its solutions (CDI being a good example) has managed to seriously put me off, and cause me drift back towards Spring.
Also, JEE is supposed to be the (self-proclaimed?) standard, but in reality you end up depending on the application server and taking advantage of its features, as you pointed out in the article, and the portability effectively goes out of the window.
My worst nightmare has been integration testing, which requires an unreasonable amount of effort vs. getting it right with Spring.
"but in reality you end up depending on the application server" Have you really tried to switch among EE servers? if you are in the spec thinks are really straightforward, if you use maven things get even easier. Also how often you migrate from app servers? i’ve seen people arguing that in favor of Spring but they are always using Tomcat…
"My worst nightmare has been integration testing" have you heard about arquillian(arquillian.org)?
Another thing thats is really powerful and is growing in EE6 are the CDI portable extensions
[…] Annotations, or Hibernate Search, I recommend reading a section in another OCPsoft blog about using extended PersistenceContexts. You can also try some books written by my colleagues and peers. (Note, you will need to disable […]
[…] Spring to Java EE – A Migration Experience by Lincoln Baxter […]
A Conversation is supposed to be related to a short, CLEAR, "business type process" that has a beginning a middle and and end. This may span multiple round trip to the User within the bounds of a single session.
It:
+Saves multiple reads from the DB by "caching" stuff in/for the Conversation span
+Saves up commits to the DB and flushes them at the "natural" end of the conversation or have them ALL rolled back by not committing (very neat!). [@ExtendedPersistance]
+Gives a CLEAR area to store things so that nothing is left around in the Session/Application etc. Scope when the "business type process" is completed or abandoned.
Due to the "fad" to completely UsStatelesstise everything (mainly from Spring and JQuery people) this has not had much attention and has largely been forgotten and even JEE 6 (CDI) has only really given it lip service. It’s all about BIG DATA and mashups or 100 things into a facebook/twitter page…
So; it seems that jPBM (and things like Oracle SOA [BPEL]) have stepped into this space and moved things into what Seam 2 called the @BusinessScope which ALSO supported the ability to come back later to an "in progress" "business type process" so you are not locked into the Session…
The lack of a "good" implementation of Conversation has driven myself to jBPM (5) which is now looking very capable and is actually built around a Rules Engine (Drools). I hope it is as good as it looks.
Yeah, I really think the JBPM5 stuff is *really* interesting. The Drools guys and Mark Proctor have been doing awesome work, especially with their UberFire web workspace based on the Errai UI framework.
Really great stuff happening there.
Yes its does look awesome.
Conversation did always have the problem with the "back" button being pressed in page having to be handled.
here is hoping that, like Seam 2, they handle that out of the box too.
Interesting to see how they support the users "Work in Progress" UI bits and how easy it is to lock into "security" as I needed more than roles and permissions.
Very good site. Have very good explanation. In coming few months, i have to migrate our legacy Spring application to java CDI and i was in search of such a good article.
Thanks a lot.
One Question – What is the alternate for Spring batch jobs (i know java batch jobs are also there but it is not supported by most of the servers)
-Sunil
I’m not very familiar with 3rd party batch libraries, but I know that Java EE 7 supports batch functionality that can be used to replace Spring Batch. Both WildFly and JBoss EAP7 support this spec.
|
https://www.ocpsoft.org/java/spring-to-java-ee-a-migration-guide-cdi-jsf-jpa-jta-ejb/?replytocom=1941
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
My previous article, Client and Server-Side Data Filtering, Sorting, and Pagination with Angular NgExTable, describes the base structures and uses of the custom data grid tool. This is the second article of the NgExTable series, which details the multiple column sorting practices and workflow with this Angular UI tool, API data services, and the database stored procedure. Audiences who use the Microsoft Visual Studio and C# can download sources and play the code with all scenarios in the front-end, middle-tier data services, and database back-end. Audiences who download the source code for any platform other than using Microsoft technologies can still look into how the multiple column sorting works with the Angular data grid tool and the logic to generate client-side source data list or server-side mock data result sets.
NgExTable
The sample application demonstrates these unique features regarding the data list sorting:
NOTE: This section may repeat most of the setup steps in the previous article for the NgExTable.
The downloaded sources contain different Visual Studio solution/project types. Please pick up those you would like and do the setup on your local machine. You also need the node.js (recommended version 10.16.x LTS or above) and Angular CLI (recommended version 8.1.2 or above) installed globally on the local machine. Please check the node.js and Angular CLI documents for details.
When you play the sample application with the Visual Studio, please check the available versions of the TypeScript for Visual Studio in the C:\Program Files (x86)\Microsoft SDKs\TypeScript folder. Both ASP.NET 5 and Core types of the sample application set the version of TypeScript for Visual Studio to 3.4 in the TypeScriptToolsVersion node of SM.NgExDialog.Sample.csproj file. If you don't have the version 3.4 installed, download the installation package from the Microsoft site.
TypeScriptToolsVersion
Download and unzip the source code file to your local work space.
Go to physical location of your local work space, double click the npm_install.bat and ng_build.bat files sequentially under the SM.NgExTable.Web\ClientApp folder.
NOTE: The ng build command may need to be executed every time after making any change in the TypeScript/JavaScript code, whereas the execution of npm install is just needed whenever there is any update with the node module packages.
ng build
npm install
Open the solution with Visual Studio 2017 or 2019 (Visual Studio 2015 with Update 3 or above also works) and rebuild the solution with the Visual Studio.
Click the IIS Express toolbar command (or press F5) to start the sample application.
You need to install the .NET Core 2.2 on the local machine.
Go to physical location of your local work space, double click the npm_install.bat and ng_build.bat files sequentially under the SM.NgExTable.Web\AppDev folder (also see the same NOTE for setting up the NgExTable_AspNet5_Cli project).
NgExTable_AspNet5_Cli
Open the solution with the Visual Studio 2017 (version 15.9 or above), or Visual Studio 2019, and rebuild the solution with the Visual Studio.
Since the data grid loaded with the client-side pagination sets the single column sorting by default, to look at the page using the multiple column sorting, you can click the Server-side Pagination menu item and then click Go button on the search panel.
You don't have to set up the server data source from the data-providing service application for the server-side pagination and sorting demo. By default, the sample application uses the server-mock-data.service.ts to simulate the server-side data request and response patterns and results. This also benefits the audiences who add the NgExTable_Scripts_AnyPlatform code files into their website project and run for the NgExTable example on their non-Microsoft platforms.
NgExTable_Scripts_AnyPlatform
If you run the sample application with Visual Studio and would like to call the real server data source for the server-side pagination and sorting demo, I recommend performing these steps:
Go to my other article, ASP.NET Core: A Multi-Layer Data Service Application Migrated from ASP.NET Web API and set up the Core API data services following the instructions. The source code files can also be downloaded on the beginning of this article.
Start the Core API data services with the Visual Studio and keep the running solution with the IIS Express on the background.
In the ../app/NgExTableDemo/app.config.ts file, change the ServerPagingDataSource from mock to server.
ServerPagingDataSource
mock
server
export const ServerPagingDataSource: string = 'server'; //'mock' for
//simulating server data.
Press F5 to run the NgExTable demo application, select the Server-side Pagination left menu item, and click the Go button on the Search Products panel.
If you would like to use the legacy ASP.NET Web API 2 version of the data services, you can also see the instructions on the data service article for details. You need to enable this line in the ../app/NgExTableDemo/app.config.ts file for accessing the Web API 2 data sources.
export const WebApiRootUrl: string = ''; //Web API 2.0
TIP: You can modify the source data to make the same value for columns to be sorted in several rows so that the multiple column sorting feature is meaningfully displayed.
The client data source file locations:
The server data source seeding file location in the data services:
Or you can directly change the data values in the SQL Server database using the SQL Server Management Studio for the server data source.
The below diagram illustrates the major components used for UI data sorting processes and their relationships.
style="width: 462px; height: 386px" alt="Image 2" data-src="/KB/scripting/5166021/component-tree.png" class="lazyload" data-sizes="auto" data->
These structures are added into the table-hosting HTML template based on the data sorting needs.
<table class="table table-condensed table-striped bottom-border"
[table-main]="pagingParams" (tableChanged)="onChangeTable($event)">
<thead>
<tr class="option-board-tr">
<th colspan="6">
<options (optionChanged)="onChangeOptions($event)"></options>
</th>
</tr>
<tr #trHead class="table-header>
<tr>
<th colspan="6" class="sort-box-th">
<multi-sort-command (multiSortChanged)="onChangeTable($event)">
</multi-sort-command>
</th>
</tr>
</thead>
- - -
</table>
Here are some key points regarding the sorting-related directive and component structures.
TableMainDirective: This attribute directive for the HTML table is a component without the HTML template. It acts as the local service privately for the current table. It can be imported and injected into any child component that is only declared within the current table scope. Thus, in the sample application, those child components, OptionsComponent, ColumnSortingComponent, and MultiSortingCommandComponent, can call the tableMainDirective as a central point for communications.
TableMainDirective
OptionsComponent
ColumnSortingComponent
MultiSortingCommandComponent
tableMainDirective
OptionsComponent: It is placed within the HTML table header. The component and its HTML template are pre-defined in the NgExTable library packages so that the code in the client calling side (the NgExTableDemo section of the sample application) would be very simple. The component transfers the data and submits changes via the tableMainDirective.
NgExTableDemo
ColumnSortingComponent: It is used to display and handle sorting icons and sequence numbers. Multiple instances of the component can be defined for the sortable columns as shown in the above HTML code. Thus, one-to-many relationship exists between the parent TableMainDirective and child ColumnSortingComponent instances. If executing child code pieces initiated from the parent, then the same code in all child instances will be iterated.
MultiSortingCommandComponent: It renders the multiple column sorting command panel for submitting or cancelling the sorting request with the “on-submit” pattern. This component also only communicates with the TableMainDirective through which the input and output data operations are performed. The UI panel is dynamically rendered and displayed based on the required multiple column sorting operations (see details in the later section, Multiple Column Sorting Command Panel).
Although the multiple column sorting feature is available, sometimes a single column sorting of the data option may still be practical in many cases. The sample application can be configured to run either single column sorting type only or combination of single and multiple column sorting types. Those configurations must be in the table-hosting component, not the global, level since multiple data grids with different settings may be used in an application.
This is the traditional operation mode for the data grid display. You can use this type if the multiple column sorting is not needed by the design or the multiple column sorting option is not available from the data sources.
To run the application with the single column sorting mode only, set this line in the ngOnInit method of the table-hosting component class:
ngOnInit
this.tableMainDirective.sortingRunMode = 0; //0: single column sorting only,
//1: single/multiple column sorting (default)
In the sample application, the Client-side Pagination demo page loads the data grid with the single-column sorting type only. You can comment out this configuration line or set the value to 1 to enable the switchable single and multiple column sorting types for this page.
With this setting, both single and multiple column sorting types can co-exist for the data grid. But the question is how to easily and intelligently switch between the single and multiple column sorting types. We will discuss this topic in details with two approaches, dropdown selection and Ctrl (or Shift) key operation, in the next section.
To run the application with the switchable, set this line in the ngOnInit method of the table-hosting component class. You can also omit this line since it's the default setting.
this.tableMainDirective.sortingRunMode = 1;
By the default, the sortingTypeSwitch is set to using the dropdown selection. See the details in the next section for using the Ctrl/Shift key approach.
sortingTypeSwitch
If using the dropdown selection, you may also to set the default loading type for the single or multiple column sorting. Otherwise, the default setting is to load the single column sorting as active selected type.
this.tableMainDirective.sortingOption = 'multiple'; //'single' (default) or
// 'multiple' - used only for sortingRunMode = 1
In the sample application, all configuration items for column sorting are defined with comments in the TableMainDirective controller class.
//Values here are defaults and can be overwritten from table-hosting component-level settings.
sortingRunMode: number = 1; //0: single column sorting only,
//1: single/multiple column sorting
sortingTypeSwitch: number = 0; //0: dropdown selection mode,
//or 1: Ctrl/Shift key mode - used only for sortingRunMode = 1
sortingOption: string = 'multiple'; //'single' or 'multiple' - initial loading type
// used only for sortingRunMode = 1
enableOptionBoard: string = ''; //'yes' or 'no'('' the same as 'no').
showOptionBoardContent: string = '';//'yes' or 'no'('' the same as 'no')
showGroupingLines: string = ''; //yes' or 'no'('' the same as 'no')
All configuration items are also listed with comments in the ngOnInit method of the ClientPagingComponent and ServerPagingComponent classes to demonstrate how to use or overwrite the defaults. Feel free to enable, disable, or change the item lines for testing the data sorting results and display after you have known all details of the sample application.
ClientPagingComponent
ServerPagingComponent
The sample application demonstrates two different approaches for switching between single and multiple column sorting types, each with its pros and cons. For your real application development, you can implement one of the approaches based on your preference and business requirements.
This approach is configured as using the dropdown selection when the value of TableMainDirective.sortingTypeSwitch value is 1.
TableMainDirective.sortingTypeSwitch
sortingTypeSwitch = 1; //dropdown selection,
The OptionsComponent and its template are created for the dropdown list and selection display. In the OptionsComponent, the dropdown selected value is assigned to the TableMainDirective.sortingOption. When the option is changed, the switchSortingOption method is then called to process the changes in sorting logic and data results. Since the TableMainDirective is injected into the contract of the OptionsComponent class, the properties and methods in the TableMainDirective can directly be accessed in the OptionsComponent.
TableMainDirective.sortingOption
switchSortingOption
onSortingOptionChange($event: any) {
this.tableMainDirective.sortingOption = this.sortingOption;
this.tableMainDirective.switchSortingOption();
}
The option panel and column headers, when loaded with multiple column sorting by default, look like the below:
style="width: 555px; height: 131px" alt="Image 3" data-src="/KB/scripting/5166021/option-panel-multiple-sort.png" class="lazyload" data-sizes="auto" data->
When changing to the single column sorting, the process automatically takes the first sorted column from the previous multiple column sorting.
style="width: 543px; height: 127px" alt="Image 4" data-src="/KB/scripting/5166021/option-panel-single-sort_1.png" class="lazyload" data-sizes="auto" data->
With the explicit selection, the user can clearly know the current sorting type and the consequences of conducted actions. However, this approach needs an additional component and space for the dropdown display on the page.
This approach or feature is not loaded by default in the sample application. You need to enable it by setting the value of TableMainDirective.sortingTypeSwitch value to 0 in the ngOnInit method of the table-hosting component controller class.
0
sortingTypeSwitch = 0; //Using Ctrl or Shift key,
With this approach, regularly clicking any sorting icon on any sortable column always proceeds with the single column sorting type. When clicking any sorting icon on the second sortable column while pressing the Ctrl or Shift key, the process will go to the multiple column sorting workflow. The toggelSort method in the ColumnSortingComponent checks such user actions.
toggelSort
toggleSort(obj: any, $event: any) {
if (this.config.sortingTypeSwitch == 0 && ($event.ctrlKey || $event.shiftKey) &&
!this.tableMainDirective.baseSequenceOptions.find(a => a.value > 1)) {
if (this.config.sortingOption == 'single') {
//Switch to multiple mode.
this.tableMainDirective.sortingOption = 'multiple';
}
}
- - -
}
At this point, any user action will follow the multiple column sorting scenarios, the same as those used with selecting the multiple column sorting from the dropdown list. No explicit structure for any selection is needed though. The downsides of the approach are also obvious.
You can remove the sorted columns by clicking the x button from the sequence dropdowns until only one sorted column is left on the data grid, which then becomes the single column sorting type. This, however, is certainly a cumbersome way for the purpose. To quickly switch to the single column sorting type, a button, Go to Single Column Sorting, is added onto the multi-sorting command panel. The details of the panel will be described in later section but here just shows the panel with the button which is rendered on the panel only for Ctrl or Shift key activation pattern. Clicking the button will switch immediately to the single column sorting type, leaving the previously first sorted column there. You can also notice that no sorting type dropdown is displayed.
style="width: 541px; height: 131px" alt="Image 5" data-src="/KB/scripting/5166021/command-panel-implicit.png" class="lazyload" data-sizes="auto" data->
The multiple column sorting feature is implemented with complex processing logic for selections of sorted columns and sequences. Audiences may not have to know the internal code details when using the feature if no modification for the logic is needed, but below are outlined the essential points of implementations and practices.
The ColumnSortingComponent object instance is created one for each sortable column. The instances set the sorting icons and sequence display with the dropdown list on the column headers.
The parent TableMainDirective object governs multiple instances of the ColumnSortingComponent by the data members sortableList and baseSequenceOptions arrays. For example, the sortableItem is created in the ColumnSortingComponent and then added into the sortableList array in the TableMainDirective.
sortableList
baseSequenceOptions
sortableItem
In the ColumnSortingComponent:
//Populate sortableItem and add sortable column to sortableList in parent.
this.sortableItem = {
sortBy: this.sortBy,
sortDirection: this.sortDirection || '',
sequence: this.sequence || -1
};
this.tableMainDirective.initSortableList(this.sortableItem);
In the TableMainDirective:
//Called from each columnSortComponent.
initSortableList(sortableItem: SortableItem) {
- - -
this.sortableList.push(sortableItem);
- - -
}
The toggleSort method in the ColumnSortingComponent handles the changes in sorted column selections and updates the sorting direction for the corresponding sortableItem.
toggleSort
toggleSort() {
- - -
switch (this.sortableItem.sortDirection) {
case "asc":
this.sortableItem.sortDirection = "desc";
break;
case "desc":
this.sortableItem.sortDirection =
this.toggleWithOriginalDataOrder ? "" : "asc";
break;
default:
//Existing sortDirection is ''.
this.sortableItem.sortDirection = "asc";
break;
}
- - -
}
When the sorting sequence changes, the code in the onSequenceChange method of the ColumnSortingComponent needs to call the parent TableMainDirective for re-arranging the sequence values and refreshing overall sorting settings since any change in a column will affect behaviors of other columns.
onSequenceChange
onSequenceChange(event: any) {
let oldSeq: number = this.sortableItem.sequence;
this.sortableItem.sequence = event.value;
//Call to re-arrange sequence numbers.
this.tableMainDirective.rearrangeSequence
(oldSeq, this.sortableItem.sequence, this.sortBy);
//Call TableMainDirective and then back call each ColumnSortComponent
//to reset sorting settings if changed.
this.tableMainDirective.refreshSortSettings();
- - -
}
The sorting sequence arrangements are based on these rules:
The next available sequence number is automatically assigned to any newly added column for the sorting.
The maximum available sequence number is dynamically updated with only the number of active sorted columns. For example, if three sorted columns are selected, then the sequence dropdown list only contains 1, 2, and 3.
style="width: 559px; height: 130px" alt="Image 6" data-src="/KB/scripting/5166021/seq-dropdown_explicit_1.png" class="lazyload" data-sizes="auto" data->
Changing any column sequence by selecting the number from the dropdown list will automatically re-arrange the sequence numbers towards the larger number side. For example, if changing the sequence number from 4 to 2, the previous 2 will be 3, and previous 3 be 4. The rearrangeSequence method in the TableMainDirective implements the desired rules and logic.
rearrangeSequence
rearrangeSequence(oldSeq: number, newSeq: number, sortBy: string) {
if (oldSeq > 0 && newSeq == -1) {
//Re-arrange sequence if any sortableItem.sequence reset to -1.
this.sortableList.forEach((item: SortableItem, index: number) => {
if (item.sequence > oldSeq) {
item.sequence--;
}
});
}
else {
//Change any sequence number in positive range.
this.sortableList.forEach((item: SortableItem, index: number) => {
if (item.sortBy != sortBy) {
if (item.sequence >= newSeq && item.sequence < oldSeq) {
item.sequence++;
}
else if (item.sequence <= newSeq && item.sequence > oldSeq) {
item.sequence--;
}
}
});
}
In the TableMainDirective, any escalated changes in sorted column selections and/or sequences will be transferred to the pagingParams.sortList array that can be sent to the table-hosting component for refreshing the data grid. If current sorting option is single column type, the pagingParams.sortList is populated with only the first sortableItem from the sortableList.
pagingParams.sortList
updatePagingParamsWithSortSettings() {
//Transfer active sortable items to pagingParams.sortList.
this.pagingParams.sortList = [];
for (let num: number = 1; num <= this.sortableList.length; num++) {
for (let idx: number = 0; idx < this.sortableList.length; idx++) {
if (this.sortableList[idx].sequence == num) {
let sortItem: SortItem = {
sortBy: this.sortableList[idx].sortBy,
sortDirection: this.sortableList[idx].sortDirection
};
this.pagingParams.sortList.push(sortItem);
break;
}
}
if (this.sortingOption == 'single' && num == 1) {
break;
}
}
}
For the multiple column sorting, most Angular data grid tools that could be found across the Internet and software market use the "on-change" data access pattern in which any change action on the sorted column selection or sequencing would reload the data items to the grid, no matter if it's an intermediate step. As a result, any designated sorting operation, if consisting of multiple steps, would call for the data and refresh the grid multiple times.
To resolve the issue, the NgExTable introduces the MultiSortingCommandComponent and its HTML template with the "on-submit" data access pattern. The panel can dynamically be expended and collapsed directly under the table header.
Add the <multi-sort-command> tag into the second row of the <thead> in the table-hosting component template.
<multi-sort-command>
<thead>
<thead>
<tr #trHead>
<!--Normal th headers -->
- - -
</tr>
<tr>
<th colspan="6" class="sort-box-th">
<multi-sort-command (multiSortChanged)="onChangeTable($event)">
</multi-sort-command>
</th>
</tr>
</thead>
The command panel would automatically be shown when any set of below conditions is met.
Condition set #1:
Condition set #2:
Below shows the command panel opened with the dropdown selection option switching type.
style="width: 557px; height: 153px" alt="Image 7" data-src="/KB/scripting/5166021/command-panel-opt-selction.png" class="lazyload" data-sizes="auto" data->
The user can comfortably and repeatedly make any desired change in column and sequence selections when the command panel is open. The sorting request will only be submitted if clicking the OK button. Alternatively, the user can cancel the changes or clear all sorting settings for getting a non-sorted data set.
The panel will automatically be closed whenever clicking the OK, Cancel, or Clear Column Settings button, or any action outside the panel if the panel is open. The command panel is not the modal type so that any action outside the panel will be treated as an operation of cancellation.
Showing and hiding the panel is controlled by the value of the showMultiSortPanel variable in the MultiSortingCommandComponent. Requests of getting and setting the variable values are sent from other components through the subscription approaches.
showMultiSortPanel
Setting the showMultiSortPanel variable to false directly in the MultiSortingCommandComponent when clicking any button on the command panel. The panel will then be closed with this action after the corresponding operation is done.
false
Since most top-level processes of multiple column sorting are performed in the TableMainDirective, and calls from this parent to the child component is needed, the methods for getting and setting the showMultiSortPanel value are added into the TableMainDirective. These methods can be called from multiple places of the TableMainDirective itself and the ColumnSortingComponents.
ColumnSortingComponents
getShowMultiSortPanelFlag(): boolean {
let subjectParam: NameValueItem = {
name: 'getShowMultiSortPanelFlag',
value: undefined
}
this.multiSortCommandComponent.next(subjectParam);
return subjectParam.value;
}
setShowMultiSortPanelFlag(flagValue: boolean) {
let subjectParam: NameValueItem = {u
name: 'setShowMultiSortPanelFlag',
value: flagValue
}
this.multiSortCommandComponent.next(subjectParam);
}
The method calls are subscribed in the constructor of the MultiSortingCommandComponent. When a calls comes from the parent TableMainDirective, it actually gets and sets the showMultiSortPanel variable value in the MultiSortingCommandComponent.
let pThis: any = this;
//Called from TableMainDirective to open this panel.
this.tableMainDirective.multiSortCommandComponent$.subscribe(
(subjectParam: NameValueItem) => {
if (subjectParam.name == "setShowMultiSortPanelFlag") {
//subjectParam.value: true or false.
pThis.showMultiSortPanel = subjectParam.value;
}
else if (subjectParam.name == "getShowMultiSortPanelFlag") {
subjectParam.value = pThis.showMultiSortPanel;
}
}
);
With the NgExTable, the default values of sorting parameters can be specified in one of either two places.
Add the sortDirection and sequence attributes and values into the column-sort tags in the table-hosting HTML template.
sortDirection
sequence
column-sort
>
Add elements into the pagingParams.sortList array in the ngOnInit() of the table-hosting component. The element orders determine the column sorting sequences.
ngOnInit()
this.pagingParams = {
pageSize: pageSize !== undefined ? pageSize : 10,
pageNumber: 1,
sortList: [{
sortBy: 'AvailableSince',
sortDirection: 'desc'
}, {
sortBy: 'StatusDescription',
sortDirection: 'asc'
}, {
sortBy: 'ProductName',
sortDirection: 'asc'
}],
changeType: TableChange.init
}
If no default item and value exist, the grid will initially be populated without any column sorting of the data.
Many display options for the sorted data list can be added into the page by changing the styles of the nativeElement items in the AfterViewInit event handler or after the data loading. The sample application shows an example of adding row grouping lines into the grid display based on the first sorted column. The main method, setRowGroupLines, is created in the TableMainDirective to dynamically process the DOM based style settings. Audiences can look into the code details in the table-main.directive.ts file.
nativeElement
AfterViewInit
setRowGroupLines
Such style settings are done in the library, rather than in the UI, which is just an example to save the code in the UI parts. Passing the DOM elements from the table-hosting component to the TableMainDirective is still needed. Thus, two ViewChild objects are defined in the table-hosting component, where the trHead and trItems are created for template variables, #trHead and #trItems, respectively.
ViewChild
trHead
trItems
#trHead
#trItems
//Row group lines.
@ViewChild('trHead', { static: true }) trHead: ElementRef;
@ViewChildren('trItems') trItems: QueryList<any>;
After the data loading, the code then calls the setRowGroupLines method by passing two ViewChild object instances.
//Show first sortBy group lines in grid.
this.tableMainDirective.setRowGroupLines(this.trHead, this.trItems);
The showGroupingLines option can also be enable and disabled using the checkbox on the option switchboard. You may want to turn off the grouping lines if rows sorted by the column are pretty unique, in which the grouping lines may not make much more sense.
showGroupingLines
The below screenshot shows the row grouping lines in action with the AvailableSince as the first sorted column.
AvailableSince
style="width: 640px; height: 489px" alt="Image 8" data-src="/KB/scripting/5166021/grouping-lines.png" class="lazyload" data-sizes="auto" data->
Various other display styles can also be enhanced using the described approach above, such as changes in row background color, text font type and color, merging cells, or even adding sub-rows. Feel free to experiment by yourselves.
The TypeScript code in the NgExTable/client-pagination.service.ts performs the sorting logic for the client-side pagination data list. In the sample application, the same native JavaScript array.sort function and associated processes are also used for the server-mock data provider.
array.sort
//Sorting logic.
changeSort(pagingParams: PagingParams, data: Array<any>): Array<any> {
let pThis: any = this;
let rtnArr: any = data.sort((previous: any, current: any) => {
//Sort firstly-available column with different comparison items along the sortList.
let idx: number = 0;
while (idx < pagingParams.sortList.length) {
if (current[pagingParams.sortList[idx].sortBy]
!== previous[pagingParams.sortList[idx].sortBy]) {
return pThis.doSort(previous, current, pagingParams.sortList, idx);
}
idx++;
}
return 0;
});
return rtnArr;
}
private doSort(previous: any, current: any,
sortList: Array<SortItem>, idx: number): number {
//Null is sorted to the last for both asc and desc.
if (previous[sortList[idx].sortBy] === null) {
return 1;
}
else if (current[sortList[idx].sortBy] === null) {
return -1;
}
else if (previous[sortList[idx].sortBy] > current[sortList[idx].sortBy]) {
return sortList[idx].sortDirection === 'desc' ? -1 : 1;
}
else if (previous[sortList[idx].sortBy] < current[sortList[idx].sortBy]) {
return sortList[idx].sortDirection === 'asc' ? -1 : 1;
}
return 0;
}
Here are the important points of the code:
The code handles both single and multiple column sorting scenarios.
Within the data.sort method that is actually an outer loop, the inner while loop is used for searching the sortable columns with the sequence in the sortList array.
data.sort
sortList
The doSort comparing function called from the while loop conducts the real data sorting for each iterated column group.
doSort
while
The logic sorts the null value to the last, no matter what sorting direction is. If you apply different rules for the null value, you may change the return index numbers in the doSort function, for example, switching between -1 and 1 in the first if and else if conditions to have null value always sorted the first.
null
-1
1
if
else if
The sample application presents the examples of the server-side data sorting management with both the LINQ Expression and the database stored procedure. These are implemented with the Microsoft technologies so that the audiences need to open the source code projects using the Visual Studio tool to see the demo results. Setting up the Visual Studio API data service projects locally is detailed in the Set Up and Run Sample Application section. Or, you can directly see the instructions in the article ASP.NET Core: A Multi-Layer Data Service Application Migrated from ASP.NET Web API.
The LINQ Expression approach is a choice for some simple requests without complex business rules, many table joins, or multiple database instances. The essence of this approach is to construct the LINQ Expression tree nodes with the passed sortList collection as the single or multiple column sorting parameter. The logic is processed by the AsSortedQueryable method in the SM.Store.CoreApi_2.2\SM.Store.Api.Common\Classes\GenericMultiSorterPager.cs. The comment lines explain the operations performed by the code.
AsSortedQueryable
public static IOrderedQueryable<t> AsSortedQueryable<t>
(this IQueryable<t> source, List<sortitem> sortList)
{
if (sortList.Count == 0)
{
return null;
}
//Create parameter expression node.
var param = Expression.Parameter(typeof(T), string.Empty);
//Create member expression for accessing properties for first sorted column.
var property = Expression.PropertyOrField(param, sortList[0].SortBy);
//Create lambda expression as delegation type for first sorted column.
var sort = Expression.Lambda(property, param);
//Call to create sorting expression for the first sorted column.
MethodCallExpression orderByCall = Expression.Call(
typeof(Queryable),
"OrderBy" + (sortList[0].SortDirection == "desc" ? "Descending" : string.Empty),
new[] { typeof(T), property.Type },
source.Expression,
Expression.Quote(sort));
//Call to create multiple column sorting expressions if more than one sorted column passed.
if (sortList.Count > 1)
{
for (int idx = 1; idx < sortList.Count; idx++)
{
var item = sortList[idx].SortBy;
//The same logic used as for the first column sorting.
param = Expression.Parameter(typeof(T), string.Empty);
property = Expression.PropertyOrField(param, item);
sort = Expression.Lambda(property, param);
//Use "ThenBy" for more than one column sorting.
orderByCall = Expression.Call(
typeof(Queryable),
"ThenBy" + (sortList[idx].SortDirection == "desc" ?
"Descending" : string.Empty),
new[] { typeof(T), property.Type },
orderByCall,
Expression.Quote(sort));
}
}
//Generate and return LINQ of IOrderedQueryable type.
return (IOrderedQueryable<t>)source.Provider.CreateQuery<t>(orderByCall);
}
If you would like to test the LINQ Expression approach, enable the line in the NgExTableDemo\services\app.config.ts of the Angular sample application. You may adjust the API data service URL if it’s different from the downloaded original.
export const ServerPagingDataSource: string = 'server';
export const WebApiRootUrl: string = ''; //Core 2.0 - 2.2
Using a stored procedure is the preferred approach for retrieving the paginated, filtered, and sorted data list, especially when multiple column sorting, multiple instances of databases, or complex business rule processing are needed. The ASP.NET Core API data service sample application contains the code to create the stored procedure, GetPagedProductList, in the SM.Store.CoreApi_2.2\SM.Store.Api.DAL\DataContext\StoreDataInitializer.cs file. When running the data service application, the stored procedure can automatically be added into the SQL Server database specified in the appsettings.json configuration file. The stored procedure is also available if using the in-memory database setting.
GetPagedProductList
Doing multiple column sorting code with the stored procedure is rather simple and straightforward.
From the Angular sample application code, include the sortList in the paginationRequest object for the AJAX call (see details in the ../SM.NgExTable.Web/ClientApp/app/NgExTableDemo/server-paging.component.ts).
paginationRequest
//Parameters for data access
getProductListRequest(): any {
let req: any = {
- - -
paginationRequest: {
sortList: []
},
};
- - -
if (this.pagingParams.sortList.length > 0) {
req.paginationRequest.sortList = this.pagingParams.sortList;
}
return req;
};
The data service controller method, Post_GetPagedProductListSp, converts the sortList generic List to the sortString with the format for the SQL ORDER BY clause.
Post_GetPagedProductListSp
sortString
ORDER BY
//Multiple column sorting
if (request.PaginationRequest.SortList != null &&
request.PaginationRequest.SortList.Count > 0)
{
foreach (var item in request.PaginationRequest.SortList)
{
if (sortString != " ") sortString += ", ";
sortString += item.SortBy + " " + item.SortDirection;
}
}
The sortString is passed to the GetPagedProductList stored procedure and embedded in the dynamic query there.
IF @SortString != ''
SET @Query = @Query + ' ORDER BY ' + @SortString
If interested, audiences can also look into the entire script of the stored procedure in the included file, StoreCF8.sql, downloaded from the ApiDataServices.zip.
The multiple column sorting feature is a nice add-on to a web application with the data grid display. This article and sample application can be helpful resources for how to implement such a feature in both client UI and server processing sides.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
|
https://www.codeproject.com/Articles/5166021/Multiple-Column-Sorting-from-Angular-NgExTable-to
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
Opened 9 years ago
Closed 9 years ago
#895 closed enhancement (fixed)
svn poller should use pass environment to getProcessOutput
Description
svnpoller.py should pass os.environ to utils.getProcessOutput to ensure shell variables are passed along properly. In my setup (gentoo) the $HOME variable is set by the script that starts buildbot, --env HOME=$BASEDIR, and this information is only propagated to the rest of the python system through os.environ.
I do not know if this change has adverse effects on other systems.
def getProcessOutput(self, args): import os # this exists so we can override it during the unit tests d = utils.getProcessOutput(self.svnbin, args, os.environ) return d
Change History (2)
comment:1 Changed 9 years ago by dustin
- Keywords svn added
- Milestone changed from undecided to 0.8.2
- Type changed from undecided to enhancement
comment:2 Changed 9 years ago by dustin
- Resolution set to fixed
- Status changed from new to closed
Note: See TracTickets for help on using tickets.
Fixed a while back:
|
http://trac.buildbot.net/ticket/895
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
687/hyperledger-can-have-some-instances-network-while-virtual
I am new to blockchain development. I have a question that if while configuring the hyperledger network, I have created multiple ubuntu instances using virtualbox on one pc, Can the peers within each instance be connected in a single blockchain network?
Yes, you can connect multiple instances to a Hyperledger Blochchain network. To do this, you have to use docker swarm mode.
The primary machine on which the network is running has to initiate swarm mode. After that, the other instances will join it. Next, you have to create another network on top of this network. By this, all the instances in the swarm will communicate with each other.
To know more about this, visit:
In the default Development Fabric, all the docker containers are running on a single machine and the network addressing/routing is managed by Docker Compose. If you split your fabric to separate Virtualbox Ubuntu instances, you will have to understand and manage the network addressing/routing. This is a Docker and networking issue, not really a Fabric or Composer issue. You may find that Kubernetes is the most helpful way forward for you or Docker Swarm.
There is no android wallet to connect ...READ MORE
To develop your own cryptocurrency, you need ...READ MORE
The problem lies in the command:
truffle migrate
Your truffle migrate command ...READ MORE
The peers communicate among them through the ...READ MORE
Summary: Both should provide similar reliability of ...READ MORE
This will solve your problem
import org.apache.commons.codec.binary.Hex;
Transaction txn ...READ MORE
To read and add data you can ...READ MORE
You can do this by generating the crypto ...READ MORE
I guess you have ganache running already ...READ MORE
OR
Already have an account? Sign in.
|
https://www.edureka.co/community/687/hyperledger-can-have-some-instances-network-while-virtual
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
Conference Buddy is a real-world Line of Business application that we are building and documenting as we build. You can learn more about it here. You can find a list of related blog posts here
We need to capture, preserve and use the following information for Conference Buddy
The preferred way to obtain this information is through the Settings Charm in windows 8, as shown in the cropped illustration.
The user slides the Charms into view (or presses Windows-C) and chooses Settings. The user then taps on Authentication and our custom authentication window opens with prompts and TextBoxes to fill in the data we need.
We will preserve the user name and url in local settings and the password in the Credential Locker. We will then use them when needed to contact the back end database that stores and manages all the data collected in the application.
The Settings page will be displayed on request of the user, and the settings themselves will be preserved when the page is dismissed. There is no explicit save button.
Special thanks to Pete Brown and his book Windows Store App Development (Manning, 2013), Carey Payette and to the folks on Stack Overflow for helping me understand how to put all this together.
We begin by creating a class which will manage the saving and loading of the settings. We’ll call this SettingsService.cs. This class has three static properties,
public static string UserName { get; set; }public static string UserPW { get; set; }public static string ServerURL { get; set; }
The constructor registers for the ApplicationData.Current.DataChanged event, the handler looks like this:
private static void OnDataChanged( ApplicationData sender, object args ){ Load();}
The Load event obtains the UserName and ServerURL from LocalSettings (we’ll see how they are stored in just a moment), using the following constants,
private const string UserNameKey = "User Name";private const string ServerURLKey = "Connection URL";private const string ResourceKey = "login";
The retrieval is accomplished by indexing into the LocalSettings collection,
UserName = ApplicationData.Current. LocalSettings.Values[UserNameKey].ToString();ServerURL = ApplicationData.Current. LocalSettings.Values[ServerURLKey].ToString();
The password is retrieved from the PasswordVault using the Credential Locker,
var vault = new PasswordVault();var retrievedCredential = vault.Retrieve( ResourceKey, UserName );UserPW = retrievedCredential.Password;
Saving is just the inverse of Loading,
public static void Save() { var current = ApplicationData.Current; current.LocalSettings.Values[ServerURLKey] = ServerURL; current.LocalSettings.Values[UserNameKey] = UserName; var credential = new PasswordCredential( ResourceKey, UserName, UserPW ); var vault = new PasswordVault(); vault.Add( credential );}
Notice that both Load and Save are public and static. We’ll see why in just a moment.
Before we create the SettingsAuthenticationPage itself, let’s begin by creating its associated ViewModel. This VM has three public properties (UserName, UserPW and ServerURL) as well as two methods, Save and Load. The methods delegate their work to the static methods we just created in SettingsService.
<Grid Grid. <StackPanel> <StackPanel Margin="0,0,0,10" Width="350" HorizontalAlignment="Left"> <TextBlock Text="User name" Style="{StaticResource CaptionTextStyle}" Foreground="Black" /> <TextBox Text="{Binding UserName, Mode=TwoWay}" Margin="0,5,0,0" BorderBrush="Black" /> </StackPanel> <StackPanel Margin="0,0,0,10" Width="350" HorizontalAlignment="Left"> <TextBlock Text="User password" Style="{StaticResource CaptionTextStyle}" Foreground="Black" /> <PasswordBox Password= "{Binding UserPW, Mode=TwoWay}" Margin="0,5,0,0" BorderBrush=" Black" /> </StackPanel> <StackPanel Margin="0,0,0,10" Width="350" HorizontalAlignment="Left"> <TextBlock Text="Server URL" Style="{StaticResource CaptionTextStyle}" Foreground="Black" /> <TextBox Text="{Binding ServerURL, Mode=TwoWay}" Margin="0,5,0,0" BorderBrush=" Black" /> </StackPanel> </StackPanel></Grid>
The Code-behind page for the SettingsAuthenticationPage sets up the View Model,
private SettingsAuthenticationViewModel _vm; public SettingsOptionsPage() { this.InitializeComponent(); _vm = new SettingsAuthenticationViewModel(); DataContext = _vm; this.Unloaded += SettingsOptionsPage_Unloaded; }
Notice that we’ve added an event handler for when the page is unloaded. This is when we’ll persist the data we’ve collected,
void SettingsOptionsPage_Unloaded( object sender, RoutedEventArgs e ){ if (_vm != null) _vm.Save();}
Our final task is to handle the BackButton click event. In this case we want to close the popup but open the settings pane. You can open the settings pane from anywhere by calling SettingsPane.Show
private void OnSettingsBackButtonClick( object sender, RoutedEventArgs e ) { var parent = this.Parent as Popup; parent.IsOpen = false; SettingsPane.Show(); }
The work of actually displaying the SettingsPane is delegated to a new class that we’ll create in the Services folder, SettingsPageService.
public class SettingsPaneService : IDisposable { private Popup _settingsPopup;
In the constructor we add a handler for the CommandsRequested event of the SettingsPage,
public SettingsPaneService()
{
SettingsPane.GetForCurrentView().CommandsRequested +=
OnSettingsPaneCommandsRequested;
}
Note that you must have only a single listener on the CommandsRequested event so you want to be sure to remove the handler when the class is destroyed.
The bulk of the work is done in the event handler for the CommandsRequested event,
private const int SettingsPageID = 1001;private void OnSettingsPaneCommandsRequested( SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args ){ var Authentications = new SettingsCommand( SettingsPageID, "Authentication", ( x ) => { var fullWidth = Window.Current.CoreWindow.Bounds.Width; var fullHeight = Window.Current.CoreWindow.Bounds.Height; const int PaneWidth = 635; _settingsPopup = new Popup(); _settingsPopup.Closed += OnPopupClosed; Window.Current.Activated += OnWindowActivated; _settingsPopup.IsLightDismissEnabled = true; _settingsPopup.Width = PaneWidth; _settingsPopup.Height = fullHeight; SettingsOptionsPage mypane = new SettingsOptionsPage(); mypane.Width = PaneWidth; mypane.Height = fullHeight; _settingsPopup.Child = mypane; _settingsPopup.SetValue( Canvas.LeftProperty, fullWidth - PaneWidth ); _settingsPopup.SetValue( Canvas.TopProperty, 0 ); _settingsPopup.IsOpen = true; } ); args.Request.ApplicationCommands.Add( Authentications );}
The width of the settings pane is under your control. Here we’ve made it a bit wider than absolutely necessary so that the controls have a little “breathing room”.
Of course, none of this will actually do anything until we wire it up in one or more pages. We’ll start in the EventList page’s OnNavigation. At the bottom of that method, we add these two lines of code:
if (_settingsPaneService == null) _settingsPaneService = new SettingsPaneService();
That’s all it takes to activate our settings from that page.
It is most convenient to have the settings loaded when the application begins. To accomplish that we’ll open App.xaml.cs and find the OnLaunched event handler, where we’ll add this one line of code,
SettingsService.Load();
That’s all it takes to add settings to your program, and in this case, to gather the information necessary to create a connection to the server. The code that actually uses these settings looks like this:
private Proxy GetProxy(){ string url = SettingsService.ServerURL; string user = SettingsService.UserName; string pw = SettingsService.UserPW; var cbProxy = new ConferenceBuddy.PortableClient.Proxy( new Uri(url), user, pw); return cbProxy;}
We can then call GetProxy to get a proxy connection and use that to retrieve events, contacts, etc.!
|
https://www.telerik.com/blogs/setting-preferences-for-a-line-of-business-application-in-windows-8-xaml
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
The there are a few more things, such as a new built-in code cleanup profile for applying code style settings. Let’s have a look, shall we?
DOWNLOAD ReSharper 2019.1 EAP
Export EditorConfig from ReSharper code style settings
Many teams are using EditorConfig to customize code style settings across IDEs and editors. From the ReSharper settings, under Code Editing | General Formatter Style, we can now export ReSharper’s code style settings to EditorConfig. We can export cross-editor options, as well as properties that are only supported by ReSharper/Rider.
Combined with the Format Selection | Configure… context action (Alt+Enter), we can visually update formatting rules and then export them as EditorConfig.
Typing assist for unindent on backspace
To help with indenting/unindenting code, we’ve added a new typing assist when pressing Backspace. Instead of moving the caret back one position at a time, pressing Backspace returns the caret to the proper indent position.
We can change the behavior of this typing assist in ReSharper’s settings (under Environment | Editor | Editor Behavior):
The following options are available:
- To proper indent position (default) – When the caret is to the right of the proper indent, Backspace deletes the space to the proper indent. Otherwise, Backspace deletes the whole indent and moves to the previous line. This means that maximum 2 Backspaces are required to move to the previous line.
- To nearest indent position – Backspace moves to the previous indent position.
- Disabled – Speaks for itself, doesn’t it? 😉
Analyze/optimize references for SDK projects
Code bases evolve. Over time, we add new references and install NuGet packages into our projects. Removing those that are not in use is often more difficult. ReSharper 2019.1 comes with improvements to analyzing and optimizing references in our projects!
Next to analyzing project and assembly references, ReSharper now also checks for unused package references in SDK projects! Using the Optimize References… context menu for a project (Ctrl+Alt+Y), we can analyze and optimize references. When our project does not contain any code that uses a given reference, it will show as unused. We can easily uninstall unused packages and keep our project’s dependency tree clean!
The Mark reference as used at runtime context menu can be used to inform ReSharper of references that are used implicitly (only at runtime). Even if there are no direct code dependencies on them, ReSharper will mark these references as being in use.
Other updates to formatting & code cleanup
In ReSharper 2018.3, we made customizing code style easier and faster, by detecting formatting and naming settings from existing code. In 2019.1, this detection now runs in the background, allowing you to continue coding while detection is running.
We have added a new option Place ‘System.*’ and ‘Windows.*’ namespaces first when sorting ‘using’ directives (find it in the ReSharper settings, under Code Editing | C# | Code Style | Reference Qualification and ‘using’ Directives). By default, ReSharper and Rider will place these namespaces first when ordering namespaces. When this option is disabled, namespaces will be ordered alphabetically. Namespace ordering is now also compatible with Visual Studio and StyleCop.
Another new formatting option helps inserting blank lines before or after a
case <x>: statement (under Code Editing | C# | Formatting Style | Blank Lines).
Want to update your code to match code styles? A new built-in code cleanup (Ctrl+E, C) profile is now available for that: Reformat & Apply code styles.
Give ReSharper 2019.1 EAP a go, or try these features in Rider 2019.1 EAP! We’d love to hear your feedback.
Does the IIS Express feature work with Compound configurations ? I’m trying to launch several apps through IIS express but I’m having issues…
When do you anticipate that we will stop seeing the message about depreciated APIs and have resharper load async, since Visual Studio 2019 will be launching next week?
The above comment is in relation to 2019.3 still showing a message even though your release notes suggest async package loading should be working
That warning should be gone with 2019.1 EAP 3. Can you double check you are on that version (or newer) via the Extensions | ReSharper | Help | About ReSharper…. menu?
Yes I can confirm that it still shows the warning messages:
“One or more of your installed extensions will not be compatible with a future Visual Studio update” when I click manage performance, Resharper 2019.1 EAP 3 is listed under Depreciated APIs.
I’ve installed it on 2 machines with the same results
JetBrains Resharper Ultimate 2019.1 EAP3 Checked built 2019-03-26
Visual Studio 2019 Rc4 (version 16.0.28721.148 )
Thanks! Just checked internally, there are a couple more that are being tackled.
I’m already looking forward to have “Typing assist for unindent on backspace” in the public release of ReSharper!
But one thing is not so clear to me: am I right that “Analyze/optimize references for SDK projects” scans for unused references and in case of anything found, it also removes the NuGet package from packages.config resp. CSPROJ file, whereas the “old” versions of ReSharper only remove the assembly reference but not the package?
That’s correct
i’m still waiting to add a renaming feature for vs project like rider.
If you can sort System.* und Windows.* namespaces to the top, then you also should add Microsoft.* the that list.
Or, better. Make the list editable. So customer can support third party stuff also in there.
|
https://blog.jetbrains.com/dotnet/2019/03/28/export-editorconfig-code-style-optimize-references-sdk-projects-resharper-2019-1-eap-updates/?replytocom=552863
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
Created on 2014-11-18 21:26 by emptysquare, last changed 2017-10-26 15:54 by xdegaye. This issue is now closed.
Running a unittest suite for Motor, my MongoDB driver which uses PyMongo, greenlet, and Tornado. The suite commonly segfaults during interpreter shutdown. I've reproduced this crash with Python 3.3.5, 3.4.1, and 3.4.2. Python 2.6 and 2.7 do *not* crash. The Python interpreters are all built like:
./configure --prefix=/mnt/jenkins/languages/python/rX.Y.Z --enable-shared && make && make install
This is Amazon Linux AMI release 2014.09.
The unittest suite's final output is:
----------------------------------------------------------------------
Ran 15 tests in 265.947s
OK
Segmentation fault (core dumped)
Backtrace from a Python 3.4.2 coredump attached.
The.
Looks as globals in setup_context() is NULL. I suppose it is PyThreadState_Get()->interp->sysdict. interp->sysdict is cleared in PyInterpreterState_Clear(). Other code is executed after setting interp->sysdict to NULL (clearing interp->sysdict content, interp->builtins, interp->builtins_copy and interp->importlib) and this potentially can emit warnings.
It looks like the problem is that raising the PyExc_RecursionErrorInst singleton creates a traceback object which contains frames. The singleton keeps the frames alive longer than expected.
I tried to write a script to raise this singleton, but it looks like the local variables of the frames are not deleted, even if frames are deleted (by _PyExc_Fini).
You may try to finish my attached runtimerror_singleton.py script.
Oh, I also wrote a draft of patch fixing the issue, but I was unable to reproduce the issue. See attached warn.patch (not tested).
The attached script raises the PyExc_RecursionErrorInst singleton and reproduces the issue.
The attached patch fixes the issue by ignoring the warning when clearing PyExc_RecursionErrorInst and clearing the frames associated with its traceback, in _PyExc_Fini().
+ /* during Python finalization, warnings may be emited after interp->sysdict
+ is cleared: see issue #22898 */
I would prefer to see this comment in the else block.
> + /* during Python finalization, warnings may be emited after interp->sysdict
> + is cleared: see issue #22898 */
>
> I would prefer to see this comment in the else block.
Indeed.
New updated patch attached.
Why recursion limit is restored? Couldn't the test be simpler without it?
.
> Why recursion limit is restored? Couldn't the test be simpler without it?
For the sake of explicitness, so that the interpreter will not raise a RuntimeError during finalization when checking for the recursion limit after g.throw(MyException) has raised PyExc_RecursionErrorInst.
> .
Thanks.
New patch attached.
The reason why the PyExc_RecursionErrorInst singleton keeps the frames alive longer than expected is that the reference count of the PyExc_RecursionErrorInst static variable never reaches zero until _PyExc_Fini(). So decrementing the reference count of this exception after the traceback has been printed in PyErr_PrintEx() does not decrement the reference count of its traceback attribute (as it is the case with the other exceptions) and the traceback is not freed. The following patch to PyErr_PrintEx() does that. With this new patch and without the changes made by warn_4.patch, the interpreter does not crash with the runtimerror_singleton_2.py reproducer and the ResourceWarning is now printed instead of being ignored as with the warn_4.patch:
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1876,6 +1876,8 @@
PyErr_Display(exception, v, tb);
}
Py_XDECREF(exception);
+ if (v == PyExc_RecursionErrorInst)
+ Py_CLEAR(((PyBaseExceptionObject *)v)->traceback);
Py_XDECREF(v);
Py_XDECREF(tb);
}
If both patches were to be included, the test case in warn_4.patch would test the above patch and not the changes made in Python/_warnings.c.
out can be b'Done.\r\n'. Use self.assertIn.
> If both patches were to be included, the test case in warn_4.patch would test the above patch and not the changes made in Python/_warnings.c.
You can test err for warning message.
The traceback should be cleared before decrementing the reference count. And only if Py_REFCNT(v) is 2.
With warn_4.patch applied I can no longer reproduce my original segfault, looks like the fix works.
>.
Out of curiosity I have tried to figure out how to build another test case using the model provided by runtimerror_singleton.py. This cannot be done, and for the following reasons:
The infinite recursion of PyErr_NormalizeException() is supposed to occur as follows: when a RuntimeError caused by recursion is normalized, PyErr_NormalizeException() calls the RuntimeError class to instantiate the exception, the recursion limit is reached again, triggering a new RuntimeError that needs also to be normalized causing PyErr_NormalizeException() to recurse infinitely.
But the low/high water mark level heuristic of the anti-recursion protection mechanism described in a comment of ceval.h prevents this. Let's assume the infinite recursion is possible:
* At iteration 'n' of the infinite recursion, the instantiation of the RuntimeError exception fails because of recursion with a new RuntimeError and tstate->overflowed is true: PyErr_NormalizeException() recurses.
* At iteration 'n + 1', the instantiation of this new RuntimeError is successfull because the recursion level is not checked when tstate->overflowed is true: the recursion of PyErr_NormalizeException() terminates and infinite recursion is not possible.
This explains the paradox that, if you remove entirely the check against infinite recursion in PyErr_NormalizeException(), then the runtimerror_singleton_2.py reproducer does not crash and the ResourceWarning is printed even though the recursion limit has been reached.
The attached patch implements this fix, includes the previous changes in _warning.c, and moves the test case to test_exceptions.
History (for reference):
The PyExc_RecursionErrorInst singleton was added by svn revision 58032 [1] to fix the issue titled "a bunch of infinite C recursions" [2].
In parallel, changeset cd125fe83051 [3] added the 'overflowed' member to the thread state.
Interestingly changeset cd125fe83051 was committed before revision 58032, but the whole discussion on issue [2] took place well before this commit was done, and so the fact that the infinite recursion problem of PyErr_NormalizeException() was being fixed by changeset cd125fe83051 as a side effect, went unnoticed.
[1]
[2]
[3]
When tstate->overflowed is already set to 1 before entering PyErr_NormalizeException() to normalize an exception, the following cases may occur:
1) Normalizing a built-in exception => instantiation ok.
2) Normalizing a python exception that fails with a built-in exception => next recursion of PyErr_NormalizeException() ok.
3) Normalizing a python exception that fails with a python exception that fails with a python exception and so on infinitely...
=> PyObject_Call() never returns and the interpreter aborts with a fatal error when the high warter mark is exceeded, the infinite recursion is in PyObject_Call().
4) Normalizing a python exception defined in an extension module and the instantiation returns NULL and sets the same exception:
a) Without any patch, we get a segfault caused by another bug in PyErr_NormalizeException() at Py_DECREF(*val), just before setting val to PyExc_RecursionErrorInst.
This is fixed by changing Py_DECREF(*val) to Py_XDECREF(*val).
With the above fix, we get the same abort as the one caused by runtimerror_singleton_2.py, so this is another reproducer of the current issue.
b) The test is ok with patch warn_5.patch, and the above fix.
c) With patch remove_singleton.patch the interpreter aborts with a fatal error when the high warter mark is exceeded, the infinite recursion is in PyErr_NormalizeException().
Cases 3) and 4) can be tested with runtimerror_singleton_3.py (install mymodule with setup.py for all three test cases in 4).
remove_singleton.patch introduces a regression in case c), but IMHO the abort in case c) is consistent with the abort in case 3), they
are both related to a more general problem involving the low/high water mark heuristic and described by Antoine in [1].
[1]
I tried the following script on Python 3.5 and Python 3.6 and I failed to reproduce the bug:
---
import sys, traceback
class MyException(Exception):
def __init__(self, *args):
1/0
def gen():
f = open(__file__, mode='rb', buffering=0)
yield
g = gen()
next(g)
recursionlimit = sys.getrecursionlimit()
sys.setrecursionlimit(len(traceback.extract_stack())+3)
try:
g.throw(MyException)
finally:
sys.setrecursionlimit(recursionlimit)
print('Done.')
---
Note: I had to add "+3" to the sys.setrecursionlimit() call, otherwise the limit is too low and you get a RecursionError (it's a recent bugfix, issue #25274).
Can somone else please confirm that the bug is fixed?
When tested with runtimerror_singleton_3.py (see msg 231933 above), the latest Python 3.6.0a0 (default:3eec7bcc14a4, Mar 24 2016, 20:16:19) still crashes:
$ python runtimerror_singleton_3.py
Importing mymodule.
Traceback (most recent call last):
File "runtimerror_singleton_3.py", line 26, in <module>
foo()
File "runtimerror_singleton_3.py", line 23, in foo
g.throw(MyException) # Entering PyErr_NormalizeException()
File "runtimerror_singleton_3.py", line 14, in gen
yield
RecursionError: maximum recursion depth exceeded
Segmentation fault (core dumped)
warn_5.patch: The patch cannot be reviewed on Rietveld :-( You must not use the git format for diff.
warn_5.patch: "if (globals == NULL) { (...) return 0; }"
It looks like filename is not initialized. I suggest to use:
*filename = f->f_code->co_filename;
It looks like you have to add:
if (PyUnicode_Check(*filename)) *filename = NULL;
To mimick the code below.
Victor,
With warn_5.patch *filename is not set when globals is NULL: setup_context() returns 0, and so do_warn() returns NULL without calling warn_explicit().
This is different from your initial warn.patch where setup_context() returns 1 in that case and an attempt is made to issue the warning.
The issue #17852 is still alive and has a reference to this issue. It would be nice to rebase the latest patch on master and create a PR ;-)
With PR 1981, a ResourceWarning is printed when a RecursionError occurs while normalizing another exception and its traceback holds a reference to a non-closed file object.
For information, issue 5437 removed the MemoryError singleton for the same reasons as PR 1981 does.
Antoine asked in PR 1981:
> Did you verify the removed code here wasn't needed anymore?
Just checked that crasher infinite_rec_2.py (removed by 1e534b5) does not crash with PR 1981. The other crashers listed at 1e534b5 are not valid Python 3.7 code. Does anyone know how to translate them into Python 3.7 ?
With PR 1981 infinite recursion does not occur in PyErr_NormalizeException() when the tstate->overflowed flag is false upon entering this function and:
* either (obviously) the normalizing of this exception does not fail
* or the normalizing of this exception fails with an exception whose normalization won't fail (for example a RecursionError).
Removing the PyExc_RecursionErrorInst singleton decreases the cases covered by the recursion checks because the test made upon using PyExc_RecursionErrorInst (in the 'finally' label of PyErr_NormalizeException()) has the side effect of adding another recursion check to the normal recursion machinery of _Py_CheckRecursiveCall(). Those are corner cases though, such as for example the following case that will abort instead now with PR 1981 [1]:
* tstate->overflowed has been set to true outside PyErr_NormalizeException() and the corresponding RecursionError has been discarded
* PyErr_NormalizeException() attempts normalizing a python exception that raises a python exception that raises ... (and so on indefinitely)
IMO it is ok to abort in such cases. As Brett wrote 9 years ago in:
"I have always viewed the check as a bonus sanity check, but not something to heavily rely upon."
One can also note that this other recursion check added with the use of PyExc_RecursionErrorInst does not respect the tstate->overflowed flag so that it adds another level of complexity to the recursion machinery.
[1] But with PR 1981, a RecursionError is raised when replacing MyException in test_recursion_normalizing_exception() at Lib/test/test_exceptions.py with:
class MyException(Exception):
def __init__(self):
raise MyException
The fact that the traceback of PyExc_RecursionErrorInst causes an issue means that PyExc_RecursionErrorInst is used. We can't just remove PyExc_RecursionErrorInst since this can cause a stack overflow or, with merged PR 2035, an infinite loop.
Perhaps the solution of this issue is clearing __traceback__, __cause__ and __context__ attributes of PyExc_RecursionErrorInst as early as possible.
The simplest solution -- make BaseException_set_tb(), BaseException_set_context() and BaseException_set_cause() no-ops for PyExc_RecursionErrorInst.
> We can't just remove PyExc_RecursionErrorInst since this can cause a stack overflow
Please give an example where a stack overflow occurs when PyExc_RecursionErrorInst has been removed.
Fixed by issue 30697.
|
https://bugs.python.org/issue22898
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
The System.Data.SqlTypes namespace contains classes for SQL Server's native data types, such as money , tinyint , and varchar . These classes can provide faster access (because typecasting isn't required), and eliminate conversion errors. Chapter 5 describes the DataReader methods you can use to retrieve database values in their native format. However, this technique is rarely required. Figure 38-1 shows the types in this namespace.
|
https://flylib.com/books/en/1.110.1.352/1/
|
CC-MAIN-2019-47
|
en
|
refinedweb
|
On Tuesday 03 June 2003 22:29, Joerg Heinicke wrote:
JH> 1: A solution for the HTMLSerializer was discussed
JH> (startPrefixMapping(), endPrefixMapping()). Maybe TidySerializer
JH> provides a better solution, but I guess this can be adapted too.
A little more would be nercessary. You would have to map all xhtml namespace
to default prefix and remove the declaration. All other namespaces would have
to generate an error. When I know someone will commit it, I can make this
patch for HTMLSerializer.
JH> 2: Human readability is as you say for debugging reasons. This needs not
JH> to be done on live systems. We use IMO a better way: on the last
JH> transformer step we add a label="format". We access a page in debugging
JH> mode via test.html?cocoon-view=format. The view "format" is simply a
JH> further transformer step using format.xsl and the XMLSerializer. The
JH> different between live and debugging mode is the URL, not the sitemap.
JH> And there is no need for second component.
You can use tidyserializer for the same via views. For this purpose, a
stylesheet would also be OK. But it wouldn't be simply indenting. You have to
check for xml:strip-space and friends. That's why I haven't done it so far.
JH> 3: Also only for debugging, isn't it?
Yesno. I want it as part of quality assurance.
JH> Validating every request on live systems is too much resource consuming.
Not that real, when it (hopefully) is integrated in xalan some time. For xslt
2.0 type handling, there has to be (IMHO) validation inside. It only has to
be forceable for output.
JH> And what do you want to do on
JH> live systems when a validation error occurs? A message "We can't deliver
JH> the page, because it's not valid HTML"?
Redirecting to a internal error page, like with other errors to.
JH> But you have other
JH> possibilities, e.g. using or a mix of Jakarta
JH> commons httpclient with Tidy as we did. If you integrate this in a test
JH> system you can validate your pages automatically.
That's what I actually do more or less. I validate all generated files via
xmllint. I am looking for a cleaner solution which enforces this already in
cocoon. When this is a parameter or a view, even better.
Regards
Torsten
--
Domain in provider transition, hope for smoothness. Planed date is 1.7.2003.
|
http://mail-archives.apache.org/mod_mbox/cocoon-dev/200306.mbox/%[email protected]%3E
|
CC-MAIN-2017-30
|
en
|
refinedweb
|
I want to do something like this:
@Stateless
@Path("/sensors/{sensorid}/version")
@Consumes({MediaType.APPLICATION_XML, MediaType.TEXT_XML})
@Produces({MediaType.APPLICATION_XML, MediaType.TEXT_XML})
public class SensorVersionRestView extends VersionRestView{
@PathParam("sensorid")
private String sensorid;
@GET
@Path("count")
...
I have been working with Jersey for a couple weeks now, and I have been impressed with how it implements dependency injection and how it can be extended to let developers ...
I was looking at a good REST tutorial using jersey,
Down the page, there is a web resource that is built, which is entitled 'TodoResource'. There are 2 instance ...
I have a Resource class where almost all methods accept a variable of Foo type as parameter. At the start of every request I need to work on this object. Is ...
I have a custom InjectionProvider which retrieves a User object from the SecurityContext and makes it available. A custom ResourceFilter performs the HTTP Basic authentication, creates the SecurityContext and populates it ...
User
ResourceFilter
I did try going through the following links
How to wire in a collaborator into a Jersey resource?
and
Access external objects in Jersey Resource class
But still i am unable to ...
|
http://www.java2s.com/Questions_And_Answers/Java-Enterprise/jersey/inject.htm
|
CC-MAIN-2017-30
|
en
|
refinedweb
|
Im new the the shallow copy/deep copy concept. I need a little help understanding whats actually going on in this implementation:
Code :
public class Stack1 { private Object value; private Stack1 rest; private boolean empty; public boolean isEmpty() { return empty; } public Stack1() { value = null; rest = null; empty = true; } private Stack1(Stack1 other){ //Make fields of this object point to the same objects in another stack's fields i.e. shallow copy this.value = other.value; this.rest = other.rest; this.empty = other.empty; } public void push(Object x){ this.rest = new Stack1(this); //What's going on here? this.value = x; this.empty = false; }
In the push method we make a shallow copy on the RHS which means that there is some object whose fields are referencing the same memory blocks as our current stack object (this). But we then go ahead and say, ok now take our current object (this) and set its rest to be this copy. But this.rest has just been altered, doesn't that mean the object copy's rest will be referencing itself? so its like some kind of infinite loop now???
Thanks
|
http://www.javaprogrammingforums.com/%20algorithms-recursion/14692-stack-implementation-shallow-copy-printingthethread.html
|
CC-MAIN-2017-30
|
en
|
refinedweb
|
40
Joined
Last visited
Community Reputation307 Neutral
About teccubus
- RankMember
teccubus replied to gamedevnoob's topic in For BeginnersThis article may be helpful:
- [quote name='Aks9' timestamp='1356700288' post='5015056'] The specification is not a book, and should not be recommended for learning OpenGL! [/quote] O, rly? I learned OpenGL 4.3 entirely from specification.
- The only book you need is GL 4.3 specification, from
teccubus replied to Darego's topic in For BeginnersDarego: you just CAN'T make a MMOsomething. Writing coherent, stable, secure and efficient server for 1000+ players is very hard and expensive.
teccubus replied to EduardoMoura's topic in For BeginnersI think it is entirely project-dependent. When you are evaluating project design issues, you have to make some choices - for example, what 3rd party components you will be reusing. If existing C# libraries satisfy your needs, then you should choose C#, because it's obviously easier to develop with this language. If there are no C# libraries you can reuse, you should choose C++ in that project. And, personally, I think that if C# is so great, then good libraries will show up sooner or later. But perhaps it is not that great...
teccubus replied to ChainedHollow's topic in For Beginners[code] /* header.h */ #ifndef _HEADER_H_INCLUDED_ #define _HEADER_H_INCLUDED_ /* code goes here */ #endif [/code]
teccubus replied to Millionaire's topic in For Beginners[quote name='Millionaire' timestamp='1355654760' post='5011221'] I was just wondering why would this user want to use a math engine written in C [/quote]Probably because doing low level math is faster in C than in Java.
teccubus replied to Sugavanas's topic in For BeginnersHere you go: It's far better than tic-tac-toe.
- [quote name='Revs' timestamp='1355578436' post='5010937'] But I already have other things to which I dedicate my devotion, where I do everything myself from scratch. So there's no time left for me to spend some more devotion on another thing ;) [/quote]And that's why you should forget about making games.
teccubus replied to suliman's topic in For Beginners@ultramailman: This issue happens and I don't understand why. Object files should be recompiled whenever any of the dependencies is changed. So, why the are not?
- Revs: no offence taken. Game development needs *real* devotion, especially if you want to do it alone. But your attitude is just opposite.
- With your knowledge and attitude, it is infinitely hard.
teccubus replied to Inuyashakagome16's topic in For BeginnersIf you can't remember method names, use IDE with autocompletion.
teccubus replied to juur's topic in For Beginners[quote name='juur' timestamp='1355487196' post='5010574'] (NB: It requires Java to be installed) [/quote] People don't like java applets nowadays.
teccubus replied to ChainedHollow's topic in For BeginnersJust read this: and start to code.
|
https://www.gamedev.net/profile/82811-j-evolas-apprentice/?tab=friends
|
CC-MAIN-2017-30
|
en
|
refinedweb
|
"Tino Dai" <tinoloc at gmail.com> wrote Your code confused me on several counts but in general... > I have a question about restarting a part of the program after > it dies. > I have a driver program that instantiates a class and runs methods > from that > class. Occasionally, the method gets bad data and it bombs out. > Instead of > bombing out, I would like the program to grab new data and start the > processing. I already have the try except block ready, but I'm > unsure about > how to restart the method itself. Is it just as easy as > self.someMethod() or > do I need to do something to the namespace to insure that I don't > get > leakage from the past running of the method. You generally can just call the method, there should be no "leakage" because you are not reloading the module just accessing one of its attributes - the method. Restart from the calling function not from the method itself of course! Thus you need a try/except in the driver section of your code and you need to do a raise in the implementation section after writing to sys.stdout... > Driver Section: > ap=apacheModule.apacheModule(configXML,putInDB="1") > while 1: > rVs=ap.perf() > for anObj in self.objList: Not sure what the last line signifies but you need to wrap the call to perf() in a try/except (if its perf that is failing - its not totally clear where the crash occurs). > Class Section (apacheModule module): > > def perf(self): > <..stuff deleted..> > self.putMethod: This is nonsensical syntax wise I have no idea what you are trying to suggest. Is it a call to self.putMetthod()? Or is it a branch: if self.putMethod: I'm assuming an if statement given what follows... > # putMethod is a variable controlled by an XML file, > assume > this is always true > return self.put(self.parse(lines)) If its put() that fails you could put the try/except here instead of the driver section. The question is whether you have the information needed to repair the damage or move onto the next data item(aka datum)? > else: > return self.parse(lines) > > def put(self,rVs): > <..stuff deleted> > try: > > (totalAccess,totalTraffic)=(rVs[3][1],self.sizeConvert > (rVs[3][3],rVs[3][4])) > > (userUsage,sysUsage,cuserUsage,csysUsage,cpuLoad)=(rVs[4][1],rVs[4][2],rVs[4][3],rVs[4][4],rVs[4][6]) > (requestsSec,bandwidth,perRequest)=(rVs[5][0], > self.sizeConvert(rVs[5][1],rVs[5][2]),self.sizeConvert(rVs[5][3],rVs[5][4])) > (requestsProc,idle)=(rVs[6][0],rVs[6][1]) > except Exception,e: > datetime.datetime.now() > sys.stdout.write(str(e) + "\n") > sys.stdout.write(rVs) > <..stuff deleted..> You need to add a raise here to force the exception up to the next level of detection. HTH, -- Alan Gauld Author of the Learn to Program web site
|
https://mail.python.org/pipermail/tutor/2007-July/055725.html
|
CC-MAIN-2017-30
|
en
|
refinedweb
|
getchar - get a byte from a stdin stream
#include <stdio.h> int getchar(void);
The getchar() function is equivalent to getc(stdin).
Refer to fgetc().
Refer to fgetc().
None.
If the integer value returned by getchar() is stored into a variable of type char and then compared against the integer constant EOF, the comparison may never succeed, because sign-extension of a variable of type char on widening to integer is implementation-dependent.
None.
getc(), <stdio.h>.
Derived from Issue 1 of the SVID.
|
http://pubs.opengroup.org/onlinepubs/007908775/xsh/getchar.html
|
CC-MAIN-2017-30
|
en
|
refinedweb
|
I have recently been working with a customer on a Windows Vista to Windows 7 migration. During the Refresh deployment task sequence, BitLocker is suspended on the C and D partitions. On occasion we had issues where by protection was not always successfully being suspended on the D partition, which caused the user to be prompted for the recovery key to access D once the deployment had completed. This led me to write a script that checks the protection status of the drives before continuing with the deployment.
A brief overview of the script:-
Firstly we need to use WMI to select the objects from Win32_Volume. This allows us to use the DeviceIDs to establish the protection status.
The \root\CIMV2\Security\MicrosoftVolumeEncryption namespace contains the Win32_EncryptableVoulume class, from which we can select the DeviceID property and use the GetProtectionStatus method.
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2\Security\MicrosoftVolumeEncryption")
Set objEncryptVol = objWMIService.Get("Win32_EncryptableVolume.DeviceID='" & strDeviceID & "'")
Set objOutParams = objWMIService.ExecMethod("Win32_EncryptableVolume.DeviceID='" & strDeviceID & "'", "GetProtectionStatus")
The protection status can then be evaluated based on the integer values returned. Windows 7 uses the following protection status values:
· Protection Status 0 : Protection OFF
· Protection Status 1 : Protection ON (Unlocked)
· Protection Status 2 : Protection ON (Locked)
This post was contributed by Matt Bailey, a
ZTI-CheckBitLockerSuspended.zip
Les DeploymentGuys nous apportent encore un nouveau script permettant de vérifier l’état
So — in a refresh scenario — is this a problem with Windows Vista, when the task sequence is initiated from the full OS? What was the method the customer was using to suspend Bitlocker, and why was it failing?
Thanks for the script -- good to know that this is a potential issue.
Cheers,
Trevor Sullivan
I don't think this is a problem with Vista, more likely something specific to the customer environment. Unfortunately the issue was very difficult to reproduce and we decided to put this solution in to capture the error should it re-occur. Hopefully the script has more uses outside of the specific issue I was invesitgating.
|
https://blogs.technet.microsoft.com/deploymentguys/2011/11/04/bitlocker-protection-status/
|
CC-MAIN-2017-30
|
en
|
refinedweb
|
2.6.32-stable review patch. If anyone has any objections, please let us know.------------------From: Ian Campbell <[email protected]>commit b4606f2165153833247823e8c04c5e88cb3d298b upstream.I have observed cases where the implicit stop_machine_destroy() done bystop_machine() hangs while destroying the workqueues, specifically inkthread_stop(). This seems to be because timer ticks are not restarteduntil after stop_machine() returns.Fortunately stop_machine provides a facility to pre-create/post-destroythe workqueues so use this to ensure that workqueues are only destroyedafter everything is really up and running again.I only actually observed this failure with 2.6.30. It seems that newerkernels are somehow more robust against doing kthread_stop() without timerinterrupts (I tried some backports of some likely looking candidates butdid not track down the commit which added this robustness). However thischange seems like a reasonable belt&braces thing to do.Signed-off-by: Ian Campbell <[email protected]>Signed-off-by: Jeremy Fitzhardinge <[email protected]>Signed-off-by: Greg Kroah-Hartman <[email protected]>--- drivers/xen/manage.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)--- a/drivers/xen/manage.c+++ b/drivers/xen/manage.c@@ -79,6 +79,12 @@ static void do_suspend(void) shutting_down = SHUTDOWN_SUSPEND; + err = stop_machine_create();+ if (err) {+ printk(KERN_ERR "xen suspend: failed to setup stop_machine %d\n", err);+ goto out;+ }+ #ifdef CONFIG_PREEMPT /* If the kernel is preemptible, we need to freeze all the processes to prevent them from being in the middle of a pagetable update@@ -86,7 +92,7 @@ static void do_suspend(void) err = freeze_processes(); if (err) { printk(KERN_ERR "xen suspend: freeze failed %d\n", err);- goto out;+ goto out_destroy_sm; } #endif @@ -129,7 +135,11 @@ out_resume: out_thaw: #ifdef CONFIG_PREEMPT thaw_processes();++out_destroy_sm: #endif+ stop_machine_destroy();+ out: shutting_down = SHUTDOWN_INVALID; }
|
http://lkml.org/lkml/2009/12/16/738
|
CC-MAIN-2017-30
|
en
|
refinedweb
|
19 November 2012 07:41 [Source: ICIS news]
SINGAPORE (ICIS)--?xml:namespace>
A security deposit ranging from 6.6% to 37.7% will be levied on products imported from producers such as Bayer MaterialScience and Dow Chemical Tarragona, according to the ministry.
However, this will not impact significantly on the domestic supply-demand situation as TDI imports from the EU and other countries have decreased after a sharp increase in capacity in the domestic market, according to Lv Guohui, the deputy secretary-general of China Polyurethane Industry Association (CPUIA).
Many multinational corporations have shifted a large part of their TDI production to
Despite the limited impact on the supply-demand situation, the temporary antidumping measure is expected to help to stabilise the prices in the domestic TDI market, a Hebei-based TDI producer said.
In the future, Chinese TDI producers are expected to mostly face domestic competition, with imports shrinking and domestic capacity expanding rapidly. Local producers must then cut costs and improve their products’ quality through innovations in technology, management and marketing to be competitive, an industry market source said.
|
http://www.icis.com/Articles/2012/11/19/9615232/chinas-tdi-market-little-affected-by-antidumping-levy-on-eu-imports.html
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
Would it make more sense to test A/B for a couple of days, then take the winner (e.g. A) and test A/C, and so on down the line, or, should I run A/B/C/D.../Z concurrently for a longer period of time and slowly weed the non performing banners (in terms of clicks) out? I would imagine that A/B ->A/C would yield more of an incremental return (since we always keep the higher performing banner in play throughout the whole testing phase) vs A/B/C/D..Z at the same time which would take longer to find the clearer performer? Can someone validate or dis-validate that theory?
thanks!
|
http://www.webmasterworld.com/analytics/3790781.htm
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
when i try to add a node i cant set it position on the map. it always stay on the cursor. see screens
Hi,
Sorry for interrupting, but I'm struggeling with trying to remove this ZenPack.
I think I managed to mess this up quite badly as I upgraded Zenoss to 3.0 when this ZenPack was marked as broken.
Now I'm unable to remove it.
Is there something short of reinstalling that I can do to remove this Zenpack and recover?
Best regards
mario;
I believe that I have fixed those issues. They appear to be because zenoss 3 uses Ext rather than YUI. I modified as many calls as I could to use Mochikit instead, since that seems to be common between the two versions.
Unfortunately however, my boss has decided that Zenoss is not going to fit our needs sufficiently enough to make my continued development on this worthwhile. I will try to answer any further questions posted, but there probably will not be any further development on this zenpack unless it is on my own time.
If anybody wants to take over this project, be my guest. I can probably get permission to license it in whatever form is desired, although a gpl license is probably most likely.
It would help if you told me what you had problems removing. The zenpack inserts a tab in the Location objects, and adds a custom_map object to them as well. If you delete these additions, and remove the zenpack itself, then all traces of the zenpack should be gone. Somewhere in the history of this thread is the code to do this (you aren't the first person to ask about it
)
I thank you for your effort of developing a feature that’s zenoss core lack.
Thanks for the reply.
I have tried to do what you outlined in the earlier message but it does not work for me. (And I'm not sure I did it right
)
If I try:
zenpack --remove=ZenPacks.USU.Map
I get:
ERROR:zen.ZenPackCmd:zenpack command failed
Traceback (most recent call last):
File "/usr/local/zenoss/zenoss/Products/ZenUtils/zenpack.py", line 406, in <module>
zp.run()
File "/usr/local/zenoss/zenoss/Products/ZenUtils/zenpack.py", line 168, in run
self.options.removePackName)
File "/usr/local/zenoss/zenoss/Products/ZenUtils/ZenPackCmd.py", line 812, in RemoveZenPack
zp.remove(dmd, leaveObjects)
File "/usr/local/zenoss/zenoss/ZenPacks/ZenPacks.USU.Map-0.1.2010.08.06-py2.6.egg/ZenPacks/USU/Map/__init__.py", line 95, in remove
ZenPackBase.remove(self, app)
File "/usr/local/zenoss/zenoss/Products/ZenModel/ZenPack.py", line 291, in remove
loader.unload(self, app, leaveObjects)
File "/usr/local/zenoss/zenoss/Products/ZenModel/ZenPackLoader.py", line 113, in unload
objs = pack.packables()
AttributeError: packables
I originally had an earlier version of your plugin installed. I tried upgrading it in the hope that it would fix my problem, but unfortunately it did not.
Possibly as a side effect of this problem I cannot get at my locations in the GUI. Is there a way to delete the added tab from zendmd?
zenpack --remove=ZenPacks.USU.Map
You can always try a manual remove in zendmd. I suggest you look through this code a bit so you understand what it is doing before you try it:
def procLoc(l): #this should remove the Custom Map Tab in the location suborganizers finfo = l.factory_type_information actions = list(finfo[0]['actions']) for a in actions: if a['id'] == 'custommaptab': actions.remove(a) finfo[0]['actions'] = tuple(actions) l.factory_type_information = finfo break if hasattr(l, 'custom_map'): del l.custom_map for c in l.children(): procLoc(c) procLoc(dmd.Locations) commit()
After that, just remove the /usr/local/zenoss/zenoss/ZenPacks/ZenPacks.USU.Map directory.
Possibly as a side effect of this problem I cannot get at my locations in the GUI. Is there a way to delete the added tab from zendmd?
The zenpack hopefully wouldn't cause that, but I suppose you never know. What version of zenoss are you using? Are the Locations there at all? What is the value of dmd.factory_type_information?
Hi,
I finally found the time to try your code. I tried to understand it, but unfortunately it's a bit over my head :-)
I decided to give it a shot anyway and pasted it in. Unfortunately it gives me an error when I get down near the end of it:
... for c in l.children():
... procLoc(c)
... procLoc(dmd.Locations)
File "<console>", line 15
procLoc(dmd.Locations)
^
SyntaxError: invalid syntax
I'm using version 3 of Zenoss.
The infrastructure tab shows 'Locations', but it has no '+' sign in front of it, so I cannot expand it.
How do I find the dmd.factory_type_information value that you requested? (and what is it?)
Thanks for being patient with me.
Sorry about my last post.
I didn't realize that the blank line of code was significant. What can I say, I'm used to perl :-)
Unfortunately, 'zenpack --list' still show:
ZenPacks.USU.Map (broken)
and it does nothing to my locations problem.
try:
i also manage to test the uninstall process using your recommendations and it work using the bogusarg in _init_.py.
def remove(self, app, bogusarg):
if hasattr(ZentinelPortal, 'customMapRPC'):
del ZentinelPortal.customMapRPC
ZenPackBase.remove(self, app)
self._unregisterCustomMapTab(app)
zpm = app.zport.ZenPortletManager
zpm.unregister_portlet('MapPortlet')
also using ths _delObject property the objects of the zenpack can be removed using zendmd. With this i manage to reinstall the zenpack.
dmd.ZenPackManager.packs._delObject('ZenPacks.USU.Map')
I hope you still get time to work on this!!! I did not try your last attachment yet but this is one functionality which I find lacking in Zenoss which I would like!!
How do I use or add the custom maps? I'm running 3.0.1 of Fedora 13.
Steve
download the last egg attached to one of the previous posts, and then use the install zenpack option in zenoss, and pray. The install code is a little shakey, and I never got a chance to completely test it before my boss nixed the project.
hello,
I'm a new user of zenoss and I'm very interested on creating custom map, specially with integration of google earth
Is it possible with your zenpack
Really, I dont understand very well the functionality of your zenpack!!!
for example, is the custom map able to draw links and change color automatically like google maps when an event occur??
thks for help
This pack is complex and buggy. I'm not sure it even works under v3. What are you looking to do?
Best,
--Shane
|
http://community.zenoss.org/message/60353
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
Dec 22, 2006 10:36 AM|brazen|LINK
Friends being a newbie in asp.net I have been layin my hands on this problem for quiet sometime now...hope I find my answer here..
First things first..
I have a gridview which is bound to a SQLDatasource1.In the gridview we have two dropdown(dropdownlist1 and dropdownlist2) Template fields.
Now one of the template field is bound to a datasource SQL datasource2 while the other contains a list of data hardcoded.
Now my requirement is to update the datasource bound to the gridview with the data selectd with the dropdownlist.
Now the dropdownlist is bound to a column called vendorname contained in vendormaster table.
The gridview is bound to a table called request which also contains a column called vendorname..however this column is empty..ie has no data in any row..simply ' '.........
My requirement is to b able to update the request table by selecting values from the two dropdownlist in the gridview..instead i end up with this error...
"'DropDownList2' has a SelectedValue which is invalid because it does not exist in the list of items"
After going thru a few posts I understand that its due "no values" present in the "request" table for "vendormaster" column.
I then tried hardcodin the values for dropdownlist1 as i have for dropdownlist2..Interesting it now gives the same error for dropdownlist2....
when i removed dropdownlist2 from the gridview things work abs fine....but guys I need to have both the dropdownlist and above that I need to bind my dropdwnlist1 to a datasource.......
How do I accomplish this update....any help wll b highly apreciated..here is the part my code.......
<asp:GridView <Columns> <asp:BoundField <asp:BoundField <asp:BoundField <asp:TemplateField <EditItemTemplate> <asp:DropDownList <asp:SqlDataSource</asp:SqlDataSource>
</EditItemTemplate> </asp:TemplateField> <asp:TemplateField <EditItemTemplate></EditItemTemplate> </asp:TemplateField> <asp:TemplateField <EditItemTemplate>
'<asp:DropDownList
'<asp:ListItem></asp:ListItem>
'<asp:ListItem</asp:ListItem>
'<asp:ListItem</asp:ListItem>
'<asp:ListItem</asp:ListItem>
'</asp:DropDownList>
'</EditItemTemplate> </asp:TemplateField>
<" />
<asp:Parameter <asp:Parameter <asp:Parameter <asp:Parameter<asp:Parameter <asp:Parameter <asp:Parameter <asp:Parameter
</UpdateParameters></UpdateParameters>
</asp:SqlDataSource></asp:SqlDataSource>
Thanx in advance[:)]
GridView
Dec 22, 2006 02:13 PM|DetroitJ|LINK
Here is an example of a dropdown list from one of my sites that has it's selection values populated from 1 datasource but it's SelectValue is bound to another.
<asp:DropDownList
Dec 23, 2006 04:49 AM|brazen|LINK
I tried using the following code..
<asp:DropDownList
still the same problem....
I think this is hapenning due to the empty string values in the Vendorname column that has been bound to the dropdownlist1.....
I need to replace these empty cells with the data selected from the dropdownlist...
Do i need to write some code for gridview_Itemdatabound or gridview_ItemUpdating to tackle this issue....
Thanx...
Star
9403 Points
Dec 25, 2006 06:48 AM|rexlin|LINK
Hi, brazen:
This is quite a problem if you have not maintained data integrity, and/or if your Select statment in your dropdownlist data source does not include particular values.
Plz have a look at this article and amend your datasource to have a valid datasets.
Jan 04, 2007 03:21 PM|JimAmigo|LINK
I get this same error but the URL Link provided does not help with my scenerio. When I go to edit bindings form my user control The Binding for visible fields are "greyed out" including the two-way databinding.
I have a form view edit item template. I have a user control that makes up two dropdownlists. The user control has two properties that return the slected value.
Cany anyone provide some insight on how to do this through the source code?
Jan 11, 2007 11:27 AM|senor|LINK
I too get this error - my data set IS valid and frustratingly it works sometimes (!)
I have found redoing the dropdownlist on the page sometimes corrects the problem, as occasionally does refreshing the schema, but I am trying to complete a form with 6 of these on and it's like juggling plates - am I doing something wrong? why does it seem so flaky?
Sorry to not offer insight just saying I've got the same problem...
Jan 11, 2007 12:34 PM|heathers|LINK
MS and many coders say this is the correct behaviour, to the rest of us normal people its just a stupid pain in the arse that we could do without.
I add a null to the select command eg "select cola, colb from table1 union select null, null"
Or you can populate the ddl via code, this is VB:
Dim strCON As String, sqlCON As SqlConnection
Dim strSQL As String, sqlCOM As SqlCommand, sqlDRD As SqlDataReader
strCON = ConfigurationManager.ConnectionStrings("con_db_TM").ToString
sqlCON = New SqlConnection(strCON)
sqlCON.Open()
strSQL = "select distinct tr_code_sub from dbo.tbl_transactions " & _
"where tr_code = '" & Me.ddlCode.SelectedValue & "'"
sqlCOM = New SqlCommand(strSQL, sqlCON)
sqlDRD = sqlCOM.ExecuteReader
Me.ddlCodeSub.Items.Clear()
Me.ddlCodeSub.Items.Add("")
With sqlDRD
If .HasRows = True Then
While .Read
Me.ddlCodeSub.Items.Add(.Item(0))
End While
End If
End With
sqlDRD.Close()
sqlCON.Close()
Jan 11, 2007 01:59 PM|JimAmigo|LINK
It works "sometimes" because it can find the value both in the dropdownlist and the table your are binding your details view or form view to.
Let's say you have a dropdownlist with numbers 1 - 9. Then your form view or details view is bound to the data table so you can have the "selected value" displayed when you edit a record. When you view various records some have 1 - 9 in the data table and it can find the value in the dropdownlist and show it as the selected value. Lets say the next record has a 10 or a 0 or is Null, then it can't find a value to show as selected.
I think MS assumes that all db have referential integrity. There are many legacy databases that are not perfect.
So really there are two ways to get by this issue that I've found in the past few week. Either clean up your data in the database and fix all the relationship's or use a user control for the dropdownlist in your application. See this thread for more help with the user control.
Apr 18, 2007 08:49 AM|Broadwood|LINK
Hi There
I've recently come to asp.2 from 1.1 and am still finding my way. I'm getting the same problem 'dropdownlist has a selected value which is invalid' problem. I have basically added a yes and no text value with corresponding 1 and 0 values to the dropdown list. i've bound the value field to the datasource to reflect a binary column field. I'm sorry but i just do not see why this will not work as the value very clearly exists in the list. any ideas on this?
Apr 18, 2007 01:45 PM|DetroitJ|LINK
Member
115 Points
May 01, 2007 09:59 PM|Webmonkeymon|LINK
Thanks DetroitJ
Your first posts help me the most. this one.
>>Here is an example of a dropdown list from one of my sites that has it's selection values populated from 1 datasource but it's SelectValue is bound to another.
see above...
If you are new, some of the posts about this error are quite confusing. I just created a new table in the database that my Dropdown could pull from. a very simple table.
two columns although only one column would have been enough for my situation.
like this
id Locationname
1 Unassigned
2 Location1
3 Location2
4 Location3
Now like what DetroitJ said the list is pulled from our new table but saves the data to the main table. The GenLoc (stands for General Location) is in the main table I am saving to. LocationName is from our new table.
<asp:DropDownList </asp:DropDownList>
the SqlDS_GenlOcation data adapter just selects the items in this small table above
but the selectedValue is bound to the table that does not have values in it yet.
Both DataTextField="LocationName" DataValueField="LocationName" (so the first column is not necessary for me, because I am using a dataform. I am already in the record.)
Then I put this in the code behindProtected Sub FVWorkspace_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FVWorkspace.DataBound If Me.FVWorkspace.CurrentMode = FormViewMode.Edit Then
Dim ddl As DropDownList = CType(Me.FVWorkspace.FindControl("DDGenLoc"), DropDownList)
ddl.Items.Insert(0, New ListItem("Unassigned", "0"))
End If
End Sub
Also in my main table I populated the entire GenLoc column with the string "Unassigned" well only where the rows do not have values.
This is the easiest way out of this mess. If you can't beat it join it. put the data it wants in the tables.
forget the if null then crap. Its a pain.
Member
115 Points
May 01, 2007 10:05 PM|Webmonkeymon|LINK
I take part of that back.
You do not even need that code behind section.
just delete
Protected Sub FVWorkspace_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FVWorkspace.DataBound
If Me.FVWorkspace.CurrentMode = FormViewMode.Edit Then
Response.Write("test") Dim ddl As DropDownList = CType(Me.FVWorkspace.FindControl("DDGenLoc"), DropDownList)
ddl.Items.Insert(0,New ListItem("Unassigned", "0")) End If
Member
2 Points
Jun 21, 2007 05:04 PM|cosmin.onea|LINK
Hi,
I encountered the same problem today but I think there is another more elegant solution than updating all the tables. Having a null value in a column is a common requirement.
All the list controls have a property called AppendDataBoundItems which is a boolean. If you set it to true than all the items that you add to the control before data binding will be preserved.
So in our case I think we could do something like:
<asp:DropDownList
<asp:ListItem
</asp:DropDownList>
After you databind the control you'll still have the Please select item.
I didnt try it yet but I think this is the way to go around null values. I'll give it a try and let you know.
Regarding broken foreign keys, you might want to write custom code to handle it.
Cosmin.
Aug 01, 2007 10:37 PM|mhlove|LINK
I solved this issue on my project by making my itemTemplate and EditItemTempates bound to different names<asp:TemplateField <EditItemTemplate> <asp:DropDownList <asp:ListItem(--Select One--)</asp:ListItem> </asp:DropDownList> </EditItemTemplate> <ItemStyle Width="250px" /> <ItemTemplate> <asp:Label</asp:Label> </ItemTemplate> </asp:TemplateField>
Member
4 Points
Apr 15, 2008 10:25 AM|afreshpulse|LINK
I fixed this issue by setting up my DropDownList like this:
<asp:DropDownList <asp:ListItemPlease Select</asp:ListItem> </asp:DropDownList>Then setting the default value in the database to 0, which sets the default selected item to "Please Select"
Apr 16, 2008 10:05 PM|mhlove|LINK
look over this code in detail to see the changes... Add the changes to your code and see if this works... it sound like you have vaules in your table that are Null or have no value, so in the dropdown list i added <asp:ListItemSelect</asp:ListItem> . The word Select will be the default that shows at the top of the list with a value of Nothing. See the Value="". I hope this helps.
<asp:DropDownList
<asp:ListItem></asp:ListItem>
<asp:ListItemSelect</asp:ListItem>
<asp:ListItem</asp:ListItem>
<asp:ListItem</asp:ListItem>
<asp:ListItem</asp:ListItem>
</asp:DropDownList>
Apr 16, 2008 10:07 PM|mhlove|LINK
Apr 16, 2008 10:14 PM|acmassie|LINK
mhlove--thanks for the suggestion, unfortunately null or blank values are not my problem--this is still in design phase, I only have 5 recs in the database, trust me, no nulls or blanks in the field I'm using. I think I'm going to tear it down and start again--amazingly that works a lot with .NET (from the same folks who brought you Shut Down--Reboot in Windows! [:)]
Aug 24, 2008 01:56 AM|bartekm|LINK
Personally I think the best solution is to check the items that are being bound to the DropDownList to ensure your value is in there.
There is an article showing this method here:
Cheers,
Bartek
Sep 11, 2008 08:18 PM|orphan|LINK
I Too have the same problem
Is this a verfied bug in .NET?
Im trying to follow that Tutorials both on here and on msdn
None of them mentioning any workaround to get this to work
But still as soon as i hit the "Edit" buton on my gridview i get the "'DDL2' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value"
Exception Details: System.ArgumentOutOfRangeException: 'DDL2' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
the data exists for sure and there is no null values
Sep 11, 2008 08:47 PM|acmassie|LINK
Oprhan, one thing to check would be the size and type of fields in the table that has your drop down options and the table that is supposed to store the resulting selection--they have to be exactly the same or else you will get this message.
That's what caused my problem, one was 2 character, the other was 3--a typo on my part, they were both supposed to be 2. Once I corrected this everything worked fine--it's an awful error message that .NET gives you because it makes you think you've got a bad field name or null data which is what everyone tells you to check (all well-meaning people to be sure, but when I explicitly stated I had no null or blank fields--I only had 5 recs in the DB, I could open it in SQL Server Manager and instantly verify there were no null fields--and everyone kept suggesting the same thing it was frustrating).
Sep 12, 2008 07:04 AM|orphan|LINK
thx for your answer acmassie
Not sure if I understand you rightm but its just a integer value.
Im picking up a ID from one table, trying to add it to the other table, as a realtion reference
It "works" if I unchek the "Two-way Binding" but then ofcourse the field will have null for value
dropdown datalist
Member
4 Points
Oct 29, 2008 07:30 PM|mdixon|LINK
Note that the "DEFAULTVALUE", is a value that is known to exist in the table used to populate the
drop-down. Could have statically populated the drop down, but then would have to manually update the code each time the
available selection list changes.protected void OnDataBinding_ddlApptype(object sender, EventArgs e)
{DropDownList ddl = (DropDownList)sender;if (ddl != null)
{if (ddl.SelectedValue == null || ddl.SelectedValue == "") ddl.SelectedValue = "DEFAULTVALUE";
}
}
.Net 2.0 .Net 2.0 FormView
Nov 03, 2008 06:08 AM|hlp4al|LINK
Hi..
I faced the same problem, but i fixed this as below..
One thing you have to observe: i.e binding column should not have null values. There should not any scope to save the blank field in that column..
for example:
this is dropdownlist in gridview
<asp:DropDownList ID="DropDownList4" runat="server" Enabled =true
SelectedValue='<%# Bind("WORKTYPE") %>' AppendDataBoundItems =true>
<asp:ListItemProcessing</asp:ListItem>
<asp:ListItemQuality Checking</asp:ListItem>
<asp:ListItemBoth</asp:ListItem>
</asp:DropDownList>
the WorkType column is CHAR(10)
while saving PR in that WorkType column, it occupies only 2 bits of space, remaining 8 bits of space occupies null values/Spaces..
so it is not matching with the dropdownlist PR value.. Because of that reason we got that error..
More concentrate on this.. Remove the error and Happy Coding..
Thanks and Regards
hlp4al..
Dec 24, 2008 01:33 PM|skiah|LINK
I wrestled with this one also and it had to do with null values in the db. The db column is of type 'int', so I made sure that there are no null values in the column, rather the default value is 0. Also, I made sure that there was no value for 0 in the ref table that I was querying for the match.
Now when the ddl loads, it defaults to "Please Select" if there is no recorded value.
<asp:TemplateField <ItemTemplate> <asp:dropdownlist <asp:ListItemPlease Select</asp:ListItem> </asp:dropdownlist> </ItemTemplate> <EditItemTemplate> <asp:dropdownlist <asp:ListItemPlease Select</asp:ListItem> </asp:dropdownlist> </EditItemTemplate> </asp:TemplateField>
Apr 20, 2009 01:41 PM|NayC|LINK
HI,
again, same problem as everyone here. Unfortunately none of the solutions from this thread seem to work in my scenario! Which is kind of a pain because I've been fighting with a simple gridview for a few days now! I have a dropdown in the gridview which selects someones name, and the value is their particular sequence which is found in the query where the data comes from. This "sequence" is then used with other data used in that row to insert into a table. This problem just wont go away.
I have created a page that runs the same query to return ID (their sequence), name and code (like a login), and then on changing the ddl a label returns the value. It worked fine, as it should for example, Me (in the db) = 1193 and so on.
I think i'm having some miss match between data trying to be stored and what the records actually holding (eg trying to store sequence into the wrong column or something) but nothing works and nothing appears to contain something that could cause such an error? This is extremely frustrating!
May 13, 2009 08:54 AM|ajith_tintin|LINK
hey friends
here are some gideliness for solving this problem.
Check whether the Value field of the dropdown is same as the database.column name
Check whether that columns contain null values in that column.
Thank you
May 18, 2009 02:27 PM|dst101|LINK
I too have the same problem, my code:
<asp:TemplateField
<ItemTemplate>
<asp:Label</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList
<asp:ListItem>------------------------</asp:ListItem>
<asp:ListItemAccept Job</asp:ListItem>
<asp:ListItemReject Job</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox</asp:TextBox>
</InsertItemTemplate>
</asp:TemplateField>
Now if I change the EditItemTemplate to <asp:TextBox</asp:TextBox> it works fine......WTF
I have also another Template that uses the same idea, and it works fine!
All the rows in the DBASE have records in it, so can anyone give me a heads up on why this isn't working?
May 20, 2009 09:29 AM|dst101|LINK
I have also altered the Dbase column to a bit 1 or 0, and set the default value to 0. Taken the Not Null option off as well, but it is STILL returning the same error.
I have even changed it to char(9) and put the default value as Awaiting, still no luck.
Thought I would try radio buttons instead, and it still pulls the same error, what's going on?
Jun 24, 2009 06:10 PM|bofcarbon1|LINK
Just to follow up on a previous suggestion I ran into a similar problem getting this error message. I did have to go back to my SQL Server 2008 table and modify columns that corresponded to the dropdownlist items. I think perhaps the slightest difference such as column length or format such as char or nchar could cause problems. Also using dropdownlists to insert we often require some sort of default option on a pre-select. When it comes to edits in a GridView I think we only want to pre-select existing values. When copying code from forms and placing it in the GridView Template we must think about what is happening and make our adjdustments such as not including a detault value that has no real value in a column of our target table. It is possible that on an insert when a listitem on a dropdownlist is left untouched hence sent as a default value that code behind overrides and selects a valid value before the SQL insert is done. Could end up being a little tricky.
tab container
Jul 06, 2009 11:15 AM|lars-erik|LINK
Hi all!
Here's a forgiving DropDownList allowing you to bind to invalid values. Hope it can help someone. :)
L-E
Jul 16, 2009 02:21 PM|jharcourt|LINK
In my case I had a field on the SQL table populating the dropdownlist set to nvarchar(10) and had omitted to notice that the relevant field on the main data table was char(10).....doh! This meant, of course, that extra spaces were being added to the data
thus rendering the 'selectedvalue' to be non existant. Fixed.
Jul 28, 2009 11:50 AM|NobleMule|LINK
Hey guys, this issue has been plaguing me too. In my code, I have a Gridview populated by a database which will have null values in it. The user then has to edit the data in the database until all cells for a row is filled and then, if the data is good, the user can accept the record into a primary database (which does not allow null values). Optionally, if the data is bad, the user can reject the record and it will be processed again. In order to make things easier for the user, several of the cells will become drop down lists when the edit button is pressed. I've had trouble getting my update to recognise the value of a DDL so I followed the guide at in the hopes that I'll get it right this time.
I've only created one DDL for the time being (may as well get one working before I start on all the others) and it will only have the values "Up" or "Down". These are hard coded. Whenever I hit the "edit" button, I get the error:
"'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value"
I've tried all the methods here and I can't get anything to work. My code for the particular template field is as follows:
<asp:TemplateField <EditItemTemplate> <asp:DropDownList <asp:ListItemUp</asp:ListItem> <asp:ListItemDown</asp:ListItem> </asp:DropDownList> </EditItemTemplate> <ItemTemplate> <asp:Label</asp:Label> </ItemTemplate> <ControlStyle BorderColor="#350B59" Width="55px" /> <FooterStyle BorderColor="#350B59" Width="55px" /> <HeaderStyle BorderColor="#350B59" Width="55px" /> <ItemStyle BorderColor="#350B59" Width="55px" /> </asp:TemplateField>
Anyone got any ideas? I'm getting desperate!
<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste">'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items.</div> <div style="position:
absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste">Parameter name: valu</div>
Edit: Almost forgot, if it helps, the data type for the column is 'nvarchar(4)' and nulls are allowed.
UPDATE:
I read something that suggested that if I add a ListItem at the top of the list like below the error would be solved:
'<asp:ListItem</asp:ListItem>'
And it did! However, as you will all notice (and as I foolishly didn't notice), when I updated, the value of the cell would become 0 or 1 but I want the value to be Up or Down. Changing Value="0" to Value="Up" and 1 to Down yielded the same error as I have been receiving all this time.
Jul 29, 2009 03:57 AM|bofcarbon1|LINK
Did you get your problem resolved?
If you are extracting data from a database that maps to values in your DDL then your item list must have a value for each existing value that is extracted. Are you pre-selecting a value in the list based on the value you read in the database? I don't know of a way to handle a null value in the list. If you have nulls in the values you are extracting how would they map to a value in your list? Is zero a different value in the database than null? If you want to say that '0' (zero) is that same as null you might have to convert nulls to zero prior to an edit that tries to pre-select a value of null which will fail.
Any other values in the database that you feel might get read that don't have a value in your item list?
The auto edit in the Gridview will try and pre-select for you based on your bind value.
If you have Visual Studio set a break point at your SQL reader or wherever you are getting data from the database. Then look at the value of the data item in your bind and note whether you are getting a value not in your list item values.
B
Jul 29, 2009 09:39 AM|NobleMule|LINK
The DDL is hard coded with values as I only need Up and Down in one list and the months of the year in another. There are no null values in the DDL.
I think that because the DDL is hard coded, the methods to fix this error in this forum aren't working for me.
Jul 29, 2009 02:17 PM|bofcarbon1|LINK
By DDL I'm assuming you mean the Drop Down List. The 'Up' and 'Down' are text strings to be displayed in the drop down list. You have values in of '0' and '1' in the Drop Down List. In your datasource you have nulls, '0' and '1' in a Direction column of a table of some sort which is what you are binding to. The values in ASP.LISTITEM identified by value='0' etc... is what you are matching on. Try testing with only Direction values of '0' and '1' in your datasource (not the DDL list items) and see if you get a clean run.
Aug 06, 2009 05:42 AM|Muhammad way|LINK
Still no solution..
I think there is no doubt that the problem is in the data type of the table field because for example when I make the datatype "text" in ACCESS database I get the error but when I change it to "integer" the problem disappears, but why it works for some "Text" columns and not for other columns?
Aug 06, 2009 06:11 AM|bofcarbon1|LINK
Who can say really with these tools. It's open system technology. The same problems in .NET and Java. A lot of time spent type casting and converting values depending on the control or datasource interface. Too much to even try to reason out. I stopped trying to make sense out of everything in .NET months ago. When things get really layered and problems occur I often peel back the code and get things real simple. Then it is the old fashioned method of looping through adding back code and waiting for the problem code to rear its ugly head. I also learned to give up on trying to pound a solution into submission. If it is too hard I find another way. Like water around a rock.
Aug 09, 2009 05:07 AM|Muhammad way|LINK
I hope this will be the final solution, if somebody has a small project and this solution didn't work with him I hope that he send me his small project so I make sure that he didn't miss any point.
There are two columns involved:
- The one that you retrieve the values from. Let’s call it "Status".
- The one that you insert values to. Let’s call it "process_type".
Suppose you have 3 values in the first column "Status": [New,In progress,Canceled]. In the GridVew or any data control you are showing the second column "process_type", and you want it to be shown as a DropDownList when you click "Edit", then you have to
open the second column "process_type" from the database and make sure that there is no cell has a value which does not exist in the first column "Status", even Null are not accepted in the second column unless you have null values in the first column.
There is one small thing left you might not notice if you have added a WHERE clause, when you make your SELECT statement for the second column "process_type", and you have added a WHERE clause, you have to make sure that all the values that will be retrieved from this SELECT statements match all the values that will be retrieved from the first column "Status".
Advice: I think it's obvious now that you have to make the right user interface in such a way to force the user to enter the values that match with the vales from the first column. usually you will be using a dropdownlist.
Aug 11, 2009 11:12 PM|Jojan|LINK
Please make sure that Datasource has the value you are trying to assign back.
Error happens when control can not find the assigned selected value in the orginal (DataSource) collection.
Nov 20, 2009 07:36 PM|ArmandoS|LINK
Hi,
I solved this issue adding the following to my DropDownList ListItems:
<asp:ListItem></asp:ListItem>
And it worked!
I hope it helps.
Armando
drop down list invalid selected value
Dec 06, 2009 08:52 PM|bartekm|LINK
My preferred solution to this problem is to remove the SelectedValue property for your dropdownlist to remove your binding and then add some code which will search through the data items bound to your dropdownlist, and if your item isn't found then display the "Please Select" option.
Dec 31, 2009 04:10 PM|heckubus|LINK
I just made a custom drop downlist class, that essentially treats the SelectedValue property as TrySelectedValue, and added options to control how to handle the missing value.
[CLSCompliant(true)] [ParseChildren(true), PersistChildren(false)] [ToolboxData("<{0}:CustomDropDownList runat=server></{0}:CustomDropDownList>")] public class CustomDropDownList : DropDownList { private string cachedSelectedValue = null; private bool performedDataBinding = false; private bool valueIsMissing = false; #region Options private ListControlOptions _options = new ListControlOptions(); /// <summary></summary> [NotifyParentProperty(true)] [PersistenceMode(PersistenceMode.InnerProperty)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public ListControlOptions Options { get { return _options; } set { _options = value; } } #endregion #region SelectedValue public override string SelectedValue { get { return base.SelectedValue; } set { // Prevents error: 'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items. if (performedDataBinding && !valueIsMissing) base.SelectedValue = value; else cachedSelectedValue = value; } } #endregion #region PerformDataBinding protected override void PerformDataBinding(IEnumerable dataSource) { base.PerformDataBinding(dataSource); Select(); performedDataBinding = true; } #endregion #region Select private void Select() { int indexOf = -1; ListItem item; if (cachedSelectedValue != null) { item = Items.FindByValue(cachedSelectedValue); indexOf = Items.IndexOf(item); } // Always insert the "(None)" if AllowNull is true if (Options.AllowNull) { ListItem nullItem = new ListItem(Options.NullText, string.Empty); Items.Insert(0, nullItem); } valueIsMissing = (indexOf == -1); // Perform selection if (indexOf != -1 && cachedSelectedValue != null) { base.SelectedValue = cachedSelectedValue; // Normal case, value was found. } else if (cachedSelectedValue == null && Options.AllowNull) { base.SelectedValue = string.Empty; // Select null when AllowNull is true. } else if (indexOf == -1 && cachedSelectedValue != null && !Options.AllowNull) { // Missing selected value if (Options.MissingMode == ListControlMissingMode.None) { // Do nothing, leave SelectedIndex at 0 } else if (Options.MissingMode == ListControlMissingMode.ThrowException) { string format = "'{0}' has a SelectedValue which is invalid because it does not exist in the list of items."; string message = string.Format(format, ID); throw new ArgumentOutOfRangeException(message); } else { // Insert missing placeholder string itemText = string.Empty; if (Options.MissingMode == ListControlMissingMode.InsertSelectedValue) itemText = cachedSelectedValue; else if (Options.MissingMode == ListControlMissingMode.InsertPlaceholder) itemText = Options.MissingText; else if (Options.MissingMode == ListControlMissingMode.InsertPlaceholderFormatted) itemText = string.Format(Options.MissingFormat, cachedSelectedValue); ListItem missingItem = new ListItem(itemText, string.Empty); Items.Insert(0, missingItem); base.SelectedValue = string.Empty; } } } #endregion }
/// <summary>Determines what to show when the selected value cannot be found in the ListControl when being data bound.</summary> public enum ListControlMissingMode { /// <summary>1. No placeholder is inserted to indicate the selected value.</summary> None = 1, /// <summary>2. Insert the selected value that is missing.</summary> InsertSelectedValue = 2, /// <summary>3. Insert a placeholder for the missing item. Example: "(Select)".</summary> InsertPlaceholder = 3, /// <summary>4. Insert a placeholder for the missing item using string.Format syntax. {0} is the selected value. Example: "(Not Found) Wisconsin"</summary> InsertPlaceholderFormatted = 4, /// <summary>Throws an exception. Default ListControl behavior.</summary> ThrowException = 5, } public class ListControlOptions { private const string selectParenthesis = "(Select)"; private const string notFoundParenthesisFormat = "{0} (Not Found)"; private const string noneParenthesis = "(None)"; #region AllowNull private bool _allowNull; /// <summary>True if a selected value is not required.</summary> public bool AllowNull { get { return _allowNull; } set { _allowNull = value; } } #endregion #region NullText private string _nullText = noneParenthesis; /// <summary>The text to display in the top list item to indicate a null value.</summary> public string NullText { get { return _nullText; } set { _nullText = value; } } #endregion #region MissingText private string _missingText = selectParenthesis; /// <summary></summary> public string MissingText { get { return _missingText; } set { _missingText = value; } } #endregion #region MissingFormat private string _missingFormat = notFoundParenthesisFormat; /// <summary></summary> public string MissingFormat { get { return _missingFormat; } set { _missingFormat = value; } } #endregion #region MissingMode private ListControlMissingMode _missingMode = ListControlMissingMode.InsertPlaceholder; /// <summary></summary> public ListControlMissingMode MissingMode { get { return _missingMode; } set { _missingMode = value; } } #endregion }
Feb 03, 2010 10:03 PM|alkurta|LINK
I too had an invalid SelectedValue.
I had an edit template field where I put a drop down list in it. I was trying to populate the drop down list with the two distinct values of the field 'Status'.
My problem was in the SQL datasource. Through the wizard, I accidentally made my query "SELECT DISTINCT [Status] FROM [tbl1I1601LookupBackup_01142010] WHERE ([Status] = @Status)".
The WHERE clause was referring back to my drop down list.
By changing the query to this "SELECT DISTINCT [Status] FROM [tbl1I1601LookupBackup_01142010]", I fixed the problem.
52 replies
Last post Feb 03, 2010 10:03 PM by alkurta
|
http://forums.asp.net/p/1056921/3332534.aspx?Re+DropDownList1+has+a+SelectedValue+which+is+invalid+because+it+does+not+exist+in+the+list+of+items
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages
hugin1/common/utils.h File Reference
#include <hugin_utils/utils.h>
#include <appbase/ProgressDisplayOld.h>
#include <appbase/ProgressReporterOld.h>
#include "platform.h"
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Function Documentation
|
http://hugin.sourceforge.net/docs/html/hugin1_2common_2utils_8h.shtml
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
30 August 2012 08:18 [Source: ICIS news]
By Felicia Loo
SINGAPORE (ICIS)--?xml:namespace>
Naphtha prices in Asia firmed up in tandem with the crack spread values in
The light distillates market drew support from gasoline production issues in the
“Fundamentally, the situation in
Indian refiners are estimated to slash naphtha exports to 500,000-600,000 tonnes in September, down by 29-33% from a monthly average of 700,000-900,000 tonnes, because of higher domestic demand for naphtha.
Some refinery maintenance will see a reduction in naphtha output in
The Indian refiners are keen to produce more gasoline than naphtha, given strong gasoline demand and some naphtha is being diverted to the gasoline blending pool..
Open-spec naphtha prices for the first-half October contract rose by $9-10/tonne to $970.50-973.50/tonne CFR
Downstream ethylene prices were underpinned by tight cargo availabilities, with prices assessed at $1,300-1,340/tonne CFR NE Asia on Wednesday compared with $1,130-1,170/tonne CFR NE Asia four weeks ago, ICIS data showed.
Moreover, the chances of booking ample European naphtha supplies for
The east-west spread, which measures the profitability of bringing European naphtha to
On 3 August, the east-west spread stood at $15.87/tonne.
Amid such backdrop, the spot naphtha premiums rose in transactions that took place in the week, traders said
Samsung Total purchased 50,000 tonnes of open-spec naphtha supply for delivery in the first half of October, after skipping spot imports for September delivery.
Rising propane prices make naphtha a more attractive option for Samsung Total. The cargoes were done at a premium of $9/tonne to
The premiums rose sharply from the purchases made by
Honam Petrochemical had bought four naphtha cargoes totalling 100,000 tonnes for delivery into Yeosu and Daesan in the first half of October at a premium of around $2/tonne to
“All tenders are going at very high premiums,” a trader said
($1 = €0.80)
|
http://www.icis.com/Articles/2012/08/30/9591097/Asias-naphtha-backwardation-to-surge-on-tight-supply.html
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
#include <ggi/internal/triple-int.h> unsigned *invert_3(unsigned x[3]); unsigned *lshift_3(unsigned l[3], unsigned r); unsigned *rshift_3(unsigned l[3], unsigned r);
lshift_3 shifts l to the left by r bits. Equivalent to l<<=r.
rshift_3 shifts l to the right by r bits. This shift is arithmetic, so the sign of l is kept as is. Equivalent to l>>=r.
Both lshift_3 and rshift_3 return a pointer to l which has been updated in place.
unsigned x[3]; assign_int_3(x, -4); invert_3(x); /* x is now 3 */ lshift_3(x, 42); /* x is now 3*2^42, if that fits in a triple-int */ rshift_3(x, 17); /* x is now 3*2^25 */
|
http://www.makelinux.net/man/3/G/ggidev-rshift_3
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
-- | Rewrite rules are represented as nested monads: a 'Rule' is a 'Pattern' that returns a 'Rewrite' the latter directly defining the transformation of the graph. The 'Rewrite' itself is expected to return a list of newly created nodes. -- -- Data.Maybe (listToMaybe) [Node]) -- rule construction --------------------------------------------------------- -- | primitive rule construction with the matched nodes of the left hand side as a parameter rewrite ∷ (Match → Rewrite n [Node]) → Rule n rewrite r = liftM r history -- | constructs a rule that deletes all of the matched nodes from the graph erase ∷ View [Port] n ⇒ Rule n erase = do hist ← history return $ do mapM_ deleteNode $ nub hist return [] -- | = do hist ← history return $ do mapM_ mergeEs $ joinEdges ess mapM_ deleteNode $ nub hist return []) hist ← history when (null hist ∧ not (null vs)) (fail "need at least one matching node to clone new nodes from") return $ do es ← replicateM n newEdge let (vs,ess) = partition es ns ← zipWithM copyNode (cycle hist) vs mapM_ mergeEs $ joinEdges ess mapM_ deleteNode $ nub hist return ns $ do ns1 ← rw1 ns2 ← apply r2 return (ns1 ⧺ ns2) -- | Apply a rule repeatedly as long as it is applicable. Fails if rule cannot be applied at all. exhaustive ∷ Rule n → Rule n exhaustive = foldr1 (>>>) . repeat -- | Apply a rule to all current redexes one by one. Neither new redexes or destroyed redexes are reduced. everywhere ∷ Rule n → Rule n everywhere r = do ms ← matches r exhaustive $ restrictOverlap (\hist future → future ∈ ms) r -- | Apply rule at an arbitrary position if applicable apply ∷ Rule n → Rewrite n [Node] apply r = maybe (return []) snd . listToMaybe =<< liftM (runPattern r) ask
|
http://hackage.haskell.org/package/graph-rewriting-0.4.8/docs/src/GraphRewriting-Rule.html
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
On Tue, 14 Oct 2008 09:39:21 +0800, Boern <cayson.z at gmail.com> wrote: >Hi? Please don't repost the same question twice in one day. Don't repost the same question at all, actually. If you don't get a response, you can try adding more details to your question, but just posting the same text more than once will just annoy people. The only XML Nevow accepts as input is XHTML, plus some tags defined by the Nevow XML namespace. It doesn't know anything about WAP. If you want to include a specific XML declaration in the output, then that's what you should do - include it in the output, not in the XHTML template file. There are a lot of ways to do this. The best depends on how you're generating output. One way is with a nevow.tags.xml tag. Another is to write a string to the request. Jean-Paul
|
http://twistedmatrix.com/pipermail/twisted-web/2008-October/003955.html
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
Summary
At Matthew Wilson's behest, I have attempted to further explain my rationale behind separate extension classes, and contract verification classes. It turns out they fit very nicely in a design pattern which Matthew refers to as a bolt-in.
Bolt-ins are template classes with the following characteristics:In all frankness I consider that to be a somewhat fluffy defintion, and I would have stated it more concisely as follows:
- They derive, usually publicly, from their primary parameterizing type.
- They accomodate the polymorphic nature of their primary parameterizing types. Usually they also adhere to the nature, but this is not always the case, and they may define virtual methods of their own, in addition to overriding those defined by the primary parameterizing type.
- They may increase the footprint of the primary parameterizing type by the definitiion of member variables, virtual functions, and additional inheritance from nonempty types.
- Imperfect C++, page 375, by Matthew Wilson, published by Addison-Wesley, 2005
Bolt-ins are template classes which inherit from their primary parameterizing type, while accomodating its polymorphic nature.The other parts of the definition are superflous, and do not add to the definition. They appear to be solely intended to distinguish bolt-ins from veneers. Matthew goes on to disintiguish a bolt-in primarily by its role:
... bolt-ins are concerned with significantly changing or completing the behavioural nature of (often partially defined) types. [...] The primary purpose of a bolt-in is to add or enhance functionality.Unfortunately I find it difficult to identify specifically when I am using a bolt-in and when I am using plain old template parameter inheritance. However I will use the term bolt-in for the time being. I would however like to encourage Matthew to further refine the definitions of bolt-ins, veneers and attempt to formalize the other forms of template parameter inheritance patterns. On that note, Joel de Guzman suggested the term Parametric Base Class Pattern (PBCP) for all the forms of template parameter inheritance.
- Imperfect C++, page 375, by Matthew Wilson, published by Addison-Wesley, 2005
Following the principle of separation of concerns has the benefit of reduction of code coupling, and improvement of code cohesion. These are both well-known good software engineering practices. The advantages are that following these principles more naturally leads to more maintainable and reusable code.
Bolt-ins can be used to enforce separation of concerns, and to reduce code coupling.
class SimpleClass { public: Init() { // do initialization } void DoSomething() { // precondition: object must be initialized // do something } }There is here an implied precondition to calling DoSomething() which is that the member function Init() must have been previously called on a particular instance. A common and somewhat naive approach to assuring the precondition is done by introducing a member variable:
class SimpleClass { public: SimpleClass() : mbInit(false) { } Init() { // do initialization mbInit = true; } void DoSomething() { assert(mbInit); // do something } private: bool mbInit; }Notice that mbInit is solely used for verifying that the class is used correctly. The problem is that it probably will only be needed during debug builds. The naive solution then would be:
class SimpleClass { public: SimpleClass() #ifdef _DEBUG : mbInit(false) #endif { } Init() { #ifdef _DEBUG // do initialization mbInit = true; #endif } void DoSomething() { assert(mbInit); // do something } private: #ifdef _DEBUG bool mbInit; #endif }Needlessly to say that is a mess. The problem results from a failure to separate concerns modularly. One improved solution is to use inheritance:
class SimpleClass_with_contract : SimpleClass_impl { public: void SimpleClass_with_contract() : mbInit(false) { } void Init() { SimpleClass_impl::Init(); mbInit = true; } void DoSomething() { assert(mbInit); SimpleClass_impl::DoSomething(); } private: bool mbInit; }; class SimpleClass_impl { public: void Init() { // do initialization } void DoSomething() { // do something } }; #ifdef _DEBUG typedef SimpleClass_with_contract SimpleClass; #else typedef SimpleClass_impl SimpleClass; #endifThis solution is good, but the contract verification class is not reusable because it is coupled with that particular implementation. This arises because we have only partially separated the concern of contract verification. Ideally I want something reusable, so I will use a class which inherits from its template parameters (a bolt-in).
template<typename Impl_T> class Simple_contract : Impl_T { public: void Simple_contract() : mbInit(false) { } void Init() { Impl_T::Init(); mbInit = true; } void DoSomething() { assert(mbInit); Impl_T::DoSomething(); } private: bool mbInit; }; class SimpleClass_impl { public: void Init() { // do initialization } void DoSomething() { // do something } }; #ifdef _DEBUG struct SimpleClass : Simple_contract<SimpleClass> { }; #else struct SimpleClass : SimpleClass_impl { }; #endifThis new contract verification class can now be used with other classes with similar interfaces:
class AnotherSimpleClass_impl { public: void Init() { // do initialization } void DoSomething() { // do something } }; #ifdef _DEBUG struct AnotherSimpleClass : Simple_contract<AnotherSimpleClass> { }; #else typedef AnotherSimpleClass_impl AnotherSimpleClass; #endifThis demonstrates how through the diligent practice of separation of concerns we can arrive at code which is more reusable.
class MyString_impl { public: void SetCount(int n) { m.resize(n); } void SetChar(int n, char c) { m[n] = c; } char GetChar(int n) const { return m[n]; } int Count() { return m.size(); } private: std::vector<char> m; };This class is too minimalist to be of much use as-is, however with this basic implementation you can implement virtually every other concievable string member function. By writing the derived functions within a bolt-in, I can reuse the derived set of memember functions on any class which matches the code interface. For instance consider the following bolt-in:
template<typename Impl_T> class String_ext : public Impl_T { public: void Concat(const Impl_T& x) { int n = Count(); SetCount(n + x.Count()); for (int i=n; < Count(); i++) { SetChar(i, x.GetChar(i-n)); } } void Assign(const Impl_T& x) { SetCount(x.Count()); for (int i=0; i < Count(); i++) { SetChar(i, x.GetChar()); } } Impl_T SubString(int n, int cnt) const { Impl_T s; s.SetCount(cnt); for (int i=0; i < cnt; i++) { s.SetChar(i, GetChar(i + n)); } return s; } // and so on and so forth };This extension class can be bolted on to any compatible class implementation as simply as:
typedef String_ext<MyString_impl> MyString;The advantage of doing this is that the extension class can be reused on any class matching the core interface. This also reduces the coupling between extension functions and the implementation to a set of four functions. Refactoring and debugging the code as a result becomes much easier.
We can also define a contract verification class for MyString as follows:
template<typename Impl_T> class String_contract : public Impl_T { public: void SetChar(int n, char c) { assert(n < Count()); Impl_T::SetChar(n); assert(GetChar(n) == c); } char GetChar(int n) const { assert(n < Count()); return Impl_T::GetChar(n); } }Tying everything together gives us:
#ifdef _DEBUG typedef String_ext<String_contract<MyString_impl> > MyString; #else typedef String_ext<MyString_impl> MyString; #endif
One solution I am aware of is to use template constructors. This is not a perfect solution though.
My currently preferred solution to this design conundrum is to forego initializing construction entirely within my libraries. A rather drastic and contentious measure, but perhaps one which may pay off, because it opens the door more widely to sophisticated usage of template parameter inheritance techniques such as bolt-ins, contract verificiation classes, extensions classes, and more. Some debate on the merits of this approach can be found in the comments of my earlier blog entry Two Stage Construction in C++ versus Initializing Constructors
Have an opinion? Readers have already posted 16 comments about this weblog entry. Why not add yours?
If you'd like to be notified whenever Christopher Diggins adds a new entry to his weblog, subscribe to his RSS feed.
|
http://www.artima.com/weblogs/viewpost.jsp?thread=106760
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
09 June 2010 17:49 [Source: ICIS news]
LONDON (ICIS news)--Polyethylene terephthalate (PET) customers are targeting June decreases in line with lower production costs and lagging demand, they said on Wednesday.
“A rollover is not our expectation even if it’s producers’ target. Customers want at least the raw material decrease of around €30/tonne ($36/tonne),” a buyer said.
A producer acknowledged that customers were putting pressure on them to lower their prices in June, but said it was refusing to budge from May’s levels of around €1,200/tonne FD (free delivered) Europe.
The price of PET raw materials fell in June. Paraxylene (PX) which feeds into PET’s main feedstock purified terephthalic acid (PTA), fell by €35/tonne in June to €835/tonne. This was putting pressure on PTA to drop by €24/tonne in the same month.
Mono ethylene glycol (MEG), PET’s other feedstock, saw its June contract price drop by €36/tonne to €820/tonne FD NWE (northwest ?xml:namespace>
Poor weather conditions during the summer peak season for PET bottlers resulted in lacklustre demand so far in June, buyers and sellers said. This situation was compounded by earlier bouts of pre-buying by customers in preparation for what is usually a period of peak demand, they added.
Demand has fallen because of bad weather and customers’ inventories are high, according to a reseller.
Film-grade packaging customers said their sector was relatively healthy, but still they were being offered reductions in the price of PET for June deliveries. One buyer reported receiving offers for spot material in June at decreases of €60-70/tonne compared with May.
Suppliers recently said shutdowns planned later in June were also supporting a firm market.
“Producers are all sold out,” one of them commented.
Earlier pre-buying may be causing some customers to hold back at the moment, but by the end of June or July the market could become tight as a result of there being less imports, a buyer speculated.
In May, PET contract values rose by around €60/tonne to €1,160-1,200/tonne FD (free delivered) NWE (northwest
($1 = €0.84)
ICIS will be developing a prototype report for
|
http://www.icis.com/Articles/2010/06/09/9366532/europe-pet-customers-target-june-decreases.html
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
Learn
Videos
Documentation
Code Samples
Tools
Ask questions
Welcome to the official Text Template Transformation Toolkit (T4) team blog.
T4 is a flexible code generation tool that can reduce development time and maintenance cost. T4 is easy to adopt in any project and in any stage of product development.
For a simple example where T4 can help development, consider exception classes in C#. We like to have specific exception types for the errors in our application. Exception classes often are implemented similar to the following (comments and implementation removed).
[Serializable]public class TestException : System.Exception{ public TestException (); public TestException (string message); public TestException (Exception innerException); public TestException (string message, Exception inner);
[SecuritySafeCritical] protected TestException ( SerializationInfo info, StreamingContext context);
public override void GetObjectData ( SerializationInfo info, StreamingContext context);}
This code reeks of redundancy as what I wanted to say was just: Give me a new exception named TestException that inherits System.Exception. Yet, I have to write all of the above and more as it needs implementation and comments as well.
Redundancy is wasteful because it reduces productivity, maintainability, quality, consistency and stops us from doing the right thing. If you have ever sat in front of ~10,000 lines of redundant code and wanted to apply a refactoring to 30% of the code, you would appreciate a tool that can make such tedious and mundane tasks disappeared.
Code snippets are not the answer as they only address part of the problem (productivity) and ignore the rest.
Wouldn't it be great if I could say something like: Exception ("TestException", baseName:"System.Exception") and all the tedious details are just automatically generated for me?
T4 can do just that.
Since it's generated every time in the same way for all exception classes, it's maintainable, consistent and you can refactor the exception classes effectively.
T4 has been used successfully in the following scenarios
Use the Pages pane on the right to explore the rich content available for learning T4 today!
|
http://blogs.msdn.com/b/t4/archive/2011/03/04/welcome.aspx
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
Official retail release of Vista was January 30, 2007Official retail release of Vista was January 30, 2007
18 hours ago, PopeDai wrote
*snip*
2006.
18 hours ago, PopeDai wrote
No, because 16-bit programming hurts my brain. I still don't understand how memory addressing worked with near and far pointers.
What's the problem? Converting between a (real-mode) far pointer and a linear pointer is easy.
DWORD FpToLinear(FAR void* fp)
{
return ((DWORD)fp >> 12) + ((DWORD)fp & 0xffff);
}
What could be more straightforward than that? =D
21 hours ago, yuhong wrote
@figuerres: It is to *target* XP, not to host on XP, as with VS2012..
15 hours ago, yuhong wrote
@evildictaitor: The problem is that don't work in 16-bit protected mode, for one thing.
20 hours ago, evildictaitor wrote
... between a (real-mode) far pointer ...
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.
|
http://channel9.msdn.com/Forums/Coffeehouse/VC11-Firefox-Metro-Win8-SDK-and-XP?page=2
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
When we think of passing an open descriptor from one process to another, we normally think of either
A child sharing all the open descriptors with the parent after a call to fork
All descriptors normally remaining open when exec is called
In the first example, the process opens a descriptor, calls fork, and then the parent closes the descriptor, letting the child handle the descriptor. This passes an open descriptor from the parent to the child. But, we would also like the ability for the child to open a descriptor and pass it back to the parent.
Current Unix systems provide a way to pass any open descriptor from one process to any other process. That is, there is no need for the processes to be related, such as a parent and its child. The technique requires us to first establish a Unix domain socket between the two processes and then use sendmsg to send a special message across the Unix domain socket. This message is handled specially by the kernel, passing the open descriptor from the sender to the receiver. steps involved in passing a descriptor between two processes are then as follows:
Create a Unix domain socket, either a stream socket or a datagram socket.
If the goal is to fork a child and have the child open the descriptor and pass the descriptor back to the parent, the parent can call socketpair to create a stream pipe that can be used to exchange the descriptor.
If the processes are unrelated, the server must create a Unix domain stream socket and bind a pathname to it, allowing the client to connect to that socket. The client can then send a request to the server to open some descriptor and the server can pass back the descriptor across the Unix domain socket. Alternately, a Unix domain datagram socket can also be used between the client and server, but there is little advantage in doing this, and the possibility exists for a datagram to be discarded. We will use a stream socket between the client and server in an example presented later in this section.
One process opens a descriptor by calling any of the Unix functions that returns a descriptor: open, pipe, mkfifo, socket, or accept, for example. Any type of descriptor can be passed from one process to another, which is why we call the technique "descriptor passing" and not "file descriptor passing."
The sending process builds a msghdr structure (Section 14.5) containing the descriptor to be passed. POSIX specifies that the descriptor be sent as ancillary data (the msg_control member of the msghdr structure, Section 14.6), but older implementations use the msg_accrights member. The sending process calls sendmsg to send the descriptor across the Unix domain socket from Step 1. At this point, we say that the descriptor is "in flight." Even if the sending process closes the descriptor after calling sendmsg, but before the receiving process calls recvmsg (in the next step), the descriptor remains open for the receiving process. Sending a descriptor increments the descriptor's reference count by one.
The receiving process calls recvmsg to receive the descriptor on the Unix domain socket from Step 1. It is normal for the descriptor number in the receiving process to differ from the descriptor number in the sending process. Passing a descriptor is not passing a descriptor number, but involves creating a new descriptor in the receiving process that refers to the same file table entry within the kernel as the descriptor that was sent by the sending process.
The client and server must have some application protocol so that the receiver of the descriptor knows when to expect it. If the receiver calls recvmsg without allocating room to receive the descriptor, and a descriptor was passed and is ready to be read, the descriptor that was being passed is closed (p. 518 of TCPv2). Also, the MSG_PEEK flag should be avoided with recvmsg if a descriptor is expected, as the result is unpredictable.
We now provide an example of descriptor passing. We will write a program named mycat that takes a pathname as a command-line argument, opens the file, and copies it to standard output. But instead of calling the normal Unix open function, we call our own function named my_open. This function creates a stream pipe and calls fork and exec to initiate another program that opens the desired file. This program must then pass the open descriptor back to the parent across the stream pipe.
Figure shows the first step: our mycat program after creating a stream pipe by calling socketpair. We designate the two descriptors returned by socketpair as [0] and [1].
The process then calls fork and the child calls exec to execute the openfile program. The parent closes the [1] descriptor and the child closes the [0] descriptor. (There is no difference in either end of the stream pipe; the child could close [1] and the parent could close [0].) This gives us the arrangement shown in Figure.
The parent must pass three pieces of information to the openfile program: (i) the pathname of the file to open, (ii) the open mode (read-only, read–write, or write-only), and (iii) the descriptor number corresponding to its end of the stream pipe (what we show as [1]). We choose to pass these three items as command-line arguments in the call to exec. An alternative method is to send these three items as data across the stream pipe. The openfile program sends back the open descriptor across the stream pipe and terminates. The exit status of the program tells the parent whether the file could be opened, and if not, what type of error occurred.
The advantage in executing another program to open the file is that the program could be a "set-user-ID" binary, which executes with root privileges, allowing it to open files that we normally do not have permission to open. This program could extend the concept of normal Unix permissions (user, group, and other) to any form of access checking it desires.
We begin with the mycat program, shown in Figure.
unixdomain/mycat.c
1 #include "unp.h"
2 int my_open(const char *, int);
3 int
4 main(int argc, char **argv)
5 {
6 int fd, n;
7 char buff[BUFFSIZE];
8 if (argc != 2)
9 err_quit("usage: mycat <pathname>");
10 if ( (fd = my_open(argv[1], O_RDONLY)) < 0)
11 err_sys("cannot open %s", argv[1]);
12 while ( (n = Read(fd, buff, BUFFSIZE)) > 0)
13 Write(STDOUT_FILENO, buff, n);
14 exit(0);
15 }
If we replace the call to my_open with a call to open, this simple program just copies a file to standard output.
The function my_open, shown in Figure, is intended to look like the normal Unix open function to its caller. It takes two arguments, a pathname and an open mode (such as O_RDONLY to mean read-only), opens the file, and returns a descriptor.
8 socketpair creates a stream pipe. Two descriptors are returned: sockfd[0] and sockfd[1]. This is the state we show in Figure.
9–16 fork is called, and the child then closes one end of the stream pipe. The descriptor number of the other end of the stream pipe is formatted into the argsockfd array and the open mode is formatted into the argmode array. We call snprintf because the arguments to exec must be character strings. The openfile program is executed. The execl function should not return unless it encounters an error. On success, the main function of the openfile program starts executing.
17–22 The parent closes the other end of the stream pipe and calls waitpid to wait for the child to terminate. The termination status of the child is returned in the variable status, and we first verify that the program terminated normally (i.e., it was not terminated by a signal). The WEXITSTATUS macro then converts the termination status into the exit status, whose value will be between 0 and 255. We will see shortly that if the openfile program encounters an error opening the requested file, it terminates with the corresponding errno value as its exit status.
unixdomain/myopen.c
1 #include "unp.h"
2 int
3 my_open(const char *pathname, int mode)
4 {
5 int fd, sockfd[2], status;
6 pid_t childpid;
7 char c, argsockfd[10], argmode[10];
8 Socketpair(AF_LOCAL, SOCK_STREAM, 0, sockfd);
9 if ( (childpid = Fork()) == 0) { /* child process */
10 Close(sockfd[0]);
11 snprintf(argsockfd, sizeof(argsockfd), "%d", sockfd[1]);
12 snprintf(argmode, sizeof(argmode), "%d", mode);
13 execl("./openfile", "openfile", argsockfd, pathname, argmode,
14 (char *) NULL);
15 err_sys("execl error");
16 }
17 /* parent process - wait for the child to terminate */
18 Close(sockfd[1]); /* close the end we don't use */
19 Waitpid(childpid, &status, 0);
20 if (WIFEXITED(status) == 0)
21 err_quit("child did not terminate");
22 if ( (status = WEXITSTATUS(status)) == 0)
23 Read_fd(sockfd[0], &c, 1, &fd);
24 else {
25 errno = status; /* set errno value from child's status */
26 fd = -1;
27 }
28 Close(sockfd[0]);
29 return (fd);
30 }
23 Our function read_fd, shown next, receives the descriptor on the stream pipe. In addition to the descriptor, we read one byte of data, but do nothing with it.
When sending and receiving a descriptor across a stream pipe, we always send at least one byte of data, even if the receiver does nothing with the data. Otherwise, the receiver cannot tell whether a return value of 0 from read_fd means "no data (but possibly a descriptor)" or "end-of-file."
Figure shows the read_fd function, which calls recvmsg to receive data and a descriptor on a Unix domain socket. The first three arguments to this function are the same as for the read function, with a fourth argument being a pointer to an integer that will contain the received descriptor on return.
9–26 This function must deal with two versions of recvmsg: those with the msg_control member and those with the msg_accrights member. Our config.h header (Figure D.2) defines the constant HAVE_MSGHDR_MSG_CONTROL if the msg_control version is supported.
10–13 The msg_control buffer must be suitably aligned for a cmsghdr structure. Simply allocating a char array is inadequate. Here we declare a union of a cmsghdr structure with the character array, which guarantees that the array is suitably aligned. Another technique is to call malloc, but that would require freeing the memory before the function returns.
27–45 recvmsg is called. If ancillary data is returned, the format is as shown in Figure. We verify that the length, level, and type are correct, then fetch the newly created descriptor and return it through the caller's recvfd pointer. CMSG_DATA returns the pointer to the cmsg_data member of the ancillary data object as an unsigned char pointer. We cast this to an int pointer and fetch the integer descriptor that is pointed to.
lib/read_fd.c
1 #include "unp.h"
2 ssize_t
3 read_fd(int fd, void *ptr, size_t nbytes, int *recvfd)
4 {
5 struct msghdr msg;
6 struct iovec iov[1];
7 ssize_t n;
8 #ifdef HAVE_MSGHDR_MSG_CONTROL
9 union {
10 struct cmsghdr cm;
11 char control[CMSG_SPACE(sizeof (int))];
12 } control_un;
13 struct cmsghdr *cmptr;
14 msg.msg_control = control_un.control;
15 msg.msg_controllen = sizeof(control_un.control);
16 #else
17 int newfd;
18 msg.msg_accrights = (caddr_t) & newfd;
19 msg.msg_accrightslen = sizeof(int);
20 #endif
21 msg.msg_name = NULL;
22 msg.msg_namelen = 0;
23 iov[0].iov_base = ptr;
24 iov[0].iov_len = nbytes;
25 msg.msg_iov = iov;
26 msg.msg_iovlen = 1;
27 if ( (n = recvmsg(fd, &msg, 0)) <= 0)
28 return (n);
29 #ifdef HAVE_MSGHDR_MSG_CONTROL
30 if ( (cmptr = CMSG_FIRSTHDR(&msg)) != NULL &&
31 cmptr->cmsg_len == CMSG_LEN(sizeof(int))) {
32 if (cmptr->cmsg_level != SOL_SOCKET)
33 err_quit("control level != SOL_SOCKET");
34 if (cmptr->cmsg_type != SCM_RIGHTS)
35 err_quit("control type != SCM_RIGHTS");
36 *recvfd = *((int *) CMSG_DATA(cmptr));
37 } else
38 *recvfd = -1; /* descriptor was not passed */
39 #else
40 if (msg.msg_accrightslen == sizeof(int))
41 *recvfd = newfd;
42 else
43 *recvfd = -1; /* descriptor was not passed */
44 #endif
45 return (n);
46 }
If the older msg_accrights member is supported, the length should be the size of an integer and the newly created descriptor is returned through the caller's recvfd pointer.
Figure shows the openfile program. It takes the three command-line arguments that must be passed and calls the normal open function.
unixdomain/openfile.c
1 #include "unp.h"
2 int
3 main(int argc, char **argv)
4 {
5 int fd;
6 if (argc != 4)
7 err_quit("openfile <sockfd#> <filename> <mode>");
8 if ( (fd = open(argv[2], atoi(argv[3]))) < 0)
9 exit((errno > 0) ? errno : 255);
10 if (write_fd(atoi(argv[1]), "", 1, fd) < 0)
11 exit((errno > 0) ? errno : 255);
12 exit(0);
13 }
7–12 Since two of the three command-line arguments were formatted into character strings by my_open, two are converted back into integers using atoi.
9–10 The file is opened by calling open. If an error is encountered, the errno value corresponding to the open error is returned as the exit status of the process.
11–12 The descriptor is passed back by write_fd, which we show next. This process then terminates. But, recall that earlier in the chapter, we said that it was acceptable for the sending process to close the descriptor that was passed (which happens when we call exit), because the kernel knows that the descriptor is in flight, and keeps it open for the receiving process.
The exit status must be between 0 and 255. The highest errno value is around 150. An alternate technique that doesn't require the errno values to be less than 256 would be to pass back an error indication as normal data in the call to sendmsg.
Figure shows the final function, write_fd, which calls sendmsg to send a descriptor (and optional data, which we do not use) across a Unix domain socket.
lib/write_fd.c
1 #include "unp.h"
2 ssize_t
3 write_fd(int fd, void *ptr, size_t nbytes, int sendfd)
4 {
5 struct msghdr msg;
6 struct iovec iov[1];
7 #ifdef HAVE_MSGHDR_MSG_CONTROL
8 union {
9 struct cmsghdr cm;
10 char control[CMSG_SPACE(sizeof(int))];
11 } control_un;
12 struct cmsghdr *cmptr;
13 msg.msg_control = control_un.control;
14 msg.msg_controllen = sizeof(control_un.control);
15 cmptr = CMSG_FIRSTHDR(&msg);
16 cmptr->cmsg_len = CMSG_LEN(sizeof(int));
17 cmptr->cmsg_level = SOL_SOCKET;
18 cmptr->cmsg_type = SCM_RIGHTS;
19 *((int *) CMSG_DATA(cmptr)) = sendfd;
20 #else
21 msg.msg_accrights = (caddr_t) & sendfd;
22 msg.msg_accrightslen = sizeof(int);
23 #endif
24 msg.msg_name = NULL;
25 msg.msg_namelen = 0;
26 iov[0].iov_base = ptr;
27 iov[0].iov_len = nbytes;
28 msg.msg_iov = iov;
29 msg.msg_iovlen = 1;
30 return (sendmsg(fd, &msg, 0));
31 }
As with read_fd, this function must deal with either ancillary data or older access rights. In either case, the msghdr structure is initialized and then sendmsg is called.
We will show an example of descriptor passing in Section 28.7 that involves unrelated processes. Additionally, we will show an example in Section 30.9 that involves related processes. We will use the read_fd and write_fd functions we just
|
http://codeidol.com/unix/unix-network-programming/Unix-Domain-Protocols/Passing-Descriptors/
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
Sponsors:
Haxx
Yang Tse wrote:
> As others have already stated, and you have verified, the problem is
> that the GSS MIT headers pollutes namespace on WIN32 builds using
> them.
> It seems that the origin of the problem mostly comes from the
> inclusion of win-mac.h in GSS headers. So lets go to the origin and
> prevent its inclusion by the GSS headers when building libcurl.
> This can be done with something like the following in libcurl's urldata.h
> Could you give this approach a try ?
Tried it, but doesn't look like that's going to work. gssapi/gssapi.h
also includes win-mac.h, and so also starts giving me duplicate definitions:
#if defined(_MSDOS) || defined(_WIN32)
#include <win-mac.h>
#endif
DR
Received on 2008-05-22
These mail archives are generated by hypermail.
Page updated November 12, 2010.
web site info
|
http://curl.haxx.se/mail/lib-2008-05/0224.html
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
Getting started with gprocedure
This is the getting started guide for the Generic Procedure (gprocedure) component of the grepo framework. It's not supposed to be a complete reference manual - the goal is to show a basic usage and configuration scenario of grepo's gprocedure component. procedure repository
- Defining procedures and functions
- Additional functionality
- Transaction Handling
Download the demo project
The demo project for this guide can be checked out from our SVN repository as follows:
$ svn checkout demo-grepo
Note: The demo application uses an Oracle database, so you need an Oracle instance running. Furthermore you need the appropriate jdbc driver in your classpath and you also will have to modify src/main/resources/META-INF/spring/db-environment.xml to configure the appropriate database connection settings. Additionally you need to setup the package used by the demo project by executing the sql scripts found in src/main/resources/META-INF/oracle. If you do not want to use Oracle, the demo project can easily be adapted to use different databases like Postgres etc...
You can now import the project in your eclipse workspace.
After you have imported the project you should now be able to run the DemoProcedure:'
Demo application
The teeny-weeny demo application consists of one database package (GREPO_DEMO) which contains one procedure and one function. The spec and body for the package can be found in src/main/resources/META-INF/oracle. The package spec looks like:
Using the grepo framework
In order to use the gprocedure component you need the following grepo artifacts (jars) in your project's classpath:
- grepo-core-<VERSION>.jar
- grepo-procedure-<VERSION>.jar
Somewhere in your Spring application context (xml) you have to import the default configuration of the grepo procedure. This configuration is "standard" Spring and is not grepo specific. In the demo project the oracle datasource dataSource property accordingly:
Using the grepo namespace the configuration above looks like:
That's it, you are now ready to build your data access layer using the grepo framework!
Creating the first procedure repository
Now its time to create the generic procedure repository for the GREPO_DEMO procedure. For this we just have to define an interface (demo.repository.DemoProcedure), which looks like:
Note that we define two method - one for the procedure demo_procedure and one for the function demo_function.
The next step is to configure a repository bean in our Spring application context:.DemoProcedure interfaces.
Finished! We can now inject our demoProcedure bean wherever we need to execute the procedure or function provided by the GREPO_DEMO package.
Defining procedures and functions
As you can see above we have defined a Map as the return type for both interface methods. This is the default return type of a procedure/function invocation. If you don't need to know the result of the procedure/function invocation just use void for the method's return type. Using Map as the return type is not always a decend choice because the calling code must be aware (hardcode) of the names (=keys in the Map) in order to retrieve the appropriate return values. In our examples we have (in fact) just one return parameter (that is _p_result_) and can return the value directly like this:
Note that we use the returnParamName property of the GenericProcedure annotation to tell grepo which parameter (of the Map) has to be returned. Also note that the method's return types have therefore changed from Map to String.
Depending on your needs there are several ways to define the procedure/function (IN, INOUT, OUT) parameters. Above we have used the most simple/intuitive way. You could also for instance define the parameters as follows:
Note that we define all (IN, OUT) parameters at the method level and use grepo's Param annotation to map method parameters to procedure IN (or INOUT) parameters.
How it works
You have to be aware that it is required to define all procedure/function parameters for a Spring StoredProcedure in the correct order. For our demo_procedure this means (due to the spec) that we have to define the parameters in the following order:
- IN p_string
- IN p_integer
- OUT p_result
You may wonder how grepo can know in which order the parameters have to be defined as we didn't tell the framework the appropriate order explicitly. The answer is conventions. For a procedure grepo assumes that parameters have to be defined in the order: IN, INOUT, OUT. For a function grepo assumes that parameters have to be defined in the order: OUT, INOUT, IN. If your package/function or repository method does not meet those conventions you may either consider writing a custom implementation of grepo's org.codehaus.grepo.procedure.compile.ProcedureCompilationStrategy interface or just use the index property of the grepo's In, InOut, Out annotations. The following example would not work (based on the procedure spec above):
Note that we have switched the order of param2 and param1 in the method. So grepo would define the parameters in the following order:
- IN p_intger
- IN p_string
- OUT p_result
As stated above it is required to define procedure/function parameters in correct order. A solution might be use the index property of grepo's In annotation as follows:
Additional functionalityProcedure annotation, like this:
Note that in this case the MyResultConverter class would be responsible to convert the result (Map) of the procedure invocation to an instance of SomeObject. procedure/functionProcedure annotation like this:
Tracking statistics.:
Note that you have to set the isReadOnly property of the GenericProcedure annotation to true in order to mark a procedure/function as read-only operation.
|
http://docs.codehaus.org/pages/viewpage.action?pageId=228175738
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
#include <db.h> int DB_ENV->log_archive(DB_ENV *env, char *(*listp)[], u_int32_t flags);
The
DB_ENV->log_archive() method returns an array of log or database
filenames.
By default,
DB_ENV-.
Arrays of log filenames_ENV-
DB_ENV->log_archive() method is the underlying method used by the
db_archive utility.
See the db_archive
utility source code for an example of using
DB_ENV->log_archive() in
a IEEE/ANSI Std 1003.1 (POSIX) environment.
The
DB_ENV->log_archive()
method returns a non-zero error value on failure and 0 on success.,
DB_ENV-
DB_ENV->log_archive()
method may fail and return one of the following non-zero errors:
|
http://docs.oracle.com/cd/E17276_01/html/api_reference/C/logarchive.html
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
J and mappings, there is a corner case I will explain below. First, let me define the entities and its relationship for modeling the data of the Institutions X Competition relationship.
Institutions X Competitions
We have two entities, with a ManyToMany relationship:
- Competition: is a virtual competition where students apply for the best academic homework of a region (a city, a state or even a country). Several competitions happen at same time in different places, sponsored and organized by different institutions.
- Institution: a company, a JUG or a school. It models the competitors' university, the JUG organizing a competition or a Company sponsoring a competition. Institutions have roles in a competition.
The problem: institution roles are dynamic
Competitions happens annually and for different competitions a same institution can have different roles. The classical example is about sponsorship: a company that was partner in the 2008 becomes platinum sponsor in 2009. The modeling of roles of the institutions is dynamic - institutions can have different roles in different competitions.
The solution: a Join Table with an additional state
The relation between competitions and institutions is a @ManyToMany relationship but we cannot just annotate the entities. In order to support the dynamic roles of institutions we need to customize the relation table, what means we need to add additional columns in the join table, as demonstrated in the diagram below.
Implementing the join table with JPA 1.x Annotations
The join table has @ManyToOne relationships with the two entities and also an enumeration with the possible roles an institution can have in a competition. In order to work as a real join table, you must use a @ClassId as composite primary key of the join table. You can check out the complete source code from here, but the relevant parts are in the below fragments.
The join table:
@Entity
@IdClass(PujInstitutionRoles_PK.class)
public class PujInstitutionRoles implements Serializable {
public enum Role {
SCHOOL, PUJ_OWNER, SPONSOR, PARTNER
}
@Enumerated(EnumType.STRING)
@Column(columnDefinition = "VARCHAR(20)")
private PujInstitutionRoles.Role role;
@Id
@ManyToOne
@PrimaryKeyJoinColumn(name = "INSTITUTION_ACRONYM", referencedColumnName = "acronym")
private PujInstitutionEntity institution;
@Id
@ManyToOne
@PrimaryKeyJoinColumn(name = "COMPETITION_NAME", referencedColumnName = "name")
private PujCompetitionEntity competition;
}
The composite primary key of the join table
public class PujInstitutionRoles_PK implements Serializable {
private String institution;
private String competition;
}
* Notice that @IdClass is a simple Java Type, not an Entity.
* Important detail: the field names of the ID Class should match the names of the ID fields of the Join Table.
The Institution model *
@Entity
public class PujInstitutionEntity implements Serializable {
@Id
@Column(length = 20)
private String acronym;
}
The Competition model *
@Entity
public class PujCompetitionEntity implements Serializable {
@Id
@Column(length = 12)
private String name;
}
* In my real model I also have the mapping from the entities to the join table, but I ommited here to make the examples shorter.
Using the model: our join serves for two basic purposes: to maintain the relationship between institutions and competitions and also to allow us to query that relationship. The insertion of a new relationship is a normal insert operation, but the queries on the join table requires the usage of named queries.How to find competitions by institutions?
The proper way to find this relationship is to define a @NamedQuery where I can find institutions by competitions, as demonstrated below. I am using some constants to facilitate the reference to the queries in other classes.
@NamedQueries( {
@NamedQuery(name = PujCompetitionEntity.SQL.FIND_BY_INSTITUTION,
query = "SELECT roles.competition FROM PujInstitutionRoles roles JOIN roles.institution inst WHERE inst.acronym=:"
+ PujCompetitionEntity.SQL.PARAM_INSTITUTION_ACRONYM) })
@Entity
public class PujCompetitionEntity implements Serializable {
public static final String FIND_BY_INSTITUTION = "findCompetitionByInstitution";
public static final String PARAM_INSTITUTION_ACRONYM = "institutionAcronym";
}
Example of usage:
@Stateless
public class PujCompetitionFacadeImpl {
@PersistenceUnit(name = "arenapuj")
protected EntityManagerFactory emf;
public Collection<PujCompetitionEntity> findByInstitution(String acronym,
int start, int max) throws IllegalStateException, IllegalArgumentException {
EntityManager manager = emf.createEntityManager();
try {
Query query = manager
.createNamedQuery(PujCompetitionEntity.FIND_BY_INSTITUTION);
query.setParameter(PujCompetitionEntity.PARAM_INSTITUTION_ACRONYM,
acronym);
query.setFirstResult(start);
query.setMaxResults(max);
return getResultList(query);
} finally {
if (manager != null && manager.isOpen()) {
manager.close();
}
}
}
}
Some live examples:
Summary
The solution for the above problem is predicted in the JPA specification but the annotations details for implementing a Join Table with an additional state is not so intuitive (IMO). I documented the solution for a future quick reference and I hope you can also benefit from that - if you disagree of my modeling or if you have any good suggestion, please give me your feedback.
From
|
http://java.dzone.com/articles/jpa-join-table-additional
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
This chapter describes the development steps required to create Notification Service applications using the CosNotification Service API and the C++ programming language.
This topic includes the following sections:
Table 4-1 outlines the development process for creating Notification Service applications.
These steps are explained in detail in subsequent topics.
The design of events is basic to any notification service. The design impacts not only the volume of information that is delivered to matching subscriptions, but the efficiency and performance of the Notification Service as well. Therefore, careful planning should be done to ensure that your Notification Service will be able to handle your needs now and allow for future growth. For a discussion of event design, see "Designing Events" on page -6.
The following types of CORBA applications can post events:
To post events, an application must, at a minimum, implement the following functions:
The following sections describe each of these functions.
Before the client application can post an event, it must get the event channel.
This development step is illustrated in Listing 4-1. Listing 4-1 is code from the
Reporter.cpp file in the Introductory sample application that uses the CosNotification Service API.
To get the event channel factory object reference, the
resolve_initial_references method is invoked on the Bootstrap object using the
"NotificationService" environmental object. The object reference is used to get the channel factory, which is, in turn, is used to get the event channel. Listing 4-1 shows code examples in C++.
// );
To post events, you must get the SupplierAdmin object, use it to create a proxy, create the event, and then post the event to the proxy.
Listing 4-2 shows how this is implemented in C++.
// Since we are a supplier (that is, we post events),
// get the SupplierAdmin object
CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin =
channel->default_supplier_admin();
// Use the supplier admin to create a proxy. Events are posted
// to the proxy (unlike the simple events interface where events
// are posted to the channel).
CosNotifyChannelAdmin::ProxyID proxy_id;
CosNotifyChannelAdmin::ProxyConsumer_var generic_proxy_consumer =
supplier_admin->obtain_notification_push_consumer(
CosNotifyChannelAdmin::STRUCTURED_EVENT, proxy_id );
CosNotifyChannelAdmin::StructuredProxyPushConsumer_var
proxy_push_consumer =
CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow(
generic_proxy_consumer );
// Connect to the proxy so that we can post events.
proxy_push_consumer->connect_structured_push_supplier(
CosNotifyComm::StructuredPushSupplier::_nil() );
...
// create an event
CosNotification::StructuredEvent notification;
// set the domain to "News"
notification.header.fixed_header.event_type.domain_name =
CORBA::string_dup("News");
// set the type to the news category
notification.header.fixed_header.event_type.type_name =
CORBA::string_dup("Sports");
// add one field, which will contain the story, to the
// event's filterable data. set the field's name to
// "Story" and value to a string containing the story
notification.filterable_data.length(1);
notification.filterable_data[0].name =
CORBA::string_dup("Story");
notification.filterable_data[0].value <<= "John Smith wins again";
// post the event
// Subscribers who subscribed to events whose domain is
// "News" and whose type matches the news category will
// receive this event
proxy_push_consumer->push_structured_event(notification);
...
// Disconnect.
proxy_push_consumer->disconnect_structured_push_consumer();
The following types of CORBA applications can subscribe to events:
To subscribe to events, an application must, at a minimum, support the following functions:
push_structured_eventoperation.
CosNotifyComm::StructuredPushConsumerinterface.
In order for the callback servant object to receive events, it must implement the CosNotifyComm::StructuredPushConsumer interface that supports the
push_structured_event operation. When an event occurs that has a matching subscription, the Notification Service invokes this operation on the servant callback object in the subscriber application to deliver the event to the subscriber application.
The CosNotifyComm::StructuredPushConsumer interface also defines the operations
offer_change and
disconnect_structured_push_consumer. The Notification Service never invokes these operations, so you should implement stubbed out versions that throw
CORBA::NO_IMPLEMENT.
Listing 4-3 and Listing 4-4 show how this interface is implemented in C++.
#ifndef _news_consumer_i_h
#define _news_consumer_i_h
#include "CosNotifyComm_s.h"
// For the servant class to receive news events,
// it must implement the CosNotifyComm::StructuredPushConsumer
// idl interface
class NewsConsumer_i : public POA_CosNotifyComm::StructuredPushConsumer
{
public:
// this method will be called when a news event occurs
virtual void push_structured_event(
const CosNotification::StructuredEvent& notification
);
// OMG's CosNotifyComm::StructuredPushConsumer idl
// interface defines the methods "offer_change" and
// "disconnect_structured_push_consumer". Since the
// Notification Service never invokes these methods, just
// have them throw a CORBA::NO_IMPLEMENT exception
virtual void offer_change(
const CosNotification::EventTypeSeq& added,
const CosNotification::EventTypeSeq& removed )
{
throw CORBA::NO_IMPLEMENT();
}
virtual void disconnect_structured_push_consumer()
{
throw CORBA::NO_IMPLEMENT();
}
};
#endif
#include "NewsConsumer_i.h"
#include <iostream.h>
//-----------------------------------------------------------
// Subscriber.cpp creates a simple events subscription to "News"
// events and has the events delivered to a NewsConsumer_i
// object. When a news event occurs (this happens when a user
// runs the Reporter application and reports a news story), this
// method will be invoked:
void NewsConsumer_i::push_structured_event(
const CosNotification::StructuredEvent& notification )
{
// extract the story from the first field in the event's
// filterable data
char* story;
notification.filterable_data[0].value >>= story;
// for coding simplicity, assume "story" is not "null"
// print out the event
cout
<< "-----------------------------------------------------"
<< endl
<< "Category : "
<< notification.header.fixed_header.
event_type.type_name.in()
<< endl
<< "Story : "
<< story
<< endl;
...
}
Before an application can create a subscription, it must get the event channel and the ConsumerAdmin and Filter Factory objects. Listing 4-5 shows how this is implemented in C++.
To get the event channel factory object reference, the
resolve_initial_references method is invoked on the Bootstrap object using the
"NotificationService" environmental object. The object reference is used to get the channel factory, which is, in turn, used to get the event channel. Finally, the event channel is used to get the ConsumerAdmin object and the FilterFactory object.
// );
// Use the channel to get the consumer admin and the filter factory.
CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin =
channel->default_consumer_admin();
CosNotifyFilter::FilterFactory_var filter_factory =
channel->default_filter_factory();
To receive events, the application must also be a server; that is, the application must implement a callback object that can be invoked (called back) when an event occurs that matches the subscriber's subscription.
Creating a callback object includes the following steps:
For a complete description of the BEAWrapper Callbacks object and its methods, see the Joint Client/Servers chapter in the CORBA Programming Reference.
Listing 4-6 shows how to use the BEAWrapper Callbacks object to create a callback object in C++. In the code examples, the
NewsConsumber_i servant is created and the
start_transient method is used to create a transient object reference.
// Create a callback wrapper object since this client needs to
// support callbacks
BEAWrapper::Callbacks wrapper(orb.in());
NewsConsumer_i* news_consumer_impl = new NewsConsumer_i;
// Create a transient object reference to this servant.
CORBA::Object_var news_consumer_oref =
wrapper.start_transient(
news_consumer_impl,
CosNotifyComm::_tc_StructuredPushConsumer->id()
);
CosNotifyComm::StructuredPushConsumer_var
news_consumer =
CosNotifyComm::StructuredPushConsumer::_narrow(
news_consumer_oref.in() );
In order for the subscriber to receive events, it must subscribe to the Notification Service. You can create a transient subscription or a persistent subscription.
To create a subscription, the following steps must be performed:
domain_name,
type_name, and
data_filter(optional) to it.
Listing 4-7 from the Introductory sample application, shows how to create a transient subscription in C++.
// Create a new subscription (at this point, it is not complete).
CosNotifyChannelAdmin::ProxyID subscription_id;
CosNotifyChannelAdmin::ProxySupplier_var generic_subscription =
consumer_admin->obtain_notification_push_supplier(
CosNotifyChannelAdmin::STRUCTURED_EVENT,
subscription_id );
CosNotifyChannelAdmin::StructuredProxyPushSupplier_var
subscription =
CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow(
generic_subscription );
s_subscription = subscription.in();
// Set the quality of service. This sets the subscription name
// and subscription type (=TRANSIENT).
CosNotification::QoSProperties qos;
qos.length(2);
qos[0].name =
CORBA::string_dup(Tobj_Notification::SUBSCRIPTION_NAME);
qos[0].value <<= subscription_name;
qos[1].name =
CORBA::string_dup(Tobj_Notification::SUBSCRIPTION_TYPE);
qos[1].value <<=
Tobj_Notification::TRANSIENT_SUBSCRIPTION;
subscription->set_qos(qos);
// Create a filter (used to specify domain, type and data filter).
CosNotifyFilter::Filter_var filter =
filter_factory->create_filter(
Tobj_Notification::CONSTRAINT_GRAMMAR );
s_filter = filter.in();
// Set the filtering parameters.
// (domain = "News", type = "Sports", and no data filter)
CosNotifyFilter::ConstraintExpSeq constraints;
constraints.length(1);
constraints[0].event_types.length(1);
constraints[0].event_types[0].domain_name =
CORBA::string_dup("News");
constraints[0].event_types[0].type_name =
CORBA::string_dup("Sports");
constraints[0].constraint_expr =
CORBA::string_dup(""); // No data filter.
CosNotifyFilter::ConstraintInfoSeq_var
add_constraints_results = // ignore this returned value
filter->add_constraints(constraints);
// Add the filter to the subscription.
CosNotifyFilter::FilterID filter_id =
subscription->add_filter(filter.in());
// Now that we have set the subscription name, type and filtering
// parameters, complete the subscription by passing in the
// reference of the callback object to deliver the events to.
subscription->connect_structured_push_consumer(
news_consumer.in() );
The final step in the development of a Notification Service application is to compile, build, and run the application. To do this, you need to perform the following steps.
To generate the client stub and skeleton files, you must execute the
idl command for each of the Notification IDL files that your application uses. Table 4-2 shows the
idl commands used for each type of subscriber.
The following is an example of an
idl command:
>idl -IC:\tuxdir\include C:\tuxdir\include\CosEventComm.idl
Table 4-3 lists the IDL files required by each type of Notification Service application.
The compiling and linking procedure differs depending on the type of Notification Service application you are building. Table 4-4 provides an overview of the commands and files used to compile each type of application.
Listing 4-8 shows the commands used for a C++ Reporter application (
Reporter.cpp) on a Microsoft Windows system. To form a C++ executable, the
idl command is run on the required IDL file and the
buildobjclient command compiles the C++ client application file and the IDL stubs.
# Run the idl command.
idl \Tobj_Notification.idl
# Run the buildobjclient command.
buildobjclient -v -o is_reporter.exe -f "\
-DWIN32 \
Reporter.cpp \
CosEventComm_c.cpp \
CosEventChannelAdmin_c.cpp \
CosNotification_c.cpp \
CosNotifyComm_c.cpp \
CosNotifyFilter_c.cpp \
CosNotifyChannelAdmin_c.cpp \
Tobj_Events_c.cpp \
Tobj_Notification_c.cpp "
# Run the application.
is_reporter
Listing 4-9 and Listing 4-10 show the commands used for a C++ Subscriber application (
Subscriber.cpp) on Microsoft Windows and UNIX, respectively. To form a C++ executable, the
buildobjclient command, with the
-P option, compiles the joint client/server application files (
Subscriber.cpp and
NewsConsumer_i.cpp), the IDL stubs, the IDL skeleton (for
CosNotifyComm_s.cpp).
# Run the idl command.
idl -P \CosNotifyChannelAdmin \ \C:\tuxdir\include\Tobj_Events.idl \
\C:\tuxdir\include\Tobj_Notification
# Run the buildobjclient command.
buildobjclient -v -P -o is_subscriber.exe -f " \
-DWIN32 \_Notification_c.cpp \
C:\tuxdir\lib\libbeawrapper.lib \
"
# Run the application.
is_subscriber
# Run the idl command.
idl -P -I/usr/local/tuxdir/include /usr/local/tuxdir/include/CosEventChannelAdmin \
/usr/local/tuxdir/include/CosEventComm.idl \
/usr/local/tuxdir/include/CosNotification.idl \
/usr/local/tuxdir/include/CosNotifyComm.idl \
/usr/local/tuxdir/include/CosNotifyFilter.idl \
/usr/local/tuxdir/include/CosNotifyChannelAdmin \
/usr/local/tuxdir/include/Tobj_Events.idl \
/usr/local/tuxdir/include/Tobj_SimpleEvents.idl
# Run the buildobjclient command.
buildobjclient -v -P -o subscriber -f " \_SimpleEvents_c.cpp \
-lbeawrapper \
"
# Run the application.
is_subscriber
|
http://docs.oracle.com/cd/E13203_01/tuxedo/tux100/notify/cos_apps.html
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
iMaterialWrapper Struct ReferenceA material wrapper is an engine-level object that wraps around an actual material (iMaterial).
More...
[Textures & Materials]
#include <iengine/material.h>
Inheritance diagram for iMaterialWrapper:
Detailed DescriptionA material wrapper is an engine-level object that wraps around an actual material (iMaterial).
Every material in the engine is represented by a material wrapper, which keeps the pointer to the material and its name, and possibly the base material object.
Main creators of instances implementing this interface:
Main ways to get pointers to this interface:
- iEngine::FindMaterial()
- iMaterialList::Get()
- iMaterialList::FindByName()
- iLoaderContext::FindMaterial()
- iLoaderContext::FindNamedMaterial()
- iMeshObject::GetMaterialWrapper()
- Various state interfaces for mesh objects.
Main users of this interface:
Definition at line 61 of file material.h.
Member Function Documentation
Get the original material.
Change the base material.
Note: The changes will not be visible until you re-register the material.
The documentation for this struct was generated from the following file:
- iengine/material.h
Generated for Crystal Space 1.2.1 by doxygen 1.5.3
|
http://www.crystalspace3d.org/docs/online/api-1.2/structiMaterialWrapper.html
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
[Python] What's with all the semicolons?
I'm looking at the
def getIndexItem(self):
# create a summary of the entry
digest = self.body[:self.DIGEST_LEN].replace('\n', '');
digest = self.HTML_STRIP.sub('', digest);
digest = digest.replace('>', '').replace('
When I learned about Python and started to work with it, I was told not to use the semicolons. In fact, I thought that was illegal. Is the parser just throwing them away? Does it have any purpose other than making those C programmers happy?
Wisconsin Passes Digital Download Tax
Sadly I found that out too.
In 2007, I took a job in Seattle that paid more and offered better opportunities but because I lived 1/2 the year in WI I had to pay them taxes as if I earned my annual wages in WI. I think this year was the first time I actually enjoyed filling out my taxes just so I don't have to file a state return.
The only redeeming part of paying that last year in taxes to WI was being able to fill out their form on why I moved out of state. I just hope they don't mind seeing the work f*ck all over the form.
Slashdot Turns 10 But You Get The Presents
Now I feel old and realize that my freshman year of college was 10 years ago.
|
http://beta.slashdot.org/~dthable
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
The first step in the Oracle B2B process flow, shown in Figure 3-1, is to create guideline files.
Figure 3-1 Oracle B2B Process Flow
Oracle B2B Document Editor is a guideline creation and implementation application for defining and managing custom document definitions for Oracle B2B transactions.
This chapter contains the following topics:
Introduction to Oracle B2B Document Editor
Installing Oracle B2B Document Editor
Creating Guideline Files: EDIFACT D98 Example
For complete documentation on the document editor, see the Oracle B2B Document Editor Help menu.
Oracle B2B Document Editor is a guideline creation and implementation application for business-to-business (B2B) electronic commerce (e-commerce). Use the document editor to simplify developing, migrating, testing, distributing, and printing your electronic business (e-business) guideline documents. You can create new guideline documents or use the document editor's comprehensive library of standards as templates.
Using an existing standard as a template, you can create new guidelines by changing the attributes of underlying segments, elements, and codes. You can also create a guideline file from a data file.
Figure 3-2 shows the types of available document guidelines: delimited flat file, EDI, HL7 2.x, HL7v3, NCPDP, ParserSchema, positional flat file (which includes SAP iDocs), RosettaNet, and XMLSchema.
Figure 3-2 Document Guidelines Available in Oracle B2B Document Editor
In addition to using the RosettaNet document guide lines in the document editor, you can also download standard DTD files from the RosettaNet Web site.
After creating a custom guideline file, use the Oracle B2B interface to include the documents in the document definition, as shown in Figure 3-3. See "Creating Document Definitions" for more information about this step.
Figure 3-3 Importing XSD and ECS File Created in Oracle B2B Document Editor
In Figure 3-3,
orders.xsd and
orders.ecs are imported to create the document definition. The ECS file is required in B2B for translating and validating documents. The XSD is optional in B2B; however, it provides an easy reference to the document schema when modeling a SOA composite for sending and receiving the document.
Oracle B2B Document Editor is installed from the Oracle B2B Document Editor CD. Oracle B2B Document Editor runs on Microsoft Windows only (Win 2000, WinXP, VistaFoot 1 32-bit and 64-bit, and Windows Server 2003), and requires the Microsoft .NET framework (installed automatically from the CD) for full support of W3C XML Schema guidelines.
Complete installation instructions are available from the Oracle B2B Document Editor Help menu by searching on installation and displaying the Preparation topic. A list of new features in this release of the document editor is also provided.
The following example describes how to create the guideline files—the ECS and XSD files— required to send an EDIFACT D98A purchase order, and how to generate and validate test data files based on the D98A–ORDERS guideline.
To create the EDIFACT transaction documents for this scenario, do the following:
Task 1, "Create the ECS File"
Task 2, "Create the XSD File"
Task 3, "Generate Data Using the ECS File"
Task 4, "Analyze the Data"
Using an existing EDIFACT guideline (standard) as a template, create a purchase order guideline file called orders.ecs.
Open Oracle B2B Document Editor.
Click New Document and then EDI.
Expand EDIFACT and D98A.
Select ORDERS - Purchase order message and click Next.
Ensure that Insert Envelope Segments is not selected and click Finish.
Oracle B2B Document Editor is preseeded with all versions of the interchange (envelope). Oracle B2B handles the envelop based on the settings.
Select this option only if you require a variation from the standard (for example, if you want to use a nonstandard qualifier for the partner identification code qualifier in the interchange sender or recipient, then add a required value in the codelist).
(Optional) Edit the segment-level details.
No edits are needed for this scenario.
From File, select Save.
Accept the default directory and enter
orders.ecs for the file name.
By default, the ECS file is saved to
My Documents\Oracle\Oracle B2B\ Guidelines.
Using the guideline file in its internal format (the ECS file), create an XML schema definition file (the XSD format) to use with Oracle B2B.
From File, select Open.
orders.ecs and click Open.
From File, select Export.
In the Export Wizard, select Oracle B2B 2.0 from the list of export types and click Next.
Use the Oracle B2B 2.0 export type to provide a namespace of your choice, as in
urn:oracle:b2b:EDIFACT/D98A/ORDERS for this example. (Use the Oracle B2B option to have a fixed namespace provided for you.)
In the Export Destination dialog, do the following and click Next.
Accept the default directory
Select Save guideline before exporting
Select Show advanced options
The XSD file is saved with the ECS file in
My Documents\Oracle\Oracle B2B\Guidelines.
In the XSD Namespace Options dialog, do the following and click Next.
Select Custom namespace
Provide a namespace, in this example,
urn:oracle:b2b:EDIFACT/D98A/ORDERS
In the Templates Configuration dialog, click Next.
No edits to the elements in the template are needed in this scenario.
In the Conversion Options dialog, do the following and click Next.
Check the Suppress Enumeration in XSD option. This is recommended because code lists are in the ECS file. Suppressing enumeration reduces the XSD size considerably.
Check the Use this export module instead of default during XData generation option.
In the Document Conversion Options dialog, accept the default, Allow to use SegmentCount macro, and click Next.
The SegmentCount macro counts the number of segments. The data type of the XSD element is changed from numeric to string to enable the count.
Ensure that the Launch Oracle B2B option is not select (it is not needed in this scenario) and click Next.
If you want to start Oracle B2B, enter the URL for your B2B interface (
http://
host_name:port/
b2b).
In the Macro Nodes dialog, click Next.
No macros are needed for any of the nodes in this scenario.
If you see the message "Some characters were replaced in XSD names because they are not allowed," click OK.
Click Finish.
The
orders.xsd file is created in Oracle B2B 2.0 format.
Using the Data Generator, create a test data file based on the guideline.
Click Data Generator.
Select New Test Case and click Next.
Click Generate and click Next.
This step generates new data using the specified data dictionaries.
Select From a guideline file, select ORDERS.ecs, and click Next.
Select Select Envelope Segments from the Standards Database and click Next.
Select the Syntax 3 envelope segment and click Next.
Select Use directly from the Standards Database and click Next.
The envelope segments are not incorporated in the guideline file.
Select Mandatory + Percentage of optional data and move the slider to indicate the percentage.
Select User Option and click Next.
Select Any size and click Next.
Select Do not reset and click Next.
Set the repeat count options, depending on how many messages you want generated.
Select any data dictionaries you want to use.
Accept the default delimiters and click Next.
Click Output Data file name, enter
C:\D98A_ORDERS.dat and click Next.
The DAT file opens.
Save and close the file.
Using the Analyzer, validate the data file against the
orders.ecs guideline file, and test the data file against the standard to check for required segments or elements that may be missing.
Click Analyzer.
Browse for
D98A_orders.dat and click Next.
Ensure that Show Advanced Options is selected and click Next.
In the Clean Up Data File dialog, click Next.
No preprocessing is needed in this scenario.
In the Data Structure dialog, click Next.
The entire document is validated by default.
Select the guideline file (ECS file) against which to check the data. Do the following and click Next.
Select From a guideline file.
Select orders.ecs.
Select Select Envelope Segments from the Standards Database and click Next.
The selected guideline file (ECS file) does not contain envelope segments.
Select the Syntax 3 envelope segment and click Next.
Select Use directly from the Standards Database and click Next.
The envelope segments are not incorporated in the guideline file.
In the Analyzer Mode and Outputs dialog, accept the default settings, set Generate XData (XML) to Always and click Next.
The results, including any error messages, are displayed.
To view the data in XML format, click the XML icon in the upper right corner.
Use the View as XML (shown) and View as HTML options to view the data. Click the Save Data As icon to export the XML report as an XML file.
Footnote LegendFootnote 1: When using Microsoft Vista, do not install Oracle B2B Document Editor in the program folder, for which admin privilege is needed.
|
http://docs.oracle.com/cd/E12839_01/integration.1111/e10229/bb_doc_ed.htm
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
.fx
To run the program, use the following command:
javafx jfx_book.HelloJFX
Have fun, and please post a comment if you have any questions!
Jim Weaver
JavaFX Script: Dynamic Java Scripting for Rich Internet/Client-side Applications
Immediate eBook (PDF) download available at the book's Apress site
I don't know why the example above doesn't work for me:
-NetBeans IDE 6.1 (Build 200804211638)
-1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
What's wrong? Has something change since July?
I had to make your code more like this:
package jfx_book;
import javafx.application.Frame;
import javafx.application.Stage;
import javafx.scene.text.Text;
import javafx.scene.FontStyle;
import javafx.scene.Font;
Frame {
title: "Hello World-style example for JavaFX Script"
height: 100
width: 400
stage:
Stage {
content:
Text {
font:
Font {
name: "Sans Serif"
style: FontStyle.BOLD
size: 24
}
x: 15
y: 50
content: "Hello JavaFX Script Developer!"
}
}
// Show the Frame on the screen
visible: true
}
Posted by: Piotr Hełka | September 08, 2008 at 10:34 AM
|
http://learnjavafx.typepad.com/weblog/2008/07/updated-javafx.html
|
CC-MAIN-2014-42
|
en
|
refinedweb
|
Yes, you've guessed correctly - the answer is "42". In this article you will find 42 recommendations about coding in C++ that can help a programmer avoid a lot of errors, save time and effort. The author is Andrey Karpov - technical director of "Program Verification Systems", a team of developers, working on PVS-Studio static code analyzer. Having checked a large number of open source projects, we have seen a large variety of ways to shoot yourself in the foot; there is definitely much to share with the readers. Every recommendation is given with a practical example, which proves the currentness of this question. These tips are intended for C/C++ programmers, but usually they are universal, and may be of interest for developers using other languages.
About the author. My name is Andrey Karpov..
A little bit of history. Not so long ago I created a resource, where I shared useful tips and tricks about programming in C++. But this resource didn't get the expected number of subscribers, so I don't see the point in giving a link to it here. It will be on the web for some time, but eventually, it will be deleted. Still, these tips are worth keeping. That's why I've updated them, added several more and combined them in a single text. Enjoy reading!
Consider the code fragment, taken from MySQL project. The code contains an error that PVS-Studio analyzer diagnoses in the following way: V525 The code containing the collection of similar blocks. Check items '0', '1', '2', '3', '4', '1', '6'. I don't think it was a good idea in this case.
Firstly, I doubt that the programmer has (slow).
The following code fragment is taken from CoreCLR project. The code has an error that PVS-Studio analyzer diagnoses in the following way: V698 Expression 'memcmp(....) == -1' is incorrect. This function can return not only the value '-1', but any negative value. Consider using 'mem );
Compares the first num bytes of the block of memory pointed by ptr1 to the first num bytes pointed by ptr2, returning zero if they all match, or a value different from zero representing which is greater, if they do not.
Return value:
Note that if blocks aren't the same, then the function returns values greater than or less than zero. Greater or less. This is important! You cannot compare the results of such functions as memcmp(), strcmp(), strncmp(), and so on works.
The fragment is taken from Audacity project. The error is detected by the following PVS-Studio diagnostic: V501 There are identical sub-expressions to the left and to the right of the '-', and that's why there will speak about them several times here. I am declaring war on code may cause many errors. Here, take a look at some examples of bugs detected with the V501 diagnostic. Half of these errors are caused by using Copy-Paste.
If you copy the code and then edit it - check what you've got! Don't be lazy!
We'll talk more about Copy-Paste later. The problem actually goes deeper than it may seem, and I won't let you forget about it.
Fragment taken from the Haiku project (inheritor of BeOS). The error is detected by the following PVS-Studio diagnostic: V502 Perhaps the '?:' operator works in a different way than it was expected. The '?:' operator has a lower priority than the '-'.
The fragment is taken from LibreOffice project. The error is detected by the following PVS-Studio diagnostic: V718 The 'CreateThread' function should not be called from 'Dll
I used to have a side job as a freelancer long time ago. Once I was given a task I failed to accomplish. The task itself was formulated incorrectly, but I didn't realise that at the time. Moreover, it seemed clear and simple at first.
Under a certain condition in the DllMain I had to do some actions, using Windows API functions; I don't remember which actions exactly, but it wasn't anything difficult.
So I spent loads of time on that, but the code just wouldn't work. More than that, when I made a new standard application, it worked; but it didn't when I tried it in the DllMain function. Some magic, isn't it? I didn't manage to figure out the root of the problem at the time.
It's only now that I work on PVS-Studio development, so many years later, that I have suddenly realized the reason behind that old failure..
The fragment is taken from IPP Samples project. The error is detected by the following PVS-Studio diagnostic: V205 Explicit conversion of pointer type to 32-bit integer type: (unsigned long)(img)
void write_output_image(...., const Ipp32f *img, ...., const Ipp32s iStep) { ... img = (Ipp32f*)((unsigned long)(img) + iStep); ... }
Note. Some may say that this code isn't the best example for several reasons. We are not concerned about why a programmer would need to move along a data buffer in such a strange way. What matters to us is the fact that the pointer is explicitly cast to the "unsigned long" type. And only this. I chose this example purely because it is brief. 'long' type is 64-bit too, but it's still a bad idea to use 'long'.
This bug was found in Pixie project. The error is detected by the following PVS-Studio diagnostic: V505 The 'Stack Reserve Size', and 'Stack:
This issue was found in LibreOffice project. The error is detected by the following PVS-Studio diagnostic: V509 The 'dynamic.
The fragment is taken from Notepad++ project. The error is detected by the following PVS-Studio diagnostic: The error text: V528 It is odd that pointer to 'char' type is compared with the '\0' value. Probably meant: *headerM != '\0'.
TCHAR headerM[headerSize] = TEXT(""); ... size_t Printer::doPrint(bool justDoIt) { ... if (headerM != '\0') ... }
Explanation
Thanks to this code's author, using the ' '\0', or simply the value 0. So please don't be lazy - avoid using 0 for shorter notations in every single case. It only makes the code less comprehensible, and errors harder to find.
Use the following notations:
Sticking to this rule will make your code clearer, and make it easier for you and other programmers to spot bugs during code reviews.
The fragment is taken from CoreCLR project. The error is detected by the following PVS-Studio diagnostic: V522 Dereferencing of the null pointer 'hp'
I believe that #ifdef/#endif constructs are evil - an unavoidable evil, unfortunately. They are necessary and we have to use them. So I won't urge you to stop using #ifdef, there's no point in that. But I do want to ask you to be careful to not "overuse" it.
I guess, I I'm not sure how best to fix this error.
As I see it, since (hp == nullptr), then the 'res' variable should be initialized to some other value, too - but I I I were to write the get_segment_for_loh() function, I wouldn't use a number of #ifdefs there; I.
I?
The fragment is taken from Godot Engine project. The error is detected by the following PVS-Studio diagnostic: V567 Undefined behavior. The 't'.
This bug was found in Source SDK library. The error is detected by the following PVS-Studio diagnostic: V525 The code containing the collection of similar blocks. Check items 'SetX', 'SetY', 'SetZ', 'Set
I'm 100% sure this code was written with the help of Copy-Paste. One of the first lines was copied several times, with certain letters changed in its duplicates. At the very end, this technique failed the programmer: his attention weakened, and he forgot to change letter 'Z' to 'W'
I hope you have already read the article I've mentioned above.:
Fragment taken from the ReactOS project (open-source operating system compatible with Windows). The error is detected by the following PVS-Studio diagnostic: V560 A part of conditional expression is always true: 10035L.
void adns__querysend_tcp(adns_query qu, struct timeval now) { ... if (!(errno == EAGAIN || EWOULDBLOCK || errno == EINTR || errno == ENOSPC || errno == ENOBUFS || errno == ENOMEM)) { ... }
Explanation
The code sample given above is small and you can easily spot the error in it. But when dealing with real-life code, bugs are often very hard to notice. When reading code like that, you tend to unconsciously skip blocks of similar comparisons and go on to the next fragment.
The reason why it happens has to do with the fact that conditions are poorly formatted and you don't feel like paying too much attention to them because it requires certain effort, and we assume that since the checks are similar, there are hardly any mistakes in the condition and everything should be fine.
One of the ways out is formatting the code as a table.
If you felt too lazy to search for an error in the code above, I'll tell you: "errno ==" is missing in one of the checks. It results in the condition always being true as the EWOULDBLOCK is not equal to zero.
Correct code
if (!(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR || errno == ENOSPC || errno == ENOBUFS || errno == ENOMEM)) {
Recommendation
For a start, here's a version of this code formatted in the simplest "table" style. I don't like it actually.
if (!(errno == EAGAIN || EWOULDBLOCK || errno == EINTR || errno == ENOSPC || errno == ENOBUFS || errno == ENOMEM)) {
It's better now, but not quite.
There are two reasons why I don't like this layout. First, the error is still not much visible; second, you have to insert too many spaces to align the code.
That's why we need to make two improvements in this formatting style. The first one is we need to use no more than one comparison per line: it makes errors easy to notice. For example:
a == 1 && b == 2 && c && d == 3 &&
The second improvement is to write operators &&, ||, etc., in a more rational way, i.e. on the left instead of on the right.
See how tedious it is to align code by means of spaces:
x == a && y == bbbbb && z == cccccccccc &&
Writing operators on the left makes it much faster and easier:
x == a && y == bbbbb && z == cccccccccc
The code looks a bit odd, but you'll get used to it very soon.
Let's combine these two improvements to write our code sample in the new style:
if (!( errno == EAGAIN || EWOULDBLOCK || errno == EINTR || errno == ENOSPC || errno == ENOBUFS || errno == ENOMEM)) {
Yes, it's longer now - yet the error has become clearly seen, too.
I agree that it looks strange, but nevertheless I do recommend this technique. I've been using it myself for half a year now and enjoy it very much, so I'm confident about this recommendation.
I don't find it a problem at all that the code has become longer. I'd even write it in a way like this:
const bool error = errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR || errno == ENOSPC || errno == ENOBUFS || errno == ENOMEM; if (!error) {
Feel disappointed with the code being too lengthy and cluttered? I agree. So let's make it a function!
static bool IsInterestingError(int errno) { return errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR || errno == ENOSPC || errno == ENOBUFS || errno == ENOMEM; } .... if (!IsInterestingError(errno)) {
You may think that I'm dramatizing things, being too much of a perfectionist. But I assure you that errors are very common in complex expressions, and I wouldn't ever bring them up weren't they 'so frequent. They are everywhere. And they are very difficult to notice.
Here's another example from WinDjView project:
inline bool IsValidChar(int c) { return c == 0x9 || 0xA || c == 0xD || c >= 0x20 && c <= 0xD7FF || c >= 0xE000 && c <= 0xFFFD || c >= 0x10000 && c <= 0x10FFFF; }
The function consists of just a few lines, but it still has an error. The function always returns true. The reason, in the long run, has to do with poor formatting and programmers maintaining the code for many years being unwilling to read it carefully.
Let's refactor this code in the "table" style, I'd also add some parentheses:
inline bool IsValidChar(int c) { return c == 0x9 || 0xA || c == 0xD || (c >= 0x20 && c <= 0xD7FF) || (c >= 0xE000 && c <= 0xFFFD) || (c >= 0x10000 && c <= 0x10FFFF); }
You don't have to format your code exactly the way I suggest. The aim of this post is to draw your attention to typos in "chaotically" written code. By arranging it in the "table" style, you can avoid lots of silly typos, and that's already great. So I hope this post will help you.
Note
Being completely honest, I have to warn you that "table" formatting may sometimes cause harm. Check this example:
inline void elxLuminocity(const PixelRGBi& iPixel, LuminanceCell< PixelRGBi >& oCell) { oCell._luminance = 2220*iPixel._red + 7067*iPixel._blue + 0713*iPixel._green; oCell._pixel = iPixel; }
It's taken from the eLynx SDK project. The programmer wanted to align the code, so he added 0 before the value 713. Unfortunately, he forgot that 0 being the first digit in a number means that this number is octal.
An array of strings
I hope that the idea about the table formatting of the code is clear, but I feel like giving couple more examples. Let's have a look at one more case. By bringing it here, I am saying that the table formatting should be used not only with conditions, but also with other various constructions of a language.
The fragment is taken from Asterisk project. The error is detected by the following PVS-Studio diagnostic: V653 A suspicious string consisting of two parts is used for array initialization. It is possible that a comma is missing. Consider inspecting this literal: "KW_INCLUDES" "KW_JUMP".
static char *token_equivs1[] = { .... "KW_IF", "KW_IGNOREPAT", "KW_INCLUDES" "KW_JUMP", "KW_MACRO", "KW_PATTERN", .... };
There is a typo here - one comma is forgotten. As a result two strings that have completely different meaning are combined in one, i.e. we actually have:
.... "KW_INCLUDESKW_JUMP", ....
The error could be avoided if the programmer used the table formatting. Then, if the comma is omitted, it will be easy to spot.
static char *token_equivs1[] = { .... "KW_IF" , "KW_IGNOREPAT" , "KW_INCLUDES" , "KW_JUMP" , "KW_MACRO" , "KW_PATTERN" , .... };
Just like last time, pay attention, that if we put the delimiter to the right (a comma in this case), you have to add a lot of spaces, which is inconvenient. It is especially inconvenient if there is a new long line/phrase: we will have to reformat the entire table.
That's why I would again recommend formatting the table in the following way:
static char *token_equivs1[] = { .... , "KW_IF" , "KW_IGNOREPAT" , "KW_INCLUDES" , "KW_JUMP" , "KW_MACRO" , "KW_PATTERN" .... };
Now it's very easy to spot a missing comma and there is no need to use a lot of spaces - the code is beautiful and intuitive. Perhaps this way of formatting may seem unusual, but you quickly get used to it - try it yourself.
Finally, here is my short motto. As a rule, beautiful code is usually correct code.
We have already spoken about good styles of coding, but this time we'll have a look at an anti-example. It's not enough to write good code: there can be various errors and a good programming style isn't always a cure-all.
The fragment is taken from PostgreSQL. The error is detected by the following PVS-Studio diagnostic: V575 The 'memcmp' function processes '0' elements. Inspect the third argument.
Cppcheck analyzer can also detect such errors. It issues I can't suggest any safe coding technique to avoid typos. The only thing I can think of is "Yoda conditions", when constants are written to the left of the comparison operator:
if (0 == memcmp(&(beentry->st_clientaddr), &zero_clientaddr, sizeof(zero_clientaddr)))
But I won't recommend this style. I don't like and don't use it for two reasons:
First, it makes conditions less readable. I me point it out for I could recommend to avoid writing closing parentheses in wrong places.
And here's where the compiler should come in handy and warn us about such a strange construct, shouldn't it? Well, it should but it doesn't. I run Visual Studio 2015, specify the /Wall switch... and don't get any warning. But we can't blame the compiler for that, it has enough work to do as it is.
The most important conclusion for us to draw from today's post is that good coding style and compiler (and I do like the compiler in VS2015) do not always make it. I sometimes hear statements like, "You only need to set the compiler warnings at the highest level and use good style, and everything's going to be OK" No, it's not like that. I:
I suppose you have already guessed that I am personally interested in the static code analysis methodology most of all. By the way, it is most appropriate for solving this particular issue because it can detect errors at the earliest stage, i.e. right after the code has been written.
Indeed, this error can be easily found by such tools as Cppcheck or PVS-Studio.
Conclusion..
All the examples of this error I have are large. I've picked one of the smallest, but it's still quite lengthy. Sorry for that.
This bug was found in Source SDK library. The error is detected by the following PVS-Studio. I came across it even in such projects as Clang, TortoiseGit, and Linux Kernel.
The reason why it is so frequent is that enumerations are not type safe in the standard C++; you may get easily confused about what should be compared with what.
Correct code
I don't know for sure what the correct version of this code should look like. My guess is that PUNTED_BY_CANNON should be replaced with DROPPED_BY_CANNON or LAUNCHED_BY_CANNON. Let it be LAUNCHED_BY_CANNON.
if( Reason == LAUNCHED_BY_CANNON ) { PlayPuntSound(); }
Recommendation
Consider yourself lucky if you write in C++; I recommend that you start using enum class right now and the compiler won't let you compare values, that refer to different enumerations. You won't be comparing pounds with inches anymore.
There are certain innovations in C++ I don't have much confidence in. Take, for instance, the auto keyword. I believe it may be harmful when used too often. Here's how I the fuck is Alice?!
Sorry for digressing from our subject. I wanted to show you that some of the new features may do both good and bad. But it's not the case with enum class: I I do urge you to start using enum class in new code right from this day on. Your project will only benefit from it.
I don't see much point in introducing enum class. Here's a few links for you to learn all the details about this new wonderful feature of the C++11 language:
This section will be slightly similar to "Don't try to squeeze as many operations as possible in one line", but this time I want to focus on a different thing. Sometimes it feels like programmers are competing against somebody, trying to write the shortest code possible.
I am not speaking about complicated templates. This is a different topic for discussion, as it is very hard to draw a line between where these templates do harm, and where they do good. Now I am going to touch upon a simpler situation which is relevant for both C and C++ programmers. They tend to make the constructions more complicated, thinking, "I do it because I can".
The fragment is taken from KDE4 project. The error is detected by the following PVS-Studio diagnostic: V593 Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)'.
void LDAPProtocol::del( const KUrl &_url, bool ) { .... if ( (id = mOp.del( usrc.dn() ) == -1) ) { LDAPErr(); return; } ret = mOp.waitForResult( id, -1 ); .... }
Explanation
After looking at this code, I '-1', the function will terminate; otherwise, it will keep running and the 'id' variable will be assigned an incorrect value. So it will always equal 0.
Correct code
I.
So my conclusion is - don't try to show off.
This tip sounds trivial, but I hope it will help you. It's always better to write clear and neat code, instead of in a "see how cool I am" style.
The fragment is taken from the Apache HTTP Server project. The error is detected by the following PVS-Studio diagnostic: V597 The compiler could delete the 'memset' function call, which is used to flush 'x' 'x' buffer, but this buffer is not used anywhere after that, which means the call of the memset() function can - and ought to - be deleted.
Important! What I.
The fragment is taken from Putty project. Ineffective code is detected by the following PVS-Studio diagnostic: V814 Decreased performance. Calls to the 'str.
Let's have a look at an example of code written in Pascal. The word called will be printed only once, because the pstrlen() is called only once.
program test; var i : integer; str : string; function pstrlen(str : string): integer; begin writeln('called'); pstr.
This issue was found in LibreOffice project. The error is detected by the following PVS-Studio diagnostic: V603 The object was created but it is not being used. If you wish to call constructor, 'this-. I'll spare you the examples - it should be obvious as it is.
That's a fine, reliable, clear, and safe technique. However, some bad programmers want to make their code even shorter. So I:
The fragment is taken from SETI@home project. The error is detected by the following PVS-Studio diagnostic: V663 Infinite loop is possible. The 'cin.eof()' condition is insufficient to break from the loop. Consider adding the 'cin article.
Let's continue the topic of working with files. And again we'll have a look at EOF. But this time we'll speak about a bug of a completely different type. It usually reveals itself in localized versions of software.
The fragment is taken from Computational Network Toolkit. The error is detected by the following PVS-Studio diagnostic: V739 EOF should not be compared with a value of the 'char' type. The 'c' should be of the 'int' '-1 ', I wanted to show an interesting variant of an error, that some people aren't aware of.
Just remember, if the functions return the values of int type, don't hasten to change it into char. Stop and check that everything is fine. By the way, we have already had a similar case discussing the function memcmp() in Chapter N2 - "Larger than 0 does not mean 1" (See the fragment about a vulnerability in MySQL)
The fragment is taken from TortoiseGIT project. The error is detected by the following PVS-Studio diagnostic: V665 Possibly, the usage of '#pragma warning(default: X)' is incorrect in this context. The ' 'pragma warning(default : X)' directive sets the 'X'.
A good article on this topic: So, You Want to Suppress This Warning in Visual C++
The fragment is taken from the OpenSSL library. The error is detected by the following PVS-Studio diagnostic: V666 Consider inspecting the third argument of the function 'strncmp'. It is possible that the value does not correspond with the length of a string which was passed with the second; I). I have no idea what to say to C programmers. You can write a special macro for it, but personally I don't like this variant. I am not a fan of macros. That's why I don't know what to suggest..
The fragment is taken from the MFC library. The error is detected by the following PVS-Studio diagnostic: V301 Unexpected function overloading behavior. See first argument of function 'WinHelpW' in derived class 'CFrameWndEx' and base class 'C:
The fragment is taken from CoreCLR project. This dangerous code is detected by the following PVS-Studio diagnostic: V704 'this == nullptr' expression should be avoided - this expression is always false on newer compilers, because 'this' pointer can never be NULL.
bool FieldSeqNode::IsFirstElemFieldSeq() { if (this == nullptr) return false; return m_fieldHnd == FieldSeqStore::FirstElemPseudoField; }
Explanation
People used to compare this pointer with 0 / NULL / nullptr. It was a common situation when C++ was only in the beginning of its development. We have found such fragments doing "archaeological" research. I suggest reading about them in an article about checking Cfront. Moreover, in those days the value of this pointer could be changed, but it was so long ago that it was forgotten.
Let's go back to the comparison of this with nullptr.
Now it is illegal. According to modern C++ standards, this can NEVER be equal to nullptr.
Formally the call of the IsFirstElemFieldSeq() method for a null-pointer this according to C++ standard leads to undefined behavior.
It seems that if this==0, then there is no access to the fields of this class while the method is executed. But in reality there are two possible unfavorable ways of such code implementation. According to C++ standards, this pointer can never be null, so the compiler can optimize the method call, by simplifying it to:
bool FieldSeqNode::IsFirstElemFieldSeq() { return m_fieldHnd == FieldSeqStore::FirstElemPseudoField; }
There is one more pitfall, by the way. Suppose there is the following inheritance hierarchy.
class X: public Y, public FieldSeqNode { .... }; .... X * nullX = NULL; X->IsFirstElemFieldSeq();
Suppose that the Y class size is 8 bytes. Then the source pointer NULL (0x00000000) will be corrected in such a way, so that it points to the beginning of FieldSeqNode sub object. Then you have to offset it to sizeof(Y) byte. So this in the IsFirstElemFieldSeq() function will be 0x00000008. The "this == 0" check has completely lost its sense.
Correct code
It's really hard to give an example of correct code. It won't be enough to just remove this condition from the function. You have to do the code refactoring in such a way that you will never call the function, using the null pointer.
Recommendation
So, now the "if (this == nullptr)" is outlawed. However, you can see this code in many applications and libraries quite often (MFC library for instance). That's why Visual C++ is still diligently comparing this to 0. I guess the compiler developers are not so crazy as to remove code that has been working properly for a dozen years.
But the law was enacted. So for a start let's avoid comparing this to null. And once you have some free time, it will be really useful to check out all the illegal comparisons, and rewrite the code.
Most likely the compilers will act in the following way. First they will give us comparison warnings. Perhaps they are already giving them, I haven't studied this question. And then at some point they'll fully support the new standard, and your code will cease working altogether. So I strongly recommend that you start obeying the law, it will be helpful later on.
P.S. When refactoring you may need the Null object pattern.
Additional links on the topic:
The fragment is taken from NAME project. The code contains an error that PVS-Studio I really ask you to be very careful with any types which are new to you, and not to hasten when programming.
Let's talk about one more nasty data type - BSTR (Basic string or binary string).
The fragment is taken from VirtualBox project. The code contains an error that PVS-Studio analyzer diagnoses in the following way: V745 A 'wchar_t *' type string is incorrectly converted to 'BSTR' type string. Consider using 'SysAllocString' function.
.... single-character string that is converted to a wide-character string through the inclusion of the "L" string modifier. The debugger will also show a two-byte terminating null character (0x0000) that appears after the data string.
If you pass a simple Unicode string as an argument to a COM function that is expecting a BSTR, the COM function will fail.
I hope this is enough to understand why we should separate the BSTR and simple strings of "wchar_t *" type.
Additional links:
Correct code
hr = pIEventSubscription->put_EventClassID( SysAllocString(L"{d5978630-5b9f-11d1-8dd2-00aa004abd5e}"));
Recommendation
The tip resembles the previous one. If you see an unknown type, it's better not to hurry, and to look it up in the documentation. This is important to remember, so it's not a big deal that this tip was repeated once again.
The fragment is taken from ReactOS project. The code contains an error that PVS-Studio
This time the code example will be quite lengthy. Fortunately it's rather easy, so it shouldn't be hard to understand. I
I cannot say that macros are my favorite. I know there is no way to code without them, especially in C. Nevertheless I try to avoid them if possible, and would like to appeal to you not to overuse them. My macro hostility has three reasons:
A lot of other errors are connected with macros. The one I've given as an example shows very clearly that sometimes we don't need macros at all. I really cannot grasp the idea of why the authors didn't use a simple function instead. Advantages of a function over a macro:
Concerning the disadvantages, I. I.
To my mind,. But this is a different story, I won't talk about it in a section on macros.
The fragment is taken from the Unreal Engine 4 project. Ineffective code is detected by the following PVS-Studio diagnostic: V803 Decreased performance. In case , I think it would've been quite hard to notice an issue in the code. At first sight, it looks like the code is quite correct, but it's not perfect. Yes, I am talking about the postfix increment - 'Iter++'. Instead of a postfix form of the increment iterator, you should rather use a prefix analogue, i.e. to substitute 'Iter++' for '++Iter'. Why should we do it, and what's the practical value of it? Here is the story.
Effective code:
for( auto Iter(NotificationLists.CreateConstIterator()); Iter; ++Iter)
Recommendation
The difference between a prefix and a postfix form is well known to everybody. I hope that the internal structure distinctions (which show us the operational principles) are not a secret as well. If you have ever done the operator overloading, then you must be aware of it. If not - I'll give a brief explanation. (All the others can skip this paragraph and go to the one, which follows the code examples with operator overloading) 'it++' and '+ I):
The fragment is taken from Energy Checker SDK. The code contains an error that PVS-Studio analyzer diagnoses in the following way: V576 Incorrect format. Consider checking the second actual argument of the 'w.
Correct code
The code I give here as a way to correct the issue is really not the most graceful one, but I still want to show the main point of corrections to make.
char *p = NULL; ... #ifdef defined(_WIN32) wprintf(L"Using power link directory: %S\n"), p); #else wprintf(L"Using power link directory: %s\n"), p); #endif
Recommendation
I don't have any particular recommendation here. I, I recommend doing some reading on the topic:
The fragment is taken from the game 'Wolf'. The code contains an error that PVS-Studio analyzer diagnoses in the following way: V511 The sizeof() operator returns size of the pointer, and not of the array, in 'sizeof . I suggest reading "Do not pass an array as a single pointer". All in all it would be a good thing to read the "C++ Core Guidelines" whenever you have free time. It contains a lot of useful ideas.
The fragment is taken from TortoiseSVN project. The code contains an error that PVS-Studio analyzer diagnoses in the following way: V618 It's dangerous to call the 'printf'. Take some time to look through it; I'm sure it will be interesting..
This bug was found in GIT's source code. The code contains an error that PVS-Studio analyzer diagnoses in the following way: V595 The 'tree' I have to give more reasons to prove my point. That's why this article topic is another attempt to change their mind.
I.
I. As I have already written,. The next section is to underline the fact that undefined behavior is really dangerous.
This:);
Explanation
This code works correctly if you build a 32-bit version of the program; if we compile the 64-bit version, the situation will be more complicated.
A 64-bit program allocates a 5 GB anything can happen.
To get more in-depth information, I suggest the following links: only be).
The fragment is taken from the Appleseed project. The code contains an error that PVS-Studio analyzer diagnoses in the following way: V719 The switch statement does not cover all values of the 'Input - I.
I suggest solving this problem in the following way; I.
I think you got pretty tired looking at numerous error patterns. So this time, let's take a break from looking at code.
A typical situation - your program is not working properly. But you have no idea what's going on. In such situations I recommend not rushing to blame someone, but focus on your code. In 99.99% of cases, the root of the evil is a bug that was brought by someone from your development team. Very often this bug is really stupid and banal. So go ahead and spend some time looking for it!
The fact that the bug occurs from time to time means nothing. You may just have a Heisenbug.
Blaming the compiler would be an even worse idea. It may do something wrong, of course, but very rarely. It will be very awkward if you find out that it was an incorrect use of sizeof(), for example. I have a post about that in my blog: The compiler is to blame for everything
But to set the record straight, I should say that there are exceptions. Very seldom the bug has nothing to do with the code. But we should be aware that such a possibility exists. This will help us to stay sane.
I'll demonstrate this using an example of a case that once happened with me. Fortunately, I have the necessary screenshots.
I was making a simple test project that was intended to demonstrate the abilities of the Viva64 analyzer (the predecessor of PVS-Studio), and this project was refusing to work correctly.
After long and tiresome investigations, I saw that one memory slot is causing all this trouble. One bit, to be exact. You can see on the picture that I am in debug mode, writing the value "3" in this memory cell.
After the memory is changed, the debugger reads the values to display in the window, and shows number 2: See, there is 0x02. Although I've set the "3" value. The low-order bit is always zero.
A memory test program confirmed the problem. It's strange that the computer was working normally without any problems. Replacement of the memory bank finally let my program work correctly.
I was very lucky. I had to deal with a simple test program. And still I spent a lot of time trying to understand what was happening. I was reviewing the assembler listing for more than two hours, trying to find the cause of the strange behavior. Yes, I was blaming the compiler for it.
I can't imagine how much more effort it would take, if it were a real program. Thank God I didn't have to debug anything else at that moment.
Recommendation
Always look for the error in your code. Do not try to shift responsibility.
However, if the bug reoccurs only on your computer for more than a week, it may be a sign that it's not because of your code.
Keep looking for the bug. But before going home, run an overnight RAM test. Perhaps, this simple step will save your nerves.
Fragment taken from the Haiku project (inheritor of BeOS). The code contains an error that PVS-Studio analyzer diagnoses in the following way: V696 The 'continue' operator will terminate 'do { ... } while (FALSE)' loop because the condition is always false.
do { .... if (appType.InitCheck() == B_OK && appType.GetAppHint(&hintRef) == B_OK && appRef == hintRef) { appType.SetAppHint(NULL); // try again continue; } .... } while (false);
Explanation
The way continue works inside the do-while loop, is not the way some programmers expect it to. When continue is encountered, there will always be a check of loop termination condition. I'll try to explain this in more details. Suppose the programmer writes code like this:
for (int i = 0; i < n; i++) { if (blabla(i)) continue; foo(); }
Or like this:
while (i < n) { if (blabla(i++)) continue; foo(); }
Most programmers by intuition understand that when continue is encountered, the controlling condition (i < n) will be (re)evaluated, and that the next loop iteration will only start if the evaluation is true. But when a programmer writes code:
do { if (blabla(i++)) continue; foo(); } while (i < n);
the intuition often fails, as they don't see a condition above the continue, and it seems to them that the continue will immediately trigger another loop iteration. This is not the case, and continue does as it always does - causes the controlling condition to be re-evaluated.
It depends on sheer luck if this lack of understanding of continue will lead to an error. However, the error will definitely occur if the loop condition is always false, as it is in the code snippet given above, where the programmer planned to carry out certain actions through subsequent iterations. A comment in the code "//try again" clearly shows their intention to do so. There will of course be no "again", as the condition is always false, and so once continue is encountered, the loop will terminate.
In other words, it turns out that in the construction of this do {...} while (false), the continue is equivalent to using break.
Correct code
There are many options to write correct code. For example, create an infinite loop, and use continue to loop, and break to exit.
for (;;) { .... if (appType.InitCheck() == B_OK && appType.GetAppHint(&hintRef) == B_OK && appRef == hintRef) { appType.SetAppHint(NULL); // try again continue; } .... break; };
Recommendation
Try to avoid continue inside do { ... } while (...). Even if you really know how it all works. The thing is that you could slip and make this error, and/or that your colleagues might read the code incorrectly, and then modify it incorrectly. I will never stop saying it: a good programmer is not the one who knows and uses different language tricks, but the one who writes clear understandable code, that even a newbie can comprehend.
New C++ standards brought quite a lot of useful changes. There are things which I would not rush into using straight away, but there are some changes which need to be applied immediately, as they will bring with them, significant benefits.
One such modernization is the keyword nullptr, which is intended to replace the NULL macro.
Let me. I;
To my mind,.
I.
This bug was found in Miranda NG's project. The code contains an error that PVS-Studio analyzer diagnoses in the following way: V502 Perhaps the '?:' operator works in a different way than was expected. The '?:' operator has a lower priority than the '|' operator..
#define MF_BYCOMMAND 0x00000000L void CMenuBar::updateState(const HMENU hMenu) const { .... ::CheckMenuItem(hMenu, ID_VIEW_SHOWAVATAR, MF_BYCOMMAND | dat->bShowAvatar ? MF_CHECKED : MF_UNCHECKED); .... }
Explanation
We have seen a lot of cases that lead to incorrect working of the program, this time I would like to raise a different thought-provoking topic for discussion. Sometimes we see that totally incorrect code happens, against all odds, to work just fine! Now, for experienced programmers this really comes as no surprise (another story), but for those that have recently started learning C/C++, well, it might be a little baffling. So today, we'll have a look at just such an example.
In the code shown above, we need to call CheckMenuItem() with certain flags set; and, on first glance we see that if bShowAvatar is true, then we need to bitwise OR MF_BYCOMMAND with MF_CHECKED - and conversely, with MF_UNCHECKED if it's false. Simple!
In the code above the programmers have chosen the very natural ternary operator to express this (the operator is a convenient short version of if-then-else):
MF_BYCOMMAND | dat->bShowAvatar ? MF_CHECKED : MF_UNCHECKED
The thing is that the priority of |operator is higher than of ?: operator. (see Operation priorities in C/C++). As a result, there are two errors at once.
The first error is that the condition has changed. It is no longer - as one might read it - "dat->bShowAvatar", but "MF_BYCOMMAND | dat->bShowAvatar".
The second error - only one flag gets chosen - either MF_CHECKED or MF_UNCHECKED. The flag MF_BYCOMMAND is lost.
But despite these errors the code works correctly! Reason - sheer stroke of luck. The programmer was just lucky that the MF_BYCOMMAND flag is equal to 0x00000000L. As the MF_BYCOMMAND flag is equal to 0, then it doesn't affect the code in any way. Probably some experienced programmers have already gotten the idea, but I'll still give some comments in case there are beginners here.
First let's have a look at a correct expression with additional parenthesis:
MF_BYCOMMAND | (dat->bShowAvatar ? MF_CHECKED : MF_UNCHECKED)
Replace macros with numeric values:
0x00000000L | (dat->bShowAvatar ? 0x00000008L : 0x00000000L)
If one of the operator operands | is 0, then we can simplify the expression:
dat->bShowAvatar ? 0x00000008L : 0x00000000L
Now let's have a closer look at an incorrect code variant:
MF_BYCOMMAND | dat->bShowAvatar ? MF_CHECKED : MF_UNCHECKED
Replace macros with numeric values:
0x00000000L | dat->bShowAvatar ? 0x00000008L : 0x00000000L
In the subexpression "0x00000000L | dat->bShowAvatar" one of the operator operands | is 0. Let's simplify the expression:
dat->bShowAvatar ? 0x00000008L : 0x00000000L
As a result we have the same expression, this is why the erroneous code works correctly; another programming miracle has occurred.
Correct code
There are various ways to correct the code. One of them is to add parentheses, another - to add an intermediate variable. A good old if operator could also be of help here:
if (dat->bShowAvatar) ::CheckMenuItem(hMenu, ID_VIEW_SHOWAVATAR, MF_BYCOMMAND | MF_CHECKED); else ::CheckMenuItem(hMenu, ID_VIEW_SHOWAVATAR, MF_BYCOMMAND | MF_UNCHECKED);
I really don't insist on using this exact way to correct the code. It might be easier to read it, but it's slightly lengthy, so it's more a matter of preferences.
Recommendation
My recommendation is simple - try to avoid complex expressions, especially with ternary operators. Also don't forget about parentheses.
As it was stated before in chapter N4, the ?: is very dangerous. Sometimes it just slips your mind that it has a very low priority and it's easy to write an incorrect expression. People tend to use it when they want to clog up a string, so try not to do that.
It is strange to read such big pieces of text, written by a developer of a static code analyzer, and not to hear recommendations about the usage of it. So here it is.
Fragment taken from the Haiku project (inheritor of BeOS). The code contains an error that PVS-Studio analyzer diagnoses in the following way: V501 There are identical sub-expressions to the left and to the right of the '<' operator: lJack->m_jackType < lJack->m_jackType
int compareTypeAndID(....) { .... if (lJack && rJack) { if (lJack->m_jackType < lJack->m_jackType) { return -1; } .... }
Explanation
It's just a usual typo. Instead of rJack it was accidentally written lJack in the right part of the expression.
This typo is a simple one indeed, but the situation is quite complicated. The thing is that the programming style, or other methods, are of no help here. People just make mistakes while typing and there is nothing you can do about it.
It's important to emphasize that it's not a problem of some particular people or projects. No doubt, all people can be mistaken, and even professionals involved in serious projects can be. Here is the proof of my words. You can see the simplest misprints like A == A, in such projects as: Notepad++, WinMerge, Chromium, Qt, Clang, OpenCV, TortoiseSVN, LibreOffice, CoreCLR, Unreal Engine 4 and so on.
So the problem is really there and it's not about students' lab works. When somebody tells me that experienced programmers don't make such mistakes, I usually send them this link.
Correct code
if (lJack->m_jackType < rJack->m_jackType)
Recommendation
First of all, let's speak about some useless tips.
What can really be effective?
I should say right away, that every strategy has its strong and weak sides. That's why the best way to get the most efficient and reliable, code is to use all of them together.
Code reviews can help us to find a great deal of different errors, and on top of this, they help us to improve readability of the code. Unfortunately shared reading of the text is quite expensive, tiresome and doesn't give a full validity guarantee. It's quite hard to remain alert, and find a typo looking at this kind of code:);
Theoretically, unit tests can save us. But it's only in theory. In practice, it's unreal to check all the possible execution paths; besides that, a test itself can have some errors too :)
Static code analyzers are mere programs, and not artificial intelligence. An analyzer can skip some errors and, on the contrary, display an error message for code which in actuality, is correct. But despite all these faults, it is a really useful tool. It can detect a whole lot of errors at an early stage.
A static code analyzer can be used as a cheaper version of Code Review. The program examines the code instead of a programmer doing it, and suggests checking certain code fragments more thoroughly.
Of course I would recommend using PVS-Studio code analyzer, which we are developing. But it's not the only one in the world; there are plenty of other free and paid tools to use. For example you can start with having a look at a free open Cppcheck analyzer. A good number of tools is given on Wikipedia: List of tools for static code analysis.
Attention:
Really, try using static code analyzers, you'll like them. It's a very nice sanitary tool.
Finally I would recommend reading an article by John Carmack: Static Code Analysis.
Suppose.
I strongly recommend avoiding adding a new library to a project. Please don't get me wrong. I am, I have seen quite a lot of problems caused by a large number of third-party libraries. I will probably enumerate only some of the issues, but this list should already provoke some thoughts:
Again, I should emphasize; I me give you an example from my own practice. In the process of developing the PVS-Studio analyzer, we needed to use simple regular expressions in a couple of diagnostics. In general, I am convinced that static analysis isn't the right place for regular expressions. This is an extremely inefficient approach. I even wrote an article regarding this topic. I was reading a book "Beautiful Code" (ISBN 9780596510046). This book is about simple and elegant solutions. And there I came across an extremely simple implementation of regular expressions. Just a few dozen strings. And that's it!
I I am not talking about several months, we have happily used it for more than five years.
This case really convinced me I:
P.S. The things I speak about here may not be completely acceptable to everyone. For example, the fact that I'm recommending the use of WinAPI, instead of a universal portable library. There may arise objections based on the idea that going this way "binds" this project to one operating system. And then it will be very difficult to make a program portable. But I do not agree with this. Quite often the idea "and then we'll port it to a different operating system" exists only in the programmer's mind. Such a task may even be unnecessary for managers. Another option - the project will kick the bucket due to the complexity and universality of it before gaining popularity and having the necessity to port. Also don't forget about point (8) in the list of problems, given above.
The fragment is taken from WinMerge project. The code contains an error that PVS-Studio.
I.
I hope you enjoyed this collection of tips. Of course, it is impossible to write about all the ways to write a program incorrectly, and there is probably no point in doing this. My aim was to warn a programmer, and to develop a sense of danger. Perhaps, next time when a programmer encounters something odd, he will remember my tips and won't haste. Sometimes several minutes of studying the documentation or writing simple/clear code can help to avoid a hidden error that would make the life of your colleagues and users miserable for several years.
I also invite everybody to follow me on Twitter @Code_Analysis
Bugless coding!
Sincerely, Andrey Karp ...
|
https://www.viva64.com/en/b/0391/
|
CC-MAIN-2021-04
|
en
|
refinedweb
|
Odom Axes not in line with base_link
Hi,
I am using Powerbot to be able to build a map using gmapping algorithm. To setup my robot, I am using the ROSARIA package to be able to have control on the motors, get pose estimates from odometry etc. This is an ROS wrapper for the ARIA library provided by ActivMedia mobilerobots.
I am aware that I need some tf configuration in order to align the odometry frame with the base_link and to align the laser frame with base_link frame. I have followed the tutorials and I have understood the concept. I came across this tutorial and followed it to be able to create my transforms while using ROSARIA. However, in doing so, I have noticed that the odometry axes is not aligned with the base_link axes. The laser axes are aligned perfectly as can be seen in this screenshot. The odometry axes as the ones far off from the other two.
I am aware that ROSARIA publishes its own tf as can be seen from rosgraph.png. The current transform tree according to my code is this. The code that I am using to build the transformations is the following:
#include <ros/ros.h> #include <tf/transform_broadcaster.h> #include <nav_msgs/Odometry.h> void poseCallback(const nav_msgs::Odometry::ConstPtr& odomsg) { //TF odom=> base_link static tf::TransformBroadcaster odom_broadcaster; odom_broadcaster.sendTransform( tf::StampedTransform( tf::Transform(tf::Quaternion(odomsg->pose.pose.orientation.x, odomsg->pose.pose.orientation.y, odomsg->pose.pose.orientation.z, odomsg->pose.pose.orientation.w), tf::Vector3(odomsg->pose.pose.position.x/1000.0, odomsg->pose.pose.position.y/1000.0, odomsg->pose.pose.position.z/1000.0)), odomsg->header.stamp, "/odom", "/base_link")); ROS_DEBUG("odometry frame sent"); ROS_INFO("odometry frame sent: y=[%f]", odomsg->pose.pose.position.y/1000.0); } int main(int argc, char** argv){ ros::init(argc, argv, "pioneer_tf"); ros::NodeHandle n; ros::Rate r(100); tf::TransformBroadcaster broadcaster; //subscribe to pose info ros::Subscriber pose_sub = n.subscribe<nav_msgs::Odometry>("RosAria/pose", 100, poseCallback); while(n.ok()){ //base_link => laser broadcaster.sendTransform( tf::StampedTransform( tf::Transform(tf::Quaternion(0, 0, 0), tf::Vector3(/*0.034, 0.0, 0.250*/0.385, 0, 0.17)), ros::Time::now(), "/base_link", "/laser")); ros::spinOnce(); r.sleep(); } }
Of course, the maps created using this setup are a mess. This happens after I move the robot with the joystick for a bit. Initially, on starting up ROSARIA and the transform node the axes are aligned. It is only after the robot moves that they lose their alignment. Can someone help me understand what is wrong with my transform tree and how can I fix this? Thanks!
EDIT
This is a typical example of what happens to my robot's odometry when I drive it around a little bit. Basically, it moved forwards, then turned around a desk and then moved forwards some more. I do not expect such bad odometry.
|
https://answers.ros.org/question/203074/odom-axes-not-in-line-with-base_link/
|
CC-MAIN-2021-04
|
en
|
refinedweb
|
What I'm doing is loading my Player Character as a prefab which then has the ability to instantiate a 2nd prefab that is supposed to be able assume control while the player character is locked in place.
The prefab instantiated by the player character and the player character has a camera (nested) attached to them. I'm trying to slect the prefab's camera so that when the player is controlling the prefab te prefab's camera is active as the main camera.
The problem I'm running into is that I can't figure out how to refer to the prefab's camera to activate or deactivate it.
"gameObject.GetComponent" only refers to the components of the prefab and not to the nested camera so I'm lost.
Here's the script as I have it now...
public class PlayerController : MonoBehaviour {
public float rotateSpeed;
public float forwardSpeed;
public float jumpHeight;
public Transform Armana;
public Camera MainCamera;
private Camera ArmanaCam;
private CharacterController playerController;
private bool PlayerActive = true;
// Use this for initialization
void Start () {
playerController = GetComponent<CharacterController> ();
MainCamera.enabled = true;
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.Q)) {
if (PlayerActive) {
PlayerActive = false;
Armana.GetComponent<PMonsterController>().enabled = true;
MainCamera.enabled = false;
MainCamera.GetComponent <AudioListener>().enabled = false;
ArmanaCam.enabled = true;
ArmanaCam.GetComponent <AudioListener>().enabled = true;
} else {
PlayerActive = true;
Armana.GetComponent<PMonsterController>().enabled = false;
ArmanaCam.enabled = false;
ArmanaCam.GetComponent <AudioListener>().enabled = false;
MainCamera.enabled = true;
MainCamera.GetComponent <AudioListener>().enabled = true;
}
}
if (Input.GetKeyDown (KeyCode.E)) {
Instantiate (Armana, transform.position, transform.rotation);
//Assaign ArmanaCam... somehow
ArmanaCam.enabled = false;
ArmanaCam.GetComponent <AudioListener>().enabled = false;
}
if (PlayerActive) {
if (Input.GetButton ("Jump") && playerController.isGrounded) {
playerController.Move (Vector3.up * jumpHeight);
}
transform.Rotate (0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
Vector3 forward = transform.TransformDirection (Vector3.forward);
float speed = forwardSpeed * Input.GetAxis ("Vertical");
playerController.SimpleMove (speed * forward);
}
}
}
Answer by JerryC92
·
Sep 24, 2017 at 07:28 AM
@Durakken I'm not sure if you ever figured out how to solve this issue of yours. I ran into a similar problem with my own project. I was instantiating some vehicles with cameras attached but inactive. I wanted to pick a vehicle out of the various spawned ones to control, but needed to have the desired cameras become active and I found that I could not do this from the spawn script directly. I eventually got it to work by attaching an "EnableCameras" script to the vehicle prefab that looked like this:
public class EnableCameras : MonoBehaviour {
[SerializeField] public Camera RightRear;
[SerializeField] public Camera LeftRear;
void Update()
{
if (Input.GetKeyDown(KeyCode.D))
{
RightRear.GetComponent<Camera>().enabled = true;
LeftRear.GetComponent<Camera>().enabled = true;
}
}
Then in my spawner script, I enabled the "EnableCameras" script whenever the player decides to take control of their desired vehicle:
whatToSpawnClone[j].GetComponent<UnityStandardAssets.Vehicles.Car.EnableCameras>().enabled = true;
Perhaps not the most elegant solution, but it did work for the purpose of activating the cameras in a particular instantiated.
How do I get an instantiated button to active/de-active a gameobject
0
Answers
disable gameobject after rotation limit
1
Answer
How do you set Prefabs into a GameObject array that will activate/deactivate when called?
1
Answer
Setting a gameObject active when a button is pressed
2
Answers
SetActive not working as should
0
Answers
|
https://answers.unity.com/questions/1163821/how-do-i-enabledisable-a-camera-on-an-instantiated.html
|
CC-MAIN-2021-04
|
en
|
refinedweb
|
Security is an essential feature in any web application to protect against unauthorized intrusions and data thefts. One way to secure your app is via authentication. Authentication helps control user access to parts of an application and determines the identity of users.
Authentication strategies for React applications include:
- Passwords
- Two-factor authentication (2FA)
- Captchas
- Token
- Single sign-on (SSO)
In this tutorial, we’ll walk through:
- Setting up a basic authentication flow with React
- Controlling access to particular parts of the application
- The idea behind magic links
- Integrating Magic Links into React Applications
What are Magic Links?
Magic Links provide a way to authenticate users without a password. Developed by Fortmatic, a Magic Link is a link that is generated by the Magic SDK whenever a user signs up or logs into an application.
When a user signs up or logs in, the following occurs.
- A magic link is generated and sent to the user’s email address
- The user clicks the link andMagic authenticates the user
- If successful, the user is redirected back to the original point of authentication; if unsuccessful, an error page is shown
Why Magic Links?
For the user, Magic Links eliminates the hassle of setting and remembering a secure password. It also saves you from having to store and manage user passwords and sessions in databases. It uses a blockchain-based key management system similar to SSH, so whenever a user signs up or logs in, it generates a public-private key pair that is subsequently used to authenticate requests made by the user.
Prerequisites
To follow along with this tutorial, you’ll need the following.
Creating a React application
To get started, we have to create a new React project. Open your terminal, and run:
npx create-react-app react-magic-tutorial
This creates a React project in the
react-magic-tutorial directory. To run the app, go to the root of the directory and start the app by running the following commands.
cd react-magic-tutorial npm start
Setting up Magic
Before we create the components for our React application, we need to set up the Magic service.
Log into Magic, get your test publishable API key to gain access to the magic service, and copy it. Create a
.env file in the root directory of your application, open the file in your editor and paste the following.
REACT_APP_PK_KEY=API_KEY
Replace
API_KEY with the key you copied, then go back to your terminal and install the Magic SDK.
npm install --save magic-sdk
Next, create a file to handle the Magic service:
mkdir service cd service touch magic.js
This creates a
magic.js file in the service directory. Open the file in your editor and paste the following.
import { Magic } from 'magic-sdk'; const magic = new Magic(process.env.REACT_APP_PK_KEY); export const checkUser = async (cb) => { const isLoggedIn = await magic.user.isLoggedIn(); if (isLoggedIn) { const user = await magic.user.getMetadata(); return cb({ isLoggedIn: true, email: user.email }); } return cb({ isLoggedIn: false }); }; export const loginUser = async (email) => { await magic.auth.loginWithMagicLink({ email }); }; export const logoutUser = async () => { await magic.user.logout(); };
The
magic variable initializes the magic service with your publishable
API_KEY. The
checkUser function accepts a callback
cb as a parameter and checks whether the user is logged in. If the user is logged in, it gets the user metadata and passes it to the callback function. If the user is not logged in, it returns the callback function with the
isLoggedIn property set as false.
The
loginUser function takes the user email as a parameter and passes it to the
magic.auth.loginWithMagicLink({ email }) function. This function is responsible for creating and sending the login link to the user and creating a user session. The
logoutUser function logs the user out and destroys the session.
Building React components
The next step is to create the components that we’ll need for our application:
Authenticate— A form component that allows the user to sign up or sign in
Dashboard— A component that displays whether or not authentication was successful
PrivateRoute— A wrapper component that checks whether the user is authenticated before rendering a component; otherwise, it redirects the user back to the signup/login page
App— The main application component. It renders either the
Authenticationcomponent if the user isn’t logged in or the
Dashboardcomponent if the user is logged in.
We’ll be using React Contexts later to pass the user data to components rendered based on whether the user is authenticated or not. We’ll also be using React Router to handle routing.
To install React Router run the following command.
npm install react-router-dom
After installing, run the following commands.
cd src mkdir components cd components touch Authenticate.js DashBoard.js PrivateRoute.js
This creates a components directory with the components in the
src directory. Your folder structure should look similar to the screenshot below.
We’ll use the React Bootstrap library to style the project. Run the following command to install the library.
npm install react-bootstrap bootstrap
Open the
Authtentication.js folder and paste the following.
import React, { useState } from 'react'; import { useHistory } from 'react-router-dom'; import { Button, Form, FormGroup, FormLabel, FormControl, } from 'react-bootstrap'; import { loginUser } from '../services/magic'; const Authenticate = () => { const [email, setEmail] = useState(''); const [loading, setLoading] = useState(''); const [error, setError] = useState(null); const history = useHistory(); const handleSubmit = async (event) => { event.preventDefault(); setLoading(true); if (!email) { setLoading(false); setError('Email is Invalid'); return; } try { await loginUser(email); setLoading(false); history.replace('/dashboard'); } catch (error) { setError('Unable to log in'); console.error(error); } }; const handleChange = (event) => { setEmail(event.target.value); }; return ( <div className="w-50 p-5 mt-5 mx-auto"> <h1 className="h1 text-center">React Magic Form</h1> <Form onSubmit={handleSubmit} <FormGroup className="mt-3" controlId="formBasicEmail"> <FormLabel fontSize="sm">Enter Email Address</FormLabel> <FormControl type="email" name="email" id="email" value={email} onChange={handleChange} <p className="text-danger text-small">{error}</p> </FormGroup> <Button type="submit" size="md" className="d-block w-100" variant="primary" > {loading ? 'Loading...' : 'Send'} </Button> </Form> </div> ); }; export default Authenticate;
This component creates a form with a text field for an email address and a button to send the Magic link to the email the user inputs. When the user clicks the button, it runs the
handleSubmit function, which validates the email address and calls the
loginUser function from the
magic.js service file.
The next component we’ll tackle is the
Dashboard component. But first, let’s create a user context to pass down user data to our
Dashboard component. In the
src directory, run the following.
mkdir context cd context touch userContext.js
This creates a
userContext file in the context directory. Open the file and input the following.
import { createContext } from 'react'; export const UserContext = createContext({ user: null });
The
UserContext creates a context and sets the user property to be null by default. To learn more about context and how to effectively use them, read React’s documentation on context.
Open the
Dashboard.js component file and input the following.
import React, { useContext } from 'react'; import { useHistory } from 'react-router-dom'; import Button from 'react-bootstrap/Button'; import { UserContext } from '../context/UserContext'; import { logoutUser } from '../services/magic'; const Dashboard = () => { const { email } = useContext(UserContext); const history = useHistory(); const handleLogOut = async () => { try { await logoutUser(); history.replace('/'); } catch (error) { console.error(error); } }; return ( <div className="p-2"> <div className="d-flex justify-content-end"> <Button variant="primary" onClick={handleLogOut}> Sign Out </Button> </div> <h1 className="h1">User: {email}</h1> </div> ); }; export default Dashboard;
The Dashboard component displays the logged-in user email and a sign out button. The logged-in user is obtained from the context
UserContext; we use the
useContext hook to get the data we need from the
UserContext.
When the user clicks the sign out button, it calls the
handleLogOut function. The
handleLogOut function calls the
logoutUser function from the Magic service, which is responsible for destroying the user session and signing out the user.
After it does that, we redirect the user back to the sign up page using the
useHistory hook of the
react-router-dom package. The
useHistory hook gives us access to the user’s session history and allows us to redirect the user to a point in history.
Next, we create the
PrivateRoute component. The
PrivateRoute component allows us to create protected routes for our application — routes that the user can only access if they are logged in, such as the dashboard.
Open the
PrivateRoute.js file and input the following.
import React, { useContext } from 'react'; import { Redirect, Route } from 'react-router-dom'; import { UserContext } from '../context/UserContext'; const PrivateRoute = ({ component: Component, ...rest }) => { const { isLoggedIn } = useContext(UserContext); return ( <Route {...rest} render={(props) => isLoggedIn ? <Component {...props} /> : <Redirect to="/" /> } /> ); }; export default PrivateRoute;
The
PrivateRoute is a wrapper for the
Route component of
react-router-dom. It checks the user’s login status,
isLoggedIn, which is fetched from the
UserContext. If the login status is true, it renders the
Component prop. If not, we use another
react-router-dom component called
Redirect, which redirects the user to a location — in this case, the authentication page.
After all this is done, we bring everything together in our
App component. Open the
App.js component in the root directory and input the following.
import React, { useState, useEffect } from 'react'; import { Switch, BrowserRouter as Router, Route, Redirect, } from 'react-router-dom'; import Spinner from 'react-bootstrap/Spinner'; import { UserContext } from './context/UserContext'; import { checkUser } from './services/magic'; import Authenticate from './components/Authenticate'; import Dashboard from './components/Dashboard'; import PrivateRoute from './components/PrivateRoute'; const App = () => { const [user, setUser] = useState({ isLoggedIn: null, email: '' }); const [loading, setLoading] = useState(); useEffect(() => { const validateUser = async () => { setLoading(true); try { await checkUser(setUser); setLoading(false); } catch (error) { console.error(error); } }; validateUser(); }, [user.isLoggedIn]); if (loading) { return ( <div className="d-flex justify-content-center align-items-center" style={{ height: '100vh' }} > <Spinner animation="border" /> </div> ); } return ( <UserContext.Provider value={user}> <Router> {user.isLoggedIn && <Redirect to={{ pathname: '/dashboard' }} />} <Switch> <Route exact path="/" component={Authenticate} /> <PrivateRoute path="/dashboard" component={Dashboard} /> </Switch> </Router> </UserContext.Provider> ); }; export default App;
The first thing to note in the App component is the
useEffect hoo. We use this to validate the user whenever the app renders or the
isLoggedIn property of the user state changes. The
validateUser function called the
checkUser function of our Magic service, which checks to see whether the user is logged in. It accepts a callback, which is our
setUser function, and sets the user state depending on what is returned by the
checkUser function. If the
isLoggedIn property is true, then the user is redirected to the dashboard. We use the
UserContext.Provider to pass the user state to the sub-components of the application.
Our application has two routes: the
/ route, which renders the
Authentication component (our default component), and the
PrivateRoute mentioned earlier as a wrapper for the
Route component, which will only render the
Dashboard component if the user is logged in. The
Switch component ensures that only one route is rendered at a time by checking the path of the
Route component.
Now our application is ready. Start it up and test the authentication flow. After inputting the email address, a link should be sent to your email. When you click the link, it will direct you to go back to the application, which, after confirming the validity of the link, redirects you to the dashboard.
If you’re done playing around, you can sign out, which will take you back to the login page.
Conclusion
In this tutorial, we walked through how to secure your React application with Magic Links. The Magic service offers so much more beyond the scope of this article and supports integration with existing infrastructure. To expand your knowledge about Magic Links, I suggest reading the official documentation.
There is no one-size-fits-all when it comes to securing your applications. Magic is a viable alternative to the popular authentication strategies you’re likely used to.
You can find the repository for the application we built on GitHub..
|
https://blog.logrocket.com/authenticating-react-applications-with-magic-links/
|
CC-MAIN-2021-04
|
en
|
refinedweb
|
Graffiti/Directory
Resource Directory API
A common API to "tag" and search across existing and new services for cloud content based on the metadata vocabulary, ad-hoc properties, names, and descriptions.
Expanded Contextual Overlay
Below is an overlay of Graffiti concepts with Graffiti components.
Resources
Basically, resources are a common way to represent a type of resource from a given provider. They have the following:
- Name
- Description
- Resource Type
- Resource Endpoint
- Freeform properties (those not associated with a known namespace in the dictionary)
- Flat properties (those associated with a namespace, but not a capability type in the namespace)
- Capabilities (instances of capability types)
- Requirements (references to required capability types as well as the constraints)
For example, a resource may be of resource type volume. It may come from a specific Cinder endpoint registered in Keystone. It may have the capability of a certain kind of OS and may also have MySQL on it.
|
https://wiki.openstack.org/wiki/Graffiti/Directory
|
CC-MAIN-2021-04
|
en
|
refinedweb
|
Hi
This is to announce the general availability of pyFltk-1.1.2.
pyFltk is a Python binding for the FLTK GUI toolkit (see) and can be downloaded from.
Changes include:
FLTK and pyFltk are a very simple and intuitive GUI toolkit, enabling you to create professional user interfaces with a minimal effort. For instance, consider the following Hello World program, complete with button callback:
from fltk import * import sys
def theCancelButtonCallback(ptr): sys.exit(0)
window = Fl_Window(100,100,200,90, sys.argv[0]) button = Fl_Button(9,20,180,50) button.label("Hello World") button.callback(theCancelButtonCallback) window.end() window.show(sys.argv) Fl.run()
See for more examples.
Best regards
Andreas
[email protected]
|
https://mail.python.org/archives/list/[email protected]/thread/NCCCAJH564SDHPTA4BRRHUEMHOKZEU7C/
|
CC-MAIN-2021-04
|
en
|
refinedweb
|
Yes!
There's not any restriction on the number of attempts.It doesn't matter whether you were able to clear it last time or not.If you are a student of class 12 or below,you can participate in it.
INOI will be held early this year,maybe in early December.I am not sure yet,but things will be clear soon!
Full Solution:
Now imagine how our shortest path from S to T will look like.Let's denote the component in which S lies by A and the component in which T lies by B.Its not possible to reach T without entering the component B(as T lies in component B and S in component A).Consider the earliest moment when we reach component B from A,let that edge ...
Looking for hints,here we go
IOITC syllabus is almost similar to that of IOI. U can also see the problems at IOITC judge to get some idea.
i would rather suggest you to concentrate on jee,otherwise u will regret ur whole life !
It is a classical problem.Number of swaps needed is nothing but the number of inversions in the array.
I have solved it using BIT,below is my code.
#include <bits/stdc++.h>using namespace std;const int MAX=5e5;long long int N,X,ans,arr[MAX];map<long long int,long long int> mp;int BITS[MAX];void update(int X,int delta){while(X<=N){BITS[X]+=delta;X+=(X&-X);}}int query(int X){int res=0;while(X>0)
|
https://www.commonlounge.com/profile/2a51a0e1793945658716dcffba49c885
|
CC-MAIN-2021-04
|
en
|
refinedweb
|
Views are part of the MVC architecture. They are code responsible for presenting data to end users. In a Web application, views are usually created in terms of view templates which are PHP script files containing mainly HTML code and presentational PHP code. They are managed by the view application component which provides commonly used methods to facilitate view composition and rendering. For simplicity, we often call view templates or view template files as views.
As aforementioned, a view is simply a PHP script mixed with HTML and PHP code. The following is the view that presents a login form. As you can see, PHP code is used to generate the dynamic content, such as the page title and the form, while HTML code organizes them into a presentable HTML page.
use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $form yii\widgets\ActiveForm */ /* @var $model app\models\LoginForm */ $this->title = 'Login'; <h1> = Html::encode($this->title) </h1> <p>Please fill out the following fields to login:</p> $form = ActiveForm::begin(); = $form->field($model, 'username') = $form->field($model, 'password')->passwordInput() = Html::submitButton('Login') ActiveForm::end();
Within a view, you can access
$this which refers to the view component managing
and rendering this view template.
Besides
$this, there may be other predefined variables in a view, such as
$model in the above
example. These variables represent the data that are pushed into the view by controllers
or other objects which trigger the view rendering.
Tip: The predefined variables are listed in a comment block at beginning of a view so that they can be recognized by IDEs. It is also a good way of documenting your views.
When creating views that generate HTML pages, it is important that you encode and/or filter the data coming from end users before presenting them. Otherwise, your application may be subject to cross-site scripting attacks.
To display a plain text, encode it first by calling yii\helpers\Html::encode(). For example, the following code encodes the user name before displaying it:
use yii\helpers\Html; <div class="username"> <?= Html::encode($user->name) ?> </div>
To display HTML content, use yii\helpers\HtmlPurifier to filter the content first. For example, the following code filters the post content before displaying it:
use yii\helpers\HtmlPurifier; <div class="post"> <?= HtmlPurifier::process($post->text) ?> </div>
Tip: While HTMLPurifier does excellent job in making output safe, it is not fast. You should consider caching the filtering result if your application requires high performance.
Like controllers and models, there are conventions to organize views.
@app/views/ControllerIDby default, where
ControllerIDrefers to the controller ID. For example, if the controller class is
PostController, the directory would be
@app/views/post; if it is
PostCommentController, the directory would be
@app/views/post-comment. In case the controller belongs to a module, the directory would be
views/ControllerIDunder the module directory.
WidgetPath/viewsdirectory by default, where
WidgetPathstands for the directory containing the widget class file.
You may customize these default view directories by overriding the yii\base\ViewContextInterface::getViewPath() method of controllers or widgets.
You can render views in controllers, widgets, or any other places by calling view rendering methods. These methods share a similar signature shown as follows,
/** * @param string $view view name or file path, depending on the actual rendering method * @param array $params the data to be passed to the view * @return string rendering result */ methodName($view, $params = [])
Within controllers, you may call the following controller methods to render views:
For example,
namespace app\controllers; use Yii; use app\models\Post; use yii\web\Controller; use yii\web\NotFoundHttpException; class PostController extends Controller { public function actionView($id) { $model = Post::findOne($id); if ($model === null) { throw new NotFoundHttpException; } // renders a view named "view" and applies a layout to it return $this->render('view', [ 'model' => $model, ]); } }
Within widgets, you may call the following widget methods to render views.
For example,
namespace app\components; use yii\base\Widget; use yii\helpers\Html; class ListWidget extends Widget { public $items = []; public function run() { // renders a view named "list" return $this->render('list', [ 'items' => $this->items, ]); } }
You can render a view within another view by calling one of the following methods provided by the view component:
For example, the following code in a view renders the
_overview.php view file which is in the same directory
as the view being currently rendered. Remember that
$this in a view refers to the view component:
$this->render('_overview')=
In any place, you can get access to the view application component by the expression
Yii::$app->view and then call its aforementioned methods to render a view. For example,
// displays the view file "@app/views/site/license.php" echo \Yii::$app->view->renderFile('@app/views/site/license.php');
When you render a view, you can specify the view using either a view name or a view file path/alias. In most cases, you would use the former because it is more concise and flexible. We call views specified using names as named views.
A view name is resolved into the corresponding view file path according to the following rules:
.phpwill be used as the extension. For example, the view name
aboutcorresponds to the file name
about.php.
//, the corresponding view file path would be
@app/views/ViewName. That is, the view is looked for under the application's view path. For example,
//site/aboutwill be resolved into
@app/views/site/about.php.
/, the view file path is formed by prefixing the view name with the view path of the currently active module. If there is no active module,
@app/views/ViewNamewill be used. For example,
/user/createwill be resolved into
@app/modules/user/views/user/create.php, if the currently active module is
user. If there is no active module, the view file path would be
@app/views/user/create.php.
aboutwill be resolved into
@app/views/site/about.phpif the context is the controller
SiteController.
itemwill be resolved into
@app/views/post/item.phpif it is being rendered in the view
@app/views/post/index.php.
According to the above rules, calling
$this->render('view') in a controller
app\controllers\PostController will
actually render the view file
@app/views/post/view.php, while calling
$this->render('_overview') in that view
will render the view file
@app/views/post/_overview.php.
There are two approaches to access data within a view: push and pull.
By passing the data as the second parameter to the view rendering methods, you are using the push approach.
The data should be represented as an array of name-value pairs. When the view is being rendered, the PHP
extract() function will be called on this array so that the array is extracted into variables in the view.
For example, the following view rendering code in a controller will push two variables to the
report view:
$foo = 1 and
$bar = 2.
echo $this->render('report', [ 'foo' => 1, 'bar' => 2, ]);
The pull approach actively retrieves data from the view component or other objects accessible
in views (e.g.
Yii::$app). Using the code below as an example, within the view you can get the controller object
by the expression
$this->context. And as a result, it is possible for you to access any properties or methods
of the controller in the
report view, such as the controller ID shown in the following:
The controller ID is: $this->context->id=
The push approach is usually the preferred way of accessing data in views, because it makes views less dependent on context objects. Its drawback is that you need to manually build the data array all the time, which could become tedious and error prone if a view is shared and rendered in different places.
The view component provides the params property that you can use to share data among views.
For example, in an
about view, you can have the following code which specifies the current segment of the
breadcrumbs.
$this->params['breadcrumbs'][] = 'About Us';
Then, in the layout file, which is also a view, you can display the breadcrumbs using the data passed along params:
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], ])= yii\widgets\Breadcrumbs::widget([
Layouts are a special type of views that represent the common parts of multiple views. For example, the pages for most Web applications share the same page header and footer. While you can repeat the same page header and footer in every view, a better way is to do this once in a layout and embed the rendering result of a content view at an appropriate place in the layout.
Because layouts are also views, they can be created in the similar way as normal views. By default, layouts
are stored in the directory
@app/views/layouts. For layouts used within a module,
they should be stored in the
views/layouts directory under the module directory.
You may customize the default layout directory by configuring the yii\base\Module::$layoutPath property of
the application or modules.
The following example shows how a layout looks like. Note that for illustrative purpose, we have greatly simplified the code in the layout. In practice, you may want to add more content to it, such as head tags, main menu, etc.
use yii\helpers\Html; /* @var $this yii\web\View */ /* @var $content string */ $this->beginPage() <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"/> = Html::csrfMetaTags() <title> = Html::encode($this->title) </title> $this->head() </head> <body> $this->beginBody() <header>My Company</header> = $content <footer>© 2014 by My Company</footer> $this->endBody() </body> </html> $this->endPage()
As you can see, the layout generates the HTML tags that are common to all pages. Within the
<body> section,
the layout echoes the
$content variable which represents the rendering result of content views and is pushed
into the layout when yii\base\Controller::render() is called.
Most layouts should call the following methods like shown in the above code. These methods mainly trigger events about the rendering process so that scripts and tags registered in other places can be properly injected into the places where these methods are called.
<head>section of an HTML page. It generates a placeholder which will be replaced with the registered head HTML code (e.g. link tags, meta tags) when a page finishes rendering.
<body>section. It triggers the EVENT_BEGIN_BODY event and generates a placeholder which will be replaced by the registered HTML code (e.g. JavaScript) targeted at the body begin position.
<body>section. It triggers the EVENT_END_BODY event and generates a placeholder which will be replaced by the registered HTML code (e.g. JavaScript) targeted at the body end position.
Within a layout, you have access to two predefined variables:
$this and
$content. The former refers to
the view component, like in normal views, while the latter contains the rendering result of a content
view which is rendered by calling the render() method in controllers.
If you want to access other data in layouts, you have to use the pull method as described in the Accessing Data in Views subsection. If you want to pass data from a content view to a layout, you may use the method described in the Sharing Data among Views subsection.
As described in the Rendering in Controllers subsection, when you render a view
by calling the render() method in a controller, a layout will be applied
to the rendering result. By default, the layout
@app/views/layouts/main.php will be used.
You may use a different layout by configuring either yii\base\Application::$layout or yii\base\Controller::$layout.
The former governs the layout used by all controllers, while the latter overrides the former for individual controllers.
For example, the following code makes the
post controller to use
@app/views/layouts/post.php as the layout
when rendering its views. Other controllers, assuming their
layout property is untouched, will still use the default
@app/views/layouts/main.php as the layout.
namespace app\controllers; use yii\web\Controller; class PostController extends Controller { public $layout = 'post'; // ... }
For controllers belonging to a module, you may also configure the module's layout property to use a particular layout for these controllers.
Because the
layout property may be configured at different levels (controllers, modules, application),
behind the scene Yii takes two steps to determine what is the actual layout file being used for a particular controller.
In the first step, it determines the layout value and the context module:
null, use it as the layout value and the module of the controller as the context module.
null, search through all ancestor modules (including the application itself) of the controller and find the first module whose layout property is not
null. Use that module and its layout value as the context module and the chosen layout value. If such a module cannot be found, it means no layout will be applied.
In the second step, it determines the actual layout file according to the layout value and the context module determined in the first step. The layout value can be:
@app/views/layouts/main).
/main): the layout value starts with a slash. The actual layout file will be looked for under the application's layout path which defaults to
@app/views/layouts.
main): the actual layout file will be looked for under the context module's layout path which defaults to the
views/layoutsdirectory under the module directory.
false: no layout will be applied.
If the layout value does not contain a file extension, it will use the default one
.php.
Sometimes you may want to nest one layout in another. For example, in different sections of a Web site, you want to use different layouts, while all these layouts share the same basic layout that generates the overall HTML5 page structure. You can achieve this goal by calling beginContent() and endContent() in the child layouts like the following:
$this->beginContent('@app/views/layouts/base.php'); ...child layout content here... $this->endContent();
As shown above, the child layout content should be enclosed within beginContent() and endContent(). The parameter passed to beginContent() specifies what is the parent layout. It can be either a layout file or alias.
Using the above approach, you can nest layouts in more than one levels.
Blocks allow you to specify the view content in one place while displaying it in another. They are often used together with layouts. For example, you can define a block in a content view and display it in the layout.
You call beginBlock() and endBlock() to define a block.
The block can then be accessed via
$view->blocks[$blockID], where
$blockID stands for a unique ID that you assign
to the block when defining it.
The following example shows how you can use blocks to customize specific parts of a layout in a content view.
First, in a content view, define one or multiple blocks:
... $this->beginBlock('block1'); ...content of block1... $this->endBlock(); ... $this->beginBlock('block3'); ...content of block3... $this->endBlock();
Then, in the layout view, render the blocks if they are available, or display some default content if a block is not defined.
... if (isset($this->blocks['block1'])): = $this->blocks['block1'] else: ... default content for block1 ... endif; ... if (isset($this->blocks['block2'])): = $this->blocks['block2'] else: ... default content for block2 ... endif; ... if (isset($this->blocks['block3'])): = $this->blocks['block3'] else: ... default content for block3 ... endif; ...
View components provides many view-related features. While you can get view components
by creating individual instances of yii\base\View or its child class, in most cases you will mainly use
the
view application component. You can configure this component in application configurations
like the following:
[ // ... 'components' => [ 'view' => [ 'class' => 'app\components\View', ], // ... ], ]
View components provide the following useful view-related features, each described in more details in a separate section:
You may also frequently use the following minor yet useful features when you are developing Web pages.
Every Web page should have a title. Normally the title tag is being displayed in a layout. However, in practice the title is often determined in content views rather than layouts. To solve this problem, yii\web\View provides the title property for you to pass the title information from content views to layouts.
To make use of this feature, in each content view, you can set the page title like the following:
$this->title = 'My page title';
Then in the layout, make sure you have the following code in the
<head> section:
<title>$this->title) </title>= Html::encode(
Web pages usually need to generate various meta tags needed by different parties. Like page titles, meta tags
appear in the
<head> section and are usually generated in layouts.
If you want to specify what meta tags to generate in content views, you can call yii\web\View::registerMetaTag() in a content view, like the following:
$this->registerMetaTag(['name' => 'keywords', 'content' => 'yii, framework, php']);
The above code will register a "keywords" meta tag with the view component. The registered meta tag is rendered after the layout finishes rendering. The following HTML code will be generated and inserted at the place where you call yii\web\View::head() in the layout:
<meta name="keywords" content="yii, framework, php">
Note that if you call yii\web\View::registerMetaTag() multiple times, it will register multiple meta tags, regardless whether the meta tags are the same or not.
To make sure there is only a single instance of a meta tag type, you can specify a key as a second parameter when calling the method. For example, the following code registers two "description" meta tags. However, only the second one will be rendered.
$this->registerMetaTag(['name' => 'description', 'content' => 'This is my cool website made with Yii!'], 'description'); $this->registerMetaTag(['name' => 'description', 'content' => 'This website is about funny raccoons.'], 'description');
Like meta tags, link tags are useful in many cases, such as customizing favicon, pointing to RSS feed or delegating OpenID to another server. You can work with link tags in the similar way as meta tags by using yii\web\View::registerLinkTag(). For example, in a content view, you can register a link tag like follows,
$this->registerLinkTag([ 'title' => 'Live News for Yii', 'rel' => 'alternate', 'type' => 'application/rss+xml', 'href' => '', ]);
The code above will result in
<link title="Live News for Yii" rel="alternate" type="application/rss+xml" href="">
Similar as registerMetaTag(), you can specify a key when calling registerLinkTag() to avoid generating repeated link tags.
View components trigger several events during the view rendering process. You may respond to these events to inject content into views or process the rendering results before they are sent to end users.
falseto cancel the rendering process.
For example, the following code injects the current date at the end of the page body:
\Yii::$app->view->on(View::EVENT_END_BODY, function () { echo date('Y-m-d'); });
Static pages refer to those Web pages whose main content are mostly static without the need of accessing dynamic data pushed from controllers.
You can output static pages by putting their code in the view, and then using the code like the following in a controller:
public function actionAbout() { return $this->render('about'); }
If a Web site contains many static pages, it would be very tedious repeating the similar code many times. To solve this problem, you may introduce a standalone action called yii\web\ViewAction in a controller. For example,
namespace app\controllers; use yii\web\Controller; class SiteController extends Controller { public function actions() { return [ 'page' => [ 'class' => 'yii\web\ViewAction', ], ]; } }
Now if you create a view named
about under the directory
@app/views/site/pages, you will be able to
display this view by the following URL:
The
GET parameter
view tells yii\web\ViewAction which view is requested. The action will then look
for this view under the directory
@app/views/site/pages. You may configure yii\web\ViewAction::$viewPrefix
to change the directory for searching these views.
Views are responsible for presenting models in the format that end users desire. In general, views
$_GET,
$_POST. This belongs to controllers. If request data is needed, they should be pushed into views by controllers.
To make views more manageable, avoid creating views that are too complex or contain too much redundant code. You may use the following techniques to achieve this goal:
Found a typo or you think this page needs improvement?
Edit it on github !
|
https://www.yiiframework.com/doc/guide/2.0/uz/structure-views
|
CC-MAIN-2021-04
|
en
|
refinedweb
|
Maybe your file associations are messed up. See what assoc .py and ftype
Python.File have to say. If %* is missing, that would explain it.
C:>assoc .py
.py=Python.File
C:>ftype Python.File
Python.File="C:Python27python.exe" "%1" %*[@]}"
See and try the solution described in:
You are likely using an extension module which will not work in a sub
interpreter.
In short, add to the Apache configuration:
WSGIApplicationGroup %{GLOBAL}
I would try doing somehting like this.
os.system("appcfg.py arg1 arg2 arg3")
I would look into this portion of the os documentation.
Goodluck.;!
You are not grabbing the output from that command. That's why you see
nothing although the command was executed. There are several ways how to do
that. This are the most common:
// test.php
<?php
$value = 123;
// will output redirect directly to stdout
passthru("php -f test1.php $value");
// these functions return the outpout
echo shell_exec("php -f test1.php $value");
echo `php -f test1.php $value`;
echo system("php -f test1.php $value");
// get output and return var into variables
exec("php -f test1.php $value", $output, $return);
echo $output;
?>
You should separate headers from body printing additional newline:
#!C:Python33python.exe
import cgitb
cgitb.enable()
print("Content-Type: text/html;charset=utf-8")
print() # <----------- addtional newlnie for header/body separation.
print("Hello World!")?
|
http://www.w3hello.com/questions/importing-a-python-script-from-another-script-and-running-it-with-arguments
|
CC-MAIN-2018-17
|
en
|
refinedweb
|
The following example demonstrates how to customize an appointment in-place editor. An in-place editor is activated when an end-user adds a new appointment by pressing the Enter key in selected cells, or edits the selected appointment's subject by pressing the F2 key, or by clicking on the appointment.
This tutorial consists of the following sections:
Add the SchedulerControl object to your project. You can do this by dragging the SchedulerControl item from the DX.17.2: Scheduling Toolbox tab to the canvas.
Right-click the SchedulerControl object and select Layout | Reset All in the context menu to stretch the SchedulerControl so that it fills the entire window.
Add the following namespace declarations to the MainWindow.xaml file:
xmlns:dxschv=""
xmlns:
Declare a System.Windows.DataTemplate in the resources section. In this example, the control template uses a TextEdit for editing an appointment's subject.
Declare a custom style for the required appointment control that should display a custom in-place editor (DayAppointmentControl, AllDayAppointmentControl, MonthAppointmentControl, or TimelineAppointmentControl) and assign the created data template to the control's EditTemplate property.
A complete sample project is available in the DevExpress Code Examples database at.
<Window.Resources>
<DataTemplate x:
<dxe:TextEdit
</DataTemplate>
<Style TargetType="dxschv:DayAppointmentControl">
<Setter Property="EditTemplate" Value="{StaticResource myEditor}" />
</Style>
</Window.Resources>
Run the application. The following image illustrates the result:
|
https://documentation.devexpress.com/WPF/115449/Controls-and-Libraries/Scheduler/Examples/How-to-Customize-the-In-Place-Editor
|
CC-MAIN-2018-17
|
en
|
refinedweb
|
A pythonic interface to Gina Trapani's todo.txt-format for Python 3.
Project Description
todo.txt-pylib is a Python 3 library to parse, manipulate, query and render tasks in the todo.txt-format in a pythonic manner. It can easily be extended.
Installation
pip install todo.txt-pylib
Usage
from todotxt import Task task = Task('do something')
There are more advanced examples in the documentation.
Hacking
Clone the repo, setup and activate a virtual envrionment, then
./setup.py develop pip install requirements-dev.txt ./run-tests
Release history Release notifications
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/todo.txt-pylib/
|
CC-MAIN-2018-17
|
en
|
refinedweb
|
This action might not be possible to undo. Are you sure you want to continue?
02/05/2016
text
original
What Jesus Told Me:
A Contemporary Reading
of the
Gospel of Thomas
Gouthum Karadi
2 3
©2004 Perfect Paradox Publishing
All rights reserved. No part of this book may be reproduced in any form or
by any means without permission from the publisher.
Reprints contact: [email protected]
Contents
Perfect Paradox Vision & Mission ....................................................10
Vision ...................................................................................................10
Mission ................................................................................................10
Author’s Introduction ...................................................................... 11
Why am I writing this book? ............................................................. 11
Who is my audience? .......................................................................... 11
What is my message? ........................................................................... 11
Caveats ................................................................................................. 11
Scholarship ......................................................................................... 12
Synthesis ............................................................................................. 12
Eternal Life ........................................................................................ 13
What is a Soul .................................................................................... 13
Reincarnation .................................................................................... 13
SELF and Soul .................................................................................... 14
Kingdom of Heaven ............................................................................ 15
Genesis ................................................................................................. 15
Masculine ............................................................................................16
Feminine ...............................................................................................16
Karma ................................................................................................... 17
An Eye for an Eye ............................................................................... 17
Ignorance of Good and Evil ............................................................. 18
Further Genesis Contradictions ..................................................... 18
Slavery or Liberty .............................................................................. 18
Heaven Within ................................................................................... 19
Infinity as Truth ................................................................................ 19
Heaven on Earth ................................................................................ 19
Creator as Infinite ............................................................................ 20
Indra’s Net ......................................................................................... 20
Know One, Know All ....................................................................... 20
Riches and Poverty ............................................................................ 21
How Does One Know? ....................................................................... 21
Like a Child: Without Prejudice .....................................................22
4 5
Consciously Unconscious .................................................................23
You don’t Say? .....................................................................................23
Rationalization ................................................................................. 24
Uncertainty Principle ...................................................................... 24
What am I? ........................................................................................... 25
We Are Consciousness ....................................................................... 25
Objective and Subjective Sciences .................................................. 26
We Are All One ................................................................................. 27
Faith: Follow the Yellow Brick Road ............................................ 27
Jesus is a revolutionary. ................................................................... 29
What is a Prophet ............................................................................. 29
Money changers .................................................................................30
The Mustard Seed, the Upanishads and Vedanta ........................... 31
The Gift of Adversity ........................................................................32
Modified Renunciation .....................................................................34
Value-Added ....................................................................................... 35
Fire of the Self ...................................................................................36
The Eye of the Hurricane .................................................................36
Jesus, the Piscean Man .......................................................................37
Animal Man and Evolution ............................................................... 38
Balance the Polarities ...................................................................... 38
A Master Appears Different to Each Viewer ................................. 40
Shining the Flashlight ..................................................................... 41
Obsession ........................................................................................... 42
Conquering Obsession-Modified Renunciation Again ..................43
Twice (or Thrice) Born .....................................................................45
Killed for Dissension Not Peace .....................................................45
Fight, Then Surrender ..................................................................... 46
Experience the Truth: Know the Truth ......................................... 48
Once your eyes are opened, they can never be closed. ................. 48
The Whole Elephant ........................................................................ 49
Finish What You Start .......................................................................50
Know the present and know eternal life. ...................................... 51
A Form of Meditation ........................................................................ 52
Oneness-Samyama ............................................................................... 52
Master the Senses .............................................................................. 53
Balance, the Right Action at the Right Time ................................56
Like a Little Child .............................................................................59
One in a Million ................................................................................61
En-LIGHTenment ...............................................................................61
Minimize Hypocrisy ........................................................................... 62
Worship and Obsession .................................................................... 64
Drunken with the Material World ............................................... 64
Little Johnny ......................................................................................65
“Gods,” or Cosmic Principles .......................................................... 66
Three Gunas ...................................................................................... 66
Dogma of the Day ............................................................................. 67
Infallibility ....................................................................................... 68
Wisdom of the Self-Master ............................................................. 69
Academic Knowledge Versus Wisdom ............................................. 69
The Blind Leading the Blind .......................................................... 70
The Emperor Has No Clothes .......................................................... 71
The Return to Life ............................................................................ 71
Liars and Thieves .............................................................................. 72
Open Your Eyes ...................................................................................73
The Master is in the Now, Live in the Present ............................. 74
The Process of Perfection ................................................................75
Four Types of Knowers ..................................................................... 76
I Heard it Through the Grapevine ................................................. 77
REAL and UNREAL ........................................................................... 78
UNREAL .............................................................................................. 79
Passers-By, Observers of the Now ................................................... 80
Love the Fruit, Love the Tree .......................................................... 80
The Unforgivable Sin Against Truth ...............................................82
What Is in Your Heart Colors All that You Produce ...................82
Surpass Even those You Deem the Greatest .................................... 83
One Can Only Serve One Master .................................................... 84
Futility of Argument ....................................................................... 84
6 7
Body Reflects Soul-Inconsistencies and Illness ........................... 86
Action, Inaction and Balance ......................................................... 87
Know What You Are ..........................................................................88
The Elect ............................................................................................88
A Movement and a Rest .................................................................... 89
Your Niche ......................................................................................... 90
See The Eternal Right Front of You ............................................... 91
God and Technology ........................................................................ 92
Life Always Triumphs over Stagnation and Death ..........................93
Free Yourself from Your Past .......................................................... 94
Know the Material World to Be Finite ..........................................95
Separate the Wheat from the Chaff ............................................... 96
Work your internal field, find your true spirit amongst the weeds.
96
Learn from the Master Before You
or Within You ................................................................................... 97
Shepherds Feasting Upon their Flocks ........................................... 97
Unity ................................................................................................... 98
The Left and Right Hands .............................................................. 98
“Creation” .......................................................................................... 99
Causality ............................................................................................ 99
Realization .......................................................................................100
Path of Devotion .............................................................................100
Snake and the Rope .......................................................................... 101
Staying on the Path (to Personal Perfection) .............................. 101
Minimizing the Peaks and Valleys of Your Life ............................ 102
Maximizing Your Gifts .................................................................... 103
You Are Finished When You Are Done .......................................... 104
Think (Reason) AND Feel ............................................................... 104
Education and Familiarization ....................................................... 105
Boundary Cases ................................................................................ 105
Fulfill Your Needs, Be Careful of Over-reaching ......................106
Time Loop of Addiction .................................................................. 107
Life is Fair ......................................................................................... 107
Study Principles ............................................................................... 108
Microscope Metaphor for Consciousness .................................... 108
Learn and understand. Do and Know. .......................................... 109
Dry Drunks ........................................................................................112
The Dilemma ......................................................................................112
Four Types of Persons ....................................................................... 113
Murdering a Master .........................................................................114
The Macrocosm is Always Balanced ................................................ 115
Rejecting the Cornerstone of Truth ............................................. 115
How to Know When You Have Achieved
Your Perfection ................................................................................116
Persecution or Self-Examination ....................................................118
Save Yourself .....................................................................................118
Dispelling Darkness .........................................................................119
A Uniter Not a Divider ................................................................... 120
Seek the Knowers ..............................................................................121
Philosophical Loggerheads .............................................................121
Sharing the Water of Wisdom .........................................................125
More is Not Necessarily Better ..................................................... 126
Thoreau’s Self-Sufficiency .............................................................. 126
Your Purpose and Your Love ........................................................... 127
Self-Liking Not Self-Loathing ....................................................... 128
Self Love Is Unity of Self ................................................................ 129
Pearl of Wisdom ............................................................................... 130
You Are Tiny Yet All Encompassing ................................................133
We Are What We Eat ....................................................................... 134
Transcend the Body, the World .....................................................135
See the Light Everywhere and You are EnLIGHTened ................ 137
The Worthy Seize Immortality from Themselves ......................... 137
To the Immortal All Places are Home ............................................138
Wretched is the Person Dependent Upon Flesh .......................... 139
You are the Arbiter of Your Own Immortality ............................ 140
Seek Within, Not Without ..............................................................141
See the Infinite All Around You .................................................... 143
8 9
Pearls Before Swine ......................................................................... 143
Ask and Ye Shall Receive ................................................................. 144
Test Yourself, Then Apply ............................................................... 145
Spiritual Brothers and Sisters ....................................................... 146
House Rules—Render Unto Caesar .............................................. 146
Husband Your Liberty ...................................................................... 148
Potential Self-Masters-Wandering Sheep .................................... 149
Till Yourself to Find Your Eternal Self ....................................... 150
Renounce the World ........................................................................ 151
SELF is Eternal .................................................................................. 151
Merge Soul and Flesh ...................................................................... 151
Mary, Masculine, and Feminine .......................................................152
Conclusion ........................................................................................152
Appendix I ...........................................................................................153
10 11
Preface
Within this text the author maps the path of self-mastery from the ancient
to the modern. Gouthum shows how to walk the mystics path of self-
perfection in today’s time. He uses the words of one of the world’s most
well-known prophets as a vehicle for joining the Ancient East with the
Modern West.
Although several books have been written which illuminate the text of the
Gnostic Gospel of Thomas, most are written by scholars from didactic
points of view. Karadi’s text is unique in that it combines both Eastern and
Western paths from the point of view of one who has walked them in this
lifetime.
Perfect Paradox Vision & Mission
Vision
Perfect Paradox seeks to help people find immortality in every moment of
their lives.
Mission
Our mission is to provide tools, treatments, and perspectives which
enable people to find their own dreams and achieve them. We deliver
these elements through speaking engagements, workshops, publications,
multimedia, and the Internet.
Author’s Introduction
Why am I writing this book?
I write this in order to share the path of self-realization that I have walked
in my life. What started as a child’s question of “what lasts forever,” became
this meandering journey. My hope is that others can read this amalgamation
to see the connections between philosophy, religion, and science through
the eyes of an ancient prophet and modern seeker.
Who is my audience?
My audience is anyone that this message resonates with. Anyone who is
tired of the dogmas of thousands of years ago running his or her lives.
People who feel deep inside that something is imbalanced within themselves
and society.
What is my message?
My message is that you are your own master. There is only one true type
of mastery, and that is self-mastery. Learn the tools from the ancient to the
modern in order to remove imbalances within and without. The material
and nonmaterial worlds are complementary. Most people only believe in
what they can see with their eyes. How many have seen an atom split?
Anyone care to argue with an atomic detonation? I thought not.
Caveats
What I write is not absolute truth. That is too vast to be in any book
anywhere. What is always so, appears different from different vantage
points, so there will be some apparent contradictions. Yet ask someone for
the absolute truth of Physics, the physical reality, and they will laugh while
sending you to a library of books. Nonphysical sciences are no different.
It takes many books to describe the myriad aspects of reality, all take a
different perspective. All are beautiful.
At best, words can only approximate reality. This book is really more of a
question for you than an answer. Discover your own question, your own
ignorance, so you can discover your enlightenment. This work seeks to
engender a discussion within you that leads to your own peace in every
moment.
12 13
Scholarship
Throw out everything you think you know about a given subject before
venturing on your quest, otherwise, you will not see what you will find. You
will see what you want to see. This is also called “loading the question.”
Great examples are poll questions, “Do you believe in separation of church
and state?” By definition, Church presupposes organized Christianity. A
better question might be, “Do you believe in the separation of religion and
government?”
Furthermore, the material herein makes the most sense as a whole, yet not
necessarily all at once. Try to understand each concept as you read it. If it
does not apply to you, forget it now and try again later.
Synthesis
This work is a work of synthesis. It integrates wisdom from dozens of
schools and sources in both the scientific and spiritual disciplines. There
are no footnotes as it is universal wisdom readily available from these many
philosophies. If you want to know, send an e-mail or letter to myself or the
publisher. Otherwise, use this text as a guidebook for your own personal
journey and research. Remove your ignorance in the same way that all who
seek perfection do. Walk the road of self-realization and trust your heart.
My role is really to meet people in person. Yet without telling people who
or what I am, they will not be interested. This book seeks to narrow the
funnel. Those who I am here to speak to will find me either in a seminar or
for personal consultations.
(1) And he said, “Whoever fnds the interpretation of these sayings
will not experience death.”
Eternal Life
This first verse is fairly self-explanatory. It states that the person who can
discern the appropriate interpretation will experience eternal life. What is
eternal life? Because modern orthodox religion has monopolized many of
the terms used in spiritual discourse, I will redefine them.
What is a Soul
First, eternal life is conscious experience of one’s soul. One’s core inner
being. Analogies describe the relationship between the soul, the mind and
the body. They are like the software, hardware and the electricity for a robot.
The software is the programming, or the mind of the robot, the hardware
the body. Finally, the soul is the electricity or power source.
The definition of soul stretches the analogy. For the current of the soul, or
how much power it has, affects the performance of the body. Also, its color
changes the personality of the person. Nonetheless, the easiest way to think
of this human experience, is that your soul is eternal, your personality is
temporal, and your body is physical.
Reincarnation
In simple terms, you last forever, your personality changes with physical
incarnation, while your body changes with the environment. The key point
is that you choose a script to live for each trip on this planet. All of the key
points are decided upon before being born. Your genes and parents are key
aspects that you predetermine.
This fact is illustrated by past life regression, and comparisons between
those who remember past lives with historical record. There is enough
empirical data to allow the possibility for this fact. Here the topic of
reincarnation has been broached.
Y’shua, or Jesus, as he is commonly known, knew of this idea through
Essene study, and travel through the East. Later thinkers took this lack
of stress on the idea to mean lack of acknowledgement, or downright
disagreement. He chose to emphasize the present as he lived in the now.
The eternal present. He also saw the result of thousands of years of
advanced study in this philosophy.
He saw hundreds of thousands of Easterners with no sense of urgency.
Individuals who justified their mediocre lives based on the idea that
they could go on forever without making the leap to eternal life.
More on this later.
14 15
(2) Jesus said, “Let him who seeks continue seeking until he fnds.
When he fnds, he will become troubled. When he becomes troubled,
he will be astonished, and he will rule over the All.”
SELF and Soul
Jesus is talking about the search for the Self, or, the soul. Most of our
everyday life is spent trying to be something we are not. This is the source
of all discomfort in physical life. We are adjusted to society, but maladjusted
to ourselves. For example, many born artists become bankers, for they were
told, that this was the wise course of action. They may have much money,
but little personal wealth.
Monetary wealth does not travel across the physical incarnations. You
cannot take it with you. Yet, we spend all of our time investing in this
finite corporeal existence. The Master states that when you discover this,
you will become troubled. The seeker realizes that whatever he does, he
cannot guarantee anything considered valuable in this mortal life. What
exists? He has no idea when he will die, or whether he will live in poverty or
riches. Once he discerns this, it follows that he has been living a lie in order
to gather meaningless, and unsure results. This causes anguish, because
anything gained is sure to be lost, anything lost may or may not be regained.
The individual searches for an answer to this dilemma. He asks, what can
I count on? How can I guarantee happiness. He knows that it is not to be
found in finite resources. He knows that he must find something eternal.
Something infinite, unchanging, always the same. This is the eternal search
of all humanity. Some entitle it love, others peace, and others still, oblivion.
The astonishment is that the student realizes that the infinite is possible;
that the one thing that he is sure of and is always so, is not empirically
provable. The one thing he is sure of is the least definable externally. What
am I talking about?
I am describing consciousness. It is the one thing that follows every human
being always. You know that you exist. That is the thing that you are sure
of. For even if you say or think that you are not sure of your own existence,
who said or thought it? If you say that you do not exist, who stated that
fact? Regardless of belief or philosophy, you are aware of your existence.
You cannot prove that anyone, or anything for that matter, exists outside
of your awareness of it. You can state that you believe that you are reading
my book. You may discuss this with another person. But, you may have
imagined the other person or the book. Ask any person in a mental hospital,
they are sure of their own experiences whether or not they contradict you or
society.
You cannot win an argument as to whether you exist or not, for your mind
interprets everything that you see. You cannot see yourself, for your brain
interprets what you see, you cannot understand yourself, for your mind is
used to understand, and it is part of you. So if you understand yourself, you
understand everything but your mind. By definition, that is not ALL of you.
(3) Jesus said, “If those who lead you say to you,
‘See, the kingdom is in the sky,’ then the birds of the sky
will precede you. If they say to you, ‘It is in the sea,’
then the fsh.”
Kingdom of Heaven
The first part of the verse refers to the irony of projecting the Kingdom of
heaven onto some far of place or time. If it is in the sky, then the birds are
already ahead of you, as are the fish if it is in the sea. If it is anywhere rather
than where you are, someone or something else will precede you.
It also mocks the clergy of Jesus day. They wanted people to believe that
heaven, or fulfillment, was at some far off time. As with all institutions, they
wanted the lay to believe that the structure was needed to reach salvation,
or perfection. Also like all institutions, then and now, its mission was to
preserve itself.
This logic leads to the question as to why one would want to believe
that heaven is some far off place. Because perfection remains distant, the
individual can postpone actions towards personal perfection, “Eat, drink
and be merry, for tomorrow you shall die.” What I tell you, is “Eat, drink
and be merry, for today you shall die.” Your own bliss becomes eternal when
you reach personal perfection. Some call this state salvation.
Genesis
There are over six genesis myths, all of ancient origin, some older than the
one in the King James Bible. Interestingly, the one chosen demeans women
in the worst way. It describes the creation of this world as sin, the sin of
Adam and Eve, alleged forbears of us all.
The story states that Eve was deceived by a serpent, after which she
manipulated Adam. Even worse, the story alleges that neither took
responsibility for their actions. Each blamed the other. There are several
problems with this story from a purely logical standpoint.
16 17
First, what kind of creator would want His or Her children ignorant of
the world. Is ignorance bliss, or just ignorance? It is lack of knowledge of
duality, or right and wrong, or hot and cold. Doing what is right when
ignorant of what is wrong, is no paradise. This whole planet is duality. Men
and women themselves represent the ultimate duality.
Duality: Divine Masculine and Feminine
Masculine Feminine
Intellect Emotion
Fit Healthy
Sex Love
Take Give
Send Receive
Flow Ebb
Fight Dance
Think Feel
Material Non-material
Physical Non-physical
Rebel Attract
Left Right
Aggressive Patient
Positive and negative. Yin and Yang. Masculine and Feminine. Attraction
and Repulsion. All duality. Here we see that the myth is a metaphor
for manifestation-the creation of a physical world which reflects the
spiritual. Some refer to God as the ultimate masculine, as thought and
conceptualization. In this model, the feminine, Heavenly Mother, is
experience, or physical manifestation.
Together, masculine and feminine form the core of this universe from
Earth’s point of view. The dual polarities follow from the tiniest atomic
particle to the largest stars. Our bodies even have poles, from the bilateral
symmetry of our physical form down to the cellular level.
So the myth is figurative for our universe. In the popularized Christian
version, the sin of disobedience creates knowledge within the minds
of humanity’s progenitors. As a result, all children are born in “sin.” In
mainstream Catholicism, this meant that Jesus redeemed these sinful
children who must express gratitude for his sacrifice.
Karma
His sacrifice can be thought of as a method of fulfilling the laws of balance.
Or of Karma, which means, “action,” in Sanskrit. The law states, like
Newton’s law of thermodynamics, for each action there is an equal and
opposite reaction. Thus, whenever we act in this world, we are assured
results. Not only the immediate effect of our work, but the cosmic return
on our investment.
This return may take place immediately, or in the future. According to the
ancient masters, our current life is the result of the desires and actions of our
previous one. It often contains effects of earlier incarnations as well. These
seeds do not always find the conditions ripe for fruition. Furthermore, the
law is not an eye for an eye.
An Eye for an Eye
Bob is extremely sensitive, and beats up his younger brother. In the future
he receives harsh words from his cousin. Jennifer is incredibly insensitive,
and abuses her younger sister, she may be abused by her mother in the
future. These two examples illustrate that your state of mind affects
the return on your investment. Balance does not dictate an arithmetic
calculation. In other words, Karma does not mean “eye for an eye,” or
retributive justice. A man who kills a rapist who murdered his daughter
would not be receiving justice if he were in turn murdered by the state
through capital punishment. The circumstances of the father’s action are
not parallel to the actions of the rapist. A better example would be that the
rapist might be raped in prison and suffocated by his parents in the next
existence. Regardless of whether you killed in self defense, you receive the
results of your action. The father still receives the returns in the future as
well. He may die on the battlefield as a soldier. Anyone one who earns a
positive or negative balance on Earth must cash it here on this plane.
Either way, the balance is always met. Jesus did not stress reincarnation as
his message was for His eternal NOW. He taught a method for breaking the
karmic cycle in one incarnation.
His purpose was never to redeem anyone from Original Sin. The idea that
the method of joining positive and negative in the human form is Sin, is
ludicrous. Let us examine the myth from more points of view rather than
from the prejudices of two thousand years ago.
18 19
Ignorance of Good and Evil
First, the King James Bible states that Yaweh, the Hebrew God, sought
to keep his children ignorant in a perfect garden. From basic logic we can
discern that one who is ignorant of wrong and does the right thing has done
nothing. Yet in reality, according to this myth, there was no good or evil in
the garden.
For without evil, good cannot exist. Without hot, there can never be cold.
In reality, one can never know comfort without experiencing discomfort. It
is just the state of being. When one is unaware of so called wrong, one can
never be called a doer of right. One has made no choice whatsoever. In the
same way that a child knows no morality, a parent will not prosecute a baby
for theft. The infant knows no wrong; and knows no right either for that
matter!
Further Genesis Contradictions
In the popular cannon, neither do the first parents. Yet their God wants
them to remain that way? What kind of parent wants his children to remain
ignorant to the universe? One who does the right thing in the absence of
wrong has chosen nothing. A person who abstains from alcohol without
ever knowing its effects shows no temperance or austerity. A monk who has
never had sex, denies nothing.
In one of the other versions of Genesis, Eve is the wise one. A false God has
captured spirits in the body. He wants to enslave them, so he attempts to
keep them ignorant. Jesus descends as a serpent to teach the children. Adam
obediently ignores Satan’s, aka Jesus’, pleas. Hence Jesus goes to Eve.
She recognizes the soul of Jesus immediately and partakes of the fruit of the
tree of knowledge. Thus she recognizes the false Yaweh and convinces Adam
to partake as well. In revenge, this God curses the serpent, and casts the
couple out into his material world to fend for itself.
Slavery or Liberty
These two competing parables show some philosophies present in all
religions. Those of obedience, or slavery, and those freedom, or liberty.
The mass produced religion is for slavery; the origin of the Hebrews. It
teaches to do what you are told until you go to heaven where another
commands you. Jesus was crucified for his original teachings of liberty. This
illumination of the Gospel of Thomas will show that Jesus was crucified for
being a rebel, not for being the father of another group of slave drivers.
The church wishes to command you now, it cares not what you do
when you leave. That is your business. It cares about your body which it
commands, not your soul over which it has no power. It cares about your
actions in this life, where it exists, not the imagined one to come, in which
it does not exist; even by its own admission!
Heaven Within.”
Here, the man of Galilee tells people where to find heaven. He says that
it is inside you and outside you. What does that mean? On the most basic
level, it means that it is all around. It is everywhere. Remember how we
mentioned earlier that all humanity seeks something that lasts forever.
Something that is always so.
This thing that is always so, what is it? Let us describe some characteristics:
Is it so now? Is it so later? Is it so in the past? Yes to all three, so it is timeless.
Are there places where it is not so? No, so it is without limit, limitless.
These are questions addressed in Vedanta, or ancient Upanishads. They state
that the Truth is without limitation, hence it is the Infinite or Absolute. It
must always be so without relativity. That is what the human spirit seeks.
If your Truth has a physical form, there are places where it cannot exist. If
your truth is a man, he cannot exist at the bottom of the ocean.
Infinity as Truth
If your truth is words, then the deaf cannot hear it. So it is not true for
them. If it is light, it does not exist in darkness, so it is not true there. Thus,
the truth must include ALL. The only thing which includes everything, is
the Infinite. Some do not believe it exists. If everything is limited, add them
all up. What you have is the infinite. You prove its existence when trying to
do the opposite.
This is the within and without. Truth exists within and without. This
concept seems dead to many seekers. How can one enjoy a heaven which is
just a concept? Details might help. It is limitless, and timeless. Sound good
so far?
Heaven on Earth
Most concepts of heaven include a “perfect world,” described in terms
of Earth. There is no need to go anywhere else if all you want to do is
experience a perfect Earth. It is here around you. Remember the rule, “ask
and ye shall receive.” This means that if you do not get something you did
not ask for it.
It also implies that you asked for what you have. Thus, the Earth consists of
everyone getting exactly what they asked for. So what you must ask yourself,
is “Why did I ask for this?” This concept is unacceptable to most, for they
do not want to take responsibility for what they have.
20 21
People wish to remain victims. They want to blame someone or something
else for their circumstances. Yet, if God is good, then all that He creates
must be as such. For if it does not exist in the prime creator, it cannot exist
in the created. Where could it come from?
Creator as Infinite
The Creator was first, and anything created must have come from it. For
something can never come from nothing. This is shown throughout the
universe. Even the Big Bang theory presupposes that something existed.
This something can be called God, or the Prime Mover, whatever you wish
to call it.
Religion is the philosophy of living. Any religion that teaches you to “live,”
for “dying,” is self-contradictory. If you live for another day you are never
living. For today is the only time that exists. The past is gone, and tomorrow
does not exist yet. These collections of rules that talk about a future time
miss the living one, or any Christ that comes around. Any Kristos, Krishna,
or Buddha is missed for this future time or place that does not exist.
When you come to know yourselves, then you will become known, and
you will realize that it is you who are the sons of the living father. But if you
will not know yourselves, you dwell in poverty and it is you who are that
poverty.”
The question then comes, how does one come to know the truth, or that
which is forever? Jesus says, by knowing yourself. That once you know
yourself, all is known. How can this be?
Indra’s Net
There is a parable in the ancient Upanishads that states that the universe
is Indra’s net. Indra is a manifestation of a principle of the Creator, or of
creation. Cosmic principles are often identified as “Gods.”
This God has a net which represents the universe, a net of pearls. Think
of every pearl reflecting every other pearl. To know one is to know all, for
if you magnify one, you will see the reflection of each other. Each other
reflects another, and so on to infinity.
Know One, Know All
You are one of these pearls. If you know yourself you will know the all. You
reflect your parents and the genes of all humanity, you reflect the weather
of planet Earth, which reflects the sun. The sun reflects the rest of the solar
system and the Milky Way Galaxy, etc. Once you know yourself, you are
Known by all, for all reflects you and you reflect the all.
Then you become a “son of the living father.” But what is that? The living
father is the universe, or the prime creator of the universe, the universal
energy. The son reflects the Father. Once you know yourself, you reflect
ALL of God, or the universe. This is what Jesus meant when he said that he
is the father, the father is in him.
Finally, this verse mentions the risk of not becoming self aware, or
awakened.
Riches and Poverty
“But if you will not know yourselves, you dwell in poverty and it is
you who are that poverty.”
You dwell in poverty, or without richness. Here, the definition of riches
needs to be addressed. When you die, everyone admits, you do not take
your monetary wealth with you, wherever you may go. This is evidenced by
the fact that your gold stays here.
What riches do go? Do facts and figures go with you? If you reincarnate, no,
not exactly. You bring the experience. That is how a child prodigy is born.
He brings the wisdom of music as a Mozart. He learns to play it before five
years old, for he already has the wisdom of music, of its beauty. He already
recognizes it on first hearing, for he has learned it before.
Think of your soul as a symphony. If you quiet your mind and hear it,
you will recognize it always. You will never have to relearn it. It will be self
evident in all times and places.
This is what knowledge of the self is, it is wisdom of yourself. It is
experience of your true nature. Once you know you, you need not know
anything else. If you know how your eyes, mind, or ears work, you need not
ever interpret what you see or hear or think, you just know it.
How Does One Know?
Hypothesize that I pinch you. How do you know it hurt? You just KNOW.
Exactly, true knowledge is inherent. When you learn to read yourself as
such, you have timeless wisdom. It applies to you, and YOU always go with
you In other words, you have awareness of that which always IS.
When you walk, do you remember using every pair of counter balancing
muscles? No, not since you were a child. Well, we are no longer spiritual
children, we need not consciously think of all of our senses anymore. They
are ready to become unconscious. One uses experience of the self to gain
this ability. Without the richness of your own song, you are born with
nothing. You dwell in poverty, for you have nothing that you can retain. You
must learn all anew.
22 23
(4) Jesus said, “The man old in days will not hesitate to ask a small
child seven days old about the place of life, and he will live.
For many who are frst will become last, and they will become one
and the same.”
When discussing philosophy, paradox often seems the rule. Yet the point
at which all things meet is by definition contradictory. At what point does
water become ice? There exists a moment where existence is both positive
and negative, where plus and minus flirt.
Even though this verse captures this paradoxical quality, we can enlighten it
with a little discussion. First, why might an old man ask a child about the
“place” of life? Here we see one of the many references that Jesus makes to a
child. One often hears of Jesus saying that those like children will enter into
the Kingdom of Heaven.
Like a Child: Without Prejudice
He does not mean those who wear diapers and defecate upon themselves.
He means without prejudice. A child looks upon all things as new. This lack
of preconceptions allows the child to see what really exists. If we see what
we think is there, then we shall never see what is really there.
A man had a very beautiful wife. She inspired longing in every male whose
eyes fell upon her. Due to his nature, the husband worried about her
faithfulness. Constantly he would find reasons to check upon her behavior.
He would randomly come home from work to get his lunch or wallet,
which he “forgot.”
One day, he came home and saw a truck out front. When he entered the
home, he saw clothing all over the floor. It was dirty male clothing without
a doubt. In the background he heard the unmistakable sounds of one
showering. His fears led him into the couple’s living area within the house.
Once within, he found female clothing strewn everywhere. When he found
his wife in the bathroom cleaning herself, he exploded. He condemned her
for committing adultery. No matter her pleas, he got louder and louder.
Eventually in a fit of rage, he hit her. The strength of the blow in his anger
crushed her delicate skull.
When the police came, they arrested him immediately, in his heartbreak he
confessed to striking his whoring wife. At this point the officers explained
that his landscaper had cut himself with a chain saw. That the husband’s
dead spouse saved the worker’s life by staunching the blood flow and calling
for help.
At this point the husband noticed that the clothing was stained with blood,
not just dirt. The horror of his action was inescapable. Like Othello in
Shakespeare, his paranoia destroyed his perfect marriage. Prejudices kill.
In the anecdote above, one graphically sees the result of one’s fears. They
cause us to mistake reality for fantasy. A child has no fear of adultery; it is
unacquainted with the very idea. Jesus is not saying that we should become
ignorant like the child. It is impossible to return to that state of inexperience
without Alzheimer’s disease, or rebirth. Anyone who knows this disease will
not call it enlightenment, and no one wants to die.
Consciously Unconscious
So what is the Master saying? He means that once we have experienced
life, that we need to consciously let go of our fears and desires. Then, when
we encounter a situation we will see it for what it is. There is no need to
preconceive all of these situations. Our experience will serve us as we need
it.
Therefore, an old man will ask a child, how does one live? By learning from
the child, the man will know life. It is interesting that humans hurry to
grow up, only to lament the loss of childhood.
(4) Jesus said, “The man old in days will not hesitate to ask
a small child seven days old about the place of life, and he will live.
For many who are frst will become last, and they will become
one and the same.”
This old man who was born first now becomes the last to experience the life
nascent in the child. Now the two become “one and the same.” The child
already has life, as it lives in the moment. The aged one now learns to live in
the now by being unconscious.
Yet unlike the child, the old man still has his experiences He has become
consciously unconscious versus unconsciously unconscious. The first has
become last. The firstborn has become the last to experience eternal life,
(5) Jesus said, “Recognize what is in your sight, and that which is
hidden from you will become plain to you. For there is nothing hidden
which will not become manifest.”
You don’t Say?
If you see what is in front of you, what you do not see will become
apparent. Paradox again, what a surprise. Truly this is not, it just appears as
such. Another parallel, you may recognize:
“You learn as much from what people say as from what they don’t say.”
A child breaks a lamp. When you come home, you see that the lamp is
shattered, you ask what happened. He responds, “Someone broke it.” The
child has told you that he broke the lamp. You know that he was here alone
24 25
He has not told you who or what broke it. You infer that it was him. By
seeing the broken lamp and observing what has been spoken, you know
what has not been said, or seen by you.
This example has limits and is fairly literal. The figurative example tells you
much more. Humans forever live in the past and the future. This allows
them to feel whatever they want. For example, the man who has murdered
his seemingly adulterous wife feels remorse upon discovery of his error.
Rationalization
Yet this feeling often fails to solidify into contrition. For as soon as he feels
responsibility, the husband begins his retreats into the past and the future.
He starts to explain how he could not know that she was not cheating. That
she should have cleaned up the house first. That “She should have <blank>.”
Then come the trips into the future. The man imagines that the judge
will understand, the judge will see the wife’s beauty and understand
that there was no way that the man could have known. Then come the
embellishments. She actually did cheat. She slept with the man first! Yeah,
that way the husband is not responsible for anything in his own mind.
Watch any trial today, and you will experience a great lack of remorse,
much less contrition. When one is contrite, the person feels so sorry for
his or her action, that the person is always sorry for that action. Not that
the person remains in that moment forever, that is depression. The person
recognizes the behavior for what it was and experiences a remorse whenever
remembering it.
So this failure to live in the present handicaps humanity’s ability to see the
present reality. Psychics forever talk about the past and the future. Few speak
of the present. That is the key to seeing the past or future, what is hidden.
If one sees what is going on now, one can always see the past and the future,
for they are just reflections of the present. The past created the present, and
the present creates the future. See what is happening now and you have the
key to what is hidden.
Uncertainty Principle
Yet this verse has deeper meaning still. Remember that every object present
reflects every other object. In physics we call this the Uncertainty Principle:
“One cannot simultaneously know the exact velocity
of a particle and its position.”
Once we decide to measure something, we affect our measurements of
it. Thus, the subject, the measurers, affect the objects, that which we are
measuring. This can be stated simply as, “The subject affects the object.”
Medical science has further elaborated this idea. Our eye has an optic nerve
which goes to the prenatal cortex, then back to the eye before going to the
vision center in the brain. Please disregard the terminology I use here. I have
no desire to complicate our discussion of philosophy with more esoteric
terms than necessary.
The important point here is that our eye goes to our brain and back before
going to the interpretation center of our brain. All of our senses mirror these
redundant and unnecessary connections. But they are only unnecessary if
our senses are not affected by our thoughts.
Since they are affected, the connections now become meaningful. Our
thoughts change what we see, hear, taste, smell, or touch!! The subject, our
personality, affects the object, anything we perceive as “outside” of ourselves.
This statement begs many questions, of which we will focus here, on only a
few:
❖ What is an object?
❖ What is a subject?
❖ What is inside of us?
❖ What is outside of us?
What am I?
These questions really filter down into one question, “What am I?” This is
the true variant of the old query, “Who am I?” Using the term “who” ties
you to personhood, or humanity; which already limits the discussion to
society as a whole. You exist inside and outside of the conventions of society,
so you are actually a what.
What are you? Lets do an experiment:
If I remove your sight are you still you? Yes, blind.
If I remove your hearing are you still you? Yes, blind and deaf.
If I remove your sense of smell and taste are you still you? Yes.
Lastly, I remove your sense of touch. What are you? You are the thoughts of
your brain, the medical scientist would say. But how do you know that you
are the thoughts of your brain? You have no senses with which to perceive
your brain or any fluids whatsoever. These definitions come from your other
senses which are now not existent.
We Are Consciousness
You are consciousness. Why the difference between consciousness
and thoughts? For what about when you are thinking of nothing in
particular. What about when you reach the Samadhi or Zen state? This is
consciousness alone, often called bliss. We will discuss this state more later.
So, you are consciousness. Nice to meet you consciousness.
26 27
This consciousness is the subject, or, you. You are the subject, anything you
use your five senses to perceive is an object. Without the senses, though, we
realize that there is no object. Some may argue that this negates nothing,
that the object still exists. Luckily for us they have no way of arguing
without mouths or ears.
Objective and Subjective Sciences
A quick discussion of science serves us here. There is objective traditional
science, and subjective nontraditional science. Chemistry falls into the
former, and religion falls into the latter. The first seeks to describe what is
outside, and the second, what is inside. Both involve applying the scientific
method of scholarship to an area of investigation.
Here most religion has been co-opted by slavers or political scientists. They
seek to make some conduct as impermissible before the discussion begins.
One cannot discover the truth if he or she eliminates possibilities from
the discussion before the results are in. True scholarship eliminates zero
possibilities before discussion begins.
When the Roman Catholics eliminated the idea that the Earth revolved
around the sun from discussion, European scientists were hamstrung.
Eventually Galileo and others after had the courage to challenge this
methodology in Western Europe. Ironically, Europeans knew of this
information prior to the domination of this repressive church.
Now, religious scientists presuppose morality before focusing on
consciousness. They mandate that right and wrong exist before examining
humanity and by proxy, their visions of the universe. True scientific
discussion requires that we drop all preconceptions, “like a little child.”
I am consciousness. You are the same. What separates us? That is the key
question to the distinctions of inside, and outside. Or as social psychologists
often say, “in group,” and “out group.” These two delineations cause much
of the horrors in the world. Think of the groups of Nazis and Jews. It would
serve us well to remove these artificial boundaries, for a more inclusive
boundary can always be chosen. Try humanity. We are all humans. Although
this division eliminates other animals, we can rectify that grouping with the
large domain, of all animals.
I use the above examples to illustrate the rapid ability with which we can
easily see all objects as logically interrelated, as one group. Physically, I am
a collection of atoms, as is anyone or anything else. More interestingly, you
are a collection of space. The majority of any atom is comprised of space.
The gap between the nucleus and the orbiting electrons is so vast as to allow
the entire matter of one individual to fit into a thimble!
We Are All One
That is right, your entire mass without space fits into barely a cubic inch.
It gets better. Between myself and the person sitting next to me, there is
nothing but atoms and space. If you compress the space once again, you
find that there is nothing between us! Two apparently separate persons are
not really distinct at all.
The only distinguishing characteristic is our consciousness. I am unaware of
all of the other’s thoughts, and she of mine. Yet does lack of awareness mean
separation? For example, the majority lives unconscious of even its own
thoughts. Does that mean that we are separate from our thoughts?
Remember the example of the human with no external senses. Can his or
her thoughts reside outside of his or her self? Nope. We are not separate
from each other, though we imagine that we are. This idea causes extreme
discomfort to most people. It is not necessary to contemplate this idea
directly at the beginning of the path to personal perfection; though its
import arises everywhere.
Once you see that you are truly connected with everyone else, either
through consciousness, or physicality, your loneliness can subside. You are
never alone. Or, you are one consciousness so alone, that you created an
imaginary world to entertain yourself. Make your choice. Just know that at
different times your feelings may change with respect to this choice.
Our discussion has described several concepts. We rediscovered the idea
of internal and external science, or science of the Subject and Object
irrespective. We described consciousness as the only common theme
through all of our lives. And, we made clear that there is no real separation
between one so called group and another. We are all part of one Universe.
These ideas hint that if we know ourselves completely we can derive
everything else in this universe of many forms. All that is required is to
know one thing completely. Then we can experience everything tangent to
it, and by proxy, know everything.
(5) Jesus said,“Recognize what is in your sight, and that which is
hidden from you will become plain to you. For there is nothing hidden
which will not become manifest.”
Faith: Follow the Yellow Brick Road
Finally we have the idea that all that is hidden will become manifest. Our
faith is buttressed by this statement. Frederick Myers once said, “Faith
is resolution to stand or fall by the noblest hypothesis.” It is not blind
obedience. That is the role of the slave: One who always searches for
someone or something outside of himself to tell him what to do.
28 29
Faith is like a man on a road. He sees a brick road leading to a mountaintop.
Along his sight, he sees the road dip in and out of view before finally
emerging upon the crest of the mountaintop. Faith is knowing that the road
you walked in on is the road you walk out on.
When he follows the path it leads into steep valleys. While in one of these,
it feels like a pit, for the walls are sheer. Faith tells him that the road he is
on is the path that leads out. He can commence many loops while in the
valley, but the only way to know if his original road is the correct one is to
complete it.
In the Army I was in the Light Infantry. It is the most faithful job. You rely
on your mates to take care of you, and yourself to fulfill your role. You carry
everything you need to fight, and everything you need to get back home.
You walk in, and damn it, you are going to walk out! Nothing will stop you.
This is faith.
Great commanders always write about the strength of an Army being in
its will to fight. Not in its technology or savvy, but sheer commitment.
Vietnam and Ho Chi Minh taught this to the USA—a lesson being
repeated in Iraq.
Regardless, you are now in the battle of your lives. Do you have the faith
to struggle your way out of darkness into the light, or will you choose the
comfortable lies of darkness? Can you question all that you have hitherto
known, or will you shy from the task? You birthed your way into this world.
Will you live your way out, or, will you die, only to return again?
disciples forever ask their master how to behave. They never seem to
tire of asking specific questions, while the enlightened often answer in broad
aphorisms. Knowing that their time with those trapped in past and future is
short, the Buddhas try to offer succinct wisdom with broad application.
They ask Jesus whether they should fast and pray and give alms. Rather
than answer about the letter of Mosaic law, the Hebrew sage states that they
should neither lie, nor do what they hate. In other words, they ought not to
behave hypocritically. To underscore this, he adds that all that is hidden will
become plain.
He implies that they are searching for more rules to ensure right conduct.
Instead of more rules, he declares that they need not follow more laws. They
only need to be consistent internally and externally. Integrity of thought,
word, and deed.
I say it more succinctly in modern terms:
“If you want to hide something, tell it to everyone. If you want to tell everyone
something, hide it.”
This method keeps one honest. It ensures that you will always be
consistent internally and externally. It is the highest practice of Truth. This
methodology is not a permanent state of mind, but a tool for realization of
your perfect self. You will know when you are done, as you will not have to
ask anyone. If you still have to ask, keep using your tools.
(7) Jesus said, “Blessed is the lion which becomes man when
consumed by man; and cursed is the man whom the lion consumes,
and the lion becomes man.”
Jesus is a revolutionary.
His philosophy contradicted everything that his contemporary Hebrew
fathers taught before him. They taught a dualistic “eye for an eye.” This
lamb fulfills that natural complement to this law with “turn the other
cheek.” Turning the other cheek balances this arithmetic.
Establishment in the Hebrew tributary to Rome feared this master’s
message. His philosophy taught that an individual found heaven within and
without, not in the empty promises of some dictatorial religion. Religious
leaders feared his decentralization of their power.
What is a Prophet
A prophet of God, is one who takes the experience of the infinite truth and
puts it into the words of the day. He or she takes the infinite and packages
it into the finite. Although this is impossible, the words draw listeners closer
to the feeling of fulfillment, to the experience of God, of bliss.
These prophets take away the power of the business based establishment
and return it to the people. Once the prophets are gone from temporal
reality, political and business leaders package the words back into a master
slave relationship.
30 31
They form a monopoly on truth so to speak. Thus the people once again
turn to the same authorities as before. They are trapped once again believing
that they are too lowly to experience infinite truth and bliss.
Ironically that may be true. But if they cannot discern this for themselves,
they cannot discern the truth of those attempting to explain it to them. If
one cannot understand the words of an enlightened soul, he or she cannot
determine the truth of one seeking to explain it.
The listeners use the same mind, ears and heart to read the closest words to
the prophet. If this mind cannot reason through those words, this intellect
cannot reason through the so called intermediaries. The difference between
what I write and what most priest-class write, is that I have walked the path
and I only speak of what I know personally. I am not here to persuade you
to listen and understand. If you do not feel the burning fire of truth when I
speak, find your truth somewhere else. If you cannot see the color red, and I
use red ink for my words, you will not see them.
Yet if you see blue, and someone else utilizes blue ink, you will see. Think
of sounds as well. If I speak in the pitch of the dog’s ear, you will hear not,
unless you are a dog. When I use the wavelengths of sound tuned to human
ears, the people may hear. Numerous examples of this analogy may be
found.
Money changers
The lion of this parable, is the lion of religious institutions. This is the
context of Rome and Israel at this time. Priests, or businessmen cloaked in
philosophy, monopolized enlightenment. They charged money to receive
the gifts of liberty.
Unlike true masters though, you had to keep paying for the bliss. A master
gives the tools to create one’s own bliss. That is why Jesus speaks of teaching
fishing rather than giving fish. Those who ask for fish he gives fish. Those
who ask for self-sufficiency are taught fishing. Everyone knows that the fish
did not jump into the Master’s basket. Some choose to learn fishing from
him, and others just want the fish.
(7) Jesus said, “Blessed is the lion which becomes man when
consumed by man; and cursed is the man whom the lion consumes,
and the lion becomes man.”
So the when the people consume the lion, the institution of spiritual slavery,
they are blessed, for they receive the fruits that were withheld. They receive
spiritual bliss. The man who is enslaved by institutional religion is cursed,
for the wealth goes to the institution instead of its members.
(8) And he said, “The man is like a wise fsherman who cast
his net into the sea and drew it up from the sea full of small fsh.
Among them the wise fsherman found a fne large fsh. He threw
all the small fsh back into the sea and chose the large fsh without
diffculty. Whoever has ears to hear, let him hear.”
The man who consumes the slavers is like he who fishes with the power of
discernment. He knows instinctively which are the profitable fish-which will
fill his belly, and which will leave him hungry. No school is required to teach
that fishermen how to fish. He has only to listen to his belly. It tells him
without equivocation what fulfills. We find the same thing with truth. If a
man listens to his core, he knows what rings true for himself. No institution
is needed. Again, if he cannot understand the act of fishing directly, no
indirect method will serve. He must listen and employ, then compare the
feelings from each situation. This is how he will know.
Above, it is again made clear that Jesus is speaking to the listener who has
ears for his truth. He is speaking to the ones who are able to experience his
wavelength.
A note is important here. All men know that fish do not miraculously jump
into boats. Some want to learn to fish and others want to be fished for by a
benevolent master. The universe always gives us what we ask for.
.”
The Mustard Seed, the Upanishads and Vedanta
In many of the world’s ancient scriptures, you will find the above analogy.
It likens the truth to a seed. A seed has all of the characteristics of the plant
which produced it. In the Upanishads of Ancient India, they speak of the
Mustard seed. It has the potential to create a great tree from the tiniest of
seeds. This scripture predates Jesus by thousands of years. Yet the Hebrews
forgot of its existence before their own master walked the path to remind
them. Yet when he came, they crucified him.
32 33
His teachings were a rebellion to them. To preserve their choke hold on the
people they had to destroy him. But one can never demolish a living master,
the master lives forever in the now. Nothing will ever eliminate the existence
of an eternal being, as evidenced by the mark these words have made in our
times.
Seed metaphors encompass a variety of meanings. All seeds are exact copies
of their parent components. They include all of the traits of the parents,
including often dormant traits as well. Offspring of this sort needs specific
conditions to sprout and possibly grow into mature adults.
Depending upon the stimulus in its environment, the sprouted seed will
exhibit varying characteristics. In a rich environment, the offspring may
become gluttonous. In a sparse one, weak and undernourished. A perfect
place has the right mix of challenge and reward.
The Gift of Adversity
Our current philosophies encourage the idea that the perfect environment
includes little to no hardships. These adversities are often used as tools to
victimize one’s self. For example, my single parent household is considered a
drawback by most. Few would honestly call it a gift.
These adversities serve to encourage growth and development, including
resilience. My childhood had many crude factors balanced by graceful ones.
I had little to no family and culture as the child of an East Indian divorcee.
We were spurned by our own culture, which blamed my mother for her
divorce.
When I was young, this broken marriage often meant my father was absent.
I had an older brother who tormented me while teaching me everything
I needed to know about manipulation and breaking rules. Mom moved
into a place where I was considered a “sand-nigger,” and I was left to
founder in a mediocre environment. Counter these challenges with large
monetary resources and a broad education in the fundamentals of reading,
mathematics, music, and athletics.
This quick tour of my childhood shows both risks and rewards. I was
two months premature, diagnosed with minimum brain dysfunction and
organic difficulties due to my tiny birth weight. The risk I had was prison,
drug addiction, depression, and suicide. The rewards manifest in where I am
today; a successful soldier, consultant, sannyasa, father, and scholar.
Key to my path was alienation and loneliness. I walked my path alone for
most of my years. My mother worked all the time and my brother went
in and out of hospitals, jail and treatment, after which he disappeared. We
call this “Jails, Institutions and Death” in twelve step programs, I never had
girlfriends and had few friends. Eventually my pain led me to treatments,
reform school and finally the US Army’s combat arms.
The path I chose hardened my resolve and strengthened my innate courage
and sense of justice. I know what I know because I have walked the road
through the same paths that everyone else must trod. I earn the wisdom
worthy of those who ask it by walking the dark road. We are all in this
together, all seeds of the divine creator manifesting differing aspects of a
unified whole. At any given NOW, these offspring appear different. Yet in
the infinity of all time though, all qualities manifest everywhere.
.”
Some fell on the road only to be gathered by scavengers. On the path to
perfection, some fall where they lay in the road. They are not wasted, but
used to feed other travelers. Because we all live forever and experience all
that we ask for, this is no loss. It is an opportunity to know for ourselves,
what IS.
Think of those great souls who arrive near the end of the path of perfection
and take a detour. The Hitlers. They use the gifts they have learned in the
eternities to manipulate, and drive, feeding their egos and reversing their
long treks. Their failures feed those of us on the path behind them. This
food inspires us to stay true to our goal of perfection.
Others land on the rocks along the path. These souls cannot find purchase
in the soil. They wither and die without every taking root. Their messages
lost into the ether, heard only by themselves and God. Yet never unheard.
Then there are those whose messages are lost amid the thorny ignorance of
slavers. These are the prophets, like Joseph Smith of the Latter Day Saints.
They speak a message of wonders lost first amid those in power, then co-
opted by those who would use it for institutional gain. Like nuts, they are
eaten by foragers.
Finally there are those messages which find purchase. They grow into eternal
trees, continually being re-birthed into each other. Hopefully the messages
of this millennium find verdant soil.
Above the seed is likened to individuals along the path to perfection. It also
holds similarity with truth itself. The seed of truth must find proper soil to
grow. Otherwise it lies dormant until reaching fertile ground. This message
resides in every human heart. In some incarnations it grows, and in others it
withers. Some seeds withdraw for winter, and others flourish.
This truth is the eternal life all masters speak of. When one feels it, one
knows. If one does not, he or she keeps searching. Sensory life serves as a
34 35
wonderful journey through which to discover one’s self. The only way to
know is to be ignorant. For without lack of knowledge we can never learn
knowledge. Life on Earth is enmeshed in these dualities, these contrasts.
To experience cold, one must be hot. To know comfort one must know
discomfort.
Lastly, we illustrate the idea of vasanas from the Upanishads. Vasana
translates roughly to “track.” When we perform an action repeatedly it
produces a habit, or a track. When on that path, it is easy to remain in
it, difficult to leave. Furthermore, tracks are easy to fall back into, think
of them as ruts. These vasanas echo throughout our incarnations on this
planet. The mustard seeds of these habits continue through each physical
life here. When one dies, he experiences his habits in the next incarnation.
There are several ways of dealing with them. If the conditions for their
ripening are not present, the seeds remain until the environment is found.
Thus, the chaste monk and nymphomaniac have a similar problem. Both
obsess on sex. The former has conditions where the seed of sexuality does
not bloom, hopefully! The latter has the vine in full bloom. A fasting person
and a glutton are the same. Again, the first has the seed dormant, the second
in full flourish. How one deals with these conditions determines whether
the seeds remain.
Modified Renunciation
Vedanta, possible the oldest known school of truth, states that the seed’s
cores must be burnt. They are burnt through a variety of means. Repression
never works. The most familiar example I can use is similar to Buddha’s.
Although St. Ignatius of Loyola’s Spiritual Exercises also qualify.
First create consistency of thought word and deed. Then renounce all
material things to a minimum. What is left are the desires you are to either
fulfill in this life or learn their illogic. For example, if you are consumed by
sexual thoughts constantly, renounce them. Refrain from sexual pictures,
contact, and discussion. If after a period of time, say a year, they remain,
attempt to fulfill them while always keeping integrity.
Do not lie to anyone about the purpose of your conduct. This will keep you
from losing your path and goal. Tell those you wish to bed that your desire
is for sexual fulfillment. In other words, if you must lie to achieve your
aims, you will not learn what you set out to. You will likely reinforce the
cloudiness of your actions and your results.
Remember always that the universe is the final arbiter of all balance. It is
never fooled. Just like visible physical laws, invisible non-physical laws are
always met. Water behaves consistently across the universe and so does light.
Your motives are always clear to the underlying universe. Imagine telling
the cosmos that you are not really boiling water, but freezing it. Will the
water miraculously freeze? I don’t think so. So, back to the key point. Either
the sexual urge goes away, or you realize through your physical incarnation,
that union through purely sex does not work for you. And if it works, you
experience the eternal NOW, you are never going to read past this point!
Upanishad wisdom states that one must burn the seed to keep it from
sprouting in future incarnations. The method you choose determines
how and when you are fulfilled. You may choose gluttony, or maybe
renunciation. Just remember, in the end you renounce the renunciation,
or overdose on renunciation. In other words, all extremes lead to their
opposites. Generally, you swing from overindulgence to austerity;
repeatedly.
You are the seed of the divine creator. As you mature, you bring out all
aspects of the creator or certain choice traits that you love. Some children
mirror the mother and others the father. Some just specific traits, and one or
two, all traits. Figure out what you are and be that. That is peace, love, bliss.
Value-Added
Father is a mechanic with a penchant for airbrushed painting. He builds
cars with beautiful artwork upon them. Mother designs building interiors
with usable spaces. One son is an architect, the other an engineer. Finally
one daughter designs and builds skyscrapers with the most artistic of
facades. Some children a trait or two, some the whole thing with beauty
added. Or as a close friend taught me, with “value-added.”
Add your value to the universe. This is often referred to as the Law of
Sacrifice, or as I like to call it, the Law of Sharing. When God imbues the
universe with its energy, it shares. We follow the same principle when we
give back to the environment. Sometimes through wildlife management,
or stewardship, and other times through harvesting crops. When we fail to
return value according to this principle, an energy blockage is reached.
This is the state we find ourselves in now. We take more then we return
too often. Fortunately, the universe is perfectly balances itself. When the
blockage is cleared it often looks like a dam bursting.
We are not to try to stop the dam from bursting, for that is what caused
the block in the first place. We are either to direct the flow along its correct
path, or to get out of the way. The dam of human liberty has been blocked
too long.
36 37
When the dam is set to overflow, release pressure out of its spillways. Do not
build it higher or face explosive flooding and drowning. Spiritual liberty has
been blocked so long that it bursts the dogmatic dams of psyche.
(10) Jesus said, “I have cast fre upon the world, and see, I am
guarding it until it blazes.”
Fire of the Self
In the spirit of the Upanishads before, and Mohammed after, Jesus is the fire
that burns the seeds of future desires. Vasanas are also desires for the future.
If you die while suppressing the sex drive, that desire flowers in the next
incarnation. It does not disappear just because you repress it. These desires
must be burned for perfection, or equilibrium, to be reached.
An important point must be stressed here. Once perfection is reached you
never return to a physical incarnation. You must have a desire to be here
to visit Earth. Even the perfect masters you meet or read about, they had a
minimum of one desire: To impact this world.
Every action has the seed of self in it. Nothing can be selfless. The universe
will not allow anything to sacrifice without payment, for balance must
be maintained. If you die for a cause, your payment was that you got to
sacrifice yourself for something. You wanted to know what it was like to
martyr.
When you come here to teach others, you receive the fulfillment that every
teacher knows is his or her true payment. That of seeing the light dawn in a
pupil’s eyes. I speak because I get to be heard. I receive the fulfillment of the
attention and power that commands. People give me joy and sorrow at my
words. Move in equilibrium.
The Eye of the Hurricane
We could leave, but we want to serve while in the world. Any master can
run away to the mountains and put on the saffron robes. I wish mastery
while in the thick of life. That is what we are here to learn and show. How
to be perfect in the midst, the eye of the hurricane. You are calm and active,
“A movement and a rest.”
There is a concept in fitness called recovery under load. When you run
for distance you can add intervals of sprints in between. In other words,
you run at a consistently moderate heart rate for the majority of the 4
kilometers. Yet while running, you execute sprints of 200 meters at a time.
Each time you complete a sprint, rather than stopping entirely, you return
to the average pace.
While under the stress of running, you are recovering. While running, you
increase the load, and recover. This is recovery under load, and the quickest
way to reach peak performance. It is also intense and risky. There is always
the possibility that you will overstress. With great rewards come great risks.
Many masters have stumbled at this last point.
They reach enlightenment, but not without paying a high price. They
lose much of what they set out to accomplish, and their messages became
marred by indiscretions. Their failures reinforce the dangers of extremism to
us. Their examples serve themselves, their detractors and us.. The universe,
or God, never hits two birds with one stone. It hits every single one of them!
(10) Jesus said,“I have cast fre upon the world, and see, I am
guarding it until it blazes.”
This saying is often left out of the modern cannon. Many call it spurious,
but that is because they have been fed much about a mythical figure who
was killed for being peace loving. Ludicrous. He was killed for taking the
power of the few and returning it to the many.
What kind of religion would teach that the most perfect of its adherents is
tortured and murder? Let go of the propaganda and look at the story as a
child does. It teaches that perfect people are murdered so your imperfections
can go unbalanced. This is not the message of a Master.
Jesus fire is the fire of truth, and it has been smoldering since he lit it. It
burns in hearts everywhere. On the cross he committed his soul energy to
turning the wheel of dharma, of fate. Each turn of the Earth’s precession
has accompanying energy released. As the Buddha said, he came to turn the
wheel of fate
Jesus, the Piscean Man
The Earth spins like a top upon its axis. When you magnify the rotation
of a top, you see that in addition to its spin, the axis itself rotates as well.
This is called “precession.” Currently this axis points to the North Star as it
rotates through the constellations in the heavens.
During Jesus age, it moved from Aries into Pisces. It went from the ram, to
the fish. That is why Jesus’ symbol is the fish. He is moving from the Jewish
scapegoat culture to that of personal love. At each age there is an opener and
a closer. He opened the age, the Second Coming is about the close. The end
of the age of Pisces and the beginning of Aquarius.
His fire has smoldered for over 2,000 years, an Age of men. It is about to
spring into a conflagration. Its flames are rising. His message burns the lies
and desires of old. Aquarius brings in the new.
38 39
?”
Animal Man and Evolution
This verse has many meanings and requires deep thought. A surprise to you,
I am sure.
First, the master reinforces that anything that exists in the world of time will
pass away. “This heaven…and the one above…will pass away.” He further
adds that neither are the dead alive, nor will the living ever die. The dead is
matter, the spirit is alive. Matter never lives without the animation of spirit.
And that which is animated with spirit NEVER dies.
By this logic, you are dead. For you are unconscious of the divinity of your
own soul. You walk through this earth as zombies, nothing more than
bipedal animals. What are the desires of animals?
❖ Better food
❖ Better Shelter
❖ Better Progeny
Are these any different for most humans? No. Sadly, humans fail to use their
higher intellects to provide deeper meanings of the universal, the infinite.
Their conceptions of the higher are only embellished caricatures of the
lower. Jesus gave man 2,000 years and his soul with which to work. The
energy of a master with which to fuel your ascension to the higher.
Unfortunately humanity largely wasted its time. The theory of evolution
states that animals progress from lesser to greater complexity, better adapted
to the environment. Entropy states that complexity decays over time. The
physical decays, while the spiritual grows. Together we have the equilibrium
of the universe, the physical and non-physical.
Humanity has descended, within its own theory of evolution. Contradiction
anyone? How can an evolving species descend? It cannot. This contradiction
is showed in our world. We can split the atom, yet we cannot feed ourselves.
The relationships between the sexes has never been more polarized.
Balance the Polarities
Early in humanity’s history we chose the group over the individual, now we
experience the worst of the individual over the group. The Aquarian age the
Earth ushers in through her representative facilitates balance between these
concepts, equilibrium between our historically opposed polarities. Father
against mother no longer; husband with wife.
Early in the manifestation of Earth from concept to practice, your spirit
animated matter. You consumed the dead, matter, and made it alive. Now
that duality is to be contrasted for all to see. Jesus rent the veil between
matter and spirit. He was to show us in a material world, the inconsistencies
within us. The polarity between our matter and spirit. When the light
shines on your hypocrisy, what will you do?
Perfect spirit descended into divided matter. Into the polarity of male and
female. You are now two, what will you do? You are of two minds within
yourself as well. Your feelings and your thoughts do not line up. You are
inconsistent, you live a lie. What will you do? How do you propose to join
with yourself?
Most people seek to join with another person to balance themselves. I posit
to you, that two unbalanced beings can never produce a balanced being.
First you must balance the duality within yourself before you can join with
another. I promise you that it is possible. I also promise that it is mandatory
for your eternal life. For you to live, you must balance. Earth balances itself.
The pendulum has swung so high to one polarity, that we are to push it
over the top. It is at 1 degree of its 360 degree path. Rather than push it
179 degrees downward, we are pushing it 2 degrees over the top! This looks
harsh from the ground level, but in the end it is the most efficient and most
balanced.
Much energy is trapped in our overly analytical world. Our externally
based philosophy with no internal complement is creating an untenable
situation. Humanity cannot be released upon the universe without the
internal component, for our empirically based ideas will cause to go through
the universe like a virus, or a plague. Because the current world philosophy
is trapped in Newtonian physics of materialism, we would consume the
universe.
Yet instead of destruction, we have opportunity though. This is the message
of adversity. Use the challenges and fire to temper one’s self. Temper, do not
burn. Take the pounding and shaping to emerge reborn and stronger. Take
the fire. Use it to burn one’s impurities and inconstancies. Lose the dross,
return it to the crucible of creation.
Ideation is the masculine, the concept. Practice is the feminine, experience.
Feel your life. Know it and feel it. Feel it and know it. External science
alone quantifies all. You are only a cog, and easily replaceable part. Internal
science, gives you meaning. You are important and you matter, for you are
your window into the world. Without you it does not exist for yourself,
much less anyone else. For without you to conceptualize it, it does not exist
at all as far as you are concerned. Find your truth and meaning within,
fulfill it.
40 41
usual, the disciples are asking about the nonexistent, the future. They
are worried about sometime when their master IS NOT, rather than
experiencing the time when he IS. They do not realize that they can ask
themselves if they become eternal like Jesus.
Nonetheless, being a kind soul, Jesus offers them James the righteous. He
tells them to ask the righteous one, for whose sake the world is. James can
be thought of an historic person or a concept. I choose the concept, for I am
speaking of universal wisdom at this time.
Although my words will never be able to perfectly capture the infinite, I will
try to target them closer to what you are to experience on your own. I will
speak of what IS, as best I can, knowing that my listeners are dynamic and
as changing as my incarnation.
There is an esoteric teaching that Jesus started the cycle, and his brother
finishes it. That his fire smolders until his brother stokes it with the truth
once again. More commonly, people refer to the concept of righteousness.
One can look at truth as the reason the Earth came into being. As long as
Jesus students go to the righteous, they shall be fine.
A Master Appears Different to Each Viewer
fre will come out of the stones and burn you up.”
In this verse the master seeks to show his disciples where they are
respectively on the path to perfection. He does this through the simple
question of how each perceive him. Simon Peter, a Hebrew, seeks purity;
forever the goal of the Jewish saint. Thus, he sees his master as a righteous
angel. One born of a virgin, of the highest purity Peter can conceive of. This
vein runs solidly through all of Peter’s church. It obsesses with purity and
sainthood, martyrdom and self-denial.
Matthew forever seeks knowledge. He sees the sage Jesus as a wise
philosopher. Both circumscribe him into their own view of perfection,
despite the fact that the infinite cannot be categorized without becoming
finite. Once you limit the truth, it is no longer universal. Unfortunately for
you, the universal truth is often too broad to be of much use to you trapped
in a time space mentality. To your luck, others have walked before you.
Shining the Flashlight
That is my role, to shine a flashlight on the major obstacles upon the path
to perfection. I describe my path and how the common pitfalls appear to
my eyes. Then I offer tools to map parallels between your experience and
those of other masters. Finally I give methods to help enlighten your path.
(13) Thomas said to him, “Master, my mouth is wholly incapable
of saying whom you are like.” Jesus says, “I am not your master.
Because you have drunk, you have become intoxicated from the
bubbling spring which I have measured out.”
The closest disciple states that his mouth could never describe whom his
master is like.
Thomas is closest, for he knows in his heart that whatever words he uses will
fall short. Words limit the breadth of the vision he has of this enlightened
being. Imagine poor Thomas stammering to try to capture the Truth only to
settle on the statement that the man from Nazareth is indescribable.
Jesus responds by stating that he is not Thomas’ master, that Thomas is
intoxicated from Jesus’ spiritual truth. This statement may be read several
ways. One way is that Thomas is intoxicated with the power of Jesus energy,
and because of this, he cannot be a disciple. A man lost in the beauty of the
words, may miss the message.
Another reading hints that Thomas is now the equal for he is drunk on
the experience of truth. Thomas has merged with the ideas of his master
so wholly that he is now one with God as well. Either reading you choose,
Jesus takes him aside to teach him further. When Thomas returns the other
brothers question him..”
42 43
Whatever Jesus tells Thomas, the disciple felt that his other brothers
would either misunderstand him and stone him, or they would rightfully
understand the import of the words and stone him as well. Moreover,
regardless of why they might stone him, Thomas unequivocally claims that
they could not but hurt themselves by stoning their fellow.
These responses tell many things. First, it is likely that Thomas is now Jesus’
equal. For of all the things that Thomas could say, this would raise the most
ire of the others. They would chastise and possibly stone him for blasphemy.
Another support to this reading, is that their stoning would not hurt
Thomas. This fact shows that Thomas has merged. Only those far along the
road to enlightenment are protected in this manner.
The truth shared with Thomas is so profound as to make his brothers want
to kill him, and in their ignorance, their blindness would cause their own
violence to turn upon themselves. Imagine that they do not want to hear the
truth. Upon hearing it, they cannot bear its weight. So instead of changing
their integrity, thought-word-deed, they try to destroy the truth. Loss of
truth would surely burn them. Inconsistency of their beings would burn
them inside without doubt.
.”
Obsession
No church authority could ever tolerate the above verse regardless of where
it came from. Jesus states that fasting, alms, and praying, staples of church
doctrine and dogma; cause sin! Most wonder how this can be. With a little
light, the ideas become sharper.
Earlier I mentioned that a glutton and a faster are no different, for they
both obsess on food. Forever is food on their minds. Same with alms. The
greedy obsess with money for many years. Then when they get older and
have enough, they only think of giving it away. Nothing has changed. In
one state they gather positive money, in the other, they gather negative
money. All is money.
Lastly the idea of prayer arises. Why, of all things, would prayer lead to
sin? In ancient Hebrew, one definition of sin means “missing the mark.”
When a disciple swings from one extreme to another, he fails to hit the
mark. Enlightenment means balance. It signifies equilibrium between the
spirit and the body. In the realized soul, his eternal spirit and physical body
balance perfectly. The examples above are indicative of the dangers to an
advanced seeker.
A note is merited here. Alms, prayer and fasting in and of themselves are
not dangerous to those still in the world of action. Early on the path to
perfection, young humans need familiarization with the feelings associated
with these acts. They also need to learn self-denial. Eventually they must
practice the denial of extremes.
When I first committed to walking the path full time, my wife left with
my child at 29 years of age. I then proceeded to surrender everything else
I owned. The purpose of this renunciation was to remove obstacles to my
enlightenment. I told few and did not make a large charitable gathering.
I carefully surrendered to those who would not be too grateful or too
resentful. This ensured that I would gain no positive or negative benefits
outside myself.
Conquering Obsession-Modified Renunciation Again
I coupled this methodology with minimization in all other areas of my life.
I spoke with as few people as possible except the bare necessities: “A large tea
please.” “No, no ice,” etc. I did not run away to the Himalayan Mountains
or to an ashram. I wanted to be in the world as much as possible. Recovery
under load. Growth while still under the stresses of the real world, that is
my method. It provides an intense and rapid ascent to the foothills and
peaks of truth.
After a period of time, I slowly added back distractions into my life.
I mean distractions from the path of personal perfection. Distractions from
internal and external consistency, true integrity. The final stage of integrity
includes feelings. When your feelings are not in concert with your thoughts,
words, and deeds, a lie or inconsistency is present. I get ahead of myself.
So, I slowly re-engaged with the world. Whenever I felt myself falling into
old behavior I eased off. But only enough to remove the old behavior; never
did I run away.
This last point is key. If you run away, you have conquered nothing.
If one is truly enlightened, nothing causes inconsistencies in his being.
Therefore, it matters not to the enlightened man whether he is alone
in a forest, or in a crowd of thousands. Remember also, though, that this life
is about experiencing the dualities of Earth life. One has come here
to live in a polar world. Perfection involves retaining your own
personal core while experiencing the myriad variety only possible in a
bipolar world. Pun intended.
Remember then, use these tools to encourage your own enlightenment.
Use them to make yourself whole rather than a divided being of confused
desires. Remove your inconsistencies, then live as a human among the
44 45
world. Or, travel to the hinterlands. Use what works for you. Know this
though, you can hide nothing from your eternal soul.
Imagine for a moment that you could access every sensation your body
experienced from the moment it was conscious. It would overwhelm you
and possible drive you insane. Yet you somehow keep track of all of your
actions, feelings, and thoughts whether you are aware of them or not.
Whether it is your soul or your DNA or your brain that accounts for
everything, you always reap what you sow.
(14) .”
Here, the master gives more tools for his disciples. He tells them to eat
what is offered, and make whole those who come to them. This keeps the
disciples from reinforcing more extremes. They are to live moderately with
what the universe offers. He does not recommend sloth or laziness, he tells
them to stay busy sharing what he has shown them to heal imbalance. Be
it spiritual or physical. The interesting thing, is that when you retrieve the
truth from within, you want to share it with all, without being told. Thus,
this admonition is not necessary if you truly receive what Masters are saying.
The reason for this sharing, is that the only way a human really knows when
he has learned the fundamentals of something is when he can share them
with others.
Jesus adds a further clarification that what they take into their mouths does
not defile them, whereas that which comes out does. This refers to the fact
that the acceptance of what life offers creates no backlash, but acting in the
world does. It is important that one reads the word, “defiles.”
When the disciples move into the world accepting its variation, they risk
no defilement of themselves. But when they decide to act in the world they
risk defiling their perfection, they create actions that have possible backlash.
When you act naturally without arithmetic calculation, there is no risk of
karmic balance being created. When you behave as a businessman, always
calculating profit, and moral balance, you risk a positive or negative cosmic
accounts balance. Then you must cash or pay your excess balance; positive
or negative.
(15) Jesus said, “When you see one who was not born of woman,
prostrate yourselves on your faces and worship him.
That one is your father.”
Twice (or Thrice) Born
Here we have the source of the virgin birth mythology. Several key points
introduce our discussion. One, all beings born on this planet have a genetic
father and mother. Jesus was born of man and woman. If Jesus was not born
of man, Joseph’s lineage to David would be meaningless. Depending on
which version you want, the one from Matthew or Luke. Seriously, the first
birth is always of 46 chromosomes, 23 from the mother and the same from
the father.
The second birth Jesus always refers you to, is a self birth, the self-
substantiation that all Masters go through at one time or another. You
become your own parent. A woman her own father, and a man his own
mother. You fulfill that within you that is out of balance. You are born with
either a masculine of feminine bias overall. This must be balanced along
with all of your other thoughts, feelings, and actions.
Thus, a man not born of a woman, is one who has birthed himself. He who
has balanced all of his cells; his physical and non-physical components. For
women it is the opposite. She who is not born of man must balance both of
her polarities.
The mishmash of scriptures that have descended down through the
centuries confuse these facts. Keep track of your purpose here, to enlighten
the facets of this existence, to enlighten you as to the ideas of balance and
equilibrium within; to reach perfection. Our goal is to return cohesion to
the ideas of earth. Truth is Unity, though not homogeny.
One who seeks a master, seeks a being who has balanced both masculine
and feminine sides within.
(16)Jesus said, “Men think, perhaps, that it is peace which I have
come to cast upon the world. They do not know that it is dissension
which I have come to cast upon the earth: fre, sword, and war.
For there will be fve in a house: three will be against two, and two
against three, the father against the son, and the son against the
father. And they will stand solitary.”
Killed for Dissension Not Peace
To the modern dogmatic Christians, these ideas are anathema. They stink
of blasphemy and hypocrisy. Their Jesus was killed for peace loving, for
love. Sounds unlikely. The Jews and Romans killed a pacifist to set a strong
example? It delivers the message…of what? Don’t be nonviolent?
46 47
Jesus spread dissent wherever he went. He encouraged people to take their
liberty back from the philosophers who taught them slavery. This is a crime
worth punishment by powerful Hebrews and Romans. He has come to sow
“dissension…fire, sword, and war.” What kind of action is he encouraging?
First, he brings the fire of truth. This fire enlightens the contradictions
inherent in the lives of men, their hypocrisy. His sword divides the truth
from the falsehood. This message draws the line which delineates truth and
falsehood. The division is already present, prophets just clarify it with light
and wisdom. Light and the sword. Now, those who hear the word must
fight the discrepancy until it is no more. Then they surrender completely to
the truth.
Fight, Then Surrender
A key distinction is drawn above. One fights hypocrisy early on the path,
once they have fought to the point of stalemate, they surrender.
A man who is obsessed with sex fights his tendency to focus on it constantly
by a common method. First he examines his life to discover extreme
thoughts and contradictions. He thinks himself a good civilized man; he
just likes pictures of beautiful women. Upon reflection, he realizes that
the only reason for him to spend so much time browsing through beauty
plates is that he still has a desire for many partners. This is examination and
discovery.
Next, he chooses renunciation and substitution. He renounces the desire in
his heart to bed many women. He does this through a variety of means: he
stops looking at the pictures, he stops staring at women around him, and
he minimizes conversations with women. He substitutes a behavior which
dissipates the desires rather than repressing them. For example, he starts to
think of women as his children or sisters. Also, he may focus on reading
ideas which prove to him that he has no need of sexual fulfillment.
After a time of practicing this method, the seeker then slowly allows the
object of obsession back into his life. When he starts lapsing back into old
behavior, he uses substitution and renunciation a little at a time as necessary.
Eventually the desire is dissolved and he can trust himself in normal
interaction.
Sometimes though, the desire never seems to goes away. In these instances
the student must fulfill his desires. He must commence meeting and
bedding women until he is satisfied. Again, never with ulterior motives or
dishonesty. It is extremely important that lies of any type are not tolerated.
He must not create more contradictions within and without.
Many religious people would vehemently disagree with my statements. For
them I say, you cannot repress an unfulfilled desire. It only grows stronger.
Their heaven is described as a place where all desires are fulfilled. Hence, the
heaven where men get many virgins for pleasure.
This world is the place for completing material needs. Finish your work here
knowing that you will come back as many times as you need to. Again, if
your heaven is where all your desires are fulfilled, you could come back here
if that were your desire.
Now, externally, the war of Christians lasted for centuries after the death of
Christ. Call them Crusades, call them whatever, there are many wars waged
to “Christianize heathens.” As late as the Philippines in this century, the
American president declared that America had a job to do Christianizing
the poor Filipinos. Please disregard the atrocities committed there and the
betrayal of her citizens.
I do not write to claim that Christians are necessarily any more violent than
other religions, although there are decidedly more pacifistic faiths. I do write
to show the dangers of an organized religion led by a paid clergy. I write
of theocracy in and of itself, be it the religion, be it dogmatic External or
Internal sciences.
For there will be five in a house: three will be against two, and two against
three, the father against the son, and the son against the father. And they
will stand solitary.
The sentence above can refer to the external results of his words, households
dividing against themselves. Or, it can refer to the deeper traditional
meaning. Humans have five recognized senses. They always compete against
each other for the attention of the soul and intellect.
Since a Master’s sight no longer competes with the rest of his senses, the
other are stronger. This individual is less “divided” against himself within
the household of his soul, his bodily temple. Also, you can look at yourself
as your own father when you are balanced. Unfortunately, you are divided
against yourself as well. Your soul, or parent, fights with your child, your
human body.
A family which is in equilibrium values all input when making a decision.
A master’s words shine the light of truth upon your dishonest condition.
Initially this brings conflict as it took you ages to develop your habits. This
war results in peace. Internally you are solidified and consistent after the fire
tempers you. It heats your soul, body and mind into an indestructible alloy.
Specific matter may come and go, you do not. You are eternal.
(17) Jesus said, “I shall give you what no eye has seen and what
no ear has heard and what no hand has touched and what has never
occurred to the human mind.”
Because the truth is infinite, it cannot be conceptualized by a time based
entity such as the mind. It cannot be seen by the eye either. For anything
seen or conceptualized by these tools is time biased. This means that it is
conditional. The eternal is unconditional. It is always so.
48 49
Experience the Truth: Know the Truth
Hence, the truth that a master brings must be experienced by following the
path as delineated for you by an enlightened soul –one who is lit by the fire
of truth. One whose soul and body have passed through the crucible of self-
realization.
This text illustrates ways to pass through your own furnace. The price is
high, as it costs you yourself. It costs everything you think of as who and
what you are. The reward is worth it. You become timeless and eternal, you
feel fulfillment and bliss. You never experience the uncertainty of ignorance
again.
Once your eyes are opened, they can never be closed.
Give someone an automobile and try to make them go back to an ox cart.
This person will never forget the ease of the auto. Give someone sight, and
make them blind after a period of time. Lamentation for the loss of sight
lasts. It is a testament to the human constitution that we can survive this
loss at.”
The disciples ask about what is not once again. They question a living
master about the dead! They ask for an end when they have not experienced
the beginning. Again, Jesus is a kind master, he only illustrates their illogic.
Ask my students about my early methodology, I can tell you that I was not
nearly as kind. Then again, we do not have His tone. He may have had the
mockery and sarcasm I am known for.
He answers, how can you search for the end when you have not found
the beginning. He then proves how he knows, and how they can know
of themselves. Jesus never sought worship, he sought to show people the
way. That is right, show people how to find the way themselves. How to be
internally consistent, and how this leads to all the answers one could ever
want.
The truth appears different from differing vantage points such as the coin
when viewed from one side or another. To one it is heads, to another it is
tails. The self-realized only knows a coin.
The ancients often saw it differently from through their lenses. When you
climb a mountain, you take many switchbacks, few go straight up to the
top. During these turns, you choose a different endpoint for each one.
Thus, your destination appears to swing from opposite to opposite. Your
field of view moves from the right side of the mountain to the left, and
back again. When you emerge at the last mile, you travel straight up the
mountain. We are there. We have emerged from the polarized opposites of
history. Now we see the goal directly in front of us.
The Whole Elephant
There is an ancient parable about blind men and an elephant:
One holds the tail, he states, “The elephant is like a rope.”
The next wraps his arms around a trunk like leg,
“The elephant is like a tree.”
Another pushes against its massive side, “No you fools, it is like a wall.”
A fourth holds its trunk, “For me it is a hose, a giant hose.”
Finally, the last flaps its ear, “It is like a palm frond.”
A Master sees the entire elephant, those of you at different times are like
each of the blind men. Most philosophers are these amazing blind men,
attempting to describe what they cannot see. Seekers go a step further,
extrapolating that what they see is only an aspect of the reality. Finally,
a fully enlightened one knows the entire animal. He or she can speak to
whomever has a question wherever they ask it from.
Life is a circle. It begins in life and ends in death. Yet if you have eternal life
you shall not die. In other words, death begets another life. For each time
you die, you are born again to fulfill your unfulfilled desires. Fulfill all that
you ever desire and you shall not die. Unfortunately we have short term
memory loss. Like a bunch of marijuana smokers, we cannot remember
what we just did. We repeat over and over. Get stoned on life if you enjoy it.
Otherwise, stop smoking for a moment and let the smoke clear. You will see
a vivid world which needs no embellishment. Even better, you can embellish
it afterwards if you still so choose.
You can always go back to the intoxicant of sensory overload if you like.
Just don’t pretend you have become sober enough to choose, and that you
have chosen this dream. An informed decision must be made. This myth
of a perfect saint being born without every having tried something reeks
of insincerity. What does it teach us, that being born perfect is the only way
to reach eternal perfection? No, all of us can reach our own perfection in
this lifetime.
50 51
Renounce Renunciation
One who has never smoked is unimpressive in their renunciation of it. Same
with one who has never had sex or drank. This is not a saint, but an ascetic.
One who is obsessed with so called austerity. What about austerity from
austerities themselves? Can they drop this addiction to renunciation? Not
without great effort. This is often the hardest part, letting go of “the act of
letting go.”
After I renounced everything, I slowly added it all back to ensure
enlightenment. If one gives everything away, part of that renunciation is the
fear of losing things. That is why one gives strategically and without fanfare.
There cannot be a benefit to letting go other than the letting go itself.
Otherwise, you are just attaching to the praise of charity. You are attaching
to something else rather than only enjoying what the universe provides.
Ancient Vedantics studied philosophy without fail. They logically reasoned
out all that you hear from masters. They realized that running away to some
ashram or temple was only a step on the journey rather than the journey
itself. They discovered a philosophy of living that can be practiced right here
and right now, that realizes results immediately.
For if your philosophy of life causes you to avoid living, what is it? Your
philosophy of living must integrate life for you. Everyone’s goal of life
is different. Fortunately for all of us, we get the opportunity to discover
what that goal is. We are rewarded with ignorance prior to the reward of
knowledge.
We must be ignorant in order to learn, for if we knew everything, we could
never learn. The joy of discovery would never be ours. This is God’s grace,
the grace of our Creator, our universe. If it helps for you to conceptualize a
master conductor, so be it. Only, live consistently with your knowledge.
Finish What You Start
You must follow each path completely to know what is at the end. Imagine
you are lost in a forest, you come across an intersection of two roads. You
have four choices, North, South, East, and West. Are you going to go part
way down each one and declare that there is no way out of the forest? Or,
are you going to completely follow each one until an end is reached?
These are the paths where our organized religions leave us. Most describe
paths that lead halfway. For most require us to die to reach the end. The
beauty of these arguments, is that no one living can disprove them. For if
you are alive, you obviously have not reached heaven!
Nonsense. If you cannot verify the path through personal experience, it is
invalid. Furthermore, if it cannot be verified, nobody can prove to you that
it completes. This is the science of living, not of some far off theoretical
model. The goal of life is to live perfectly. That is the goal of any science of
living, of any religion. Religion is about living a perfect life whose reward is
that perfect experience, versus some nebulous unverifiable concept.
(18) “Have you discovered, then, the beginning, that you look for
the end? For where the beginning is, there will the end be. Blessed is
he who will take his place in the beginning; he will know the end and
will not experience death.”
To simplify this discussion I will avoid the whole “life is a circle
without beginning or end idea.” Suffices to say, that because the truth is
unconditional it cannot have a beginning or end. If you are to live forever,
you cannot have beginning or an end. For if you have a beginning or an
end, you are not eternal. There is a time when you do not exist. The truth
must always BE.
If you want to know the end, you need only know your beginning. The
seeds of the future are the present, and the fruit of the past is the present.
Psychic visionaries always try to tell you the future or the past: “He was
murdered by such and such,” or, “He will be murdered by so and so.” While
an impressive and useful gift, religious sciences give a more reliable method
of sight.
This method, though much more rigorous, enables an enlightened soul to
see both the future and the past. For if you know the present you know all
that is before and after. For as I explained above, the present was created
by the past, and the future comes from the present. Thus, if you know the
present you know the beginning, if you know the beginning you know the
present, if you know the present you know the end.
Yes, it is that simple. Please note though, that if you do not know all of the
present, you know nothing. Everything is related to everything else. Know
one thing completely, know them all. Know a little of everything, you know
nothing. Any philosopher will tell you, the more they learn, the more they
recognize their own ignorance.
Know the present and know eternal life.
(19) Jesus said, “Blessed is he who came into being before he came
into being. If you become my disciples and listen to my words,
these stones will minister to you. For there are fve trees for you in
Paradise which remain undisturbed summer and winter and whose
leaves do not fall. Whoever becomes acquainted with them will not
experience death.”
52 53
A Form of Meditation
When I mediate on this scripture, I perform what is called samyama. The
science of yoga is the path followed by most masters regardless of what they
call it. It is the process of knowing something inside and out without taking
it apart. When you break something apart to understand it, you fail your
primary mission.
If your goal is to understand a person, taking them apart does not fulfill it.
I take you apart and study all of your cells under a microscope. Yet you are
more than the sum of your parts. Try putting component parts of carbon,
hydrogen oxygen etc into a bucket, do I have you? I think not.
So, Yoga means, “to yoke,” or “union.” Its many aspects include the
processes of Dhyana, Dhyana, and Samadhi. These are contemplation,
concentration, and union with knowledge. In the first step, Dharana,
one concentrates the focus of the mind on one object. Say, a tomato. The
individual constantly trains the mind on all characteristics of it, seeds, vines,
green, red, even soil. Author’s traditionally refer to this as “meditation.”
The second stage is Dhyana, or contemplation. The student focuses, or
contemplates, only the object itself. No longer is drifting to aspects allowed.
Here, the student learns single-pointedness, the ability to contemplate
only one thing at a time. Obsessive Compulsive people are expert at this.
Unfortunately, they are ignorant of what is worth spending all of their time
considering.
Oneness-Samyama
Finally, a state of peace is reached where the contemplator becomes one with
the contemplated. This state of method of reaching the state of Samadhi is
called Samyama. When an expert performs Samyama on an object, he or
she can know an object as it “knows” itself. You can know a tree from its
inside out.
The logic behind this method is that awareness is the key to all. If awareness
is life, and everything is known as you conceptualize it to yourself, you can
know something completely by removing your biases. There are many books
which describe this concept in physics. If you want to know these, ask me
personally, or find them yourself. If I can find them, so can you.
Now that I have broached the process of Samyama, I will explain what my
feeling is on this verse. The feeling I get, is that of my internal core in all
of its glory prior to entering the density of physical incarnation. You may
ask, “Gouthum, what the heck does that mean?” Then again you may not.
Either way, I will explain logically what I think of as it complements what I
feel.
When you balance your soul first, before entering into your life, you have
perfection. The soul needs its polarities internally balanced before entering
the experiences of life. There are several levels of examining this. You exist as
a soul before you get an intellect, or a mind, or a body.
The intellect provides your reasoning power, your mind your emotions,
your body corresponds to bodily needs. These three pieces refer to your
physical incarnation. When you are physically attacked, your body has
chemical processes that respond with fight reflexes, you are courageous.
Your body begins its adrenaline rush, your mind feels fury and sees red.
Your intellect reasons out why you are right to be furious. This is your
human responses. Your soul has none of this. When you have no body, how
are you going to think? How are you going to feel? How are you going to
react? You have no body with which to act, no mind with which to feel, and
no intellect with which to think.
Your incarnation can be thought of as a descent into the body, mind and
intellect. In that order. To reverse it you must reason your way through the
bodily desires, and mind’s emotions. Eventually you must drop the intellect
itself. By removing inconsistencies between your intellectual logic, mind’s
feelings, and body’s reactions, you are able to act as one consistent actor.
Then you allow your soul to BE.
If you become my disciples and listen to my words, these stones will
minister to you.
In Samyama, the rocks can teach you. When you can become one with
anything that you contemplate, anything can minister to you. Even the
rocks show you.
This is being. By uniting the competing parts of your nature, you come into
being first. Once this is done, you allow your being to BE. Then your being
has come into BEING. There are other competing parts of your incarnation
that you can use to explain these ideas. And don’t worry, they are easier to
understand.
For there are five trees for you in Paradise which remain undisturbed
summer and winter and whose leaves do not fall. Whoever becomes
acquainted with them will not experience death.
Master the Senses
These five trees are the five senses. In the state of paradise, man is not
divided from heaven. Here soul and body are one, spirit plus matter
equals God. God minus spirit equals matter, pure objective science, no
meaning. God minus matter equals spirit only, then there is no creation.
No physical life.
54 55
Both matter and consciousness must be one. Ancient Vedantins called this
Purusa and Prakriti. Purusa is the pure energy of the universe, the common
denominator for everything energetic. Prakriti is the matter of which all
things are made. These are also thought of as the masculine and feminine
principles respectively. Female being matter, male being energy.
This is also reflected in procreation. Man provides the energy through
sperm, and woman provides manifestation through egg and uterus. She
takes concept and energy, 46 chromosomes with male vitality, and makes
a child. She creates. Perfection is the union of these polarities in total. All
beings lined up perfectly within and without.
Compare this to a steel girder. If is it forged, and the molecules are lined
up inconsistently, it will shatter when subjected to stress, to increasing
vibration. When the molecules are consistent, it weathers vibration and
dissipates the vibration.
Galloping Gertie
People are no different. Your thoughts mirror your physical consistency and
vice versa. One must be consistent in one’s being to resonate one’s note. You
are a symphony of one note. Think of the note C. Whenever you have C
strings in a room, play one, and they all resonate. Anywhere in the universe
that the note of Gouthum plays, I am there.
Anywhere the symphony of God is playing, all notes are present. This is the
way that one can be in many places at once. Is it a different note C in 1875
versus now? How about in Vienna with Mozart, or the Isle of Wight with
Jimi Hendrix? Brittany Spears, Madonna? It is always the same note.
You feel a change in your bones. Your awareness is increasing with your
vibration. The Earth’s vibration decreased for several hundred years,
now it is increasing again. It shall double in the near future. This is what
you feel. If you do not reach internal and external consistency, your being
will shatter.
For there are five trees for you in Paradise which remain undisturbed
summer and winter and whose leaves do not fall. Whoever becomes
acquainted with them will not experience death.
These five senses compete for your attention. The eyes and the ears, the nose
and the mouth. In a state of harmony, they all work together to provide
a coherent picture. Instead of seeing an elephant as five different things,
you see it as one animal. In Paradise, when you are undivided, you remain
present and at peace throughout any change of weather. You weather any
storm with internal consciousness. You are aware, therefore, you are.
When you are one with yourself, you have Eternal Life. YOU LIVE NOW
AND FOREVER.
disciples again ask what some other place is like. Yet, they are closer
to the mark this time. They ask what they are aiming for so that they
can recognize it when it arrives. We will ignore the fact that Jesus is the
Kingdom of Heaven before them, and that all they have to do is seek for the
feeling of the Christ within to know.
Call it Krishna, Kristos, or Christ, you have the One. We are all aspects
of it. God is the beginning and the end, the Alpha and the Omega. It is
all that ever was and will be. It is the infinite. Because it is the infinite you
are part of it. For the infinite covers all, it is the ultimate truth, unlimited,
unconditional.
The world of many forms, the physical, is only an aspect of the infinite. To
see anything different, you require time. Without time, it all diminishes
to an ever changing chaos mass. The ancients called this unchanging
substratum upon which everything appears, God. Some call it the Tao,
others, the Brahman. All describe the cohesive principle of the universe.
56 57
Think of life as a movie. Without the screen you would have nothing. The
movie does not really exist without a means through which to view it. This
ultimate consciousness of which you are a part, is God. Each person is a part
of this body of God. Some are the hands of God. Some give a help up, and
some a fist. Some are the mouth of God, they speak. Others are the anus of
God, they defecate on other things. All components are vital.
Balance, the Right Action at the Right Time
Our societies have a philosophy which states that nothing “bad,” “should”
exist. As a result we are not to burp in public or ever talk about our
elimination of wastes. If nothing bad comes out of you, you are without an
anus. If you are without an anus, you are full of feces. The majority of the
people in the world are full of waste. This idea is that if you are perfect that
nothing negative comes out of you. As a result we have people suffering
inside upon their own wastes. This is where the digestive problems come
from and much of our illness.
We are sick from the inside out because we deny ourselves based on
misguided morality, this idea of sainthood which is really only half of the
puzzle. The saints of old Christianity demand no sex. Although this may
have started as a tool through which to reach the divine, the means became
the end. Imagine a world of no sex? You cannot, for no one on earth would
exist to conceive of it.
It is not that there is no morality at all. There is balance, but what we
usually think of it as, is not what it IS. You must discover yourself, then
you are internally consistent, then your actions are externally consistent.
Then you always act in concert with Truth. Old Christians often state that
violence is wrong.
Have you tried to explain this to a drunk in psychosis beating his girlfriend?
It fails miserably. Have you tried to restrain him? Impossible. Have you tried
to sedate him? The needle breaks off into his arm, and you get hurt. In the
end, you often have to beat him into submission until you can restrain him.
Tell this woman that violence is wrong? There are times when you can get
anyone to do anything. Once you see yourself in everyone then you have
achieved something.
Then you no longer judge them personally. You may not agree with their
action, and you may respond to it, but you do not think them ill, or evil.
Once you create the ultimate good, you create the ultimate evil. For the
system must maintain equilibrium.
Think about society. Society is comprised of people. If people are in
disequilibrium, society is in disequilibrium. If society is in disequilibrium,
persons are out of balance. This is the state of our current society. People
are suffering and society is suffering. We are trying to create the “perfect”
society where one portion of the globe does not suffer.
As a result, we are creating parts of the globe where EVERYONE suffers.
Is this the world that you want to populate? Balance is ensured by the laws
of the universe. No one can circumvent this order. Chaos is order you do
not understand. “Random” is objective science’s way of saying I don’t know.
“God” is subjective science’s way of saying the same. The universe makes
perfect sense.
Some dispute that there is order, or eternity, or fairness. I have some simple
examples to show that they likely exist. First, a child always asks where it
comes from. That is because it KNOWS that it was somewhere before here!
You never have to mention the idea of “pre-existence.” Same with “after,” it
always asks where it goes. It knows that its consciousness never dissipates.
Next, it asks why the world is not fair. You may never mention that the
world is to be fair, it knows that there is balance. It cannot understand
why things don’t feel they way that he or she expects them to feel. Here
is the key. Our short lifespan disallows one to easily see the balance of the
universe. Regardless whether this is fair or not, if you saw balance and
fairness from the day you came into an incarnation, you would never
experience anything.
The ultimate equilibrium is stagnation. Take a closed tank of 0 degree water.
Partition it into halves and make one side positive 237 degrees and the
other negative 237. Remove the partition. At the convergence zone you see
thousands, millions of reactions. This is where life occurs. At the fringes,
or extremes, you experience nothing. Life is duality and interaction. At the
microscopic level it appears chaotic. At the macroscopic level it is always in
balance. The universe is the infinite tank. It is always in balance.
Know that everything follows a pattern. By definition, the world is perfect,
for that is what IS. It is our conception which is flawed. We are trying to
project our normative moral ideas onto an amoral and balanced world. It
does not mean that humans are amoral. Humans have morality. God’s do
not. Incarnate God’s do though, yet because their scope is so broad, they
may seem amoral to you.
(20) “It is like a mustard seed. It is the smallest of all seeds. But
when it falls on tilled soil, it produces a great plant and becomes a
shelter for birds of the sky.”
The Kingdom of Heaven is like a small seed that grows into an incredibly
massive tree capable of shading all around it. Truth is your core, for you
are eternal. Your consciousness is forever. You feel it deep inside yourself,
as a little voice. It tells you from your earliest childhood what is right and
wrong for you. Most Christians call this voice the Holy Ghost, or the
“still small voice.”
58 59
When you feed this seed with a perfect body, mind, and intellect, it grows.
You grow from a seed into a giant tree. Your perfection offers the vast
shade of peace to all those whom you interact with. This feeling has been
testified to by all who have sat in the presence of a master. Even the word,
“upanisad,” the title of ancient Vedantin books, means “at the feet of,” for
sitting at the feet of a master.
What is peace though? To quote an anonymous source, it is more than the
absence of war. Peace is the absence of contentions or inconsistencies within
yourself. It is often experienced for brief moments by dancers, athletes, and
musicians. Whenever you are deeply lost in yourself, you are at peace.
This peace means you are of one body, mind, and intellect. Greeks called
it the union of body, mind, and soul. There are no divisions within while
in this state. A master is always in this state, for he or she has eliminated all
inconsistencies within. Religion’s job is to teach you how to do this.
Note that a master is still human. That is the joy. Why would the universal
consciousness descend into a human incarnation just to be itself without
experience? Masters still feels joy, and sorrow, pleasure and pain. Yet it is
more like hot or cold, there are no normative values attached to either. Not
only does a master get to see theelephant whole, he or she gets to experience
all of its parts separately too. This is the gift that is the state of Samadhi.
(21) Mary said to Jesus, “Whom are your disciples like?”
He said, “They are like children who have settled in a feld
which is not theirs. When the owners of the feld come, they will say,
‘Let us have back our feld.’ They (will) undress in their presence
in order to let them have back their feld fnd a way to come to you,
for the diffculty which you expect will (surely) materialize.
Let there be among you a man of understanding. When the grain
ripened, he came quickly with his sickle in his hand and reaped it.
Whoever has ears to hear, let him hear.”
Here Mary asks about the other disciples. To which her master replies, that
they are children who have settled in the field of the Jews. Throughout
the scriptures, the people of Israel are referred to as a field. The religious
institution of the day had captured the people.
His disciples have settled into the field of the so called authorities. They are
squatting. When the leaders come, Jesus students will undress themselves
into their presence in order to return the people. They will show themselves
naked for what they really are.
To this action, the master provides an admonition. Be prepared for the
thieves who have stolen your liberty. Do not allow them to search through
your domain, your soul, to carry away what is yours.
He warns the people to arm themselves with great strength rather than to
surrender to thieves and vagabonds who sell salvation in a future life. Train
yourself a master who can harvest the seekers when they are ready. This
“man of understanding” will reap the liberated from among the slaves.
The time of Jesus had scribes who owned religion, its observances and its
rewards. To him they were thieves stealing what was rightfully the people’s
own inheritance. This is one of the things that He was crucified for. Ever be
on your guard for those who seek to draw you to themselves instead of the
truth itself.
.”
Like a Little Child
As usual, the disciples take Jesus literally here. He points out a baby that
takes the milk of this mother with faith and without prejudice. His students
then think to behave like children to enter eternity. This is a common
misunderstanding today.
People rush to become adults only to reminisce for the days of childhood
as soon as they reach adulthood. There are even ascetics in the East who
defecate upon themselves and wander around like babies. All of this under
the misguided notion that children are all that can enter the kingdom of
perfection.
This is a simile, “like those who enter the kingdom.” Children are without
prejudice. The key is to learn everything without building prejudices, then
you can then see what is really before you.
60 61
Children are not innocent, no one is. That is correct, we are all ancient
and have lived numberless lifetimes. You do not get a human body without
learning the basics of single-celled life, all the way to multi-celled life, finally
to animal and human. A simple analogy serves.
What you think of as automatic is just that which you have learned already.
Remember learning to walk, or at least, watch a child. When he or she
begins, it is a tentative business of wobbling and weaving. By the age of your
reading this, you have hopefully mastered unconscious walking. Some can
even chew gum at the same time.
So, what you think of as automatic, is just something you have already
mastered. Therefore, all of the cellular operations you imagine as grace, were
earned. You are neither innocent nor guilty, though you are worthy of this
human body. Now life itself, the first time you receive it, that is the grace of
the universe.
.”
We have already discussed the first part, how to make the two one. To
reiterate quickly here, we are of two polarities, positive and negative,
masculine and feminine. When we can balance our forms, we are no longer
in disequilibrium. And thus, we enter perfection. We neither advocate
bisexuality or androgyny here, nor do we condemn it.
However we do advocate the balancing of your own poles, such that your
masculine and feminine are in balance. Some call these poles Yin and Yang.
The easiest way to think about it is when your thoughts and deeds line up.
Yet the master goes further. He talks about the five senses again, though in
a seemingly meaningless manner. Your eye itself does not see, nor does your
hand touch. There is something within you that interprets the signals of
these organs. Most objective scientists believe it is the brain that processes
the signals. But what interprets the brain?
You are not the brain, as they can remove large parts of it without changing
your personality. Imagine the person who loses long and short term memory
and still has the same personality with accompanying behavior. Or, the rare
occurrence of an individual who loses almost all of the major portions of the
brain yet retains everything!?
If there is one exception to a theory it is incomplete. You are not the
brain either. So the question remains, what interprets ALL of the signals,
including the brain? Your soul does. It is the animating energy that does so.
This is the “eye in the place of the eye.” The Upanishads call this the “eye of
the eye,” and the “ear of the ear,” etc.
(23) Jesus said, “I shall choose you, one out of a thousand,
and two out of ten thousand, and they shall stand as a single one.”
One in a Million
Here Jesus uses gematria, or sacred numerology to explain the number of
his disciples. An easier way to think of this is the ratio of those who find
truth. The Upanishads state that one in a thousand will seek, and one in a
thousand of those will find. For you non-arithmetic majors, that is one in a
million who will FIND the truth. Of those, a considerably smaller number
will realize infinite truth.
Some say that number is one in a thousand of those, or one in a billion for
the final number of eternal beings. The exact number is unimportant. Know
this though, those among you who seek full time are of a very rare few. The
final method is less important than the courage and commitment to drive
through all obstacles to the end of your road. Remember as the masters say,
if you find the beginning you find the end. Since creation is a circle, you
find one, you find the.”
En-LIGHTenment
The disciples seek a place outside, for that is much easier than searching
within. So, they ask where Jesus is, for they know that he is where
they want to go. They are trapped in the time loop. For there to be two
places there must be two different times. Rather than get caught on that
mind bender, try to see where a master is, then find that same place within
yourself. Capture the feeling of the master by staying near, then find that
experience within.
62 63
The answer he gives, is that there is light within himself. Light is a cosmic
principle. The more we study of physics, the more we learn that it is
difficult to state any absolute truths in terms of solid objective facts. What
we are left with are principles of behavior. Think of the principle of static,
in motion, and equilibrium. On a subatomic level it is easiest to describe
things in terms of principles of interaction.
Think of chemistry. Each atom has electron orbits, or “shells of probability.”
What the heck does this mean? It means that for any given atom, there are
electrons orbiting its nucleus. The irony is that we never know where those
electrons are at any given time, but we have a probable orbit.
An analogy serves. You have a satellite rotating around the Earth, but we do
not know its exact start time or finish time. We DO know what distance
from the Earth it always maintains. We could say that we have a probability
shell where it is at any given moment. This is the science that everyone puts
their faith in.
It is humorous that those who often argue with subjective religious science
know less than this about objective orthodox science. In reality, our external
science is just as relative as our internal science. Each gives us the ability to
decide our behavior based on likelihood.
The difference is that each has a different purpose. The former seeks to
provide methods of external peace and reliability, the latter seeks internal
peace and reliability. When kept flexible and dynamic, both serve their
purposes. As soon as either becomes static dogma, we become out of
balance. All are tools for our perfection, inside and out.
.”
Minimize Hypocrisy
These aphorisms are clear even to the thick headed. Love your brother as
you love your own eye, your own ability to see, the part of your eye that
allows light in. Then Jesus adds, that normally you see what is blocking your
brother’s sight, but you do not see what is blocking your own.
There is still more depth available to those who desire it. How can you truly
see what is blocking your brother’s sight when yours is blocked? You cannot.
Very simply, you project your blindness onto another rather than look at
yourself. As long as all discord in the world is outside of you, there is no call
to action.
As long as the messiah comes at another time and place, you are free to do
as you please. You denied him last time, and you deny him this time. You
do not want him, for he causes you to see the blindness in your eyes, your
ignorance and hypocrisy. You worship the dead instead of the living. You
tend to compare what a living master says to the dead words of those who
have gone before.
Compare what they say to what is, to what you say. To what you see and
feel. To what you know, not what you think. What you say is what you
believe, what you know is what you do. People speak all day about how they
know there is a God, then they act all day is if there is not one. They believe
there is a God, but they know there is not one. Take the time to examine
these things. If you do not do it today, you will never do it. Tomorrow does
not exist, and the past is gone. Today. Today. Today.
You will die, and maybe in the next fifteen minutes. Do you want to
re-experience the pain of this entire life again, just to be at the same place
you are now? Several more questions may aid you in your quest:
1. What is worth dying for?
a. That is what is worth living for
2. If you could change one thing in the world, what would it be?
3. If you were to die in the next fifteen minutes, what would make your life
worth living?
a. What would justify your existence
4. Describe the perfect day?
a. Now live it
5. Assume you just lived your perfect day, now what do you want to do?
6. Describe your perfect job assuming money is not a problem?
Enough for now. Answer these questions, act, and you will begin to live
a perfect life. Go out and live. The only way to learn is to make mistakes.
These are the experiences worth living. If you were born in balance you
would be dead, there would be no reason to live at all. You would not even
know that you lived, for everything would be perfect and in balance, there
would be no differentiation to show you yourself. Revel in the variety, for
that is life.
See the mote in your own eye. That is enough. Once that is done you will
know what to do, worry not about the mote in your brother’s eye that may
or may not even exist.
(27) <Jesus said,> “If you do not fast as regards the world,
you will not fnd the kingdom. If you do not observe the Sabbath
as a Sabbath, you will not see the father.”
64 65
Worship and Obsession
The Sabbath day is about oblation to God. It is about worship. Two key
concepts are appropriate for discussion here. What is worship, and when is
the Sabbath. Everyday is the Sabbath, spend everyday honoring God, honor
your creator by worshipping it.
You are created by the universe, whether God created the universe and is
the universe is immaterial. You know without any doubt that you were
generated from the parts of the universe. Worship it. What is worship?
Worship is enjoying things for what they are, honoring them. How does
one honor? By using all of a thing for its intended purpose. Like the Native
North American buffalo hunters you are to worship. They used all of the
animal, they wasted nothing. By eating what you can use, you worship.
Gluttony is a prime example of abuse and poor stewardship. You eat what
you cannot use, resulting in sewage overflow into the environment and ill
health. You will hear religions everywhere talking about sexual austerity, not
using harsh language etc. But what about waste? What about buying a yacht
that no one else can use, yet it uses tons of resources and sits in berth 95%
of its time? This is greed at its worst, failure to use what you have.
I am not saying that nice things are wrong, wasting them is. Use what you
have wisely, then more will be given to you. Abuse what you have and it
is taken away, just ask any alcoholic! Spend every moment as a worship of
your creator, enjoy and utilize all that it offers you. This is the divine life. If
you do not value life it will be taken from you, and you will not see what is
right in front of your eyes—you will fail to see the universe around you. You
are blind.
(29) Jesus said, “I took my place in the midst of the world, and I
appeared to them in fesh. I found all of them intoxicated; I found
none of them thirsty. And my soul became afficted.”
Drunken with the Material World
This is the fate of all masters. They birth themselves into this world only
to find all drunken around them, intoxicated upon the pleasures of the
material. They find their people lost in fleeting pleasures instead of deep in
the eternal ones. They are lost outside instead of found inside.
Self-masters show the truth, yet people insist on arguing in terms of their
addictions. “What do you mean you cannot see the eternal world, master?
How is that going to help me get better progeny, food, shelter, and sex?
What do you mean that I already have bliss? If I have bliss how can I enjoy
my intoxicant?” All addicted. All wasted.
Little Johnny
They hear with their minds, but not with their hearts. From an early age
they are taught to lie. Ms. Jones comes over with a new haircut. She asks
little Johnny, “What do you think?” He says that he doesn’t like it. Ms.
Jones tells Johnny’s mother that he is a rude boy. All Johnny did was tell the
truth.
His mother tells him not to tell the truth. Hence the first contradiction
comes. “Johnny, never tell a lie.” For years, his mother says, do not lie. Then
one day, she tells him that lying is OK in certain circumstances. When it
will hurt someone’s feelings it is OK to lie. When he is older, he breaks a
prized vase, he thinks, “Hmmmm if I tell mom the truth it will hurt mine
and her feelings. I must lie.” Few children ever reason their way out off this
dilemma.
Some children do. Let’s examine this situation. When someone asks you for
a compliment passive aggressively, they are stealing. When Ms. Jones asked
Johnny how she looked, she did not want the truth. She wanted to be told
that she looked good.
This complement is a theft. She wants free energy from a little boy. If she
wants to be paid, she must ask. This is the rule of the universe, ask and ye
shall receive. She might say, “This haircut makes me feel good, tell me how
good it looks on me.” She may not be feeling well, and have decided to get
a new hairdo to make herself feel better. Then she can say, “I like this new
haircut, tell me it looks good.”
Whenever someone behaves passive aggressively, they are often thieves,
stealing that which does not belong to themselves. They get paid in good
feelings from your lie. Who pays for your lie? You do. That is right, this is
the worst kind of theft. From a young age you try to help, and it makes you
weaker and weaker. Our societies are designed to reward theft.
Your parents usually teach you to ignore the voice of truth in your
childhood. After thirty years, you have built up investment in your
falsehood. When you finally meet a master, he speaks truth and his light
hurts you. It enlightens your ugly hypocrisy. You have two choices, ignore
the little voice, and hold on to your investment, your false conception of the
world. Or, throw out the lies, and live anew.
66 67
I speak to a man of sixty. He has been living this lie for sixty years, he is
going to die in ten. Rather than discard the past sixty years and live ten real
years, he holds on to the drunken vision. People have an empty life of lies
they wish to hold onto. Luckily for them lies cannot go with them into the
next world. You come into this world empty, and because you only have lies,
you leave empty-Better than leaving with the lies, then you would just dig
deeper and deeper. Yet somehow, people manage to live this eternal hell too.
(29) Jesus said, “If the fesh came into being because of spirit, it
is a wonder. But if spirit came into being because of the body, it is a
wonder of wonders. Indeed, I am amazed at how this great wealth has
made its home in this poverty.”
First there was spirit, or concept. The universal had an idea, it encased it
into flesh. This is the body coming into being because of soul. What is more
amazing still is when we reverse the order. When your soul shines through
your body, it is a wonder of wonders. That is what masters try to show you,
how to shine eternally through the finite. It is amazing to us how you can
reside in the poverty of ignorance. It stuns us to see the infinite believing it
is finite, it shocks us to see the eternal trying to be temporary. Why would
you want to know only this impermanent world?
(30) Jesus said, “Where there are three gods, they are gods.
Where there are two or one, I am with him.”
“Gods,” or Cosmic Principles
Gods are cosmic principles. Humanity has trouble of conceiving of anything
greater than itself. The sun gathers human characteristics, as do animals and
everything else under the son. Even their divine being has human traits,
jealousy, and ego. The over arching principle of the universe I know of has a
mixture of everything. So ancient humans called these cosmic laws, “Gods.”
Nothing can exist in the created which is not present in the creator. The
universe is created out of the creator itself. It used a part of itself, for it is the
infinite, it is the All. Thus, anything conceived of is from this Father. “HE”
is the conceptualization of reality, “SHE,” the mother, is the manifestation
of it. Together, father and mother create us. The masculine, the ideation, the
feminine, the manifestation.
Three Gunas
Hence, the Gods are sub-principles of these two universals. Vedantins
choose three principles which underlie all others. These are those of inertia,
change, and equilibrium. These correspond with three gunas, or qualities:
Tamas, Rajas, and Sattva. According to the ancients, the entire manifested
universe is comprised of different collections of these principles. Quantum
physics finds parallels to these, as do many other sciences such as chemistry
and astrophysics.
Due to the fast that these ideas are extremely opaque and dead for most
seekers, they are usually described in terms of Gods. Ancient science
merged with art. It was not considered complete if it only fulfilled technical
requirements. For anything to be complete ancient masters required it to be
aesthetically pleasing too.
Dogma of the Day
An important note is merited here. We believe that we are the pinnacle of
human development, that ancient builders constructed the pyramids of
Africa and the Americas with no knowledge of the wheel. That the squatters
in these places when Western Europe discovered them were descendants of
the original creators.
By this logic, they were created by Europeans. Huh, you say? The majority
of churches built in the early invasion of the Americas were built out of
the temples of the locals on sacred local sites. Thus, the original builders of
these pyramids must be European, as that is who lives there now. We know
that this is inaccurate.
It gets better. There is a man named Edward Leedskalin who immigrated to
the United States from Latvia. In the early part of the 1900’s he claimed to
have rediscovered the principles the ancients used to construct massive stone
works without our ideas of machinery. Claims of this sort are not new.
What makes this case interesting, is that he build massive works at Coral
Castle in Florida, USA by himself, without known assistance. Seeing these
works will, at the least, cause one to question orthodox objective science,
which is littered with inexplicable phenomenon.
Yet now it is the dogma of the day. Note even the term, “orthodox” science.
It was new to Western Europe after the Dark Ages after a slave driving
religion crushed all competing ideas. Before the church, Europeans knew
that the Earth was round, and that it revolved around the sun.
The church made it illegal to read and write in its early days. It created
oppressive laws which enslaved all of the people. Specifically, lay persons
suffered the pain of death for reading the scriptures. This enabled the slave
masters to justify anything they wanted to. Do not forget the inquisition,
where even believers were tortured into confessing trumped up “sins.” Even
the greatest message of liberation can be co-opted for oppression.
Hitler’s information minister Josef Goebbels understood this well. He stated
that for a lie to be effective in politics or government, it must be huge, and
repeated often. Sound familiar. “Jesus, the resurrected was the only begotten
son of the father god.” The organized church fathers created a mythical
Jesus figure that fulfilled all of the requirements of local religions worldwide.
68 69
They even made his birthday in December to correspond
with a Roman God.
This does not require a conspiracy of large proportions. You have a group of
selected individuals who want to control a large number of people. They can
read and write whereas the subjects cannot. They hold money and power,
and they use it. Even if their intent was to liberate the people, absolute
power corrupts absolutely. Concentrated power is dangerous. It encourages
corruption by the buttressing of the belief in human infallibility.
Infallibility
For yourself, you are always infallible. Even when you drive drunk, and you
murder someone, you have done what you set out to do. Bear with me.
You intended to drive while inebriated. Your free gift is that you got to kill
someone too. What you do with that lesson is your business. For others, you
are always fallible. I do not tell you what the truth is in a vacuum, I show
you how to discover it within yourself. Once you know how to read yourself
you have no need to ask anyone else what you are and what you see, you
know. And you have no need to tell others what they are or believe.
Science supplanted the Church dogma of the Western world. Its first
adherents were rebels, just like early Christians. Once it became the rule,
the same dogmatic thought invaded it. Any non-standard idea is ridiculed
by orthodox “priests” of science. Gantebrink created a small robot which
discovered something new in the Great Pyramid at Giza, entirely outside the
standard scientific community.
Instead of lauding his ingenuity like the fathers of modern Western
discourse, the inheritors mocked and slandered him. They do this readily to
anyone who steals their thunder. The reason? Ill will? Not exactly. When an
idea becomes mainstream, modern business gets involved to make money.
With their thunder goes their money. They do not want to lose their
livelihood. Furthermore, their egos are invested heavily in their external
reputations. I make no qualms about this. A person rarely has anything
more than his or her word in this world. We spend much time trying
to defend and prove ours to be reliable. Nonetheless, it still hurts
to have people slander, libel, and attack me from a distance safe
from cross examination.
Yet that is part of the perfect life. You get to know all of the human
emotions fully, with no mixed perspectives. Your whole being is in concert
as one. Your joy is ecstasy, and your sorrow deep. In your heart you feel
them all, for that is the privilege of being human. The difference, with
self-mastery, is that you never lose clarity of purpose. Live with passion, for
without passion, you are dead.
Here we link another saying of oneness, of life:
“Where there are three gods, they are gods.
Where there are two or one, I am with him.”
Your senses are metaphors for Gods, for cosmic principles. The eyes
represent the principle of light, the enlightening principle. It shows things
in all of their naked glory. All of your senses are such. When they compete,
they are Gods, competing without balance.
When they are balanced as two, there is equilibrium, when they are one,
they are undifferentiated. Here are the three principles again. You have the
static, the One. Then there is the dynamic, several. Finally there is balance,
the two. When you are balanced, you have the unifying principle, or the
Eternal.
(31) Jesus said, “No prophet is accepted in his own village;
no physician heals those who know him.”
Wisdom of the Self-Master
This verse states simply that those who know a master before his maturity
never believe that the young boy who wore diapers could be this ancient
elder. To his childhood relations, he is always little Y’shua. A doctor cannot
heal those who he hurt as a kid. If there is doubt, one can never heal one’s
self, or hear the truth. The subject will disregard what is to be said or done
before it even occurs.
Just ask my friends from growing up, the ones I drank to excess with. They
say, “Aw, Gouthum? He’s just another punk like me.” Yet, don’t we all start
from cell division as embryos? Some claim that Buddha and Jesus were
divinely inspired by God, so that they do not use flesh. This common myth
threads its way throughout human history, oral and written.
But isn’t all flesh divinely inspired? Spirit before matter. Energy before
matter. Non-physical before physical, unmanifest before manifest.
Neuropsychologists have a new study out where they measure brainwaves
corresponded with thoughts. They find that the waves start BEFORE a
thought occurs to someone. Prior to even the thought of motivation, energy
amasses in the brain of the subjects.
Academic Knowledge Versus Wisdom
More importantly, if self-masters are any different than you, what good
is their wisdom? If they have not walked the road, what can they tell you
about it? All wisdom is hard earned, like yours, that is where its meaning
comes from. Self-masters have experienced what you have. That is why what
they say has value.
70 71
There is no such thing as “book learning,” if you cannot apply what you
have learned, you have learned nothing. If you cannot apply it, you may
UNDERSTAND, you certainly do not KNOW.
(32) Jesus said, “A city being built on a high mountain
and fortifed.”
These verses go well together. Simply, be, yourself, a city built atop a high
mesa and fortified. In ancient Israel there was a city named Masada. It was a
fortress fortified upon a hill. Although it could not hide, the Romans could
not tackle it with an Army. Eventually it surrendered. Politics aside, it did
not fall, whatever the method of its submission.
The master instructs his students to preach from the housetops, high places,
that which they hear from him. He exhorts them to share what he teaches,
not to “convert.” There are only to shout from the hills what they have
heard from a master. As a parallel, he likens them to lamps. No one hides
a light under a bushel, they set it upon a stand to be seen. People put the
lamp where others can share its light.
(34) Jesus said, “If a blind man leads a blind man,
they will both fall into a pit.”
The Blind Leading the Blind
Here we have the news of Jesus day, and ours for that matter. The blind are
those who are unenlightened. Thus, the unenlightened can only lead other
unenlightened people into a pit. A pit is darker than where you were before
you fell into it. Thus, these unenlightened teachers can only lead you into a
darker place.
Most teachers these days have partially applied their own teachings. How
can they teach about that which they know not? Few walk the road to know
its beginning and end. Most read about it from someone else who does
not know. Read translations of those who experience the truth. One way
to know these authors’ veracity, is through the logical infallibility of their
statements.
Another way, is that these statements are brief and concise. This is how their
truth is known. Universal truths are narrow enough to maintain consistency,
and only broad enough to have meaning. That the Earth revolves around
the sun is universal. No matter how far away you get from the Earth, it still
rotates around the sun; even if the whole solar system, by definition rotates
about the star.
After reading these statements and reordering all of the logic in your
brain, practice the truths. Always, review your thoughts, words, and deeds
against these statements. After consolidating your practice into your own
nature, return the heart. Question how you reel about your condition.
Any disciplined seeker can do anything. There is nothing he or she cannot
renounce.
But if you keep having the feeling for the renounced object, it is part of
you. Very simply, we breathe. If you truly are perfect, you do not need to
breathe anymore. You will transcend this physical plane. But if you hold
your breathe and when you pass out, your body starts to breathe again, you
are not done with this world. Very simply, you are here for a reason that you
have chosen in the annals of time. Until this is fulfilled, you will continue
rotating through corporeal existence.
The Emperor Has No Clothes
In the story of the emperor having no clothes, the authors generally censor
the true results. A group of merchants come to a rich emperor. This leader
has a desire for the best. His country, and himself mandate the best of all
things. These business persons know that this emperor has amassed great
wealth and they wish to make the greatest profit.
They sell him invisible clothes which cost them nothing. You see, the
clothes don’t exist. The hucksters tell him that only the most cultured will
be able to see the fabric. To shorten the story I will get to the climax. There
is a parade held in honor of the profiteers in which the new clothes are
donned by the vain leader. A little boy with no prejudices or preconceived
notions states emphatically that his emperor is naked!
Because he is a child, the pretentious believe that he is not refined enough to
see the garments. The audience laughs. Unfortunately for Jesus, he was not
a child. But this is how it must be. For the truth to be heard, it must come
from a source that is undeniable. Not that the source must be externally
“perfect,” but that it must undeniably exist.
When he speaks, the merchants chase him down, and state that he must
have stolen the perfect garments. The suit is lies. It is sold to the ignorant
throughout time. Masters reveal the cloak of lies behind which people
imagine their ugliness is covered. This job is dangerous and fulfilling.
The Return to Life
After the phase of minimization and renunciation, one has to reintegrate
with the world fully for several reasons. One, is that life is about living, and
you would not be here if life was not part of your visit to Earth. Another is
72 73
that every person has a raison d’être, or reason for being. Only your heart
can tell you this. Remember that the one thing you know beyond all doubt
is the one thing that you cannot prove externally: You exist.
Remove the bad habits of old, and then you will be able to see what you are.
Be that. Follow those who have sight, they will show you how to discover
your own eyes. Those who are enlightened seek no slaves. They want to
show you your own liberty and feel the joy of seeing themselves through
your newly opened eyes. The universe wants to know itself. Know yourself
and you become known.
(35) Jesus said, “It is not possible for anyone to enter the house of
a strong man and take it by force unless he binds his hands; then he
will (be able to) ransack his house.”
Your hands are your tools of action of giving and receiving. When someone
wishes to take what is yours they need to bind your hands. That is what liars
and thieves seek to do. They desire to take what is yours without paying.
The best thief exerts the minimum of force, thus, the best thieves are liars as
well.
They convince you with lies to put your hands in your pockets, preferably
behind your backs. Then they can steal not only all of what is yours, but
what is in your pockets as well. That which is visibly yours, and that which
is hidden in your pants as well. The robbers bond your hands with lies.
They convince you that you are incapable of defense, that your “hands are
bound.” You are a slave to their lies.
Liars and Thieves
Much organized religion teaches you that everything that is yours is God’s.
This is no leap for even the simplest of minds. They then convince you
that they are God’s designated representative here to collect what is his
for redistribution. Excuse me? God has already distributed, yet he needs a
physical organization of men to distribute his wealth again? No, God uses
the universal physical laws to distribute.
As a clarification here, helping other is not wrong. However, God does not
need you to do it. You can help others if that fills an internal need, just
know that you are doing it for yourself. Now, you can explain yourself as
part of God, and claim that you are acting in his name. But you one cannot
be sure of this unless he or she is already fully consistent internally and
externally, logic and action. The quickest way to render this consistency is
through living as an observer with minimal interactions. Yet those who have
done this are not likely to read this book.
Your residence is your body, and your only true possession is your energetic
soul. Even the matter from our body is borrowed from the Earth and one of
the 60,000,000,000 inhabitants of Earth who has had it before. So, the soul
is what these slavers wish to ransack. They do it by binding you with lies.
Then they live off of your soul energy.
(36) Jesus said, “Do not be concerned from morning until evening
and from evening until morning about what you will wear.”
As usual with masters, there are many layers to their statements. There is the
top layer, not to worry about material things. Do not be concerned with the
mundane. Answer the deep questions and all of the shallow become clear.
This sentence transitions us to the next level.
The deeper import is not to worry about how you will cover yourself.
Covering is a way of hiding what you are. That is one of the deeper
meanings of the Genesis myth. It states that knowledge of duality cause
the first people to try to lie, to hide their true forms. To lose themselves in
the animal natures, versus finding the balance of God and animal
that humans are.
Jesus makes clear that his students are not to worry about clothing
or hiding any part of themselves. He also uses the future tense,
to emphasize that what they are hiding with now can be considered,
but not used as future cover”
Open Your Eyes
Here the man from Galilee takes the metaphor further. His disciples are
asking about when THEY can see him. Though, they coin the questions in
terms of passive voice, “when will you become revealed.” The quick answer
is that he will be revealed IN THEIR EYES when they open them. Since
this is difficult, He makes it easier.
He tells them that when they lose their lies they will see him. When a so
called rebellious child is first clothed, he or she will fight them. They will be
clothed one minute, and the next they are running naked through the yard.
Why is this? Is it because the child is evil? Is it because it is born in sin?
Neither nor.
Clothing covers our own ill thoughts. There is nothing evil or ugly about
the human form, especially in childhood. Naked babies are beautiful, just
as they are born. Why do we clothe them? We have standards of morality
74 75
which teach shame for our children. Whether this is do to the lasciviousness
of adults can be debated.
Regardless, the child senses the dishonesty of clothing. Originally it was
only an extension of shelter. Tropical citizens were not immoral before the
arrival of invading Western Europeans. The men and women covered only
the necessary areas for health. No worries though, body consciousness has
been indoctrinated into everyone. This shame is now part and parcel of
existence on the majority of Earth.
When you lose the prejudices indoctrinated into you by society, you become
liberated. You discover the part of you that was stomped out of you as a
child. When you can drop this yoke of fakery you lose your fear. An easier
way to think of it may be that when you drop the fear of others and their
prejudices you lose your own. When you discard these vestigial ideas your
sight is cleared to see the living ones. Those that live in the now.
(38) Jesus said, “Many times have you desired to hear these words
which I am saying to you, and you have no one else to hear them
from. There will be days when you will look for me
and will not fnd me.”
The Master is in the Now, Live in the Present
Here the Hebrew master laments for his disciples. They have desired to hear
his truth forever. They have no other master to hear them from, yet they still
fail. These are the days when they look for him and cannot find him. All
the days the disciples live in the past or present, they fail to see their chosen
teacher.
It is sad to see these sons of God wait eternity to meet their own personal
master in the flesh. They try so hard with their minds to hear him. Yet only
he or she who has ears to hear can hear, or eyes to see can see. They listen
with their minds not their hearts. One who thinks his way through truth
will always miss it in the end.
The first part is about reasoning. Youth is about familiarization with the
senses of this plane of Earth. A parent’s job is to teach familiarization. Hot
and cold, pain and pleasure, growth and stagnation. Then the child is to
teach him or her self what they look like here by using these senses. You use
your minds to cognize what you are feeling.
Once you know your feelings in concert with your body and mind, you
listen to your soul. When the three are in concert you are one. Then you
ARE. These men listen to their master with their intellects. Then they forget
to drop the intellect and use the body-mind-intellect as one.
There is an ancient proverb that describes the intellect as a thorn in the
side. A seeker must use a thorn to remove this thorn and then discard both.
Seekers fall so much in love with the intellect that they identify themselves
with it. They fail to ditch the tool when they are done.
Imagine using a doctor to heal yourself. After the surgery you think that you
are the doctor. This is not unheard of with nurses. Soldiers returning from
battle often fall in love with the nurse, mistakenly identifying the healing
with the healer. Some have trouble with this idea.
They fail to drop the intellect. They intellectually realize, thinking
themselves into existence rather than knowing themselves. It is a shallow
life you have that you can only think your reality. You must think, feel, and
know it. That is perfection. Intellectual realization is a dead thing without
life. You would not have incorporated into a body if you did not want the
whole experience. You can be a disembodied soul floating around the planet
if you want that. It is a horror to understand, but not to know.
Truth is, you just have but to experience oneness to know immortality. Ask
while here in the body, then you will know. Ask what you want to know,
ask how to know. Self-masters can tell you how it feels, but only when they
show you, or you experience it on your own can you integrate it into your
everyday existence.
The Process of Perfection
Know this though, the first experience itself is grace, sometimes discovered
during making love, other times when painting a picture, composing a song,
or running a race. The real work begins when you try to maintain it in all
places and at all times. This is the marvelous work which occupies the rest
of your existence, the “process of perfection.” It lasts forever, for if it ended
or began it would not be immortal.
A friend of mine once took me to Missouri, USA. He wanted me to
experience his life. I got more and more frustrated as he took me from place
to place.
Eventually I hammered him, as I had been known to do. “What the hell are
we doing?” He said that I wanted him to tell me what was going on with
him in “The Show me State.” The motto of Missouri is that it is the “Show
me state.” His thought stuck with me. We can show you how it feels within,
we can give you the tools. You have to combine them to make your recipe.
The recipe is your perfect life, you are the chef, grocer, and diner. Make
your masterpiece.
.”
76 77
In ancient cultures the serpent is known for wisdom, and the dove for
innocence. It is no coincidence that the Church fathers chose the genesis
myth where the serpent is thought of as manipulative. Although there are
many metaphors for the serpent, we read it here to mean that the priest class
wants to keep people enslaved.
Four Types of Knowers
These so called masters are not enlightened, they are blind. They cannot
lead anyone anywhere except into a deeper pit. The Vedanta masters state
that there are four types of people:
❖ Those who know–learn from them
❖ Those who know that they don’t know–teach them
❖ Those who don’t know that they don’t know–pity them
❖ Those who don’t know but think that they know–run from them
The Pharisees and Scribes are number four, those who seek truth are
number two. Number fours can only cause number twos to get further
lost. They have hidden the keys of knowledge by censoring and limiting
what masters have said. You cannot censor the instructions which you don’t
understand. These fathers took out the stuff that they did not understand,
or as popes have admitted, they spoke of truths for the initiated and
different ones for the uninitiated.
Unfortunately the deep truths were not released until later, and not from
the church authority. Whether they were lost or not is immaterial. You are
here now with the ability to understand what the laymen of the last two
thousand years could not. Use your intellect to sift through all of the words.
Do not suffer from the ignorance of religious fathers that had no knowledge
of even bacteria, much less cancer, and radiation.
These religious slavers want you to be innocent as doves, but without the
wisdom of the serpent. A serpent never holds a grudge, though it does
bite when threatened. A dove just gets eaten. Organized priests want you
to support their church without knowing whether their paths lead to the
infinite. For they have not walked. Some have, watch them, by the feeling
you get, you will know if they are masters. Walking the path alone does not
make one a master. A master is one who understands the path, walks the
path, feels the path, knows the path.
Institutions seek to perpetuate themselves. Thus, where the organized
religion is, the truth is not. Most institutions care not about your soul, but
your body. As soon as we create a movement around a master or idea, we
have separated ourselves from truth. We begin to worship the movement or
master, we lose the ends, and follow the means.
(40) Jesus said, “A grapevine has been planted outside of the father,
but being unsound, it will be pulled up by its roots and destroyed.”
I Heard it Through the Grapevine
Parables of vineyards are common in texts of the children of Abraham.
Mormons also share a wonderful one in their book delivered by their
prophet, Joseph Smith. A vineyard has several fields, each one has its own
grape vine. When you want to change an entire crop, all you do is graft a
small branch, or stub, into one section of the vine. This small 6-8 inch stub
changes the entire flavor of the vine.
So when a vine goes bad, you often uproot the entire crop. This is disastrous
for the farmer, or vintner. For God it is harsh, nothing is utterly disastrous
when you have eternity to plan and execute. Here, the metaphor describes
those who are outside of the truth, or living in untruth, as unsound. Jesus
states that the entire of the lies of those who live in their dream worlds will
be uprooted and destroyed.
What does this mean? It means that anyone who lives in the past and
future, who is cloaked in their ideas about the world versus in the eternal
world, will be destroyed. This is the bad news, you, as you think of yourself
now, are doomed to die. You are the collection of your ideas about what the
world is. These ideas are a collection of your eternal unfinished business,
and that business you have executed in this lifetime.
These current actions will sometimes bear fruit in this life, and other times
they need to wait for another incarnation. Jesus states in other places that
if you follow his path that you will finish your account in one life, this one.
That aside, your skin suit, or animal skin as some call it, will fall into dust
as it dies this life. The true you, your eternal soul as it was created, will
continue. This is the good news.
Ah, the good news. That is the message of the masters. Depending upon
your perceptions, you will hear this news as good or bad. If you are ready
to seek the eternal, if you are done with the finite, it is moving news.
Miracles will not convince you to move forward. For these are physical
manifestations of eternal truth. If you seek physical magic, you are still
trapped in this world.
If you seek internal fulfillment from within, instead of without, you are
ready for the good news. Your eternal soul lives eternally and never dies. You
are living in the largest virtual reality construct you have ever created. You
think that you hurt, and that you experience joy. Yet all of your feelings are
tied to this realm, they stay here!
Your contact with the divine, uncensored and unadulterated truth
continues. It never disappears, though it may seem to fade. These
experiences push the path under your feet. They keep you moving from
78 79
the beginning to the end, and around again. In plain words, when you feel
something infinite that lasts forever, you have contacted the divine.
Some examples of this include the eyes of a child as it first looks into the
world. When you feel that gaze, you know that something lasts forever. That
feeling. When you experience the heights of sexual ecstasy, you KNOW that
divinity exists. It is sad that in misunderstanding the masters many feel that
sex is a hindrance rather than a help. It is the clearest physical manifestation
of polarity balancing. Sexual union shows the joining of male and female.
Some paths to perfection involve merging with the feeling of this moment
and examining it. They involve remembering this feeling and providing it to
one’s self energetically without a partner.
I do not mean only physical masturbation. I mean a richness of memory
such that in your deep mediation and contemplation, you revisit the
moment of union. Some get lost here, and become wandering zombies,
talking to themselves, and drooling. Others get obsessed with returning to
this moment through physical excess. Everything on this planet and plane is
for you to experience yourself in the physical plane.
You wanted to know what you were. So you created the physical world,
and condescended into it in an infinite variety of ways. This allowed “you”
to “forget” yourself, which in turn, allowed you to “remember” yourself.
Ignorance and knowledge are heads and tails of the same coin. Without
one you cannot have the other. To know one, you must to know the other.
This is the beauty of the bipolar world. Even more, this is the beauty of
disequilibrium, it allows you to feel equilibrium.
When it all becomes ONE in your experience, you do not lose conception
of the entire world of many forms. Instead, you no longer judge the forms
as separate and right or wrong. They become a wonderful kaleidoscope of
colors. Differences arising, only to merge again into a whole, back into a
million-million parts. Like colors of the rainbow, they merge into white
light without the prism. The being that is one sees both white light and its
components at all times.
(41) Jesus said, “Whoever has something in his hand
will receive more, and whoever has nothing will be deprived
of even the little he has.”
REAL and UNREAL
The text spends much time describing the REAL and UNREAL as
ancient sages describe the two polarities. There are some guidelines for the
truth or the infinite, for that which always is, the UNIVERSAL. Other
characteristics delineate the UNREAL. It is important to note that these
distinctions are only tools for Discrimination, or Viveka. It is not that
nothing exists, but that everything exists.
It is upon you to discover what it looks like where you are now. The first
step to distinguishing the reality from where you stand now, is to determine
where you stand. Before you can do that, you need to know what is. That
is what Discrimination is for, discover what is. Once you understand that,
then you can learn more.
UNREAL
❖ Birth
❖ Death
❖ Growth
❖ Disease
❖ Modification
❖ Transience
For example, anything transient is not real. If it changes, it is not eternal.
Something which is changing is really an aspect of something unchanging.
Ask most children about something that never changes, and they will
generally mention a mountain or a tree. As an adult, you know that this
is not factually correct. As an advanced adult, you may extrapolate this to
mean that everything changes.
This deduction produces fear in most when first discovered. I remember
at eight years old realizing that no one knew anything that did not have an
exception. This meant that their truly is no predictive accuracy. That there is
variation in everything. Even worse, I could not find a permanent landmark
with which to define things. “Where is here?,” I wondered. How can I define
what IS, when there is no reference point. Needless to say I was twenty-nine
when I had lived enough of my life to find formulate my understanding
of the principle of universal or unchanging truth. Consciousness is in
everything seen here and now. Thus the question reforms as, “Who am I
without respect to anyone or anything else?” This question will be answered
elsewhere.
What we can answer here, is that it is not that nothing exists, as people
sometimes misread Buddha. For, if nothing exists, who are you? If you say,
“I don’t exist,” who said it? Nothing will ever state, “I do not exist.” This is a
logical conundrum and an impossibility. As a human being you may lie and
say that you know that you do not exist. If this were true, you would not say
it, for who would you be talking to? The Mandukya Upanishad with Karika
describes this illogical argument perfectly. A prudent seeker can learn much
from its author, Gaudupada.
Now, if all we possess in our consciousness are transient ideas, untruths
and half-truths that cannot stand alone for eternity, we have nothing! If we
possess even one truth that is in transient, and timeless, we are eternal. By
this statement, our life purpose is clear: Find one truth.
80 81
This truth persists while all else decays.
(42) Jesus said, “Become passers-by.”
Passers-By, Observers of the Now
What are “passers-by” ? When you see passers by, they appear transient
to you. This appears fact, for you are trapped in your transient world of
imagination. You live in the UNREAL. They are actually the ones who are
REAL. Jesus is not dead, you are. He lives forever in the now. You live in
the past and the future. There is no past and no future for one who knows
what IS. When one finally becomes one with the eternal truths, he or she is
known by all.
Thus, the person who appears to be passing by to you is actually the
REAL. You are the one traveling upon your linear unreal path. You live
in your mind, not in your heart and soul. Become a so called passer by,
by becoming the observer of the infinite now. Be in the one place where
you are, and you are always. As long as you mentally live in your thoughts
about what is happening you are not experiencing what is happening, like a
mouse in some cruel psychological experiment. You will never know where
your cheese is, and you will never find it. You are thinking about where it is
instead of finding it. You will starve to death while you are thinking about
looking instead of looking.
.”
Love the Fruit, Love the Tree
The disciples still do not recognize the master. They ask him to again
explain himself in terms of something that they can understand. In
kindness, he reminds them of the contrast between their professed questions
and their actions. They ask who he is, when already he has told them and
they did not listen. When you do not listen to what someone has already
told you, how can that person explain with more words that you will fail to
hear? When you do not listen, how will you even hear the statement telling
you that you are not listening?
Even worse, Jesus explains, his so called true brothers treat him as the other
Jews do. They either love the tree, love Jesus, and hate its fruit, his words
and action. Or, they love his fruit, his words, and hate the tree, him. This
common reception is the experience of many masters. People not only hate
the light shining on their inconsistencies, they hate those that shine it even
more. These people are so identified with their inconsistent thoughts about
themselves that they think their only existence consists of these flawed rules.
When you destroy their fallacies, the people seek to destroy you. The
ignorant feel that you are the source of their pain, rather than their own
ignorance. Like the man who is fat. He hates the doctor who tells him he is
a glutton. He creates a support group explaining how he is not “fat,” that he
is different. That the word fat really does not mean anything. That there is
no such thing as fat or skinny.
Ask the glutton and he will say that this is not what he says. You see, fat
people are those that are fatter than him. And skinny people are those
that are skinnier than he. He may elaborate these arguments. You see, he is
actually different. Those other people who appear like him are actually fat,
THEY need to change their habits. Ask these others, they will say the same
thing that this fellow says.
So when self-masters tell people that they are living lies, this audience hates
them for speaking such hatred. Yet there is no hatred, masters have been
fat, they have been drunken on their own lies. They have been addicted to
rationalizations. Whatever you are capable of they are capable of more, both
better and worse. This last statement alone is enough for some to hate you.
Some will hate you because you can do more. Others will hate you because
you choose to do more within their same world. For if you are the same as
them, they have no excuse for their weak performance and lack of character.
This last statement brings us to the next idea. Some will love what you say
and hate you. They believe that your words are true, but you are not. When
you are true, and they are not, you again shatter personal illusions. You
cannot be living your philosophy that you believe and they do to, because
again, they have no reason for their failures then.
So, they may love you, for you make them feel divine in your presence.
They feel the peace within you. You are the mustard tree which has sprouted
from the small seed of truth within. In this instance they hate your words,
for they produce such a contrast with their experience of you. They want to
bask in your glory instead of finding their own.
The others, want to find their own glory while denying yours. They sense
the truth of your words, the unflinching courage of your words and logic.
The unflagging way in which you can destroy illusions. They hate your
success in contrast with your failures. It is easier for them to believe
that you cannot live the truth either. Instead of seeking inconsistencies
within themselves, they will try, using unenlightened eyes, to invent ones
within you.
82 83
(44) Jesus said, “Whoever blasphemes against the father will be
forgiven, and whoever blasphemes against the son will be forgiven,
but whoever blasphemes against the holy spirit will not be forgiven
either on earth or in heaven.”
The Unforgivable Sin Against Truth
The verse above seems strange to rule oriented egos. How can one be
forgiven for blaspheming against the father and son, but not the holy spirit?
Try this in a fundamentalist sect where women are taught to serve their
husbands before themselves and sexuality is considered a sin to be hidden.
Where modesty is prized over truth but not over lies.
These are places where you are supposed to modest with respect to the
perfect body God created, but not with the imperfect mind you have made.
Sects where you can speak endlessly about your purity, but cannot be
trusted to see nudity because you really have impure thoughts by your own
definition. The truly pure in thought, word and deed, has no need for all
of these external laws. He or she experiences consistency in all things. This
person is ONE.
Anyone with dedication can find endless examples of this hypocrisy.
Hypocrites blaspheme endlessly about the so-called father, the universal, the
God, the Creator. They drone about the son, about man and woman, and
children. These can be forgiven. But when they speak lies about universal
truth, this is never forgotten. These actions enter the cosmic bank account
and must be paid. There is almost no way to repent your way out of steering
others away from oneness. No way to surrender your burden for enslaving
others with your lies about the truth.
(45) Jesus said, “Grapes are not harvested from thorns, nor are fgs.”
What Is in Your Heart Colors All that You Produce
Using the farm imagery again, Jesus explains where you will find good
things. Truth does not come from lies, darkness not from light, nor light
from darkness. From ill intent comes ill will. From ill will you find ill
results. One cannot do the right thing for the wrong reasons. If you intend
to do the wrong thing and fail, you are not doing the right thing. Your
intent forever colors your actions, the intent of your heart; what you really
feel, not what you believe.
Therefore, a man who has good things in his heart brings forth good things.
The man with ill intent brings forth ill. The feelings you savor in your heart
all of your days accumulate, that is what you radiate. No matter how much
you talk about purity and abstinence from evil, if you covet all physical
pleasures in your heart, you will be sharing ill.
Your energy radiates that which you feel deep in your soul. Compare this
idea with verbal and nonverbal cues. When a child lies, his body often tells
you. Children voice no, while nodding yes, or voice yes while nodding no.
Try to do it yourself, nod the opposite answer to your statement. Hopefully
it will be difficult for you. If not, you lie more than you believe you do.
A note is important here. I make no claims that lack of physical pleasure
makes you pure. There is nothing noble about being cold, tired, and
hungry, ask any soldier in the wintertime. Nobility is doing what is right
your heart. Courage is following your convictions knowing that you have
only the long-run to live with yourself. Self-punishment and self-denial are
only punishment and denial without the proper methodology. Do not fall
in love with denial because you cannot manage to live with abundance.
If you cannot enjoy the world, do not call it evil. It is only the world, you
are the one who has problems navigating it. Do the work inside, and the
outside magically transforms. More accurately, when you transform your
inner awareness, your outer awareness follows.
.”
Surpass Even those You Deem the Greatest
John the Baptist initiated Jesus into the old ways of the Hebrews. He was a
master of the battles of this plane. Yet, for John there was always good and
evil, he had his prejudices. Although John outshined any before, and most
afterwards, he has his limitations. He may have changed afterwards, that is
outside the purview of this verse.
What falls under the purview, is the idea that one can surpass the greatest
man, yet,, in Jesus’ tradition. All that one has to do is to become like a
little child, without prejudices. Open minded and without judgment,
while simultaneously knowing, without the child’s ignorance. This last part
shows why Jesus, always uses simile instead of metaphor when speaking of
children. He says, “LIKE” children. He does not say to become children.
84 85
.”
One Can Only Serve One Master
This verse is talking about the trap of duality. Much of my discourse focuses
on the irony of this universe -the idea that life comes from duality, from
polarity. On the convergence zones is where you always find life. That is also
the source of our pain, this idea that we swing from one pole to the next.
How we constantly seek to choose one side over another. How our illogic is
the source of all of our pain.
If two horses are pointed in opposite directions, how can we mount both?
When two masters seek divergent goals, how is one to serve them both?
When you try to put the old into the new, you spoil both. When you
try to put new into old, you are again left with a rotten core. The key to
comprehending a master is to illuminate their words.
True scholarship consists of finding one who knows and learning from
them. Each tool has its purpose. Please do not seek to learn how to make
money from me. Although what I teach will make you better in all things,
it only sees results in the long run. The longest run. The challenge is how to
live everyday as if it were your last, but never at the expense of the past or
future.
So, you may learn how to make yourself consistent from a self-master.
You learn how to be true, or more accurately, to be TRUTH, to exist in
the eternal now. To always know what it is you feel. To never experience
anything halfheartedly again, learn how to understand, know, and feel. If
you want to make a table, go to a master craftsman. If none are available,
use the tools other masters have shown you to make yourself into one.
Become master craftsmen.
Futility of Argument
When one finds the master, he or she commences to learning. The way to
learn is to try to prove what the master says. You are not there to disprove
the master, for you do not know what the master does. This does not mean
that you discard logic or critical reasoning, it means that you are not here to
argue with one who knows what you do not.
One could sit and argue ad infinitum, ad nauseum with anyone who does
not know the truth. But one wastes precious time doing that. If you know
something, great, share it. You cannot prove what someone knows to be true
wrong, for he or she knows. Take an example. I smack you across the face
smartly and loudly. Do you think that I can convince you that it did not
hurt?
Do not answer so quickly, I can logically prove anything by changing the
time scale of the perspective. I can prove it did not hurt you. You doubt
me? Okay. Your blood, cells, brain, and body are constantly changing? Yes,
you are in a state of dynamism? So the person who I smacked is no more.
Neither am I the same anymore. Hence, “I” did not hurt, “you.”
So what does this example “prove?” It illustrates the futility of arguing with
someone who knows what you do not. You know that it hurt, you feel it
in your heart. No amount of mental hocus pocus can fool your heart. One
can even pay any number of people to fabricate testimony and videos that
you did not get smacked. Are you going to go to the mental hospital to
take medications until your heart believes what your mind tries to convince
you of, namely that you were not hit? Of course not. Like the martyrs of
Eternity, you know what you know.
(48) Jesus said, “If two make peace with each other
in this one house, they will say to the mountain, ‘Move Away,’
and it will move away.”
Here again, the master talks about polarities being balanced in the body.
Your body is the current home for your spirit in which you are divided.
Not only are your masculine and feminine polarities out of balance, but
your spirit and ego fight for control of it. Although your spirit speaks more
quietly, it carries a larger stick than your ego. It continues, while your ego,
or current created personality does not.
It is appropriate to delineate more of the model of existence in use here.
Your soul is the energy which binds your matter together. Once in the body,
you create a personality based upon your past experiences and current script
for life. This personality allows you to engage in the types of activities you
wish while still clearing out your cosmic balance.
This “personality” takes upon itself the immortality of the soul. It thinks
that it is “you.” Although this identification often assists you early in a life,
it becomes a hindrance when you are ready to emerge from your chrysalis.
When you are ready to realize your soul in a physical realm, this ego which
protected your body does everything in its power to maintain its identity. It
fears its death. This is the person you imagine is yourself.
86 87
Your soul never fears death for it is eternal. The way to discover your soul
is to minimize your identification with this human body and ego as “you.”
Here the schools of perfection diverge. Some say that the body is not you at
all. Others say that this whole existence is your dream and that you need to
disavow any relationship with the body to awaken.
Body Reflects Soul-Inconsistencies and Illness
Rather than descend into the melee of religious battles, the key points are all
that matter herein. Your body is a reflection of your soul. Its imperfections
reflect inconsistencies within yourself. So when you are sick or out of
balance mentally, spiritually and physically, there are several tracks to full
health.
Let’s say you have boils. This generally represents repressed anger. You can
change your diet based on ancient wisdom, Ayurveda for example. This
involves food, breathing, herbs, and possibly physical hatha yoga. You may
also use essential oils. These will lower your physical manifestations. As your
skin clears up, you may think yourself healed.
If the boils never return, even though you are able to return to your old
lifestyle, you have already made the internal changes necessary. In fact, the
boils themselves were a symptom of past ills. Let me explain further. When
you are born, you have seven key nerve plexuses throughout your body. You
will know these as “chakras,” they have different names depending on your
school of thought. These centers correspond to seven key endocrine glands.
When you are born, your energy level is lower, it takes time to fully mesh
with the human form. Thus, children are rarely fully capable of manifesting
their true selves. This explains why children are generally different than
adults. There are exceptions. For example, some children are born with full
heads of hair, and some even cross puberty long before reaching the teen
years. Yet most things that do not follow the average are called “disorders.”
Although, those things that better allow you to hit the mean, extended
patience, or let’s say a dull wit, are not diagnosed. For example, when
a child has a dull wit, but follows orders extremely well, he or she is an
“exceptionally good kid.” If your intelligence allows you to perform better
than expected at any given age, in an area society appreciates, you are a
prodigy.
There are many children stigmatized with this odd standard of assessment.
Take the child who is really creative as a toddler, he or she tells wonderful
stories about the imaginary companions created. When they are in their
teens talking about imaginary friends, they are aberrant. When they use this
imagination and tell stories past a certain age, the children are liars.
Teach Your Children Well
It is not prudent to drop of all standards of behavior or comparison.
However, it is wisdom to utilize somewhat more flexible and fluid dialogues
or categorizations. We must be careful using absolutes to illustrate standards
of right or wrong to children. These types of statements inevitably lead to
self-contradictions and illness.
Their moral code must be able to adapt to the situation. Tell children that
stealing leads to unintended consequences, and give examples. Explain that
they must be ready for these types of occurrences if they steal. For example,
if you take mommy’s money out of her purse, she may not have the money
to pay rent. Then you, Little Johnny may not have a place to live. You
may be out on the street. We can give explanations and show them, while
also allowing them the chances to learn on their own in semi-controlled
environments.
These are some keys to parenting, explain the concepts that you have
learned on this plane. Share your understanding that theft on this planet
is taking without asking. That way, your children know what it is they are
doing. It is surprising how well children understand when we speak to them
instead of at them. This does not mean that all kids will understand. Some
eventually needed harsher discipline, and some easier. The discipline adapts
to the listener.
Back to health. When you minimize the internal inconsistencies, perfect
health results. You can command the truth when you are a master of
yourself. This is what Jesus is saying. When you are not divided, your soul
energy manifests directly into the universe. Though there ere are some
caveats to emphasize. When you follow this “spiritual-psycho-physical
path,” you are less likely to ask things out of concert with your soul and the
environment around you. This ensures that when you tell a mountain to
move it moves. The master is trying to show an extravagant example of the
power you command as the creator of your own perspective.
Action, Inaction and Balance
You are not likely to abuse your privileges when you are in balance.
The balanced individual does not act in such a way so as to accrue
cosmic accounts balance. This is due to the fact that he or she renounces
everything, only to renounce renunciation itself in the end in order to
reintegrate back into society. Here we enter the concepts of “action,”
“inaction,” and “unaction.”
The first is what we are familiar with, we encounter a situation, evaluate
it based upon our past experiences. Then we act along the most likely
probability for success. We see a knife on the floor. The service person
remembers his or her parents stating never to leave a knife on the floor. This
child was strictly disciplined in order to learn this lesson. The next type of
88 89
person remembers that someone could step on it, and he or she picks it up.
This generally works towards the preservation and balance of life in his or
her experience. This is the warrior’s mentality, the lover of self-sacrifice.
A business person, will act differently. He would remember that he could
get hurt, and that he profits by picking it up. He “earns” safety, by his
investment in energy. The service person will walk right by unless they
are told to pick it up. All are examples of action. This person actually uses
inaction unless told to pick it up.
Finally the philosopher knows that a knife does not belong upon the
ground, this person retrieves the blade because it is right. This is only
unaction though if it is not contemplated. If the philosopher has to think
about consequences and morals, he is really just another businessman or
warrior. But if he is walking, not thinking of anything, and his nature
automatically picks up the blade, he has not “acted.”
Hence, if you know yourself through and through, you do not need to
“act” as anyone or anything, you are what you are. You automatically know
what you would do in any given situation, you do not need to think. Your
thoughts generally revolve around several things, your senses, and a time
scale of past or future. You are always evaluating what you have just seen, or
what you may imagine you will see based on what you think that you just
saw, or experienced.
Know What You Are
When you know what you are, you do not need to think about what you
see or experience. You do not need to ask yourself if you saw a beautiful
woman, or man, you know, for you know exactly what you classify as
beautiful, and that your eyes have already seen it. This is all automatic. So
you have no need to “think” about anything. Everything becomes natural.
This is unaction at its purest. You gather no karmic debt, for you are fully
following your innate nature. This is the goal for all, to know ourselves
truly. We are here in this Age to learn how to do this. All masters show you
an aspect of the process of self knowledge. Once you know yourself, the
world is your co-creation and fulfillment. The fun part of this is that you
must come to these things on your own. No one can prove to you that you
live out of balance.
(49) Jesus said, “Blessed are the solitary and elect, for you will fnd
the kingdom. For you are from it, and to it you will return.”
The Elect
Masters seek the elect to deliver the message to, while the elect seek this
guidance. These are those who are willing to take inner guidance to stand
for what they are regardless of external circumstance. They seek to rediscover
their liberty. They stand alone without peer, and without limitation. They
find the kingdom, for they have the largest egos, which they use to self-
destruct rather than dominate.
Some clarity here is in order. Those with the largest egos have the ability
to walk off of the common path of sheep, of the mob mind. They have
potential for great nobility and depravity. When they are willing to use this
ego to consume itself, they become the solitary who stand alone as one.
How is this possible? By being what they ARE deep within, they fulfill their
niche in the universe. They become one with the universal flow of energy.
Some call this the background radiation, others call it God. It does not
matter what you call it.
The kingdom of God is the source energy of which we are all an inseparable
part of. Our energy is always a part of it, though many are currently
ignorant of this fact. Yet, when we stand apart from your historical
behaviors, we see them as the trend that they are. When we stand apart from
social constructs, we see the overall pattern of our existence. The global
pattern that includes everyone and everything is the kingdom.
.’”
A Movement and a Rest
When people ask where you are from, you usually answer, “Albuquerque,”
or some place upon the Earth. When people ask you who you are,
you commonly answer in terms of some group. I am an Indian, I am a
Christian, I am Jew. Jesus says to answer in a more inclusive way, though it
seems exclusive. He says to tell others that you come from the light.
He is specifically speaking to seekers at this point. Those who seek their
infinite and eternal origins, those who need to discover their unchanging
natures so as to find eternal bliss. The light that came into being of its own
accord can be thought of as the “Big Bang,” God, or the cosmic fire of
God. Use whatever term you want. What it signifies, is the beginning of the
manifest universe.
When you have no eyes, does that mean that the universe is not there? What
about ears, nose, or mouth? In fact, what about no senses at all? Of course,
the universe exists even without your objective external senses. Without
objects, do your senses exist? Most would answer yes. So, your senses exist
90 91
before the manifest universe of objects. That is where masters state you can
claim your descendants from.
The light which is self manifesting, is the light of the universe. Think of this
as the enlightening principle discussed elsewhere. This conceptual principle
is what precedes the physical. The universe manifested itself on its own out
of itself. This is the process of self-substantiation. When you have merged
with your own divine origins by listening to your own vibration, you are
able to see the reflection of everything else within you.
Thus, by knowing one’s self, you know your origins. When you answer
others who ask, you are to say that you are offspring of the divine, the
infinite, therefore, you are infinite as well. The ignorant will ask you how to
know the sign of this awareness within yourself, you are to say that the sign
is “movement and repose.”
Your Niche
When you are aware of your place in the universe, your own unique place,
you behave in a certain manner. You are an absolutely necessary component
of existence. You matter. Without you, the universe would not be what it is,
and it can neither create nor destroy you. You are part of it, integral. As far
as you are concerned, when you are gone the universe is gone, for with you
goes your conception of it. What you know as the universe ceases when you
cease. Hence, you never cease, and neither does the universe.
So what does this movement and repose look like. Remember the states
of movement again, the gunas, or qualities. These are inertia, change, and
equilibrium. In plain language these are the steady state, the state of change,
and balance. When a system is constant, it is in a steady state, a train at a
steady speed, its movement is imperceptible to the passengers. In fact, it
cannot be proven whether the train moves or the rails. It all depends on
perspective, which obviously changes. From the universal perspective, either
everything moves relative to each other, or nothing does, take your pick.
NOTE: Example of relative movement and Earth.
Why don’t we fly to one side or to the other side of the planet. A plane has
to fly around the planet. The air moves with the atmosphere.
When a system is in a state of change, you perceive the movement. This
is when something is changing its rate of motion relative to something
else. Imagine the train as it accelerates. You can feel this change. When a
system is in a state of balance, you have ordered movement. Think of the
point directly between when a clock pendulum is switching directions. It
neither moves, nor is it static. Movement and a repose feels like being that
pendulum. You have not stopped, yet you do not seem to be in motion.
A material example is the man of inaction mentioned before. It is the
person who exerts no excess energy in motion. The relaxed Tai Chi Chuan
practitioner, the cowboy who is one with his horse. The woman who swims
and glides with the water. When all of these lose their minds in their BE-
ing, they are a movement and a repose. Those who are merged with their
niche in the universe, or their divine, remain in this state of firm relaxation.
When you feel a master, this is the feeling you have, that of relaxed power.
Potential energy that is not stagnant, but flowing. It feels like a steady
current of power, throbbing, vibrating, and resonating.
(51) His disciples said to him, “When will the repose of the dead
come about, and when will the new world come?”
He said to them, “What you look forward to has already come,
but you do not recognize it.”
See The Eternal Right Front of You
Yet again, the disciples ask for a future occurrence from the man who lives
in the now. They ask when will the dead rest and the eternal life come?
Their master tells them that the dead are at rest whenever there is a living
master present. That in Jesus the dead are at rest, and the new world is.
How can this be? The world is always the world, and it is always in
existence. Only those trapped in the time loop of present and future miss it.
All that it takes for the dead to receive rest, and for those alive to live, is one
who recognizes life. If the universe is really all one Absolute, if truth is this
infinite, then, all that must occur is for one part of it to know itself. Then
the rest knows it as well. Think of it like the brain and the body. The brain
is aware of the body’s existence; sometimes it takes a little while for the feet
to get the message though.
So when you wish to know what the cosmic mind is telling you, wait and
have patience. Dull the drone of your cells competing for your attention,
and try to hear the messages of the “brain.” If the foot seeks outside to see
what the brain is telling it, it will never know what it is being told. But if it
quiets the cells it is in charge of, it will know its role as the conveyor of the
body.
Remember that if you listen to the foot cells as to where to go, you will
drown. For once you hit a beach, the sand is soft. The cells of the sole
will keep you walking deeper and deeper into the soft sand. These cells
are ignorant of the rest of the body, especially the lungs and their oxygen
exchanging ability. While the feet walk out to sea, the body submerges
into the water and you die. Quiet your basal cells and listen to your higher
functioning ones. Listen to the masters and find the truth within. Worst
case scenario: you are better off because now you have eliminated a whole
branch of inquiry. Best case scenario: you know immortality.
92 93
(52) His disciples said to him, “Twenty-four prophets spoke in
Israel, and all of them spoke in you.”
He said to them, “You have omitted the one living in your presence
and have spoken (only) of the dead.”
Here the master is again questioned in terms of a past which is gone. His
greatest followers ask whether the past testifies of the present. They need not
ask him to prove his existence based upon the past. His greatest proof is his
presence, he is present. All they have is but to experience the now. No proof,
based upon what does not exist, is going to prove what does exist. Though,
there are times, when historical analysis is useful for familiarization with
your own internal compass of truth and of falsehood.
Once you know how to read your internal direction, you have but to
experience the world and observe where your compass points. Do you
remember a time when you discovered your best friend was lying, or when
anyone close to you was lying to you? Do you remember that palpable
sensation, the sinking in your stomach? That dry mouth and utter loss of
faith? Whenever you speak to someone and get this feeling, someone is lying
to you or about you. Use these cues. Use these senses properly and they will
guide you at least as well as your intellect.
Use your present to build your presence. Once you are here, you will know.
(53) His disciples said to him, “Is circumcision benefcial or not?”
He said to them, “If it were benefcial, their father would
beget them already circumcised from their mother. Rather, the true
circumcision in spirit has become completely proftable.”
God and Technology
Historically many of the rules in the Old Testament, and other codified
religious books, are found to be scientifically based. Common rules are
those on cleanliness. Does this prove that the rules came from divine origin?
Not necessarily. Remember that we all come from the same universal energy
source, whatever you call it. This represents the divine.
The universal infinite does not change, though the finite mind that
conceives of it does. Try to explain to a shepherd of 2,000 years ago that
bacteria and viruses cause the majority of human illness. Try to explain that
rules of cleanliness, purity, and mating are designed to protect you from
these things. Instead, the wisdom of a forgotten age has traveled down by
word of mouth. When the natives could not understand what was being
disseminated, they created rules.
Although these so called laws have served us in their time, there is a new
law coming. It is the law of the SELF within. If you do not know what is
right in your heart, no amount of legislation will teach you. Those who can
chart their own progress and course are the elect. This law is not technically
new, though it is being manifested in our time as NEW. Old scriptures like
the Upanishads were written in poetic formed and metered. These formulas
allowed ancient man to memorize them without knowing their entire
import.
When they are changed, their meters fail, the formula is broken. You
will see this security, or compression algorithm in many of the world’s
ancient scriptures. This way, the stories were preserved for us now, when
we can understand their deeper meanings. This is not to say that the elect
misunderstood them in the annals of time, it is to say that lay people can
enlighten there meanings now with study and practice. They cannot do
so though, when the texts are abridged by well meaning, or ill meaning
religious authorities. This is what has happened to the majority of subjective
scientific knowledge.
Catholic Pope’s are on record as saying that they censor the truth from the
“uninitiated.” Mohammed told his people to only write down the Koran.
They created a whole religion out of Hadidth against his teachings. The
businessmen always make a business out of the words of the master. They
have little faith in themselves and humanity. Thus, they make laws, rules,
and money on the backs of the ignorant masses.
(54) Jesus said, “Blessed are the poor, for yours
is the kingdom of heaven.”
This statement speaks directly to the people of Jesus time as well as us now.
It speaks of those who fail in this world. Failure in this world illustrates the
futility of chasing the finite without the possession of the infinite. Without
yourself, no amount of money will fulfill your emptiness. Object after object
may be “owned” for a time, but if it was once not yours, it will once again
go to someone or something else. In reality the only thing that you possess
that cannot be taken away is you. Your own thoughts and ideas, your own
consciousness and awareness.
Ask even the richest man. Gold investments may fall, they can be stolen.
Governments rise and fall, there is no guarantee that you will keep what
you have fought so hard to buy. Inflation destroys bank accounts, regimes
take your worthless paper deeds through land redistribution. Ownership
is a human convention first and foremost, based on changing human
agreements. No matter how hard you and high you build a wall protecting
your possessions, flesh will overcome the dead bricks comprising it.
Life Always Triumphs over Stagnation and Death
People will pile body on top of body to climb your security fence. You
cannot escape anywhere. Running away did not work in the suburbs, and it
94 95
will not work in nations. Life always overcomes death. New will regenerate
and wipe away the old. Ask the dinosaurs. Maybe they ate themselves out of
the environment. It is possible that they overburdened the environment to
such a stage that nothing could regenerate except the smaller mammals. Are
we now the dinosaurs?
Yet Jesus is speaking of those poor in ego. Those who have little invested in
the trappings of any given society. They have little to gain from institutions
structured to enslave them. Thus they are ripe for the kingdom of heaven.
There kingdom is the now, the possession of those who live in the present.
(55) Jesus said, “Whoever does not hate his father
and his mother cannot become a disciple to me.
And whoever does not hate his brothers and sisters
and take up his cross in my way will not be worthy of me.”
Free Yourself from Your Past
This verse scares many a politician and religious leader. It undermines much
upon which society is based upon. Here the master highlights a necessary
component for throwing off the chains of oppression of self. Your parents
tell you how bad you are from the day you are born. They are forever
“correcting” you, training you to live in their societies. They tell you how
what you do is wrong. Do not run naked, do not laugh at the dinner table.
Always say nice things to people.
However useful these admonitions are when you are growing, they become
hindrances as you reach for spiritual maturity. God does not need children
anymore, or spiritual adolescents. We must learn to govern ourselves
without referring to some vengeful outside authority. The universe does not
“punish” people for trying to break cosmic law. If you swing the energetic
balance in one direction, the universe swings it back. Without enmity, or
even a thought. If you mismanage your planet, your civilization dies. It
offers no second chances, or mercies. It is what it is.
Somewhere underneath your parent’s philosophies lies you. You are under
some admonition somewhere. You must break from these rigid dogmas.
You cannot hold any relation more sacred than your own relationship with
yourself. At the end of the day, you are all that is left with you. You are in
your every waking moment. Even the most advanced of human leaders has
a tentative understanding of himself or herself, at best. Even they define
themselves in terms of outward actions.
A simple example is a politician who spends his or her entire life working
in legislation. Politicians are defined by their work managing others. What
happens when they no longer hold office? This person cannot define self
by action and results anymore. Take the wayward pastor. He spends his life
assisting others only to suddenly go blind. He cannot even study or teach in
his old way as he has gout too. If he knows not himself, he has nothing.
He needs the cross of the masters. This burden is not the wooden cross of
Calvary, but the uniting of divine from above, or eternal progression, with
linear time along the horizontal plane. The vertical line unites the divine
from above with linear time along the horizontal beam.
The crux of the two progressions is the domain of the master. A master
lives forever in the eternal present by intersecting the past and future of the
laymen. We are all fledgling masters though! Slave mentality forever divides
humanity. “My divine savior is separate and greater than me.” Rather than,
“My enlightened master is further along the path than I.” Feel the difference
in your heart. Say it out loud and too yourself:
“I am younger than my master…I am earlier on my path than the master is
on his or hers…I approach perfection.” Now believe it is true. As long as
you measure yourself against the standard of your brothers and sisters, or
mothers and fathers, you will remain trapped. Use the tools as they were
given to you to surmount obstacles. Use them to remove your ignorance of
your perfect and divine nature. You can be trusted. Because you learn, you
will get what you seek. It is not anyone else’s role to make you do anything.
That is your role. Drive your success, and carry the cross of eternity. Keep
your attention focused upon it always.
(56) Jesus said, “Whoever has come to understand the world
has found (only) a corpse, and whoever has found a corpse
is superior to the world.”
Know the Material World to Be Finite
The outside world is that of the dead and dying. It is comprised of dead
matter, that which you cannot truly possess, only borrow. Even food is
borrowed. You eat it in the morning, and eliminate it by the evening-
hopefully. The 70,000,000 cells comprising your physical body are even
replaced in total every seven years! What you think of as yourself physically
changes constantly. What you think of as you in this world is dead and
replaceable.
When you discover that all that you have chased is dead and dying, when
you discover a corpse in the materially minded world, then you have
transcended it. Discover what you are and be that. Find your master and
follow his or her methodology. Then find your master within, do not settle
for another “object” that can be taken away. Do not worship the master,
worship the truth by living it.
96 97
.”
Separate the Wheat from the Chaff field, find your true spirit
amongst the weeds.
(58) Jesus said, “Blessed is the man who has suffered and found
life.”
This verse has been as misinterpreted as much as any other, though it speaks
personally to me. When I first began the path full-time, difficult tasks easy for me, the easy tasks became difficult.
I had no idea how to enjoy, how to have fun. Everything was bloody horror
for me, fire.
(59) Jesus said, “Take heed of the living one while you are alive, lest
you die and seek to see him and be unable to do so.”
Learn from the Master Before You
or Within You
The master seeks to warn his students of the urgency of his message. He has
all the time in the universe, you do not. When a master is alive and in your
presence, you can sense his movement and repose, you can learn directly
from your heart feeling his peace. This direct experience allows you to
accelerate your growth. Once a seeker becomes aware of this feeling, he or
she naturally spends life trying to recreate it from within.
But when you can no longer find your master in physical presence, it
becomes much more difficult. Notice how the disciples always ask their
own master about the past and the future, even in his presence they have
difficulty seeing what is right in front of them. Imagine how difficult it is
after they have moved on to a different time and space. Yet if you cannot
find a master, use the tools you find and create on your journey to become
one. Everything you need is within you where it has always been and always
will be. It lies upon us to discover it.
.”
Shepherds Feasting Upon their Flocks
This metaphor compares your soul to that of a lamb. The leaders of the
disciples’ day slaughtered their flock. They were to lead the people to higher
enlightenment, instead they ate them, living off of others’ sweat and labors.
Not much different than now.
Your soul does not fully inhabit this body upon birth. And unless you
realize your infinite true soul within, you never fully live in this now. You
are just a tenant passing through, a transient personality borrowing this
physical matter. What you think of as you, or the personality ego you have
created as you to inhabit this body, will die and be eaten. That is its sadness
and constant fear. For you to live forever, you must find “repose.”
What is this repose about? It is about you fully functioning in this NOW.
When you are fully present, you are the observer of life, for you are
completely here. Your attention no longer focuses on the past and future.
This produces deep calm. It produces, the movement and repose spoken of
earlier. When you live this knowledge completely, you will not die and be
eaten, for you no longer identify yourself with this ego based personality.
98 99
You become your eternal self, the self which never dies, that part of you that
always knows of its existence.
flled with light, but if he is divided, he will be
flled with darkness.”
Unity
Here He refers to division again. This time a woman asks Jesus. The two
resting on the bed are the soul and the ego. The ego dies, and the soul lives.
Salome asks him, who he is to lie upon her couch, and eat at her table.
He answers unequivocally that he “exists from the undivided.” This
phrasing means that his being comes from the undivided source. This place
is the Father of all, the undivided source energy of the universe. This is the
energy upon which all of the manifested universe is based. The master is
given some of the “things of [this] father.”
What things was he given? Life itself of course, as well as the wisdom that is
the divine inheritance of awareness, or true consciousness. This wisdom is
the knowledge that never dies, true self-awareness. Not awareness of the ego
personality, but of the true source of your physically manifested body.
Salome recognizes this truth, and she states her discipleship to “it.” To this
the master states that the ego that is destroyed enables the soul to be filled
with light. When the ego and the true self are divided, the incarnation dies.
And with it your present chance to live in knowledge. Without knowledge
of an infinite truth, time-conditioned truth dissolves into the finitude of
time. You die.
(62) Jesus said, “It is to those who are worthy of my mysteries that
I tell my mysteries. Do not let your left (hand) know what your
right (hand) is doing.”
The Left and Right Hands
This qualification spoken by the master refers to deep truths. A master
decides whom is worthy of his truth and administers accordingly.
Everything that you understand is conditioned by time and space. It only
exists as a function of this reality. Thus by definition, it dies with this body
and its corresponding personality. This personality will do everything it can
to resist learning the truth before its time is up too. It wants to live forever
even though it cannot conceive of a timeless existence. How can a finite
mind consist of an infinite concept? It cannot. Your ego based personality
gains its desire for the infinite source from your soul. This soul is timeless.
Fortunately, your ego, with all of its flaws is temporary.
This temporary cloak you call yourself is the left hand in this verse.
The right hand represents the soul. The master explains here that one
who wishes to realize perfection in the human body, must keep the ego
unaware of this desire. Early on the path, one goes through a phase of ego
destruction. This phase represents the thorn being used to remove a thorn,
and the discarding of both. There are several paths to realization of the true
self. Your soul is an infinite link in the chain of God. It is an indispensable
part of the universe without which neither can exist. In fact, your soul never
has any doubt about this, as it is created perfect. It manifests, “imperfectly”
in a physical body, for you think that you are ONLY this body.
“Creation”
Creation is in quotes, because an infinite being can never create anything.
IT always IS. “Whoa!?,” you say? When your thoughts are in a constant
state of fulfillment, how can you ever create anything. As soon as you think
of it, it is so. Furthermore, how could you ever do anything to get anything
else? You get what it is that you conceive of instantaneously. Thus, the
universe IS, as it IS. It was NEVER created to get anything else. It is the
cause, the underlying principle, and the effect, the manifested universe. This
leads us to the causality debate.
Causality
Cause and effect are not truly separated. This is an artificial subdivision in
order to achieve a desired feeling. Commonly, you will hear a child ask a
profound question, “Why?” If you follow their causality you always reach
the idea of God, or the universe. Follow me. Why was I born brown?
Because my body is East Indian. What makes me East Indian? My parents
are. What makes them so? They were born in India. Why? Because there
parents had children that met in the Army. Why did they meet in the
Army? Because their parent had the concept of duty, and their genes and
upbringing brought about this situation. What brought about the situation
that created this one? Eventually you will trace all of the variables to a
cosmic event. Some call this the Big Bang, or other objective scientific
conception, others call it God.
Many religious folks resist this characterization of God. They call it
blasphemy. Yet how could a slave, or illiterate, of thousands of years ago
understand the idea of a cosmic event in the form of energy? Most could
not, and those that did, were called crazy or mystic. God, or the underlying
principle never changes. Like the law of conservation of matter, it is
never created nor destroyed, it only changes form. And without time, it is
100 101
simultaneously all things. In the infinite, all things are possible at all times.
Thus, if it is conceivable it exists. If you think of something and call it
unlikely, it is already conceivable as you have thought of it to dispute it.
It is enough to make one’s head hurt. That is the feeling of a finite mind
approaching the infinite; the goal of self-realization.
Thus, the cause of the universe, God, is the effect of the universe, the
universe itself. For the creator imbued the creation with itself. Something
never comes from nothing. Positively phrased, something always comes
from something else. Thus, causality is an artificial division in time. You
can divide the child’s question of why into an infinite number of questions
and answers. Scientists can always find more subatomic particles. The final
cohesive principle will always be energy. Objective external science’s goal is
how, not why. The philosopher, or internal subjective scientists answer why.
For example, objective scientists may tell you that the universe has a radius
of 75 million light years, or that n number of planetoids orbit the star Sol.
This means nothing in your everyday life. The astrologer will tell you what
that means to you personally. Because you are born at such and such a time,
the gravity and energy of these planets exert this influence. How they exert
this influence is forever the realm of the objective. Why they exert this
influence lies smartly in the purview of the subjective.
Realization
Your soul wishes to realize its inter-connectedness and omnipresence, its
infinite immortality. There are many ways to do this. You may commit
Karma Yoga, or the yoga of perfect action. When you are lost in the action,
you become perfect. This is easiest to imagine in the ballet dancer or
musician. When they lose themselves in their art, they become one with
God. If two become one, they are the same. Thus you become God. This
statement may sound blasphemous according to organized religion. But it
is not only throughout their scriptures, it is also supported by simple logic.
Do not be fooled by the dogma and prejudices of thousands of years. Also
remember that many who transcribe the words of masters are not masters
themselves. Hence grammatical “corrections” creep into translations. These
corrections damage the clarity of the words as initially spoken. Even more
important, the audience changes. What a master says to your child sounds
different than what he tells you.
Path of Devotion
Another path to realization is to perform Bhakti Yoga, or, perfect love,
devotion. When a man or women loves another completely, they become
one with the object of devotion. In these moments of loss of self, there
is oneness. When two become one, once again, you have God. The sage
of Galilee states that two must become one. The ancient scriptures of the
Tao and the Upanishads state the same. Shamanistic traditions state the
same. Merging of thought, word, deed, and feeling are key. Until the many
become one, you have division, or devolution. When they merge, you have
evolution.
Snake and the Rope
An ancient proverb speaks of a man walking through the forest. He comes
upon a snake and jumps back startled. Then, he gingerly approaches the
animal only to discover that it is a rope. Did he truly discover that it was
not a snake? No, he did not. It was never a mistake, he never discovered
that it was a snake in the first place, so he could not discover that it was not.
He imagined the whole cause and effect situation. He imagined the entire
duality of snake and rope. The truth is that he removed his ignorance.
This is the path we have chosen. God created us out of itself. We sought
to know ourselves as God. Thus came ignorance first. To know something
we become ignorant of its true nature first. Then we can experience the joy
of discovery. Imagine that we inherently know ourselves as infinite pieces
of God, but there is no contrast of ignorance. So we do not really note our
innate fulfillment. The beauty of the universe is that it always provides
what is asked for. You always get what you want. Ask yourself, why do I
want this? Once you realize what you know and why, you no longer need to
contemplate the what and why. You automatically know. This is the goal of
realization.
Most of the methods I have mentioned so far are temporary. The dancer is
one for a moment. The lovers are one for a moment. When you can remain
in this moment infinitely, you have achieved merging with God. Some call
this Godhood; draw your own distinction.
Staying on the Path (to Personal Perfection)
The question remains, how to know that you are infinite at ALL times. This
is Jnana Yoga, or perfect knowledge. The path to achieving this is long an
arduous. It usually takes many millions of lifetimes. Don’t worry though,
the fact that you are reading this now shows that you are through with at
least 90% or more of them. There is a story of three men asking a realized
soul how their realization goes.
The first asks, “How long do I have to go?” To which, the master answers,
“You have ten lives to go.” The man leaves distraught. The second seeker
asks the same, “How long?.” The master replies, “Only one hundred to
go.” This man slinks away crestfallen. A final seeker asks, “How long?” The
master with a twinkle says, “One thousand.” To this, the seeker screams
ecstatically, “Whoo hooo!” The other two are dumfounded, that he dances.
They ask him, “Why are you so joyful, you have ten and a hundred times as
us, respectively?” Still smiling, he responds, “I am on the path! I am on the
path. My success is assured.”
102 103
The principle in this story shines clearly. Once you are truly on the path you
may go astray, but you will never leave. You will always know that the truth
is there. You will settle for no facsimiles. Only the truth will do for you.
This does not mean that there is no work. When you fall at the end of
the path, the heights are dizzying, and so is your impact with the ground.
You fall much harder at the end of the road than the beginningAny who
have great power have the risk of great abuses. This does not mean that
they do not realize, or that they are not realized. The infinite truth has all
possibilities within it. You can never really know what it is until you merge,
and once you merge, the differentiation is gone. Then you can no longer
judge, for the pairs of opposites are gone. There is only the one without
division.
Listening to the Still Small Voice
This ego seeks only to preserve itself. This is where the greed of humanity
comes from. Because the soul is infinite, the ego “feels” that it must be too.
This is not the case. The ego personality goes with the body. It includes the
intellect of thought, the mind of emotions, and the body of urges. Use its
intellect, the thorn, to remove the thorn, the ego itself. Then discard both.
The ego senses when the soul comes out. This soul is the still small voice
that we are cultivating into a roar! It drowns the ego, the source of pain and
pleasure, but not of feeling. This may seem contradictory, so I will clarify.
Feelings from the body are powered by the soul. These sensory perceptions
are illuminated by the internal illumination principle itself, the “knowing
principle,” or soul. But the senses themselves have no normative value.
There is no good or bad for the soul. For the soul, there is only itself. The
body ego and intellect are the ones that have normative or moral values.
This is how things become good or bad.
Minimizing the Peaks and Valleys of Your Life
So, the ego and body generally want pleasure. They will do anything to
avoid pain and experience pleasure. The soul knows neither. Without a
body, how is it to know the ecstasy of orgasm, or sweetness of sugar? It
does not, it only knows bliss. The privilege of feeling only comes through
corporeal existence. Discorporated, the soul knows infinite bliss. The goal
of realization is to know infinite bliss while incarnate. To experience pain
and pleasure of the body and mind, from the place of infinite bliss. When
viewed from this point, pain and pleasure are both feelings to be treasured
and valued in balance.
The way to experience this state requires minimizing pain and pleasure
while feeding your bliss. In the beginning, a seeker avoids extremes. He
or she quiets the senses which up until recently were “life. The aspirant
removes all attachments between the ego and the world in order to bind
it to the SELF. Turn the ego inward toward the soul, the true source of
its existence. The way to recognize the soul is to quiet the ego’s screaming
desires long enough to recognize the soft spoken seed of truth within. Make
no mistake though, the soul has its own shout, its own fire. Once it is heard,
it can never be silenced or ignored.
When you find your fire, feed it while starve the ego’s. Do not let it know
what the goal is. Keep it minimized and chained until you have control of
it. In the Bhagavad Gita, Krishna likens the five senses to horses in a chariot.
Keep the reins tight until you have control of them. Then allow them a
little rope at a time. If anyone seeks to outpace the others, reign them back
in until they subside again. This is a process of slow progress. Sometimes
you go two steps forwards and one step back. Other times you go 24 inches
forward and 23 inches back.
Follow the above methodology with all desires, though especially with your
major addictions, sex, gambling, and purity-that is right, obsession with
so called perfection, charity-giving, etc. Any extreme desire gives the ego a
place to preserve itself. This does not mean that the soul has no intensity.
It just means that you have to minimize what you thought were your
intensities, until you discover the real ones.
Maximizing Your Gifts
Although they may be the same talents as before renunciation, it is more
likely that they are complements. Other times, your easy skills of this trip
are the hardest earned ones of the last trip. For example, you may spend
one or many incarnations learning to put family first. On this one, you
keep entering the same relationships, ones where you enter happily and it
goes downhill. You keep trying to preserve them until they crash and burn
terribly, you have already learned self sacrifice. You may be set to learn how
to be in a relationship for yourself now.
Please do not take this example to mean that I am speaking about anyone
personally. This is an example. Your ego is actually what you think of as
yourself at this moment, hence ,it is perfectly matched to battle. It knows
all of your strengths and weaknesses as you are it at this moment. That is
why you must pass it logical conundrums to exhaust its illogic. Eventually it
gets so tired that it can no longer put up any resistance. It starts to whimper
and whine. Even this behavior subsides after you begin to ignore it. Finally
you ignore it entirely and it goes away. One day you feel oneness. One day,
there are no more arguments and debates within. This is neither the silence
of an ignorant child, nor the unconsciousness of fools. It is the “conscious
unconsciousness” of the sage.
104 105
(63) Jesus said, “There was a rich man who had much money. He
said, ‘I shall put my money to use so that I may sow, reap, plant,
and fll my storehouse with produce, with the result that I shall lack
nothing.’ Such were his intentions, but that same night he died. Let
him who has ears hear.”
You Are Finished When You Are Done
“You could die at any moment, and probably in the next fifteen minutes. What
would you want to say that you were doing?”
Early on your path you may state, “Having sex,” or, “<INSERT> bodily
gratification.” In fact, when you have not lived enough yet, you will believe
that the best way to live is to fill all of your time with bodily gratification.
Those of us who have tried to do so, know its futility. Many people try to
“understand” its futility. You must do both, understand and experience.
Only then do you truly know, until then it is only speculation. Yet the two
states need not meet in the same day, year, or even incarnation. They must
however, be met by the same soul for fulfillment to occur. You know not to
touch the stove because you were burned. Whenever you are contemplating
that the stove is not that hot, grab it, sit on it, make love to it! Make sure
you are done, for if you are not sure, you will return.
Treatment counselors hate when I tell their charges to make sure that they
are done. I have been an alcoholic, I have quit. Though I was not done
until I was sure that I had enough. If you repress your addiction, be it sex,
alcohol, or whatever, you will be born again to experience it. These seeds
of future conduct always lie in wait for the right conditions. They must be
spent, eaten, consumed by the fire of enlightened experience. Make sure you
are done! Know that you have had enough. The human spirit can endure
nearly anything. That is the beauty and strength of humanity. Revel in your
life. When you are ready, transcend it to your infinite glory. Meet your
perfection here and now. Know it though, do not try to fake it. Without
experiencing life, you will never know it.
Think (Reason) AND Feel
Many people try to “think” their way through life. They think that if they
logically understand everything that they never have to make a “mistake.”
Wrong. Until you know something yourself, you are just a parrot. Your
parents can tell you not to overeat again and again, but until you do so,
you really don’t understand. Furthermore, if you always went with what
someone else told you— you would be condemned to failure. Prejudice
would be the standard of life, and imperfection the rule. This is not so. You
have your own body, mind, and intellect, your own spirit of truth. Learn
what others try to teach you, then test it yourself. You will know what to
test in this life, and what you already know.
Do not be fooled, what comes naturally to you in this life is something that
you have fought unceasingly to learn in another one.
Learning is difficult and rewarding. If something does not require
everything that you have to know it, it is not new. If when you first
start something, it is natural, you already know it. This result does not
immediately indicate that you should drop the pursuit. Doing everything
difficult is not the purpose of your life. It would be difficult for me to have
a baby or become an opera singer. This does not mean that these are lessons
for my present life.
Education and Familiarization
The key to knowing yourself and your accompanying tasks is
familiarization. Many parents do a poor job of explaining the difference
between pain and growth. The Army breaks you down before it builds
you up. Modern psychology is often at odds with itself over this strategy.
Yet it serves an important purpose. We cannot build ourselves upon a
flawed foundation of logical inconsistencies. When we build strength upon
weakness, we collapse when the stress reaches threshold. Yet sometimes in
the military, growth becomes punishment. We learned in the Combat Arms
to survive withering abuse inflicted by others, and eventually ourselves.
At a certain point though, a beating is just a beating. Once you know the
difference between pain and growth, you can be trusted to be your own
master. You learn to govern your own thresholds. At this point though,
hopefully your enlistment is up. Otherwise, you are going to have a rough
time and a lot of insubordination charges.
Boundary Cases
Learning thresholds is what all children seek to do. This is called testing
one’s limits. The issue common in today’s society in the USA is that Alpha
children are being born. The strongest of the strong are being born for the
coming changes. Think about humanity as an organism with a variety of
differentiated cells at any given time. As it prepares for stress, it produces
the appropriate cells to handle the load. These hyperactive kids are the kind
that will get up no matter how many times you knock them down. These
kids, sometimes called indigo children, always come back for more. They
never stop and often move at a rate outpacing the most dedicated of adults.
Unfortunately, when the parents cannot provide the familiarization that the
children need, they will go outside the home to get it. As a result, society
becomes the arbiter of their fate. Society is more like life, less kind then
a parent often will be. I am not saying that all ADHD (Attention Deficit
Disorder Hyperactivity) youth can be taught by their parents. Each one is
different. What I am saying though, is that it is not a disorder per se, but a
response to where we are in our evolution as a species.
106 107
These children live in the eternal present. There is no past and future
for them. Sound like realization? They are closer than many of the other
generations present in society. These children are ready for the world, and
they seek to come out now. They come prematurely, strongly. Trying to
change what is, cannot be done. Learning from it is the goal. Figure out
how you are going to deal with yourself and your children. Learn from
experience, that is the fun. Understand what you experience, and then
experience it. Together you will know it.
Fulfill Your Needs, Be Careful of Over-reaching
The verse above has Jesus saying that a rich man who decided to invest for
the future died the very night he made his decision to live for that future.
Why? When you decide to imagine your life in the future, you will not
get more. The more you devalue the present, the less you need it. You are
not valuing what you have, life, why should you get more? The parable
has more. Why live for the future, when you know not whether it will
come.? Think of all of the resources you save for your golden years. Think
of all of the dreams you save for a time that does not exist instead of living
them now. Sit down and think. How much do you really need to live
comfortably? You need a sleeping bag, clean clothes, a shower, a hot meal,
and a library card. From here you can do anything. You can earn a daily loaf
of bread and then read all day. You can visit people and talk. You can make
love, you can sing or dance. You can teach and learn. It is not that other
comforts are not nice, they are not necessities.
What is necessary is love and passion. If you have no love and no passion,
how well will all of these other comforts serve? They will only cover your
deeper sickness inside. The poor man has the dream of wealth to keep
him going. The rich man has no such delusions left, for he has achieved
everything he once thought would make him happy. Nonetheless,
abundance is a requirement for a golden age to dawn. Not because riches
create gold, but because they illustrate the inner poverty. Having all of your
material needs met will show you how you fail to meet you non-material
ones. As an example, have you ever been in love? Even for a moment?
When you are “in” love, nothing can ruffle your feathers, it is as if you
are surrounded by a cushioning cloud of joy. You are in a cloud of warm
soothing pink light. Everything that comes into contact with you is colored
by this light, it is softened by your cloud. Your house could burn down, and
your best friend could get sick. Neither hurts you. When you fulfill your
internal need, the outer ones become accoutrements. The outer fulfillments
become assistants to you. This is the goal of realization, to find yourself, and
to experience everything else as embellishments; as tints to the shade of your
own personal light. As filters that allow you to illuminate life differently.
All spiritual schools speak of this truth. They all state that external objects
cannot fulfill internal needs. That you can’t achieve everlasting happiness
through finite objects. By this statement alone, you can see that something
must be infinite for you to ever be happy. As long as you know that your
love will pass, you will always have the fear of loss somewhere within. Most
people settle for the idea that life is a gamble. They pretend to believe that
they may or may not ever achieve perfect happiness. But ask yourself, why
do gamblers gamble? Because they know that they will lose? NO. Deep
down inside, they know that they will win. If they knew that they would
lose, they would stop. They may understand that the odds are against them,
but they believe that they will win. Again, do you ever touch a hot stove?
No, for you know that it burns. You do not calculate odds and touch it.
There is no need to calculate.
Time Loop of Addiction
The problem with the gambler or drug addict is the time loop. They both
know that eternal fulfillment and bliss are their natural right and reward.
Unfortunately for their families and themselves, these powerful egos are
unable or unwilling to connect the paths. They do not see that there
shortcut is failing, that their reward is coming, just not through these
means. They are told that they can never gamble or get high again. When in
reality, the feeling they get from gambling and drinking is from within. The
cards or the booze has no property of itself. Set the booze or deck of cards
in front of one who does not use. There is no effect. Now, set the objects in
view of the newly reformed addict. This is cruel, for their ego will imbue
these tools with an unquenchable desire.
Back to this idea of gambling itself. The gambler knows he or she will win,
as do all people. They pretend that they are rational and that they accept
that life is a gamble with uncertain rewards. But if this were the case,
everyone would kill themselves. The person who knows gambling is a risk
with uncertain rewards, never gambles. Deep inside, you know you will
win this gamble of life. You believe that the universe is just. Otherwise,
you would never ask why the world is unjust. You have your own concept
of fairness from within. Yet what is, is what is fair. Your outlook is what is
inaccurate. By definition what is out of order cannot happen. What happens
is “the order of the universe,” what you imagine is what is out of order
and nonexistent. The challenge is to bring the two into line. Expand your
perspective to know what that order is. Once you understand the order and
live it, you know it. Once you know, feelings of injustice and unfairness
dissipate. The stove is still hot and burns, but it is no longer an evil oven!
Life is Fair
Many people argue with when advised that they know that life is a winning
proposition. They insist that they do not know that life is a sure thing. They
state that they believe that it is, but that they know that it is not. They claim
to ignore this discrepancy. Disregard the fact that everything you feel affects
108 109
either your mind or your body. The discussion of the fact that our internal
inconsistencies result in bodily injury lies elsewhere. Instead, the focus here
falls on the fact that what you do, is what you know. What you say is what
you believe. Go into any house of worship on a meeting day, and you will
see people preaching about how they know God lives and judges etc., how
they know that justice will be served. Then on the next day watch any one
of these people contradict that statement. They have ill will in their hearts
or contradictions within their souls. If they know that God is who they
claim he is, they will have no need to claim it or remind themselves. You do
not forget what you truly know. If you forget it, you never really knew it.
The definition of knowledge with respect to the self and infinite truth needs
clarification. As long as your knowledge is based upon the finite cells of your
brain, it is finite. That which is learned within your infinite soul is never
lost. How can you remember what a weight is without hands to lift it? How
can you remember words without mouths to speak them, ears to hear them,
or eyes to see them? You cannot. In fact scientists cannot figure out what
language the brain uses. It is not images, sounds, or numbers.
Study Principles
What you remember is knowledge tied to concepts. Principles stay in
your awareness. You remember what is hot and cold. The feeling of joy
you remember. When you associate a fact with a principle you remember.
Genius is often thought of as pattern recognition, or association. Imagine
memory as a spherical web with an infinite number of interstices, where
multiple lines of reasoning, or facts, intersect, is an interstice. These are
“memories,” or experiences. At any given time there is a focus for one’s
intellect. The range of all values is the consciousness of the infinite. The
range of values one’s awareness is focused on in any given moment is the
soul. The goal of realization is to expand the consciousness to all values.
Microscope Metaphor for Consciousness
In fact, compare your body, heart, and mind to the viewing area of a
microscope. The lens is your intellect, focusing on a part of your awareness.
Your awareness is the circle of light through which you can view any part of
the slide. The light is the enlightening principle of God. Thus, you can use
your intellect to think about any part of the physical universe within your
consciousness, the lens to view any part of the slide. Your intellect is limited
by the range of your awareness, the area of light underneath the slide. To
know the whole universe, you must expand your light to that of the entire
universe. You must join your ray to that of all light. Once this is done, you
always exist as that ray. Your intellect always exists as part of the lens of the
cosmic intellect, and the physical specimen on the slide always exists as part
of the entire physical universe. Had enough yet?
Mimicking Versus Knowing
Most religions teach you to ape reality. They say read about truth,
understand it, then go right to the end and be it. They teach people to
avoid the learning process. If you have ever tried to teach or learn, which
all of you have, you see that parroting has no place here. Learn by doing ,
watching, seeing, hearing, and teaching.
It is questionable whether one can learn by watching someone do
something, or by reading about it. The way to truly know something is to
do it. If you know something from the bottom of your heart which you
have not done in this life, you know the principle. Learning does not mean
that you have to touch every hot thing to know it will burn. It means that
you learn concepts and principles broad enough to extrapolate yet narrow
enough to be useful; such as the principle of “hot,” in the stove example.
You will know when you have tempered the metal of understanding into the
steel of knowledge.
Wisdom or Scholarship
Without tempering you have outward erudition. You have name without
form. Only when the two merge do you have life. The majority of so called
masters you will meet today are intellectuals without tempering. They tell
you about what they “think,” this is where the adage comes, “Those who
can, do. Those who cannot, teach.” This idea points out the flaws common
in scholarship of today. Teaching is about showing your students how to
think and understand, and then encouraging them to do.
Learn and understand. Do and Know.
One who thinks and understands alone often teaches and performs poorly
because he or she does not know first. You must know first. This is not to
say that one cannot be an excellent explainer. Align your thoughts, then
your words, then your actions; feelings follow. Understand what you do and
why, then do it with these ideals. When you are fully aligned, you no longer
need to think about what you do, it becomes natural. Like the perfectly
forged beam your molecules are in alignment, you can handle stress and
distribute. A master is a perfectly forged beam and bridge across which
others can pass. They pass from death to eternal life.
110 111
(64) Jesus said, “A man had received visitors.
And when he had prepared the dinner, he sent his servant to invite the
guests. He went to the frst.”
We seek self-masters to feed the hungers in our souls. To see, feel, and
know what fulfillment feels like. Our examples serve double purpose. We
watch them fulfill themselves, then we replicate. Yet, as the parable above
illustrates, people resist the invitation when they see it. Ceaselessly life
entices with its inducements to consume. We must resist excess in order
to reach the goal of eternal perfection while in the thick of life. When we
follow all of the steps leading to enlightenment, we realize when we get
“there,” that it was always “here.” Some of us run the track of life so quickly
trying to get to the end only to realize that it is the beginning. Others try to
hold on to the past so rigidly only to regress back to the beginning which is
only the end of something else. It is a circle.
Yet ask any runner though, the end which is the beginning is most
meaningful after you have run a circle. Ask an athlete if she wants to win
the medal without running the race. She will be disgusted with you. A
fighter seeks to fight the battle, the winning comes when it is time. Never
does it come without the fight though. Recall the coward turned pacifist, he
wants to win without a fight, unlike the warrior who surrenders the sword.
Any hawk who has never battled is nothing but a child wearing the clothes
of the father. He is a chicken, not a hawk, a chicken hawk. Look familiar?
Love, the Satiating Meal
Masters offer you a meal, one that satisfies. Yet rather than come to the
table, we instead choose to do business. We constantly try to buy eternity
by investing in an uncertain future rather than living our present lives more
fully. Most parents teach the idea not to follow our dreams to be artists,
but rather to invest in the job that pays more. Some of us discover though,
that the job that pays the highest dividends is the one that is our passion.
Although its compensation may not be financial, its payment in the form of
satisfaction is much higher. The lesson is that if you do what you love, you
are a success. Although there is an unspoken hint that if you love something
and are good at it, that you will make money, it is secondary. When you are
happy and in love, the simplest of pleasures is a wonder. Be it a picnic with
your paramour, or an outing with your child. Both fulfill you while costing
little actual material wealth. Love is the key.
Still though, we are taught, invest into the future. We are taught to prepare
for the rainy days. We spend time saving dollar after dollar, cent after cent;
running as hard as we can to learn as much as possible in the shortest
of time. Then one day we awaken to realize that if we always run to get
somewhere else, we never get anywhere. Couple this comprehension with
the path of renunciation and we spend much more time living rather than
preparing to live. To live eternally, you must sit with the masters and eat
their fruit. Once you are fed, you will never be hungry.
Five Addictions
These sentences are metaphorical of course. Material life is a diet for the
senses. In the ancient traditions anything meant for the senses was food.
When you eat ignorantly and without balance you suffer indigestion. Look
at modern Western culture, as it spans the globe. It encourages gluttony and
sensory overload. There are over three different types of gastric bypass, or
stomach surgery to prevent obesity and over eating. Overeating is like any
other drug addiction. There are five addictions:
❖ Drugs
❖ Alcohol (really the same as drugs)
❖ Gambling
❖ Sex
❖ Food
The only one that you cannot quit entirely is food. American society deals
with sensory overload like the puritans who were the forefathers. No sex, no
drugs, no alcohol, no gambling. Food overdose is all that remains. So this
society tries to create fake fat and physical surgery to prevent what is really
immature philosophy. Food consumption releases endorphins into the body
which are akin to those released from drugs or sex. We get addicted to these
112 113
good feelings. When we are not feeling well, we self medicate with food.
Most doctors will not tell you this as they are addicted as well. Furthermore,
no one wants to take responsibility for their own life. In reality, you asked
for this entire existence.
Dry Drunks
Most people in the world today are what twelve step programs call
“dry drunks.” These are those who have all of the rationalizations and
mentalities of an active addict, without the substance to sedate them. In
other words, they blame everything upon someone or something else, and
they justify many of their actions based upon their own emotional appeals.
An example is when a drunk finishes an exam. If he passes, he says that
he ought to celebrate, for he passed! When he fails, he must drink, for he
needs soothing. Whatever the occasion, the drunken spirit revels in its
self-pity. It uses any excuse to fulfill its material excesses. Just because you
are a functional member of society does not mean that you are not drunk.
Anyone who is willing to trade their dreams for material compensation is
either a prostitute or a drunk. Take your pick.
Make mistakes, but do not try to clothe them in ill-fitting arguments of
nobility. The Bhagavad Gita’s main character is a man named Arjuna. He is
the greatest warrior of his time who can best any man living. His mantle is
the command of armies. The Mahabarata is the story of this family, the Gita
focuses on the final battle where he is brought against his own family. This
prince must fight his own masters of arms who work for his uncle. All of
his life, Arjuna fights and fights well. Now that the greatest battle has come
upon him, he shows cowardice cloaked behind noble philosophy. He states
that it is better to die than to fight one’s own unrighteous family. Rather
than descend into the details of the story, as beautiful as it is, I will focus on
Arjuna’s Dilemma.
The Dilemma
This dilemma is a microcosm of all of our lives. We live as we are with
courage and nobility until a real challenge presents itself. We then hide
behind voluminous logic. That we may not win is the real reason we
fear fighting. For if we had a choice: A) You get the object of your desire
without a fight B) You do not get it. We would pick the object of desire.
As the challenges stiffen, we fold. We make excuses. Some of the greatest
philosophies in the world are co-opted by cowards. A coward is one who
only fights when the battle is already won. This is not fighting, this is
clean up. A fight is when you stand tall for what you believe, regardless of
circumstances. This is justice, it has nothing to do with winning or losing.
Here we find ourselves, trapped in a world that does not reward the one
who stands for what is right. Yet once you understand the philosophy of
living, you learn that you cannot lose. Losing without winning is against
cosmic law. Balance is always maintained. This is the theme of the Gita. It
explains what God is and how to reach the state of universal consciousness.
The beauty of the Gita is that it gives a way for each person to reach
the pinnacle of their own potential. It delineates the four main types of
personalities. The caste system is an institutionalized bastardization of these
paths.
Four Types of Persons
These four types of persons are service, business, warrior, and philosopher.
They are not hard and fast rules, instead, they are models for behavior. The
service person is one who follows orders, these people are likened to the feet
of God, the sudras. They are not to make long term decisions. They are to
do as they are told, to be the masters of service, fulfilling their obligations. If
the feet decide where to walk they will only choose the soft ground, one trip
to the beach and you drowned. The feet reach the soft sand and just keep
walking into the water.
Business people are the merchants, they always seek to see what is in it for
themselves. Their motto, “What can I get out of it?” They are to be masters
of exchange ensuring that all interactions are win-win. Their goal is to learn
to create transactions where all parties benefit.
Next come the warriors, whose perfection is reached when they learn
selfless leadership and sacrifice. They lead organizations and fight battles.
They can be trusted because justice and sacrifice comes first to them. After
reaching the pinnacle of self-sacrifice, they learn to do what is right because
that is their payment. These are the philosophers. They follow the path of
human perfection until they reach the point where their nature is to do the
right thing. They do not sacrifice. What they are as themselves are divine
oblations. They serve by living truth. The danger with these delineations
is that merchant-minded men make them rules. Once guidelines morph
into laws the system lost its explanatory power. They are guidelines for
self-discovery that is all. If they serve a purpose for you, utilize them, if not,
disregard them.
The hardest hurdle to pass is that of the business person. This role
guarantees you the ability to make money in the material life. Once you
gather this ability, it is difficult to surrender it to self-sacrifice. For the
warrior, it is hard to find the self after so many incarnations sacrificing it.
He or she always seeks to fight his or her way to success. As a philosopher,
the warrior is to succeed by being, not by doing. Generally, the paths of Yoga
are Bhakti Yoga or “selfless” devotion for the service person. Karma Yoga,
or perfect action, for the business person. Both Karma and Bhakti for the
warrior. And finally, Jnana which merges all three yogas for the philosopher.
114 115
.”
Murdering a Master
When we are young our parents often teach us mercy, to give the benefit
of the doubt. For one who is strong, this is vital, it avoids tyranny. The
example above was given in Jesus day to refer specifically to the lineage of
God. This line refers to the natural evolution of consciousness from the
prophets of old until the master himself. His forerunners were seers whose
consciousness evolved until it could host a perfect master. Jesus reached the
pinnacle of spiritual development within their schools.
How did the locals deal with Jesus forebears? Sometimes they murdered
the prophets. This parable is to show that the religious leaders recognized
exactly which master sent them. In fact, knowing who sent them is what
caused them to be so wroth. They could see that spiritual liberation lead to
physical liberation. It is no coincidence that the early church infrastructure
so limited personal liberty. Much of the church did not care about the
salvation of souls. Once the souls leave, they are outside of any physical
religion’s control.
By definition, these organizations seek to control people’s bodies and minds.
The soul is taken care of on its own by itself, or, by God, if you will. So,
each time the master sends a servant to collect, the tenants molest him.
Finally the master sends his son himself. The leaseholders murder this one
as well. Each of the other servants had a slight possibility of not being
recognized. Not so with the son. All who looked upon this son of God
knew him. And for this reason they had to kill him.
Make no mistake, it is the recognition of the people that brings the
hangman’s noose. If you are unrecognized, you have no worry of upsetting
the powers that be. When the fearful see your power, they must destroy it.
They cannot have competition for salvation. Once you return agency to
the masses, it is too late. Thus, many prophets who testify of the return
of liberty are killed. History decorates itself with the bodies of those who
preach for the return of liberty, whether physical or spiritual.
The Macrocosm is Always Balanced
Many souls who lead this world have stored up ignorance, they have
borrowed from the future for their present and past. As a result, a collection
is due. In its elegance, the universal balance is always met. Imagine the fish
tank with a partition again. Half of the tank is 50 degrees C, and the other
half is -50 degrees C. In the microcosm, on either side of the divider, it
seems out of balance. Yet, when you look at the entire tank, you see that it
is balanced. The infinite universe is always in balance. Sometimes though,
the microcosm is not. We live in the microcosm. As long as we divide our
time into past present and future, we will have imbalance. As long as we see
the world as polar opposites, we are bound to experience them both. If we
try to create the finite codified moral good, we inadvertently create the finite
moral evil. More simply, by pursuing the so called ultimate good at all costs,
we create the ultimate evil. Thus, we lead ourselves into exactly that which
we wish to avoid.
(66) Jesus said, “Show me the stone which the builders have rejected.
That one is the cornerstone.”
Rejecting the Cornerstone of Truth
This verse refers specifically to religion builders. They reject the cornerstone
of the science of living: Liberty. Religion is the science of perfect living, it is
based upon internal and external science. Both the subjective and objective
fall within the realm of the philosophy of living. To understand, one must
have freedom of spirit and of conscience.
Many religious institution builders reject the true message of masters such
as Jesus who tell you that you know what is right in your heart and that
you are the final arbiter of your fate with respect to the universal father and
mother. Their lives show you that you will discover yourself despite outside
meddling of those who do not know. How can one who has not walked the
path tell you what it is like? They cannot.
116 117
Because self-masters taught themselves, they can teach you. They show you.
Feel the intensity in your hearts when they speak. If you do not, they are
not talking to you. Here is where the phrase, “Let him who has ears hear,”
comes from. We speak to those who have the ears to hear, those whose
hearts ache from the inconsistencies of this finite life. They are not here to
argue with those who believe only in the physical. One cannot debate with
those who do not know.
Leave the debates to the academics, that is their role. Masters show you the
truth so that you can feel it. If you are not ripe to be plucked they will not
harvest you. For your flesh is bitter to their taste. Your bitterness is for you
alone. Each must transform his or her own bitterness to produce perfect
fruit. No one else can to transmute it. Bitterness comes from their own
illogic, and inconsistency, no one else can balance it. Only you can balance
your own inconsistency. Anyone who tells you otherwise knows not. They
are imbalanced themselves.
This is not to say that others cannot help you to feel the difference. Even
though your soul may be filled with darkness, an outer light can always help
you find your own light switch. You are dark within, your light is directed
outward. With the help of those already shining, shine inward to see
yourself. Once you recognize your own illumination, you always remember
it.
Once your eyes are opened, they can never be closed. Throughout eternity,
you will always search for the light again. Those who refuse to see damn
themselves to ignorance. There is always a chance though, that they will
someday recognize. Unfortunately though, the habits of ignorance are
self-perpetuating. One lie builds its own momentum of subsequent lies.
Remember this when you are in darkness alone. When your soul is in agony,
remember that lies perpetuate themselves, and that pain is temporary.
Acknowledge that the truth is forever, that it is always darkest before
sunrise. You will see the day, and because you have endured the dark night,
it will be oh so bright.
(67) Jesus said, “If one who knows the all still feels a personal
defciency, he is completely defcient.”
How to Know When You Have Achieved
Your Perfection
A less poetic way of stating this verse is, “If you think you know the all and
you still feel a personal deficiency, you do not know the all.” If you feel
deficient in any way, you are deficient. Key here is the use of the verb “to
feel.” You may think whatever you want, it is your heart that matters.
The path to perfection involves clarifying and perfecting your feelings. You
must feel without indecision that you know the all. Or, more accurately, you
do not “feel that you know the all.” You “feel the all,” and therefore, you
know it. Just as you know hot and cold, you do not “feel that you know hot
and cold,” you “feel hot and cold.” If you are the slightest bit inconsistent
you cannot be perfect.
A caveat is required here. Removing thoughts of doubts does not equal
perfection. Read all of the ancient masters, integrate all of their thoughts
and logic. Concentrate, contemplate and meditates. Whenever feelings
come up, reason out that they did not exist. You may then think that you
are realized, yet you are not. If the feelings did not exist, you would not feel
them.
This does not mean that these feelings are infinite truth. This does mean
that until you have exhausted these feelings, that you will feel them, and
hence be unrealized. If you know something is hot, you do not have to keep
explaining to yourself that hot burns. Furthermore, when it burns, you
do not tell yourself that burning is a transient phenomenon and therefore
nonexistent. When you are burned, you move. It is part of the human
existence, self-preservation. Regardless of your infinite soul, you are here
now. When your consciousness is no longer here only then will this present
“now” cease to exist for you.
In other words, you cannot reason your way out of existence, you must feel
your way out. You felt your way in, you will feel your way out. You did not,
as a young soul, reason that your body felt, and therefore convince yourself
that this world was the only reality. You created a separation, some call it
a veil, between your infinite self and this world. Thus, you learned from a
state of ignorance, that this was your reality. Now you must unlearn that
state by feeling your way out as you felt your way in.
You must remove your judgment of this world by allowing it to do what it
will. Resist no longer this plane of existence. With the open-mindedness of
a child, and the wisdom of the ancient, experience what this world offers.
Know this world in the biblical sense. Make love to your experiences,
become one with them. Merge your thoughts, words, and deeds. When you
feel them become consistent with your heart, you know. Until then, you
mime your betters. This is humility, knowing that there is more that you do
not know.
(68) Jesus said, “Blessed are you when you are hated and persecuted.
Wherever you have been persecuted they will fnd no place.”
(69) Jesus said, “Blessed are they who have been persecuted within
themselves. It is they who have truly come to know the father. Blessed
are the hungry, for the belly of him who desires will be flled.”
118 119
Persecution or Self-Examination
These two verses complement each other well. They speak of persecution.
To reach perfection, you must be your own prosecutor. With unflinching
gaze, and unwavering commitment, you must examine yourself. You
must discover all inconsistencies within your own being. Then you must
eliminate them. This is the persecution masters speak of. Once you
persecute yourself and become perfect, others will follow.
Society’s telling you to persecute parts of yourself is the actual problem, not
the parts that it tells you to persecute. Society tells you to persecute your
true self. Knowers of eternal truth tell you to persecute your societal self,
your personality-ego. That is what society teaches, for you to crush yourself
in order to become what society thinks you should be. Society does not
meet its own standards of conduct. A great example of this is to be found
in most religious gatherings. Most religious leaders tell you to become more
like they believe themselves to be. Or, more like they wish themselves to be.
Masters do not tell you how to become like themselves. They tell you to feel
the way they feel. The methodology used for discovering themselves is what
they show you. Realized souls show you the result of their labors, then they
share what those labors were. If you seek what they have, follow the path for
yourself, using the tools they embody. If you do not seek what they have,
speed your way back to the fold of society.
When you begin to unfailingly remove your internal logical flaws, you begin
to persecute yourself. Where you have cleansed yourself in this manner,
within, the persecutors have no place. They will have no place within you.
Yet, you will forever be in their thoughts. You will dismiss their cries, they
will weep at yours. When you begin to know your own lies, you begin to
know the universal father. When you begin to perfect yourself within, you
know the father. If you are hungry for the truth, and nothing of this world
satiates your appetite, your desires will be fulfilled by the methods of the
masters.
They come to the hungry.
(70) Jesus said, “That which you have will save you if you bring it
forth from yourselves. That which you do not have within you will
kill you if you do not have it within you.”
Save Yourself
The only thing which you truly possess is your consciousness. Your physical
liberty can be taken. Ask anyone who has been locked up. Your body can
be taken from you, ask any amputee. Your mental liberty can be taken from
you, ask any mental patient. What is yours? Your consciousness, is you and
it is yours. You are.
This “You” is what you have within. If you bring it out of your deep self, it
will save you from any threat, real or imagined. If you do not learn to fully
possess and master your consciousness, your ignorance and ineptitude will
kill you. The cause of death is your ignorance of your true nature.
Know this, that slavery is an abomination before the universe, nothing can
be enslaved against its will. The only way to capture anything is to convince
it to follow you.
Masters do not seek to have you follow them. They seek to have you
follow your path to yourselves. YOU FOLLOW YOU is our admonition.
Even when you say you are not following you, you still are. Do it without
apology.
(71) Jesus said, “I shall destroy this house, and no one will be able
to build it [...].”
Dispelling Darkness
This statement is incomplete from the Nag Hammadi scrolls. Nonetheless,
the statement is about destroying a house which another cannot rebuild.
What can a master destroy that cannot be rebuilt? Darkness. The house
is ignorance, once you remove ignorance, it can never return. How can
you pretend you don’t know what you don’t know? This is a proof of the
negative. Impossible.
Self-masters come to destroy the glass houses of liars and slavers. Slavers
seek to convince you that you are unworthy to be your own master. Their
mission is to convince you that you cannot know the truth without their
interpretation of it. How is this different from a master? A master’s mission
is to show you the truth so that you can recognize it. Their method of
illustration is such that it provides the tools for you to discover the truth on
your own.
They destroy the house of ignorance. They destroy darkness through
shining the light of truth cultivated within. Once the light has been turned
on, you will forever know when it is off. You may have trouble finding the
light switch again, but you will NEVER forget what it the light feels like.
Your heart will forever yearn for the light again.
Some ask why they desire to show the truth. They are one with the infinite
consciousness, so they are not really showing anyone else, anything. They
enlighten themselves. God is enlightening itself as to itself. It looks in the
mirror, to see you, its reflection.
How is this different than the other teachers? They want you to remain
ignorant, to look outside for yourself, to follow some rules that they have
dictated. How can the universal consciousness enslave itself? It cannot. How
can you limit yourself? If you are both the limit and the limited, then you
120 121
are not limited. If you are the right and the left half, there is no division.
If you are the excess above the limit, and that which is circumscribed by it,
there is no limit. You are both.
A simpler example may suffice. God has created you and the universe out of
itself. God is timelessness. If there is no time, something is always in every
place at once. This means that God is where you are at this very moment.
God is where you are and where you are not. By this explanation, God is
you. For if it is not you, there is a place where God is not. This statement
flies in the face of the earlier definitions.
God is omniscient, omnipresent, and omnipotent. In plain words, God
knows all, is everywhere (is the all), and is able to do all. By these rules,
God is again you, for he is everywhere. If you are somewhere, he is there
wherever you are. There is no place that God is not. If God is truth, it is
always so. If it is always so, it is infinite and unlimited. God is you, you are
part of God; if you are a sinner, so is God.
(72) A man said to him, “Tell my brothers to divide my father’s
possessions with me.” He said to him, “O man, who has made me
a divider?” He turned to his disciples and said to them, “I am not a
divider, am I?”
A Uniter Not a Divider
The diction of this translation whether from the scribe or not, is
exceptionally opaque. Rather than get caught up in the unclear parable,
focus on the statement, “I am not a divider, am I?’
As stated above, a slaver seeks to divide, a master seeks to unite. The mortal
slaver sees only division, whereas the master sees only unity. He seeks to
unite the disparate pieces of consciousness lost in the material. Unlike many
masters of old who sought to liberate consciousness from the material, this
book seeks to liberate consciousness while in the material.
The martyrdom of Jesus and the sword of Mohammed are the opposite
poles of religious excess. Neither are perfect human lives per se. Both are
extremes, they are duality. The perfect human life has both within it. It
has the feelings of love and hate, of tolerance and intolerance. This is the
goal of human evolution, to live perfectly. Our goal is not to come here to
experience all of humanity for nothing. We are creating a perfect manifested
being; that the universe can seed itself with. We are flowers within the
gardens of emptiness, stellar furnaces burning brightly in the vast expanses
of space.
(73) Jesus said, “The harvest is great but the laborers are few.
Beseech the Lord, therefore, to send out laborers to the harvest.”
Seek the Knowers
Here a master recognizes that many are becoming ready to realize the
truth. Even in his day, people are ready to know. Or, more accurately,
by definition, a master in the world comes when the people are ready to
transition. Therefore, he tells those who feel ready, to “Beseech the Lord…
to send out laborers to the harvest.”
The Laborers are those who know. They are to work to help others to
know. Remember that the universe seeks to know itself. This means that all
conscious beings wish to know themselves. This esoteric sounding goal is
the desire of masters since the dawn of time.
They seek to model the perfect life. Many masters preach disavowal of the
world. They teach to escape to the hills. To run away. Whether these are
their initial messages or not is immaterial. The key message is how to escape
the treadmill of slavery-self determination. Free yourselves from the bonds
of intellectual, emotional, and spiritual bondage.
Philosophical Loggerheads
One philosophy teaches that all that exists is spirit, another teaches that
there is only matter. Another seeks to show that the past and future are all
that is. The first sends people away, into themselves. It teaches to withdraw.
The second teaches people to try to define ALL in terms of cogs and wheels,
to discover an external reason for everything. The last commands people to
dream of a future wherein all returns to the perfection of the past.
So, one says to go right, spirit only. Another says to go left, matter only.
The third says to go forwards to reach the past. All ignore their opposites.
The right ignores the left, and the past and future ignore the present. They
neglect the one most important fact. You are here and you do exist. Nothing
comes without reason-Everything has a reason.
Running away, whether to the past and future or, the inside and the outside,
will not fulfill your personal destiny. Everyone who exists has a purpose,
this is destiny. For each organism in the ecosystem, there is a niche. This
law holds true for all animate and inanimate objects. Some call this raison
d’etre, this reason for being, dharma. This is the “reason for being,” for all
that exists.
You were not created to uncreate yourself, or just to create more like
yourself. If you do not know what you are, creating another who does not
know will not help.
All paths lead to you. All paths lead to understanding, they must be walked
consciously and to their completion. When you are lost, you must walk
in one direction until you hit a landmark. The military calls these “phase
lines,” project managers, “milestones.”
122 123
These are the easily identifiable terrain features on the ground, the landmark
goals which keep everyone on track toward the team’s goals. Humanity is
the team. Our goal is the perfect human organism. This organism is the
society of man. It is neither a group of individuals, nor a group of mindless
hive minds. Humanity seeks to have the perfect balance of the one and the
many.
The way to reach this balance is to know what you are, then to be that. By
following this logic, together we create the perfect harmony for humanity.
Everyone is conditioned to worry about everyone else. This leads to the
conundrum, of how to ensure appropriate behavior. Because everyone is
different, we can never ensure that everyone else does anything. We can only
manage our own conduct.
The path of internal spiritual perfection teaches internal perfection. It
teaches to “purify” the inside. Call this “clarification.” Clarify your internal
thoughts, then your words and deeds. This clarity produces pure heart.
Passion with clarity of purpose focuses your attention.
Ancient Vedantins refer to this trait as Mumakshatwa. This is the over
arching desire to do one thing, “wake up.” You are in a dream as your body
and mind run rampant. Your soul drifts through a slumber, equal parts
dream and nightmare. This unwavering desire to awaken comes when it
arrives. No one can teach it to you. You learn it on the endless wheel of life.
One day you must awaken, nothing else will satisfy. This is when you truly
begin your path to perfection. Before this state, you are still playing. You are
a child, a young spiritual being playing in a material sandbox.
A student asks his master, “What is “mumakshatwa?”
The master submerges the seekers head into a pool of water.
The disciple struggles to escape, wrenching himself this way and that. When
he struggles free of the suffocation, he sputters a question, “What are you
doing master?”
The master asks, “What were you thinking while you were under the
water?”
Still dripping from his submersion, the disciple responds, “Thinking,,
“What do you mean thinking?!! I was just struggling to get out!”
His master smiles and explains, “This is mumakshatwa, the unwavering
need to wake up. Nothing will ever get in its way. You ‘think’ of nothing,
your purpose is utterly clear, to the point of there being no thought of
anything. Only this resolute focus remains.”
Discovering the Focus for Your Unwavering Desire
This unwavering need within to wake-up from the dream, is a must. It
comes from within, from having enough experiences for yourself. No one
can give it to you, despite what some may say. Austerities will not produce
it. No number of beatings alone will do it. It takes aeons. How does a child
know when it has had enough chocolate? You cannot teach him, he has to
eat until he is full. You cannot explain it to him. Look at the number of
food addicts in American society? This obsession spreads too.
Addiction only finds its bounds by being full. When obsessed with drugs
or alcohol, no number of rehabilitation centers or counselors can convince
addicts that they have had enough. The subject has to reach his or her own
threshold. Treatment professionals serve by helping others to recognize
when they are full. But it ss the feeling within that seals the conclusion
beyond doubt!
Obsession with material objects or substances attempts to fulfill the deep
emptiness in our hearts that truly arises due to questions about our eternal
nature. How disconcerting is it really to know that you come from nowhere
are going nowhere and your life is meaningless blip on a time and distance
scale so vast as to dwarf even the sun?
After drowning ourselves in Neptunian depths we eventually sober up
enough to come up for air. We then remember the key questions once asked
at a young age. Most seekers ask one or a series of key questions, they are:
“Mommy who am I?”
“Where did I come from?
“Where am I going?”
“Where is ‘here?”
“Why isn’t life fair?”
Or, “Why did I get hurt…Why….Why….Why?”
The answers to these forever change a seekers life. Most parents invent an
answer, or give one that they do not believe themselves. The answers usually
are: “Why daddy?” Daddy is a scientist, “Because of genetics, the big bang?”
“And before that?” “Nothing son.” “And before that?” “That is a stupid
question”
124 125
Definition of Random
The scientist when pushed answers that life is random. Not only does this
drive a child crazy, it is a cowardly way of saying, “I don’t know.” But not
only few people admit their ignorance to anyone, much less themselves.
Adults cannot admit to their children that they do not know an answer to a
question decades old in their own mind. People cannot admit to themselves
that they fake life without any knowledge of why they do anything.
The pastors child asks the same:
“Why mommy?”
“Because God made it that way?”
“Who made God?”
“That is a ridiculous question, nobody made God.”
“God,” is often the zealots word for “I don’t know.” Whenever they cannot
understand anything, the unknowable God Concept shows up. How
convenient, the answer is known, but the answer itself is unknowable.
A master comes to know god, then shows others. This concept of God
reunites the concepts of Random, and the Unknowablse.
When you can answer these questions then you are ready for children,
otherwise you are just another kid yourself. Others sense your dishonesty
when you answer. They can recognize when you “believe” something and
when you “know” it.
Answer with what you know. All that I could prove when I was child, was
that everything appeared random. There was no satisfactory answer to
anything. Everything that I could see came from something else which came
from something else. If something came from nothing, that was even less
realistic.
In the face of all of this logic, even my parents, geniuses in their own rights,
could not answer. They gave me some nonsense to shut me up. They
rewarded me when I did not believe in some creator being, and when I
could come to the same conclusion as them. In other words, when I stopped
at, “There is no way to prove anything. They did not push for further
explanation.” Both objective scientists, and subjective scientists said the
same.
Luckily for most of society the external scientists have kept noisily looking.
Internal scientists get nowhere near as much public relations! Yet, both
schools have become dogmatized. Human consciousness is like a pair of
plates sliding against themselves. We have the internal consciousness, and
the external senses rubbing one another.
Philosophical Earthquake Imminent
Now however, our philosophies have been stagnant. They are not
exchanging. One moved forward while the other stopped. Like a fault line
of geological plates, our minds are about to experience a release. This looks
like an earthquake on the ground. For the majority of humanity, this easing
of tension within our internal philosophies will appear like a cosmic shift.
Some will get crushed as their psyches collapse from the pressure. Others
will move so far forward in their understanding as to make the world
entirely shifted. My word and presence testify that there is an answer. I
KNOW what it is for me, my existence proves that your answer exists for
you.
(74) He said, “O Lord, there are many around the drinking trough,
but there is nothing in the cistern.”
Sharing the Water of Wisdom
Masters commonly refer to wisdom as water. On a water based planet, water
is life. Earth is a water planet where water comprises approximately 70%
of each human. We can survive several days or more without food; not so
without water. We need our liquid life from the time we are conceived in
water, inside a womb, to the time when we die.
Despite this fact, we are thirsty. The Hebrew master states that in his time
there were many thirsting for the truth, the water of wisdom, the life of
knowledge. Not the salve of understanding. There are many at the trough
seeking it, but there is nothing in the trough.
The cistern refers to religion of his day. The religious mimicry did not feed
its flocks. Little has changed. We offer each other platitudes, or “I don’t
knows,” in a myriad of colored cloaks. An endless parade of costumed fools
dancing in your opera, feeding your ignorance with mirthless laughter.
Without knowledge of yourself and your infinite purpose, you will stagnate
and die. You spend your consciousness rolling from one dark night to the
“Ignorance is the night of the mind. A night without moon or stars.”
-Confucius
All masters come to drink the water, and to share it. Do not get lost in their
altruism. They see you as part of themselves, they help themselves. The
rule of the universe is that nothing ever “sacrifices,” but everything shares.
We may feel the privilege of sacrifice, but this is only to know service.
Everything always serves itself and others. There is no way to subvert the
purposes of the universe. This is order. This is faith. This is knowledge.
What is, by definition, IS.
126 127
What Is?
Our question, is what is that? What IS, “IS?” This is the question and the
answer.
Q: “What is, IS?”
A: “IS, IS.”
It cannot be answered in terms of something else. For how do you
circumscribe that which can never be limited? The answer is a proof of
negation. A master tells you qualities of what is unlimited. They describe all
that is around the truth, so that others can also experience it. The truth is a
feeling, the feeling of fulfillment. You KNOW what you know. No once can
prove to you that you are not you.
When you have this type of knowledge about reality, then you truly know
something. Everything else consists of estimations. It is fine to use tools to
accomplish your purpose, however, do not forget that they are only tools.
This is what humanity has done. It has taken tools to discover reality while
forgetting that the goal was reality, not greater tools!
We have the ability to meet all material needs. Instead of resting, and
turning inward, we create new “needs” through advertising, and planned
obsolescence. We create a branch of so called knowledge, advertising, whose
job it is to make a want a need. Does no one else see the horror of this
enslavement, of creating more desires to trap our consciousness upon the
treadmill of things?
These object never fulfill our needs. Otherwise we would all be trapped
at our first birthdays. All we want are the newest toys. If material objects
actually fulfilled our needs, we would never need more than the first ones.
Yet, no one will try to prove that we are fulfilled once we get the first
bicycle, or stuffed toy. We always want more.
More is Not Necessarily Better
The greatest assumption of Western Economics is that “more is better.”
Without this idea, society grinds to a halt. The next time you get a 20%
raise, ask for a day off of your five day workweek. Tell your slave masters
that you want an extra day off to spend the time and money you have now.
Tell the bosses that you have not been able to live, because you spend more
time working than doing anything else.
Thoreau’s Self-Sufficiency
Henry David Thoreau proved that he could work 16 weeks a year to provide
for the entire year. Do you really believe that you NEED to work 260 days
out of 365 to survive? You work 37 weeks out of a year? Even with kids,
do you need to spend two and a half times as many days working as you
do playing? This means that for every day off you get, you spend two days
working!
Do you believe in your heart that life consists of spending more time
running on a treadmill than actually making progress? Let me explain. The
majority of work is spent upon maintenance. Most of humanity works to
work. They wake up in the morning only to work so that they have enough
food to do the same tomorrow. Is this what existence is about?
No one would argue that this is what life is about. If someone tries to, ask
them if they would like to go to work, only to come home, to go to sleep,
only to get up to do the same the next day. In fact, ask most people what
their dreams are, and they are to become, “independently wealthy.” When
you ask a person what he or she means by this dream, the subject states that
this means having enough money to do whatever suits his or her fancy that
day.
The average person believes that this is what a child does. This idea is not
entirely accurate. A child is unaware of all of the options available. An adult
knows the options available from trying so many of them. This is how he or
she chooses what to do. Each morning all options are available because they
have tried them and found which tasks suit them and which do not.
Freedom enlightens. Living with nothing to do all day shows you that you
do not really know what you want to do. Here is a lie that many of us live
with. We create financial need, for if we are free, we don’t know what to do
with our time.
You ever hear the phrase, “Idle hands are the devil’s workshop?” Now you
know its true source.
The statement above shows that we actually believe that we cannot be
trusted to do the right thing. We create external needs to constantly keep
us from examining ourselves. We create external wealth to hide our inner
poverty. Find yourself and you will find everything. Then enter the world.
When you have your inner filled, you will be able to fulfill your outer. You
will seek that which is within.
Remember that when only the universal consciousness existed, it had
nothing to know outside, and no one to talk to or experience. It divided
itself in order to FEEL. Without something to know, knowledge has no
meaning. Your life is to find meaning. Discover what is your emptiness
within, in order to fulfill it without.
Your Purpose and Your Love
Each being has a personal mission to fulfill, a niche. Search yourself to
discover what you are missing, this deep seated need is your purpose. You
can fulfill this. Most people try to answer that they need to find, “true love.”
While often times true, this is only part of the equation. You must love
yourself before anyone can love you.
128 129
Here the doctrine of selfless love needs illumination. You can love no
one more than yourself. YOU CAN LOVE NO ONE MORE THAN
YOURSELF. How can one be so sure? You use your own consciousness to
love, so without you there is no one else to love from your point of view.
Wherever you look, you are using yourself to see. Thus wherever you look,
there you are! This is not to say that you cannot love someone as you do
yourself. This is in fact exactly what masters are saying, “Love your neighbor
as you love yourself.”
Self-Liking Not Self-Loathing
But most of you cannot stand yourselves. You look to love someone else
using this intellect, mind, and body that you cannot stand. You spend all of
your time looking outside because you cannot stand to look within. So, very
simply, you are using an unloved vehicle to find love. Thus, everything that
you experience is colored by your own personal discontent.
To the above statements many argue. They state that, “They really like
themselves.” Is that so? Do you have anything to hide? Anything that you
do not want others to know? As long as there is something about yourself
that you are ashamed of, there is part of you that you do not love. Will you
ever hide the object of your affection? Ask those in love, they wish to show
their paramours to everyone.
This behavior illustrates one way to learn whether or not you love your
partner. When you keep your so called love hidden, your significant other
knows you do not love him or her. Then again, most of us do not even love
ourselves as we hide parts of ourselves from ourselves. Thus we place others
dissatisfaction with us beneath our own. The cycle begins.
As a child, your parents train you on how to deny yourself. They say that
you are bad because you want to eat candy all day. You begin to bury your
desires to eat candy all day as wrong. Part of you becomes wrong. Welcome
to self hatred, population one. In reality, your desire is not “bad,” per se.
It results in you stagnating in development. Furthermore, there are other
explanations that serve better. Parents can try, “I do not have the resources
for you to eat candy all day. Furthermore, it makes you sick, and I can
afford neither the time nor the money to heal you all of the time.” There
are a multitude of answers that you can give that do not plant logical
conundrums that create self-loathing in a child’s young heart.
Suppression is a useful tactic for learning balance, as long as you remember
that it comes as part of a comprehensive strategy. It is a tool to build
concentration. The mission is to know yourself, the tools allow you to
recognize you. Once you know what you are, you no longer need to
suppress. In fact, suppression works against your development once you
arrive at adulthood. You accidentally suppress yourself along with all of
these thoughts. Find yourself, and love it. Then you can love everyone and
everything. Your love of self colors everything you see. Your vehicle
of cognition, “you,” is loved. Hence, the objects you cognize,
become loved as well.
(75) Jesus said, “Many are standing at the door, but it is the
solitary who will enter the bridal chamber.”
In the previous discussion, we talked about those who thirst for the Truth.
These people who stand near the well, are the same who seek to enter the
Kingdom of Heaven. The well, or the doorway, is the master. One who has
removed his or her own ignorance of the REAL can show others what it is.
What it looks like, and what it does not look like. What it FEELS like.
Self Love Is Unity of Self
Yet no matter how many stand at the door, or at the well, not all can enter.
They must be ready to love themselves FIRST. One must wed one’s self
before one can enter into balance. The masculine and feminine or positive
and negative within must pair. You are a divided soul. Very simply, without
any esoteric jargon, you are divided against yourself. You have shame for
parts of you that are perfectly understandable. There is no thought or
feeling that you have had that someone else has not had. Everything you
conceive of is conceived of by everyone else at some time.
But you don’t believe this fact. Your philosophy has you imagining that you
are bad. You are a bad bad child! You did not listen to your parents. You
have parts within that you should not. It must be so, your parents told you
so, and they love you. Realize this, your parents are no more wise than you
are now. In fact, a great deal are more ignorant.
By definition, you must surpass those who have gone before. Otherwise,
why would the universe want and need you? If you were more of the
same, you would not be you. If everything is the same, there is no need for
everything. By definition, if everything is the same, there is no everything,
there is only the sameness.
You know this to be false. You know that you are unique. In your heart,
you know that there is no one else quite like you. Revel in your uniqueness,
the vital role you fulfill in the universe. If the universe created you, it needs
you. Nothing exists superfluous, otherwise it would not BE. Vitality, that of
“vital-ness.” Live your vitality, your “vital-ness” to the universe.
130 131
How to reconcile these two ideas? On the one hand, you are unique, like
no other. On the other, you have no thought that is unique. These two
statements mean that all which comprises you is present everywhere else,
just not in the same combination. You are comprised of the same cosmic
energy as the entire universe in a unique form. From the same scale we can
produce an infinite variation of music. You are a combination of notes, a
song, that is part of the grand symphony of the universe.
You must become solitary, undivided. Only then can you enter the bridal
chamber, the place of wholeness. Marriage is a metaphor for joining and
balance. A human being is balanced when its polarities are balanced. When
its positive and negative, when its masculine and feminine, are balanced, a
human is solitary. When you are balanced you can enter into marriage, or
perfection. You must balance yourself in order to join the infinite. We must
fall into love before we can love eternally.
.”
Pearl of Wisdom
From research I discovered that this is a common parable. It is about a
merchant who went on a journey. He traveled far and wide gathering goods
to sell. Upon the return trip to his own country he found a priceless pearl.
Instead of carting dozens of packages and trinkets, he traded all that he had
for this one jewel. When his ship wrecked upon rough seas, he kept his
wealth, whereas, all of the other merchants lost everything.
The priceless object is the Self. You always have you and you cannot lose
you. True, you can misidentify yourself with this finite incarnation, and
this dies. But your true self never dies. Invest in discovering your true self.
Surrender everything that is finite, slough off all of these objects to which
you identify yourself. As long as you invest in the finite, you will forever lose
your wealth. There is no way to foresee every possible occurrence from a
finite perspective.
More simply, you are using a finite mind to conceive of the infinite. You are
at a disadvantage to say the least. Rather than trying to discover more about
what is going to disappear, search for that which is persists. Wherever you
are, your self is there. Yet most people define themselves in terms of external
objects that disappear. Can you really define the infinite by the finite? Of
course not. It is a logical impossibility to define that which never changes in
terms of what always changes. It makes more sense to define the changing in
terms of the unchanging.
This is the purpose for all of us. Once we understand the feelings of sensory
life, we are to define experience in terms of our selves. More clearly, once
you know what you are, you know what you feel. The way to know what
you are is to bring yourself into alignment. That is what masters seek to
show you. They seek to show you how to know yourself. They provide the
tools for infinite wealth and immortality; to live forever in bliss.
I would like to posit an interesting idea for advanced seekers. What would it
feel like to know everything all of the time forever? Yes, it might get boring.
Do you think that you might want to forget what you know sometimes?
Do you imagine that you may want to feel the quietude of ignorance?
You would and you did. That is correct, you have known the all, and you
wanted to forget it. Only by forgetting could you feel the joy of discovery.
Now you want to know again.
NOTE: May want to insert parable “There was a father once.”
Invest in that which is always there, invest in yourself. I read a wonderful
story about a family that saved money for their children’s educations. I
struggled with it. How can I save money for my son’s education when
money diminishes in value?
I decided to invest in land. It always appreciates in value. Until I realized
that even land may be lost through imminent domain. That is right, one
group of people may arbitrarily decide that my investment in my son’s
future may be better spent somewhere else. “Hmph,” I thought, “What can
I do to prepare for my son’s future?”
To this question I received the answer, “To invest into the future, invest in
today, for the future is comes from today.” This response seems obvious.
What is not so intuitive, is how to accomplish it. How does one invest in
today? Invest into yourself. You are going to be wherever you are in the
future. You will always be with you, so if you invest in you; You can never
lose.
How does this help you children you ask? If you are existent, you will be
able to help them. You worry that you will not be there. At this time, I will
not examine why you worry about where you are not. However, I will say
that you must invest in your children themselves in order to help them.
They will always be with themselves.
So what can you give them that they cannot lose? What can you give that
cannot be taken away? You can give them what you know, those deep truths
that you have within your soul. Because most of us have no deep truths,
we have nothing to give. More clearly, our truths are defined in terms of
external knowledge. Our wisdom is object based.
132 133
Imagine the blacksmith who taught his children smithy right at the dawn of
the industrial revolution. His hard earned knowledge expired. His son had
nothing with which he could invest. Much less, did he have anything he
could invest in. Teach yourself what it is you know. Then show this to your
children. Show them what it feels like to have a question, show them what it
feels like to answer it. Give them the tools you have discovered for knowing
truth. Show them how to use these tools.
These investments never depreciate, they can never be lost. They become
part of the child. Your child will know what it feels like to be wanting, he
or she will now what it feels like to be fulfilled. And just as important, your
child will know how to discover what he or she wants and how to figure out
how to fulfill it.
Each child comes with its own questions and its own internal engine. What
do you think propels it into existence? Its own deep seated desires motivate
itself. All it has to do to feel fulfilled, is to discover what these desires are
and to fulfill them. Many seekers find the path of renunciation and nothing
else. These individuals suppress all of their bodily desires only to come back
to finish them. They birthed themselves into experience, then they try to
deny that experience by explaining it away. If you imagine that you are
born, there is a reason. The reason cannot be that you imagined that you
were born to imagine that you were not born. These are mental games. You
would not need to imagine a body in order to imagine that you did not
have one. You have done all this as consciousness alone. You have a desire
to fulfill. Find it and fulfill it. You are a reason. You are a question that God
asked himself. He wanted to know something, he asked, and she delivered.
Together they make a circle. He asks, she answers. Together they are ONE.
fnd me there.”
One who merges speaks as the master here. The consciousness that merges
with the infinite knows, in the body, that there is no separation between it
and all consciousness. Eternal consciousness pervades all. It is the binding
force of energy underlying the entire manifest world. This consciousness
speaks here, declaring itself the ALL.
It exists not only through specific holy places and persons, but through all
things. It does not take a special religion or language to address it. Each
subject or object can commune with it independently or as a whole. It is as
unlimited as only infinite truth can be.
(78) Jesus said, “Why have you come out into the desert? To see a
reed shaken by the wind? And to see a man clothed in fne garments
like your kings and your great men? Upon them are the fne
garments, and they are unable to discern the truth.”
You Are Tiny Yet All Encompassing
Rhetorically, the master asks, “Why did you come to see him?” He answers
that it cannot be for the external trappings of glory, for you can get those
at home. In your city you can see fine garments, though underneath you
find individuals who cannot “discern the truth.” In other words, you come
out to the desert to find one who knows. Out at the fringes of the habitable
world, in the allegedly uninhabitable, you find the master. He or she knows
the immortal reality is from direct experience.
Ironic. Those who know so much in this world, as wise as they are, they
have not answered the most important of questions, “What is there
that never passes away?” Furthermore, most of those who have allegedly
answered, they do not live as if they believe their answers. In other words,
the so called masters of spirituality rarely live what they are so busy telling
you that they know.
Lastly, there are masters who have experienced the divine reality, but even
fewer of them can tell you how to live in this now. Their perfection is
outdated for you.
The fact that you are reading this book shows that it is your time for you.
Everything you have seen and done during this finite life is meaningful.
Earth alone is 4.5 billion years old by our current radioactive carbon dating
system. Your measly 100 years out of 4,500,000,000 is not much time. It
gets better. I know you always get worried when I tell you things are about
to get better, it usually means “worse,” by regular standards.
The Earth is roughly 8,000 miles in diameter, which means that you can
draw a line of this distance right through the center of it. Our solar system
extends to approximately 8,000,000,000 miles across. Even the Earth is less
than 1 to 1,000,000th the size of our solar system which is so small as to
be insignificant in the Milky Way, our galaxy. There are millions of these
galaxies in the known universe. You are less than 6 feet to 8,000 miles. Need
I do further arithmetic? I think not.
This math is not only to crush any belief in personal gravity, it is to show
that all that we hold so dear covers an insignificant amount of space even by
basic standards of physics. We are not even using extremely large or small
numbers. In our simple model of Earth we are a specks!
Yet, you know of your own importance. In fact, you are tantamount to
everything you cognize. You loom massive in any cognition of reality you
attempt. Again, “Wherever you go, there you are.” Even in the example
134 135
above, you are more massive than the Milky Way. “What?,” You say. That is
right, try to think of the Milky Way without using yourself. It is impossible,
for you are present to you when the Milky Way is not. You always exist to
yourself. The point of the exercise above, is to show you several key things:
1. You are tiny when compared to the objective scientific world. 2. You are
massive compared to the subjective scientific world. 3. All conceptions of
reality, because they come from within, outweigh any amount of external
science. 4. Your self importance is true for yourself, and hence, what you
personally know about reality is all that matters.
The only thing that you know is that you exist. From this, you must refine
your conception of yourself in order to know reality. This does not mean
that one needs to ditch all external science. Use it as a tool, a model for
viewing and describing “reality.” Models approximate reality in order to
allow one to make predictions and choices in very select circumstances. No
model can capture the infinite as that would make it finite. All scientific
models are conceptions with specific applications.
Knowing yourselves takes much more dedication then most people are
familiar with. You dedicate at least twelve years of elementary through
secondary school learning how to communicate in society. How long
do you spend learning to communicate with yourself? To learn subject
familiarization, you spend at least two years on major subject courses for the
bachelor’s degree. For mastery, you generally add two more years. For the
doctorate add about another three years for difficult subjects.
You spend nary a thought on yourself for many decades. Aim for a world
where people know what they are and what they are studying. The two
together make for perfection, within and without.. This.’”
Jesus compares the womb and breasts of the woman in the material world,
to that of the consciousness in the nonmaterial realm. You are the womb
which gives birth to your next incarnation. You are the one who guarantees
that you will die to be born again. Because you chase after the mortal, you
become mortal. When you chase after the immortal, you become immortal.
We Are What We Eat
Take for example the habitats of predators and their favorite prey. They
share the same habitats. When you chase something ceaselessly, you begin
to take upon you characteristics of that goal. Listen to the wisdom of the
ancient adage, “You are what you eat?” What physical substances actually
comprise your body? Your food. So, what are we in society today?
We are sweet without substance, large with emptiness, and chemically deep
with shallow lives.
We eat sugar substitutes or white sugar itself. Our bodies are massive with
empty calories, and our meat is comprised of hormonal supercharged
animals that live in cages. They live short shallow existences.
When your consciousness no longer create your future bodies, then your
wombs have not conceived. When you no longer feed your empty desires
for the future, your breasts do not give milk. When you do not fertilize
your seed for another death and life with unfulfilled desires, then you are
immortal.
Take the simple example of the physical body alone. Most of us want to be
taller or faster. These two things alone are enough to bring about at least
one more death and life. What these desires mean, is that we want more of
this world. When we no longer seek more of this world, we are immortal.
Although you may understand the futility of wanting more, that does not
mean that you can “think” your way out of life. Your desires have to be
fulfilled, not suppressed. These ideas show why you have to “live” life to
avoid dying. If you live your life waiting for something, then that thing has
to come. If you dream of a heaven where you see everyone you know again,
doing the same things, that is what you get.
A visual helps to see these desires for heaven as the milk for you next birth.
Ask most people what they dream of. They dream that they will have
unlimited youth and sex. Health and wealth. Children and toys. All of these
things can be gained on Earth. Do we need another heaven to get them?
No. Look all around you; You see heaven and hell right here. You can be
born in the hell of poverty, or the heaven of wealth. These are what keep
you in Earth life. There is no shame at being human. It is a privilege that we
all die to gain. When you have fulfilled your dreams, you are done. The key
then, again, is to discover which dreams come from within you and which
are societal layers piled upon you. Your dreams enable you to return to
immortality, for it was your dreams which made you mortal.
(80) Jesus said, “He who has recognized the world has found the
body, but he who has found the body is superior to the world.”
Transcend the Body, the World
When you hear the universe laugh, you witness irony, the humor of the
absolute. Masters speak in many ironies. There are two main layers to this
verse. First, there is the physical. The world is the manifested body of the
136 137
cosmic consciousness. The consciousness of the universe decided to commit
part of itself to the physical. Thus, the manifest world IS the body of God.
Once you recognize the body of God as such, you transcend it, you become
“superior” to it.
Next, the material world is finite and ever-changing. When you recognize
that the world is finite, you have discovered the body. You see the perishable
nature of the body, you transcend it. You know that the body is finite, you
become infinite. You can never become finite, for you will always be with
yourself. You are always You, just ask yourself. Can you conceive of a time
where you are not? No you cannot, for you are not there to conceive of it.
And if you are there to conceive, then you are there.
NOTE: Possible elaboration or clarifcation of above paragraph.
(81) Jesus said, “Let him who has grown rich be king, and let him
who possesses power renounce it.”
Richness in mystic schools consists of possession of the self. When you
possess the self, you have the only thing which you can ever really possess.
You can only have that which can never be taken away. True ownership is
achieved in a timeless sense. This is wealth. Everything else you capture in
this world is transient. The fact that you had to secure something proves
that there exists a time when you do not have this object. Realization
implies realizing that you have always had yourself, and that you always will.
You become the richest by holding that which you have ever had, instead of
by chasing that which you never will have.
(82) Jesus said, “He who is near me is near the fre, and he who is
far from me is far from the kingdom.”
Stand in the presence of the master. His inner light of truth illuminates
truth and falsehood alike. When you are false, you feel a burn in his
presence. When you are true, you feel warmth. A person who gets burned
by a fire stays away from it, he who feels its warmth stays near. He who is
false avoids the realized soul who burns his lies. He who is true stays near to
the warmth of the Kingdom of Truth.
So, you might say, the televangelist makes you feel warm inside. So go closer
to him. You may say that I burn you, so I must be false. The truth never
burns truth, but it always burns the false. So if your master does not burn
anyone, he is not a master. If you are truth, you are warmed and comforted
by him. If you are lies, you are burned and discomforted.
(83) Jesus said, “The images are manifest to man, but the light
in them remains concealed in the image of the light of the father.
He will become manifest, but his image will remain concealed
by his light.”
See the Light Everywhere and You are EnLIGHTened
When you have one light next to another much brighter one, you only see
the brightest. Take the sun and the stars. During the day, all you can see is
the local star, Sol. At night, you can see the other more distant bodies. Jesus
states that although all things are self-illuminating, man cannot see them.
He loses them in the “light of the father.”
Again, the father is the Universal, the Absolute, the enlightening principle
itself. Although it becomes manifest through the universe, it is concealed by
its own light. When you realize your infinite self, you cannot see it directly.
Can the light illuminate itself? Ludicrous. The light is the light. It cannot
illuminate that which it is. Can the water wet itself? Can space envelop
itself? Or can fire burn itself? None. Nunca.
You can know your illumination by that around you. When everything
you see is bright as if from inner light, you have succeeded. When you
illuminate all around, you are.
(84) Jesus said, “When you see your likeness, you rejoice. But when
you see your images which came into being before you, and which
neither die not become manifest, how much you will have to bear!”
When you see your likeness upon this Earth, that which you look like, you
rejoice in it. But when you see your images, your eternal self, which came
into being before your likeness; and you fail to manifest it, you are crushed.
You cannot bear the fact that your eternal self is not here. It is a burden to
bear to know that you are greater than you have been behaving as.
NOTE: Elaborate or rewrite
(85) Jesus said, “Adam came into being from a great power and a
great wealth, but he did not become worthy of you. For had he been
worthy, he would not have experienced death.”
The Worthy Seize Immortality from Themselves
To Jesus audience, their ancestor Adam is nearly worshipped. Father
Abraham, and all of the progenitors are looked upon with honor. For this
young man to challenge the worthiness of a patriarch is quite audacious.
Masters are nothing if not apparently bold. They must be, to challenge the
truths of their days. He explains the justification for this courage.
138 139
If these ancestors were so great, they would not have died. They would have
enjoyed eternal life.
This idea of immortality begs the question, if these masters are so great,
why are they dead? You don’t “see” them. The finite can never conceive of
the infinite. You cannot put something which always is, into something
which is changing. The immortal outlasts the mortal. You cannot, in your
present state conceive of the unchanging. You yourself are changing at this
very moment. Think of the physical realm as moving with a common rate
of change. As long as your movement is that of a different rate as everything
else, the world appears changing.
When you match your momentum to that of the rest of the universe, it
no longer appears in motion. Think of the universe like a train. If you are
running down the train cars, it always seems different. If you stand still,
you are really moving at the same rate as the train. When you are moving at
this constant rate, or are steady, you see the entire world as one. This is the
goal for this life. To slow your course corrections, to stop moving enough to
allow yourself to match the rest of the universe. Once you match everything
is in harmony.
NOTE: Possible re-word of this paragraph above.
Think of yourself as an arrow shot at a target. You started course correcting
one day in order to meet your target quicker. Your corrections pushed
you off course. Rather than to keep correcting, you must allow your past
changes to cascade. This is renunciation, finding out what all of your history
has created. Once you know what you are now, you have matched the
background. Then, all of your actions are in harmony with everything else.
So where is Adam? He has either ascended to perfection in perfect balance,
or he is walking amongst us. He could be you, or anyone you know. How
is one to know the difference between an Adam and a Jesus? Either by
realizing yourself or by witnessing a realized soul, you can know whether a
person is immortal. Reading about them may help you to know. Better yet,
walk the path yourself.
( 86) Jesus said, “The foxes have their holes and the birds have their
nests, but the son of man has no place to lay his head and rest.”
To the Immortal All Places are Home
We are all born of God, then we are placed into corporeal existence. When
we can birth ourselves back into immortality while in physical incarnation,
we become the sons of man by Jesus doctrine. It is involved logic to me. I
say, that we are immortal, and that we must realize this.
When you are born of yourself, you are born from the immortal to the
immortal. You are self-evident and self-contained. You are truth. When
you are truth, do you need a place for your body, for your head? No. When
you are born of yourself, you always have this immortal core. You need no
place outside of yourself. You want no place outside of yourself. You rest in
yourself with yourself. You always have a place to call home.
(87) Jesus said, “Wretched is the body that is dependent upon a
body, and wretched is the soul that is dependent on these two.”
Wretched is the Person Dependent Upon Flesh
A body dependent upon a body is condemned to death. It is finitude
dependent upon the finite. A soul dependent upon these two is wretched as
well. It imagines itself finite, hence, it dies to be reborn endlessly. A body is
by definition dependent upon the soul, it has no energy source without it.
A soul is not dependent upon a body, but to effect change on this plane
in this now, it IS. In other words, to affect the mortal, one must take a
mortal existence. To remain immortal, one only has to be aware of one’s
immortality. Thinking about your immortality will not help.
Try teaching a child to do the right thing without the physical world.
Shelter the child and teach it from books. What happens when you release
the baby into the world later in life? You get dangers to the child and others.
It has no personal experience of that which you taught, it is all just vapors
to them. They become willing slaves to any who can present a cogent
argument. They have no feeling for the truth from experience with which to
verify.
They believe that logical accuracy in the absence of reality is truth. They
seek things to prove that which they were taught to believe instead of
experiencing life and knowing what truth feels like. They do not gravitate to
the truth, they search for feeling like they did in your sheltered household.
They seek the feeling that they get when someone shelters them from
difficult details. This is the life they seek, a recipe for disaster. They have no
abilities to conquer actual reality.
When you have been taught to feel and know the truth and then sent to
experience the false, you know the feeling of inner truth contrasted against
outer falsehood. When you have been taught the so called truth, and never
felt the contrast to it by experience, you think that truth is a feeling of
comfort. This is not always the case. Do not seek comfort as your guidepost
to truth. Comfort often leads you to great company if you enjoy the
companionship of the childish.
Truth finds comfort in and of itself. When it condescends to interact with
the false, it knows the festering of falsehood. Feel this contrast. Until you
are truth, seek this convergence zone. You will recognize this transition area
140 141
between truth and falsehood. Remain here until you know what your truth
is. Discover it within by mapping it against falsehoods without. This shows
you your truth. Then perform in your niche. In harmony you become at
peace.
If your role is that of a warrior, you will know peace only when acting as a
warrior. If you are a coward, you will only know peace when you are afraid
and surrendering. Know what you are within, then you find the harmonious
without. Do not mistake old behavior for peace. In this world of many
forms, old behavior is comfortable, new behavior is discomforting. Neither
is necessarily reflective of your truth. You must discover what you are by
eliminating external leeches to your consciousness. Then you slowly re-
add them to your experience. Once you are stabilized, you can know what
you are with respect to these external manifestations of consciousness. You
enjoy them, but you are no longer dependent upon them. NOTE: Possible
insertion of battered individual story. Bad feels good and good feels bad.
(88) Jesus said, “The angels and the prophets will come to you and
give to you those things you (already) have. And you too, give them
those things which you have, and say to yourselves, ‘When will they
come and take what is theirs?’”
You are the Arbiter of Your Own Immortality
To most listeners, the angels and the prophets come to give immortality.
You award them with the same, immortality. You say that they are immortal
and you worship them with words and physical honors. Yet in reality,
they are giving you immortality, and you are not accepting it. You accept
mortality, and give it back. Thus, you die, and their messages die in your
ears. For you assign mortality to them, for that is all you have.
Yet mortality belongs to no one. It changes constantly, and never lasts. It
is finite, therefore UNREAL. You cannot surrender mortality nor can you
receive it. You may imagine that you have it, but you do not. For anything
that changes possession never really belongs to those who imagine that they
own it. We buy property, but do we really own it? Buy a piece of land, go
take a look at it and then sell it. Take a look again, see any difference? Nope.
You imagine you own the land for a time, but you do not, as it has never
changed hands. Only a piece of paper has floated around. The true possessor
of the land is Earth, by definition, land is part of Earth. Technically all that
imagine that they are the body alone, they belong to Earth as well. From the
global perspective, matter remains unchanged. Becoming immortal can be
thought of as widening one’s perspective until you see everything as ONE.
When you know that all is really one, all encompassing infinite, you become
one with that immortality. You become that One. For example, you think
that you are the body, you believe that you are mortal. So you identify with
country, Rome. Yet Rome comes and goes, so you identify with nation, you
are Latin. Then again, Latin becomes mixed, so you become Religion. The
Essenes are gone and thus mortal, so you identify with humanity. Then
again where are the dinosaurs? Species come and go too. You choose living
organisms which were not here 4.5 billion years ago. How about matter?
OK, light a fire and burn the matter, now it is all gas. Jump to the end of
this logic loop and become energy. When you identify with energy you are
the entire manifested universe. You know this, you know all.
(89) Jesus said, “Why do you wash the outside of the cup?
Do you not realize that he who made the inside is the same one
who made the outside?”
Seek Within, Not Without
The outside of the cup in this analogy can be thought of as your body, the
inside of the cup your personality. The master always asks why you cleanse
your body without cleansing your mind. You perform all of these rites from
moral admonishments to physical ones. Yet the whole time you neglect your
own logical inconsistencies. You allow one lie to follow you everywhere, the
idea that you are a good person when you know that by your own standards
you are horrible. You create an impossible to reach standard and pretend
that you feel fine even thought you never meet it. You do not feel good
about this. You are ashamed of your failures. Yet deep inside you know that
by definition you cannot be imperfect, otherwise your entire existence is
unreliable.
Understand your perfection, discover what that is, and be that. As long
as you compare yourself to the outside using an imperfect instrument,
yourself, you will fail to meet anything solid. You are relative to your own
standard. You cannot find an absolute until you become absolute. The way
to become absolute is to mercilessly remove the inconsistencies in your
reasoning and behavior with respect to yourself and the rest of the world.
Solidify your logic, and you will find out what you really know. From here,
you can always build. One cannot start with a sliding standard and expect
to find anything other than the relative.
(90) Jesus said, “Come unto me, for my yoke is easy and my
lordship is mild, and you will fnd repose for yourselves.”
A better way to translate this phrase into a workable regimen may be to say,
my yoke is “straightforward.” Their methodology is unwaveringly simple,
but like the Mandelbrot set of numbers, this simplicity produces extremely
complex results. Have very few rules and apply them unceasingly. When
you do this, find repose for your mind.
142 143
“Discover what you are and be that.” Once you know what you are, you are
relaxed because you do not have to do anymore analysis of what you see or
do. You just behave as you do. This is relatively easy and relaxing compared
to calculating a dozen rules all of the time.
NOTE: Story of one-armed judo guy.
Even our weakness becomes an advantage. You probably know the rest of
this sentence: Your greatest strength is also your greatest weakness, right?
Well let’s take it the other way around. If that’s the case, your greatest
weakness is also your greatest strength. If you look at where you are weak,
you can know from that position you have incredible opportunities.
There is a story of a young man who didn’t have a left arm. This young man
wanted to do something athletic so he decided he was going to learn judo.
He went to a judo studio and he met the Sensei and he started training.
The instructor said, “I want you to learn this particular move. So he taught
him the move. The young man practiced that one judo move every single
day. That’s all he would practice. He did that week after week. Finally after
several months of coming in every day, practicing this one judo move he
asked the Sensei, “Why do you have me practice this one move over and
over again? How can I ever learn judo and be good in judo if I only know
this one move? Sensei replied, “You need only one move. You can do
anything with this one move.” The next month his Sensei took him to a
tournament and in this tournament he fought for awhile and he did quite
well and he actually pinned his opponent and won his first match. The
second one was a little more difficult but as it went along he finally did his
one move again and he pinned his next opponent. In the finals he had his
opportunity to use his one move and he won the tournament. On the way
home he talked to his instructor and he said, “How is it that I was able to
win this tournament with only one move?” Sensei replied, “Two reasons:
the move I taught you is the hardest move to learn in judo and secondly, the
only counter to that move is to grab the left arm.”
Your greatest weakness is an opportunity which gives you the greatest
strength you ever could imagine.
Whoever wants to become great among you must be your servant. And then
the greatest among you will be your servant. Whoever exalts himself will be
humbled and whoever humbles himself will be exalted.
.”
See the Infinite All Around You
Not for the fist time, students ask a master how to know that he is a master.
They want him to teach what he is by comparative analysis. Very simply
Jesus rebukes them. They can see the sky and Earth for what they are
without comparing them to others, yet they cannot see Him. Because they
cannot see him, he rightly explains that they cannot read a moment, much
less anything else.
(92) Jesus said, “Seek and you will fnd. Yet, what you asked me
about in former times and which I did not tell you then, now I do
desire to tell, but you do not inquire after it.”
Here the man of Galilee hints at his past. He says that he was asked in
“former times” for something and that he did not give it. Now he is ready
to tell it, but they do not ask about “it” anymore. What are “former times,”
and what is “it?”
First, “former times” is a way for a master to refer to a different lifetime. In
these former times, Jesus WAS, and the questioners WERE as well. What
did ancients ask that he did not answer? They asked about the secrets of
eternal life. Jesus had no desire to tell them the secrets then. He may have
had many reasons. One reason, is that they did not have the faculties to
comprehend the secrets.
Dissemination of the truth to those who cannot comprehend it hinders
progress. This does not mean that you withhold the truth, it means that you
answer the breadth of their questions as best as they can understand. You
do not tell children about subatomic particles when they cannot conceive of
atomic particles. You stick to the language they speak minimizing any future
contradictions.
When a seeker went to ancient master in the East, he had to “bring the
firewood.” In those times, this was life. The questor brought life to the
master in order to illustrate his commitment to learning. By surrendering
all that he had materially, he showed his willingness to sacrifice all that he
thought that he was, for what he truly is.
(93) Jesus said, “Do not give what is holy to dogs, lest they throw
them on the dung-heap. Do not throw the pearls to swine, lest they
[...] it [...].”
Pearls Before Swine
These common sentiments explain both the previous verses and many
future ones. You do not give that which is priceless to dogs. You do not give
the pearls of your wisdom to those who are only interested in what they can
physically eat.
144 145
A pig has no use for pearls, if it does not serve the animal’s material interests
it is not revered.
A master rarely shares his wisdom with the ignorant. Those of you who do
not understand what they say have no need for it. In fact, you will desecrate
and demean it.
(94) Jesus said, “He who seeks will fnd, and he who knocks will be
let in.”
Ask and Ye Shall Receive
The rule of the universe is “Ask and ye shall receive.” This means that
you must sincerely ask for grace. Not that you ask for free gifts. You pay
for everything, so you must be willing to trade for that which you want.
Sometimes the asking itself is the payment, and other times there are
additional installments.
Willingness is all that is asked. You never know when it will be converted.
Like the old mafia movies, you owe a favor that may never be returned. It is
not for you to decide when the universe needs what it is you have promised.
The idea of grace comes from the fact that you in fact possess nothing
that can be taken or given away. Also, your first inheritance as spirit, or
incarnation IS grace. God, the universe, gave it to you out of love of itself;
love of you. All that belongs to you belongs to the universe. As needed, you
serve each other.
(95) Jesus said, “If you have money, do not lend it at interest, but
give it to one from whom you will not get it back.”
Masters state that you ought to give away what you have earned to those
whom will not return it. The simplest way to read this phrase is do action
without reaction. Break the karmic cycle. As long as you do with thought
of return, you are sowing the seeds of death and future birth. Work
without thought of anything other than the action you perform. When you
negotiate for money negotiate for money. When you earn money, earn that
which you negotiated for. Do not negotiate for that which you are working,
work for it. Do not work for that which you are negotiating for; negotiate
for it.
Also, when giving away things, most people are storing in the cosmic bank
account. They really do charity, for “God will return it tenfold.” These are
not charitable people, they are business persons making investments. Ten to
one? Not a bad return on your investment (ROI)? Furthermore, they want
to get paid twice. They get the good feeling of charity, and then they want
the tenfold increase. This is theft.
Therefore, give to those who do not give back, so you are sure not to be
investing in the karmic bank account.
(96) Jesus said, “The kingdom of the father is like a certain woman.
She took a little leaven, concealed it in some dough, and made it
into large loaves. Let him who has ears hear.”
The Kingdom of heaven is the immortal truth. It is dense and fertile. This
apparently small amount can fuel the growth of greatness. Take your truth
and place it where it can buttress. Goddess also hid the soul in the body to
give it life. When it grew within it made the dead matter living and holy.
When it became subordinate to matter, the soul decayed. Imagine the yeast,
or leaven getting subordinated by the rest of the inactive dough. This is how
the world generally is today. People take truth and pollute it with falsehood.
NOTE: May want more examples of Goddess
.”
You have the truth, the kingdom of heaven, yet you do not realize it. You
wander down the road, with your materials in a sack. Along the path of
life, you spring a leak, dropping your meal everywhere. When you finally
get to your home, you find that you possess nothing. You have misplaced
your eternal truth somewhere along the road. You did not even notice! Find
your truth, you still have it within. It is too late to stop from losing track of
yourself, you must rediscover it. Most people are trying to hold onto what
you no longer have within their focus.
(98) Jesus said, “The kingdom of the father is like a certain man
who wanted to kill a powerful man. In his own house he drew his
sword and stuck it into the wall in order to fnd out whether his hand
could carry through. Then he slew the powerful man.”
Test Yourself, Then Apply
You are both the house, the killer, the sword, and the powerful man. You
create yourself by desires. Within this person exists the seed of truth,
or the kingdom of heaven. It seeks to test itself within itself to verify its
efficacy. Then, it spreads. So step by step, your truth cuts through lies and
146 147
misconceptions. You test it upon your own internal illogic, then you spread
it to your external lies. This analogy can be stretched to the entire world if
necessary. You to yourself. Yourself to those around you. Those around you
to those around them.
(99) The disciples said to him, “Your brothers and your mother are
standing outside.” He said to them, “Those here who do the will of my
father are my brothers and my mother. It is they who will enter the
kingdom of my father.”
Spiritual Brothers and Sisters
To the worldly man family lines are drawn by blood relations. To the master,
brotherhood is determined by spiritual lines. I call my mother sister.. I
call my closest friends, brothers and sisters alike. To us, when we are of
common purpose we are family. When we are divided, we are not. There is
no we when we are not of one purpose. Those who live the truth enter into
it, those who do not, remain in lies. We are moving beyond the world of
division in the human family. Those who embrace their truth within and
become their own masters will all be one family.
(100) They showed Jesus a gold coin and said to him, “Caesar’s men
demand taxes from us.” He said to them, “Give Caesar what belongs
to Caesar, give God what belongs to God, and give me what is mine.”
House Rules—Render Unto Caesar
This is a test of Jesus. People are trying to get him to become a subversive.
They want him to say that he owes no taxes, or that he himself outranks
Caesar. Rather than to fall into the trap, he uses the opportunity to fulfill his
message. This is how a master works, everything serves his or her purpose.
Therefore, Jesus states that you should give Caesar, the king of the finite,
more which is finite. Give him your money not your liberty, not your soul.
Next, Jesus says give God what is his. Since everything is God’s and God
always possesses it, this statement sounds like an affirmation, unless, you
contrast it with the earlier sentence about finitude. Then, it means give the
eternal to the eternal. Commit yourself to yourself. You are eternal, and
your soul is eternal. Act accordingly.
Finally he says that you should give him what is his. He demands to be
recognized. All that a messenger asks is acknowledgement. His payment for
delivery of the message is recognition of the message, which in turn, equals
recognition of the messenger. If you honor what he delivers, you honor him.
Tell him the truth.
.”
This incomplete verse refers to statements made earlier. The master hates
the external rules of father’s and mother’s. These guidelines may serve
children, but they hinder the adult. If you only studied information fit
for children, you may never understand anything to any level of depth.
You remain a child yourself. Imagine being forced to wear the diapers of
children, this is what parental admonitions are to a master.
Next, a master does not revere the physical life given by a physical mother.
He or she worships the eternal life granted by the eternal mother, Goddess.
For the mystic, the eternal mother represents experience. She gives us the
manifest world. The way to worship something is to enjoy it for what it is.
To worship the material life, you must experience it in its transient states, a
transitory wonder. Know how temporary the finite world of flowers, wind,
and rain is. When you experience this feeling, your entire world fills with
wonderment and appreciation. What you see now will never be again in
the same way. The world “outside” dances for you, feel the rhythm. NOTE:
Poetry about the union of masculine and feminine may hel p here. These
statements shock most persons, they cannot conceive of their lives in terms
of anything other than this personality that is the source of all of their
miseries. They think that truth is the cause of their pain. They choose illogic
over logic, carefully crafted inconsistencies whose fruit is pain, rather than
simple truths whose fruit is repose.
(102) Jesus said, “Woe to the pharisees, for they are like a dog
sleeping in the manger of oxen, for neither does he eat nor does he let
the oxen eat.”
The Pharisees represent the false religious leaders of both Jesus time and
ours. They sit in your temple and they guard the truth even though they
do not understand it themselves. As if the truth needs to be protected
against falsehood. The UNREAL, that which is untrue, cannot affect the
REAL, that which is true. Ridiculous. These leaders hide the truth which
they cannot consume themselves. You are the oxen that they use to do their
labors. They enslave you as a beast of burden from which they withhold its
rightful produce. Neither do they eat, nor do you.
(103) Jesus said, “Fortunate is the man who knows where the
brigands will enter, so that he may get up, muster his domain, and
arm himself before they invade.”
148 149
Husband Your Liberty
You are fortunate to know that these brigands seek to enter into your heart.
For, you can muster your defenses, your truth, against their falsehoods, lies.
Prepare yourself and yours against encroachments upon your liberty.
.”
Here, the disciples want to fast and pray, they are trying to win favor with
their master, for they believe that he is like the other leaders. These leaders
reward the disciples when they say “holy” things. Not so with Jesus, he is
not fooled. He asks them, what mistake has he made that he needs to fast
and pray? He rhetorically asks, how has he been defeated that he needs to
fast and pray.
Then he answers. He states that when the bridegroom leaves the bridal
chamber, then, they need to fast and pray. He is the bridegroom becoming
one in the self. He is balancing his polarity, his masculine and feminine.
When he has done so, he is one. When he merges with himself, the disciples
need to perform their oblations. Once a master becomes one, you have
a doorway into the infinite, then you worship. A master has no need of
worshipping outside, for he has connected all within. He has but to remain
in himself.
(105) Jesus said, “He who knows the father and the mother
will be called the son of a harlot.”
He who knows the infinite concept as well as the manifest universe will
be called the son of a whore. Here Jesus states that one who knows the
reality will be persecuted. As he loves all equally, he will be called the son
of a whore, who “loves,” anyone. This is how his detractors think of love,
as physical love. This knower will be called no end of names. Those who
do not know the infinite cannot stand to hear otherwise. They slander and
defame all who contradict.
NOTE: May need elaboration
(106) Jesus said, “When you make the two one, you will become the
sons of man, and when you say, ‘Mountain, move away,’ it will move
away.”
Harmony of Self with the Universe
This verse is addressed earlier. When you become one in the self, you birth
yourself. When you birth yourself, you become immortal. When you are
infinite, your desires match pace with the rest of the manifest world. Think
of the man on Earth who moves at the same speed as mercury. He moves
relatively faster, as a result, nothing he aims for does he hit when he expects
to. When you are in harmony with the world, you get everything when you
expect to.
NOTE: Reference earlier verse about “mountain, move,” and insert
example of universe as queued up at the kitchen or server.
.’”
Potential Self-Masters-Wandering Sheep
Sheep are generally cowards with no true individual minds. They move as a
mob. When one who is born can walk his own path, he has a massive ego.
It takes this massive personality to find the truth, as it goes against anything
the sheep mind believe is true. Hence, the largest sheep, or best, is the one
that has its own momentum. It leaves the fold in order to find the REAL.
For these persons, masters always search. They neither seek those who are
the leaders of the current philosophy of the day, nor do they seek those
who only want to replace the current dogma with their own. They want
the “largest sheep,” those with capacity for both greater evil and greater
good. Such is liberty. Only together with the ability to do anything do your
actions show meaning. A master is one who chooses from a menu with
everything on it. If all options are not there, you did not really choose. Or
in other words, doing right with no option of wrong means there was no
choice at all. This is no measure of character.
(108) Jesus said, “He who will drink from my mouth
will become like me. I myself shall become he, and the things
that are hidden will be revealed to him.”
150 151
A master says, those that imbibe what he distributes become like him. If
he is united and one, those who become like him become one. When one
becomes like a master, that person possesses the same knowledge. They
both know what goes unspoken, what is hidden. You become one with the
knower, and the knowledge, you become one with what is now hidden from
your vantage point.
(109) Jesus said, “The kingdom is like a man who had a hidden
treasure in his feld without knowing it. And after he died, he left it
to his son. The son did not know (about the treasure). He inherited
the feld and sold it. And the one who bought it went plowing and
found the treasure. He began to lend money at interest to whomever
he wished.”
Till Yourself to Find Your Eternal Self
The kingdom of heaven, or the truth-you, is hidden within the field given
you by your father. Your body is the field you inherited from your eternal
father. You can nurse the infinite truth within, or you can sow more desires
for mortal life. Most sons inherit this fertile field for truth, instead of
plowing the field for the fulfilling fruit, children sell it for more material
wealth.
Wise students will acquire a field ripe for truth by investing their time into
it. They invest, sacrificing in the field. They sacrifice to get the field and
to sow it. Once they work the field, it sprouts infinite truth. He can give
this truth to all around and it only grows. You only possess something by
worshipping it for what it is. When you use a farm for farming, you are
living. When an artist uses his brush for art, he is living his truth. When you
use yourself for your intended purpose, you worship and flourish.
(110) Jesus said, “Whoever fnds the world and becomes rich, let
him renounce the world.”
Renounce the World
The rich man must surrender his worth, what he has invested in, this
materialism, in order to reach truth. If you find the REAL world, you
become rich. Then renounce this world. This does not mean that you do
not accept anything, or that you give everything you have away. Although,
both methods may serve for a time. In the end, when you truly renounce
future desires, you are wealthy. You possess only desires for the now. You no
longer sow seeds for the future. Find the world all around you, now, then
renounce the so called world that does not exist, the future. If your now is
always perfect, you have no worries for the future.
(111) Jesus said, “The heavens and the earth will be rolled up
in your presence. And the one who lives from the living one will not
see death.” Does not Jesus say, “Whoever fnds himself is superior
to the world?”
SELF is Eternal
When you finally find the eternal self which powers your consciousness, you
have the eternal. This is the you that never changes, that is omnipresent in
your view. Birth yourself from that which never dies, and you will never die.
Thus, birth yourself from your eternal self, and you are superior to the finite
born from the finite world.
NOTE: May need example of perfect living now. A perfect day in a
perfect week, in a perfect month in a perfect year in a perfect life.
(112) Jesus said, “Woe to the fesh that depends on the soul; woe to
the soul that depends on the fesh.”
Merge Soul and Flesh
Woe to the flesh that depends upon the soul for it will die. Woe be to the
soul that depends upon the flesh, for it is trapped in the cycle of birth and
death, of mortality. Do not depend upon that which is finite, you will surely
die. Depend upon that which is immortal, the eternal source for all of your
incarnations, you, your soul. You must merge the two for there to be eternal
life now. Your soul and body must become one.
.”
152 153
As I mentioned earlier, the Kingdom of Heaven, or the eternal truth,
is immortal. Since it is immortal, eternal truth must be timeless, and
omnipresent, or space less as well. Therefore, by logic alone, you can prove
that the truth is always here. If you await eternal truth it will never arrive.
That which arrives was once not here. If truth is ever conditional, it is not
eternal truth. The eternal, by definition, is always present, you just fail.”
Mary, Masculine, and Feminine
As ever, Simon Peter, or Peter as modern Christians know him, is obsessed
with purity. Why would he want someone else to leave the presence of a
master? He must fear that she will hurt either the master or the disciples.
Can another diminish the infinite? No. So she cannot harm Jesus. If this
other person can hurt Peter or his friends, then this person is greater than
they. Thus Peter fears Mary for she is either greater than Jesus, or greater
than he and his compatriots. She is not greater than Jesus, or Jesus would be
learning from her. Hence, she is greater than the disciples.
Yet Jesus tells them not to worry. He says that he will balance her femininity
with masculinity, so that she becomes one. Then her femaleness is balanced
with maleness. What we do not see, is that Jesus is balancing their maleness
with femaleness. The path of realization is different for men and women.
Men think their way into feeling. Women feel their way into thinking.
Remember always though, that woman does not necessarily equal feminine,
nor male, masculine. Both genders must balance themselves to become
perfect.
Conclusion
I hope you have enjoyed this read. Most importantly, remember, it is only
a tool for your own self mastery. If you seek to contact me please send an
Appendix I
Here are some questions I usually give Seekers to help them find themselves
and their life purpose:
1. You are going to die in the next fifteen minutes. What would you want to
say that you were doing?
2. If you were going to die in the next fifteen minutes, what would you
want to say that you did in the world.?
3. If you could change one thing in the world what would it be?
4. If you had to justify your existence, what is the one thing that you would
want to say you did?
5. If you had/wanted to change one thing about the world,
what would it be?
6. What is worth dying for?
a. That is what is worth living for?
7. What is the one thing in the world that you could never accept?
8. OK, accept it. Now that you are willing to accept anything,
you can have everything.
v
154 155
Index
A
Abraham 75
ADHD 103
alcohol 16, 102, 109, 120
androgyny 58
Army 26, 30, 68, 97, 102
ask and ye shall receive 17, 63
atom 9, 24, 36, 60
awareness 12, 19, 25, 50, 53, 81, 88, 91, 96, 106
B
bank 80, 91, 141, 142
bisexuality 58
boils 84
Brahman 53
C
Caesar 5, 143
caste 110
children 14, 16, 19, 20, 33, 44, 56, 57, 63, 71, 72, 75, 77, 80, 81, 84, 85, 87, 92,
97, 103, 121, 128, 129, 140, 144, 147
Christ 18, 45, 53
Confucius 122
consciousness 12, 23, 24, 25, 52, 53, 54, 55, 56, 72, 77, 91, 96, 106, 110, 111,
114, 116, 117, 118, 122, 123, 124, 125, 129, 131, 132, 133, 137, 148
coward
cowardice 108, 110, 137
D
death 11, 45, 46, 47, 49, 51, 53, 65, 78, 83, 91, 107, 116, 132, 134, 136, 141,
148
desire 23, 32, 34, 44, 45, 47, 60, 69, 70, 96, 101, 105, 110, 117, 118, 119, 125,
129, 140
dharma 35, 119
Dhyana 50
dogma 40, 60, 65, 66, 98, 146
Drugs 109
duality 14, 37, 55, 71, 82, 98, 118
E
Edward Leedskalin 65
ego 64, 83, 86, 91, 95, 96, 100, 101, 105, 115, 146
Eternal Life 11, 53
F
feminine 14, 37, 43, 52, 58, 64, 83, 126, 127, 144, 145, 149
fre 28, 34, 35, 37, 38, 39, 43, 44, 45, 46, 87, 94, 100, 102, 133, 134, 138
G
Genesis 13, 16, 71
Gertie 52
Gluttony 62
God 14, 16, 18, 19, 27, 31, 33, 35, 39, 48, 51, 53, 54, 55, 61, 62, 66, 67, 70, 71,
72, 75, 80, 86, 87, 90, 92, 94, 96, 97, 98, 99, 105, 106, 110, 111, 112, 117,
121, 129, 133, 135, 141, 143
Goddess 142, 144
Great Pyramid 66
Gunas 4, 64
H
Heaven 3, 13, 17, 20, 53, 55, 126, 149
Hurricane 3, 34
hypocrisy 37, 43, 44, 61, 63, 80
I
Indra’s Net 18
inertia 64, 88
J
Jesus 1, 11, 12, 13, 14, 15, 16, 18, 19, 20, 21, 25, 26, 27, 28, 29, 34, 35, 36, 37,
38, 39, 40, 42, 43, 44, 45, 46, 49, 53, 56, 57, 58, 59, 60, 61, 62, 64, 65,
67, 68, 69, 70, 71, 72, 73, 75, 76, 78, 79, 80, 81, 83, 85, 86, 87, 89, 91,
93, 94, 95, 96, 101, 103, 107, 111, 112, 113, 115, 116, 118, 126, 127, 129,
130, 131, 132, 133, 134, 135, 136, 137, 138, 140, 141, 142, 143, 144,
145, 146, 147, 148, 149
Joseph Smith 31, 75
K
Karma 15, 98, 111
kingdom of heaven 53, 91, 142, 147, 149
Krishna 18, 53, 100
Kristos 18, 53
L
love 12, 33, 35, 43, 60, 73, 78, 79, 81, 98, 102, 104, 108, 114, 118, 125, 126,
127, 141, 144, 145
M
masculine 14, 37, 43, 52, 58, 64, 83, 126, 127, 144, 145, 149
Mohammed 34, 91, 118
156 157
Money changers 3, 28
Mumakshatwa 119
Mustard Seed 29
N
Newton 15
P
parable 18, 28, 47, 103, 108, 111, 117, 127, 128
perfection 11, 67
pharisees 11, 67
physics 22, 37, 50, 60, 65, 130
polarity 37, 76, 82, 145
Prophet 27
Q
quantum physics 64
R
Rajas 64
Reincarnation 3, 11
revolutionary 27
S
Salome 95, 96
Samadhi 23, 50, 56
Samyama 4, 50, 51
Sattva 64
self 8, 9, 10, 11, 15, 18, 19, 25, 27, 28, 30, 32, 34, 37, 39, 41, 43, 46, 66, 67, 72,
76, 79, 81, 82, 84, 85, 86, 87, 92, 95, 96, 97, 98, 101, 105, 108, 109, 111,
113, 114, 115, 116, 118, 125, 126, 127, 131, 133, 134, 136, 145, 146, 148,
149
Sex 14, 109
slavery 16, 28, 44, 93, 116, 118
soul 11, 12, 16, 19, 28, 35, 36, 38, 41, 42, 45, 46, 49, 51, 56, 57, 59, 60, 62, 64,
70, 71, 72, 73, 74, 75, 78, 81, 83, 84, 85, 95, 96, 97, 98, 99, 100, 101,
102, 105, 106, 112, 113, 114, 119, 126, 128, 133, 135, 136, 142, 143, 148
T
Tamas 64
Tao 53, 98
Thoreau
Henry David Thoreau 124
U
unconscious 19, 21, 25, 36, 58
Upanishad 33, 77
V
Vasanas 34
Vedanta 17, 29, 32, 74
W
wisdom 10, 19, 26, 31, 33, 38, 44, 67, 74, 84, 90, 96, 114, 122, 128, 132, 140,
141
Y
yoga 50, 84, 98
Y’shua 11, 67
158
This action might not be possible to undo. Are you sure you want to continue?
|
https://pt.scribd.com/doc/2057648/What-Jesus-Told-Me-2007-Revised-2012
|
CC-MAIN-2016-07
|
en
|
refinedweb
|
According any debate like that, there’s no unique solution, it depends on many factors.In this article we try using JavaDepend to discover PureMVC indepth, and talk about the main difference between it and the other variants.
PureMVC was popularized first by Flex and Flash developers, but it was ported after to many other langugages.The following GWT sample use the java PureMVC framework, let’s analyze it to explore PureMVC concepts.
PureMVC basic Concepts
Here’s the structure of the project
This structure shows the main PureMVC concepts:
The PureMVC best practices encourage developers to put each actor into a specific namespace , to modularize better the application.
Here’s the graph representing the communication between all namespaces.
There’s no dependency cycle, it’s well layered what makes it very clear and simple to understand.
The matrix gives us more details about dependency weight between all namespaces.
The PureMVC glue
To go deep inside the sample let’s discover the dependency graph between all classes
What’s interesting in this dependency graph, is that almost all classes uses INotification.
PureMVC use the publish-subscribe pattern to communicate between all actors(Model,View,Controler), and for this reason INotification is mainly used, and to check that let’s discover the most popular types, for that we can use the TypeRank metric.
SELECT TOP 100 TYPES ORDER BY TypeRank DESC, TypeCa DESC
The three most popular types concern notification mechanism, what’s proof that this concept is the glue of PureMVC framework, almost all communication between actors use notification, that make them less coupled..
This allows asynchronous, event-driven communications between the actors of the system, and also promotes a loose coupling between those actors, since the subscriber never needs to have direct knowledge of the publisher.
For our sample we can search for all classes using Notifier class to notify other actors.
SELECT METHODS FROM JARS "PureMVC" WHERE
IsDirectlyUsing "org.puremvc.java.multicore.patterns.observer.Notifier"
Almost all actors: Mediators,Commands and proxies use the notification mechanism to communicate with each others.
Here’s a concrete example of adding a new user from view.
In this sample the mediator ask the proxy to add a user and after send a notification to inform all other components that a user was added.
What’s interesting to note here is the fact that the mediator communicate directly with the proxy, in PureMVC, proxies cant act as subscribers, and can only publish notification.
Inside PureMVC Concepts
Facade
- Facade is singleton
If we search where the facade is instantiated
SELECT METHODS WHERE
DepthOfCreateA "org.puremvc.java.multicore.patterns.facade.Facade" == 1
Only one static method getInstance instantiate it, but this method has one parameter, so we can create many facades, each component has its own singleton facade identified by a name, and it’s why we talk about PureMVC MultiCore.
- Facade Initialisation:
SELECT METHODS WHERE
IsDirectlyUsedBy "org.puremvc.java.multicore.patterns.facade.Facade"
The facade initialize all other actors.
- Facade and notification:
The facade caches all actors, and when a notification is published, the facade notify all observers.
Commands
Let’s search for all methods used by DeleteUserCommand, the command responsable of deleting a user.
SELECT METHODS WHERE
IsDirectlyUsedBy "org.puremvc.java.multicore.demos.gwt.employeeadmin.controller.DeleteUserCommand"
The command doesn’t communicate directly with other components, except for the proxy as we observed before.
Mediators
SELECT METHODS WHERE
IsDirectlyUsedBy "org.puremvc.java.multicore.demos.gwt.employeeadmin.view.UserFormMediator"
Like Commands, mediators use mainly notifications to interact with other classes except for proxies.
Proxies
The question that makes a difference using PureMVC and gives us three more other variants is:
who communicate with the proxy?
Here we can differentiate between three ways used by developers using PureMVC:
- Only Commands use proxies: we suppose that only commands have to abstract the logic of the application, this solution makes the code more reusable, for example deleteuser could be used by many classes, and if this logic exist in mediator instead of command, we have to duplicate the code if another mediator need to also delete a user.
- Commands and mediators use the proxy:For our sample it’s what happens.The AddUser is invoked from a mediator and the deleteuser from a command.
- Only Mediators use proxies and commands are used only for startup: Some developers prefer not use Commands and use only Mediators, to not add more classes and maybe more complexity to the code.
The main difference between PureMVC and the other variants, is the way that all actors communicate with each others, PureMVC choose the asynchrounous and the less coupled solution.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
|
http://www.codeproject.com/Articles/294768/Exploring-another-MVC-variant-PureMVC
|
CC-MAIN-2016-07
|
en
|
refinedweb
|
Results 1 to 3 of 3
Thread: Naming a Switch Statement? Help!
- Join Date
- Dec 2010
- 8
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Naming a Switch Statement? Help!
Hi,
I have come across this question during my school assignment, and would appreciate some help since this is a new topic for me, I have provided the code I have written so far at the bottom. Basically I'm trying to name my 'cases' so a book can be entered rather than a number as in conjunction with switch cases.
1. Switch to Philip K Dick books
Code:
Program Names : DickBooks.java Example Input/Output: A A Scanner Darkly V Valis O Our Friends From Frolix 8 U Ubik D Do Androids Dream of Electric Sheep? Choose a novel from menu above: u You chose "Ubik"
Use a switch statement to pick a novel by entering the correct character.
• Allow the user to enter upper or lower case.
If the novel is not on the list the program should output this exact string including a newline on the end:
Code:
That novel is not on the list
Code:
package assignment3; import java.util.Scanner; public class DickBooks { public static void main(String[] args) { int novel; Scanner daniel = new Scanner(System.in); System.out.print("Choose a novel from menu above:"); novel = 1; System.out.println("You chose\n" + novel); switch (novel) { case 1: System.out.println("A Scanner Darkly"); break; case 2: System.out.println("Valis"); break; case 3: System.out.println("Our Friends From Frolix 8"); break; case 4: System.out.println("Ubik"); break; case 5: System.out.println("Do Androids Dream of Electric Sheep?"); break; default: System.out.println("That novel is not on the list"); System.out.println(scan.nextLine()); System.out.println("Choose a novel from menu above:"); } } }
Last edited by danielinthebed; 03-24-2011 at 05:19 PM.
- Join Date
- Sep 2002
- Location
- Saskatoon, Saskatchewan
- 17,027
- Thanks
- 4
- Thanked 2,668 Times in 2,637 Posts
I'm not sure exactly what your question here is.
You should be able to switch case on a primitive value. You cannot switch case on a string. So either a numerical list or a char list would be fine. If you choose a char list though, you will run into size limitations so you wouldn't be able to grow beyond the size of the charset in use. Given the example you have, it appears the desire should be to construct a list and allow the user to provide the first char of the title. This would then need switching against a double case for each, since case calls are sensitive when comparing chars. It also means that you cannot have two titles that start with the same letter.
The code you have doesn't really do a lot. All it will do is print out "A Scanner Darkly" and end. You need to scan input from a client prior to the switch. Default should only indicate that the book is not in the list.PHP Code:
header('HTTP/1.1 420 Enhance Your Calm');
- Join Date
- May 2006
- Location
- Ontario, Canada
- 392
- Thanks
- 2
- Thanked 20 Times in 20 Posts
A small code example to go with Fou-Lu's comment that may help you.
PHP Code:
import java.util.Scanner;
public class MainCLass {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
System.out.print("Enter the package code: ");
String s = sc.next();
char p = s.charAt(0);
String details = "";
switch (p) {
case 'E':
case 'e':
details += "\tE...\n";
case 'D':
case 'd':
details += "\tD...\n";
case 'C':
case 'c':
details += "\tC...\n";
case 'B':
case 'b':
details += "\tB...\n";
case 'A':
case 'a':
details += "\tA.\n";
break;
default:
details = "That's";
break;
}
System.out.println(details);
}
}
|
http://www.codingforums.com/java-and-jsp/222287-naming-switch-statement-help.html
|
CC-MAIN-2016-07
|
en
|
refinedweb
|
Type: Posts; User: dotnet13
You don't seem to understand a simple Linked List program, before inserting the 1st node head is always null because (*ptrtohead)=&head=null, and after insertion it will have the address of the 1st...
#include <stdio.h>
#include <stdlib.h>
typedef struct Node
{
int data;
struct Node *next;
}node;
Actually everyone here misinterpreted what I have said, what I meant was that asking directly for code is not fair at all. Hope you guys will understand now :) :)
hmm, that's unfair I guess
lol yet to solve and actually even if I find 1 the time complexity will not be great for sure
ya but need efficient ones :( :( help will be really appreciable
3121931221312233122531227
|
http://forums.codeguru.com/search.php?s=6d1deb10baa58f71042bb4f9fd3a7dd2&searchid=8424381
|
CC-MAIN-2016-07
|
en
|
refinedweb
|
Overview
The Python programming language, which emerged in 1994, has really taken hold since the turn of the new millennium. One measure of a language's success is the number of implementations. The best-known and most used implementation of Python is called CPython. There have also been successful projects such as Jython (Python language working on the Java™ runtime) and IronPython (Python language working on the .NET platform). These have all been open source, and Python has always had a large presence in the open source software world.
A long-standing goal for Python implementation is to support pure language design — to "bootstrap" the definition of Python by specifying the language in its own terms, rather than in terms of other languages such as C and Java. The PyPy project is a Python implementation serving this need. PyPy means "Python implemented in Python," though it's actually implemented to a subset of Python called RPython. More precisely, PyPy is a runtime of its own into which you can plug in any language.
The clean language design PyPy allows makes it feasible to build in low-level optimizers with enormous benefit to optimization. In particular, PyPy integrates a just-in-time (JIT) compiler. This is the same technology that famously revolutionized Java performance in the form of HotSpot, acquired by Sun Microsystems from Animorphic in the early 2000s and incorporated into their Java implementation, making the language practical for most uses. Python is already practical for many uses, but performance is the most frequent complaint. PyPy's tracing JIT compiler is already showing how it might revolutionize the performance of Python programs, and even though the project is in what I would characterize as a late beta phase, it is already an essential tool for the Python programmer, and a very useful addition to any developer's toolbox.
In this article, I introduce PyPy without presuming you have an extensive background in Python.
Getting started
First, don't confuse PyPy with PyPI. These are very different projects. The latter is the Python Package Index, a site and system for obtaining third-party Python packages to supplement the standard library. Once you arrive at the correct PyPy site (see Resources) you'll find that the developers have made things easy to try out for most users. If you have Linux®, Mac, or Windows® (except for Windows 64, which isn't yet supported) on recent hardware, you should be able to just download and execute one of the binary packages.
The current version of PyPy is 1.8, which fully implements Python 2.7.2, meaning it should be compatible in language features and behavior with that CPython version. However, it is already much faster than CPython 2.7.2 in many benchmarked uses, which is what really attracts our interest. The following session shows how I installed PyPy on my Ubuntu 11.04 box. It was captured from an earlier release of PyPy, but PyPy 1.8 gives similar results.
$ cd Downloads/ $ wget $ cd ../.local $ tar jxvf ~/Downloads/pypy-1.6-linux.tar.bz2 $ ln -s ~/.local/pypy-1.6/bin/pypy ~/.local/bin/
Now you need to update
$PATH to include
~/.local/bin/. After installing PyPy, I recommend installing Distribute
and Pip as well, to make it easy to install additional packages. (Although
I don't cover it in this article, you might also want to use Virtualenv,
which is a way to keep separate, clean Python environments.) The following
session demonstrates the Distribute and Pip set-up.
$ wget $ wget $ pypy distribute_setup.py $ pypy get-pip.py
You should find library files installed in
~/.local/pypy-1.8/site-packages/, and executables in
~/.local/pypy-1.8/bin, so you might want to add the latter to your
$PATH. Also, make sure you are using the pip
that was just installed, rather than the system-wide pip. After which you
can install the third-party packages used later in this article.
$ pip install html5lib $ pip install pyparsing
Listing 1 is shows output from the PyPy interpreter
after invocation of the Python "easter egg"
import this.
Listing 1. Sample PyPy output
uche@malatesta:~$ pypy Python 2.7.1 (d8ac7d23d3ec, Aug 17 2011, 11:51:18) [PyPy 1.6.0 with GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. And now for something completely different: ``__xxx__ and __rxxx__ vs operation slots: particle quantum superposition kind of fun'' >>>>! >>>>
Link census
As a simple illustration of PyPy in action, I present a program to parse a web page and print a list of links expressed on the page. This is the basic idea behind spidering software, which follows the web of links from page to page for some purpose.
For the parsing I chose html5lib, which is a pure Python-parsing library designed to implement the parsing algorithms of the WHAT-WG group that is defining the HTML5 specification. HTML5 is designed to be backwards compatible, even with badly broken web pages. Thus html5lib doubles as a good, general-purpose HTML parsing toolkit. It has also been benchmarked on CPython and PyPy, and is significantly faster on the latter.
Listing 2 parses a specified web page and prints
the links from that page line by line. You specify the target page URL on
the command line, for example:
pypy listing1.py.
Listing 2. Listing the links on a page
#!/usr/bin/env pypy #Import the needed libraries for use import sys import urllib2 import html5lib #List of tuples, each an element/attribute pair to check for links link_attrs = [ ('a', 'href'), ('link', 'href'), ] #This function is a generator, a Python construct that can be used as a sequence. def list_links(url): ''' Given a URL parse the HTML and yield a sequence of link strings as they are found on the page. ''' #Open the URL and get back a stream of the content stream = urllib2.urlopen(url) #Parse the HTML content according to html5lib conventions tree_builder = html5lib.treebuilders.getTreeBuilder('dom') parser = html5lib.html5parser.HTMLParser(tree=tree_builder) doc = parser.parse(stream) #In the outer loop, go over each element/attribute set for elemname, attr in link_attrs: #In the inner loop, go over the matches of the current element name for elem in doc.getElementsByTagName(elemname): #If the corresponding attribute is found, yield it in sequence attrvalue = elem.getAttribute(attr) if attrvalue: yield attrvalue return #Read the URL to parse from the first command line argument #Note: Python lists start at index 0, but as in UNIX convention the 0th #Command line argument is the program name itself input_url = sys.argv[1] #Set up the generator by calling it with the URL argument, then iterate #Over the yielded link strings, printing each for link in list_links(input_url): print link
I commented the code quite liberally, and I don't expect the reader to have deep knowledge of Python, though you should know the basics, such as how indentation is used to express flow of control. Please see Resources for relevant Python tutorials.
For simplicity, I avoided some conventions for such programs, but I did use
one advanced feature that I think is very useful, even for the beginning
programmer. The function
list_links is called a
generator. It is a function that acts like a sequence in that it computes
and offers up the items one by one. The
yield
statements are key here, providing the sequence of values.
Even more complex screen scraping
Most web page parsing tasks are more complex than just finding and displaying links, and there are several libraries that can help with typical "web-scraping" tasks. Pyparsing is a general-purpose, pure Python-parsing toolkit that includes some facilities to support HTML parsing.
For the next example I'll demonstrate how to scrape a list of articles from an IBM developerWorks index page. See Figure 1 for a screenshot of the target page. Listing 3 is a sample record in the HTML.
Figure 1. IBM developerWorks web page to be processed
Listing 3. Sample record to be processed from HTML
<tbody> <tr> <td> <a href=""> <strong>Join the social business revolution</strong></a> <div> Social media has become social business and everyone from business leadership to software developers need to understand the tools and techniques that will be required. The World Wide Web Consortium (W3C) will be conducting a social media event to discuss relevant standards and requirement for the near and far future. </div> </td> <td>Articles</td> <td class="dw-nowrap">03 Nov 2011</td> </tr> </tbody>
Listing 4 is code to parse this page. Again, I try to comment it liberally, but there are a few key new concepts I'll be discussing after the listing.
Listing 4. Listing 4. Extracting a listing of articles from a web page
#!/usr/bin/env pypy #Import the needed built-in libraries for use import sys import urllib2 from greenlet import greenlet #Import what we need from pyparsing from pyparsing import makeHTMLTags, SkipTo def collapse_space(s): ''' Strip leading and trailing space from a string, and replace any run of whitespace within with a single space ''' #Split the string according to whitespace and then join back with single spaces #Then strip leadig and trailing spaces. These are all standard Python library tools return ' '.join(s.split()).strip() def handler(): ''' Simple coroutine to print the result of a matched portion from the page ''' #This will be run the first time the code switches to this greenlet function print 'A list of recent IBM developerWorks Open Source Zone articles:' #Then we get into the main loop while True: next_tok = green_handler.parent.switch() print ' *', collapse_space(data.title), '(', data.date, ')', data.link.href #Turn a regular function into a greenlet by wrapping it green_handler = greenlet(handler) #Switch to the handler greenlet the first time to prime it green_handler.switch() #Read the search starting page START_URL = "" stream = urllib2.urlopen(START_URL) html = stream.read() stream.close() #Set up some tokens for HTML start and end tags div_start, div_end = makeHTMLTags("div") tbody_start, tbody_end = makeHTMLTags("tbody") strong_start, strong_end = makeHTMLTags("strong") article_tr, tr_end = makeHTMLTags("tr") td_start, td_end = makeHTMLTags("td") a_start, a_end = makeHTMLTags("a") #Put together enough tokens to narrow down the data desired from the page article_row = ( div_start + SkipTo(tbody_start) + SkipTo(a_start) + a_start('link') + SkipTo(strong_start) + strong_start + SkipTo(strong_end)("title") + SkipTo(div_start) + div_start + SkipTo(div_end)("summary") + div_end + SkipTo(td_start) + td_start + SkipTo(td_end)("type") + td_end + SkipTo(td_start) + td_start + SkipTo(td_end)("date") + td_end + SkipTo(tbody_end) ) #Run the parser over the page. scanString is a generator of matched snippets for data, startloc, endloc in article_row.scanString(html): #For each match, hand it over to the greenlet for processing green_handler.switch(data)
I set up Listing 4 deliberately to introduce PyPy's Stackless Python features. In short, it is a long-standing, alternative implementation of Python to experiment with advanced flow-of-control features. Most Stackless features have not made it into other Python implementations because of limitations in other runtimes, which are relaxed in PyPy. Greenlets are one example. Greenlets are like very lightweight threads that are multitasked cooperatively, by explicit calls to switch the content from one greenlet to another. Greenlets allow you to do some of the neat things that generators allow, and much more.
In Listing 4 I use greenlets to define a co-routine, a function whose operation is neatly interleaved with another in a way that makes the flow easy to construct and follow. You would often use greenlets in situations where more mainstream programming use callbacks, such as event-driven systems. Rather than invoking a callback you switch context to a co-routine. The key benefit of such facilities is that it allows you to structure programs for high efficiency without difficult state management.
Listing 4 provides a taste of co-routines and greenlets in general, but it's a useful concept to ease into in the context of PyPy, which comes bundled with greenlets and other Stackless features. In Listing 4, every time pyparsing matches a record, the greenlet is invoked to process that record.
The following is a sample of the output from Listing 4.
A list of recent IBM developerWorks Open Source Zone articles: * Join the social business revolution ( 03 Nov 2011 ) * Spark, an alternative for fast data analytics ( 01 Nov 2011 ) * Automate development and management of cloud virtual machines ( 29 Oct 2011 )
Whys and why nots
I took the approach in Listing 4 deliberately, but I'll start with one warning about it: It is always dangerous to try processing HTML without very specialized tools. Not as bad as XML, where not using a conforming parser is an anti-pattern, HTML is very complex and tricky, even in pages that conform to the standard, which most don't. If you need general-purpose HTML parsing, html5lib is a better option. That said, web scraping is usually a specialized operation where you are just extracting information according to the specific situation. For such limited use, pyparsing is fine, and provides some neat facilities to help.
The reasons I introduced greenlets, which are not strictly necessary in Listing 4, become more apparent as you expand such code to many real-world scenarios. In situations where you are multiplexing the parsing and processing with other operations, the greenlets approach makes it possible to structure processing not unlike UNIX command-line pipes. In cases where the problem is complicated by working with multiple source pages there is one more problem, the fact that urllib2 operations are not asynchronous and the whole program blocks any time it accesses a web page. Addressing this problem is beyond the scope of this article, but the use of advanced flow of control in Listing 4 should get you into the habit of thinking carefully about how to stitch together such sophisticated applications with an eye to performance.
Wrap up
PyPy is an actively maintained project, and certainly a moving target, but there is already much that can be done with it, and the high level of CPython compatibility means that you probably have a an established backup platform for your work if you begin to experiment. In this article, you learned enough to get started, and you had a bit of enticement to PyPy's very fascinating Stackless features. I think you'll be pleasantly surprised by PyPy's performance, and more importantly, it opens up new ways of thinking about programming for elegance without sacrificing speed.
Resources
Learn
- Some other important resources for PyPy are the performance page and the compatibility wiki, which tracks the compatibility of popular Python libraries with PyPy.
- Enjoy a gentle introduction to Python in the "Discover python" series (developerWorks, 2005-2006), by Robert Brunner.
- Learn more about HTML5 in the series "HTML5 fundamentals" (developerWorks, 2011), by Grace Walker.
- Check out developerWorks Open source for the resources you need to participate in the exciting world of open source software.
- Stay current with developerWorks technical events and webcasts focused on a variety of IBM products and IT industry topics.
- Attend a
- Learn more about PyPy or just skip to the downloads page..
|
http://www.ibm.com/developerworks/opensource/library/os-pypy-intro/index.html
|
CC-MAIN-2016-07
|
en
|
refinedweb
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.