text
stringlengths 454
608k
| url
stringlengths 17
896
| dump
stringclasses 91
values | source
stringclasses 1
value | word_count
int64 101
114k
| flesch_reading_ease
float64 50
104
|
|---|---|---|---|---|---|
from rosetta import *
import sys
init()
pose = Pose()
scorefxn = create_score_function_ws_patch('standard','score12')
pose_from_pdb(pose,'config.pdb')
scorePose = scorefxn(pose)
print scorePose
coord = pose.residue(740).atom('N').xyz()
print coord
coord.x = 100.0
print coord
scorePose = scorefxn(pose)
print scorePose
Returns:
...
core.pack.task: Packer task: initialize from command line()
core.scoring.dunbrack: Dunbrack library took 0.01 seconds to load from binary
-1347.47520146
-30.36600000000000 14.16400000000000 -17.65900000000000
100.0000000000000 14.16400000000000 -17.65900000000000
-1347.47520146
Is this something I'm doing wrong, or do I need to trigger some kind of neighbor list update after moving an atom?
coord is not a reference, it is a local copy. You haven't modified the coordinate of residue 740 atom N, you've made a local copy of that coordinate and then modified THAT.
You'll need to make a local copy of the Residue object for residue 740, modify that, and replace the Pose's 740 with your new 740 (if you really wanted to do that to it, anyway....)
So there is no way to get access to an atom's mutable position vector?
I can't set an atom's position through:
atom = pose.residue(5).atom('N') ?
Try pose.set_xyz(AtomID, PointPosition). AtomID is composed of a residue and atom number, I forget in what order. PointPosition is probably an alias for a coordinate triplet.
coord = pose.residue(740).atom('N').xyz()
print coord
coord.x = 100.0
print pose.residue(740).atom('N').xyz()
...should prove that this is a pointer. It looks like there are two sets of coordinates kept. One in the atomtree and one elsewhere, and I may need to trigger an update somehow.
A) The code is written such that it handles all the automatic updating for you.
B) The traditional way to force a coordinate update, (before we had all the automatic updating working well), was pose.residue(1). Since you're already calling pose.residue, it's going to try to do the update.
C) It's possible there's something broken in between the C++ and Python layers here.
It looks like the set_xyz method is the way to go...
void
Conformation::set_xyz(
AtomID const & id,
PointPosition const & position
)
{
// update atomtree coords
if ( !atom_tree_.empty() ) atom_tree_.set_xyz( id, position );
// update residue coords
residues_[ id.rsd() ]->set_xyz( id.atomno(), position );
// notify scoring
set_xyz_moved( id );
}
|
https://rosettacommons.org/comment/3103
|
CC-MAIN-2022-40
|
refinedweb
| 398
| 68.67
|
07 July 2011 17:32 [Source: ICIS news]
(adds paragraphs 1-9)
HOUSTON (ICIS)--US renewable fuels trade groups on Thursday welcomed a Senate compromise proposal that would, if enacted, end ethanol subsidies and tariffs on 31 July.
“This agreement has enough of the right ingredients to move the conversation forward,” said Brooke Coleman, executive director of the Advanced Ethanol Council (AEC).
But Coleman said the deal’s provisions on tax credits could create uncertainty and risk.
“While we appreciate the ambition to lengthen the duration of the tax credits, the last minute switch from a yearly credit to a gallon-based, capped credit adds artificial and unnecessary layers of uncertainty and risk for the financing community,” he said.
Bob Dinneen, president and CEO of the Renewable Fuels Association (RFA), also welcomed the compromise.
While not perfect, the compromise demonstrates the willingness of ethanol producers to do their part in addressing ?xml:namespace>
RFA is particularly pleased that the compromise deal commits funds to help develop new technologies and new feedstocks for cellulosic ethanol, he said.
However, Dinneen added that funding for cellulosic ethanol development should not be capped.
“We are concerned that capping cellulosic ethanol development sends the wrong signal, and we will continue to work with the Congress and the Obama Administration to address this anomaly in as this process continues,” he said.
Under the deal, as proposed by three Senators, the US will repeal the 45 cent/gal ethanol blender credit, effective on 31 July, ICIS reported. This should save $2bn (€1.4bn) through the rest of the year.
The 54 cent/gal ethanol tariff will also end on 31 July.
Two thirds of the money saved by ending the benefits - $1.33bn - will go towards reducing the nation's deficit, the senators said.
Another $668m will go towards new energy technology.
Specifically, the deal will extend the nation's cellulosic biofuel tax credit by three years. The credit, worth $1.01/gal, was set to expire on 31 December 2012.
In addition, the agreement will expand the definition of cellulosic biofuel to include biodiesel made from algae.
Cellulosic blending caps will be set at 50m gal (189m litres) for 2013, 100m gal for 2014 and 155m gal for 2015.
($1 = €0.70)
Al Greenwood contributed to this article
|
http://www.icis.com/Articles/2011/07/07/9475952/us-renewable-groups-welcome-senate-ethanol-subsidy-deal.html
|
CC-MAIN-2014-35
|
refinedweb
| 382
| 54.52
|
QTableWidget Example using Python 2.4, QT 4.1.4, and PyQt
import sys from Qt import * lista = ['aa', 'ab', 'ac'] listb = ['ba', 'bb', 'bc'] listc = ['ca', 'cb', 'cc'] mystruct = {'A':lista, 'B':listb, 'C':listc} class MyTable(QTableWidget): def __init__(self, thestruct, *args): QTableWidget.__init__(self, *args) self.data = thestruct self.setmydata() def setmydata(self): n = 0 for key in self.data: m = 0 for item in self.data[key]: newitem = QTableWidgetItem(item) self.setItem(m, n, newitem) m += 1 n += 1 def main(args): app = QApplication(args) table = MyTable(mystruct, 5, 3) table.show() sys.exit(app.exec_()) if __name__=="__main__": main(sys.argv) this example. It saved me quite some searching time.
(.. On my machine I had to alter "from Qt import *" into "from PyQt4.QtGui import *")
Bastian, yes I think
from PyQt4.QtGui import * is the correct import statement now. I think
from Qt import * was the old way. Thanks for your comment.
How can I copy and pasty all the data from the whole table?
Fantastic examples you have here. One thing I would do differently is to make use of enumerate() to index your for loops.
I would rework the above like...
def setmydata(self): for n, key in enumerate(self.data): for m, item in enumerate(self.data[key]): newitem = QTableWidgetItem(item) self.setItem(m, n, newitem)
Ryan, Thanks. I agree your modification is much better. I learned about
enumerate a couple years after I originally wrote this. (Also, I added one blank line in your comment before your code block so the formatting would come out correctly.)
A Question: How to add "Cut & Paste" to QTableWidget?
|
https://www.saltycrane.com/blog/2006/10/qtablewidget-example-using-python-24/
|
CC-MAIN-2019-47
|
refinedweb
| 274
| 71.71
|
Learning Next.js
- Part 1: Reviewing React
- Part 2: Pages
- Part 3: Links and Head
- Part 4: Dynamic Routing
- Part 5: Serverless API
Next.js is a JavaScript framework based on React for rapidly developing web sites and applications.
Reviewing React
Understanding Next.js starts with first reviewing how React works and its basic concepts.
Everything is a Component
React divides up sites and web applications into different parts called components. These can be anything from input areas to an entire page. The difference between components is not in how they do things, but what makes the most sense in understanding parts in relation to each other.
React enforces no strict design patterns. However, certain patterns have developed over time based on how React works. This includes the concept of “lifting state” where the state (data) of one component is handled by another, parent component.
Components Render
Anything that inherits from the class React.Component should have a render() function. Whenever this class is used, anything found within the component is added to the page through its render() function.
import React from 'react'; class Example extends React.Component { render() { return( <p>This is the best example!</p> ); } } export default Example;
React uses JSX
React uses JavaScript XML (JSX) to allow the use of HTML within other JavaScript code. However, as XML, it follows some strict rules such as having a single root element, that all elements should close, and uses expressions for values.
import React from 'react'; class Example extends React.Component { render() { let greeting = "Hello!"; return( <p>{greeting} This is the best example!</p> ); } } export default Example;
Properties and State
React allows for creating classes that inherit from React.Component through using their named XML equivalent. For example, with a class named Example, it can be created, and its render() function automatically called, through the code <Example />.
React also converts elements and attributes into objects and properties. Any attributes added to a XML class name is sent to the same class as an object literal based on its key-value pairs.
<Example name="Dan" greeting="Hello!" />
import React from 'react'; class Example extends React.Component { constructor(props) { super(props); // props.name will be "Dan" // props.greeting will be "Hello!" } render() { return( <p>This is the best example!</p> ); } } export default Example;
Note: The use of the super() function should be used to make sure all attributes (converted into properties) are properly passed to the component and its parent class of React.Component.
State
When dealing with internal data, all components should use its state. Defined initial within a constructor(), this should be this.state with an object literal containing values
import React from 'react'; class Example extends React.Component { constructor(props) { super(props); this.state = {}; } render() { return( <p>This is the best example!</p> ); } } export default Example;
Component Lifecycle
Each component follows a lifecycle and movement between three different phases: mounting, updating, and unmouting.
Mounting
When a component is initially used, its constructor is first called and properties passed to it. The render() function is also called and any HTML elements are “mounted” to the page.
At the end of the mounting phase, the function componentDidMount() will be called. When adding data from an external source, this is the best function to use.
Updating
During the updating phase, any content within the render() function will be updated if the state also changes. To update its state, the function this.setState() should always be used, passing to it an object literal of new key-value pairs.
Unmounting
When a component is removed from the page, it undergoes an unmounting phase. The function componentWillUnmount() will be called last.
Event Handlers
Finally, events within a browser such as clicks can be handled through using an onEvent attribute on the component with an event handler defined as an arrow function or a member function of the class.
import React from 'react'; class Example extends React.Component { constructor(props) { super(props); this.state = {clicked: false}; } clickHandler = () => { this.setState({clicked: true}); } render() { return( <div> <p>Button clicked? {this.state.clicked ? "Yup!" : "Nope!"}</p> <button onClick={this.clickHandler}>Click me!</button> </div> ); } } export default Example;
|
https://videlais.com/2019/12/24/learning-next-js-part-1-reviewing-react/
|
CC-MAIN-2021-04
|
refinedweb
| 689
| 50.94
|
Bell character is the control code used to sound an audible bell or tone in
order to alert the user (ASCII 7, EBCDIC 2F). Bell character is an ASCII control character, code 7 (^G).
When it is sent to a printer or a terminal, nothing is printed, but an audible signal is emitted instead.
You can emit a beep by printing the ASCII Bell character ("\0007") to the console.
public class testBeep {
public static main(String args[]) {
// ASCII bell
System.out.print("\0007");
System.out.flush();
}
}
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.
|
http://www.java-tips.org/java-se-tips/java.lang/how-to-emit-a-beep-by-printing-the-ascii-bell-character-to-the-co-9.html
|
CC-MAIN-2014-15
|
refinedweb
| 108
| 73.58
|
Orientation strategy for mobile. Best practice?gtr Apr 26, 2012 1:43 PM
Hi all.
What's the best way to handle orientation changes on a mobile device when you have several child movies loaded in the background?
I'm thinking:
1. Each child movie have it's own listener for an orientation change. (calls function to adjust graphics as needed so they are ready when the movie is added to stage)
or
2. One primary listener on the main stage which the child movies respond to.
Thoughts? Am I way off-base on this?
Thanks!
JP
PS. Don't think this matters, but just in case, the app is for iOS only.
1. Re: Orientation strategy for mobile. Best practice?sinious Apr 26, 2012 1:50 PM (in response to gtr)
I dispatch an event from my main and have my children listen and adjust accordingly.
Of course you can always simply use Flex with some simple layout rules and constraints and let Flex do the work for you. Not every complex view is capable of that automation but I tend to stray from making any single view too complex anyhow.
2. Re: Orientation strategy for mobile. Best practice?gtr Apr 26, 2012 2:05 PM (in response to sinious)
Thanks, that makes sense. Only, despite my best Googling, I can't find a clear and concise description on how to get the child to listen to the parent. (I understand how to achieve the opposite) What's the simplest way to do this?
3. Re: Orientation strategy for mobile. Best practice?Colin Holgate Apr 26, 2012 2:14 PM (in response to gtr)
It can get complicated it you want to send an event with data attached, so it could be that the simpler approach would be to have two listeners in each child. Something like this, in each child that needs to rearrange things:
stage.addEventListener("go portrait",goportrait);
stage.addEventListener("go landscape",golandscape);
function goportrait(e:Event){
//do what this child needs when going to portrait
}
function golandscape(e:Event){
//do what this child needs when going to landscape
}
Then in the orientation listener on the stage you would do:
dispatchEvent(new Event("goportrait"));
or:
dispatchEvent(new Event("golandscape"));
You'll read in some places about how it's bad practice to use strings like that, and that you should set up constants with the strings in them. But, using strings is quick and easy, and has no drawbacks at runtime.
4. Re: Orientation strategy for mobile. Best practice?sinious Apr 26, 2012 2:24 PM (in response to Colin Holgate)
It's not difficult to make your own event, which you can use custom information in it. I prefer this method.
Here's a full example of a custom event I use all the time called AppEvent:
package { import flash.events.Event; public class AppEvent extends Event { public static const APP_EVENT:String = "appevent"; public var params:Object; // where you stick your custom goodies public function AppEvent(type:String, params:Object, bubbles:Boolean = false, cancelable:Boolean = false) { super(type, bubbles, cancelable); this.params = params; } public override function clone():Event { return new AppEvent(type, this.params, bubbles, cancelable); } public override function toString():String { return formatToString("AppEvent", "params", "type", "bubbles", "cancelable"); } } }
To dispatch this event with a piece of data, you'd do this:
this.dispatchEvent(new AppEvent(AppEvent.APP_EVENT, {customVarA:"something",customVarB:"something"}));
In that example I sent "customVarA" and "customVarB" both set to the string "something". I'd read it like this:
function someHandler(e:AppEvent):void { trace("A: " + e.params.customVarA + ", B: " + e.params.customVarB); }
It sends an object through called e.params. You set whatever objects you want inside it.
To add a listener from a child clip just use the .parent property.
e.g.
this.parent.addEventListener(AppEvent.APP_EVENT, someHandler, false, 0, true);
Any time the parent dispatches the event the child will get it, with whatever custom parameters you need.
5. Re: Orientation strategy for mobile. Best practice?gtr Apr 26, 2012 2:34 PM (in response to Colin Holgate)
Thanks for the lesson, Colin. Very helpful!
My only remaining concern is regarding a momentary performance hit by having all (five) movies rotating their content at once (even though only one is added to the stage at any one time). Would it be better to wait and use a system where the orientation function ("goLandscape" or "goPortrait" in your example) is only called when it's time to load the child to stage?
I've noticed some apps seem to occasionally "pause" momentarily on rotation (even on the new iPad), so I suspect everything is happening at once in the background...
6. Re: Orientation strategy for mobile. Best practice?Colin Holgate Apr 26, 2012 2:44 PM (in response to gtr)
If you study carefully what apps are doing, they are often doing a quick crossfade from one arrangement to another. You could grab the current arrangement as a bitmap, and then lay that on top of the arrangement before you instantly switch the layouts, and then fade out the old layout to reveal the new one.
You wouldn't normally have listeners active if the object wasn't on the stage at the time, but I suppose that if you're adding something to the stage it should arrange itself correctly. In your main orientation function you could store the current state in a variable, and then the child would check that variable as it gets added to the stage, to see what arrangement it should show.
7. Re: Orientation strategy for mobile. Best practice?gtr Apr 26, 2012 3:13 PM (in response to Colin Holgate)
@sinious
Thanks for the custom event tip. Some of the stuff in there is a little over my head right now, but I'll give it a study.
@Colin
So it sounds like you're saying that it's best not to have child movies change their arrangements while off stage? (rather, they adjust their "arrangement" only when added, or just prior to being added)
"You wouldn't normally have listeners active if the object wasn't on the stage at the time,"
My app is not a heavy lifter (mostly displaying content via stagewebview rather than a game with lots of sprites and animation) and my layouts are pretty minimalist in design, so I was thinking of doing this just to save some time and primarily make sure everything is in place before the child gets added.
8. Re: Orientation strategy for mobile. Best practice?sinious Apr 26, 2012 4:32 PM (in response to gtr)
Can you explain exactly what you're "doing" when the orientation changes? How are you "transforming" these clips? Adjusting sizes of objects and possibly repositioning things or is there anything else more elaborate? Those types of things take no more or less CPU to do on or off the stage.
9. Re: Orientation strategy for mobile. Best practice?gtr Apr 26, 2012 4:43 PM (in response to sinious)
No, pretty simple stuff. As you suspect, just repositioning/resizing of maybe a dozen objects or so. Pretty simple app with low memory and CPU requirements (the "heavy lifting" is being done natively through stagewebview)
"Those types of things take no more or less CPU to do on or off the stage."
My CPU concern is if I have all five of my off-stage movies perform their repositioning functions at the same time. I wonder if that will that noticeably impact performance... I suppose I can just try it and if I don't like the results, I'll try storing a variable like Colin mentioned above to check against before adding the child movie.
10. Re: Orientation strategy for mobile. Best practice?sinious Apr 26, 2012 4:56 PM (in response to gtr)
Many apps take a second to reorient to a new view, even (but to a much lesser extent) native applications. I don't know "how many things" you're doing in these 5 clips but I'm willing to bet you're a lot pickier about a tiny bog than a user of the app will be.
And yes the StageWebView can utilize the GPU but it can use CPU as well.
Being you have to do the resposition/resize anyhow, you should just do it and see how it goes.
Realize also that while AIR is a pretty easy app to make, it is nowhere near the performance of a native app outside the GPU utilizing features. Everything is "boggy" in an AIR app that isn't using a native feature.
On or off the stage, when you perform those calculations it will take up so little difference in CPU it's not worth removing them from stage if you think that removing them from the display list will somehow make the resizing and repositioning faster. You could even take a hit for it, albeit equally small.
11. Re: Orientation strategy for mobile. Best practice?gtr Apr 26, 2012 5:28 PM (in response to sinious)
Okay, thanks for the tips! Much appreciated. I'll see how it goes and report back later on with details for anyone interested.
12. Re: Orientation strategy for mobile. Best practice?sinious Apr 27, 2012 6:49 AM (in response to gtr)
You're welcome and good luck. iPad1 optimization is what I work the hardest at.. It's amazing how much faster the iPad2 is going from a single A4 to dual A5s.. The display list is what I'd call pretty boggish on iPad1, but that's because it's all cpu.
|
https://forums.adobe.com/message/4363954
|
CC-MAIN-2015-32
|
refinedweb
| 1,608
| 69.72
|
If, for example, you're receiving a "The file jvm.dll is missing" error when you play a 3D video game, try updating the drivers for your video card.Note: The jvm.dll file may Duncan Murdoch has made the require changes, but the changes are not in the package, so you have to download the development version (r47752 above). After reinstalling the rJava package I started getting a windows pop up with the message: Rgui.exe - Unable to Locate Component "This application has failed to start because jvm.dll was not rJava will not load due to "The specified module could not be found" > library(rJava) Error : .onLoad failed in loadNamespace() for 'rJava', details: call: inDL(x, as.logical(local), as.logical(now), ...) error: unable have a peek at these guys
By messaging with Merrill Lynch you consent to the foregoing. -------------------------------------------------------------------------- ______________________________________________ [hidden email] mailing list do read the posting guide provide commented, minimal, self-contained, reproducible code. Yes No Thanks for your feedback! Watson Product Search Search None of the above, continue with my search The LoadLibrary function failed for the following reason: The specified module could not be found. I still get the error below without any pop-up message: > library(rJava) Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared library 'C:/R/R-2.7.2/library/rJava/libs/rJava.dll': LoadLibrary failure: The specified
java r package bigdata rjava share|improve this question edited Aug 18 '14 at 10:04 asked Aug 18 '14 at 9:34 Khurram Majeed 85651939 1 As a first step I would Cause 2: The BlackBerry Java Virtual Machine (JVM) path in the registry is pointing to the incorrect location for Java or an incompatible Java version. You don't need admin rights to install R. Secu!
The key here is to pay very close attention to the context of the error and troubleshoot accordingly. Roll back a driver to a previously installed version if jvm.dll errors began At some point I even got > R Console: Rgui.exe - System Error The > program can't start because > MSVCR71.dll is is missing from your > computer. charis-2 Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Problem with loading rJava in R Thank you everyone for the help. Install Rjava Package In R Some services stop automatically if they are not in use by other services or programs.
Error: package/namespace load failed for ‘rJava’ > To fix this make sure if R is 64bit that your Java is 64bit too. Join them; it only takes a minute: Sign up Cannot load rJava because cannot load a shared library up vote 8 down vote favorite 2 I have been struggling to load Error : .onLoad failed in 'loadNamespace' for 'rJava' Error: package/namespace load failed for 'rJava' > sessionInfo() R version 2.7.2 (2008-11-24) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] You deinstall the service with the uninstall.bat file or you can modify them in the registry. 7 - Others possibilities 7.1 - Windows Service with NT/Win2k Resource Kit Answer from the
Then uninstallation and re-installation of R did not resolve the issue either. Loadlibrary Failure: %1 Is Not A Valid Win32 Application. Document and back up the registry entries prior to implementing any changes. more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed I really would appreciate any help you could give me?
I only know of one commercial beta release ... If your dll indeed exists in the directory it complains about, I would venture that it's a mismatch between 32-bit and 64-bit libraries (R, rJava, Java). Jvm Dll Missing From Your Computer Skip to content Skip to breadcrumbs Skip to header menu Skip to action menu Skip to quick search Linked ApplicationsLoading…Confluence Spaces Quick Search Help Online Help Keyboard Shortcuts Feed Builder What’s The Program Can't Start Because Jvm.dll Is Missing From Your Computer charis-2 Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Problem with loading rJava in R Thank you for helping.
Is an ACK necessary when using reliable protocols like TCP? More about the author Why is credit card information not stolen more often? If you suspect that the jvm.dll error was caused by a change made to an important file or configuration, a System Restore could solve the problem. Update the drivers for hardware What is a real-world metaphor for irrational numbers? Loadlibrary Failure: The Specified Module Could Not Be Found.
If not, you can re-configure R by using R CMD javareconf (you may have to prepend sudo or run it as root depending on your installation - see R-ext manual A.2.2 Cause The path highlighted in the error is not valid. Simple pack Uri builder What is the proper usage of "identically zero"? check my blog Symptom SI services do not start up, and the Event Viewer logs show the following errors: Error Message The LoadLibrary function failed for the following reason: The specified module could not
Try reinstalling the program > to fix this problem. Jvm.dll Download However, when i type ‘library(rJava)’ I get an error dialog box saying: 'This application has failed to start because jvm.dll was not found. Best, Uwe Ligges Rowe, Brian Lee Yung (Portfolio Analytics) wrote: > Did you verify that all your apps/libraries are all 64-bit compatible? > If your dll indeed exists in the directory
Re-installing the application may fix this problem' When I press 'OK' on the dialog box, I get the following in the R console: Error in dyn.load(x, as.logical(local), as.logical(now)) : I only know of one commercial beta release ... How do organic chemistry mechanisms become accepted? Install Java If this parameter is not specified, System.err will not be redirected. 4 - Installation Steps 4.1 - for 32 Bit machines From Metalink, if you want to run oc4j as a
Why do Latin nouns (like cena, -ae) include two forms? mister_bluesman-2 Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: rJava problem In reply to this post by mister_bluesman-2 Could someone please In the registry Start the regedit which is in the directory C:\WINDOWS\SysWOW64 if you are in a 64 bit environement HKLM\SYSTEM\CONTROLSET001\Services 6 - Support 6.1 - Unrecognised or incorrectly-ordered parameters for Crazy 8s Code Golf How to send the ESC signal to vim when my esc key doesn't work?
rities and Insurance Products: * Are Not FDIC Insured * Are Not Bank Guaranteed * May Lose Value * Are Not a Bank Deposit * Are Not a Condition to Any However, when i type ‘library(rJava)’ I get an error dialog box saying: 'This application has failed to start because jvm.dll was not found. I think I have succeeded in doing so as it appears in the list when i type library() in R. Resolution 1: Install the desired version(s) of Java in the desired path.If necessary, update the Java paths in the registry to point to the correct location of the desired Java version
That seems to have done the trick. Does any Windows error message appear on your screen? HTH, Brian -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of charis Sent: Wednesday, February 11, 2009 8:40 PM To: [hidden email] Subject: [R] Problem with loading rJava in R Attachments that are part of this E-communication may have additional important disclosures and disclaimers, which you should read.
that is what R does. Make sure you've made the best attempt possible to fix the jvm.dll error using a troubleshooting step prior to this one. Troubleshoot for a hardware problem if any jvm.dll errors persist. I would also then remove C:\Program Files\R from the path. The program seem to be sitting in C:\Program Files\Java\jre6.
References to "Merrill Lynch" are references to any company in the Merrill Lynch & Co., Inc. PS Also note that when setting the environment variable JAVA_HOME in Windows, the path to jre or jre7 is NOT enclosed in single or double quotes and does not require \ You can check this out by launching services.msc in Windows, and looking for the Confluence service. However i keep getting the error: Error: could not find function ".JavaConstructor" Any help would be so greatly appreciated.
Many service packs and other patches replace or update some of the hundreds of Microsoft distributed DLL files on your computer.
|
http://gsbook.org/the-specified/loadlibraryjvm-dll-failed-the-specified-module-could-not-be-found.php
|
CC-MAIN-2018-09
|
refinedweb
| 1,471
| 62.78
|
AJAX on Rails 2.1.
How.
AJAX Example the previous chapters, then we would suggest you to complete the previous chapters first and then continue with AJAX on Rails.
Creating Controller
Let’s create a controller for subject. It will be done as follows −
C:\ruby\library> ruby script/generate controller Subject
This command creates a controller file app/controllers/subject_controller.rb. Open this file in any text editor and modify it to have the following content −
class SubjectController < ApplicationController layout 'standard' def list end def show end def create end end
Now, we will discuss the implementation part of all these functions in the same way we had given in the passed ID.
The create Method Implementation
def create @subject = Subject.new(params[:subject]) if @subject.save render :partial => 'subject', :object => @subject end end
This part is a bit new. Here we are not redirecting the page to any other page; we are just rendering the changed part instead of whole page.
It happens only when using partial. We don't write the complete view file, instead, we will write a partial in> the create method because we are using partial instead of view. In the next section, we will create a partial for the create method.
Adding Ajax Support.rhtml layout file in app/views/layouts, add the following line just before the </head> tag, and save your changes −
<%='}) do %> Name: <%= text_field "subject", "name" %> <%= submit_tag 'Add' %> <% end %> </div> start_form_tag tag, but it is used here to let the Rails framework know that it needs to trigger an Ajax action for this method. The form_remote_tag takes the :action parameter just like start_form_tag.
You also have two additional parameters − _form_tag to close the <form> tag. Make sure that things are semantically correct and valid XHTML.
Creating Partial for create Method
We are calling the create method while adding a subject, and inside this create method, we are using one partial. Let’s implement this partial before going for actual practical.
Under app/views/subject, create a new file called _subject.rhtml. Notice that all the partials are named with an underscore (_) at the beginning.
Add the following code into this file −
<li id="subject_<%= subject.id %>"> <%= link_to subject.name, :action => 'show', :id => subject.id %> <%= "(#{subject.books.count})" -%> </li>
You are done now and can easily add several subjects without having to wait for the page to refresh after each subject is added. Now, try browsing your Subject list using. It will show you the following screen. Try to add some subject.
When you press the Add button, subject would be added at the bottom of all the available subjects and you would not have a feel of page refresh.
|
https://www.tutorialspoint.com/ruby-on-rails-2.1/rails-and-ajax.htm
|
CC-MAIN-2018-39
|
refinedweb
| 450
| 65.12
|
Back to: C#.NET Tutorials For Beginners and Professionals
Generics in C# with Examples
In this article, I am going to discuss how to implement Generics in C# with Examples. Please read our previous article where we discussed the Generic Collection in C#. As part of this article, we are going to discuss the following pointers.
- Why do we need generics in C#?
- What are Generics in C#?
- Advantages of Generics in C#.
- How to implement Generics in C#?
- How to use Generics with class and its members?
Why do we need Generics in C#?
Let us understand the need for Generics in C# with one example. Let us create a simple program to check whether two integer numbers are equal or not. The following code implementation is very straightforward. Here we created two classes with the name ClsCalculator and ClsMain. Within the ClsCalculator class, we have AreEqual() method which takes two integer values as the input parameter and then it checks whether the two input values are equal or not. If both are equal then it returns true else it will return false. And from the ClsMain class, we are calling the static AreEqual() method and showing the output based on the return value.
namespace GenericsDemo { public class ClsMain { private static void Main() { bool IsEqual = ClsCalculator.AreEqual(10, 20); if (IsEqual) { Console.WriteLine("Both are Equal"); } else { Console.WriteLine("Both are Not Equal"); } Console.ReadKey(); } } public class ClsCalculator { public static bool AreEqual(int value1, int value2) { return value1 == value2; } } }
The above AreEqual() method works as expected as it is and more importantly it will only work with the integer values as this is our initial requirement. Suppose our requirement changes, now we also need to check whether two string values are equal or not.
In the above example, if we try to pass values other than the integer values, then we will get a compile-time error. This is because the AreEqual() method of the ClsCalculator class is tightly bounded with the integer data type and hence it is not possible to invoke the AreEqual method other than the integer data type values. So, when we try to invoke the AreEqual() method by passing string values as shown below we get a compile-time error.
bool Equal = ClsCalculator.AreEqual(“ABC”, “XYZ”);
One of the ways to make the above AreEqual() method to accepts string type values as well as integer type values, we need to make use of the object data type as the parameters. If we make the parameters of the AreEqual() method as Object type, then it is going to work with any data type.
Note: The most important point that you need to keep in remember is every .NET data type whether it is a primitive type or reference type, directly or indirectly inherits from the System.Object data type.
Modifying the Method to accept any data type values:
Let’s modify the AreEqual() method of the ClsCalculator class to use the Object data type as shown below.
namespace GenericsDemo { public class ClsMain { private static void Main() { // bool IsEqual = ClsCalculator.AreEqual(10, 20); bool IsEqual = ClsCalculator.AreEqual("ABC", "ABC"); if (IsEqual) { Console.WriteLine("Both are Equal"); } else { Console.WriteLine("Both are Not Equal"); } Console.ReadKey(); } } public class ClsCalculator { //Now this method can accept any data type public static bool AreEqual(object value1, object value2) { return value1 == value2; } } }
That’s it. Run the application and you will see it is working as expected. Let’s see the problem of the above code implementation.
- We get poor Performance due to boxing and unboxing. The object type needs to be converted to the value type.
- Now, the AreEuqal() method is not type-safe. Now it is possible to pass a string value for the first parameter and an integer value for the second parameter.
Method Overloading to Achieve the same:
Another option is we need to overload the AreEqual method which will accept different types of parameters as shown below. As you can see in the below code, now we have created three methods with the same name but with different types of parameters. This is nothing but method overloading. Now, run the application and you will see everything is working as expected.
namespace GenericsDemo { public class ClsMain { private static void Main() { // bool IsEqual = ClsCalculator.AreEqual(10, 20); // bool IsEqual = ClsCalculator.AreEqual("ABC", "ABC"); bool IsEqual = ClsCalculator.AreEqual(10.5, 20.5); if (IsEqual) { Console.WriteLine("Both are Equal"); } else { Console.WriteLine("Both are Not Equal"); } Console.ReadKey(); } } public class ClsCalculator { public static bool AreEqual(int value1, int value2) { return value1 == value2; } public static bool AreEqual(string value1, string value2) { return value1 == value2; } public static bool AreEqual(double value1, double value2) { return value1 == value2; } } }
The problem with the above code implementation is that we are repeating the same logic in each and every method. However, if tomorrow we need to compare two float or two long values then again we need to create two more methods.
How to solve the above Problems?
We can solve all the above problems with Generics in C#. With generics, we will make the AreEqual() method to works with different types of data types. Let us first modify the code implementation to use the generics and then we will discuss how it works.
namespace GenericsDemo { public class ClsMain { private static void Main() { //bool IsEqual = ClsCalculator.AreEqual<int>(10, 20); //bool IsEqual = ClsCalculator.AreEqual<string>("ABC", "ABC"); bool IsEqual = ClsCalculator.AreEqual<double>(10.5, 20.5); if (IsEqual) { Console.WriteLine("Both are Equal"); } else { Console.WriteLine("Both are Not Equal"); } Console.ReadKey(); } } public class ClsCalculator { public static bool AreEqual<T>(T value1, T value2) { return value1.Equals(value2); } } }
Here in the above example, in order to make the AreEqual() method generic (generic means the same method will work with the different data types), we specified the type parameter T using the angular brackets <T>. Then we use that type as the data type for the method parameters as shown in the below image.
At this point, if you want to invoke the above AreEqual() method, then you need to specify the data type on which the method should operate. For example, if you want to work with integer values, then you need to invoke the AreEqual() method by specifying int as the data type as shown in the below image using angular brackets.
The above AreEqual() generic method is working as follows:
If you want to work with the string values, then you need to call the AreEqual() method as shown below.
bool IsEqual= ClsCalculator.AreEqual<string>(“ABC”, “ABC”);
Now, I hope you understand the need and importance of Generics in C#.
What are Generics in C#?
As we already discussed in our previous article, the Generics in C# are introduced as part of C# 2.0. The Generics in C# allow us to define classes and methods which are decoupled from the data type. In other words, we can say that the Generics allow us to create classes using angular brackets for the data type of its members. At compilation time, these angular brackets are going to be replaced with some specific data types. In C#, the Generics can be applied to the following:
- Interface
- Abstract class
- Class
- Method
- Static method
- Property
- Event
- Delegates
- Operator
Advantages of Generics in C#
- It Increases the reusability of the code.
- The Generics are type-safe. We will get the compile-time error if we try to use a different type of data rather than the one we specified in the definition.
- We get better performance with Generics as it removes the possibilities of boxing and unboxing.
How to use Generics with class and its members?
Let us create a generic class with a generic constructor, generic member variable, generic property, and a generic method as shown below.
using System; namespace GenericsDemo { //MyGenericClass is a Generic Class class MyGenericClass<T> { //Generic variable //The data type is generic private T genericMemberVariable; //Generic Constructor //Constructor accepts one parameter of Generic type public MyGenericClass(T value) { genericMemberVariable = value; } //Generic Method //Method accepts one Generic type Parameter //Method return type also Generic public T genericMethod(T genericParameter) { Console.WriteLine("Parameter type: {0}, value: {1}", typeof(T).ToString(), genericParameter); Console.WriteLine("Return type: {0}, value: {1}", typeof(T).ToString(), genericMemberVariable); return genericMemberVariable; } //Generic Property //The data type is generic public T genericProperty { get; set; } } }
In the above example, we created the class MyGenericClass with <T>. The angular brackets (“<>”) indicate that the MyGenericClass class is a generic class and the type for this class is going to be defined later.
While creating the instance of this MyGenericClass class, we need to specify the type and the compiler will assign that type to T. In the following example, we use int as the data type:
class Program { static void Main() { MyGenericClass<int> integerGenericClass = new MyGenericClass<int>(10); int val = integerGenericClass.genericMethod(200); Console.ReadKey(); } }
Run the application and it will give you the following output.
The following diagram shows how the T will be replaced with the int data type by the compiler.
The compiler will compile the above class as shown in the below image
At the time of instantiation, we can use any type as per our requirement. If we want to use a string type, then we need to instantiate the class as shown below
class Program { static void Main() { MyGenericClass<string> stringGenericClass = new MyGenericClass<string>("Hello Generic World"); stringGenericClass.genericProperty = "This is a generic property example."; string result = stringGenericClass.genericMethod("Generic Parameter"); Console.ReadKey(); } }
Output:
I hope you understand the concept of Generics in C#. The generics are extremely used by the collection classes which belong to System.Collections.Generic namespace.
In the next article, I am going to discuss the List Generic Collection class in C# with examples. In this article, I try to explain Generics in C# with an example. I hope this article will help you with your needs. I would like to have your feedback. Please post your feedback, question, or comments about this article.
6 thoughts on “Generics in C#”
this is awesome and very clear explanation for beginner, thank you
awesome!
Your all topics are superb ..thanks
Your explanation is good .One observation ,method overloading can be achieved within same classes and not in different classes.
I am Surprised. Thank u so much for this knowledgeable article.
Many thanks. First article I’ve found that explains why Generics is so useful and how it works in detail.
|
https://dotnettutorials.net/lesson/generics-csharp/
|
CC-MAIN-2022-21
|
refinedweb
| 1,742
| 56.96
|
One of the challenges of writing a library like Eventlet is that the built-in networking libraries don’t natively support the sort of cooperative yielding that we need. What we must do instead is patch standard library modules in certain key places so that they do cooperatively yield. We’ve in the past considered doing this automatically upon importing Eventlet, but have decided against that course of action because it is un-Pythonic to change the behavior of module A simply by importing module B.
Therefore, the application using Eventlet must explicitly green the world for itself, using one or both of the convenient methods provided.
The first way of greening an application is to import networking-related libraries from the eventlet.green package. It contains libraries that have the same interfaces as common standard ones, but they are modified to behave well with green threads. Using this method is a good engineering practice, because the true dependencies are apparent in every file:
from eventlet.green import socket from eventlet.green import threading from eventlet.green import asyncore
This works best if every library can be imported green in this manner. If eventlet.green lacks a module (for example, non-python-standard modules), then import_patched() function can come to the rescue. It is a replacement for the builtin import statement that greens any module on import.
Imports a module in a greened manner, so that the module’s use of networking libraries like socket will use Eventlet’s green versions instead. The only required argument is the name of the module to be imported:
import eventlet httplib2 = eventlet.import_patched('httplib2')
Under the hood, it works by temporarily swapping out the “normal” versions of the libraries in sys.modules for an eventlet.green equivalent. When the import of the to-be-patched module completes, the state of sys.modules is restored. Therefore, if the patched module contains the statement ‘import socket’, import_patched will have it reference eventlet.green.socket. One weakness of this approach is that it doesn’t work for late binding (i.e. imports that happen during runtime). Late binding of imports is fortunately rarely done (it’s slow and against PEP-8), so in most cases import_patched will work just fine.
One other aspect of import_patched is the ability to specify exactly which modules are patched. Doing so may provide a slight performance benefit since only the needed modules are imported, whereas import_patched with no arguments imports a bunch of modules in case they’re needed. The additional_modules and kw_additional_modules arguments are both sequences of name/module pairs. Either or both can be used:
from eventlet.green import socket from eventlet.green import SocketServer BaseHTTPServer = eventlet.import_patched('BaseHTTPServer', ('socket', socket), ('SocketServer', SocketServer)) BaseHTTPServer = eventlet.import_patched('BaseHTTPServer', socket=socket, SocketServer=SocketServer)
The other way of greening an application is simply to monkeypatch the standard library. This has the disadvantage of appearing quite magical, but the advantage of avoiding the late-binding problem.
This function monkeypatches the key system modules by replacing their key elements with green equivalents. If no arguments are specified, everything is patched:
import eventlet eventlet.monkey_patch()
The keyword arguments afford some control over which modules are patched, in case that’s important. Most patch the single module of the same name (e.g. time=True means that the time module is patched [time.sleep is patched by eventlet.sleep]). The exceptions to this rule are socket, which also patches the ssl module if present; and thread, which patches thread, threading, and Queue.
Here’s an example of using monkey_patch to patch only a few modules:
import eventlet eventlet.monkey_patch(socket=True, select=True)
It is important to call monkey_patch() as early in the lifetime of the application as possible. Try to do it as one of the first lines in the main module. The reason for this is that sometimes there is a class that inherits from a class that needs to be greened – e.g. a class that inherits from socket.socket – and inheritance is done at import time, so therefore the monkeypatching should happen before the derived class is defined. It’s safe to call monkey_patch multiple times.
The psycopg monkeypatching relies on Daniele Varrazzo’s green psycopg2 branch; see the announcement for more information.
Returns whether or not the specified module is currently monkeypatched. module can either be the module itself or the module’s name.
Based entirely off the name of the module, so if you import a module some other way than with the import keyword (including import_patched()), is_monkey_patched might not be correct about that particular module.
|
http://eventlet.net/doc/patching.html
|
CC-MAIN-2014-42
|
refinedweb
| 767
| 56.66
|
In the time since Barry Vercoe wrote the original Preface to this manual, printed above, many further contributions have been made to Csound. CsoundAC is an extended version of Csound 5.
Csound 5 begins a new major version of Csound that includes the following new features:
The use of widely--accepted open source libraries:
In addition, Istvan Varga has contributed native MIDI and audio drivers for Windows and Linux.
Plugin opcodes are working and becoming more widely accepted. Many opcodes have been moved to plugins. Most new opcodes are plugins, including:
i-rate or
k-rate.
OpcodeBase.hppheader file for writing plugin opcodes in C++. This is based on the technique of static polymorphism via template inheritance.
The Csound API is becoming more standardized and more widely used. There are interfaces or wrappers to the API in the following languages:
csound.h).
csound.hpp)). This API includes Csound score and orchestra file container functions.
import csnd).
import csnd.*;).
require "csnd";).
csound5.lisp).
John ffitch plans to replace the handwritten parser with one written using a parser generator, which should make it more bug-free and perhaps more efficient.
|
http://www.csounds.com/manual/html/RecentDevelopments.html
|
CC-MAIN-2014-41
|
refinedweb
| 188
| 56.25
|
Hi all once again, one more question from me. But this one stands between me and my final work. I am doing a REST Webservice, in which I have to send image files from the server and had to calculate processing times at the client. So, I choosen InputStream at the server, and same to catch at the Client. Seems some basic problem, I am measuring time before and after InputStream at Client..seems since its a stream as soon as receiving some bytes the program was coming to the next....better to put it in code... REST Web Service and i am using Netbeans 6.8
Server COde
Code :
@Path("/restserver/image23") public class imagetest23 { @Context private UriInfo context; /** Creates a new instance of imagetest1 */ public imagetest23() { } @GET @Path("{id}") //@Produces ("StreamingOutput/text") public InputStream GettheFile(@PathParam ("id") String cId) throws Exception { File file = new File("C:/"+cId+".png"); InputStream in = null; //File file = new File("C:/fone.gif"); FileInputStream fs = new FileInputStream(file); // int cid=01; in = new BufferedInputStream(new FileInputStream(file)); return in; } }
And at the Client Side
Code :
private static void testgettingfiles() throws IOException, WebApplicationException, HttpException, java.sql.SQLException,java.lang.ClassNotFoundException, com.sun.jersey.api.client.UniformInterfaceException { System.out.println("coming to here, start of the getmethod in client"); final String BASE_URI = ""; System.out.println("the value of string"+BASE_URI); System.out.println("coming to here before start of client"); Client c = Client.create(); WebResource service = c.resource(BASE_URI); System.out.println("coming to here after baseuri"); System.out.println("the time before fetching starts:"); long g= System.currentTimeMillis(); InputStream in=service.path("/restserver/image12").get(InputStream.class); long f=System.currentTimeMillis(); System.out.println("the total time :"+(f-g)); }
So thats the problem ..no matter the size of the image files (trying from 5 mb to 50mb) the processing time is just few milli seconds and almost the same..
tried a bit logic to convert the files
Code :
BufferedImage bi1 = ImageIO.read(in); System.out.println("the time after fetching"); long f=System.currentTimeMillis(); File file = new File("newimage1.png");//(dint changed)changing to .gif ImageIO.write(bi1, "png", file);//(dint changed)changing to .gif FileInputStream fs = new FileInputStream(file);
But getting different size files...and if i take the time here, it also includes conversion and saving file locally times....Since its REST and i test with a plane url and its returning same files size ( tried right click and save as )...
Thanks in advance guys,...spent whole night on this..
|
http://www.javaprogrammingforums.com/%20web-frameworks/3816-inputstream-problem-client-side-printingthethread.html
|
CC-MAIN-2017-26
|
refinedweb
| 418
| 51.95
|
Originally posted by Usha Vydyanathan: Hi, I thought if a statement is unreachable Java always gives error. Following code compiles fine eventhough "System.out.println("After stop method");" is not reachable because thread will stop before that. public class Q1 extends Thread { public void run() { System.out.println("Before start method"); this.stop(); System.out.println("After stop method"); } public static void main(String[] args) { Q1 a = new Q1(); a.start(); } } Can any one explain? Thanks in advance. regards, Usha
An empty block that is not a switch block can complete normally iff it is reachable. A nonempty block that is not a switch block can complete normally iff the last statement in it can complete normally. The first statement in a nonempty block that is not a switch block is reachable iff the block is reachable. Every other statement S in a nonempty block that is not a switch block is reachable iff the statement preceding S can complete normally. An expression statement can complete normally iff it is reachable
|
http://www.coderanch.com/t/199008/java-programmer-SCJP/certification/Majji-Paper
|
CC-MAIN-2014-49
|
refinedweb
| 171
| 67.55
|
TZSET(3) Linux Programmer's Manual TZSET(3)
NAME
tzset, tzname, timezone, daylight - initialize time conversion informa-
tion
SYNOPSIS
#include <time.h>
void tzset (void);
extern char *tzname[2];
extern long timezone;
extern int daylight;
DESCRIPTION
The tzset() function initializes the tzname variable from the TZ envi-
ronment variable. This function is automatically called by the other
time conversion functions that depend on the time zone. In a SysV-like
environment it will also set the variables timezone (seconds West of
GMT) and daylight (0 if this time zone does not have any daylight sav-
ings time rules, non-zero if there is a time during the year when day-
light savings time applies).
If the TZ variable does not appear in the environment, the tzname vari-
able spec-
ified Coor-
dinated sav-
ingsru-
ary 29 is never counted even in leap years.
n This specifies the Julian day with n between 0 and 365. Febru-
ary informa-
tion file-
spec envi-
ronment cor-
rect time zone file in the system time zone directory.
CONFORMING TO
SVr4, POSIX.1-2001, 4.3BSD
NOTES
Note that the variable daylight does not indicate that daylight savings, other-
wise the daylight savings time version.
SEE ALSO
date(1), gettimeofday(2), time(2), ctime(3), getenv(3), tzfile(5)
2001-11-13 TZSET(3)
|
http://man.yolinux.com/cgi-bin/man2html?cgi_command=tzset
|
CC-MAIN-2014-10
|
refinedweb
| 220
| 59.53
|
Unity: How to playback fullscreen videos using the GL class
Posted by Dimitri | Dec 22nd, 2011 | Filed under Programming
This Unity programming tutorial explains how to use the immediate mode rendering available at the GL class for the playback of video files. There is already another post here on 41 Post that shows how to do the same thing using GUITexture component. However, in this tutorial, a quad is going to be rendered and the video will be played at its texture.
Not only the steps required for achieving fullscreen video playback are going to be explained, but how to properly scale the video based on the screen dimensions is also featured in this post. Warning: this tutorial works only with Unity Pro because the free version doesn’t support video decoding. This post has been created and tested in Unity version 3.4. At the end of the post, a Unity project featuring all the code explained here is available for download both in C# and JavaScript.
Before setting the scene or programming the script, you have to create or find a video file from the internet to use with Unity. Here’s a list of Unity’s supported video formats. It’s basically what the QuickTime Player supports (without additional codecs).
After obtaining the video file, add a folder named Resources in your Project tab. Just right-click anywhere inside and select New->Folder. This is where the video files should go, just drag and drop them inside this folder.
Create the 'Resources' folder if it isn't there yet. Drag and drop the video files in it.
With the videos inside Unity, create a Unlit Texture material, by right-clicking inside the Project tab and selecting New->Material. Give it any name, such as White Unlit. Select this recently created material and set it to use the Unlit Texture shader, by selecting it from the Shader drop down menu:
Select the 'Unlit/Texture' shader from the dropdown menu. Don't assing any texture to it.
Now, take a look at the C# script responsible for setting up and starting the video playback. Here’s the code:
using UnityEngine; using System.Collections; [RequireComponent (typeof (AudioSource))] public class PlayVideo : MonoBehaviour { //a Material where the movie texture will be displayed public Material mat; //the name of the movie file (without the extension) public string movieName; //the texture wich holds the movie private MovieTexture mTex; //an AudioSource to play the audio from the movie private AudioSource movieAS; //Use this for early initialization void Awake() { //if the material hasn't been found if (!mat) { Debug.LogError("Please assign a material on the Inspector."); return; } //load the movie texture from the 'Resources' folder mTex = (MovieTexture)Resources.Load(movieName); //get the atttached AudioSource component movieAS = this.GetComponent<AudioSource>(); //set the AudioSource clip to be the same as the movie texture audio clip movieAS.clip = mTex.audioClip; } //Use this for initialization void Start() { //assign the video texture to the material texture mat.SetTexture("_MainTex", mTex); //Play the video mTex.Play(); //Play the audio from the movie movieAS.Play(); } void Update() { //Check if the video has finished playing if(!mTex.isPlaying) { //hide the video by disabling the script this.enabled = false; } } //Called after camera has finished rendering the scene void OnPostRender() { //push current matrix into the matrix stack GL.PushMatrix(); //set the material pass mat.SetPass(0); //load orthogonal projection matrix GL.LoadOrtho(); //render a quad where the video will be displayed GL.Begin(GL.QUADS); //set the color GL.Color(Color.white); //Define the quad texture coordinates and vetices GL.TexCoord2(0, 0); GL.Vertex3(0.0f, 0.0f, 0); GL.TexCoord2(0, 1); GL.Vertex3(0.0f, 1.0f, 0); GL.TexCoord2(1, 1); GL.Vertex3(1.0f, 1.0f, 0); GL.TexCoord2(1, 0); GL.Vertex3(1.0f, 0.0f, 0); GL.End(); //pop the orthogonal matrix from the stack GL.PopMatrix(); } }
In order to work properly, this script must be attached to a camera, since it relies on execution of the OnPostRender() method, that only gets called by the Camera component of the game object it’s attached to. In this code, four different member variables are being declared. The first one is a public Material object, which will display the MovieTexture (line 9). The second one, also public is a string that will hold the movie’s name (line 11). Both of then need to be initialized at the Inspector. The Material is going to be the Unlit Texture material that have just been created, and the string is going to be the name of the video file placed at the Resources folder we want to play, like this:
Select the Material and type the name of the video at the Inspector.
Back to the script, the other two declared variables are the MovieTexture and an AudioSource object. The MovieTexture is where the video will be decoded into and the AudioSource will play the movie’s audio (lines 13 and 15). The Awake() method is where all the other variables are initialized. Inside it, there is a if statement that checks if the material has been assigned (lines 21 through 25). After that, mTex is initialized by loading the MovieTexture by its name from the Resources folder (line 28). Then, the AudioSource is initialized and assigned to play the audio clip that comes with the video file (line 31 and 34).
At the Start() method, the MovieTexture is assigned as the texture of the material we have defined on the Inspector (line 41). So, each time this material is used, it will display the movie. But that’s not enough, since it would display only the first frame. To actually play the movie, the Play() method from the MovieTexture object must be called (line 44). The AudioSource object Play() method is also called, to start the audio playback (line 47).
The only thing that the Update() method does is to check if the movie has finished playing. Case it does, this script is disabled, hiding the quad that was used to render the movie texture (lines 50 through 58). As the reader might have noticed, no geometry has been assigned at the Scene to display the material mat which is rendering the MovieTexture. This geometry is being set at the OnPostRender() method, that, as previously explained, only gets called if the game object that contains it has also a Camera component.
There, a quad is being defined in a manner very similar to the calls made to the fixed function OpenGL pipeline. This means that a material is being set, in this case, the material that is displaying the movie texture (line 66); an orthogonal projection matrix is being loaded (line 68) and the texture coordinates and vertices positions are being defined (lines 74 trough 81). All that creates a quad that takes the whole screen displaying the video. When loading the orthogonal projection matrix, in Unity, the position X:0, Y:0 is the bottom left corner of the screen and the position X:1,Y:1 is the top right corner of the screen.
If this script is now executed, the movie will play taking the whole screen, but it won’t take the video’s aspect ratio in consideration and will be stretched into the four corners of the screen, because the quad vertices are set to match the edges of the screen. To successfully maintain the aspect ratio of the videos, read the following sections.
Stretching the movie’s height and how to find the new width
This is one of the cases where you want to have a 16:9 video into a 4:3 screen by cropping its sides. For this case, the height of the video is know: it’s the same as the screen’s height, in pixels. The width of the video must be calculated based on the new height in such way that it maintains the video’s original size ratio. By knowing this new width, it’s now possible to subtract the screen’s width from it and divide the obtained value by two, to find out how much each side of the video is going to be outside the screen.
With that in mind, only the following would need to be added to the above script:
//*** Omitted Code ***// //the quad half width needed to fit the video on the screen private float quadHalfWidth; //Use this for early initialization void Awake() { //*** Omitted Code ***// //find out the quad width based on the screen height and original movie aspect ratio quadHalfWidth = (((mTex.width/(float)mTex.height) * Screen.height) - Screen.width)/2; } //*** Omitted Code ***// //Called after camera has finished rendering the scene void OnPostRender() { //push current matrix into the matrix stack GL.PushMatrix(); //set the material pass mat.SetPass(0); //load orthogonal pixel projection matrix GL.LoadPixelMatrix(); //render a quad where the video will be displayed GL.Begin(GL.QUADS); //set the color GL.Color(Color.white); //Define the quad texture coordinates and vetices GL.TexCoord2(0, 0); GL.Vertex3(-quadHalfWidth, 0.0f, 0); GL.TexCoord2(0, 1); GL.Vertex3(-quadHalfWidth, Screen.height, 0); GL.TexCoord2(1, 1); GL.Vertex3(Screen.width + quadHalfWidth, Screen.height, 0); GL.TexCoord2(1, 0); GL.Vertex3(Screen.width + quadHalfWidth, 0.0f, 0); GL.End(); //pop the orthogonal matrix from the stack GL.PopMatrix(); }
Basically, there is going to be one more float variable to store how much the video is going to be placed on the X axis of the screen. Moreover,. By using this matrix, it isn’t necessary to normalize the quadHalfWidth and Screen.width: they can be directly used as vertex coordinates.
Stretching the movie’s width and how to find the new height (letterbox)
This case is exactly the opposite from the previous one: the video’s width must match the screen width, and what needs to be calculated is the new video height. The video must also be centered vertically on the screen, with two black bars: one of the top, and one of the bottom of the video. The height of the video must be calculated based on the new width in such way that it maintains the video’s original size ratio. Width the new height, the bottom vertices’ Y position must be calculated by subtracting the video’s height from the screen’s height and dividing it by two.
With that in mind, only the following would need to be added to the PlayVideo.cs script:
//*** Omitted Code ***// //the quad height needed to be display the video in the letterbox format private float quadHeight; //Y position of the bottom vertices private float quadBottomVert; //Use this for early initialization void Awake() { //*** Omitted Code ***// //find out the quad height based on the screen width and the inverse of the movie aspect ratio quadHeight = (mTex.height/(float)mTex.width) * Screen.width; //find the Y position of the bottom vertices quadBottomVert = (Screen.height - quadHeight)/2; } //*** Omitted Code ***// //Called after camera has finished rendering the scene void OnPostRender() { //push current matrix into Che matrix stack GL.PushMatrix(); //set the material pass blackMat.SetPass(0); //load orthogonal pixel projection matrix GL.LoadPixelMatrix(); //render a black quad that takes the whole screen GL.Begin(GL.QUADS); //set the color GL.Color(Color.white); //Define the quad vertices GL.Vertex3(0.0f, 0.0f, -1.0f); GL.Vertex3(0.0f, Screen.height+1, -1.0f); GL.Vertex3(Screen.width, Screen.height+1, -1.0f); GL.Vertex3(Screen.width, 0.0f, -1.0f); GL.End(); //set the material pass mat.SetPass(0); //render a quad where the video will be displayed GL.Begin(GL.QUADS); //set the color GL.Color(Color.white); //Define the quad texture coordinates and vertices GL.TexCoord2(0, 0); GL.Vertex3(0.0f, quadBottomVert, 0); GL.TexCoord2(0, 1); GL.Vertex3(0.0f, quadBottomVert + quadHeight, 0); GL.TexCoord2(1, 1); GL.Vertex3(Screen.width, quadBottomVert + quadHeight, 0); GL.TexCoord2(1, 0); GL.Vertex3(Screen.width, quadBottomVert, 0); GL.End(); //pop the orthogonal matrix from the stack GL.PopMatrix(); }
The above code features two more float member variables that will store the video’s new height and the position of the bottom vertices. Additionally, there is another Material member variable, that should be assigned at the Inspector. This material should be a black diffuse material. and is used for rendering the black bars that frames the video.
As the previous case.
Not only the video but the black bars must be rendered. So, a black quad that takes the whole screen is being rendered behind the video.
That’s it!
Downloads
- fullscreenvideo2.zip 8.01M
your post is really helpfull
but one little detail..would it be possible to read
transparent(alpha) movies with one or two additive lines of codes..?
I don’t know if it is possible.
when I tried for iPhone it got compile time error.
|
http://www.41post.com/4570/programming/unity-how-to-playback-fullscreen-videos-using-the-gl-class
|
CC-MAIN-2020-16
|
refinedweb
| 2,144
| 65.42
|
Are you sure?
This action might not be possible to undo. Are you sure you want to continue?
Instructions for Form CT-1
Employer's Annual Railroad Retirement Tax Return
Section references are to the Internal Revenue Code unless otherwise noted.
Department of the Treasury Internal Revenue Service
A Change To Note
New electronic deposit requirement. The threshold after which you must make electronic tax deposits has been increased from $50,000 to $200,000. All Federal tax deposits (such as deposits for employment, excise, and corporate income taxes) are combined to determine whether you exceeded the $200,000 threshold. See Part II of Form CT-1 and the Electronic deposit requirement on page 3 of these instructions.
When To File
File Form CT-1 by February 29, 2000. payments for group-term life insurance over $50,000 and the amount of railroad retirement taxes owed by the former employee for coverage provided after separation from service. See Pub. 15-A the prior year is taxable at the current year's tax rates, and you must include the compensation with the current year's compensation on lines 5 through 14 of Form CT-1, as appropriate. Exceptions. Compensation does not include: q Any benefit provided to or on behalf of an employee if at the time the benefit is provided it is reasonable to believe the employee can exclude such benefit from income. For information on what benefits are excludable, see Pub. 15-A. Examples of this type of benefit include: 1. Certain employee achievement awards under section 74(c), 2. Certain scholarship and fellowship grants under section 117, 3. Certain fringe benefits under section 132, and 4. Employer payments to a medical savings account under section 220. q—
Photographs of Missing Children
Use this form to report taxes imposed by the Railroad Retirement Tax Act (RRTA).
Who Must File
File Form CT-1 if you paid one or more employees compensation subject to RRTA. An employer that pays sick pay or a third-party payer of sick pay that is subject to Tier I railroad retirement and Medicare taxes must file Form CT-1. See Pub. 15-A, Employer's Supplemental Tax Guide, for details. However, see the exceptions under the definition of compensation below. Report sick pay payments on lines 11 through 14 q By its owner (as if the employees of the disregarded entity are employed directly by the owner) using the owner's name and taxpayer identification number (TIN) or q By each entity recognized as a separate entity under state law using the entity's own name and TIN. If the second method is chosen, the owner retains responsibility for the employment tax obligations of the disregarded entity. For more information, see Notice 99-6, 1999-3 I.R.B. 12.
Where To File
Send Form CT-1 to: Internal Revenue Service Center Kansas City, MO 64999
Cat. No. 16005H
1. Under a workers' compensation law, 2. Under section 2(a) of the Railroad Unemployment Insurance Act for days of sickness due to on-the-job injury, 3. Under the Railroad Retirement Act, or 4. More than 6 months after the calendar month the employee last worked. q Payments made specifically for traveling or other bona fide and necessary expenses that meet the rules in the regulations under section 62. q Payments for service performed by a nonresident alien temporarily present in the United States as a nonimmigrant under subparagraphs (F), (J), (M), or (Q) of the Immigration and Nationality Act. q 16.1% of first ................................. Employee: Pays 4.9% of first .................................. $53,700 $53,700 All $72,600 Compensation Paid in 1999 from the employee's compensation (after deduction of employee railroad retirement and income tax) or from other funds the employee makes available. Apply the compensation or other funds first to the railroad retirement tax and then to income tax. You do not have to pay the employer railroad retirement taxes on tips. Stop collecting the 6.2% Tier I employee tax when the employee's wages and tips reach the maximum for the year ($72,600 for 1999). However, your liability for Tier I employer tax on compensation continues until the compensation, not including tips, totals $72,600 for the year. If, by the 10th of the month after the month you received an employee's tip income report, you do not have enough employee funds available to deduct the employee tax, you no longer have to collect it.
Depositing Taxes
For Tier I and Tier II taxes, you are either a monthly schedule depositor or a semiweekly schedule depositor. There are also two special rules explained later—the $1,000 rule and the $100,000 next-day deposit rule. The terms “monthly schedule depositor” and “semiweekly schedule depositor” do not refer to how often your business pays its employees, or even how often you are required to make deposits. The terms identify which set of rules you must follow when a tax liability arises (when you have a payday). Before each year begins, you must determine which deposit schedule to follow. Your deposit schedule for the year is determined from the total Form CT-1 taxes reported for the lookback period. Lookback period. Which deposit schedule you must follow for depositing Tier I and Tier II taxes for a calendar year is determined from the total taxes reported on your Form CT-1 for a calendar year lookback period. The lookback period is the second calendar year preceding the current calendar year. For example, the lookback period for calendar year 2000 is calendar year 1998. Use the table below to determine which deposit schedule to follow for the current year.
IF you reported taxes for the lookback period of... $50,000 or less More than $50,000
Supplemental annuity work-hour tax rate. The supplemental annuity work-hour tax rate is 27 cents for 1999. Employer taxes. Employers must pay Tier I, Tier II, and supplemental annuity work-hour taxes. Tier I tax is divided into two parts. The amount of compensation subject to each tax is different. See the table above for the tax rates and compensation bases. For information on the special supplemental annuity tax, see the line 2 instructions on page 5. pay the tax. If you withhold too much or too little tax because you cannot determine the correct amount, correct the amount withheld by an adjustment, credit, or refund according to the regulations relating to the RRTA. If you pay the railroad retirement tax for your employee rather than withholding it, see Rev. Proc. 83-43, 1983-1 C.B. 778, for information on how to figure and report the proper amounts.. Tips. An employee who receives tips must report them to you by the 10th of the month following the month the tips are received. Tips must be reported for every month regardless of the total of compensation and tips for the month. However, an employee is not required to report tips for any month in which the tips are less than $20.
THEN you are a... business. Example. Employer A reported Form CT-1 taxes as follows: q 1998 Form CT-1—$49,000 q 1999 Form CT-1—$52,000 Employer A is a monthly schedule depositor for 2000 because its Form CT-1 taxes for its lookback period (calendar year 1998) was not more than $50,000. However, for 2001, Employer A is a semiweekly schedule depositor because A's taxes exceeded $50,000 for its lookback period (calendar year 1999).
Page 2 (1998). B discovered in March 2000 that the tax during the lookback period was understated by $10,000 and corrected this error with an adjustment on the 2000 Form CT-1. B is a monthly schedule depositor for 2000 because the lookback period Form CT-1 taxes are based on the amount originally reported, which was not more than $50,000. The $10,000 adjustment is treated as part of the 2000 Form CT-1 taxes. When to deposit. If you are a monthly schedule depositor, deposit employer and employee Tier I and Tier II taxes accumulated during a calendar month by the 15th day of the following month. If you are a semiweekly schedule depositor, use the table below to determine when to make deposits.
Deposit Tier I and Tier II taxes for payments made on... Wednesday, Thursday, and/or Friday
No later than... The following Wednesday
Saturday, Sunday, Monday, and/or The following Friday Tuesday
The end of the calendar year always ends a semiweekly deposit period and begins a new one. For example, the 2000 calendar year ends on Sunday. Taxes accumulated on the preceding Saturday and on Sunday are subject to one deposit obligation and taxes accumulated on Monday and Tuesday (January 1 and 2, 2001) are subject to a separate deposit obligation. Deposits on banking days only. If a deposit is required to be made on a day that is not a banking day, it is considered timely if it is made by the close of the next banking day. In addition to Federal and state bank holidays, Saturdays and Sundays are treated as nonbanking days. For example, if a deposit is required to be made on Friday and Friday is not a banking day, the deposit will be considered timely if it is made by the following Monday (if Monday is a banking day). Semiweekly schedule depositors will always have at least 3 banking days to make a deposit. If any of the 3 weekdays after the end of a semiweekly period is a banking holiday, you have one additional day to deposit. For example, if you have Form CT-1 taxes accumulated for payments made on Friday and the following Monday is not a banking day, the deposit normally due on Wednesday may be made on Thursday (allowing 3 banking days to make the deposit)., it did not have a tax liability for the month. Example of a semiweekly schedule depositor. Employer D, a semiweekly schedule depositor, pays wages on the last Saturday of each month. Although D is a semiweekly schedule depositor, it will deposit just once a month because it pays wages only once a month. The deposit, however, will be made under the semiweekly deposit schedule as follows: D's taxes for the January 29, 2000 (Saturday) payday must be deposited by February 4, 2000 (Friday). Under the semiweekly deposit rule, taxes arising on Saturday through Tuesday must be deposited by the following Friday.
Exceptions. Two exceptions apply to the above deposit rules, the q $1,000 rule and q $100,000 next-day deposit rule. $1,000 rule. If your total Form CT-1 taxes for the year are less than $1,000, no deposits are required. You may pay this tax with Form CT-1. However, if you are unsure that you will accumulate less than $1,000,. For a monthly schedule depositor the deposit period is a calendar month. The deposit periods for a semiweekly schedule depositor are Wednesday through Friday and Saturday through Tuesday. For purposes of the $100,000 next-day deposit rule, do not continue accumulating taxes after the end of a deposit period., Employer E accumulates taxes of $110,000 and must deposit this amount by Tuesday, the next banking day. On Tuesday, Employer E accumulates additional taxes of $30,000. Because the $30,000 is not added to the previous $110,000, Employer E must deposit the $30,000 by Friday following the semiweekly deposit schedule. Example of $100,000 next-day deposit rule during the first year of business. Employer F started its business on January 31, 2000. Because this was the first year of its business, its Form CT-1 taxes for its lookback period are considered to be zero, and it is a monthly schedule depositor. On February 4, it paid compensation for the first time and accumulated taxes of $40,000. On February 11, Employer F paid compensation and accumulated taxes of $60,000, bringing its total accumulated (undeposited) taxes to $100,000. Because Employer F accumulated $100,000 on February 11 (Friday), it must deposit the $100,000 by February 14 (Monday), the next banking day. It became a semiweekly schedule depositor on February 12. It will be a semiweekly schedule depositor for the rest of 2000 and for 2001., Employer G must deposit $95,000 by Friday and $10,000 by the following Wednesday. Accuracy of deposits rule. You are required to deposit 100% of your railroad retirement taxes on or before the deposit due date. However, penalties will not be applied for depositing less than 100% if both of the following conditions are met: 1. Any deposit shortfall does not exceed the greater of $100 or 2% of the amount of taxes otherwise required to be deposited and 2. The deposit shortfall is paid or deposited by the shortfall makeup date as described below. q Monthly schedule depositor. Deposit the shortfall or pay it with your return by the due date of Form CT-1. You may pay the shortfall with Form CT-1 even if the amount is $1,000 or more. q Semiweekly schedule depositor. Deposit the shortfall by the earlier of the first Wednesday or Friday that comes on or
Page 3
after the 15th of the month following the month in which the shortfall occurred or, if earlier, the due date of Form CT-1. For example, if a semiweekly schedule depositor has a deposit shortfall during January 2000, the shortfall makeup date is February 16, 2000 (Wednesday). Supplemental annuity work-hour tax. Deposit supplemental annuity work-hour tax accumulated during a month by the first date after the 15th day of the following month on which Form CT-1 taxes are otherwise required to be deposited. For example, Employer X accumulates supplemental annuity work-hour tax for February. The supplemental annuity work-hour tax must be deposited the next time Form CT-1 taxes are required to be deposited after March 15. For a monthly schedule depositor, this would be April 15. Special supplemental annuity tax. The Railroad Retirement Board will notify you each quarter of the amount of special supplemental annuity tax. Deposit the special supplemental annuity tax by the last day of the second month after the month the quarter ended. How to make deposits. In general, you must deposit railroad retirement taxes with an authorized financial institution or a Federal Reserve bank. If you are not making electronic deposits (explained below), tax liabilities that occur after 1999 if the total of all your Federal tax deposits (such as deposits for employment tax, excise tax, and corporate income tax) in 1998 were more than $200,000. If you are already depositing electronically but your deposits did not exceed $200,000, you may continue to do so or you may deposit with Form 8109. The Electronic Federal Tax Payment System (EFTPS) or RRBLINK must be used to make electronic deposits. If you are required to make deposits by electronic funds transfer and fail to do so, you may be subject to a 10% penalty. Taxpayers who are not required to make electronic deposits may voluntarily participate in EFTPS/RRBLINK. To enroll in EFTPS, call 1-800-555-4477 or 1-800-945-8400. For general information about EFTPS, call 1-800-829-1040. To enroll in RRBLINK, call 1-888-273-2265. Depositing on time. For deposits made by EFTPS/RRBLINK to be on time, you must initiate the transaction at least one business day before the date the deposit is due. Order in which deposits are applied. Generally, tax deposits are applied first to any past due undeposited amount, with the oldest liability satisfied first. However, to minimize a failure to deposit penalty, you may designate the period to which a deposit applies if you receive a penalty notice. You must respond within 90 days of the date of the notice. Follow the instructions on the notice you receive. See Rev. Proc. 99-10, 1999-2 C.B. 11, for more information.
Specific Instructions
Final return. If you stop paying taxable compensation and will not have to file Form CT-1 in the future, you must file a final return and check the box at the top of the form under “1999.”
Line 1. Supplemental Annuity Work-Hour Tax
The supplemental annuity work-hour tax rate is 27 cents for each employee work-hour. To figure the amount to enter on line 1 multiply 27 cents by: q The actual hours of service performed by your employees in 1999 or q The number of work-hours determined by using the Safe-harbor method described on page 5. Note: To use the safe-harbor method for 1999, you must have made the election to use it with your timely filed 1998 Form CT-1. You must report work-hours for which you compensate the employee that involve a time or mileage factor. See Compensation paid on a mileage or piecework basis below. Exception. Employees covered by a supplemental pension plan established by a collective bargaining agreement between you and those employees are exempt from the supplemental annuity work-hour tax. See the line 2 instructions on page 5. Work-hours. Work-hours include time actually worked (including overtime); time paid for vacations and holidays; time (but not cash payments) allowed for meals; away-from-home terminal time; called and not used, runaround, and deadheading time; and time for attending court, investigations, and claim and safety meetings. All compensation paid as arbitraries or allowances independently of the rate and not specifically related to hours or miles, including vacation allowances based on compensation earned in the previous year, should be converted to hours by dividing by the appropriate hourly rate. Report: q Hours representing payments to make up guarantees (other than weekly or monthly money guarantees) only if the payments are made for time not actually worked. q Hours representing payments to make up weekly or monthly money guarantees only if the hours or days included in the assignments are not actually worked. q Number of hours paid for overtime, regardless of the rate at which paid. Generally, do not report: q Hours representing medical expense reimbursements or payments for periods of absence from work due to sickness or accident disability. q Hours representing payments made under arrangements that advance or reimburse to employees their business and away-from-home traveling expenses if fully accounted for and substantiated. (See the regulations under section 62.) q Travel expenses paid under a nonaccountable plan even though they are included in compensation. q Tips, amounts representing bonuses, amounts received by the exercise of an employee stock option, or any separation or severance payments., use 174 hours as the standard hourly factor for monthly rated employees. Compensation paid on a mileage or piecework basis. Compensation not based on time (hour, day, month), such as compensation paid by the mile or by the piece, must be converted into the number of hours represented by the. Trust fund recovery penalty. If taxes that must be withheld are not withheld or are not deposited or paid to the United States Treasury, the trust fund recovery penalty may apply. The penalty is 100% of such unpaid taxes.. See Circular E for more details.
Page 4 2000, you must choose it by checking the box above line 1 on your timely filed 1999 Form CT-1. If you choose the safe-harbor method, you must use it for the entire year.
Line 6. Tier I Employer Medicare Tax
Enter the compensation (other than tips and sick pay) subject to Tier I Medicare tax. Multiply by 1.45% and enter the result.
Line 7. Tier II Employer Tax
Enter the compensation (other than tips) subject to Tier II tax. Do not show more than $53,700 per employee. Multiply by 16.1% and enter the result.
Line 8. Tier I Employee Tax
Enter the compensation, including tips reported, subject to employee Tier I tax. Do not enter more than $72,600 per employee. Multiply by 6.2% and enter the result.
Line 9. Tier I Employee Medicare Tax
Enter the compensation, including tips reported, subject to employee Tier I Medicare tax. Multiply by 1.45% and enter the result. For tips, see Tips on page 2. Stop collecting the 6.2% Tier I employee tax when the employee's wages and tips reach the maximum for the year ($72,600 for 1999). However, your liability for Tier I employer tax on compensation continues until the compensation, not including tips, totals $72,600 for the (1) the total supplemental annuities paid to those employees each year plus (2) a percentage for administrative costs. Each quarter the Railroad Retirement Board will notify you of the amount due on Form G-241, Summary Statement of Quarterly Report of Railroad Retirement Supplemental Annuity Tax Liabilities. Total the amounts on Forms G-241, and enter the total on line 2. Attach Forms G-241 to Form CT-1. Deposit the special supplemental annuity tax by the last day of the second month after the month the quarter ended.
Line 10. Tier II Employee Tax
Enter the compensation, including tips reported, subject to Tier II employee tax. Only the first $53,700 of the employee's compensation for 1999 is subject to this tax. Multiply by 4.9% and enter the result. For tips, see Tips on page 2..
Lines 11 Through 14. Tier I Taxes on Sick Pay
Enter tax), make entries on lines 11 through 14. If you are subject to only the employer or employee tax, complete only the applicable line. Multiply by the appropriate rate and enter the result.
Line 3. Adjustments to Supplemental Annuity Work-Hour Tax
You may take a credit on line 3 for the total monthly reduction of employee supplemental annuities under section 2(h)(2) of the Railroad Retirement Act of 1974. Each quarter the Railroad Retirement Board will furnish you with Form G-245, Summary Statement of Quarterly Report of Railroad Retirement Supplemental Tax Credits, showing your supplemental annuity work-hour tax credit. Total the amounts shown on Forms G-245, and enter the total on line 3. Attach a copy of each Form G-245 to Form CT-1. The credit cannot exceed the amount on line 1, and any excess cannot be claimed on line 16. If the amount you enter on line 3 differs from the total amount shown on Forms G-245, attach an explanation to Form CT-1. Include the amounts from Forms G-245 in your explanation. If you need to make changes to Forms G-245, you must first contact the Railroad Retirement Board at the CAUTION following address: Chief of Employer Services and Training, Railroad Retirement Board, 844 Rush Street, Chicago, IL 60611.
Line 16. Adjustments to Taxes Based on Compensation
Use line 16 to show (a) corrections of underpayments or overpayments of taxes reported on prior year returns, (b) credits for overpayments of penalty or interest paid on tax for earlier years, and (c) a fractions of cents adjustment. (See Fractions of cents on page 6.) Do not include the 1998 overpayment that is applied to this year's return (this is included on line 19). If you are reporting both an addition and a subtraction, enter only the difference between the two on line 16. You cannot claim any excess credit from line 3 here. Enter: 1. Adjustments for sick pay and fractions of cents in their entry spaces, 2. The amount of all other adjustments in the “Other” entry space, and 3. The total of the three types of adjustments in the line 16 entry space to the right. Explanation of line 16 adjustments. Except for adjustments for fractions of cents, explain amounts entered on line 16 in a statement. Attach a full sheet of paper that shows at the top your name, employer identification number, calendar year of the
!
Line 5. Tier I Employer Tax
Enter the compensation (other than tips and sick pay) subject to Tier I tax. Do not show more than $72,600 per employee. Multiply by 6.2% and enter the result.
Page 5
return, and “Form CT-1.” Include in the statement the following information: 1. An explanation of the item the adjustment is intended to correct showing the compensation subject to Tier I and Tier II taxes and the respective tax rates. 2. The year(s) to which the adjustment relates. 3. The amount of the adjustment for each year. 4. The name and account number of any employee from whom employee tax was undercollected or overcollected. 5. How you and the employee have settled any undercollection or overcollection of employee tax. Note: A timely filed return is considered to be filed on the last day of February of the year after the close of the tax year. Generally, adjustments for prior year returns may be made only within 3 years of that date. Fractions of cents. If there is a difference between the total employee tax on lines 8, 9, 10, 13, and 14 and the total actually deducted from your employees' compensation (including tips) plus the employer's contribution due to fractions of cents added or dropped in collecting the tax, report this difference on line 16 as a deduction or an addition. If this is the only entry on line 16, do not attach a statement to explain the adjustment.
amount for monthly schedule depositors as explained under the Accuracy of deposits rule on page 3. Enter on your check or money order your employer identification number, “Form CT-1,” and “1999.” Pay to the “United States Treasury”. You do not have to pay if line 20 is less than $1.
Line 21. Overpayment
If you deposited more than the correct amount of taxes for the year, check the first box if you want the overpayment applied to your 2000 Form CT-1. Check the second box if you want it refunded. If line 21 is less than $1, we will send you a refund or apply it to your next return only on written request. Paperwork Reduction Act Notice. We ask for the information on this form to carry out the Internal Revenue laws of the United States. We need it to ensure that you are complying with these laws and—Part I, 10 hr., 17 min.; Part II, 3 hr., 7 min.; Learning about the law or the form—Part I, 2 hr., 23 min.; Part II, 6 min.; Preparing, copying, assembling, and sending the form to the IRS—Part I, 6 hr., 16 min.; Part II, address. Instead, see Where To File on page 1.
Line 17. Adjusted Total of Taxes Based on Compensation
If the net adjustment on line 16 is: q A decrease, subtract line 16 from line 15. q An increase, add line 16 to line 15.
Line 19. Total Deposits for the Year
Enter the total Form CT-1 taxes you deposited. Also include any overpayment applied from your 1998 return.
Line 20. Balance Due
Subtract line 19 from line 18. You should have a balance due only if line 18 is less than $1,000 unless the balance is a shortfall
Page 6
|
https://www.scribd.com/document/545173/US-Internal-Revenue-Service-ict1-1999
|
CC-MAIN-2018-26
|
refinedweb
| 4,556
| 63.49
|
What is Norm for .NET
Norm is a data access library for .NET Core 3 (or .NET Standard 2.1).
Previously called
NoORM to give emphases to fact that this is Not Yet Another ORM (although I have added O/R mapping extension recently) - now it's just shortened to
Norm.
I've built it for my needs as I do frequent work on data-intense applications, and it is fully tested with PostgreSQL and Microsoft SQL Server databases.
You can find the official repository here.
Now I'm going to try to demonstrate how it can be very useful to anyone building .NET Core 3 data-intense applications.
Example
Example uses very simple example data model with just three tables:
NormUsers- Table of test users with name and email
NormRoles- Table of test roles with the role name
NormUserRoles- Junction table so we can have a many-to-many relationship between users and roles
Data definition script is here.
Also, the example provides migration that inserts 4 roles and generates 1000 initial users with randomly generated names and randomly generates emails. The script is located here, but naturally, anyone can clone or download and tweak it to generate more users for testing purposes (go for a million).
Now, let's get to examples.
Read users and show them on a web page (using razor page)
Assuming that we have configured a service that hold our database connection, we can add very simple
GetUsers method like this:
public IEnumerable<(int id, string userName, string email)> GetUsers() => _connection.Read<int, string, string>("select Id, Name, Email from NormUsers");
Now we can show our data in a table body element of our page:
<tbody> @foreach (var user in Model.Service.GetUsers()) { <tr> <td>@user.id</td> <td>@user.userName</td> <td>@user.email</td> </tr> } </tbody>
Notice anything unusual?
Well, there is no instance model here that is returned from our service.
No instance model at all.
For such scenarios - we're all used to (self-included) of having class instance models.
Those models are great - they give us benefits of editor autocompletion, enhance our testability and readability, and so on.
But
Norm doesn't return that kind of model by default.
Normreturns tuples by default because that's what databases do return - data tuples.
However, in this example, we use the c# concept of named tuples - to give names for our values.
We still have the same benefits as a data model based on class instances as we used to. Editor autocompletion, IntelliSense, testability - everything is still there,
In a sense - named tuples act like a class instance data model.
We could go even step further and use unnamed tuples and give them names when we use them in a page, by using tuple deconstruction feature like this:
<tbody> @foreach (var (id, userName, email) in Model.Service.GetUsers()) { <tr> <td>@id</td> <td>@userName</td> <td>@email</td> </tr> } </tbody>
In that case naming our tuples wouldn't even be necessary (although we can if want):
public IEnumerable<(int, string, string)> GetUsers() => _connection.Read<int, string, string>("select Id, Name, Email from NormUsers");
But then we still have to type data types twice.
Of course, unless we expose our connection to the page (which is gross anti-pattern since it compromises testability and general maintenance, but it may be good enough for something really quick):
<tbody> @foreach (var (id, userName, email) in Model.Connection.Read<int, string, string>("select Id, Name, Email from NormUsers")) { <tr> <td>@id</td> <td>@userName</td> <td>@email</td> </tr> } </tbody>
Benefits
What are they?
1. I find to be much more convenient, easier and even faster to develop
For me as developer higher code cohesion counts. I don't want to navigate somewhere else, into another class, another file, or even another project in some cases - to work on a result of that query from that particular method.
In my opinion - related code should be closer together as possible.
This:
public IEnumerable<(int id, string userName, string email)> GetUsers() => _connection.Read<int, string, string>("select Id, Name, Email from NormUsers");
- allows you to see your model which is returned immediately. Not just the name of your model. The actual model.
However, it may come to personal preferences, although I suggest you try this approach.
In that case,
Norm has extendible architecture and class instance mapper extension is included by default. It's generic
Select extension and you can use it like this:
public IEnumerable<User> GetUsers() => _connection.Read("select Id, Name, Email from NormUsers").Select<User>();
Normworks simply by creating iterator for later use over your query results.
That means that
Read method is executed immediately in a millisecond, regardless of your query. You can start building your expression trees by using
Linq extensions (or built-in Norm extension such as this generic
Select in the example above).
Actual database operation and actual reading and serialization will not commence until you call actual iteration methods such as
foreach,
ToListor
Countfor example.
Example:
public IEnumerable<(int id, string userName, IEnumerable<string> roles)> GetUsersAndRoles() => _connection.Read<int, string, string>(@" select u.Id, u.Name, r.Name as Role from NormUsers u left outer join NormUserRoles ur on u.Id = ur.UserId left outer join NormRoles r on ur.RoleId = r.Id ") .GroupBy(u => { var (id, userName, _) = u; return (id, userName); }).Select(g => ( g.Key.id, g.Key.userName, g.Select(r => { var (_, _, role) = r; return role; }) ));
this method transforms users and their roles into the composite structure where each user has its own enumerator for roles.
2. Performances. It's a bit faster
Yes, it's a bit faster, even from
Dapper, but only when you use the tuples approach described above.
That is because tuples are mapped by position - not by name, the name is irrelevant.
Performance tests are showing that Dapper averages serialization of one million records in
02.859 seconds and Norm generates tuples in
02.239 seconds.
The difference may be even higher since Norm can be used to avoid unnecessary iterations by building iterator for query results.
For example, Dapper will typically iterate once to generate results and then typically you'll have to do another iteration to do something with those results, to generate JSON response for example.
For contrast, Norm will create an iterator, then you can build your expression tree and ideally execute iteration only once.
It's just a smart way to avoid unnecessary iterations in your program.
But, to be completely honest - that whole performance thing may not matter that much.
Because it is noticeable when you start returning millions and millions of rows from database to your database client.
And if you are doing that - returning millions and millions of rows from the database - then you are doing something wrong (or just data very intense application).
Asynchronous operations and asynchronous streaming
For asynchronous operations, Norm doesn't return
Task object as some might expect. Instead, it returns
IAsyncEnumerable
From docs:
IAsyncEnumerableexposes an enumerator that provides asynchronous iteration over values of a specified type.
IAsyncEnumerable is a new type for .NET Core that got many people excited, self-included. It finally allows for real asynchronous streaming.
The goal here is to write the values to your output response stream as they appear on your database connection - while still preserving features we're used to having described above (IntelliSense, autocomplete, models, testing, etc).
Let's modify our service method to use asynchronous version:
public IAsyncEnumerable<(int id, string userName, string email)> GetUsersAsync() => _connection.ReadAsync<int, string, string>("select Id, Name, Email from NormUsers");
There is no
async and
await keywords anymore because we're not returning
Task object, so we don't need them.
Now, we can put this new
async foreach feature to good use - and render our page like this:
<tbody> @await foreach (var user in Model.Service.GetUsersAsync()) { <tr> <td>@user.id</td> <td>@user.userName</td> <td>@user.email</td> </tr> } </tbody>
What happens here is that database values are written to our page as they appear on our database connection (while we still have IntelliSense, autocomplete, and all that).
Let's compare this to what we have used to do before .NET Core 3 and
IAsyncEnumerable type, for example, we could also have generated our page like this:
<tbody> @foreach (var user in await Model.Service.GetUsersAsync().ToListAsync()) { <tr> <td>@user.id</td> <td>@user.userName</td> <td>@user.email</td> </tr> } </tbody>
This is something we used to do regularly in the pre .NET Core 3 era (although there wasn't
ToListAsync method, I'll get to that in a second).
What it does it actually waits, although asynchronously, but it still waits first - and only when database connection has returned all values - it writes them down to our page.
So, asynchronous streaming and
IAsyncEnumerabletype is quite an improvement.
In the example above we used the non-standard extension called
ToListAsync. This extension method is part of the new library for .NET Core 3, that just got out of preview that implements standard
Linq extensions for asynchronous operations over
IAsyncEnumerable type.
It is called
System.Linq.Async, developed and maintained by .NET Foundation and Contributors and it is referenced by Norm package.
This extension method in particular -
ToListAsync - extends
IAsyncEnumerable to return an asynchronous
Task that returns a list object generated by our enumerator.
So, this first version with
async foreach should be much more efficient because it is asynchronous streaming, right. But we run the page with that implementation we may notice something interesting:
Page download doesn't start until the entire page has been generated.
We can see that clearly if we add a small delay to our service method:
public IAsyncEnumerable<(int id, string userName, string email)> GetUsersAsync() => _connection.ReadAsync<int, string, string>("select Id, Name, Email from NormUsers").SelectAwait(async u => { await Task.Delay(100); return u; });
In this example,
SelectAwait extension method (part of
System.Linq.Async library, can create projection from the async task) - will add expression to an expression tree that adds small delay which is executed when we execute our
async foreach iteration on a page.
So, with that delay, we can see clearly that the page is downloaded only when the stream is finished.
Not exactly what I was hoping for, let's try something else:
REST API Controller
If not with Razor Web Page, let's if we can asynchronously stream content to a web page by using REST API and client render.
Luckily, .NET Core 3 REST API Controllers do support
IAsyncEnumerable type out-of-the-box, so that means that we can just return
IAsyncEnumerable out of the controller and framework will recognize it and serialize it properly.
[HttpGet] public IAsyncEnumerable<(int id, string userName, string email)> Get() => Service.GetUsersAsync();
Note that in this case, again,
async and
await aren't necessary anymore.
But when we run this example this is the response that we will see:
{}
Empty JSON.
That it is because the new JSON serializer from .NET Core 3 still doesn't support named tuples.
Not yet anyway. So, in order to have it work - we have to use class instance models:
public IAsyncEnumerable<User> GetUsersAsync() => _connection.ReadAsync("select Id, Name, Email from NormUsers").Select<User>();
and
[HttpGet] public IAsyncEnumerable<User> Get() => Service.GetUsersAsync();
This works as expected.
Now, again, let's add a small delay in our iterator expression tree to see does it really streams our response:
public IAsyncEnumerable<User> GetUsersAsync() => _connection.ReadAsync("select Id, Name as UserName, Email from NormUsers").Select<User>().SelectAwait(async u => { await Task.Delay(100); return u; });
No, not really. Response download will again commence only after all data has been written. So that means if we have 1000 records and each is generated in 100 milliseconds, response download will start only after 1000 * 100 milliseconds.
We'll have to try something else...
Lucky for us, .NET Core 3 is packed with exciting new tech.
Blazor pages
Blazor is an exciting new technology that comes with .NET Core 3. This version uses Blazor Server Side which is a hosting model that updates your page asynchronously by utilizing web sockets via SignalR implementation.
So, since it updates web pages asynchronously we might finally get lucky with Blazor. Let's try.
Add the code block in your page:
@code { List<User> Users = new List<User>(); protected override async Task OnInitializedAsync() { await foreach (var user in Service.GetUsersAsync()) { users.Add(user); this.StateHasChanged(); } } }
This page code block defines property
Users which will hold our results. Every time that property is changed page will be re-rendered to reflect changes in the following area:
<tbody> @foreach (var user in Users) { <tr> <td>@user.Id</td> <td>@user.UserName</td> <td>@user.Email</td> </tr> } </tbody>
Also, you may notice that we have overridden
OnInitializedAsync protected method:
protected override async Task OnInitializedAsync() { await foreach (var user in Service.GetUsersAsync()) { users.Add(user); this.StateHasChanged(); } }
This will be executed after page initialization and we can use that to stream into our reactive property. And since it is in this special initialization event - we have to explicitly inform the page that state has been changed with additional
StateHasChanged call.
And that's it, this looks good, this should work. And really, when we open this page we can see that the table is populated progressively, one by one. So it seems that we've finally achieved asynchronous streaming directly from our database to our page. It only seems so at first.
That is until we add a small delay again to our data service method.
What will happen in that case is the real rendering of the page will only start when
OnInitializedAsync method is completed. State changes are buffered after the execution of that method. So the page will first await for that execution and then start rendering asynchronously.
Bummer. That's not exactly what I was hoping to achieve.
But, there is still one option left. Since Blazor is using
WebSockets - maybe we can utilize them too, to finally have real asynchronous streaming from the database to web page.
SignalR streaming
SignalR is Microsoft implementation of
WebSockets technology and apparently, it does support streaming.
So, first, let's create
SignalR hub that returns our
IAsyncEnumerable:
public class UsersHub : Hub { public UsersService Service { get; }; public UsersHub(UsersService service) { Service = service; } public IAsyncEnumerable<User> Users() => Service.GetUsersAsync(); }
Next, we'll have to build a web page that connects to our streaming hub and with simple client renderer. Entire Razor web page:
@page @{ <thead> <tr> <th>Id</th> <th>Username</th> <th>Email</th> </tr> </thead> <tbody id="table-body"> <!-- content --> </tbody> </table> <template id="row-template"> <td>${this.id}</td> <td>${this.userName}</td> <td>${this.email}</td> </template> <script src="~/js/signalr/dist/browser/signalr.min.js"></script> <script> (async function () { const connection = new signalR.HubConnectionBuilder().withUrl("/usersHub").build(), tableBody = document.getElementById("table-body"), template = document.getElementById("row-template").innerHTML; await connection.start(); connection.stream("Users").subscribe({ next: item => { let tr = document.createElement("tr"); tr.innerHTML = new Function('return `' + template + '`').call(item); tableBody.appendChild(tr); } }); })(); </script>
Yay! With a little help of JavaScript - finally, finally - it works as expected:
Data is streamed properly for our database to our web page. It doesn't matter now if we add delay to our data service, the stream will start immediately. If we add, let's say a one-second delay, the new row will appear on a web page every second. As soon as database returns data row it sent down the web socket and into our web page where it is rendered immediately.
It's a beautiful thing to watch, it really is, almost brought a tear to my eye ;)
So that is it, I hope I have managed to demonstrate how Norm data access can be useful to anyone developing data application with .NET Core 3 as it is useful to me, and also how to asynchronously stream your data from database to a web page and still being able to keep editor features, models, testability and all of those wonderful things we used to have.
If you have any comments, suggestions, or criticisms or anything to add - please let me know in comments down below.
Discussion (4)
Fantastic article! The new streaming feature paired with SignalR's streaming seems like a win-win. Norm's source is very slick, succinct, clean and extensible, ValueTask friendly; amazing! Never seen the JS
<template>in use, thanks for showing that also. Would be amazing if this iterator building approach you have employed could be accommodated by bigger ORM players. Congrats!
Thanks.
You haven't seen
<template>probably because you use js frameworks too much 😁
Cool post, cool library! 👍
Now, if only the tuple syntax could be lightened up through type aliasing, we could have method signatures that were readable 😁
Thanks.
What I do usually is wrap it into class like this:
HTH
|
https://dev.to/vbilopav/norm-data-access-for-net-core-3-fal
|
CC-MAIN-2022-05
|
refinedweb
| 2,826
| 55.74
|
Developing Simple Smart Tags
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Paul Cornell
Microsoft Corporation
May 2001
Applies to:
Microsoft® Office XP
Summary: This article describes how to create, deploy, and manage simple smart tags for Microsoft Office XP by using Extensible Markup Language (XML) files. (10 printed pages)
Download ODC_stXML.exe.
Contents
Introduction
Creating Your First Simple Smart Tag
Exploring the Smart Tag XML Syntax
Deploying Simple Smart Tags by Using the Visual Studio Installer
Updating Simple Smart Tags
Conclusion
Introduction
Smart tags are a new feature in Microsoft®. For example, "Paul Cornell" could be labeled as a person's name, and "MSFT" could be labeled as a stock ticker symbol. Once the text has been labeled, users can choose from a list of available actions that apply to that text. For example, a user might want to create a new contact record in Outlook with "Paul Cornell" already placed into the Full Name field. Similarly, a user might want to get the latest stock price for "MSFT" from the MoneyCentral Web site on the Microsoft Network (MSN®). Smart tags makes such features easy: the user can rest the mouse pointer on "Paul Cornell," click the Smart Tag Actions button, and select Add to Contacts. Likewise, the user can rest the mouse pointer on "MSFT," click the Smart Tag Actions button, and then click Stock quote on MSN Money Central. Smart tags are extensible, so you can create your own recognizable strings, category labels, and customizable actions for those categories as well.
There are several options for creating your own smart tags. For dynamic, highly-interactive smart tags, you can use a Component Object Model (COM)-based application development system such as Microsoft Visual Basic® or Microsoft Visual C++®. For simple smart tags you can use a text editor or HTML editor (such as Notepad or Microsoft FrontPage®). This article focuses on the simple smart tag approach. For information on creating dynamic, highly interactive smart tags by using Visual Basic, you can start with another article I've written titled "Developing Smart Tag DLLs." For more information on smart tag development in general, download the Smart Tag Software Development Kit (SDK).
**Note **I use the term "simple smart tag" in this article to mean a smart tag that allows a user to only browse to a Web site (and possibly pass the actionable text as a parameter to the Web site).
You can create a simple smart tag by adhering to the smart tag list schema, a syntax that Microsoft has designated so that Microsoft Office XP can recognize certain text strings as actionable, as well as provide the appropriate actions for these text strings. The smart tag list schema is described in Extensible Markup Language (XML) format. Explaining XML is beyond the scope of this article; for more information on XML, see the MSDN Online XML Developer Center.
When you've finished typing your simple smart tag schema, you will need to save the file containing the XML (also known as an XML list description file) to a specific path on the end user's computer. Office XP uses this path to find the functionality for locating and labeling actionable text. A deployment tool such as the Microsoft Visual Studio® Installer can automate the deployment of XML list description files.
If you want to provide updates to the available text and actions for an XML list description file you've already deployed, you can add simple XML files to a Web server (such as the one included with Microsoft Internet Information Services) so that end users can automatically pull updates down to their computers.
I will explain how to create, save, deploy, test, and manage these XML list description files in the sections that follow.
Creating Your First Simple Smart Tag
To create your first XML list description file:
Make sure all of your smart tag-aware applications (Word 2002, Excel 2002, Outlook 2002, and Internet Explorer) are shut down.
Start Notepad and type the following (or view the file msdnodc.xml in the sample download):
<FL:smarttaglist xmlns: <FL:name>MSDN Office Developer Center Related Terms</FL:name> <FL:lcid>1033</FL:lcid> <FL:description>A list of MSDN Office Developer Center related terms for recognition, as well as a set of actions that work with them.</FL:description> <FL:moreinfourl></FL:moreinfourl> <FL:smarttag <FL:caption>MSDN Office Developer Center Related Terms</FL:caption> <FL:terms> <FL:termlist>access, developer, excel, msdn, office, outlook, powerpoint, vba, visual, word, xp</FL:termlist> </FL:terms> <FL:actions> <FL:action <FL:caption>&MSDN Office Developer Web site</FL:caption> <FL:url></FL:url> </FL:action> <FL:action <FL:caption>MSDN Main &Web site</FL:caption> <FL:url></FL:url> </FL:action> <FL:action <FL:caption>Microsoft &Office Web site</FL:caption> <FL:url></FL:url> </FL:action> </FL:actions> </FL:smarttag> </FL:smarttaglist>
3. Save the file as msdnodc.xml in the following directory: C:\Program Files\Common Files\Microsoft Shared\Smart Tag\Lists.
4. Start Word 2002 and type one or more of the following words, separated by spaces or carriage returns: access, developer, excel, msdn, office, outlook, powerpoint, vba, visual, word, or xp.
5. Underneath any of the words you typed in step four you will notice a dotted purple underline. Rest the mouse pointer on one of these words, click the Smart Tag Actions button, and click one of the choices on the context menu, such as MSDN Office Developer Web site, MSDN Main Web site, or Microsoft Office Web site.
Exploring the Smart Tag XML Syntax
The XML in the previous exercise conforms to a specific syntax that Microsoft has defined for simple smart tags. To enable you to customize the XML to meet your own needs, I will explain the syntax.
The first line of text,
<FL:smarttaglist xmlns:, defines the root element and the namespace for the smart tag. If you're familiar with XML namespaces, you know that the arbitrary string "
FL" is an alias for writing the longer "
urn:schemas-microosft-com:smarttags:list" at the beginning of every XML opening and closing tag.
Each XML list description file can have a list containing multiple smart tag terms. Table 1 below describes the various XML elements and examples of their use in a simple smart tag XML list description file. Note that if an XML element listed below is not implemented in the exercise above, it is because that smart tag was not designed to be updateable. I will show you an example later in this article of how to create an updateable simple smart tag.
Table 1. Smart tag XML list description elements (in order of appearance)
One special case for the url element above is that you can pass in the actionable text as a parameter to the URL by using the syntax
{TEXT}. For example, for a stock quote on Money Central, the contents of the url element would be{TEXT}, where
{TEXT} is a stock ticker symbol currently displaying the Smart Tag Actions button (such as "MSFT").
Deploying Simple Smart Tags by Using the Visual Studio Installer
To deploy your simple smart tag, you could simply have end users copy the XML list description file to their C:\Program Files\Common Files\Microsoft Shared\Smart Tag\Lists folders, but this approach can be time-consuming for end users. An easier solution is to use a deployment tool such as the Microsoft Visual Studio Installer. The Visual Studio Installer is available for download at the Visual Studio Web site for licensed users of any Visual Studio 6.0 Professional or Enterprise edition tool; see the Visual Studio Web site for more information on how to download and install the Visual Studio Installer.
To deploy a simple smart tag by using the Visual Studio Installer:
On the Start menu, point to Programs, point to Microsoft Visual Studio 6.0, point to Microsoft Visual Studio 6.0 Enterprise Tools, and then click Visual Studio Installer.
In the New Project dialog box, on the New tab, expand the Visual Studio folder, and then select the Visual Studio Installer Projects folder.
Select the Empty Installer icon, type a name for your new project in the Name box, type a path to your new project in the Location box, and then click Open.
In the Project Explorer window, double-click File System. Right-click File System on Target Machine, point to Add Special Folder, and then click Program Files Folder.
Right-click Program Files Folder, and then click Add Folder. Rename the new folder Common Files.
Right-click Common Files, and then click Add Folder. Rename the new folder Microsoft Shared.
Right-click Microsoft Shared, and then click Add Folder. Rename the new folder Smart Tag.
Right-click Smart Tag, and then click Add Folder. Rename the new folder Lists.
Right-click Lists, and then click Add File(s). Browse to the smart tag XML list description file you want to install on the end user's computer, and then click Open.
In the Project Explorer window, double-click User Interface. Right-click Select Installation Folder, and then click Delete.
**Note **If you do not delete the Select Installation Folder dialog box, the Setup Wizard suggests the default folder C:\Program Files\Your-Project-Name to place the XML file. Because you want to put the file into a different location, by deleting this dialog box, you ensure that the file will be placed into the end user's C:\ :\Program Files\Common Files\Microsoft Shared\Smart Tag\Lists folder.
On the Build menu, click Build.
Using Windows Explorer, browse to the path you created in step 3 above. In that path you will find a subfolder named Output. Open the Output folder, and then open the subfolder named DISK_1. In this folder you will find a file with the extension .msi. This is the Visual Studio Installer file you will distribute to end users. To deploy your XML file, end users must simply double-click the .msi file and accept the defaults that the Setup Wizard suggests.
I used Visual Studio Installer to create a .msi file named MSDNODCST.msi (included in the sample download) that downloads the msdnodc.xml file. I have also included the project files that you can use as a start to your own Visual Studio Installer project.
Updating Simple Smart Tags
To allow your XML list description files to be dynamically updateable over the Internet or an intranet, you must provide five additional elements in your XML list definition file: updateable, autoupdate, lastcheckpoint, lastupdate, and updateurl. You should also include the optional updatefrequency element. More information about these elements is included in Table 1 above.
To provide updates to your XML list description files, you must include a helper XML file on your Web server using the following syntax:
<FLUP:smarttaglistupdate xmlns: <FLUP:checkpoint>400</FLUP:checkpoint> <FLUP:smarttaglistdefinition>msdnodc.xml</FLUP:smarttaglistdefinition> </FLUP:smarttaglistupdate>
The value of the checkpoint element must be greater than the value of the lastcheckpoint element in the XML list description file in order for updates to be pulled down to the end user's computer. The contents of the XML list description file indicated in the smattaglistdefinition element will be pulled down to the end user's computer and will overwrite their existing file.
To test this behavior on your own computer (assuming you have a local Web server), do the following:
Using the sample XML list description file msdnodc.xml discussed earlier in this article, add the following XML between the moreinfourl and smarttag elements (or view the file msdnodcupdate.xml in the sample download):
<FL:updateable>true</FL:updateable> <FL:autoupdate>true</FL:autoupdate> <FL:lastcheckpoint>1</FL:lastcheckpoint> <FL:lastupdate>0</FL:lastupdate> <FL:updateurl></FL:updateurl> <FL:updatefrequency>5</FL:updatefrequency>
In this example,
localhostis the name of your Web server. Place your newly-modified XML list description file in the C:\Program Files\Common Files\Microsoft Shared\Smart Tag\Lists folder on your computer.
On your local Web server, create a virtual directory called smarttags. In the smarttags virtual directory, create a file named msdnupdate.xml with the XML in the "FLUP" namespace above.
**Note **The smarttags virtual directory must have full read permissions and allow for anonymous access.
In that same smarttags directory, place a copy of the newly-modified msdnodc.xml file (or the msdnodcupdate.xml file) from step 1 above, with the following change: the termlist element should have some additional terms, such as basic and 2002.
Assuming your have connectivity to your Web server, after five minutes have passed, you can have your computer recognize the new basic and 2002 terms by performing two tasks: first, you must execute at least one of the actions on the smart tag action lists that appear when you type terms such as access, developer, or excel and then click the Smart Tag Actions button (this forces your computer to check for updates to all locally registered smart tags); second, you must restart your smart-tag aware application (this reinitializes all locally-registered smart tags with the new smart tag values and actions). Then you should be able to type basic or 2002 and have the same Smart Tag Options button appear as for the other terms in the list such as access, developer, and excel.
Conclusion
With only a text editor such as Notepad, you can create simple smart tag XML list description files. These simple smart tags can be deployed to an unlimited number of Office XP users by using a deployment tool such as the Visual Studio Installer. In this article, you learned how to create XML list description files that conform to the Microsoft smart tag XML list description schema. You also learned how to deploy your XML list description files by using the Visual Studio Installer. Finally, you learned how to provide updates to users of your XML list description files over the Internet or an intranet.
|
https://docs.microsoft.com/en-us/previous-versions/office/developer/office-xp/aa163627(v=office.10)?redirectedfrom=MSDN
|
CC-MAIN-2020-10
|
refinedweb
| 2,368
| 50.57
|
Aliasing with ‘as’ keyword
In Python, the
as keyword can be used to give an alternative name as an alias for a Python module or function.
# Aliasing matplotlib.pyplot as plt from matplotlib import pyplot as plt plt.plot(x, y) # Aliasing calendar as c import calendar as c print(c.month_name[1]).
# Three different ways to import modules: # First way import module module.function() # Second way from module import function function() # Third way from module import * function().
# Returns a random integer N in a given range, such that start <= N <= end # random.randint(start, end) r1 = random.randint(0, 10) print(r1) # Random integer where 0 <= r1 <= 10 # Prints a random element from a sequence seq = ["a", "b", "c", "d", "e"] r2 = random.choice(seq) print(r2) # Random element in the sequence
Module importing
In Python, you can import and use the content of another file using
import filename, provided that it is in the same folder as the current file you are writing.
# file1 content # def f1_function(): # return "Hello World" # file2 import file1 # Now we can use f1_function, because we imported file1 f1_function()
|
https://www.codecademy.com/learn/learn-python-3/modules/learn-python3-modules/cheatsheet
|
CC-MAIN-2022-05
|
refinedweb
| 185
| 54.22
|
The graph painter class. Implements all graphs' drawing's options.
Graphs are drawn via the painter
TGraphPainter class. This class implements techniques needed to display the various kind of graphs i.e.:
TGraph,
TGraphErrors,
TGraphBentErrors and
TGraphAsymmErrors.
To draw a graph
graph it's enough to do:
graph->Draw("AL");
The option
AL in the
Draw() method means:
A),
The graph should be drawn as a simple line (option
L).
By default a graph is drawn in the current pad in the current coordinate system. To define a suitable coordinate system and draw the axis the option
A must be specified.:
TPad::Update.
Graphs can be drawn with the following options:
Drawing options can be combined. In the following example the graph is drawn as a smooth curve (option "C") with markers (option "P") and with axes (option "A").
The following macro shows the option "B" usage. It can be combined with the option "1".
When a graph is painted with the option
C or
L it is possible to draw a filled area on one side of the line. This is useful to show exclusion zones.
This drawing mode is activated when the absolute value of the graph line width (set by
SetLineWidth()) is greater than 99. In that case the line width number is interpreted as:
100*ff+ll = ffll
llrepresent the normal line width
ffrepresent the filled area width.
The current fill area attributes are used to draw the hatched zone.
Three classes are available to handle graphs with error bars:
TGraphErrors,
TGraphAsymmErrors and
TGraphBentErrors. The following drawing options are specific to graphs with error bars:).
A
TGraphErrors is a
TGraph with error bars. The errors are defined along X and Y and are symmetric: The left and right errors are the same along X and the bottom and up errors are the same along Y.
The option "0" shows the error bars for data points outside range.
The option "3" shows the errors as a band..
The following example shows how the option "[]" can be used to superimpose systematic errors on top of a graph with statistical errors.
A
TGraphAsymmErrors is like a
TGraphErrors but the errors defined along X and Y are not symmetric: The left and right errors are different along X and the bottom and up errors are different along Y.
A
TGraphBentErrors is like a
TGraphAsymmErrors. An extra parameter allows to bend the error bars to better see them when several graphs are drawn on the same plot.
A
TGraphMultiErrors works basically the same way like a
TGraphAsymmErrors. It has the possibility to define more than one type / dimension of y-Errors. This is useful if you want to plot statistic and systematic errors at once.
To be able to define different drawing options for the multiple error dimensions the option string can consist of multiple blocks separated by semicolons. The painting method assigns these blocks to the error dimensions. The first block is always used for the general draw options and options concerning the x-Errors. In case there are less than NErrorDimensions + 1 blocks in the option string the first block is also used for the first error dimension which is reserved for statistical errors. The remaining blocks are assigned to the remaining dimensions.
In addition to the draw options of options of
TGraphAsymmErrors the following are possible:
Per default the Fill and Line Styles of the Graph are being used for all error dimensions. To use the specific ones add the draw option "S" to the first block.
The drawing options for the polar graphs are the following:
When several graphs are painted in the same canvas or when a multi-graph is drawn, it might be useful to have an easy and automatic way to choose their color. The simplest way is to pick colors in the current active color palette. Palette coloring for histogram is activated thanks to the options
PFC (Palette Fill Color),
PLC (Palette Line Color) and
PMC (Palette Marker Color). When one of these options is given to
TGraph::Draw the graph get its color from the current color palette defined by
gStyle->SetPalette(…). The color is determined according to the number of objects having palette coloring in the current pad.
When a TGraph.
Like histograms, graphs can be drawn in logarithmic scale along X and Y. When a pad is set to logarithmic scale with TPad::SetLogx() and/or with TPad::SetLogy() the points building the graph are converted into logarithmic scale. But only the points not the lines connecting them which stay linear. This can be clearly seen on the following example:
Highlight mode is implemented for
TGraph (and for
TH1) class. When highlight mode is on, mouse movement over the point will be represented graphically. Point will be highlighted as "point circle" (presented by marker object). Moreover, any highlight (change of point) emits signal
TCanvas::Highlighted() which allows the user to react and call their own function. For a better understanding please see also the tutorials
$ROOTSYS/tutorials/graphs/hlGraph*.C files.
Highlight mode is switched on/off by
TGraph::SetHighlight() function or interactively from
TGraph context menu.
TGraph::IsHighlight() to verify whether the highlight mode enabled or disabled, default it is disabled.
See how it is used highlight mode and user function (is fully equivalent as for histogram).
NOTE all parameters of user function are taken from
void TCanvas::Highlighted(TVirtualPad *pad, TObject *obj, Int_t x, Int_t y)
padis pointer to pad with highlighted graph
objis pointer to highlighted graph
xis highlighted x-th (i-th) point for graph
ynot in use (only for 2D histogram)
For more complex demo please see for example
$ROOTSYS/tutorials/math/hlquantiles.C file.
Definition at line 29 of file TGraphPainter.h.
#include <TGraphPainter.h>
Default constructor.
Definition at line 640 of file TGraphPainter.cxx.
Destructor.
Definition at line 648 of file TGraphPainter.cxx..
Definition at line 663 of file TGraphPainter.cxx.
Compute distance from point px,py to a graph.
Compute the closest distance of approach from point px,py to this line. The distance is computed in pixels units.
Implements TVirtualGraphPainter.
Definition at line 691 of file TGraphPainter.cxx.
Display a panel with all histogram drawing options.
Implements TVirtualGraphPainter.
Definition at line 781 of file TGraphPainter.cxx..
Implements TVirtualGraphPainter.
Definition at line 806 of file TGraphPainter.cxx.
Return the highlighted point for theGraph.
Definition at line 1095 of file TGraphPainter.cxx.
Implements TVirtualGraphPainter.
Definition at line 1086 of file TGraphPainter.cxx.
Check on highlight point.
Definition at line 1121 of file TGraphPainter.cxx.
[Control function to draw a graph.]($GP01)
Implements TVirtualGraphPainter.
Definition at line 1267 of file TGraphPainter.cxx.
Paint this TGraphAsymmErrors with its current attributes.
Definition at line 2397 of file TGraphPainter.cxx.
[Paint this TGraphBentErrors with its current attributes.]($GP03)
Definition at line 3114 of file TGraphPainter.cxx.
[Paint this TGraphErrors with its current attributes.]($GP03)
Definition at line 3370 of file TGraphPainter.cxx.
This is a service method used by
THistPainter to paint 1D histograms.
It is not used to paint TGraph.
Input parameters:
The aspect of the histogram is done according to the value of the chopt.
Implements TVirtualGraphPainter.
Definition at line 1672 of file TGraphPainter.cxx.
[Paint this TGraphMultiErrors with its current attributes.]($GP03)
Definition at line 2643 of file TGraphPainter.cxx.
[Paint this TGraphPolar with its current attributes.]($GP04)
Definition at line 3617 of file TGraphPainter.cxx.
Paint this graphQQ. No options for the time being.
Definition at line 3913 of file TGraphPainter.cxx.
Paint theGraph reverting values along X and/or Y axis. a new graph is created.
Definition at line 3973 of file TGraphPainter.cxx.
Paint a simple graph, without errors bars.
Definition at line 4116 of file TGraphPainter.cxx.
Paint a any kind of TGraph.
Implements TVirtualGraphPainter.
Definition at line 1196 of file TGraphPainter.cxx.
Paint highlight point as TMarker object (open circle)
Definition at line 1150 of file TGraphPainter.cxx.
Paint a polyline with hatches on one side showing an exclusion zone.
x and y are the the vectors holding the polyline and n the number of points in the polyline and
w the width of the hatches.
w can be negative. This method is not meant to be used directly. It is called automatically according to the line style convention.
Definition at line 4156 of file TGraphPainter.cxx.
Paint the statistics box with the fit info.
Implements TVirtualGraphPainter.
Definition at line 4361 of file TGraphPainter.cxx.
Set highlight (enable/disable) mode for theGraph.
Implements TVirtualGraphPainter.
Definition at line 1105 of file TGraphPainter.cxx.
Static function to set
fgMaxPointsPerLine for graph painting.
When graphs are painted with lines, they are split into chunks of length
fgMaxPointsPerLine. This allows to paint line with an "infinite" number of points. In some case this "chunks painting" technic may create artefacts at the chunk's boundaries. For instance when zooming deeply in a PDF file. To avoid this effect it might be necessary to increase the chunks' size using this function:
TGraphPainter::SetMaxPointsPerLine(20000).
Definition at line 4948 of file TGraphPainter.cxx.
Smooth a curve given by N points.
The original code is from an underlaying routine for Draw based on the CERN GD3 routine TVIPTE:
Author - Marlow etc. Modified by - P. Ward Date - 3.10.1973
This methodP p392 6
Definition at line 4474 of file TGraphPainter.cxx.
Definition at line 64 of file TGraphPainter.h.
|
https://root.cern.ch/doc/master/classTGraphPainter.html
|
CC-MAIN-2020-29
|
refinedweb
| 1,562
| 59.19
|
Varargs:
Java has included a feature in JDK 5 that simplifies the creation of methods that require a variable number of arguments. This feature is known as varargs, which is an abbreviation for variable-length arguments. A varargs method is one that accepts a variable number of arguments.
Variable-length arguments could be handled in two ways prior to JDK 5. One method employs overloaded methods (one for each), while another places the arguments in an array and then passes this array to the method. Both are potentially error-prone and necessitate more code. The varargs feature is a better, simpler option.
Arraylist:
The elements of the Java ArrayList class are stored in a dynamic array. It’s similar to an array, but there’s no size limit. At any time, we can add or remove elements. As a result, it is far more adaptable than a traditional array. It’s in the java.util package. It is analogous to the Vector in C++.
In Java, duplicate elements can also exist in an ArrayList. It implements the List interface, so we can use all of the List interface’s methods here. Internally, the ArrayList keeps track of the insertion order.
It derives from AbstractList and implements the List interface.
In this article, we’ll look at how to pass an arraylist to a method that takes vararg as an argument.
Passing an ArrayList to Varargs Method
Assume we have a method that accepts Integer varargs and computes their product.
int findProduct(Integer... numbers) { // declaring product as 1 int product = 1; // computing the product for (int ele : numbers) { product = product * ele; } return product; }
We can call this function by many ways some of them are:
1)This function can now be called by passing arguments separately i.e
findProduct(5, 6, 7);
2)passing an array
Integer[] array1 = { 2, 8, 1, 1, 3, 1 }; findProduct(array1);
3)passing Arraylist
Assume we want to pass an ArrayList to the vararg parameter of this method.
ArrayList<Integer> intlist = new ArrayList<>(); findProduct(intlist);
It will result in a compile error because we cannot directly pass an ArrayList to vararg in a method parameter. So, let’s see how we can do this.
To accomplish this, we must first convert our ArrayList to an Array and then pass it to the method that expects vararg. This can be done in a single line, i.e.
findProduct(intlist.toArray(new Integer[0]));
Below is the implementation:
import java.io.*; import java.lang.*; import java.util.*; class Codechef { // function which Accepts a variable number of arguments // and computes the product of all passed elements. int findProduct(Integer... numbers) { // declaring product as 1 int product = 1; // computing the product for (int ele : numbers) { product = product * ele; } return product; } public static void main(String[] args) throws java.lang.Exception { // taking a object of given class Codechef classobject = new Codechef(); // initializing array with some values Integer[] array1 = { 1, 2, 3, 4, 5, 6 }; // converting array to array list ArrayList<Integer> intlist = new ArrayList<>(Arrays.asList(array1)); int product = classobject.findProduct( intlist.toArray(new Integer[0])); // printing the sum System.out.println("Product is = " + product); } }
Output:
Product is = 720
Related Programs:
- python how to find all indexes of an item in a list
- python how to check if an item exists in list
- python how to create an empty set and append items to it
- python how to create an empty list and append items to it
- pandas how to create an empty dataframe and append rows columns to it in python
- python how to add an element in list append vs extend
- python how to insert an element at specific index in list
|
https://btechgeeks.com/how-to-pass-an-arraylist-to-varargs-method/
|
CC-MAIN-2022-27
|
refinedweb
| 613
| 61.87
|
Cracks in the Foundation
by Micah Dubinko
|
Pages: 1, 2
Other specific choices made in the development of XML namespaces cause persistent confusion among markup practitioners. For one, namespace prefixes are largely incompatible with DTDs, which, although unfashionable, are still a built-in part of XML and intimately connected to any use of XML involving DOCTYPEs or named character entities. In other words, they're still important to nearly any web developer.
Does a namespace declaration apply to elements or attributes? A reasonable answer would be "yes and no"; the subtleties still pop up in mailing lists. Ron Bourret covered this and more in the seminal Namespace Myths Exploded article previously published on this site. The way things ended up, attributes can't be placed in a specific namespace without an explicit prefix regardless of whether a conflict is even possible -- a decision that would cause problems later.
Another trouble spot lies in the use of "namespace names," or strings that look like URLs, which add a truckload of URL baggage to the spec and lead many enthusiastic new learners to wonder what will happen if they visit that URL in a browser. This is an old debate, one that won't be rehashed here. But direct confusion from the XML Namespaces spec is only the beginning.
QNames in content: what does this phrase bring to mind? The Namespaces in XML spec defined QNames but remained silent on the topic of using them in content; in practice, it arrived with XPath 1.0, which needed a way to refer to element and attribute names. At the time, making XPath identifiers look the same way as the elements themselves was justified as the most sensible way to deal with two-part names with one part bound to a longer third name. Over time, though, this practice has fallen out of favor and been compared to "using TCP packets as delimiters in an application protocol." This bit of unpleasantness has become firmly entrenched in XML vocabularies, at a minimum including any that use XPath. The lineage of this practice can be traced straight back to namespaces.
Aside from using QNames in content, the XML Schema Part 1 specification has been criticized for its complexity. I started counting how many times the word "namespace" or its plural appears in the document and gave up somewhere around 400. How much of this complexity is caused by namespace-think?
Then there's XLink, once a promising branch of XML technology. XLink failed to meet a key requirement:.
The syntactic restrictions introduced by namespaces caused this conflict. It wasn't possible to meet this requirement and define XLink as a distinct namespaced vocabulary.
Even when vocabularies use namespaces, there's no guarantee of coordination. If anything, scoping encourages folks to go off and do their own thing. Already within the W3C we have paragraphs as html:p as well as speech:p, where html and speech map to the "namespace names" for XHTML and Speech Synthesis Markup Language, respectively. (Don't even get me started on wml:p.) Markup vocabularies also have multiple anchors as a elements, including XHTML, SMIL, and others outside of W3C. So the problem attributed to chameleon namespaces at the outset of this article has already come to pass. In aggregate, the amount of time that has been wasted debating and rehashing such issues in standardization and development communities is staggering.
html:p
speech:p
html
speech
wml:p
a
There are a few other lines of evidence that will have to go in another article, like the mobile industry reaction to namespaces or examining the continual stream of proposed alternatives. Individually, any of the objections recounted here wouldn't amount to much. Collectively, though, they form a composite sign that suggests that the XML community might need to reconsider not only its approach and attitudes toward HTML, but toward the foundation of namespaces as well.
What would the XML world look like without namespaces, or with a less intrusive version thereof? Docbook and HTML would continue to be fine. Newer languages like SVG would be slightly different in details, but overall the same. The big question is what compound documents would look like, but it's hard to imagine the situation much worse than what we have today.
So far, the W3C hasn't posted an official notice to the effect of what Tim Berners-Lee wrote on his blog. Nevertheless, it's encouraging to see a willingness to change course when needed. Let's hope this willingness extends deep enough to reconsider namespaces. The tension between incremental HTML 4 philosophies and XML namespace practice will only get stronger.
The formal objection noted at the start of this article concludes with these words:
If we're going to go changing the namespace for every host language that comes along, we might as well not have namespaces in the first place.
Actually, that doesn't sound like such a bad alternative.
Disclosure: the author of this article is a former editor for the XForms and HTML Working Groups, and is a contributor to XML Hacks. He submitted this article in namespace-free HTML.
© , O’Reilly Media, Inc.
(707) 827-7019
(800) 889-8969
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
|
http://www.xml.com/pub/a/2006/11/08/cracks-in-the-foundation.html?page=2
|
CC-MAIN-2015-11
|
refinedweb
| 887
| 62.17
|
The Python Pandas library provides a function to calculate the standard deviation of a data set. Let’s find out how.
The Pandas DataFrame std() function allows to calculate the standard deviation of a data set. The standard deviation is usually calculated for a given column and it’s normalised by N-1 by default. The degrees of freedom of the standard deviation can be changed using the ddof parameter.
In this article I will make sure the reason why we use the standard deviation is clear and then we will look at how to use Pandas to calculate the standard deviation for your data.
Let’s get started!
Standard Deviation and Mean Relationship
I have read many articles that explain the standard deviation with Pandas simply by showing how to calculate it and which parameters to pass.
But, the most important thing was missing…
An actual explanation of what calculating the standard deviation of a set of data means (e.g. for a column in a dataframe).
The standard deviation tells how much a set of data deviates from its mean. It is a measure of how spread out a given set of data is. The more spread out the higher the standard deviation.
With a low standard deviation most data is distributed around the mean. On the other side a high standard deviation tells that data is distributed over a wider range of values.
Why do we use standard deviation?
To understand if a specific data point is in line with the rest of the data points (it’s expected) or if it’s unexpected compared to the rest of the data points.
Pandas Standard Deviation of a DataFrame
Let’s create a Pandas Dataframe that contains historical data for Amazon stocks in a 3 month period. The data comes from Yahoo Finance and is in CSV format.
Here you can see the same data inside the CSV file. In our analysis we will just look at the Close price.
And this is how we can create the dataframe from the data. The file AMZN.csv is in the same directory of our Python program.
import pandas as pd df = pd.read_csv('AMZN.csv') print(df)
This is the Pandas dataframe we have created from the CSV file:
If you want to see the full data in the dataframe you can use the to_string() function:
print(df.to_string())
And now let’s calculate the standard deviation of the dataframe using the std() function:
>>> print(df.std()) Open 1.077549e+02 High 1.075887e+02 Low 1.097788e+02 Close 1.089106e+02 Adj Close 1.089106e+02 Volume 1.029446e+06 dtype: float64
You can see the standard deviation for multiple columns in the dataframe.
Calculate the Standard Deviation of a DataFrame Column
Now let’s move our focus to one of the columns in the dataframe, the ‘Close’ column.
We will see how to calculate the standard deviation of a specific column. We will then refactor our code to make it more generic.
This will help us for a deeper analysis we will perform in the next section on this one column.
To calculate the standard deviation of the ‘Close’ column you have two options (I personally prefer the first one):
>>> print(df['Close'].std()) 108.91061129873428 >>> print(df.std()['Close']) 108.91061129873428
So, let’s stick to the first option. If you want to calculate the mean for the same column with Pandas you can use the mean() function:
>>> print(df['Close'].mean()) 3169.820640639344
Later on we will use the mean together with the standard deviation to get another piece of data for our analysis.
Now, we will refactor our code to create a generic function that returns a dataframe from a CSV file. We will also write a generic print statement that shows mean and standard deviation values for a given stock.
import pandas as pd def get_dataframe_from_csv(filename): df = pd.read_csv(filename) return df stock = "AMZN" df = get_dataframe_from_csv('{}.csv'.format(stock)) print("Stock: {} - Mean: {} - Standard deviation: {}".format(stock, df['Close'].mean(), df['Close'].std()))
Notice that:
- The stock variable is used to generate the name of the CSV file and also to print the name of the stock in the final message.
- We are using the Python string format method to print our message.
The output of our program is:
Stock: AMZN - Mean: 3169.820640639344 - Standard deviation: 108.91061129873428
Standard Deviation For Multiple DataFrames
I would like to make our code work for an arbitrary number of stocks…
…to do that we have to make a few changes.
The code that prints the mean and standard deviation will become a function that we can call for each stock.
Nothing changes in the logic of the code compared to the previous section, we are just refactoring it to make it more flexible.
Let’s add the following function:
def get_stats(stock): df = get_dataframe_from_csv('{}.csv'.format(stock)) return df['Close'].mean(), df['Close'].std()
What kind of Python data type do you think this function returns?
>>>>> stats = get_stats(stock) >>> print(stats) (3169.820640639344, 108.91061129873428)
The function returns a tuple where the first element is the mean and the second element is the standard deviation.
And now that we have the data we need in this tuple we can print the same message as before:
print("Stock: {} - Mean: {} - Standard deviation: {}".format(stock, stats[0], stats[1]))
Before continuing with this tutorial run it on your machine and make sure it works as expected.
Standard Deviation For Multiple DataFrames
Our code is ready to calculate the standard deviation for multiple stocks.
I want to enhance our program so it can calculate the standard deviation of the close price for three different stocks: Amazon, Google and Facebook.
You can retrieve the historical data in CSV format for Google and Facebook from Yahoo Finance in the same way we have done it in the first section for Amazon (the historical period is the same).
Now, we can simply update our code to use a for loop that goes through each one of the stocks stored in a Python list:
stocks = ["AMZN", "GOOG", "FB"] for stock in stocks: stats = get_stats(stock) print("Stock: {} - Mean: {} - Standard deviation: {}".format(stock, stats[0], stats[1]))
That’s super simple! Nothing else changes in our code. And here is what we got:
Stock: AMZN - Mean: 3169.820640639344 - Standard deviation: 108.91061129873428 Stock: GOOG - Mean: 1990.8854079836065 - Standard deviation: 127.06676441921294 Stock: FB - Mean: 269.7439343114754 - Standard deviation: 11.722428896760924
You can now compare the three stocks using the standard deviation.
This doesn’t give us enough information to understand which one has performed the best but it’s a starting point to analyse our data.
Coefficient of Variation With Pandas
But, how can we compare the stats we have considering that the values of the mean for the three stocks are very different from each other?
An additional statistical metric that can help us compare the three stocks is the coefficient of variation.
The coefficient of variation is the ratio between the standard deviation and the mean.
Let’s add it to our code.
We could print its value as ratio between the standard deviation and the mean directly in the final print statement…
…but instead I will calculate it inside the get_stats() function. In this way I can continue expanding this function if I want to add more metrics in the future.
The function becomes:
def get_stats(stock): df = get_dataframe_from_csv('{}.csv'.format(stock)) mean = df['Close'].mean() std = df['Close'].std() cov = std / mean return mean, std, cov
Then we can add the coefficient of variation to the print statement:
stocks = ["AMZN", "GOOG", "FB"] for stock in stocks: stats = get_stats(stock) print("Stock: {} - Mean: {} - Standard deviation: {} - Coefficient of variation: {}".format(stock, stats[0], stats[1], stats[2]))
The final output is:
Stock: AMZN - Mean: 3169.820640639344 - Standard deviation: 108.91061129873428 - Coefficient of variation: 0.034358603733732805 Stock: GOOG - Mean: 1990.8854079836065 - Standard deviation: 127.06676441921294 - Coefficient of variation: 0.06382424820115978 Stock: FB - Mean: 269.7439343114754 - Standard deviation: 11.722428896760924 - Coefficient of variation: 0.043457618154352805
Difference Between Pandas and NumPy Standard Deviation
The NumPy module also allows to calculate the standard deviation of a data set.
Let’s calculate the standard deviation for Amazon Close prices in both ways to see if there is any difference between the two.
You would expect to see the same value considering that the standard deviation should be based on a standard formula.
We will use the following dataframe:
stock = "AMZN" df = get_dataframe_from_csv('{}.csv'.format(stock))
Standard deviation using Pandas
>> print(df['Close'].std()) 108.91061129873428
Standard deviation using NumPy
>>> import numpy as np >>> print(np.std(df['Close'])) 108.01421242306225
The two values are similar but they are not the same…
When I look at the official documentation for both std() functions I notice a difference.
The Pandas documentation says that the standard deviation is normalized by N-1 by default.
According to the NumPy documentation the standard deviation is calculated based on a divisor equal to N - ddof where the default value for ddof is zero. This means that the NumPy standard deviation is normalized by N by default.
Let’s update the NumPy expression and pass as parameter a ddof equal to 1.
>>> print(np.std(df['Close'], ddof=1)) 108.91061129873428
This time the value is the same returned by Pandas.
If you are interested in understanding more about the difference between a divisor equal to N or N-1 you can have a look here.
Plot Standard Deviation With Matplotlib
An important part of data analysis is also being able to plot a given dataset.
Let’s take the dataset for the Amazon stock…
We will plot all the values using Matplotlib and we will also show how data points relate to the mean.
import pandas as pd import matplotlib.pyplot as plt def get_dataframe_from_csv(filename): df = pd.read_csv(filename) return df stock = "AMZN" df = get_dataframe_from_csv('{}.csv'.format(stock)) data = df['Close'] mean = df['Close'].mean() std = df['Close'].std() min_value = min(data) max_value = max(data) plt.title("AMZN Dataset") plt.ylim(min_value - 100, max_value + 100) plt.scatter(x=df.index, y=df['Close']) plt.hlines(y=mean, xmin=0, xmax=len(data)) plt.show()
We have centered the graph based on the minimum and maximum of the ‘Close’ data points (plt.ylim).
We can also show how many data points fall within one or two standard deviations from the mean. Let’s do that by adding the following lines before plt.show().
plt.hlines(y=mean - std, xmin=0, xmax=len(data), colors='r') plt.hlines(y=mean + std, xmin=0, xmax=len(data), colors='r') plt.hlines(y=mean - 2*std, xmin=0, xmax=len(data), colors='g') plt.hlines(y=mean + 2*std, xmin=0, xmax=len(data), colors='g')
And here is the final graph:
Now you also know how to plot data points, mean and standard deviation using Matplotlib.
Conclusion
In this tutorial we have seen how mean and standard deviation relate to each other and how you can calculate the standard deviation for a set of data in Python.
Being able to plot this data with Matplotlib also helps you in the data analysis.
You can download the full source code of this tutorial and the CSV files here.
And you, what will you use to calculate the standard deviation of your data? Pandas or NumPy?
I’m a Tech Lead, Software Engineer and Programming Coach. I want to help you in your journey to become a Super Developer!
|
https://codefather.tech/blog/pandas-standard-deviation/
|
CC-MAIN-2021-31
|
refinedweb
| 1,932
| 66.84
|
This is a linux machine answering. The "answer" is possibly not the solution, but i need space to insert information, a comment is not enough.
In 38750 the procedure was described for a linux machine.
sage -sh sets all needed variables for the operating system. In my case:
(sage-sh) dan@f... :~$ printenv | fgrep SAGE
gives the list of all more or less needed variables. Among them the most important one is
SAGE_ROOT=/usr
The right corresponding value(s) should maybe be set for Windows. Here is the list, well, i hesitated first to insert it, but soon we will see some of the variables again...
$ printenv | fgrep SAGE SAGE_DOC_SRC=/usr/share/doc/sage SAGE_ETC=/usr/etc SAGE_SHARE=/usr/share SAGE_NUM_THREADS_PARALLEL=4 SAGE_STARTUP_FILE=/home/dan/.sage//init.sage SAGE_SPKG_INST=/usr/var/lib/sage/installed SAGE_ORIG_PATH_SET=True SAGE_SRC=/usr/share/sage/source SAGE_DOC=/usr/share/doc/sage SAGE_LOCAL=/usr SAGE_ENV_SOURCED=4 SAGE_REPO_ANONYMOUS=git://trac.sagemath.org/sage.git SAGE_DOC_MATHJAX=True SAGE_ORIG_PATH=/home/dan/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl SAGE_LOGS=/usr/logs/pkgs SAGE_EXTCODE=/usr/share/sage/ext SAGE_ROOT=/usr SAGE64=no SAGE_DISTFILES=/usr/upstream SAGE_NUM_THREADS=1 DOT_SAGE=/home/dan/.sage/ SAGE_REPO_AUTHENTICATED=ssh://git@trac.sagemath.org:2222/sage.git
A first try to set sage up and running in Windows is to insure that the Windows Python27 interpreter (that must be somewhere, possibly in
C:\Python27) is found from the command line (running
cmd.exe) and that inside of the python dialog box offered something like
from sage.all import * is working...
Let me show the difference in Linux first. In a terminal...
$ python2.7 Python 2.7.14 (default, Sep 20 2017, 02:02:23) [GCC 7.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from sage.all import * Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/site-packages/sage/all.py", line 71, in <module> from sage.env import SAGE_ROOT, SAGE_SRC, SAGE_DOC_SRC, SAGE_LOCAL, DOT_SAGE, SAGE_ENV File "/usr/lib/python2.7/site-packages/sage/env.py", line 154, in <module> SINGULAR_SO = SAGE_LOCAL+"/lib/libSingular."+extension TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' >>>
Such information is hidden in the dark, when pycharm or an other IDE hits the issue.
The same after setting the right environment variables, using the simple
sage -sh first:
$ sage -sh Starting subshell with Sage environment variables set. Don't forget to exit when you are done. Beware: * Do not do anything with other copies of Sage on your system. * Do not use this for installing Sage packages using "sage -i" or for running "make" at Sage's root directory. These should be done outside the Sage shell. Bypassing shell configuration files... Note: SAGE_ROOT=/usr (sage-sh) dan@f...:~$ python2.7 Python 2.7.14 (default, Sep 20 2017, 02:02:23) [GCC 7.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from sage.all import * >>> F = GF(2017) >>> print F.multiplicative_generator() 5
My blind answer is to make the above first run from the command line in Windows. Then start pycharm against the right windows environment variables. In pycharm, or an other IDE, the python interpreter is still python27, not sage. To run sage inside, one has to do the above, possibly having to declare the libraries somewhere. In pycharm, this may be done using Settings > Project Structure . But my pycharm works without such a declaration.
Note that there is no pre-processing. So i have to type with contorsions something like...
from sage.all import * for p in primes( 10**20, 10**20 + 1000 ): R = PolynomialRing( GF( p ), names='X' ) X = R.gens()[0] if not (X**4 - 2).is_irreducible(): print ("...reducible polynom mod %s :: X^4-2 = %s -> next prime..." % (p, factor( X**4 - 2 ))) continue print "%s is OK" % p break
in order to get the first prime $p$ for which $X^4-2$ is irreducible in $\mathbb F_p[X]$. I could run the above code in my pycharm project.
Good luck!
|
https://ask.sagemath.org/answers/39750/revisions/
|
CC-MAIN-2021-10
|
refinedweb
| 687
| 60.11
|
File::OldSlurp -- single call read & write file routines; read directories
use File::OldSlur truncate the file whereas the last thing that overwrite_file() is to truncate the file (to it's new length). Overwrite_file() should be used in situations where you have a file that always needs to have contents, even in the middle of an update.
read_dir() returns all of the entries in a directory except for "." and "..". It croaks if it cannot open the directory.
This module used to be called File::Slurp. Uri Guttman <uri@sysarch.com> wrote a version with more features and more speed. I gave the namespace to him. However, this version still has some merit: it is much smaller and thus if speed of complilation is more important that slurping speed, and you don't need the new features, then this version is still useful.
Copyright (C) 1996, 1998, 2001-2003 David Muir Sharnoff. License hereby granted for anyone to use, modify or redistribute this module at their own risk. Please feed useful changes back to muir@idiom.com.
David Muir Sharnoff <muir@idiom.com>
|
http://search.cpan.org/dist/File-OldSlurp/OldSlurp.pod
|
CC-MAIN-2016-30
|
refinedweb
| 181
| 75.2
|
Sync
A
Monad that can suspend the execution of side effects in the
F[_] context.
import cats.{Defer, MonadError} import cats.effect.Bracket trait Sync[F[_]] extends Bracket[F, Throwable] with Defer[F] { def suspend[A](thunk: => F[A]): F[A] def delay[A](thunk: => A): F[A] = suspend(pure(thunk)) }
This is the most basic interface that represents the suspension of synchronous side effects. On the other hand, its implementation of
flatMap is stack safe, meaning that you can describe
tailRecM in terms of it as demonstrated in the laws module.
import cats.effect.{IO, Sync} import cats.laws._ val F = Sync[IO] lazy val stackSafetyOnRepeatedRightBinds = { val result = (0 until 10000).foldRight(F.delay(())) { (_, acc) => F.delay(()).flatMap(_ => acc) } result <-> F.pure(()) }
Example of use:
val ioa = Sync[IO].delay(println("Hello world!")) ioa.unsafeRunSync()
So basically using
Sync[IO].delay is equivalent to using
IO.apply.
The use of
suspend is useful for trampolining (i.e. when the side effect is conceptually the allocation of a stack frame) and it’s used by
delay to represent an internal stack of calls. Any exceptions thrown by the side effect will be caught and sequenced into the
F[_] context.
|
https://typelevel.org/cats-effect/typeclasses/sync.html
|
CC-MAIN-2019-09
|
refinedweb
| 205
| 51.04
|
VULNERABILITY DETAILS
Opening suitable pages sometimes causes Chrome to crash at various places on startup. These kind of crashes have been happening for a while now, but have been difficult to isolate and reproduce. The last browser test run found several files which seem to trigger this fairly often. One such file is attached. I'll try to narrow down the cause later if others can also reproduce and this is not a duplicate issue.
The crashes look like there could be a memory corruption. Many of the traces have had hosed pointers, often with freeing or allocating going on nearby, so reporting this conservatively as a security issue.
VERSION
Chrome Version: 9.0.597.83 beta (also current dev)
Operating System: Linux, Ubuntu 10.10 x64_64
REPRODUCTION CASE
The crash should occur at least once a minute when repeatedly opening the attached file. The following loop should trigger a browser crash about once a minute:
$ while true; do google-chrome a.html a.html a.html a.html & sleep 1.5; pkill -9 chrome; done
FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION
Type of crash: browser
Crash State:
Crash state varies a lot. One from 9.0.597.83 beta:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe7b62700 (LWP 24653)]
__strcmp_sse2 () at ../sysdeps/x86_64/multiarch/../strcmp.S:107
107 ../sysdeps/x86_64/multiarch/../strcmp.S: No such file or directory.
in ../sysdeps/x86_64/multiarch/../strcmp.S
(gdb) bt
#0 __strcmp_sse2 () at ../sysdeps/x86_64/multiarch/../strcmp.S:107
#1 0x00007ffff1ac43b4 in msort_with_tmp (p=<value optimized out>,
b=<value optimized out>, n=<value optimized out>) at msort.c:105
#2 0x00007ffff1ac4188 in msort_with_tmp (p=<value optimized out>,
b=<value optimized out>, n=<value optimized out>) at msort.c:54
#3 0x00007ffff1ac4188 in msort_with_tmp (p=<value optimized out>,
b=<value optimized out>, n=<value optimized out>) at msort.c:54
#4 0x00007ffff1ac4188 in msort_with_tmp (p=<value optimized out>,
b=<value optimized out>, n=<value optimized out>) at msort.c:54
#5 0x00007ffff1ac4178 in msort_with_tmp (p=0x4b9da40,
b=<value optimized out>, n=<value optimized out>) at msort.c:53
#6 0x00007ffff1ac4178 in msort_with_tmp (p=0x4b9da40,
b=<value optimized out>, n=<value optimized out>) at msort.c:53
#7 0x00007ffff1ac4178 in msort_with_tmp (p=0x4b9da40,
b=<value optimized out>, n=<value optimized out>) at msort.c:53
#8 0x00007ffff1ac4178 in msort_with_tmp (p=0x4b9da40,
b=<value optimized out>, n=<value optimized out>) at msort.c:53
#9 0x00007ffff1ac4178 in msort_with_tmp (p=0x4b9da40,
b=<value optimized out>, n=<value optimized out>) at msort.c:53
#10 0x00007ffff1ac47ec in qsort_r (b=<value optimized out>,
n=<value optimized out>, s=0, cmp=0xbd5860, arg=0x0) at msort.c:294
#11 0x0000000000bd5812 in ?? ()
#12 0x0000000000bd5533 in ?? ()
[...]
(gdb) info registers
rax 0x0 0
rbx 0x4bad080 79351936
rcx 0x2f 47
rdx 0x0 0
rsi 0x6d00750063006f 30681274979123311
rdi 0x4b9da40 79288896
rbp 0x4bab800 0x4bab800
rsp 0x7fffe7b60da8 0x7fffe7b60da8
r8 0x4ba0880 79300736
r9 0x4ba0940 79300928
r10 0x4ba0920 79300896
r11 0x206 518
r12 0x1 1
r13 0x4bab810 79345680
r14 0x4bab810 79345680
r15 0x10 16
rip 0x7ffff1b0d42a 0x7ffff1b0d42) disas $rip-32, $rip+32
Dump of assembler code from 0x7ffff1b0d40a to 0x7ffff1b0d44a:
0x00007ffff1b0d40a <strcmp+58>: add %al,%bl
0x00007ffff1b0d40c: jmp 0x7ffff1b0d410 <__strcmp_sse2>
0x00007ffff1b0d40e: nop
0x00007ffff1b0d40f: nop
0x00007ffff1b0d410 <__strcmp_sse2+0>: mov %esi,%ecx
0x00007ffff1b0d412 <__strcmp_sse2+2>: mov %edi,%eax
0x00007ffff1b0d414 <__strcmp_sse2+4>: and $0x3f,%rcx
0x00007ffff1b0d418 <__strcmp_sse2+8>: and $0x3f,%rax
0x00007ffff1b0d41c <__strcmp_sse2+12>: cmp $0x30,%ecx
0x00007ffff1b0d41f <__strcmp_sse2+15>: ja 0x7ffff1b0d460 <__strcmp_sse2+80>
0x00007ffff1b0d421 <__strcmp_sse2+17>: cmp $0x30,%eax
0x00007ffff1b0d424 <__strcmp_sse2+20>: ja 0x7ffff1b0d460 <__strcmp_sse2+80>
0x00007ffff1b0d426 <__strcmp_sse2+22>: movlpd (%rdi),%xmm1
=> 0x00007ffff1b0d42a <__strcmp_sse2+26>: movlpd (%rsi),%xmm2
0x00007ffff1b0d42e <__strcmp_sse2+30>: movhpd 0x8(%rdi),%xmm1
0x00007ffff1b0d433 <__strcmp_sse2+35>: movhpd 0x8(%rsi),%xmm2
0x00007ffff1b0d438 <__strcmp_sse2+40>: pxor %xmm0,%xmm0
0x00007ffff1b0d43c <__strcmp_sse2+44>: pcmpeqb %xmm1,%xmm0
0x00007ffff1b0d440 <__strcmp_sse2+48>: pcmpeqb %xmm2,%xmm1
0x00007ffff1b0d444 <__strcmp_sse2+52>: psubb %xmm0,%xmm1
0x00007ffff1b0d448 <__strcmp_sse2+56>: pmovmskb %xmm1,%edx
End of assembler dump.
(gdb) p $rsi
$1 = 30681274979123311
The next one was:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe7b62700 (LWP 26063)]
0x0000000000b76464 in ?? ()
(gdb) bt
#0 0x0000000000b76464 in ?? ()
#1 0x0000000000b7673d in ?? ()
#2 0x00007fffdc494e9e in sqlite3_free () from /usr/lib/libsqlite3.so.0
#3 0x00007fffdc4c52fd in ?? () from /usr/lib/libsqlite3.so.0
#4 0x00007fffdc4d200c in ?? () from /usr/lib/libsqlite3.so.0
#5 0x00007fffdc4f1caa in sqlite3_exec () from /usr/lib/libsqlite3.so.0
#6 0x00007fffdc7428a3 in tableExists (sqlDB=0x4bf0408, tableName=<value optimized out>) at sdb.c:1657
[...]
A more symbolic trace using 11.0.657.0 (Developer Build 73427). This seems to be the most common place where the crash occurs.
@aohelin: that's an interesting trace in #c1, because both of those strings being compared look valid to me. It leads one to suspect a data race condition. Could you provide the output for "info threads" at the time of the crash? If any thread looks like it is also doing something MIME related, please provide its backtrace.
Also, it'd be useful to see the actual faulting instruction (plus registers) inside strcmp() itself.
Oh, I see the crashes are all over the shop... this may need valgrind :-/
It would still be useful to sample what the other threads are doing at the exact time of the SIGSEGV. Whoever may have stomped memory won't have moved on very far, especially on a multi-core machine.
Took a while to get it again to gdb. Loading symbols is a bit slow. I'll add the thread backtraces soon.
Thread backtraces. This is in one of the other common crash sites. Thread 10 crashed, and 5 looks interesting.
(gdb) thread 5
[Switching to thread 5 (Thread 0x7fffe9478700 (LWP 26507))]#0 __strcmp_sse2 ()
at ../sysdeps/x86_64/multiarch/../strcmp.S:107
107 in ../sysdeps/x86_64/multiarch/../strcmp.S
(gdb) info registers
rax 0x0 0
rbx 0x7fffe470eb00 140737025993472
rcx 0x0 0
rdx 0x100000000 4294967296
rsi 0x100000000 4294967296
rdi 0x7fffdff89b40 140736950999872
rbp 0x7fffe9476250 0x7fffe9476250
rsp 0x7fffe9476238 0x7fffe9476238
r8 0x7fffdff8cd80 140736951012736
r9 0x7fffdff8cd60 140736951012704
r10 0x7fffdff8cd40 140736951012672
r11 0x206 518
r12 0x1 1
r13 0x7fffdff99810 140736951064592
r14 0x7fffdff99810 140736951064592
r15 0x10 16
rip 0x7ffff0da142a 0x7ffff0da142) thread 10
[Switching to thread 10 (Thread 0x7fffe6c73700 (LWP 26512))]#0 __strcmp_sse2
() at ../sysdeps/x86_64/multiarch/../strcmp.S:106
106 in ../sysdeps/x86_64/multiarch/../strcmp.S
(gdb) info registers
rax 0x0 0
rbx 0x7fffdff94010 140736951042064
rcx 0x0 0
rdx 0x7fffdff8cf40 140736951013184
rsi 0x7fffdff8cf40 140736951013184
rdi 0x0 0
rbp 0x7fffe6c71170 0x7fffe6c71170
rsp 0x7fffe6c71158 0x7fffe6c71158
r8 0x30 48
r9 0x101010101010101 72340172838076673
r10 0x7fffdff8f2c0 140736951022272
r11 0x7ffff0da5756 140737234229078
r12 0x1 1
r13 0x7fffdff98010 140736951058448
r14 0x7fffdff98010 140736951058448
r15 0x10 16
rip 0x7ffff0da1426 0x7ffff0da1426 <__strcmp_sse2+22>
eflags 0x10283 [ CF SF IF RF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
Reduced testcase. Same effect and reproduction instructions. Some a's can probably be removed, but the dot seems to be required. Always a bit disappointing to see fun test data reduce to something like this :)
Hmm. Might be a race with the plugin process at startup?
Mime strings and sorting would fit multiple threads having raced to populate a shared mime database at the same time, and breaking the browser process in the... process.
Tom, you're a bit of a race wizard. Any chance you're interesting in looking at this bug?
I just had a quick look here. Might be worth starting at base/third_party/xdg_mime/xdgmime.c. Many functions call xdg_mime_init to make sure the mime data is loaded, and the flag whether it needs to be loaded seems to be a non-protected global variable. It is set to FALSE after the data has been loaded, so there is plenty of time for two threads to race and start reading the data.
Nice. I wonder which two threads? We only have one file IO thread, and IO tasks (such as loading the MIME db) are supposed to be strictly serialized on that thread. This design is what makes the Chrome UI so responsive.
Maybe a strategic sprinkling of DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); in a debug build would help?
At least asserts checking if someone has changed need_reread after starting to read the data fire pretty often, as in "base/third_party/xdg_mime/xdgmime.c:467: xdg_mime_init: Assertion `need_reread == (!(0))' failed." I'll have another look at the thread issue with DCHECKs after work unless this has been resolved already. Seems to take a while for me to figure out who is doing what and sharing what with whom :)
One of the threads seems to be handling a MimeRegistryMessageFilter::OnGetMimeTypeFromExtension, and does an xdg_mime_init() since it has not yet been loaded, and the other thread is doing a net::URLRequestFileJob and does xdg_mime_init() via URLRequestFileJob::GetMimeType. The latter usually seems to have finished loading mime data and has moved on, while the former usually crashes or aborts if the need_reread check is in place.
Different runs show a slightly different position, but this seems to be the common pattern. Adding a mutex or some other exclusion mechanism to mime reading would probably be enough to fix this.
Crash does not seem to happen if a mutex is added around need_reread. This is just an ugly workaround though, as the whole xdg library is not thread-safe. Chrome itself should probably be checking that no two threads are in the air at the same time calling xdg code. I didn't check yet whether the other thread is bypassing the mime registry and causing the race that way, or if both go through a same point which could enforce single threaded access.
Not sure if this helps. I seem to have ended up spending a moment with morning coffee and evening tea searching for or looking at bugs :)
Given that this appears specific to startup and probably not web triggerable, I'm marking as low severity now.
@tsepez - Could you investigate and work out a fix when you get a chance?
Adding the asserts as suggested in comment 12 rapidly results in:
[9418:9424:332127091617:FATAL:mime_util_xdg.cc(554)] Check failed: BrowserThread::CurrentlyOn(BrowserThread::IO).
Backtrace:
base::debug::StackTrace::StackTrace() [0x126dd76]
logging::LogMessage::~LogMessage() [0x1282a22]
mime_util::GetFileMimeType() [0x129c6e0]
net::PlatformMimeUtil::GetPlatformMimeTypeFromExtension() [0x181252b]
net::MimeUtil::GetMimeTypeFromExtension() [0x17fa1d0]
net::GetMimeTypeFromExtension() [0x17fb518]
MimeRegistryMessageFilter::OnGetMimeTypeFromExtension() [0xfa3593]
DispatchToMethod<>() [0xfa3d2d]
IPC::MessageWithReply<>::Dispatch<>() [0xfa39d2]
MimeRegistryMessageFilter::OnMessageReceived() [0xfa34c9]
BrowserMessageFilter::DispatchMessage() [0xa48d3d]
DispatchToMethod<>() [0xa494e1]
RunnableMethod<>::Run() [0xa49300]
MessageLoop::RunTask() [0x1285acc]
MessageLoop::DeferOrRunPendingTask() [0x1285bba]
MessageLoop::DoWork() [0x12864ec]
base::MessagePumpLibevent::Run() [0x125ce5b]
MessageLoop::RunInternal() [0x12858f0]
MessageLoop::RunHandler() [0x128578c]
MessageLoop::Run() [0x128514b]
base::Thread::Run() [0x12cdb1e]
base::Thread::ThreadMain() [0x12cdcd9]
base::(anonymous namespace)::ThreadFunc() [0x12c8cc7]
start_thread [0x7fc99c3989ca]
0x7fc999a4570d
as expected. Probably a layering violation to allow files in base/ to call into browser/ ...
I take it back. Looks like a small typo in comment #12: IO vs. FILE. Would seem to want to happen in the file thread via chrome/browser/mime_registry_message_filter.cc's
void MimeRegistryMessageFilter::OverrideThreadForMessage(
const IPC::Message& message,
BrowserThread::ID* thread) {
if (IPC_MESSAGE_CLASS(message) == MimeRegistryMsgStart)
*thread = BrowserThread::FILE;
}
Changing the asserts to FILE and things are no longer asserting. Time for more digging.
To summarize aohelin's analysis:
- MimeRegistryMessageFilter forwards all messages on the FILE thread (comment #18)
- URLRequestFileJob::GetMimeType lives on the IO thread (that's where URLRequests live)
- both call into xdg_mime_init via net::GetMimeTypeFromExtension.
It seems clear to me that this is bad. A mutex solves it, but we usually don't like to block the IO thread on the FILE thread. It'd be better to make the relevant calls async.
I think it's totally wrong that URLRequestFileJob is calling a blocking disk function from the IO thread anyway. And looking at the code...
bool URLRequestFileJob::GetMimeType(std::string* mime_type) const {
// URL requests should not block on the disk! On Windows this goes to the
// registry.
//
base::ThreadRestrictions::ScopedAllowIO allow_io;
DCHECK(request_);
return GetMimeTypeFromFile(file_path_, mime_type);
}
FFFFFUUUUU
Will and I discussed this in person.
We think:
1) Fix the race. We should put a lock into base/mime_util_xdg.cc because the code it's calling (the xdg stuff) has tons of global state. Having URLRequestFileJob::GetMimeType() block on a lock is the same amount of jank as the code currently has, so it's not such a bad thing to introduce it first.
2) Fix the jank. This is a separate issue, and can be done as part of 59849. I'll comment there with what needs to be done.
Issue 72042 has been merged into this issue.
The dup'd issue is a ThreadSanitizer report showing that we have this race. We shoulda caught this earlier. :~(
Adding Kostya who found the issue 72042
As we now have an easy reproducer (do we?), I'd suggest running it under ThreadSanitizer, before and after the fix.
Bumping up the severity a bit because the other crash stacks make it look like a malicious extension could potentially use this for privilege escalation (although that may be a longshot).
I start seeing this as a Memcheck report (in addition to ThreadSanitizer report in issue 74042 ):
Invalid write of size 8
at 0xD1365C: _xdg_mime_alias_read_from_file (base/third_party/xdg_mime/xdgmimealias.c:153)
by 0xD12F9A: xdg_mime_init_from_directory (base/third_party/xdg_mime/xdgmime.c:201)
by 0xD12AED: xdg_run_command_on_dirs (base/third_party/xdg_mime/xdgmime.c:288)
by 0xD13405: xdg_mime_init (base/third_party/xdg_mime/xdgmime.c:456)
by 0xD13490: xdg_mime_get_mime_type_from_file_name (base/third_party/xdg_mime/xdgmime.c:567)
by 0xCDF4FD: mime_util::GetFileMimeType(FilePath const&) (base/mime_util_xdg.cc:556)
by 0x1098BCB: net::PlatformMimeUtil::GetPlatformMimeTypeFromExtension(std::string const&, std::string*) const (net/base/platform_mime_util_linux.cc:23)
by 0x1086975: net::MimeUtil::GetMimeTypeFromExtension(std::string const&, std::string*) const (net/base/mime_util.cc:171)
by 0x1086A55: net::MimeUtil::GetMimeTypeFromFile(FilePath const&, std::string*) const (net/base/mime_util.cc:189)
by 0xFA6800: net::URLRequestFileJob::GetMimeType(std::string*) const (net/url_request/url_request_file_job.cc:283)
by 0xFB04C2: net::URLRequestJob::NotifyHeadersComplete() (net/url_request/url_request_job.cc:470)
by 0xFA64E6: net::URLRequestFileJob::DidResolve(bool, base::PlatformFileInfo const&) (net/url_request/url_request_file_job.cc:373)
by 0xCCE1B8: MessageLoop::RunTask(Task*) (base/message_loop.cc:367)
by 0xCCEE17: MessageLoop::DeferOrRunPendingTask(MessageLoop::PendingTask const&) (base/message_loop.cc:376)
by 0xCCFB52: MessageLoop::DoWork() (base/message_loop.cc:569)
by 0xCB03A8: base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) (base/message_pump_libevent.cc:222)
by 0xCD05CD: MessageLoop::RunInternal() (base/message_loop.cc:342)
by 0xCD0769: MessageLoop::Run() (base/message_loop.cc:239)
by 0xCFB5AB: base::Thread::ThreadMain() (base/threading/thread.cc:164)
by 0xCFAAE9: base::(anonymous namespace)::ThreadFunc(void*) (base/threading/platform_thread_posix.cc:51)
Address 0x540 is not stack'd, malloc'd or (recently) free'd
The following revision refers to this bug:
------------------------------------------------------------------------
r79851 | tsepez@chromium.org | Wed Mar 30 09:59:46 PDT 2011
Changed paths:
M
XDG isn't thread safe. Add a lock around calls to it.
BUG= 71586
Review URL:
------------------------------------------------------------------------
Merged to M11: 80097
The following revision refers to this bug:
------------------------------------------------------------------------
r80097 | cevans@chromium.org | Thu Mar 31 16:20:07 PDT 2011
Changed paths:
M
Merge 79851 - XDG isn't thread safe. Add a lock around calls to it.
BUG= 71586
Review URL:
TBR=tsepez@chromium.org
Review URL:
------------------------------------------------------------------------
I am testing yet another dynamic tool for detecting memory crashers.
The tool reports similar stacks on Chromium: r81383 / WebKit: r83605
And I do see a similar stack in crash on Chrome 12.
So, is this really fixed?
#0 0x0110b2e3 << _xdg_mime_cache_new_from_file base/third_party/xdg_mime/xdgmimecache.c:156
#1 0x01104bd8 << xdg_mime_init_from_directory base/third_party/xdg_mime/xdgmime.c:148
#2 0x011045c5 << xdg_run_command_on_dirs base/third_party/xdg_mime/xdgmime.c:250
#3 0x011062bd << xdg_mime_init base/third_party/xdg_mime/xdgmime.c:456
#4 0x01106900 << xdg_mime_get_mime_type_from_file_name base/third_party/xdg_mime/xdgmime.c:567
#5 0x0109525a << mime_util::GetFileMimeType(FilePath const0x109525a ) /usr/lib/llvm/gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits/stl_tree.h:184
#6 0x01973815 << net::PlatformMimeUtil::GetPlatformMimeTypeFromExtension(std::string const0x1973815 , std::string*) const net/base/platform_mime_util_linux.cc:23
#7 0x0194a1ba << net::MimeUtil::GetMimeTypeFromExtension(std::string const0x194a1ba , std::string*) const /usr/lib/llvm/gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bi»
#8 0x0194c318 << net::MimeUtil::GetMimeTypeFromFile(FilePath const0x194c318 , std::string*) const /usr/lib/llvm/gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits/stl_v»
#9 0x0194c367 << net::GetMimeTypeFromFile(FilePath const0x194c367 , std::string*) /usr/lib/llvm/gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits/stl_vector.h:536
#10 0x017a25c8 << net::URLRequestFileJob::GetMimeType(std::string*) const ./base/memory/weak_ptr.h:66
#11 0x0179adc8 << net::URLRequest::GetMimeType(std::string*) ./base/memory/ref_counted.h:95
#12 0x03f24e8c << ResourceDispatcherHost::CompleteResponseStarted(net::URLRequest*) ./base/memory/ref_counted.h:143
#13 0x03f25033 << ResourceDispatcherHost::CompleteResponseStarted(net::URLRequest*) ./base/memory/ref_counted.h:143
#14 0x03f276b9 << ResourceDispatcherHost::CancelRequestsForRoute(int, int) ./base/memory/ref_counted.h:143
#15 0x0179c3a3 << net::URLRequest::ResponseStarted() ./base/memory/ref_counted.h:95
#16 0x017acc14 << net::URLRequestJob::NotifyHeadersComplete() ./base/memory/ref_counted.h:241
#17 0x017a2061 << net::URLRequestFileJob::DidResolve(bool, base::PlatformFileInfo const0x17a2061 ) ./base/memory/weak_ptr.h:66
#18 0x01071226 << MessageLoop::RunTask(Task*) ./base/synchronization/lock.h:104
#19 0x01071610 << MessageLoop::DeferOrRunPendingTask(MessageLoop::PendingTask const0x1071610 ) ./base/synchronization/lock.h:104
#20 0x0107242a << MessageLoop::DoWork() ./base/synchronization/lock.h:104
#21 0x0103bcb7 << base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) /usr/lib/llvm/gcc-4.2/lib/gcc/x86_64-linux-gnu/4.2.1/../../../../include/c++/4.2.1/bits/stl_algobase.h:189
#22 0x01072aef << MessageLoop::RunInternal() ./base/synchronization/lock.h:104
#23 0x01072ca4 << MessageLoop::Run() ./base/synchronization/lock.h:104
#24 0x010cf797 << base::Thread::ThreadMain() ./base/threading/platform_thread.h:57
#25 0x010cf368 << base::(anonymous namespace)::ThreadFunc(void*) base/threading/platform_thread_posix.cc:51
The version of Chrome of referenced in is 12.0.712.0, which is r79102 and therefore does not contain Tom's fix.
Could you go in to more detail on what your new dynamic tool is reporting, exactly? It's hard to tell from just a stack trace.
Compare
(noisy)
vs.
Pretty clean :)
The new tool tells me that the memory accessed in _xdg_mime_cache_new_from_file has been freed long ago.
So long ago, that the tool lost track of where it has been free-ed.
Could be a false positive of course, the tool is just a few days old. :)
I am rerunning with different settings (larger free-delay buffer and red zones)...
Let me update this bug once I have a better report.
@aohelin: we're happy to be without this race, it was also causing stability issues. Accordingly, please have a $500 Chromium Security Reward :)
----.
----
Excellent, thanks :)
Invoice finalized; payment is in e-payment system; it can take a couple of weeks.
Batch update.
Lifting view restrictions.
|
https://bugs.chromium.org/p/chromium/issues/detail?id=71586
|
CC-MAIN-2018-47
|
refinedweb
| 3,047
| 50.43
|
HTML in E2 writeups is filtered; only a subset of the available HTML tags
are actually allowed. There are approximately two reasons for this:
Tables would be fine if they could be validated to prove that they're well-formed and hence will not break tables outside the writeup. Tables in particular aren't allowed because:
Also, another issue which was not discussed is that allowing tables in writeups might be "exploited" for forcing layout within writeups; eg. to split a writeup into columns, etc.
Having written some fairly simple code to validate table HTML, running some performance tests on it seems to show that the 'worst case' HTML (a nightmare of tables, taken from an entire pageload on Community2) indicates that the table validation takes about a fifth of the time the normal HTML validation takes.
The design of the table validation code emerges from a slightly different
approach than is used for general HTML validation. The existing HTML validation
code in ecore strips out disallowed tags to create valid HTML. Transforming the markup in such a way can be fairly expensive, and for tables could be quite complex to perform. Hence, a much simpler approach was adopted based on observations of writeup content.
Thus the two cases for which performance should be optimised are the corresponding cases of no table tags at all, and tables which are valid and well-formed. Hence the main code merely scans the structure of the tables in the HTML and determines whether tables have valid structure or not. When a malformed table is discovered, the code adopts an entirely different approach (and one which may in the long run be more useful...) of rendering the table tags visible in the displayed HTML, and adding <div> tags with dashed outlines around the elements to aid debugging.
With this approach, the majority of the web server's activity will be in simply checking the validity of any table tags.
Here's the source to the htmlcode:
# Okay, in brief:
# Fast 'cause it's optimised to the 'common' cases:
# Most writeups have no tables.
# Writeups that have tables will mostly have valid tables:
# => Only a quick parse to validate.
# We 'enforce' the validity of tables by outputting debug info
# for badly formed tables. This is UGLY so writeup authors will
# fix 'em quick.
# In an HTMLcode, so compilation of this code is amortised.
# [screenHTML] should still be used, and can be used to control
# attributes in the tags. Ideally this works on the output of
# screenHTML, but only because the 'debug' output uses <div>s
# with dashed outlines to help HTML writers find their oopsies.
# Should be reasonably fast: scans through the HTML using a m''g, which
# is about as fast as anything in perl can be. Stacks the tags (only
# looks at table tags) and checks the structural validity by
# matching a two-level context descriptor (stack . tag) against
# an RE describing valid contexts. (again, perl and RE => faster than
# a bunch of ifs or whatever)
sub tableWellFormed ($) {
my (@stack);
# Note that htmlScreen ensures that the HTML input to screenTable will
# only ever terminate the tag name with a space or a closing >, so this
# is all we have to match.
for ($_[0] =~ m{<(/?table|/?tr|/?th|/?td)[\s>]}ig) {
my $tag = lc $_;
my $top = $stack[$#stack];
if (substr($tag, 0, 1) eq '/') {
# Closing tag. Pop from stack and check that they match.
return (0, "$top closed with $tag")
if pop @stack ne substr($tag, 1);
} else {
# Opening tag. Push, and check context is valid.
push @stack, $tag;
return (0, "$tag inside $top")
if (($top.$tag) !~ /^(table(tr)?|tr(td|th)|(td|th)(table))$/);
}
}
return (0, "Unclosed table elements: " . join ", ", @stack)
if ($#stack != -1);
return 1;
}
sub debugTag ($) {
my ($tag) = @_;
my $htmltag = $tag;
$htmltag =~ s/</amp;lt;/g; # should be encodeHTML, but of course
# I don't have that in my standalone testbench.
$htmltag = "<strong><small>amp;lt;" . $htmltag . "amp;gt;</small></strong>";
if (substr($tag, 0, 1) ne '/') {
return $htmltag . "<div style=\"margin-left: 16px; border: dashed 1px grey\">";
} else {
return "</div>". $htmltag;
}
}
sub debugTable ($$) {
my ($error, $html) = @_;
$html =~ s{<((/?)(table|tr|td|th)((\s[^>]*)|))>}{debugTag $1}ige;
return "<p><strong>Table formatting error: $error</strong></p>".$html;
}
my ($text) = @_;
my ($valid, $error) = tableWellFormed($text);
$text = debugTable ($error, $text) if ! $valid;
$text;
A similar approach might yield speed improvements to
htmlScreen too. It should be possible, for instance, to construct a single regular expression to determine if some HTML consists entirely of valid tags and attributes (and this regular expression can be constructed automatically, of course). However, since there's a large base of existing writeups that may have invalid tags and attributes that nobody has noticed (since the existing htmlScreen provides no real feedback), it's unlikely that this will be a particularly palatable idea.
As a last word, caching of computed results in ecore is something that could be done better, and more consistently; but we all know this by now, and it's late in the evening so I'm not going to tell you things you already know.
Y'all can try it out over at
or
In particular, I want y'all to try and break it, defeat the validation to get unpleasant HTML through the validator. And remember that in the final version it will be used in conjunction with htmlScreen... ;)
Log in or register to write something here or to contact authors.
Need help? accounthelp@everything2.com
|
https://everything2.com/title/edev%253A+Tables+and+HTML+Validation
|
CC-MAIN-2018-47
|
refinedweb
| 917
| 61.06
|
It’s common to want to create several SwiftUI views inside a loop. For example, we might want to loop over an array of names and have each one be a text view, or loop over an array of menu items and have each one be shown as an image.
SwiftUI gives us a dedicated view type for this purpose, called
ForEach. This can loop over arrays and ranges, creating as many views as needed. Even better,
ForEach doesn’t get hit by the 10-view limit that would affect us if we had typed the views by hand.
ForEach will run a closure once for every item it loops over, passing in the current loop item. For example, if we looped from 0 to 100 it would pass in 0, then 1, then 2, and so on.
For example, this creates a form with 100 rows:
Form { ForEach(0 ..< 100) { number in Text("Row \(number)") } }
Because
ForEach passes in a closure, we can use shorthand syntax for the parameter name, like this:
Form { ForEach(0 ..< 100) { Text("Row \($0)") } }
ForEach is particularly useful when working with SwiftUI’s
Picker view, which lets us show various options for users to select from.
To demonstrate this, we’re going to define a view that:
@Stateproperty storing the currently selected student.
Pickerview asking users to select their favorite, using a two-way binding to the
@Stateproperty.
ForEachto loop over all possible student names, turning them into a text view.
Here’s the code for that:
struct ContentView: View { let students = ["Harry", "Hermione", "Ron"] @State private var selectedStudent = 0 var body: some View { VStack { Picker("Select your student", selection: $selectedStudent) { ForEach(0 ..< students.count) { Text(self.students[$0]) } } Text("You chose: Student # \(students[selectedStudent])") } } }
There’s not a lot of code in there, but it’s worth clarifying a few things:
studentsarray doesn’t need to be marked with
@Statebecause it’s a constant; it isn’t going to change.
selectedStudentproperty starts with the value 0 but can change, which is why it’s marked with
@State.
Pickerhas a label, “Select your student”, which tells users what it does and also provides something descriptive for screen readers to read aloud.
Pickerhas a two-way binding to
selectedStudent, which means it will start showing a selection of 0 but update the property as the user moves the picker.
ForEachwe count from 0 up to (but excluding) the number of students in our array.
We’ll look at other ways to use
ForEach in the future, but that’s enough for this project.:
import SwiftUI struct ContentView: View { var body: some View { Text("Hello World") } } struct ContentView_Previews: PreviewProvider { static var previews: some View { Content.
|
https://www.hackingwithswift.com/books/ios-swiftui/creating-views-in-a-loop
|
CC-MAIN-2021-31
|
refinedweb
| 449
| 59.64
|
I don’t think I need to elaborate on how important it is to get ratings for your app in the Store – and preferably good ratings. By no means this is new and original: Matthijs Hoekstra wrote something to this effect, our Dutch DPE Rajen Kishna even made a NuGet package for similar stuff, Telerik have something in their magnificent Radcontrols for Windows Phone and yet me, being stubborn, need to make something of my own. The reason for this is simple: I wanted (of course) to make a behavior so you can add it to your app without any code at all – just drag it on top of your first opening page and it will work out of the box. And Blend will present you with some properties that you can set – or not. It works fine out of the box. As it does in my latest Windows Phone app, 2 Phone Pong.
If you drop the behavior on top of your start page it will work without modification. But Blend exposes four properties to customize it’s mode of operation:
- Caption is the text on top of the message box that will display when the app reminds the user. Default is “Review App”. You can set a different value in XAML or (better) bind it to a view model property holding a globalized text.
- MaxReminders is the number of times the behavior will ask the user to review. If the user refuses to review more than MaxReminders time, he will no longer be bothered.
- Message shows the actual reminder message. Default values is “You have used this app a few times now, would you like to review it in the store?”
- RemindFrequency is the number of app startups after which the review request is displayed.
So, with the default setting, the app will ask you the 7th, 14th and 21st time if you want to review the app. After the third dismiss, it won’t ask you anymore. This is to prevent users getting annoyed by endless review requests and giving negative reviews because of that. And of course it will stop asking the user when has elected to post a review.
The behavior itself is built on top of my wp7nl library on codeplex (of course) and implemented as a SafeBehavior. First, I created a simple data class to hold the data in local storage:
namespace Wp7nl.Behaviors { /// <summary> /// Simple data class to store data in used by RemindReviewBehavior /// </summary> public class RemindData { public int Starts { get; set; } public bool Reviewed { get; set; } public bool Refused { get; set; } } }
The behavior itself is also pretty simple – it sports four Dependency Properties with the same names as Blend shows – not coincidentally – in front of the text boxes in the image on top of this post.
The behavior itself starts simple enough, being a standard SafeBehavior:
namespace Wp7nl.Behaviors { /// <summary> /// A behavior to remind the user to review the app after a couple /// times using it /// </summary> public class RemindReviewBehavior: SafeBehavior<Page> { protected override void OnSetup() { CheckRemind(); } }
All the functionality is in the CheckRemind method:
private void CheckRemind() { var helper = new IsolatedStorageHelper<RemindData>(); var remindData =
helper.ExistsInStorage() ? helper.RetrieveFromStorage() : new RemindData(); if (!remindData.Reviewed && !remindData.Refused) { remindData.Starts++; if (remindData.Starts % RemindFrequency == 0) { var result = MessageBox.Show(Message, Caption, MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { Review(); remindData.Reviewed = true; } else { if (remindData.Starts >= MaxReminders * RemindFrequency) { remindData.Refused = true; } } } helper.SaveToStorage(remindData); } }
Using the IsolatedStorageHelper from wp7nl it checks if there is already data from a previous run in local storage – if there is not, it is created. If Reviewed or Refused are true, no action in necessary. After, the number or starts is increased, and it checks if the number of starts can be divided by the RemindFrequency. If that is the case, the message is displayed,
If the user then decides to review the app, the Review method called and the Reviewed property is set to true so the user won’t be bothered anymore. If the user does not want to review, the app checks if the max number of review request has already been put out – and if so, the Refused property is set to true. The user is (also) no longer bothered anymore. And at the end, the remindData is saved so whatever happened in the method is saved for posterity.
The Review method then is pretty simple:
private void Review() { var marketplaceReviewTask = new MarketplaceReviewTask(); try { marketplaceReviewTask.Show(); } catch (InvalidOperationException ex) { } }
The only drawback is that the user can click OK, go to the Store, and then hit cancel. There is no way around cheaters, but if someone does not want to review, whatever – at least he/she then won’t give a bad review either.
The four dependency properties I leave out for the sake of brevity.
I have put the code into upcoming version of the wp7nl library, but for now you can get it from the demo solution. I have changed MaxReminders to 20 and RemindFrequency to 2 so the demo app will ask you every other time to rate it, for 20 times. This is a setting I would definitely not recommend in the wild, but it shows the point.
Now Matthijs, Rajen, me and several others have showed you multiple ways to get this done. Mine does not even require you to code – just drag and drop. Now make sure you implement any of these solutions. Whether you are in the Windows Phone game for fun, glory, money or all of the above – you want those apps downloaded. And ratings are crucial for that.
2 comments:
thanks, great :)
ok, I have one Question, It gives me the message when I enter the app every 2nd time, How can do that for Every 15 times ?
@Asif try setting RemindFrequency to 15.
|
http://dotnetbyexample.blogspot.com/2013/09/zero-lines-of-code-solution-to-entice.html
|
CC-MAIN-2017-51
|
refinedweb
| 969
| 62.17
|
Is there a way to load pyc files on the LoPy? We are running into 'out of memory errors' trying to import modules even though there seems to be plenty of free memory. This is making development very difficult and time consuming.
Thanks,
Steve
@robert-hh That worked great. I'm now able to build the FW with our frozen bytecode. Next step is to figure out the OTA
@ssmith To erase flash, just issue the command:
make erase
in the PC command window. Like flashing it requires the joint between GP3 and GND, and a Reset. After that, you can reflash the device with
make BOARD=LOPY flash
P.S.: This RED led state happens when you load a self-built image over the Pycom images. This IS a bug, and not fixed since several releases. But as long a you stick with either version, it will not hit you.
@robert-hh Thank you for all your help. I can now build the code and even managed to write it to flash. Unfortunately, now I think I hit the double buffered code bug. My device boots up but the LED is just solid red. I only get the boot messages on the console and then nothing. How can I erase the flash?
Thanks,
Steve
@ssmith In addtion to what @BetterAuto said, a few comments:
OTA (Over The Air) stands for firmware update by WiFi.
The initial method was simply storing the appimg.bin into /flash/sys with ftp. appimg.bin is created by the build process or extracted from the pycom file package. It requires at least version 1.8.0 to be loaded initially by USB.
The primitives used by ftp upload are available in the 'pycom' module. You'll find it in the docs at. These allow to create your own method for downloading and flashing the image, e.g. using a protocol which ios more secure than non-encrpyted ftp.
At the moment, there is a little hiccup involved when you mix OTA and USB flashing.
OTA uses two memory areas for the firmware and toggles these. Let's call these A and B. On bootup, the bootloader checks a flag which area is active and starts this one. The USB flash always puts the image in area A and does NOT set the "active" flag accordingly. So, if the active area is B, and you do a firmware update by USB, the new firmware will NOT be excecuted. At the moment you have two options:
a) erase flash, which will also clear the file system (not nice)
b) do another OTA, which will set again A as the acitve area. Obviously you can use the new image.
There is another unrelated hiccup when alternating between firmware images downloaded from Pycom.io and self-built images. The partition maps seem incompatible, leading to either "Red LED frozen devices" or a corrrupted file system. In that case one has to erase flash and reload with the intended method.
Both hiccups will be fixed in one of the next versions.
- BetterAuto Pybytes Beta
@ssmith said in Loading pyc Files:
What about OTA?
Also I just posted a tutorial for compiling a custom image for frozen bytecode. MUCH faster and no more out of memory errors.
@robert-hh I did try that but maybe something was out of sync. Just started over and it did work. Thanks! What about OTA? That's is something we're going to need. Can you point me to any info on using that?
@ssmith did you use mpy-cross_pycom.exe?
mpy-cross.exe is for the micropython.org branch, and they are not compatible.
@robert-hh I tried this and am getting this error when running 1.9.0.b1
>>> import test Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid .mpy file >>>
I compiled it using you mpy-cross.exe
test.py def hello_world(): print('Hello World from precompile') hello_world()
When I import the .py file it ran.
Any ideas?
@ssmith Sorry no, you need the new firmware. Maybe another advantage of the newer firmware is the option to do OTA updates with it.
@robert-hh Thanks for the info but that creates another problem. We have units in the field running different FW versions from 1.7.3 on up. Any way to allow those units to load mpy files or is that an RMA?
@caseyrodgers That feature was recently by default enabled. V1.9.0b1 supports it.
You example should work then.
- caseyrodgers
@robert-hh Thanks for info ...
Should this work? (it does not):
def hello():
-> print('Hello World')
hello()
import test
ImportError: no module named 'test'
That does not seem to work (fw: 1.7.9b3).
Can you please provide a simple example that should work?
@ssmith MicroPython has its own cross-compiler, called mpy-cross, which takes a .py files and creates a .mpy file, which can be imported. You must build that cross-compiler yourself. I have some versions prepared for people who want to do a quick test :
Look for the mpy-cross-pycom* files. Using these reduces the amount needed to start a script, but still the bytecode resides in RAM.
If you set up your own build environment for the firmware, you can also embed python scripts into the flash memory. Just put them into the subdirectory esp32/frozen. Then bytecode and static data do not occupies RAM anymore, just the dynamic data, it uses.
Follow the instructions in the repositories and. There is a actual problem: the most recent extensa gcc comiler does not match the micropython repository. And older working version is here: (cudos to @jmarcelino)
|
https://forum.pycom.io/topic/1917/loading-pyc-files
|
CC-MAIN-2018-17
|
refinedweb
| 948
| 77.13
|
Hi,
Is it possible to do downcast in the bind clause of a rule?
like this:
RULE rule
CLASS Foo
METHOD bar
AT ENTRY
BIND child : HashMap = $input;
IF true
DO traceln("yes, it works!" + child)
ENDRULE
{code}
public class Foo {
public void bar(Map input) {
System.out.println("");
}
}
{code}
Hi Anton,
Anton Ryabtsev wrote:
Hi,
Is it possible to do downcast in the bind clause of a rule?
At present no. However, I have been thinking for quite a while about providing some sort of support for downcasting.
I have not proposed/implemented anything yet because it's not necessarily clear to me how to provide this capability, in particular how to deal with cast exceptions (it's not trappng these that I am concerned with, rather providing a clean way for rules to cope with the consequences).
So, if you can provide me with some idea of what you want to do, why you want to do it and how you would like it to behave I would be glad to consider this as input to any requirements for an implementation. Community software is supposed to serve a community so any input yoou can provide will be very interesting.
I would also like to be able to downcast in the BIND clause.
I am using Byteman as a debugging tool to collect intermediate values of a
long calculation, which is spreaded across several classes.
My current work around is to have the downcasting done in a custom Java class, and this makes my
custom class to depend on the code, which I try to debug. I can live with the above.
But it would be better to do downcast in the BIND clause,as I would have less code to maintain
and less dependency.
Without downcasting, I would have to collect the intermediate values when it is calculated.
This would result in more rules.
In my case, if there is a class cast exception, it is acceptable that it is not catched.
|
https://developer.jboss.org/message/727426
|
CC-MAIN-2016-44
|
refinedweb
| 334
| 68.91
|
pls review my code - Struts
pls review my code Hello friends,
This is the code in struts. when i click on the submit button.
It is showing the blank page. Pls respond soon...("error in connecting database");
}
return null
pls review my code - Struts
pls review my code When i click on the submit page i am getting a blank page
Pls help me.
thanks in advance.
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request
pls help me sir its urgent
pls help me sir its urgent thanks for reply,
but i am getting this error pls help me its urgent
type Exception report
description The server encountered an internal error () that prevented it from
Error - Struts
Error Hi,
I downloaded the roseindia first struts example... create the url for that action then
"Struts Problem Report
Struts has detected...
-----------------------
RoseIndia.Net Struts 2 Tutorial
RoseIndia.net Struts 2
pls help me it urgent
pls help me it urgent hey, pls help me i want to know that can we call java/.bat file from plsql/proceudre /trigger
help - Struts
studying on struts2.0 ,i have a error which can't solve by myself. Please give me help, thans!
information:
struts.xml
HelloWorld.jsp... execute(){
name = "Hello, " + name + "!";
return SUCCESS;
}
}
but error
Pls help me...........
Pls help me........... how to use the text file as input to insert the values injdbc?
Please visit the following link:
Insert text file data into database
pls help me!!!!!!!
do the combinations in java, pls help me its urhent - Development process
do the combinations in java, pls help me its urhent import... one help me:
action when condition1 and condition3
action when condition1... and condition3 Hi friend,
We check your code having error and Plz check
How to add dynamically rows into database ?Need help pls
into the database.I have been trying to solve in for ages.Can anyone pls help me.Thanks...How to add dynamically rows into database ?Need help pls Hi everyone...', '', 'sjas') or die(mysqli_connect_error());
$query = "INSERT INTO employee
pls. help me - Java Beginners
pls. help me please help me i do need now if its okay...
Consider the method headings:
void funcOne(int[] alpha, int size)
int funcSum(int x,int y)
void funcTwo(int[] alpha, int[] beta)
and the declarations:
int
The server encountered internal error() - Struts
struts-taglib-1.3.10.jar
struts-tiles-1.3.10.jar
Please help me find out...The server encountered internal error() Hello,
I'm facing the problem in struts application.
Here is my web.xml
MYAPP
file download in struts - Struts
my form...\
PLs help...
Thanks in advance... need to get an error message when no meterid is selected from the list...
I used validator in struts but it didn't worked...
i used validate() in form bean 2 : Http Status Error 404 - Struts
Struts 2 : Http Status Error 404 Hi All,
I'm facing the below... error as shown below.
see below error for the details
code...
---------------------------------------------------------------------------
ERROR(404) : "The requested
Struts - Struts
Struts How to display single validation error message, in stude of ? Hi friend,
I am sending you a link. This link will help you. Please visit for more information..why
pls send code
pls send code pls send code for set database value into text box based on selected value
in struts and jsp
use any database and get its code for getting values from google
Hi.. how to write more than one sheets in a excel file... pls anybody help me....
Hi.. how to write more than one sheets in a excel file... pls anybody help me... go to second sheet... pls help me.. here my code..
import... (Exception ex) {
System.out.println("Error at focusEvent
Pls send code
an error pls send code...Pls send code I am Mohini Charankar
suppose Name="Mohini" Edit Button Click on that I change my Name with "Mohini/" Save it and page refresh After
pls send reply - Java Beginners
pls send reply i get the error
Error Occurred:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
how to remove
Java.. pls. - Java Beginners
Java.. pls. Hi, sir. it compiler but when search or purchase it didt go true.
Sir, can u help me sir. Please Sir..
Import java.io.*;
public class nathan{
String title[]={"Biography","Computers","Science","Sports
java struts error - Struts
java struts error
my jsp page is
post the problem... THINK EVERY THING IS RIGHT BUT THE ERROR IS COMING I TRIED BY GIVING INPUT... on struts visit to :
Thanks
Struts+Hibernate - Development process
the records.
pls help me i am strucked with error.
thanx in advance
Hi,
What error you are getting?
Thanks...Struts+Hibernate Hi
I am Using Struts+Hibernate in my web
help pls help me to get the code of a java program
a program to perform different shapes in a menu using javaapplet
how to make a matrix like datagrid in ide in java pls help
how to make a matrix like datagrid in ide in java pls help how to make a datagrid mainly matrix in ajava standalone app
error
error The content of element type "struts" must match "(package|include|bean|constant
Error-
Error- Hello, I would like to know about XSD file.
I try to print XML file but I am getting error SAXException-- says
Content is not allowed in prolog.
Please help me
pls send reply - Java Beginners
pls send reply i get the error
Error Occurred:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
how to remove
Hi Friend,
Check your connection string, username
Sending large data to Action Class error. Struts code - Struts
Sending large data to Action Class error. Struts code I have a jsp page and there is a button which is a image type ,when i click on the button I am... string value so it is not passed to action class. So please help me
i have a problem to do this question...pls help me..
i have a problem to do this question...pls help me.. Write a program that prompts the user to input an integer and the output the number with the digits reversed. For example if the input is 12345, the output should be 54321
on-line examination project?(urgent pls)
on-line examination project?(urgent pls) Hello friends,
i am doing an on-line examination project. In A page i will get n(user... not getting how to transfer the values or how to disable the form ...please help
servlet not working properly ...pls help me out....its really urgent
servlet not working properly ...pls help me out....its really urgent Hi,
Below is the front page of my project
1)enty.jsp
</form> </body> </html>
</form> </body> </html>> <>
in the printf method is actually invalid.Therefore error occurs. Anyways, check your code
Logic error? HELP PLEASE! :(
Logic error? HELP PLEASE! :( Hello Guys! i have a huge problem. What...);
System.out.println("Error.");
result = "Client info...) {
ex.printStackTrace();
System.out.println(ex);
System.out.println("Error
forward error message in struts
forward error message in struts how to forward the error message got in struts from one jsp to other jsp?
Hello Friend,
Use <%@ page errorPage="errorPage.jsp" %> in the first page that generates the exception
error in sample example
error in sample example hi can u please help me
XmlBeanFactory class is deprecation in java 6.0
so, pls send advance version class
Use XmlBeanFactory(Resource) with an InputStreamResource parameter2-db connection error -" %>
Struts validation not work properly - Struts
to be validated. what have i missed? is there anything that i forgot...
pls help...Struts validation not work properly hi...
i have a problem with my struts validation framework.
i using struts 1.0...
i have 2 page which
For Loop - Struts
Containing 2 records.
In jsp need to dsiplay as two columns.
Pls help me
java error - Java Beginners
uninstalled jdk and NetBeans and reinstalled them, Then too its the same error coming...
pls help...
its urgent...
pls reply as soon as possible...
Thank you....
But if I want to run that program the fetches me the following error.
For example
error message - Java Beginners
,this is the same.how can i take steps to solve this problem pls help. ...error message sir,
while i m trying to execute my first program(print my name)I get error message like" javac is not recognized as internal... into it,but didn't get an idea- how to achieve it.
Can you please help?
Urgently waiting
Display error message if data is already inserted in database
Display error message if data is already inserted in database Display error message if data is already inserted in database Pls help me
Thanks Suppose if you write label message with in your JSP page. But that "add.title" key name was not added in ApplicationResources.properties file? What happens when you run that JSP? What error shows? If it is run
Struts
Struts I want to create tiles programme using struts1.3.8 but i got jasper exception help me out
java complilation error - JavaMail
java complilation error Hi
I was trying to send the mails using the below code,This coding is giving errors that java.mail.* does not exists,i am using netbeans 6.5 ide...pls help
mail.jsp
<@pageimport="java.util. can
Struts - Struts
Struts Hello
I like to make a registration form in struts inwhich... be displayed on single dynamic page according to selected by student.
pls send....
Struts1/Struts2
For more information on struts visit to :
struts
in this file.
# Struts Validator Error Messages
errors.required={0...struts <p>hi here is my code in struts i want to validate my...
}//execute
}//class
struts-config.xml
<struts
Ask Questions?
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
|
http://www.roseindia.net/tutorialhelp/comment/34922
|
CC-MAIN-2013-20
|
refinedweb
| 1,671
| 67.55
|
The Dark Pi Rises
Did you think that the Raspberry Pi will only be limited to benign uses? Did you think that the Raspberry Pi will always bask in the light of day? Well this Raspberry Pi...has embraced the darkness.
Okay I might have overdone it a bit =) no thanks to iMovie's trailer templates! This will be a series of tutorials and code on the construction of Xaver Mk.2. Watch this space! For the next few weeks this article will be a work in progress.
The Architecture
To use the Raspberry Pi in a robot, we need to get the Raspberry Pi mobile first. I used a Tecknet IEP387 USB power pack which provides 7000mAh at 5 volts, which is enough to power the Raspberry Pi for several hours. The power pack has 2 USB power outputs, and I used the first one for the Raspberry Pi, the second one for the powered USB hub using a USB-A to 3.5mm DC jack cable.
I then connected an Arduino to the Raspberry Pi using the USB cable. This enables the Arduino to receive commands from the Raspberry Pi using the serial interface (/dev/ttyACM0), and the Arduino then deals with the hardware such as LEDs and motors. This set-up enables me to keep adding things to be controlled - currently 2 servos, a 5mW red laser diode, a white LED, a 940nm IR LED, as well as the main car motor. This set-up is only limited by the number of available pins on the Arduino (currently 3 motor outputs and 3 digital pins are unused).
Finally, I connected a PS3 eye to the USB hub to serve as the robot's onboard camera. I also removed the IR filter on this camera. This makes colours look a bit strange in daylight, but is essential for the night vision capability of Xaver Mk.2.
Setting up the wifi
First, you need to install the Raspbian image into an SD card. Once the image is loaded on the SD card, it will be recognised on a linux computer as containing 2 partitions. On the 2nd partition, navigate to /etc/network and as root, edit the file 'interfaces'. Put:
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "ssid"
wpa-psk "password"
Replacing, of course, the ssid and password with your own network ssid and password. The Raspberry Pi forums and website contains more details on getting wifi set up on the Raspberry Pi. One tip - use a USB wifi dongle which uses a Ralink or Atheros chipset. Unfortunately, the very small wifi dongles (like the Edimax EW-7811un) use a Realtek chipset which is not as capable on linux yet. If you're going for those wifi dongles anyway, I recommend using the Adafruit Occidentalis version of Raspbian, as they get recognized automatically.
Once you start the Raspberry Pi, it should then connect automatically to the access point. You can connect the Raspberry Pi to a monitor to see its IP address, or you can use Nmap and scan for open SSH ports.
So assuming everything went well, log in through SSH:
arthur@macbook $ ssh pi@192.168.1.135
pi@192.168.1.135's password:
Now you have control over your Raspberry Pi without connecting it to a keyboard or monitor!
Setting up the webcam
After some trouble with other webcams, I settled on using the PS3 eye webcam. You can buy used ones from game stores for about £5. One good thing about the PS3 eye is its extremely fast frame rates at low resolution (60-120 fps), and for £5, that's very good value for money!
To use it, let's install some required programs:
sudo apt-get install gstreamer-tools gstreamer0.10-plugins-bad gstreamer0.10-plugins-good v4l-utils
There are several ways to stream the webcam output to the network, but I settled on GStreamer because 1) I couldn't get VLC to work, 2) ffserver, motion and mjpeg consumed more CPU when I tried them. The following command gives me 10fps at 320x240, at only 25-30% CPU usage:
gst-launch -v v4l2src ! ffmpegcolorspace ! video/x-raw-yuv,width=320,height=240,framerate=\(fraction\)30/1 ! queue ! videorate ! video/x-raw-yuv,framerate=10/1 ! jpegenc ! multipartmux ! tcpserversink host=192.168.1.135 port=5000 sync=false
UPDATE: The Raspberry Pi Foundation has updated the firmware to enable H.264 encode on the GPU - I'll be working on getting this working as this could enable phenomenal improvement in the webcam streaming while using *less* CPU!
To open the Raspberry Pi's stream on your desktop, just fire up VLC and click 'File->Open Network Stream' and type in 'tcp://192.168.1.135:5000' in the location bar (replace the IP address with your Raspberry Pi's IP address!).
Now you should have 'live' streaming from your Raspberry Pi!
Using a PS3 controller
In one of my earlier posts, I enabled control of a robotic arm through a PS3 sixaxis controller. To do this, we need to install the qtsixa package on the LAPTOP/DESKTOP we're using to control the robot:
sudo add-apt-repository ppa:falk-t-j/qtsixa
sudo apt-get update
sudo apt-get install qtsixa
This should hopefully pull in the sixad daemon which we need to recognise the PS3 sixaxis as a joystick. Alternatively, you can just use a normal PC joystick.
Follow the instructions on the qtsixa website to connect your PS3 controller to your computer. Finally, you need to install pygame (again, still on the laptop/desktop you're using to control the Raspberry Pi):
sudo apt-get install python-pygame
Setting up ad-hoc wifi
To actually be able to use wi-fi outdoors, I followed debian's documentation on setting up an ad-hoc network:
RASPBERRY PI /etc/network/interfaces:
auto wlan0
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
gateway 192.168.1.2
wireless-channel 1
wireless-essid MYNETWORK
wireless-mode ad-hoc
On the linux laptop: use gnome network manager to connect to MYNETWORK, but set a manual IP address of 192.168.1.2, with a gateway of 192.168.1.1. Take note that ad-hoc is NOT supported in all of linux wifi drivers. (Ralink 2500 does not support it, neither do most Realtek chips)
All in all, the control architecture of Xaver Mk.2 can be represented by the diagram below:
PS3 + TCP client in python:
#!/usr/bin/env python import pygame import usb.core import time #import serial #DEVICE = '/dev/ttyACM0' #BAUD = 9600 #ser = serial.Serial(DEVICE, BAUD) pygame.init() j = pygame.joystick.Joystick(0) j.init() print 'Initialized Joystick : %s' % j.get_name() threshold = 0.30 throttle_prev = 0 steering_prev = 0 laser_prev = 0 import socket # Import socket module s = socket.socket() # Create a socket object host = '192.168.1.135' #socket.gethostname() # Get local machine name port = 12345 # Reserve a port for your service. print 'Connecting to ', host, port s.connect((host, port)) def sendcommand(steering_set,throttle_set,light_set,infrared_set,laser_set,camera): byte1 = chr(steering_set+throttle_set) byte2 = chr(camera*8+laser_set*4+int(infrared_set)*2+int(light_set)) s.send(byte1+byte2) try: command = (0,0,0) lighton = False lc = 0 oldtime = 0 oldtime2 = 0 oldtime3 = 0 oldtime4 = 0 light_set = False infrared_set = False while True: pygame.event.pump() steering = j.get_axis(0) throttle = j.get_axis(3) light = j.get_button(12) laser = j.get_button(11) infrared = j.get_button(15) camera_left = j.get_button(5) camera_right = j.get_button(7) ############################################# throttle_set = int((-throttle*7.5)+7.5) steering_set = int((steering*7.5)+7.5)*16 laser_set = int(laser) camera = 0 if light: if (time.time()- oldtime) > 0.3: light_set = not light_set oldtime = time.time() sendcommand(steering_set,throttle_set,light_set,infrared_set,laser_set,camera) print 'light: ', light if infrared: if (time.time()- oldtime2) > 0.3: infrared_set = not infrared_set oldtime2 = time.time() sendcommand(steering_set,throttle_set,light_set,infrared_set,laser_set,camera) print 'light: ', light if throttle_set != throttle_prev: sendcommand(steering_set,throttle_set,light_set,infrared_set,laser_set,camera) print 'throttle: ', throttle_set if steering_set != steering_prev: sendcommand(steering_set,throttle_set,light_set,infrared_set,laser_set,camera) print 'steering: ', steering_set if laser_set != laser_prev: sendcommand(steering_set,throttle_set,light_set,infrared_set,laser_set,camera) print 'pew, pew' if camera_left: if (time.time()- oldtime3) > 0.05: camera = 2 oldtime3 = time.time() sendcommand(steering_set,throttle_set,light_set,infrared_set,laser_set,camera) if camera_right: if (time.time()- oldtime4) > 0.05: camera = 1 oldtime4 = time.time() sendcommand(steering_set,throttle_set,light_set,infrared_set,laser_set,camera) throttle_prev = int(throttle_set) steering_prev = int(steering_set) laser_prev = laser_set except KeyboardInterrupt: j.quit()
The TCP server running on Xaver:
#!/usr/bin/python # Xaver's TCP server. Runs on the Raspberry Pi. import socket # Import socket module s = socket.socket() # Create a socket object host = '192.168.1.135' # Get local machine name port = 12345 # Reserve a port for your service. import serial DEVICE = '/dev/ttyACM0' # the arduino serial interface (use dmesg when connecting) BAUD = 9600 ser = serial.Serial(DEVICE, BAUD) print 'Server started!' print 'Waiting for clients...' s.bind((host, port)) # Bind to the port s.listen(5) # Now wait for client connection. c, addr = s.accept() # Establish connection with client. print 'Got connection from', addr while True: msg = c.recv(2) # get 2 bytes from the TCP connection ser.write(msg) # write the 2 bytes to the serial interface
The Arduino sketch:
#include <AFMotor.h> #include <Servo.h> Servo steering; Servo cservo; AF_DCMotor motor(3, MOTOR12_64KHZ); // create motor #3, 64KHz pwm int throttle = 0; int ctlbyte = 0; int ctlbyte2 = 0; float tval = 7.0; float sval = 7.0; int steering_pos = 96; int camera_pos = 90; void setup() { Serial.begin(9600); motor.setSpeed(0); motor.run(RELEASE); steering.attach(10); steering.write(96); cservo.attach(9); cservo.write(90); pinMode(A5,OUTPUT); pinMode(A4,OUTPUT); pinMode(A3,OUTPUT); digitalWrite(A5,LOW); digitalWrite(A4,LOW); digitalWrite(A3,LOW); } void loop() { if (tval == 7.0) { motor.setSpeed(0); motor.run(RELEASE); } if (sval == 7.0) { steering.write(96); } if (Serial.available()==2) { ctlbyte = Serial.read(); tval = (float) (ctlbyte & 0x0F); sval = (float) (ctlbyte & 0xF0); sval = sval/16.0; //set zero positions if (tval == 7.0) { motor.setSpeed(0); motor.run(RELEASE); } if (sval == 7.0) { steering.write(96); } //motor forward if (tval > 7.0) { throttle = (int) (100.0 + ((tval - 7.0)/8.0)*150.0); motor.setSpeed(throttle); //Serial.println(throttle); motor.run(FORWARD); } //motor backward if (tval < 7.0) { throttle = (int) (100.0 + (-(tval-7.0)/7.0)*150.0); motor.setSpeed(throttle); //Serial.println(throttle); motor.run(BACKWARD); } //going right if (sval > 7.0) { steering_pos = (int) 96.0 + ((sval - 7.0)/8.0)*40.0; steering.write(steering_pos); } //going left if (sval < 7.0) { steering_pos = (int) 96.0 - ((-(sval-7.0)/7.0)*26.0); steering.write(steering_pos); } ctlbyte2 = Serial.read(); //read 2nd control byte if ((ctlbyte2 & 0x01)==1) { digitalWrite(A5,HIGH); //light on } if ((ctlbyte2 & 0x01)==0) { digitalWrite(A5,LOW); //light off } if ((ctlbyte2 & 0x02)==2) { digitalWrite(A4,HIGH); //IR on } if ((ctlbyte2 & 0x02)==0) { digitalWrite(A4,LOW); // IR off } if ((ctlbyte2 & 0x04)==4) { digitalWrite(A3,HIGH); //laser on } if ((ctlbyte2 & 0x04)==0) { digitalWrite(A3,LOW); // laser off } if ((ctlbyte2 & 0x18)==8) { //turn camera left camera_pos = camera_pos + 5; cservo.write(camera_pos); } if ((ctlbyte2 & 0x18)==16) { //turn camera right camera_pos = camera_pos - 5; cservo.write(camera_pos); } } }
Interesting..
My today's visit to raspberrypi.org blog is much more exciting than any of my previous visits. Your Pi + Robotics projects are very interesting. I am curious to know about how does the camera connection and how does Pi + Arduino communication happen...
Good luck,
-Kri
Nice work!
This looks great, and thanks for posting. Any chance you could fill us in on what wifi hardware you're using?
Great Project!
I'll be following your blog! P.S. Looks like the embedded object (below the first still of the Dark Pi) is not working FWIW. I assume the Pi connects to the Arduino via TTL serial? Also, have you looked at the Beagle Bone? Can you compare the Beagle to the Pi?
Thanks!
Ralph - ralphsrobots.com
OMG
The video started working, it is a riot! Nice Job.
great video
can you send me some details of the video editing tools you used to create your work, It looks great and i'd like to know how you did it.
Hey!
Very good work! I have the same idea since one year ago, but i was using a mini-ITX as the raspberry, now got a rasp and i'm remaking the project with it. I really appreciate your work, It will help my project to get ended.
sorry for my bad english!
Nice project! I am actually
Nice project! I am actually planning on combining an Arduino and a Raspberry Pi for an autonomous vehicle that I am working on but I am not quite as far along on it as you are with yours. Keep up the good work.
Thanks for the awesome post!
Thanks for the awesome post! I'm using your method for streaming from my PS Eye on the Raspi with the official 2012-08-16 Raspbian distro but it's using 60-70% CPU for me... any ideas so to why? The only thing I've changed is overclocking to 800Mhz.
Video settings
It's possibly because the v4l settings need to be set. You need v4l-utils and type:
v4l2-ctl --list-formats
Then select 320x240 resolution by typing:
v4l2-ctl --set-fmt-video=width=320,height=240,pixelformat=0
Replace the pixelformat with the correct number (I don't have my pi powered on right now to check the exact value). Hope this helps.
Vivo en Uruguay. Hay algun
Vivo en Uruguay. Hay algun proveedor al que pueda comprar un Raspberry Pi por internet?
Si, RS Electronics (http:/
Si, RS Electronics (...) y Farnell ().
Adhoc network
Great little project you've done with the Pi :-)
Was reading over on the Foundation forum that you were now doing this with an adhoc wi-fi network. WOuld you mind giving some details on how you managed to do this? I've been struggling with it for about a month.
-
Mike
A way for "zero" delay?
Hey, im trying the same streaming with a Microsoft Camera on linux, it just works with the same configuration you have in here, but i have a one second delay between the movement and the streamed. Is there a way to perform this?
Thanks
is there code missing? what
is there code missing? what code goes on the raspi and what is used on the laptop.
Thanks.
Hi! Thank you for sharing
Hi! Thank you for sharing your setup.
Can you please say what USB wifi dongle you are using? And why is there an antenna connected to a white USB dongle?
Also you are using the "EXTREME 1:10" for your rover?
Is this the Adafruit motor shield you refer ?
Wifi dongle
The wifi dongle doesn't have a brand on it, and I've thrown away the box. All I know is that it uses a Ralink chipset - plenty of other dongles have the same chipset, use those. The TP-Link TL-WN722N also works well.
2nd question: yes.
3rd question: Yes it's a 1:10 radio controlled car.
4th question: yes.
Thanks! :)
Thanks! :)
I am now testing a PS3 Eye toy webcam.
tcp server setup
Hi i would like to set up a drone of my own, I am having trouble with the tcp server for the raspberry pi.
Your help would be greatly appreciated.
Just brilliant!!
Hi, great idea and execution. I have all the parts of my machine figured out but am really struggling writing the tcp stack for the raspberry pi. Any help or a pointer in the right direction would be greatly appreciated.
Cheers, Gavinu
GStreamer Green screen
Hi amazing stuff here
i followed your instructions and i open the stream in vlc but i am only getting a green screen. do you have any pointers because im stuck
Which USB hub are you using?
Which USB hub are you using?
Hey, what kind of latency is
Hey, what kind of latency is there between the ps3 eye and vlc?
Hello,
Hello,
I am having trouble setting up my wifi. How would I set this up at my school where I need to sign in with a username and a password. How would I set this up using wlan0? It is a WPA-2 network and find an answer online. If you know of a good tutorial, that would be great as well.
Thanks,
Michael
|
http://www.aonsquared.co.uk/the_dark_pi_rises
|
CC-MAIN-2014-35
|
refinedweb
| 2,752
| 68.16
|
A transaction-aware Celery job setup
A transaction-aware Celery job setup. This is integrated with the Zope transaction package, which implements a full two-phase commit protocol. While it is not designed for anything other than Pyramid, it also does not use any component of Pyramid. It’s simply not tested anywhere else.
- Free software: BSD license
- Documentation:.
Features
- Queues tasks into a thread-local when they are called either using delay or apply_async.
- If the transaction is aborted, then the tasks will never be called.
- If the transaction is committed, the tasks will go through their normal apply_async process and be queued for processing.
Limitations
Currently, the code is designed around Celery v3.1, and it is unknown whether it will work with previous versions. I’m more than happy to integrate changes that would make it work with other releases, but since I generally stay on the latest release, it isn’t a priority for my own development.
Usage
Using the library is a relatively easy thing to do. First, you’ll need to integrate Celery into your Pyramid application, for which I recommend using pyramid_celery. Once that’s done, you simply need to start creating your tasks. The big difference is for function-based tasks, you use a different decorator:
from pyramid_transactional_celery import task_tm @task_tm def add(x, y): """Add two numbers together.""" return x + y
That’s all there is to it. For class-based tasks, you simply need to subclass TransactionalTask instead of Task:
from pyramid_transactional_celery import TransactionalTask class SampleTask(TransactionalTask): """A sample task that is transactional.""" def run(x, y): return x + y
That’s it. Bob’s your uncle.
History
0.1.1 (2015-01-19)
- Removed an excess creation of a CeleryDataManager that was a left-over from a previous approach. While this didn’t create a bug, it wasted memory.
0.1.0 (2015-01-19)
- Initial functionality, but more testing of edge cases is needed to ensure that it works correctly in all cases, and with other versions of Celery.
- First release on PyPI.
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/pyramid_transactional_celery/
|
CC-MAIN-2017-43
|
refinedweb
| 366
| 57.77
|
I am using matplotlib to draw and show my plot, now I want to know how may I
add manual axes scale to it.
I need to manually show the axes scale (from min to max value that I have)
the below is some part of my code.
.
.
.
from matplotlib.figure import Figure
self.fig = Figure( figsize =5, 4 ))
yLine = self.ax.plot( xData, yData, 'ro-', linewidth = 2 )
fitLine = self.ax.plot( xData, fitData,'bo-', linewidth = 1 )
self.ax.set_xlabel('X')
self.ax.set_ylabel('Y )
···
View this message in context:
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
https://discourse.matplotlib.org/t/how-add-axes-scale-to-my-plot/9600
|
CC-MAIN-2022-21
|
refinedweb
| 101
| 67.35
|
A computer program is a sequence of instructions that tell the computer what to do.
Statements often terminated by a semicolon.
There are many different kinds of statements in C++. The following are some of the most common types of simple statements:
int x; is a declaration statement. This particular declaration statement tells the compiler that x is a variable that holds an integer (int) value. In programming, a variable provides a name for a region of memory that can hold a value that can vary. All variables in a program must be declared before they are used. We will talk more about variables shortly.
int x;
x = 5; is an assignment statement. It assigns a value (5) to a variable (x).
x = 5;
std::cout << x; is an output statement. It outputs the value of x (which we set to 5 in the previous statement) to the screen.
std::cout << x;
Expressions
The compiler is also capable of resolving expressions. An expression is)).
For example, the statement x = 2 + 3; is a valid assignment statement. The expression 2 + 3 evaluates to the value of 5. This value of 5 is then assigned to x.
x = 2 + 3;
Functions
In C++, statements are typically grouped into units called functions. A function is a collection of statements that executes sequentially. Every C++ program must contain a special function called main. When the C++ program is run, execution starts with the first statement inside of function main. Functions are typically written to do a very specific job. For example, a function named “max” might contain statements that figures out which of two numbers is larger. A function named “calculateGrade” might calculate a student’s grade. We will talk more about functions later.
Helpful hint: It’s a good idea to put your main() function in a .cpp file named either main.cpp, or with the same name as your project. For example, if you are writing a Chess game, you could put your main() function in chess.cpp.
Libraries and the C++ Standard Library
A library is a collection of precompiled code (e.g. functions) that has been “packaged up” for reuse in many different programs. Libraries provide a common way to extend what your programs can do. For example, if you were writing a game, you’d probably want to include a sound library and a graphics library.
The C++ core language is actually very small and minimalistic (and you’ll learn most of it in these tutorials). However, C++ also comes with a library called the C++ standard library that provides additional functionality for your use. The C++ standard library is divided into areas (sometimes also called libraries, even though they’re just parts of the standard library), each of which focus on providing a specific type of functionality. One of the most commonly used parts of the C++ standard library is the iostream library, which contains functionality for writing to the screen and getting input from a console user.
Taking a look at a sample program
Now that you have a brief understanding of what statements, functions, and libraries are, let’s look at a simple “hello world” program:
Line 1 is a special type of statement called a preprocessor directive. Preprocessor directives tell the compiler to perform a special task. In this case, we are telling the compiler that we would like to add the contents of the iostream header to our program. The iostream header allows us to access functionality from the iostream library, which will allow us to write text to the screen.
Line 2 is blank, and is ignored by the compiler.
Line 3 declares the main() function, which as you learned above, is mandatory. Every program must have a main() function.
Lines 4 and 7 tell the compiler which lines are part of the main function. Everything between the opening curly brace on line 4 and the closing curly brace on line 7 is considered part of the main() function.
Line 5 is our first statement (you can tell it’s a statement because it ends with a semicolon), and it is an output statement. std::cout is a special object that represents the console/screen. The << symbol is an operator (much like + is an operator in mathematics) called the output operator. std::cout understands that anything sent to it via the output operator should be printed on the screen. In this case, we’re sending it the text “Hello world!”.
Line 6 is a new type of statement, called a return statement. When an executable program finishes running, the main() function sends a value back to the operating system that indicates whether it was run successfully or not.
This particular return statement returns the value of 0 to the operating system, which means “everything went okay!”. Non-zero numbers are typically used to indicate that something went wrong, and the program had to abort. We will discuss return statements in more detail when we discuss functions.
All of the programs we write will follow this template, or a variation on it. We will discuss each of the lines above in more detail in the upcoming sections.
(Remember, Visual Studio users should add #include “stdafx.h” as the first line of any C++ code file written in Visual Studio).
For example, you learned above that statements must end in a semicolon.
Let’s see what happens if we omit the semicolon in the following program:
Visual studio produces the following error:
c:\users\apomeranz\documents\visual studio 2013\projects\test1\test1\test1.cpp(6): error C2143: syntax error : missing ';' before 'return'
This is telling you that you have a syntax error on line 6: You’ve forgotten a semicolon before the return. In this case, the error is actually at the end of line 5. Often, the compiler will pinpoint the exact line where the syntax error occurs for you. However, sometimes it doesn’t notice until the next line.
Syntax errors are common when writing a program. Fortunately, they’re often easily fixable. The program can only be fully compiled (and executed) once all syntax errors are resolved.
Quiz
The following quiz is meant to reinforce your understanding of the material presented above.
1) What is the difference between a statement and an expression?
2) What is the difference between a function and a library?
3) What symbol are statements in C++ often ended with?
4) What is a syntax error?
Quiz Answers
To see these answers, select the area below with your mouse.
1) Show Solution
2) Show Solution
3) Show Solution
4) Show Solution
So after execution of our program, compiler returns a value to the OS indicating whether or not our program was successfully compiled and executed. But, here we are already specifying a return value (in the above case, '0'). We forcefully want our compiler to tell our OS that there wasn't any error in our program. Shouldn't this job be handled by compiler itself, instead of user specifying a return value?
At the end of execution of our program, the program returns a value to the OS (not the compiler).
Typically, things happen in this order:
* Programmer writes code.
* Programmer uses compiler to compile code into an executable. (The compiler’s job is done at this point)
* User runs executable.
* Executable returns a code to the OS to indicate whether the executable ran successfully.
The compiler generally won’t even be running when the executable is running (unless you’re debugging).
Hi how can I gt the minGw compiler, currently m using turbo C++
It's quite tricky to work with.
Hello.I am From Iran and in my University I Learned the Python very well. but dont teach the c++.
this Site is very Special and very good.
thanks for all your difficulty.
int x;
This tells the compiler that x is a variable
Does this mean, memory is allocated for variable x when variable x is declared?
What exactly is the difference between declaration and definition?
Really good question about the difference between declaration and definition. The easiest way to think about it is as follows:
* A declaration introduces an object object (function, variable, etc…) and it’s type. A function prototype is an example of a declaration. A declaration is enough to satisfy the compiler. You can have multiple declarations for the same object.
* A definition actually defines that object. A function with a body is an example of a definition. A definition is needed to satisfy the linker. There can only be one definition for an object.
In many cases, a single line serves as both the declaration and definition. For example, “int x” is a declaration AND a definition.
Memory is allocated at the point of instantiation, which is when the object (variable) is actually created. This point can vary depending on where the variable is. For example, if a variable lives inside a function, the variable won’t be created (and memory assigned) until that function executes.
First, remember that the declaration is purely semantic. You have a name that logically associates with a type and a value. What the compiler does will vary. See the section on build configurations above.
For "debug" builds, variables local to a function are typically given memory when first assigned a value. That memory is only present for as long as the variable is in scope (i.e. code is executing within the {} the variable was defined in, and then is subject to reuse.
For release builds, typically the compliers optimizer is enabled -- and all bets are off. Local variables (those that are part of a function) are not guaranteed to have *any* memory is allocated. Depending on how x is used, x may only ever exist inside a CPU register and never be stored to memory. Other optimizations might collapse all logical operations on x to a logically equivalent set of instructions that don’t ever have any of the values that x would logically take on.
Debugging release builds can be a serious pain, and bugs that only exist in release builds are among the most pernicious.
very nice working………..
I just started with the tutorial yesterday and completed my first program! I am in HS and want to learn c++ because I want to be a computer programmer! Thank you this is all good and if you have any tips for me or other codes I can learn online please comment!!! 🙂
Thanks for this site owner’s
thanks for every one who do this site thanx much
Why we need operators?
Operators provide a convenient and concise way for us to get different things to interact.
Take for example “3 + 4”. The + operator adds 3 and 4 to produce the result 7.
With cout << "Hello world", the << operator takes "Hello world" and gives it to cout to print on the screen. Without the << operator, the compiler wouldn't know whether "Hello world" was meant to interact with cout or something else.
Hey there!
I am wondering what “int” does in “int main()”.
What does it do and when do i use it?
I also read somewhere that you can use “void” instead of “int”.
What does “void” mean and what does it do?
I talk about all of these things in section 1.4 -- A first look at functions. If you keep following the tutorials, you’ll get there shortly.
Consistency issue.
For beginners, the move from
using namespace std;
to
std::
std::
might be confusing.
Hence I suggest amending the example code accordingly, or leaving a note at the end of the tutorial highlighting the interchangeability feature of the two.
I added a side note about this. Hopefully it isn’t information overload at this point.
I started doing some things on my own hehehe
#include
int main()
{
int x;
int y;
int d;
int f;
x = 5;
y = 5;
d = x + y;
f = d + d;
using namespace std;
cout << x + y << endl;
cout << f << endl;
return 0;
I think this one is more appropriate:
ohhh… every nice i understand!
thanks! learncpp.com
On mac (xcode) there will be one error if you follow it exactly as shown on this page. Instead use this one
int main () {
using namespace std;
cout << "Hello world!" << endl;
return 0;
}
Even if you have ignore white space on it will still err. So do not give "{" its own line thats bad programming on xcode. it took me a week to figure that out, because i was wondering why it wasnt "build & run" so i started to play around with spacing, after i had already asked 10 different sites why didnt this code work, turns out it does, just requires a certain spacing requirement. My guess is you cant use "{}" without telling it why its there. thats probably a bad explaination or wrong explaination.
Or your compiler/IDE sucks. Any standard C++ compiler which follows the specifications should be able to compile with all the whitespace you need.
Endl is a special symbol that moves the cursor to the next line
This is incorrect. The special symbol that moves the cursor to the next line is ‘\n’. Abuse of std::endl for this purpose is bad practice which leads to inefficient programs.
thanks
I updated the wording to be more precise:
Endl is another special object that, when used in conjunction with cout, causes the cursor to move to the next line (and ensures that anything that precedes it is printed on the screen immediately).
You are correct that overuse of std::endl can cause performance issues in cases where flushing the buffer has a performance cost, such as when writing to disk. I made notes of this in lesson 13.6 -- Basic File I/O, where I talk about buffering and flushing in more detail.
Good stuff!!!
Plz explain using namesapace std; in more understandable manner alex sir.
using namespace std; is basically using "std" throughout the entire code.
using namespace std;
is basically using "std" throughout the entire code.
Instead of writing std::cout:: << "Hello World!" << std::endl; or something like that. You won't have to include all that "std::" if you have
std::cout:: << "Hello World!" << std::endl;
or something like that. You won't have to include all that "std::" if you have
using namespace std;
very good website this. thanks to the Admin of this website and the people who made this possiable to us. Great lessons
thanks again
Albanian.
Hahah I’m Albanian too
And I’m trying to learn this language
you gys need to stop smoking bad weed, the code is fine.
When i code i place the:
at the top
it still works, isn’t that more convinient? or is there a reason for placing it inside each and every function
It’s more convenient perhaps, but also more dangerous. If you put the using namespace std; statement at the top of your code, it applies to everything in the file. This increases the chance of naming collisions.
Generally, it’s better to either put the using statement in each function that needs it, or call cout directly using the scope resolution operator (e.g. std::cout).
It would be good if you could explain the difference between functions and methods.
A method and a function are essentially the same thing. In C++, we usually use the term function when the function is independent of an object, and method (or more commonly, member function) when the function is part of an object/class.
Wow ur teaching or tutorial here is much better than my teacher. I’m currently studying engineering with c++ as a module but till now i nvr knew the true meaning of 0 at the return 0.
Is there any explanation about the structure of Standard Template Library (STL)in this site?
………………………………………… skew you
I have Visual C++ 2005 Express Edition,
but my lines aren’t numbered. Why?
This article has some helpful information for turning on line numbering in Visual Studio 2005.
And to add in a little Open Source plug (I swear I’m not being paid), Code::Blocks turns on line numbering by default.
if “cout < < “Hello world!” << endl;” is a statement and “<<” is an operator what is “cout” a command?
cout is actually a variable that is predefined by the standard library. The variable is of type ostream, which is a class. Classes allow you to define your own variable types. We cover classes in more detail in chapter 8.
if “cout” is an object of a class, then who actually does instantiate it ? we do not create this instance in our code. Is this object created before the actual code is executed ?
Great question. When you include iostream, the iostream has an instatiation of cout.
lol you replied like 5 years later on that one
Better late than never. 😛
is an expression a type of statement?
I’m not quite sure how to answer that.
In most cases, and expression is PART of a statement. For example:
“2 + 3” is an expression that evaluates to 5. x = 2 + 3 is an assignment statement that assigns the result of evaluation 2 + 3 to variable x.
It is possible to have a statement that consists only of an expression. For example, the following is allowed:
This expression evaluates to 5, but since the result is not used anywhere it is just discarded.
hey man very nice though you wrote ” would like to use the iosteam library.” in the first paragraph after
“Taking a look at a sample program”
I’m not sure what the problem is with that. Am I missing something? 🙂
iosteam should be iostream. It is missing an “r”.
[ Wow, I can’t believe I didn’t see that. Fixed now! Thanks all. -Alex ]
using namespace std; is in the wrong line
it should be in the main header before int main( )
No, it shouldn’t. If it’s in the main function, the scope of the statement only applies to the function (which is good). If you put it in the main part of the program, it applies to the entire file, which is generally considered poor form (and could lead to naming collisions).
Hey you’re still reading comments! That’s awesome. I just started not that long ago. Thanks for putting these up 😀
Me too, and it is super awesome!
Alex is write
I write, therefore I am.
If you use iostream instead of iostream.h,you should use the following namespace directive to make the definition in iostream available to your program.using namespace std at the beginning of the program is bit lazy and potentially a problem in large projects.the preferred approaches are to use the std:: qualifier or to use something called using declaration to make just particular names available.for example using std::cout.
I’m not sure if it differentiates between C++ Compilers or not but I’m using Visual C++ and my program will not compile unless the using namespace std; is outside of the main function
Thanks for this part of the tutorial. I found this section really helpful.
Thanks for the valuble post , It is very useful C++ Programming examples for beginners
Name (required)
Website
|
http://www.learncpp.com/cpp-tutorial/11-structure-of-a-program/comment-page-1/
|
CC-MAIN-2018-05
|
refinedweb
| 3,220
| 65.52
|
Log pings
This flag causes all subsequent pings that are submitted to also be echoed to the product's log.
Once enabled, the only way to disable this feature is to restart or manually reset the application.
On how to access logs
The Glean SDKs log warnings and errors through platform-specific logging frameworks. See the platform-specific instructions for information on how to view the logs on the platform you are on.
Limits
- The accepted values are
trueor
false. Any other value will be ignored.
API
setLogPings
Enables or disables ping logging.
This API can safely be called before
Glean.initialize.
The tag will be applied upon initialization in this case.
import Glean Glean.shared.setLogPings(true)
use glean; glean.set_log_pings(true);
import Glean from "@mozilla/glean/<platform>"; Glean.setLogPings(true);
Environment variable
GLEAN_LOG_PINGS
It is also possible to enable ping logging through
the
GLEAN_LOG_PINGS_LOG_PINGS=true python my_application.py
$ GLEAN_LOG_PINGS=true cargo run
$ GLEAN_LOG_PINGS=true ./mach run
|
https://mozilla.github.io/glean/book/reference/debug/logPings.html
|
CC-MAIN-2022-05
|
refinedweb
| 158
| 61.22
|
Aspose Cells for Java parses XML character reference incorrectly. Please look at following code and attached xlsx files:
package com.xmlintl.tools;
import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Paths; import com.aspose.cells.Workbook; public class AsposeCellsTest { public static void main(String[] args) throws Exception { try(InputStream input = Files.newInputStream(Paths.get("C:/test/test.xlsx"))) { Workbook workbook = new Workbook(input); workbook.save("C:/test/test-result.xlsx"); } } }
After opening the resulting file, you will see that the emoji in cell from the second row has been saved as:
🌾 test
while it should be saved (and displayed in the Excel file) as a character:
test
I find this as a bug in Aspose Cells for Java.
It is caused by the fact that the text in cell from row 2 is saved in the xlsx file (xl\sharedStrings.xml) as:
🌾 test
but this is correct way of saving it in XML file.
I also expect that the method Cell::getStringValue will return:
“ test”
for cells from row 1 and 2. Currently it does return:
“🌾 test”
for the cell from second row.test.zip (13.0 KB)
|
https://forum.aspose.com/t/character-references-parsed-incorrectly-by-aspose-cells-for-java/161711
|
CC-MAIN-2022-21
|
refinedweb
| 193
| 59.09
|
Bhakti-rasmta-sindhu
The complete Science of Bhakti Yoga
A Summary Study of rla Rpa Gosvm's
Bhakti-rasmta-sindhu
Introduction
1. Characteristics of Pure Devotional Service
2. The First Stages of Devotion
3. Eligibility of the Candidate for Acccepting
1
Dedicationops and are
engaged in the transcendental loving service of Rdh and Ka."
Preface
The Nectar of Devotion is a summary study of Bhakti-rasmta-sindhu,
which was written in Sanskrit by rla Rpa Gosvm Prabhupda. He was the
chief of the six Gosvms, who were the direct disciples of Lord Caitanya
Mahprabhu. When he first met Lord Caitanya, rla Rpa Gosvm
Prabhupda was engaged as a minister in the Muhammadan government of
Bengal. He and his brother Santana were then named Dabira Khsa and
Skara Mallika respectively, and they held responsible posts as ministers of
Nawab Hussain Shah. At that time, five hundred years ago, the Hindu society
was very rigid, and if a member of the brhmaa caste accepted the service of a
Muhammadan ruler he was at once rejected from brhmaa society. That was
the position of the two brothers, Dabira Khsa and Skara Mallika. They
belonged to the highly situated srasvata-brhmaams, the highest position of brahminical culture. Similarly, Lord Caitanya
accepted Haridsa hkura as His disciple, although Haridsa happened to be
born of a Muhammadan family, and Lord Caitanya later on made him the
crya of the chanting of the holy name of the Lord: Hare Ka, Hare Ka,
Ka Ka, Hare Hare/ Hare Rma, Hare Rma, Rma Rma, Hare Hare.
4
spent in forgetfulness, he again changes his position and resumes his actual
business activities. Material engagement means accepting a particular status
for some time and then changing it. This position of changing back and forth
is technically known as bhoga-tyga, which means a position of alternating
sense enjoyment and renunciation. A living entity. In
any field of activitypolitical, social, national or internationalthe result of
our actions will be finished with the end of life. That is sure.
Bhakti-rasa, however, the mellow relished in the transcendental loving
service of the Lord, does not finish with the end of life. It continues
perpetually and is therefore called amta, that which does not die but exists
eternally. This is confirmed in all Vedic literatures. Bhagavad-gt says that a
little advancement in bhakti-rasa can save the devotee from the greatest
dangerthat
7
live without material discomfiture, but at the same time he should learn the
art of loving Ka. At the present moment we are inventing so many ways to
utilize our propensity to love, but factually we are missing the real point:
Ka. We are watering all parts of the tree, but missing the tree's root. We are
trying to keep our body fit by all means, but we are neglecting to supply
foodstuffs to the stomach. Missing Ka means missing one's self also. Real
self-realization and realization of Ka go together simultaneously. For
example, seeing oneself in the morning means seeing the sunrise also; without
seeing the sunshine no one can see himself. Similarly, unless one has realized
Ka there is no question of self-realization.
The Nectar of Devotion is specifically presented for persons who are now
engaged in the Ka consciousness movement. I beg to offer my sincere
thanks to all my friends and disciples who are helping me to push forward the
Ka consciousness movement in the Western countries, and I beg to
acknowledge, with thanks, the contribution made by my beloved disciple
rman Jaynanda brahmacr. My thanks are due as well to the directors of
ISKCON Press, who have taken so much care in publishing this great
literature. Hare Ka. [VTE]
(1)
A.C. Bhaktivedanta Swami
13 April 1970
ISKCON Headquarters
3764 Watseka Ave.
Los Angeles, California
Introduction
11.
rla Rpa Gosvm prays to his spiritual master, rla Santana Gosvm,
for the protection of Bhakti-rasmasmta-sindhu, rla Rpa Gosvm, very humbly
submits that he is just trying to spread Ka consciousness all over the world,
although he humbly thinks himself unfit for this work. That should be the
attitude of all preachers of the Ka consciousness movement, following in
the footsteps of rla Rpa Gosvm. We should never think of ourselves as
great preachers, but should always consider that we are simply instrumental to
the previous cryas, and simply by following in their footsteps we may be able
to do something for the benefit of suffering humanity.
Bhakti-rasmta-sindhu is divided into four parts, just as the ocean is
sometimes divided into four parts, and there are different sections within each
of these four divisions. Originally, in Bhakti-rasmta-sindhu, the ocean is
divided like the watery ocean into east, south, west and north, while the
subsections within these different divisions are called waves. As in the ocean
there are always different waves, either on the eastern side, the southern side,
13
internal energy. The living entities, who are called marginal energy, perform
material activities when acting under the inferior, external energy. And when
they engage in activities under the internal, spiritual energy, their activities
are called Ka conscious. This means that those who are great souls or great
devotees do not act under the spell of material energy, but act instead under
the protection of the spiritual energy. Any activities done in devotional
service, or in Ka consciousness, are directly under the control of spiritual
energy. In other words, energy is a sort of strength, and this strength can be
spiritualized by the mercy of both the bona fide spiritual master and Ka.
In the Caitanya-caritmta, by Kadsa Kavirja Gosvm, Lord Caitanya
states that it is a fortunate person who comes in contact with a bona fide
spiritual master by the grace of Ka. One who is serious about spiritual life is
given by Ka the intelligence to come in contact with a bona fide spiritual
master, and then by the grace of the spiritual master one becomes advanced in
Ka consciousness. In this way the whole jurisdiction of Ka consciousness
is directly under the spiritual energyKa and the spiritual master. This
has nothing to do with the material world. When we speak of "Ka" we refer
to the Supreme Personality of Godhead, along with His many expansions. He
is expanded by His plenary parts and parcels, His differentiated parts and
parcels and His different energies. "Ka," in other words, means everything
and includes everything. Generally, however, we should understand "Ka" to
mean Ka and His personal expansions. Ka expands Himself as Baladeva,
Sakaraa, Vsudeva, Aniruddha, Pradyumna, Rma, Nsiha and Varha,
as well as many other incarnations and innumerable Viu expansions. These
are described in the rmad-Bhgavatam to be as numerous as the uncountable
waves. So Ka includes all such expansions, as well as His pure devotees. In
the Brahma-sahit it is stated that Ka's expansions are all complete in
eternity, blissfulness and cognizance.
Devotional service means to prosecute Ka conscious activities which are
favorable to the transcendental pleasure of the Supreme Lord, Ka, and any
activities which are not favorable to the transcendental favor of the Lord
16
Those effects described as "almost mature" refer to the distress from which
one is suffering at present, and the effects "lying as seed" are in the core of the
heart, where there is a certain stock of sinful desires which are like seeds. The
Sanskrit word kam means that they are almost ready to produce the seed, or
the effect of the seed. "An immature effect" refers to the case where the
seedling has not begun. From this statement of Padma Pura Ka consciousness.
In this connection, ukadeva Gosvm speaks in the Sixth Canto of
rmad-Bhgavatam, Second Chapter, verse 17, about the story of Ajmila,
who began life as a fine and dutiful brhmaa, but in his young manhood
became wholly corrupted by a prostitute. At the end of his wicked life, just by
calling the name "Nryaa [Ka]," he was saved despite so much sin.
ukadeva points out that austerity, charity and the performance of ritualistic
ceremonies for counteracting sinful activities are recommended processes, but
that by performing them one cannot remove the sinful desire-seed from the
heart, as was the case with Ajmila in his youth. This sinful desire-seed can be
removed only by achieving Ka consciousness. And this can be
accomplished very easily by chanting the mah-mantra, or Hare Ka mantra,
as recommended by r Caitanya Mahprab
23 rmad-Bhg Ka rmad-Bhgavatam,
Twenty-second Chapter, verse 39, wherein Sanat-kumra says, "My dear King,
the false ego of a human being is so strong that it keeps him in material
existence as if tied up by a strong rope. Only the devotees can cut off the knot
of this strong rope very easily, by engaging themselves in Ka consciousness.
Others, who are not in Ka consciousness but are trying to become great
mystics or great ritual performers, cannot advance like the devotees.
Therefore, it is the duty of everyone to engage himself in the activities of
Ka consciousness in order to be freed from the tight knot of false ego and
engagement in material activities."
This tight knot of false ego is due to ignorance. As long as one is ignorant
24
about his identity, he is sure to act wrongly and thereby become entangled in
material contamination. This ignorance of factual knowledge can also be
dissipated by Ka consciousness, as is confirmed in the Padma Pura as
follows: "Pure devotional service in Ka Ka consciousness is so strong that the
snakes of ignorance are immediately killed.
Ka Consciousness Is All-auspicious
rla Rpa Gosvm Ka consciousness movement,
however, is so nice that it can render the highest benefit to the entire human
race. Everyone can be attracted by this movement, and everyone can feel the
result. Therefore, Rpa Gosvm and other learned scholars agree that a broad
propaganda program for the Ka consciousness movement of devotional
service all over the world is the highest humanitarian welfare activity.
How the Ka consciousness movement can attract the attention of the
whole world and how each and every man can feel pleasure in this Ka
consciousness is stated in the Padma Pura as follows: "A person who is
25
Happiness in Ka Consciousness
rla Rpa Gosvm has analyzed the different sources of happiness. He has
divided happiness into three categories, which are (1) happiness derived from
material enjoyment, (2) happiness derived by identifying oneself with the
Supreme Brahman and (3) happiness derived from Ka consciousness.
In the tantra-stra Lord iva speaks to his wife, Sat, in this way: "My dear
wife, a person who has surrendered himself at the lotus feet of Govinda and
who has thus developed pure Ka consciousness can be very easily awarded
all the perfections desired by the impersonalists; and beyond this, he can enjoy
27 can enter into the sun planet simply by using the rays of the
sunshine. This perfection is called laghim. Similarly, a yog can touch the
moon with his finger. Though the modern astronauts go to the moon with the
help of spaceships, they undergo many difficulties, whereas a person with
mystic perfection can extend his hand and touch the moon with his finger.
This siddhi is called prpti, or acquisition. With this prpti-siddhi, not only can
the perfect mystic yog touch the moon planet, but he can extend his hand
anywhere and take whatever he likes. He may be sitting thousands of miles
away from a certain place, and if he likes he can take fruit from a garden
there. This is prpti-siddhi.
The modern scientists have manufactured nuclear weapons with which
they can destroy an insignificant part of this planet, but by the yoga-siddhi
known as it one can create and destroy an entire planet simply at will.
Another perfection is called vait, and by this perfection one can bring
anyone under his control. This is a kind of hypnotism which is almost
irresistible. Sometimes it is found that a yog who may have attained a little
perfection in this vait mystic power comes out among the people and speaks
all sorts of nonsense, controls their minds, exploits them, takes their money
and then goes away.
There is another mystic perfection, which is known as prkmya (magic).
By this prkmya power one can achieve anything he likes. For example, one
can make water enter into his eye and then again come out from within the
29
Actually, a pure devotee does not aspire after any of these perfections,
because the happiness derived from devotional service in Ka consciousness
is so transcendental and so unlimited that no other happiness can compare to
it. It is said that even one drop of happiness in Kavec rdhvec rdhara, and offered
him any opulence he liked. But rdh Nrada-pacartra
31
of the Lord. In other words, a pure devotee does not lack any kind of
happiness derived from any source. He does not want anything but service to
Ka, but even if he should have another desire, the Lord fulfills this without
the devotee's asking.
the dust of the lotus feet of a pure devotee, who is completely freed from the
contamination of material desires.
In the Fifth Canto of rmad-Bhgavatam, Sixth Chapter, verse 18, Nrada
also says to Yudhihira, "My dear King, it is Lord Ka, known as Mukunda,
who is the eternal protector of the Pavas and the Yadus. He is also your
spiritual master and instructor in every respect. He is the only worshipable
God for you. He is very dear and affectionate, and He is the director of all
your activities, both individual and familial. And what's more, He sometimes
carries out your orders as if He were your messenger! My dear King, how very
fortunate you are, because for others all these favors given to you by the
Supreme Lord would not even be dreamt of." The purport to this verse is that
the Lord easily offers liberation, but He rarely agrees to offer a soul devotional
service, because by devotional service the Lord Himself becomes purchased by
the devotee.
Attracting Ka
rla Rpa Gosvm has stated that devotional service attracts even Ka.
Ka attracts everyone, but devotional service attracts Ka. The symbol of
devotional service in the highest degree is Rdhr. Ka is called
Madana-mohana, which means that He is so attractive that He can defeat the
attraction of thousands of Cupids. But Rdhr is still more attractive, for
She can even attract Ka. Therefore devotees call Her
Madana-mohana-mohinthe attractor of the attractor of Cupid.
To perform devotional service means to follow in the footsteps of
Rdhr, and devotees in Vndvana put themselves under the care of
Rdhr in order to achieve perfection in their devotional service. In other
words, devotional service is not an activity of the material world; it is directly
under the control of Rdhr. In Bhagavad-gt it is confirmed that the
mahtms, or great souls, are under the protection of daiv prakti, the internal
energyRdhr. So, being directly under the control of the internal
potency of Ka, devotional service attracts even Ka Himself.
This fact is corroborated by Ka in the Eleventh Canto of
rmad-Bhgnta, the practice of severe austerities or the giving of everything in
charity. These are, of course, very nice activities, but they are not as attractive
to Me as the transcendental loving service rendered by My devotees."
34
35
and decisions. Then another person, who may be a greater logician, will nullify
these conclusions and establish another thesis. In this way the path of
argument will never be safe or conclusive. rmad-Bhgavatam recommends,
therefore, that one follow in the footsteps of the authorities.
Here is a general description of devotional service given by r Rpa
Gosvm in his Bhakti-rasmta-sindhu. Previously, it has been stated that
devotional service can be divided into three categoriesnamely devotional
service in practice, devotional service in ecstasy and devotional service in pure
love of God. Now r Rpa Gosvm proposes to describe devotional service in
practice.
Practice means employing our senses in some particular type of work.
Therefore devotional service in practice means utilizing our different sensory
organs in service to Ka. Some of the senses are meant for acquiring
knowledge, Ka consciousness.
There are certain prescribed methods for employing our senses and mind in
such a way that our dormant consciousness for loving Ka will be invoked,
as much as the child, with a little practice, can begin to walk. One who has no
basic walking capacity cannot walk by practice. Similarly, Ka consciousness
cannot be aroused simply by practice. Actually there is no such practice.
37
When we wish to develop our innate capacity for devotional service, there are
certain processes which, by our accepting and executing them, will cause that
dormant capacity to be invoked. Such practice is called sdhana-bhakti.
Every living entity under the spell of material energy is held to be in an
abnormal condition of madness. In rmad-Bhgavatam it is said, "Generally,
the conditioned soul is mad, because he is always engaged in activities which
are the causes of bondage and suffering." Spirit soul in his original condition is
joyful, blissful, eternal and full of knowledge. Only by his implication in
material activities has he become miserable, temporary and full of ignorance.
This is due to vikarma. Vikarma means "actions which should not be done."
Therefore, we must practice sdhana-bhaktiwhich means to offer
magala-rat sdhana-bhakti cures the
conditioned soul of his madness under the spell of my, material illusion.
Nrada Muni mentions this sdhana-bhakti in rmad-Bhgavatam,
Seventh Canto, First Chapter, verse 32. He says there to King Yudhihira,
"My dear King, one has to fix his mind on Ka by any means." That is called
Ka consciousness. It is the duty of the crya, the spiritual master, to find
the ways and means for his disciple to fix his mind on Ka. That is the
beginning of sdhana-bhakti.
r Caitanya Mahprabhu has given us an authorized program for this
purpose, centered around the chanting of the Hare Ka mantra. This
chanting has so much power that it immediately attaches one to Ka. That
is the beginning of sdhana-bhakti. Somehow or other, one has to fix his mind
on Ka. The great saint Ambara Mahrja, although a responsible king,
fixed his mind on Ka, and similarly anyone who tries to fix his mind in this
way will very rapidly make progress in successfully reviving his original Ka
38
consciousness.
Now this sdh sdhana-bhakti is called rgnug.
Rgnug refers to the point at which, by following the regulative principles,
one becomes a little more attached to Ka and executes devotional service
out of natural love. For example, a person engaged in devotional service may
be ordered to rise early in the morning and offer rati, which is a form of Deity
worship. In the beginning, by the order of his spiritual master, one rises early
in the morning and offers rati,,
sdhana-bhakti, can be divided into two partsnamely, regulative and
spontaneous.
Rpa Gosvm rmad-Bhgavatam,
Second Canto, First Chapter, verse 5, where ukadeva Gosvm instructs the
dying Mahrja Parkit as to his course of action. Mahrja Parkit met
ukadeva Gosvm just a week before his death, and the King was perplexed as
to what should be done before he was to pass on. Many other sages also arrived
there, but no one could give him the proper direction. ukadeva Gosvm,
however, gave this direction to him as follows: "My dear King, if you want to
39
be fearless in meeting your death next week (for actually everyone is afraid at
the point of death), then you must immediately begin the process of hearing
and chanting and remembering God." If one can chant and hear Hare Ka
and always remember Lord Ka, then he is sure to become fearless of death,
which may come at any moment.
In the statements of ukadeva Gosvm it is said that the Supreme
Personality of Godhead is Ka. Therefore ukadeva recommends that one
should always hear about Ka. He does not recommend that one hear and
chant about the demigods. The Myvds (impersonalists) say that one may
chant any name, either that of Ka or those of the demigods, and the result
will be the same. But actually this is not a fact. According to the authorized
version of rmad-Bhgavatam, one has to hear and chant about Lord Viu
(Ka) only.
So ukadeva Gosvm has recommended to Parkit Mahrja that in order
to be fearless of death, one has to hear and chant and remember the Supreme
Personality of Godhead, Ka, by all means. He also mentions that the
Supreme Personality of Godhead is sarvtm. Sarvtm means "the Supersoul
of everyone." Ka is also mentioned as vara, the supreme controller who is
situated in everyone's heart. Therefore, if some way or other we become
attached to Ka, He will make us free from all danger. In Bhagavad-gt Kapa
Gosvm for reviving our original Ka consciousness is that somehow or
40
other we should apply our minds to Ka very seriously and thus also become
fearless of death. After death we do not know our destination, because we are
completely under the control of the laws of nature. Only Ka, the Supreme
Personality of Godhead, is controller over the laws of nature. Therefore, if we
take shelter of Ka seriously, there will be no fear of being thrown back into
the cycle of so many species of life. A sincere devotee will surely be transferred
to the abode of Ka, as affirmed in Bhagavad-gt.
In the Padma Pura, also, the same process is advised. There it is said that
one should always remember Lord Viu. This is called dhyna, or
meditationalways remembering Ka. It is said that one has to meditate
with his mind fixed upon Viu. Padma Pura recommends that one always
fix his mind on the form of Viu by meditation and not forget Him at any
moment. And this state of consciousness is called samdhi, or trance.
We should always try to mold the activities of our lives in such a way that
we will constantly remember Viu, or Ka. That is Ka consciousness.
Whether one concentrates his mind on the four-handed form of Viu or on
the form of two-handed Ka, it is the same. The Padma Pura recommends:
somehow or other always think of Viu, without forgetting Him under any
circumstances. Actually this is the most basic of all regulative principles. For,
when there is an order from a superior about doing something, there is
simultaneously a prohibition. When the order is that one should always
remember Ka, the prohibition is that one should never forget Him. Within
this simple order and prohibition, all regulative principles are found complete.
This regulative principle is applicable to all varas and ramas, the castes
and occupations of life. There are four varas, namely the brhmaas (priests
and intellectuals), the katriyas (warriors and statesmen), the vaiyas
(businessmen and farmers) and the dras (laborers and servants). There are
also four standard ramas, namely brahmacarya (student life), ghastha
(householder), vnaprastha (retired) and sannysa (renounced). The
regulative principles are not only for the brahmacrs (celibate students) to
follow, but are applicable for all. It doesn't matter whether one is a
41
proper condition, so that everyone will be happy and take profit from
developing Ka consciousness.
Lord r Ka
Ka consciousness, there is no doubt that all of its members will live very
peacefully and happily. Without wanting the necessities of life, the whole
world will be turned into Vaikuha, a spiritual abode. Even without being
transferred to the kingdom of God, by following the injunctions of
rmad-Bhgavatam and prosecuting the duties of Ka consciousness all
human society will be happy in all respects.
There is a similar statement by r Ka Himself to Uddhava, in the
Eleventh Canto of rmad-Bhgavatam, Twenty-seventh Chapter, verse 49.
The Lord says there, "My dear Uddhava, all persons are engaged in activities,
whether those indicated in the revealed scriptures or ordinary worldly
activities. If by the result of either of such activities they worship Me in Ka
consciousness, then automatically they become very happy within this world,
as well as in the next. Of this there is no doubt." We can conclude from this
statement by Ka that activities in Ka consciousness will give everyone
all perfection in all desires.
Thus the Ka consciousness movement is so nice that there is no need of
even designating oneself brhmaa, katriya, vaiya, dra, brahmacr,
ghastha, vnaprastha or sannys. Let everyone be engaged in whatever
occupation he now has. Simply let him worship Lord Ka by the result of his
activities in Ka consciousness. That will adjust the whole situation, and
everyone will be happy and peaceful within this world. In the
Nrada-pacartra the regulative principles of devotional service are
described as follows: "Any activities sanctioned in the revealed scriptures and
44
terms of those scriptures. He can very nicely present conclusions with perfect
discretion and can consider the ways of devotional service in a decisive way.
He understands perfectly that the ultimate goal of life is to attain to the
transcendental loving service of Ka, and he knows that Ka
Ka, but he may sometimes fail to offer arguments and decisions on the
strength of revealed scripture to an opposing party. But at the same time he is
still undaunted within himself as to his decision that Ka.
Further classification of the neophyte devotee is made in the Bhagavad-gt.
46
It is stated there that four classes of mennamely those who are distressed,
those who are in need of money, those who are inquisitive and those who are
wisebegin.
An example of the neophyte class is Mahrja Ka for protection, after which he became a pure
devotee. Similarly Sanaka, Santana, Sananda and Sanat-kumra were all in
the category of wise, saintly persons, and they were also attracted by
devotional service. A similar thing happened to the assemblage in the
Naimiraya Forest, headed by the sage aunaka. They were inquisitive and
were always asking Sta Gosvm about Ka..
These four types of devotees have been described in the Seventh Chapter
of Bhagavad-gt, and they have all been accepted as pious. Without becoming
pious, no one can come to devotional service. It is explained in Bhagavad-gt
that only one who has continually executed pious activities and whose sinful
reactions in life have completely stopped can take to Ka consciousness.
Others cannot. The neophyte devotees are classified into four groupsthe
distressed, those in need of money, the inquisitive and the wiseaccording to
their gradations of pious activities. Without pious activities, if a man is in a
47
service. rla Rpa Gosvm.
A pure devotee never cares for liberation. Lord Caitanya Mahprabhu
prayed to Ka, ., that the devotee does not care for
mukti. r Bilvamagala hkura has said, "If.
In this connection, in the Third Canto of rmad-Bhgavatam, Chapter
Twenty-five, verse 36, Kapiladeva has advised His mother, Devahti, among
My associates in the supreme abode."
50
You, and how can they be described as enjoying a happiness similar to the
devotees' happiness?" [VTE](6)
the earthly planet and his affection for his children, society, friends, royal
opulence and beautiful wife. He was so very lucky that the goddess of fortune
was pleased to offer him all kinds of material concessions, but he never
accepted any of these material opulences." ukadeva Gosvm praises this
behavior of King Bharata very highly. He says, "Any person whose heart is
attracted by the transcendental qualities of the Supreme Personality of
Godhead, Madhusdana, does not care even for that liberation which is
aspired to by many great sages, what to speak of material opulences."
In the Bhgavatam, Sixth Canto, Eleventh Chapter, verse 25, there is a
similar statement by Vtrsura, who addresses the Lord as follows: "My dear
Lord, by leaving Your transcendental service I may be promoted to the planet
called Dhruvaloka [the polestar], or I may gain lordship over all the planetary
systems of the universe. But I do not aspire to this. Nor do I wish the mystic
perfections of yoga practice, nor do I aspire to spiritual emancipation. All I
wish for, my Lord, is Your association and transcendental service eternally."
This statement is confirmed by Lord iva in rmad-Bhgavatam, Sixth
Canto, Seventeenth Chapter, verse 28, wherein Lord iva addresses Sat thus:
"My dear Sat, persons who are devoted to Nryaa [Ka] are not afraid of
anything. If they are elevated to the higher planetary systems, or if they get
liberation from material contamination, or if they are pushed down to the
hellish condition of lifeor, in fact, in any situation whateverthey are not
afraid of anything. Simply because they have taken shelter of the lotus feet of
Nryaa, for them any position in the material world is as good as another."
There is a similar statement by Indra, the King of heaven, in
rmad-Bhgavatam, Sixth Canto, Eighteenth Chapter, verse 74. There Indra
addresses mother Diti in this manner: "My dear mother, persons who have
given up all kinds of desire and are simply engaged in devotional service to the
Lord know what is actually their self-interest. Such persons are actually
serving their self-interests and are considered first-class experts in the matter
of advancing to the perfectional stage of life."
53
nga-patns say there, ."
There is a similar statement in the Tenth Canto, Eighty-seventh Chapter,
verse 21, wherein the rutis, the Vedas personified, pray to the Lord as follows:
"Dear Lord, it is very difficult to understand spiritual knowledge. Your
appearance here, just as You are, is to explain to us this most difficult subject
of knowledge of the spirit. As such, Your devotees who have left their
domestic comforts to associate with the liberated cryas [teachers] are now
fully merged in the devotional service of Your Lordship, and thus they do not
care for any so-called liberation.". It is confirmed in Bhagavad-gt that out of many millions of
persons, only one may try to understand what is spiritual knowledge, and out
of many such persons who are trying to understand, only one or a few may
know what is the Supreme Personality of Godhead. So this verse says that
spiritual knowledge is very difficult to achieve, and so in order to make it more
easily attainable, the Supreme Lord Himself comes in His original form as r
Ka
56
devotees can automatically give up material life and also enjoy the
transcendental bliss of hearing and chanting the wonderful activities of Lord
Ka.
In the Eleventh Canto of rmad-Bhgavatam, Twentieth Chapter, verse
34, Lord Ka says to Uddhava, "My dear Uddhava, the devotees who have
completely taken shelter of My service are so steadfast in devotional service
that they have no other desire. Even if they are offered the four kinds of
spiritual opulences,*(7) they will refuse to accept them. So what to speak of
their desiring anything within the material world!" Similarly, Lord Ka says
in another passage of the Bhgavatam, Eleventh Canto, Fourteenth Chapter,
verse 14, "My dear Uddhava, a person whose consciousness is completely
absorbed in My thought and activities does not aspire even to occupy the post
of Brahm, or the post of Indra, or the post of lordship over the planets, or the
eight kinds of mystic perfections, or even liberation itself." In the Twelfth
Canto of rmad-Bhgavatam, Tenth Chapter, verse 6, Lord iva says to Dev,
"My dear Dev, this great brhmaa sage Mrkaeya has attained unflinching
faith and devotion unto the Supreme Personality of Godhead, and as such he
does not aspire after any benedictions, including liberation from the material
world."
Similarly, there is a statement in Padma Pura describing the ritualistic
function during the month of Krttika (October-November). During this
month, in Vndvana it is the regulative principle to pray daily to Lord Ka
in His Dmodara form. The Dmodara form refers to Ka in His childhood
when He was tied up with rope by His mother, Yaod. Dma means "ropes,"
and udara means "the abdomen." So mother Yaod, being very disturbed by
naughty Ka, bound Him round the abdomen with a rope, and thus Ka is
named Dmodara. During the month of Krttika, Dmodara is prayed to as
follows: "My dear Lord, You are the Lord of all, the giver of all benedictions."
There are many demigods, like Lord Brahm and Lord iva, who sometimes
offer benedictions to their respective devotees. For example, Rvaa was
blessed with many benedictions by Lord iva, and Hirayakaipu was blessed
57
by Lord Brahm. But even Lord iva and Lord Brahm depend upon the
benedictions of Lord Ka, and therefore Ka is addressed as the Lord of all
benefactors. As such, Lord Ka can offer His devotees anything they want,
but still, the devotee's prayer continues, "I do not ask You for liberation or any
material facility up to the point of liberation. What I want as Your favor is
that I may always think of Your form in which I see You now, as Dmodara.
You are so beautiful and attractive that my mind does not want anything
besides this wonderful form." In this same prayer, there is another passage, in
which it is said, "My dear Lord Dmodara, once when You were playing as a
naughty boy in the house of Nanda Mahrja, You broke the box containing
yogurt, and because of that, mother Yaod considered You an offender and
tied You with rope to the household grinding mortar. At that time You
delivered two sons of Kuvera, Nalakvara and Maigrva, who were staying
there as two arjuna trees in the yard of Nanda Mahrja. My only request is
that by Your merciful pastimes You may similarly deliver me."
The story behind this verse is that the two sons of Kuvera (the treasurer of
the demigods) were puffed up on account of the opulence of their father, and
so once on a heavenly planet they were enjoying themselves in a lake with
some naked damsels of heaven. At that time the great saint Nrada Muni was
passing on the road and was sorry to see the behavior of the sons of Kuvera.
Seeing Nrada passing by, the damsels of heaven covered their bodies with
cloth, but the two sons, being drunkards, did not have this decency. Nrada
became angry with their behavior and cursed them thus: "You have no sense,
so it is better if you become trees instead of the sons of Kuvera." Upon hearing
this, the boys came to their senses and begged Nrada to be pardoned for their
offenses. Nrada then said, "Yes, you shall become trees, arjuna trees, and you
will stand in the courtyard of Nanda Mahrja. But Ka Himself will appear
in time as the foster son of Nanda, and He will deliver you." In other words,
the curse of Nrada was a benediction to the sons of Kuvera because indirectly
it was foretold that they would be able to receive the favor of Lord Ka.
After that, Kuvera's two sons stood as two big arjuna trees in the courtyard of
58
Nanda Mahrja until Lord Dmodara, in order to fulfill the desire of Nrada,
dragged the grinding mortar to which He was tied and struck the two trees,
violently causing them to fall down. From out of these fallen trees came
Nalakvara and Maigrva, who had by then become great devotees of the
Lord.
There is a passage in the Hayara-pacartra."
In the same Hayara-pacartra, after Nsihadeva wanted to give
benedictions to Prahlda Mahrja, Prahlda did not accept any material
benediction and simply asked the favor of the Lord to remain His eternal
devotee. In this connection, Prahlda Mahrja cited the example of
Hanumn, the eternal servitor of Lord Rmacandra, who also set an example
by never asking any material favor from the Lord. He always remained
engaged in the Lord's service. That is the ideal character of Hanumn, for
which he is still worshiped by all devotees. Prahlda Mahrja also offered his
respectful obeisances unto Hanumn. There is a well-known verse spoken by
Hanumn in which he says, "My."
In a similar passage in the Nrada-pacartra slokya (to reside
on Your planet) or srpya (to have the same bodily features as You). I simply
59
pray for Your favor that I may be always engaged in Your loving service."
Similarly, in the Sixth Canto, Fourteenth Chapter, verse 5, of
rmad-Bhgavatam, Mahrja Parkit inquires from ukadeva Gosvm, "My
dear brhmaa, I understand that the demon Vtrsura was a greatly sinful
person and that his mentality was completely absorbed in the modes of passion
and ignorance. How did he develop to such a perfectional stage of devotional
service to Nryaa?trsura
became such a devotee!"
In the above verse, the most important thing to be noted is that there may
be many liberated persons who have merged into the existence of the
impersonal Brahman, but a devotee of the Supreme Personality of Godhead,
Nryaa, is very, very rare. Even out of millions of liberated persons, only
one is fortunate enough to become a devotee.
In rmad-Bhgavatam, First Canto, Eighth Chapter, verse 20, Queen
Kunt is praying to Lord Ka at the time of His departure, "My dear Ka,
You are so great that You are inconceivable even to great stalwart scholars and
paramahas in her humbleness. Although she was a woman and was
considered less intelligent than a man, still she realized the glories of Ka.
That is the purport of this verse.
Another passage which is very important is in rmad-Bhgavatam, First
Canto, Seventh Chapter, verse 10, and is called "the tmrma verse." In this
60
tmrma verse it is stated that even those who are completely liberated from
material contamination are attracted by the transcendental qualities of Lord
Ka.*(8) tmrmas be attracted by such pastimes? That is
the important point in this verse. Ka and be promoted
to the Goloka Vndvana planet in the spiritual sky. In other words, those
who are already promoted to the Vaikuha planets and who possess the four
kinds of liberation may also sometimes develop affection for Ka and
become promoted to Kaloka.
So those who are in the four liberated states may still be going through
different stages of existence. In the beginning they may want the opulences of
Ka, but at the mature stage the dormant love for Ka exhibited in
Vndvana becomes prominent in their hearts. As such, the pure devotees
never accept the liberation of syujya, to become one with the Supreme,
though sometimes they may accept as favorable the other four liberated states.
Out of many kinds of devotees of the Supreme Personality of Godhead, the
one who is attracted to the original form of the Lord, Ka in Vndvana, is
61
from the principles of devotional service, he need not take to the pryacitta
performances for reformation. He simply has to execute the rules and
regulations for discharging devotional service, and this is sufficient for his
reinstatement. This is the mystery of the Vaiava (devotional) cult.
Practically there are three processes for elevating one to the platform of
spiritual consciousness. These processes are called karma, jna and bhakti.
Ritualistic performances are in the field of karma. Speculative processes are in
the field of jna. One who has taken to bhakti, the devotional service of the
Lord, need have nothing to do with karma or jna. It has been already
explained that pure devotional service is without any tinge of karma or jna.
Bhakti should have no tinge of philosophical speculation or ritualistic
performances.
In this connection rla Rpa Gosvm gives evidence from
rmad-Bhgavatam, Eleventh Canto, Twenty-first Chapter, verse 2, in which
Lord Ka
cryas, that is the best qualification."
This statement is supported in rmad-Bhgavatam, First Canto, Fifth
Chapter, verse 17, wherein r Nrada Muni advises Vysadeva thus: "Even if
one does not execute his specific occupational duty, but immediately takes
direct shelter of the lotus feet of Hari [Ka],a and rama, however, with no Ka consciousness, practically does not
gain the true benefit of human life." The purport is that all conditioned souls
who are engaged very frantically in activities for sense gratification, without
65
knowing that this process will never help them get out of material
contamination, are awarded only with repeated births and deaths.
In the Fifth Canto of rmad-Bhgavatam it is clearly stated by abhadeva
to His sons, "Persons engaged in fruitive activities are repeatedly accepting
birth and death, and until they develop a loving feeling for Vsudeva, there
will be no question of getting out from these stringent laws of material nature."
As such, any person who is very seriously engaged in his occupational duties in
the varas and ramas, and who does not develop love for the Supreme
Personality of Godhead, Vsudeva, should be understood to be simply spoiling
his human form of life.
This is confirmed also in the Eleventh Canto of rmad-Bhg
rmad-Bhgavatam and other authentic Vedic scriptures we learn further
that if a person simply acts in Ka consciousness and discharges devotional
service, he is considered to be far, far better situated than all of those persons
engaged in philanthropic, ethical, moral, altruistic and social welfare
activities.
The same thing is still more emphatically confirmed in rmad-Bhgavatam,
Eleventh Canto, Fifth Chapter, verse 41, in which Karabhjana Muni
addresses Mahrja Nimi as follows: "My dear King, if someone gives up his
occupational duties as they are prescribed for the different varas and
ram
66
to bother executing the five kinds of yajs ysadeva.
Vysadeva has left for us all the Vedas. Before Vysadeva's writing, the Vedic
literature was simply heard, and the disciples would learn the mantras quickly
by hearing and not by reading. Later on, Vysas, Vednta,
Mahbhrata and rmad-Bhgavatam.
There are many other sages, like akarcrya, Gautama Muni and Nria
(prasda)t
67 Ka in Bhagavad-gt.
There is additional evidence in the Agastya-sahit: "As the regulative
principles of scripture are not required by a liberated person, so the ritualistic
principles indicated in the Vedic supplements are also not required for a
person duly engaged in the service of Lord Rmacandra." In other words, the
devotees of Lord Rmacandra, or Ka, are already liberated persons and are
not required to follow all the regulative principles mentioned in the ritualistic
portions of the Vedic literature.
Similarly, in the Eleventh Canto of rmad-Bhgavatam, Fifth Chapter,
verse 42, Karabhjt in many places that the
Supreme Personality of Godhead, Ka, takes a special interest in His
devotees and declares emphatically that nothing can cause His devotees to fall
down. He is always protecting them. [VTE](11)
compiled Hari-bhakti-vilsa for the guidance of the Vaiavas and therein has
mentioned many rules and regulations to be followed by the Vaiavas. Some
of them are very important and prominent, and rla Rpa Gosvm will now
mention these very important items for our benefit. The purport of this
statement is that rla Rpa Gosvm. rla Rpa Gosvm cryas (teachers) under the direction of
the spiritual master, (5) inquiring from the spiritual master how to advance in
Ka consciousness, (6) being prepared to give up anything material for the
satisfaction of the Supreme Personality of Godhead, r Ka (this means
that when we are engaged in the devotional service of Ka, we must be
prepared to give up something which we may not like to give up, and also we
have to accept something which we may not like to accept), (7) residing in a
sacred place of pilgrimage like Dvrak or Vndvana, (8) accepting only what
is necessary, or dealing with the material world only as far as necessary, (9)
observing the fasting day on Ekda
69
(7) When the Deity is being borne for a stroll in the street, a devotee should
immediately follow the procession. (In this connection it may be noted that in
India, especially in Viuda. Viu temple at least once or
twice every day, morning and evening. (In Vndvana this system is followed
very strictly. All the devotees in town go every morning and evening to visit
different temples. Therefore during these times there are considerable crowds
all over the city. There are about five thousand temples in Vndvana city. Of
course it is not possible to visit all the temples, but there are at least one dozen
very big and important temples which were started by the Gosvms and
which should be visited.) (9) One must circumambulate the temple building at
least three times. (In every temple there is an arrangement to go around the
temple at least three times. Some devotees go around more than three
timesten times, fifteen timesaccording to their vows. The Gosvms used
to circumambulate Govardhana Hill.) One should also circumambulate the
whole Vndvana area. (10) One must worship the Deity in the temple
according to the regulative principles. (Offering rati and prasda, decorating
71
the Deity, etc.these things must be observed regularly.) (11) One must
render personal service to the Deities. (12) One must sing. (13) One must
perform sakrtana. (14) One must chant. (15) One must offer prayers. (16)
One must recite notable prayers. (17) One must taste mah-prasda (food from
the very plate offered before the Deities). (18) One must drink caram rati (rtrika) at different times. (23) One must hear
about the Lord and His pastimes from rmad-Bhgavatam, Bhagavad-gt Ka's benefit. (32) In every
condition, one should be a surrendered soul. (33) One should pour water on
the tulas tree. (34) One should regularly hear rmad-Bhgavatam and similar
literature. (35) One should live in a sacred place like Mathur, Vndvana or
Dvrak. (36) One should offer service to Vaiavas (devotees). (37) One
should arrange one's devotional service according to one's means. (38) In the
month of Krttika (October and November), one should make arrangements
for special services. (39) During Janmam (the time of Ka's appearance
in this world) one should observe a special service. (40) One should do
whatever is done with great care and devotion for the Deity. (41) One should
relish the pleasure of Bhgavatam reading among devotees and not among
outsiders. (42) One should associate with devotees who are considered more
advanced. (43) One should chant the holy name of the Lord. (44) One should
live in the jurisdiction of Mathur.
Now, the total regulative principles come to an aggregate of sixty-four
items. As we have mentioned, the first are the primary ten regulative
72
principles. Then come the secondary ten regulative principles, and added to
these are forty-four other activities. So all together there are sixty-four items
for discharging the regulative practice of devotional service. Out of these
sixty-four items, five itemsnamely worshiping the Deity, hearing
rmad-Bhgavatam, associating among the devotees, sakrtana, and living in
Mathurare, rla Rpa Gosvm will give evidence
from different scriptures supporting the authenticity of many of these points.
[VTE](12).
master. Then it will be very easy for him to understand spiritual knowledge.
This is confirmed in the Vedas, and Rpa Gosvm will further explain that
for a person who has unflinching faith in God and the spiritual master,
everything becomes revealed very easily.
false interpretation of the Vedas. Also, for the atheists Lord Buddha preached
atheism so that they would follow him and thus be tricked into devotional
service to Lord Buddha, or Ka.
as follows: "The waters of the Ganges are always carrying the flavor of tulas
offered at the lotus feet of r Ka, and as such the waters of the Ganges are
ever flowing, spreading the glories of Lord Ka. Wherever the waters of the
Ganges are flowing, all will be sanctified, both externally and internally."
time in the service of the Lord by chanting or performing similar service. The
best thing to do on fasting days is to remember the pastimes of Govinda and to
hear His holy name constantly.
Nectar of Devotion, that will give him sufficient knowledge to understand the
science of Ka consciousness. One need not take the trouble of reading
other books.
In the Seventh Canto of rmad-Bhgavatam, Thirteenth Chapter, verse 8,
Nrada Muni, while discussing with Mahrja Yudhihira the various
functions of the different orders in society, especially mentions rules for the
sannyss, those persons who have renounced this material world. One who
has accepted the sannysa order of life is forbidden to accept as a disciple
anyone who is not fit. A sannys should first of all examine whether a
prospective student is sincerely seeking Ka consciousness. If he is not, he
should not be accepted. However, Lord Caitanya's causeless mercy is such that
He advised all bona fide spiritual masters to speak about Ka consciousness
everywhere. Therefore, in the line of Lord Caitanya even the sannyss can
speak about Ka consciousness everywhere, and if someone is seriously
inclined to become a disciple, the sannys always accepts him.
The one point is that without increasing the number of disciples, there is
no propagation of the cult of Ka consciousness. Therefore, sometimes even
at a risk, a sannys in the line of Caitanya Mahprab Ka
consciousness.
Similarly, a bona fide spiritual master has no business reading many books
simply to show his proficiency or to get popularity by lecturing in different
places. One should avoid all these things. It is also stated that a sannys
should not be enthusiastic about constructing temples. We can see in the lives
of various cryas in the line of r Caitanya Mahprabhu that they are not
very enthusiastic about constructing temples. However, if somebody comes
forward to offer some service, the same reluctant cryas will encourage the
building of costly temples by such servitors. For example, Rpa Gosvm was
81
material loss, but, rather, should concentrate his mind upon the lotus feet of
the Lord.
A devotee should not be subjected to lamentation or illusion. There is the
following statement in the Padma Pura: "Within the heart of a person who
is overpowered by lamentation or anger, there is no possibility of Ka's being
manifested."
The Demigods
One should not neglect to offer due respect to the demigods. One may not
be a devotee of demigods, but that does not mean that he should be
disrespectful to them. For example, a Vaiava is not a devotee of Lord iva or
Lord Brahm, but he is duty-bound to offer all respects to such highly
positioned demigods. According to Vaiava philosophy, one should offer
respect even to an ant, so then what is there to speak of such exalted persons
as Lord iva and Lord Brahm?
In the Padma Pura it is said, "Ka, or Hari, is the master of all
demigods, and therefore He is always worshipable. But this does not mean that
one should not offer respect to the demigods."
8. Offenses to Be Avoided
In the supplementary Vedic literature, there is the following list of
thirty-twomam and Ratha-ytr. (3)
One should not avoid bowing down before the Deity. (4) One should not
enter the temple to worship the Lord without having washed one's hands and
feet after eating. (5) One should not enter the temple in a contaminated state.
(According to Vedic scripture, if someone dies in the family the whole family
becomes contaminated for some time, according to its status. For example, if
the family is brhmaa their contamination period is twelve days, for the
katriyas and vaiyas it is fifteen days, and for dras thirty days.) (6) One
should not bow down on one hand. (7) One should not circumambulate in
front of r Ka. one's hands. (10) One should not lie down before the
Deity of Ka. (11) One should not accept prasda
84 one's means. (In Bhagavad-gt it is stated
that the Lord is satisfied if some devotee offers Him even and nice foodstuffs and observe all
ceremonies. It is not that one should try to satisfy the Supreme Lord with a
little water and a leaf, and for himself spend all his money in sense
gratification.) (25) One should not eat anything which is not offered first to
Ka. (26) One should not fail to offer fresh fruit and grains to Ka,
according to the season. (27) After food has been cooked, no one should be
offered any foodstuff unless it is first offered to the Deity. (28) One should not
sit with his back toward thirty-two offenses. Besides these, there are a number of
offenses which are mentioned in the Varha Pura. silence while worshiping. (6)
One should not pass urine or evacuate while engaged in worshiping. (7) One
85 garmentsaj. one has completed taking bath.
(28) One should not decorate his forehead with the three-lined tilaka. (29)
One should not enter the temple without washing his hands and feet.
Other rules are that one should not offer foodstuff which is cooked by a
non-Vaiava, one should not worship the Deity before a nondevotee, and
one should not engage himself in the worship of the Lord while seeing a
nondevotee. One should begin the worship of the demigod Gaapati, who
drives away all impediments in the execution of devotional service. In the
Brahma-sahit it is stated that Gaapati worships the lotus feet of Lord
Nsihadeva and in that way has become auspicious for the devotees in
clearing out all impediments. Therefore, all devotees should worship Gaapati.
The Deities should not be bathed in water which has been touched by the
86
kinds of sinful reaction, one may continue to act sinfully and after that chant
Hare Ka to neutralize his sins. Such a dangerous mentality is very offensive
and should be avoided.) (8) To consider the chanting of Hare Ka one of
the auspicious ritualistic activities offered in the Vedas as fruitive activities
(karma-ka). (9) not to instruct them in this
matter.) (10) To not have complete faith in the chanting of the holy names
and to maintain material attachments, even after understanding so many
instructions on this matter.
Every devotee who claims to be a Vaiava must guard against these
offenses in order to quickly achieve the desired success. [VTE](14)
Blasphemy
One should not tolerate blasphemy of the Lord or His devotees. In this
connection, in the Tenth Canto, Seventy-fourth Chapter, verse 40, of
rmad-Bhgavatam, ukadeva Gosvm tells Parkit Mahrja, "My dear
King, if a person, after hearing blasphemous propaganda against the Lord and
His devotees, does not go away from that place, he becomes bereft of the effect
of all pious activities."
In one of Lord Caitanya's ikaka verses it is stated, "The devotee should
88 r Nitynanda, He
immediately ran to the spot and wanted to kill the offenders, Jagi and
Mdhi. This behavior of Lord Caitanya's is very significant. It shows that a
Vaiava may be very tolerant and meek, foregoing everything for his personal
honor, but when it is a question of the honor of Ka or His devotee, he will
not tolerate any insult. follow any of the above-mentioned three processes, he falls
down from his position of devotion.
bodies all over with the holy names of the Lord, and on whose necks and
breasts there are tulas beads, are never approached by the Yamadtas." The
Yamadtas are the constables of King Yama (the lord of death), who punishes
all sinful men. Vaiavas are never called for by such constables of Yamarja.
In the rmad-Bhgavatam, in the narration of Ajmila's deliverance, it is said
that Yamarja gave clear instructions to his assistants not to approach the
Vaiavas. Vaiavas are beyond the jurisdiction of Yamarja's activities.
The Padma Pura also mentions, "A person whose body is decorated with
the pulp of sandalwood, with paintings of the holy name of the Lord, is
delivered from all sinful reactions, and after his death he goes directly to
Kaloka to live in association with the Supreme Personality of Godhead."
In the Brahma Pura it is said, "A person who sees the Lord's
Ratha-ytr car festival and then stands up to receive the Lord can purge all
kinds of sinful results from his body."
92
Arcan
Arcan means worship of the Deity in the temple. By executing this process
one confirms himself to be not the body but spirit soul. In the Tenth Canto,
Eighty-first Chapter, verse 19, of rmad-Bhgavatam, it is told how Sudm,
an intimate friend of Ka's, while going to the house of a brhmaa,
murmured to himself, "Simply by worshiping Ka one can easily achieve all
the results of heavenly opulence, liberation, supremacy over the planetary
systems of the universe, all the opulences of this material world, and the
mystic power of performing the yoga system.
93
Singing
In the Liga Pura there is a statement about glorifying and singing about
the Lord. It is said there, "A brhmaa who is constantly engaged in singing
the glories of the Lord is surely elevated to the same planet as the Supreme
Personality of Godhead. Lord Ka appreciates this singing even more than
the prayers offered by Lord iva."
Sakrtana
When a person loudly chants the glories of the Lord's activities, qualities,
form, etc., his chanting is called sakrtana. Sakrtana also refers to the
congregational chanting of the holy name of the Lord.
95
and chant the glories of the Lord." It is indicated here that chanting about and
glorifying the Lord is the ultimate activity of the living entity.
Japa
Chanting a mantra or hymn softly and slowly is called japa, and chanting
the same mantra loudly is called krtana. For example, uttering the
mah-mantra (Hare Ka, Hare Ka, Ka Ka, Hare Hare/ Hare Rma,
Hare Rma, Rma Rma, Hare Hare) very softly, only for one's own hearing, is
called japa. Chanting the same mantra loudly for being heard by all others is
called krtana. The mah-mantra can be used for japa and krtana also. When
japa is practiced it is for the personal benefit of the chanter, but when krtana
is performed it is for the benefit of all others who may hear.
In the Padma Pura there is a statement: "For any person who is chanting
the holy name either softly or loudly, the paths to liberation and even
heavenly happiness are at once open."
Submission
In the Skanda Pura there is a statement about submission unto the lotus
feet of the Lord. It is said there that those who are sober devotees can offer
their submission to Ka in the following three ways: (1) samprrthantmik,
very feelingly offering prayers; (2) dainyavodhik, humbly submitting oneself;
(3) llasmay, desiring some perfectional stage. Ka. That
is called llasmay, or very eagerly desiring to go to one's natural position.
This llasmay stage of submission comes in the stage of perfect liberation,
which is technically called svarpa-siddhi(15), when the living entity
97asmta-sindhu.
In the Nrada-pacartra.akm, the goddess of fortune. He also wishes that the
Personality of Godhead will be pleased to give him directions as to how to fan.
This submission with transcendental desire, or llasmay vijapti, is the
highest perfectional stage of spiritual realization.
In the same Nrada-pacartra, there is another expression of submission,
wherein the devotee says, "My dear Lord, O lotus-eyed one, when will that day
come when on the bank of the Yamun.
99 llasmay, or desire and
great eagerness.
Partaking of Prasda
There is this specific statement in the Padma Pura: "A person who
honors the prasda and regularly eats it, not exactly in front of the Deity,
along with caramta [the water offered to the lotus feet of the Lord, which is
mixed with seeds of the tulas tree], immediately can achieve the results of
pious activities which are obtained through ten thousand performances of
sacrificial rites."
Drinking Caramta
Caramta is obtained in the morning while the Lord is being washed
before dressing. Scented with perfumes and flowers, the water comes gliding
down through His lotus feet and is collected and mixed with yogurt. In this
way this caramta not only becomes very tastefully flavored, but also has
tremendous spiritual value. As described in the Padma Pura, even a person
who has never been able to give in charity, who has never been able to
perform a great sacrifice, who has never been able to study the Vedas, who has
never been able to worship the Lordor, in other words, even one who has
never done any pious activitieswill become eligible to enter into the
kingdom of God if he simply drinks the caramta which is kept in the
temple. In the temple it is the custom that the caramta be kept in a big pot.
The devotees who come to visit and offer respects to the Deity take three
drops of caramta very submissively and feel themselves happy in
transcendentalwhatever is
possiblemust-stra,
Myvd [impersonalist] to devotee." There are several instances of this, a
prime one being the advancement of the four Kumras. They were
impersonalist Myvds, but after smelling the remnants of flowers and
incense in the temple, they turned to become devotees. From the above verse
it appears that the Myvds, or impersonalists, are more or less
102
delay.
Hearing
The beginning of Ka consciousness and devotional service is hearing, in
Sanskrit called ravaam. All people should be given the chance to come and
join devotional parties so that they may hear. This hearing is very important
for progressing in Ka Ka
consciousness.
In the Garua Pura
105
again in this material world. A devotee who is not perfectly freed from the
resultant actions should therefore continue to act in Ka consciousness
seriously, even though there may be so many impediments. When such
impediments arise he should simply think of Ka dya-bhk. Dya-bhk refers to a son's becoming the lawful inheritor of
the property of the father. In a similar way, a pure devotee who is prepared to
undergo all kinds of tribulations in executing Ka conscious duties becomes
lawfully qualified to enter into the transcendental abode.
Remembrance
Some way or other, if someone establishes in his mind his continuous
relationship with Ka, this relationship is called remembrance. About this
remembrance there is a nice statement in the Viu Pura, where it is said,
"Simply by remembering the Supreme Personality of Godhead all living
entities become eligible for all kinds of auspiciousness. Therefore let me always
remember the Lord, who is unborn and eternal." In the Padma Pura the
same remembrance is explained as follows: "Let me offer my respectful
obeisances unto the Supreme Lord Ka,iu.
108
activities physically, he can meditate upon the Vaiava activities and thereby
acquire all of the same results. Because the brhmaa was not very well-to-do
financially, he decided that he would simply meditate on grand, royal
devotional activities, and he began this business thus:
Sometimes he would take his bath in the River Godvar. After taking his
bath he would sit in a secluded place on the bank of the river, and by
practicing the yoga exercises of pryma, brhmavar, but he collected from the Ganges,
Yamun, Narmad and Kver. Generally a Vaiava, while worshiping the
Lord, collects water from all these rivers by mantra chanting. This brhmaa,
instead of chanting some mantra, imagined that he was physically securing
water from all these rivers in golden and silver waterpots. Then he collected
all kinds of paraphernalia for worshipflowers, fruits, incense and
sandalwood pulp. He collected everything to place before the Deity. All these
waters, flowers and scented articles were then very nicely offered to the
Deities to Their satisfaction. Then he offered rati, and with the regulative
principles he finished all these activities in the correct worshiping method.
He would daily execute similar performances as his routine work, and he
continued to do so for many, many years. Then one day the brhmaa
110 brhmaikuha Lord Nryaa, seated with
the goddess of fortune, Lakm, began to smile humorously. On seeing this
smiling of the Lord, all the goddesses of fortune attending the Lord became
very curious and asked Lord Nryaa why He was smiling. The Lord,
however, did not reply to their inquisitiveness, but instead immediately sent
for the brhmaa. An airplane sent from Vaikuha immediately brought the
brhmaa into Lord Nryaa's presence. When the brhmaa was thus
present before the Lord and the goddesses of fortune, the Lord explained the
whole story. The brhmaa was then fortunate enough to get an eternal place
in Vaikuha in the association of the Lord and His Lakms. This shows how
the Lord is all-pervading, in spite of His being locally situated in His abode.
Although the Lord was present in Vaikuha, He was present also in the heart
of the brhmaa when he was meditating on the worshiping process. Thus, we
can understand that things offered by the devotees even in meditation are
accepted by the Lord, and they help one achieve the desired result. [VTE](17)
111
Servitorship
In the opinion of the karms (fruitive workers), offering the results of
karma is called servitorship. But according to Vaiava cryas like Rpa
Gosvm, servitorship means constant engagement in some kind of service to
the Lord.
In the Skanda Pura it is said that those who are attached to ritualistic
activities, the four orders of social life and the four orders of spiritual life, are
considered devotees. But when devotees are actually engaged in offering
service to the Lord directly, these must be bhgrama and the prescribed
duties under this system are so designed that the conditioned soul may enjoy
in the material world according to his desire for sense gratification and at the
same time gradually become elevated to spiritual understanding. Under these
prescribed duties of vara and rama there are many activities which belong
to devotional service in Ka consciousness. Those devotees who are
householders accept Vedic ritualistic performances as well as the prescribed
duties of devotional service, because both are meant for satisfying Ka.
112
therefore in all kinds of tribulations I simply remember Your promise, and thus
I live." The purport is that Draupad and her five husbands, the Pavas,
were put into severe tribulations by their cousin-brother Duryodhana, as well
as by others. The tribulations were so severe that even Bhmadeva, who was
both a lifelong brahmacr and a great warrior, would sometimes shed tears
thinking of them. He was always surprised that although the Pavas were so
righteous and Draupad was practically the goddess of fortune, and although
Ka was their friend, still they had to undergo such severe tribulations.
Though their tribulations were not ordinary, Draupad was not discouraged.
She knew that because Ka was their friend, ultimately they would be saved.
A similar statement is there in the Eleventh Canto of rmad-Bhgavatam,
Second Chapter, verse 53, where Havi, the son of King abha, addresses
Mahrja."
r Rpa Gosvmgnug, or spontaneous. Although, according
to regulative principles, no one can lie down in the temple of the Supreme
Personality of Godhead, this spontaneous love of Godhead may be grouped
under devotional service in friendship.
114.
rla Rpa Gosvm.
Residing in Mathur
In the Varha Pura there is a statement praising the residential quarters
of Mathur. Lord Varha tells the men of earth, "Any person who becomes
attracted to places other than Mathur will certainly be captivated by the
illusory energy." In the Brahma Pura it is said that all the results of
traveling on all the pilgrimages within the three worlds can be achieved simply
by touching the holy land of Mathur. In many stras (scriptures) it is said
that simply by hearing, remembering, glorifying, desiring, seeing or touching
the land of Mathur, one can achieve all desires.
120
knowledge are sincere and bona fide, there will be good results.
Living in Mathur
In the Padma Pura there is a statement about the importance of living at
holy places like Mathur or Dvrak.hta [SB 4.30.20] [liberation]
stage, one can further advance to engagement in devotional service. So this
attainment of transcendental loving devotional service to the Lord is the goal
of life, and it can be achieved very easily for one who lives in
Mathur-maala even for a few seconds."
It is further said, "Who is that person who will not agree to worship the
126
land of Mathur? Mathur can deliver all the desires and ambitions of the
fruitive workers and of the salvationists, who desire to become one with the
Supreme Brahman. Certainly Mathur will deliver the desires of the devotees,
who simply aspire to be engaged in the devotional service of the Lord." In the
Vedic literature it is also stated, "How wonderful it is that simply by residing in
Mathur even for one day, one can achieve a transcendental loving attitude
toward the Supreme Personality of Godhead! This land of Mathur must be
more glorious than Vaikuha-dhma, the kingdom of God!" [VTE](19)
process of worshiping along with all of his family members. This will save
everyone from such unwanted activities as going to clubs, cinemas and
dancing parties, and smoking, drinking, etc. All such nonsense will be
forgotten if one stresses the worship of the Deities at home.
Rpa Gosvm further writes, "My dear foolish friend, I think that you have
already heard some of the auspicious rmad-Bhgavatam, which decries
seeking the results of fruitive activities, economic development and liberation.
I think that now it is certain that gradually the verses of the Tenth Canto of
rmad-Bhgavatam, describing the pastimes of the Lord, will enter your ears
and go into your heart."
In the beginning of rmad-Bhgavatam it is said that unless one has the
ability to throw out, just like garbage, the fruitive results of ritualistic
ceremonies, economic development and becoming one with the Supreme (or
salvation), one cannot understand rmad-Bhgavatam. The Bhgavatam deals
exclusively with devotional service. Only one who studies rmad-Bhgavatam
in the spirit of renunciation can understand the pastimes of the Lord which
are described in the Tenth Canto. In other words, one should not try to
understand the topics of the Tenth Canto, such as the rsa-ll (love dance),
unless he has spontaneous attraction for rmad-Bhgavatam. One must be
situated in pure devotional service before he can relish rmad-Bhgavatam as
it is.
In the above two verses of Rpa Gosvm there are some metaphorical
analogies that indirectly condemn the association of materialistic society,
friendship and love. People are generally attracted to society, friendship and
love, and they make elaborate arrangements and strong endeavors to develop
these material contaminations. But to see the r-mrtis of Rdh and Ka is
to forget such endeavors for material association. Rpa Gosvm composed his
verse in such a way that he was seemingly praising the material association of
friendship and love and was condemning the audience of r-mrti or
Govinda. This metaphorical analogy is constructed in such a way that things
which seem to be praised are condemned, and things which are to be
128
condemned are praised. The actual import of the verse is that one must see the
form of Govinda if one at all wants to forget the nonsense of material
friendship, love and society.
rla Rpa Gosvm has similarly described the transcendental nature of
relishing topics which concern Ka.,
one must be anxious immediately to hear about Ka, to learn about Ka,
or, in other words, to become fully Ka conscious.
Similarly, there is a statement about hearing and chanting the
mah-mantra: "It is said that saints have been able to hear the vibrating strings
of the v in the hands of Nrada, who is always singing the glories of Lord
Ka. Now this same sound vibration has entered my ears, and I am always
feeling the presence of the Supreme Personality. Gradually I am becoming
bereft of all attachment for material enjoyment."
Again, rla Rpa Gosvm has described Mathur-maala: "I remember
the Lord standing by the banks of the Yamun River, so beautiful amid the
kadamba trees, where many birds are chirping in the gardens. And these
impressions are always giving me transcendental realization of beauty and
bliss." This feeling about Mathur-maala and Vndvana described by Rpa
Gosvm can actually be felt even by nondevotees. The places in the
eighty-four-square-mile district of Mathur are so beautifully situated on the
banks of the River Yamun that anyone who goes there will never want to
return to this material world. These statements by Rpa Gosvm are factually
realized descriptions of Mathur and Vndvana. All these qualities prove that
Mathur and Vndvana are situated transcendentally. Otherwise, there
would be no possibility of invoking our transcendental sentiments in these
places. Such transcendental feelings are aroused immediately and without fail
129
r Rpa Gosvm affirms herein that there are nine different kinds of
devotional service, which are listed as hearing, chanting, remembering,
serving, worshiping the Deity in the temple, praying, carrying out orders,
serving Kam Parkit achieved the desired goal of
life simply by hearing rmad-Bhgavatam. ukadeva Gosvm achieved the
desired goal of life simply by reciting rmad-Bhgavatam. Prahlda Mahrja
became successful in his devotional service by always remembering the Lord.
Lakm, the goddess of fortune, was successful by engaging herself in
massaging the lotus feet of the Lord. King Pthu became successful by
worshiping in the temple. Akrra became successful by offering prayers.
Hanumn became successful by rendering personal service to Lord
Rmacandra. Arjuna became successful by being a friend of Ka. And Bali
Mahrja became successful simply by offering all of his possessions to Ka.
There are also examples of devotees who discharged all the different items
together. In the Ninth Canto, Fourth Chapter, verses 18, 19 and 20, of
rmad-Bhgavatam, there is a statement about Mahrja Ambara, who
followed every one of the devotional processes. In these verses, ukadeva
Gosvm says, "King Ambara first of all concentrated his mind on the lotus
feet of Lord Ka and then engaged his speech in describing the pastimes and
activities of the Lord. He engaged his hands in washing the temple of the
Lord. He engaged his ears in hearing of the transcendental glories of the Lord.
136ara
Mahrja made his association only with pure devotees and did not allow his
body to be touched by anyone else.] He engaged his nostrils in smelling the
flowers and tulas offered to Ka, and he engaged his tongue in tasting Ka
prasda [food prepared specifically for offering to the Lord, the remnants of
which are taken by the devotees]. Mahrja Ambara was able to offer very
nice prasda to Ka because he was a king and had no scarcity of finances.
He used to offer Ka the most royal dishes and would then taste the
remnants as ka-prasda. There was no scarcity in his royal style, because he
had a very beautiful temple wherein the Deity of the Lord was decorated with
costly paraphernalia and offered high-grade food. So everything was available,
and his engagement was always completely in Ka consciousness." The idea
is that we should follow in the footsteps of great devotees. If we are unable to
execute all the different items of devotional service, we must try to execute at
least one of them, as exemplified by previous cryas. If we are engaged in the
execution of all the items of devotional service, as was Mahrja Ambara,
then the perfection of devotional service is guaranteed from each one of these
items. With the first complete engagement, one becomes automatically
detached from material contamination, and liberation becomes the
maidservant of the devotee. This idea is confirmed by Bilvamagala hkura.
If one develops unalloyed devotion to the Lord, liberation will follow the
devotee as his maidservant.
rla Rpa Gosvm says that the regulative principles of devotional service
are sometimes described by authorities as the path of serving the Lord in
opulence. [VTE](21)
137
Truth, devotees like Kasa or iupla could attain only to the Brahman
effulgence. They could not have realization of Paramtm or Bhagavn.asa and iupla attained to
the Absolute Truth, but they were not allowed to enter into the Goloka
Vndvana abode. Impersonalists and the enemies of the Lord are, because of
attraction to God, allowed to enter into His kingdom, but they are not allowed
to enter into the Vaikuha planets or the Goloka Vndvana planet of the
Supreme Lord. To enter the kingdom and to enter the king's palace are not
the same thing.
rla Rpa Gosvm. r Caitanya Mahprabhu has proclaimed the impersonalists to be
offenders of the Lord. The Lord is so kind, however, that even though they are
His enemies, they are still allowed to enter into the spiritual kingdom and
140
who are in love with the Supreme Person enter into the supreme abode of the
Lord, Goloka Vndvana.
The "lusty attitude" of the gops does not refer to any sort of sex indulgence.
rla Rpa Gosvm explains that this "lusty desire" refers to the devotee's
particular attitude of association with Ka.ops. The gops'
love for Ka is so elevated that for our understanding it is sometimes
explained as being "lusty desire."
The author of r Caitanya-caritmta, Kavirja Kadsa,ops, however, wanted nothing at all
but to gratify the senses of the Lord, and there is no instance of this in the
material world. Therefore the gops' ecstatic love for Ka is sometimes
142ops. So the gops' love
for Ka is certainly not material lusty desire. Otherwise, how could Uddhava
aspire to follow in their footsteps? Another instance is Lord Caitanya Himself.
After accepting the sannysa order of life, He was very, very strict about
avoiding association with women, but still He taught that there is no better
method of worshiping Ka than that conceived by the gops. Thus the gops'
method of worshiping the Lord as if impelled by lusty desire was praised very
highly even by r Caitanya Mahprabhu. This very fact means that although
the attraction of the gops for Ka appears to be lusty, it is not in the least bit
material. Unless one is fully situated in the transcendental position, the
relationship of the gops with Kaops and Ka take it for granted that Ka's love
affairs with the gops are mundane transactions, and therefore they sometimes
indulge in painting licentious pictures in some modernistic style.
On the other hand, the lusty desire of Kubj is described by learned
scholars as being "almost lusty desire." Kubj was a hunchbacked woman who
also wanted Ka with a great ecstatic love. But her desire for Ka was
almost mundane, and so her love cannot be compared to the love of the gops.
Her loving affection for Ka is called kma-pry, or almost like the gops'
love for Ka. [VTE](22)
143
Relationship
In the attitude of the denizens of Vndvana, such as Nanda Mahrja and
mother Yaod, is to be found the ideal transcendental concept of being the
father and mother of Ka, the original Personality of Godhead. Factually, no
one can become the father or mother of Ka, but a devotee's possession of
such transcendental feelings is called love of Ka in a parental relationship.
The Vis (Ka's relatives at Dvrak) also felt like that. So spontaneous
love of Ka in the parental relationship is found both among those denizens
of Dvrak who belonged to the dynasty of Vi and among the inhabitants
of Vndvana.
Spontaneous love of Ka as exhibited by the Vis and the denizens of
Vndvana is eternally existing in them. In the stage of devotional service
where regulative principles are followed, there is no necessity of discussing
this love, for it must develop of itself at a more advanced stage.
Conjugal Love
Devotional service following in the footsteps of the gops of Vndvana or
the queens at Dvrak is called devotional service in conjugal love. This
devotional service in conjugal love can be divided into two categories. One is
indirect conjugal love, the other direct. In both of these categories, one has to
follow the particular gop who is engaged in such service in Goloka
Vndvana.ops. Such devotees enjoy simply by
hearing of the activities of the Lord with the gops.
This development of conjugal love can be possible only with those who are
already engaged in following the regulative principles of devotional service,
specifically in the worship of Rdh and Ka in the temple. Such devotees
gradually develop a spontaneous love for the Deity, and by hearing of the
Lord's exchange of loving affairs with the gops, they gradually become
attracted to these pastimes. After this spontaneous attraction becomes highly
developed, the devotee is placed in either of the above-mentioned categories.
This development of conjugal love for Ka is not manifested in women
only. The material body has nothing to do with spiritual loving affairs. A
woman may develop an attitude for becoming a friend of Ka, and, similarly,
a man may develop the feature of becoming a gop in Vndvana. How a
devotee in the form of a man can desire to become a gop is stated in the
Padma Pura as follows: In days gone by there were many sages in
Daakraya. Daakraya is the name of the forest where Lord
Rmacandra lived after being banished by His father for fourteen years. At
that time there were many advanced sages who were captivated by the beauty
of Lord Rmacandra and who desired to become women in order to embrace
147
the Lord. Later on, these sages appeared in Gokula Vndvana when Ka
advented Himself there, and they were born as gops, or girl friends of Ka.
In this way they attained the perfection of spiritual life.
The story of the sages of Daakraya can be explained as follows. When
Lord Rmacandra was residing in Daakraya, the sages who were engaged
in devotional service there became attracted by His beauty and immediately
thought of the gops at Vndvana, who enjoyed conjugal loving affection with
Ka. In this instance it is clear that the sages of Daakraya desired
conjugal love in the manner of the gops, although they were well aware of the
Supreme Lord as both Ka and Lord Rmacandra. They knew that although
Rmacandra was an ideal king and could not accept more than one wife, Lord
Ka, being the full-fledged Personality of Godhead, could fulfill the desires
of all of them in Vndvana. These sages also concluded that the form of Lord
Ka is more attractive than that of Lord Rmacandra, and so they prayed to
become gops in their future lives to be associated with Ka.
Lord Rmacandra remained silent, and His silence shows that He accepted
the prayers of the sages. Thus they were blessed by Lord Rmacandra to have
association with Lord Ka in their future lives. As a result of this
benediction, they all took birth as women in the wombs of gops at Gokula,
and as they had desired in their previous lives, they enjoyed the company of
Lord Ka, who was present at that time in Gokula Vndvana. The
perfection of their human form of life was thus achieved by their generating a
transcendental sentiment to share conjugal love with Lord Ka.
Conjugal love is divided into two classificationsnamely, conjugal love as
husband and wife and conjugal love as lover and beloved. One who develops
conjugal love for Ka as a wife is promoted to Dvrak, where the devotee
becomes the queen of the Lord. One who develops conjugal love for Ka as a
lover is promoted to Goloka Vndvana, to associate with the gops and enjoy
loving affairs with Ka there. We should note carefully, however, that this
conjugal love for Ka, either as gop or as queen, is not limited only to
women. Even men can develop such sentiments, as was evidenced by the sages
148
of Daakraya. If someone simply desires conjugal love, but does not follow
in the footsteps of the gops, he is promoted to association with the Lord at
Dvrak.
In the Mah-krma Pura it is stated, "Great sages who were the sons of
fire-gods rigidly followed the regulative principles in their desire to have
conjugal love for Ka. As such, in their next lives they were able to associate
with the Lord, the origin of all creation, who is known as Vsudeva, or Ka,
and all of them got Him as their husband."
Parenthood or Friendship
Devotees who are attracted to Ka as parents or as friends should follow
in the footsteps of Nanda Mahrja or Subala, respectively. Nanda Mahrja
is the foster father of Ka, and out of all of the friends of Ka, Subala is
the most intimate in Vrajabhmi.
In the development of becoming either the father or friend of the Lord,
there are two varieties. One method is that one may try to become the father
of the Lord directly, and the other is that one may follow Nanda Mahrja
and cherish the ideal of being Ka's father. Out of these two, the attempt to
directly become the father of Ka is not recommended. Such a development
can become polluted with Myvda (impersonal) philosophy. The Myvds,
or monists, think that they themselves are Ka, and if one thinks that he
himself has become Nanda Mahrja, then his parental love will become
contaminated with the Myvda philosophy. The Myvda philosophical
way of thinking is offensive, and no offender can enter into the kingdom of
God to associate with Ka.
In the Skanda Pura there is a story of an old man residing in
Hastinpura, capital of the kingdom of the Pus, who desired Ka as his
beloved son. This old man was instructed by Nrada to follow in the footsteps
of Nanda Mahrja, and thus he achieved success.
149
principles of devotional service and at the same time hope for Ka's favor or
for His devotee's favor.
An example of rising to the stage of ecstatic love by executing the
regulative principles of devotional service is given in the life story of Nrada,
which is described to Vysadeva in rmad-Bhgavatam. Nrada tells there of
his previous life and how he developed to the stage of ecstatic love. He was
engaged in the service of great devotees and used to hear their talks and songs.
Because he had the opportunity to hear these pastimes and songs of Ka
from the mouths of pure devotees, he became very attracted within his heart.
Because he had become so eager to hear these topics, he gradually developed
within himself an ecstatic love for Ka. This ecstatic love is prior to the pure
love of Ka, because in the next verse Nrada confirms that by the gradual
process of hearing from the great sages he developed love of Godhead. In that
connection, Nrada continues to say in the First Canto, Fifth Chapter, verse
28, of the Bhgavatam, "First I passed my days in the association of the great
sages during the rainy autumn season. Every morning and evening I heard
them while they were singing and chanting the Hare Ka mantra, and thus
my heart gradually Ka mantra. In this way one will
get the chance to purify his heart and develop this ecstatic pure love for
Ka.
This statement is also confirmed in the Third Canto, Twenty-fifth
Chapter, verse 25, of rmad-Bhg.
152
154
Utilization of Time
An unalloyed devotee who has developed ecstatic love for Ka is always
engaging his words in reciting prayers to the Lord. Within the mind he is
always thinking of Ka, and with his body he either offers obeisances by
bowing down before the Deity or engages in some other service. During these
ecstatic activities he sometimes sheds tears. In this way his whole life is
155 Parkit, as
described in the First Canto, Nineteenth Chapter, verse 15, of
rmad-Bhgavatam. The King says there to all the sages present before him at
the time of his death, "My dear brhmaas, you should always accept me as
your surrendered servant. I have come to the bank of the Ganges just to
devote my heart and soul unto the lotus feet of Lord Ka. So please bless me,
that mother Ganges may also be pleased with me. Let the curse of the
brhmaa's son fall upon meI do not mind. I only request that at the last
moment of my life all of you will kindly chant the holy name of Viu, so that
I may realize His transcendental qualities."
This example of Mahrja Parkit's behavior, his remaining patient even at
the last point of his life, his undisturbed condition of mind, is an example of
reservation. This is one of the characteristics of a devotee who has developed
ecstatic love for Ka.
Detachment
The senses are always desiring sense enjoyment, but when a devotee
develops transcendental love for Ka his senses are no longer attracted by
material desires. This state of mind is called detachment. There is a nice
example of this detachment in connection with the character of King
Bharata. In the Fifth Canto, Fourteenth Chapter, verse 43, of
rmad-Bhgavatam it is stated, "Emperor Bharata was so attracted by the
beauty of the lotus feet of Ka that even in his youthful life he gave up all
156
Pridelessness
When a devotee, in spite of possessing all the qualities of pure realization, is
not proud of his position, he is called prideless. In the Padma Pura it is
stated that King Bhagratha was the emperor above all other kings, yet he
developed such ecstatic love for Ka that he became a mendicant and went
out begging even to the homes of his political enemies and untouchables. He
was so humble that he respectfully bowed down before them.
There are many similar instances in the history of India. Even very
recently, about two hundred years ago or less, one big landlord known as Ll
Bbu, a Calcutta landholder, became a Vaiava and lived in Vndvana. He
was also begging from door to door, even at the homes of his political enemies.
Begging involves being ready to be insulted by persons to whose home one has
come. That is natural. But one has to tolerate such insults for the sake of
Ka. The devotee of Ka can accept any position in the service of Ka.
Great Hope
157
The strong conviction that one will certainly receive the favor of the
Supreme Personality of Godhead is called in Sanskrit -bandha. -bandha
means to continue to think, "Because I'm trying my best to follow the routine
principles of devotional service, I am sure that I will go back to Godhead, back
to home."
In this connection, one prayer by Rpa Gosvm is sufficient to exemplify
this hopefulness. He says, "I have no love for Ka, nor for the causes of
developing love of Kanamely, hearing and chanting. And the process of
bhakti-yoga, by which one is always thinking of Kajana-vallabha [Ka, maintainer and beloved of the
gops]. -bandha, one should continue to hope
against hope that some way or other he will be able to approach the lotus feet
of the Supreme Lord.ndvana!"
mother, Yaod."
A pure devotee of Lord Ka resides in the district of Mathur or
Vndvana and visits all the places where Ka's pastimes were performed. At
these sacred places Ka displayed His childhood activities with the cowherd
boys and mother Yaod. The system of circumambulating all these places is
still current among devotees of Lord Ka, and those coming to Mathur and
Vndvana always feel transcendental pleasure. Actually, if someone goes to
Vndvana, he will immediately feel separation from Ka, who performed
such nice activities when He was present there.
Such attraction for remembering Ka's activities is known as attachment
for Ka. There are impersonalist philosophers and mystics, however, who by
a show of devotional service want ultimately to merge into the existence of
the Supreme Lord. They sometimes try to imitate a pure devotee's sentiment
for visiting the holy places where Ka had His pastimes, but they simply
have a view for salvation, and so their activities cannot be considered
attachment.
It is said by Rpa Gosvm that the attachment exhibited by pure devotees
for Ka cannot possibly be perfected in the hearts of fruitive workers
(karms) or mental speculators, because such attachment in pure Ka
consciousness is very rare and not possible to achieve even for many liberated
persons. As stated in Bhagavad-gt, liberation from material contamination is
the stage at which devotional service can be achieved. For a person who
simply wants to have liberation and to merge into the impersonal brahmajyoti,
attachment to Ka is not possible to acquire. This attachment is very
confidentially kept by Ka and is bestowed only upon pure devotees. Even
ordinary devotees cannot have such pure attachment for Ka. Therefore,
how is it possible for success to be achieved by persons whose hearts are
contaminated by the actions and reactions of fruitive activities and who are
entangled by various types of mental speculation?
There are many so-called devotees who artificially think of Ka's
160
some common man, by the association of a pure devotee it can bring one to
the perfectional stage. But such attachment for Ka Ka can be aroused, but if one commits offenses at the lotus
feet of a devotee, one's shadow attachment or par par,hmajyoti, his ecstasies gradually diminish into
shadow and par attachment or else transform into the principles of
ahagrahopsan. This ahagrahopsan,
162
163
Ecstasy
164
devotee who always thinks of Ka and who always chants His glories in
ecstatic love, regardless of his condition, will attain the highest perfection of
unalloyed devotional love due to Lord Ka's extraordinary mercy. This is
confirmed in rmad-Bhg Ka
inside and out, then it is to be understood that he has surpassed all austerities
and penances for self-realization. And if, after executing all kinds of penances
and austerities, one cannot always see Ka inside and out, then he has
executed his performances uselessly."
Spontaneous attraction to Ka, which is said to be due to the
extraordinary mercy of the Lord, can be placed under two headings: one is
profound veneration for the greatness of the Lord, and the other is one's being
automatically attracted to Ka without any extraneous consideration. In the
Nrada-pacartra it is said that if on account of profound veneration for the
greatness of the Supreme Lord one attains a great affection and steady love for
Him, one is certainly assured of attaining the four kinds of Vaiava
liberationnamely achieving the same bodily features as the Lord, achieving
the same opulence as the Lord, dwelling on the planet where the Lord is
residing, and attaining eternal association with the Lord. The Vaiava
liberation is completely different from the Myvda liberation, which is
simply a matter of being merged into the effulgence of the Lord.
In the Nrada-pacartra pure, unalloyed devotional service is explained as
being without any motive for personal benefit. If a devotee is continuously in
love with Lord Ka and his mind is always fixed upon Him, that devotional
attitude will prove to be the only means of attracting the attention of the
Lord. In other words, a Vaiava who is incessantly thinking of the form of
Lord Ka is to be known as a pure Vaiava.
166.
168
21. Qualities of r Ka
Personal features can be divided into two: one feature is covered, and the
other feature is manifested. When Ka is covered by different kinds of dress,
His personal feature is covered. There is an example of His covered personal
feature in rmad-Bhgavatam in connection with His dvrak-ll (His
residence in Dvrak as its king). Sometimes Lord Ka began to play by
dressing Himself like a woman. Seeing this form, Uddhava said, "How
wonderful it is that this woman is attracting my ecstatic love exactly as Lord
Ka does. I think she must be Ka covered by the dress of a woman!"
One devotee praised the bodily features of Ka when he saw the Lord in
His manifested personal feature. He exclaimed, "How wonderful is the
personal feature of Lord Ka! How His neck is just like a conchshell! His
eyes are so beautiful, as though they themselves were encountering the beauty
of a lotus flower. His body is just like the tamla tree, very blackish. His head is
protected with a canopy of hair. There are the marks of rvatsa on His chest,
and He is holding His conchshell. By such beautiful bodily features, the enemy
of the demon Madhu has appeared so pleasing that He can bestow upon me
transcendental bliss simply by my seeing His transcendental qualities."
rla Rpa Gosvm, after consulting various scriptures, has enumerated
the transcendental qualities of the Lord as follows: (1) beautiful features of the
172 iva to Prvat in the Padma Pura, and in the First Canto of
rmad-Bhgavatam in connection with a conversation between the deity of
the earth and the King of religion, Yamarja.,
173
2. Auspicious Characteristics
There are certain characteristics of different limbs which are considered to
be very auspicious and are fully present in the body of the Lord. In this
connection, one friend of Nanda Mahrja, speaking about Lord Ka Ka appears He does so in a family of katriyas (kings), as did
Lord Rmacandra, and sometimes in a family of brhmaas. But Ka
accepted the role of son to Mahrja Nanda, despite the fact that Nanda
belonged to the vaiya community. The business of the vaiya community is
trade, commerce and the protection of cows. Therefore his friend, who may
have been born into a brhmaa family, expressed his wonder at how such an
exalted child could take birth in a family of vaiyas. Anyway, he pointed out
the auspicious signs on the body of Ka to the boy's foster father.
He continued, "This boy has a reddish luster in seven placesHis eyes, the
ends of His hands, the ends of His legs, His palate, His lips, His tongue and His
nails. A reddish luster in these seven places is considered to be auspicious.
175). Ka possesses this attractive feature of rucira in His
personal features. In the Third Canto, Second Chapter, verse 13, of
rmad-Bhgavatam, there is a statement about this. "The Supreme Personality
of Godhead, in His pleasing dress, appeared at the scene of the sacrificial
arena when King Yudhihira was performing the Rjasya sacrifice. All
important personalities from different parts of the universe had been invited
to the sacrificial arena, and all of them, upon beholding Ka there,
considered that the Creator had ended all of His craftsmanship in the
creation of this particular body of Ka."
It is said that the transcendental body of Ka resembles the lotus flower
in eight partsnamely His face, His two eyes, His two hands, His navel and
His two feet. The gops and inhabitants of Vndvana used to see the luster of
lotus flowers everywhere, and they could hardly withdraw their eyes from such
176
a vision.
4. Effulgent
The effulgence pervading the universe is considered to be the rays of the
Supreme Personality of Godhead. The supreme abode of Ka Ka is so great that it can
defeat anyone. When Ka was present in the sacrificial arena of His enemy
King Kasa, the wrestlers present, although appreciating the softness of the
body of r Ka, were afraid and perturbed when they thought of engaging
with Him in battle.
5. Strong
A person who has extraordinary bodily strength is called balyn. When
Ka killed Arisura, some of the gops said, "My dear friends, just see how
Ka has killed Arisura! Although he was stronger than a mountain, Ka
plucked him up just like a piece of cotton and threw him away without any
difficulty!" There is another passage wherein it is said, "O my dear devotees of
Lord Ka, may the left hand of Lord Ka, which has lifted Govardhana
Hill like a ball, save you from all dangers."
6. Ever Youthful
Ka is beautiful at His different agesnamely His childhood, His
177
boyhood and His youth. Out of these three, His youth is the reservoir of all
pleasures and is the time when the highest varieties of devotional service are
acceptable. At that age, Ka is full with all transcendental qualities and is
engaged in His transcendental pastimes. Therefore, devotees have accepted
the beginning of His youth as the most attractive feature in ecstatic love.
At this age Ka is described as follows: "The force of Ka's youth was
combined with His beautiful smile, which defeated even the beauty of the full
moon. He was always nicely dressed, in beauty surpassing even Cupid, and He
was always attracting the minds of the gops, who were thereby always feeling
pleasure."
7. Wonderful Linguist
Rpa Gosvm says that a person who knows the languages of different
countries, especially the Sanskrit language, which is spoken in the cities of the
demigodsas well as other worldly languages, including those of the
animalsis called a wonderful linguist. It appears from this statement that
Ka can also speak and understand the languages of the animals. An old
woman in Vndvana, present at the time of Ka's pastimes, once stated in
surprise, "How wonderful it is that Ka, who owns the hearts of all the young
girls of Vrajabhmi, can nicely speak the language of Vrajabhmi with the
gops,, Ka is so expressive!" She inquired from
the gops as to how Ka had become so expert in speaking so many different
types of languages.
8. Truthful
A person whose word of honor is never broken is called truthful. Ka
178
once promised Kunt, the mother of the Pavas, that He would bring her
five sons back from the Battlefield of Kuruketra. After the battle was
finished, when all the Pavas had come home, Kunt praised Ka because
His promise was so nicely fulfilled. She said, "Even the sunshine may one day
become cool and the moonshine one day become hot, but still Your promise
will not fail." Similarly, when Ka, along with Bhma and Arjuna, went to
challenge Jarsandha, He plainly told Jarsandha that He was the eternal
Ka, present along with two of the Pavas. The story is that both Ka
and the Pavasin this case Bhma and Arjunawere katriyas
(warrior-kings). Jarsandha was also a katriya and was very charitable toward
the brhmaas. Thus Ka, who had planned to fight with Jarsandha, went
to him with Bhma and Arjuna in the dress of brhmaas. Jarsandha, being
very charitable toward the brhmaas, asked them what they wanted, and they
expressed their desire to fight with him. Then Ka, dressed as a brhmaa,
declared Himself to be the same Ka who was the King's eternal enemy.
9. Pleasing Talker
A person who can speak sweetly even with his enemy just to pacify him is
called a pleasing talker. Ka was such a pleasing talker that after defeating
His enemy Kliya in the water of the Yamun,liya was residing within the water of the Yamun, and as a result the
back portion of that river had become poisoned. Thus so many cows who had
drunk the water had died. Therefore Ka, even though He was only four or
five years old, dipped Himself into the water, punished Kliya very severely
and then asked him to leave the place and go elsewhere.
Ka said at that time that the cows are worshiped even by the demigods,
179
and He practically demonstrated how to protect the cows. At least people who
are in Ka consciousness should follow in His footsteps and give all
protection to the cows. Cows are worshiped not only by the demigods. Ka
Himself worshiped the cows on several occasions, especially on the days of
Gopam and Govardhana-pj.
10. Fluent
A person who can speak meaningful words and with all politeness and good
qualities is called vvadka, or fluent. There is a nice statement in
rmad-Bhgavatam regarding Ka's speaking politely. When Ka politely
bade His father, Nanda Mahrja, to stop the ritualistic offering of sacrifice to
the rain-god, Indra, a wife of one village cowherd man became captivated. She
later thus described the speaking of Ka to her friends: "Ka was speaking
to His father so politely and gently that it was as if He were pouring nectar
into the ears of all present there. After hearing such sweet words from Ka,
who will not be attracted to Him?"
Ka's speech, which contains all good qualities in the universe, is
described in the following statement by Uddhava: "The words of Ka are so
attractive that they can immediately change the heart of even His opponent.
His words can immediately solve all of the questions and problems of the
world. Although He does not speak very long, each and every word from His
mouth contains volumes of meaning. These speeches of Ka are very
pleasing to my heart."
Mathur, Ka did not think it wise to kill him directly with His own hand.
Still the king had to be killed, and therefore Ka decided with fine
discretion that He should flee from the battlefield so that the untouchable
king would chase Him. He could then lead the king to the mountain where
Mucukunda was lying asleep. Mucukunda had received a benediction from
Krttikeya to the effect that when he awoke from his sleep, whomever he
might see would at once be burnt to ashes. Therefore Kaval which contains the following conversation between
Ka and Rdh. One morning, when Ka came to Rdh, Rdh asked
Him, "My dear Keava, where is Your vsa at present?" The Sanskrit word vsa
has three meanings: one meaning is residence, one meaning is fragrance, and
another meaning is dress.
Actually Rdhr inquired from Ka, "Where is Your dress?" But Ka
took the meaning as residence, and He replied to Rdhr, "My dear
captivated one, at the present moment My residence is in Your beautiful eyes."
To this Rdhr replied, "My dear cunning boy, I did not ask You about
Your residence. I inquired about Your dress."
Ka then took the meaning of vsa as fragrance and said, "My dear
fortunate one, I have just assumed this fragrance in order to be associated with
Your body."
rmat Rdhr again inquired from Ka, "Where did You pass Your
night?" The exact Sanskrit word used in this connection was yminymuita.
Yminym means "at night," and uita means "pass." Ka, however, divided
183
the word yminymuita into two separate words, namely yminy and
muita. By dividing this word into two, it came out to mean that He was
kidnapped by Ymin, or night. Ka therefore replied to Rdhr, "My
dear Rdhr, is it possible that night can kidnap Me?" In this way He was
answering all of the questions of Rdhr so cunningly that He gladdened
this dearest of the gops.
14. Artistic
One who can talk and dress himself very artistically is called vidagdha. This
exemplary characteristic was visible in the personality of r Ka. It is
spoken of by Rdhr as follows: "My dear friend, just see how Kaops said, "My dear friends, just see the clever
activities of r Ka! He has composed nice songs about the cowherd boys
and is pleasing the cows. By the movement of His eyes He is pleasing the gops,
and at the same time, He is fighting with demons like Arisura. In this way,
He is sitting with different living entities in different ways, and He is
thoroughly enjoying the situation."
16. Expert
Any person who can quickly execute a very difficult task is called expert.
184
17. Grateful
Any person who is conscious of his friend's beneficent activities and never
forgets his service is called grateful. In the Mahbhrata, Ka says, "When I
was away from Draupad, she cried with the words, 'He govinda!' This call for
Me has put Me in her debt, and that indebtedness is gradually increasing in
My heart!" This statement by Ka gives evidence of how one can please the
Supreme Lord simply by addressing Him, "He ka! He govinda!"
The mah-mantra (Hare Ka, Hare Ka, Ka Ka, Hare Hare/ Hare
Rma, Hare Rma, Rma Rma, Ka's feeling of obligation is stated in connection
185
with His dealings with Jmbavn. When the Lord was present as Lord
Rmacandra, Jmbavn, the great king of the monkeys, rendered very faithful
service to Him. When the Lord again appeared as Lord Ka, He married
Jmbavn's daughter and paid him all the respect that is usually given to
superiors. Any honest person is obliged to his friend if some service has been
rendered unto Him. Since Kaaa. This is in
connection with Lord Ka's fighting the King of heaven, Indra, who was
forcibly deprived of the prijta flower. Prijta is a kind of lotus flower grown
on the heavenly planets. Once, Satyabhm, one of Ka's queens, wanted
that lotus flower, and Ka promised to deliver it; but Indra refused to part
with his prijta flower. Therefore there was a great fight, with Ka and the
Pavas on one side and all of the demigods on the other. Ultimately, Ka
defeated all of them and took the prijta flower, which He presented to His
queen. So, in regard to that occurrence, Ka told Nrada Muni, "My dear
great sage of the demigods, now you can declare to the devotees in general,
and to the nondevotees in particular, that in this matter of taking the prijta
flower, all the demigodsthe Gandharvas, the Ngas, the demon Rkasas,
the Yakas, the Pannagastried to defeat Me, but none could make Me break
My promise to My queen."
There is another promise by Ka in Bhagavad-gt to the effect that His
devotee will never be vanquished. So a sincere devotee who is always engaged
in the transcendental loving service of the Lord should know for certain that
Ka will never break His promise. He will always protect His devotees in
every circumstance.
186 Ka is the Supreme Personality of Godhead and can see all
that is past, present and future, to teach the people in general He used to
always refer to the scriptures. For example, in Bhagavad-gt, although Ka
was speaking as the supreme authority, He still mentioned and quoted
Vednta-stra as authority. There is a statement in rmad-Bhgavatam
wherein a person jokingly says that Ka, the enemy of Kasa, is known as
the seer through the stras. In order to establish His authority, however, He is
now engaged in seeing the gops, whereby the gops. Ka is both; He can deliver all sinful conditioned
souls, and at the same time, He never does anything by which He can be
contaminated.
In this connection, Vidura, while trying to detach his elder brother,
Dhtarra, from his familial attachments, said, "My dear brother, you just fix
your mind on the lotus feet of Ka, who is worshiped with beautiful, erudite
verses by great sages and saintly persons. Ka is the supreme deliverer among
all deliverers. Undoubtedly there are great demigods like Lord iva and Lord
Brahm, but their positions as deliverers depend always upon the mercy of
Ka." Therefore Vidura advised his elder brother, Dhtarra, to
concentrate his mind and worship only Ka. If one simply chants the holy
name of Ka, this holy name will rise within one's heart like the powerful
188
sun and will immediately dissipate all the darkness of ignorance. Vidura
advised Dhtarra to therefore think always of Ka, so that the volumes of
contaminations due to sinful activities would be washed off immediately. In
Bhagavad-gt also Ka is addressed by Arjuna as para brahma para
dhma pavitram [Bg. 10.12]the supreme pure. There are many other
instances exhibiting Ka's supreme purity.
22. Self-controlled
A person who can control his senses fully is called va, or self-controlled.
In this connection it is stated in rmad-Bhgavatam, "All the sixteen
thousand wives of Ka were so exquisitely beautiful that their smiling and
shyness were able to captivate the minds of great demigods like Lord iva. But
still they could not even agitate the mind of Ka, in spite of their attractive
feminine behavior." Every one of the thousands of wives of Ka was
thinking that Ka was captivated by her feminine beauty, but this was not
the case. Ka is therefore the supreme controller of the senses, and this is
admitted in Bhagavad-gt, where He is addressed as Hkeathe master of
the senses.
23. Steadfast
A person who continues to work until his desired goal is achieved is called
steadfast.
There was a fight between Ka and King Jmbavn, and Ka was to
take the valuable Syamantaka jewel from the King. The King tried to hide
himself in the forest, but Ka would not become discouraged. Ka finally
got the jewel by seeking out the King with great steadfastness.
189
24. Forbearing
A person who tolerates all kinds of troubles, even though such troubles
appear to be unbearable, is called forbearing.
When Kada is being served,
the spiritual master is supposed to call each and every disciple to come eat. If
by chance the spiritual master forgets to call a disciple to partake of the
prasda, it is enjoined in the scriptures that the student should fast on that
day rather than accept food on his own initiative. There are many such
strictures. Sometimes, also, Ka went to the forest to collect dry wood for
fuel.
25. Forgiving
A person who can tolerate all kinds of offenses from the opposite party is
known to be forgiving.
Lord Ka's forgiving quality is described in the iupla-vadha in
connection with His forbidding the killing of iupla. King iupla was the
monarch of the Cedi kingdom, and although he happened to be a cousin of
Ka's, he was always envious of Him. Whenever they would meet, iupla
would try to insult Ka and call Him ill names as much as possible. In the
arena of the Rjasya sacrifice of Mahrja Yudhihira, when iupla began
to call Lord Ka ill names, Ka did not care and remained silent. Some of
the people at the arena were prepared to kill iupla, but Ka restricted
them. He was so forgiving. It is said that when there is a thundering sound in
190
the clouds, the mighty lion immediately replies with his thundering roar. But
the lion doesn't care when all the foolish jackals begin to make their less
important sounds.
r Ymuncrya praises Ka's power of forgiveness with the following
statement: "My dear Lord Rmacandra, You are so merciful to have excused
the crow's clawing on the nipples of Jnak simply because of his bowing down
before You." Once Indra, the King of heaven, assumed the form of a crow and
attacked St (Jnak), Lord Rmacandra's wife, by striking her on the breast.
This was certainly an insult to the universal mother, St, and Lord
Rmacandra was immediately prepared to kill the crow. But because later on
the crow bowed down before the Lord, the Lord excused his offense. r
Ymuncrya further says in his prayer that the forgiving power of Lord Ka
is even greater than that of Lord Rmacandra, because iupla was always in
the habit of insulting Kanot only in one lifetime, but continually
throughout three lives. Still, Ka was so kind that He gave iupla the
salvation of merging into His existence. From this we can understand that the
goal of the monist to merge into the effulgence of the Supreme is not a very
difficult problem. Persons like iupla who are consistently inimical to Ka
can also get this liberation.
26. Grave
A person who does not express his mind to everyone, or whose mental
activity and plan of action are very difficult to understand, is called grave.
After Lord r Ka had been offended by Brahm, Brahm prayed to Him to
be excused. But in spite of his offering nice prayers to Ka, Brahm could
not understand whether Ka was satisfied or still dissatisfied. In other words,
Ka was so grave that He did not take the prayers of Brahm very seriously.
Another instance of Ka's gravity is found in connection with His love
affairs with Rdhr. Ka was always very silent about His love affairs
with Rdhr, so much so that Baladeva, Ka's elder brother and constant
191
27. Self-satisfied
A person who is fully satisfied in himself, without any hankering, and who
is not agitated even in the presence of serious cause for distress, is called
self-satisfied.
An example of Ka's self-satisfaction was exhibited when He, Arjuna and
Bhma went to challenge Jarsandha, the formidable king of Magadha, and
Ka gave all credit to Bhma for the killing of Jarsandha. From this we can
understand that Ka never cares at all for fame, although no one can be
more famous.
An example of His not being disturbed was shown when iupla began to
call Him ill names. All the kings and brhmaas assembled at the sacrificial
arena of Mahrja Yudhihira became perturbed and immediately wanted to
satisfy Ka by offering nice prayers. But all these kings and brhmaas could
not discover any disturbance in Ka's person.
Your enemies and Your dealings with Your sons are both the same. We know
that it is in thinking of the future welfare of this condemned creature that
You have chastised him."
In another prayer it is said, "My dear Lord Ka, Ka was reigning over Dvrak, He was so magnanimous and
charitably disposed that there was no limit to His charity. In fact, so great was
His charity in Dvrak that even the spiritual kingdom, with all of its
opulence of cintmai (touchstone), desire trees and surabhi cows, was
surpassed. In the spiritual kingdom of Lord Ka, named Goloka Vndvana, Ka, everything is wonderfully opulent, still when Ka was in
Dvrak His charity exceeded the opulences of Goloka Vndvana. Wherever
Ka is present, the limitless opulence of Goloka Vndvana is automatically
present.
It is also stated that while Lord Ka was living in Dvrak, He expanded
Himself into 16,108 forms, and each and every expansion resided in a palace
with a queen. Not only was Ka happily living with His queens in those
palaces, but He was giving in charity from each palace an aggregate number of
193
13,054 cows completely decorated with nice clothing and ornaments. From
each of Ka's 16,108 palaces, these cows were being given in charity by Ka
every day. No one can estimate the value of such a large number of cows given
in charity, but that was the system of Ka's daily affairs while He was
reigning in Dvrak.
30. Religious
A person who personally practices the tenets of religion as they are
enjoined in the stras Ka was present on this planet, there was no irreligion. In this
connection, Nrada Muni once addressed Ka
Ka, religious principles were so well cared for that hardly any irreligious
activities could be found.
It is said that because Ka, Ka's ninth incarnation, who appears in
the age of Kali. In other words, instead of being pleased that Lord Ka
194
31. Heroic
A person who is very enthusiastic in military activities and expert in
releasing different kinds of weapons is called heroic.
Regarding Ka Ka's expertise in releasing weapons, when Jarsandha and
thirteen divisions of soldiers attacked Ka's army, they were unable to hurt
even one soldier on the side of Ka. This was due to Ka's expert military
training. This is unique in the history of military art.
32. Compassionate
A person who is unable to bear another's distress is called compassionate.
195
33. Respectful
A person who shows adequate respect to a spiritual master, a brhmaa and
an old person is to be understood as being respectful.
When superior persons assembled before Ka, Ka first of all offered
respect to His spiritual master, then to His father, and then to His elder
brother, Balarma. In this way Lord Ka, the lotus-eyed, was completely
happy and pure at heart in all of His dealings.
196
34. Gentle
Any person who neither becomes impudent nor exhibits a puffed-up nature
is called gentle.
The example of Ka's gentle behavior was manifested when He was
coming to the arena of the Rjasya sacrifice arranged by Mahrja
Yudhihira, Ka's older cousin. Mahrja Yudhihira knew that Ka was
the Supreme Personality of Godhead, and he was attempting to get down from
his chariot to receive Ka. But before Yudhihira could get down, Lord
Ka got down from His own chariot and immediately fell at the feet of the
King. Even though Ka Ka is so kind and favorable that if a servitor is accused even of great
offenses, Ka does not take this into consideration. He simply considers the
service that is rendered by His devotee.
36. Shy
A person who sometimes exhibits humility and bashfulness is called shy.
As described in the Lalita-mdhava, Ka's shyness was manifested when
He lifted Govardhana Hill by the little finger of His left hand. All of the gops
were observing Ka's wonderful achievement, and Ka was also smiling at
seeing the gops. When Ka's glance went over the breasts of the gops, His
hand began to shake, and upon seeing His hand shake, all of the cowherd men
197
underneath the hill became a little disturbed. Then there was a tumultuous
roaring sound, and they all began to pray to Ka for safety. At this time Lord
Balarma was smiling, thinking that these cowherd men had been frightened
by the shaking of Govardhana Hill. But, seeing Balarma smile, Ka thought
that Balarma had understood His mind in observing the breasts of the gops,
and He immediately became bashful.
38. Happy
Any person who is always joyful and untouched by any distress is called
happy.
As far as Ka's enjoyment is concerned, it is stated that the ornaments
which decorated the bodies of Ka and His queens were beyond the dreams
of Kuvera, the treasurer of the heavenly kingdom. The constant dancing
before the doors of Ka Ka's palaces.
Gaur means "white woman," and Lord iva's wife is called Gaur. The
beautiful women residing within the palaces of Ka were so much whiter
than Gaur that they were compared to the moonshine, and they were
198
199
41. All-auspicious
A person who is always engaged in auspicious welfare activities for
200
43. All-famous
A person who becomes well known due to his spotless character is called
famous.
It is stated that the diffusion of Ka's fame is like the moonshine, which
turns darkness into light. In other words, if Ka consciousness is preached
all over the world, the darkness of ignorance and the anxiety of material
existence will turn into the whiteness of purity, peacefulness and prosperity.
When the great sage Nrada was chanting the glories of the Lord, the
bluish line on the neck of Lord iva disappeared. Upon seeing this, Gaur, the
wife of Lord iva, suspected Lord iva of being someone else disguised as her
husband, and out of fear she immediately left his company. Upon hearing the
chanting of Ka's name, Lord Balarma saw that His dress had become
white, although He was generally accustomed to a bluish dress. And the
cowherd girls saw all of the water of the Yamun River turn into milk, so they
began to churn it into butter. In other words, by the spreading of Ka
201
44. Popular
Any person who is very dear to people in general is called a popular man.
As for Ka's popularity, there is a statement in the First Canto, Eleventh
Chapter, verse 9, of rmad-Bhgavatam, that deals with His returning home
from the capital of Hastinpura. While He had been absent from Dvrak at
the Battle of Kuruketra, all the citizens of Dvrak Ka was all over the country.
A similar incident occurred when Ka entered the arena of sacrifice
arranged by King Kasa for His death. As soon as He entered the place, all
the sages began to cry, "Jaya! Jaya! Jaya!" (which means "Victory!"). Ka was
a boy at that time, and all the sages offered their respectful blessings to Him.
The demigods who were present also began to offer beautiful prayers to Ka.
And the ladies and girls present expressed their joy from all corners of the
arena. In other words, there was no one in that particular place with whom
Ka was not very popular.
dear Lord, if You had not appeared on this planet, then the asuras [demons]
and atheists would have surely created havoc against the activities of the
devotees. I cannot imagine the magnitude of such devastation prevented by
Your presence." From the very beginning of His appearance, Ka was the
greatest enemy of all demoniac persons, although Ka's enmity toward the
demons is actually comparable to His friendship with the devotees. This is
because any demon who is killed by Ka receives immediate salvation.
47. All-worshipable
A person who is respected and worshiped by all kinds of human beings and
demigods is called sarvrdhya, or all-worshipable.
Ka is worshiped not only by all living entities, including the great
demigods like Lord iva and Lord Brahm, but also by Viu expansions
203
48. All-opulent
Ka is full in all opulencesnamely strength, wealth, fame, beauty,
knowledge and renunciation. When Ka was present in Dvrak, His family,
which is known as the Yadu dynasty, consisted of 560 million members. And
all of these family members were very obedient and faithful to Ka. There
were more than 900,000 big palatial buildings there to house all the people,
and everyone in them respected Ka as the most worshipable. Devotees were
astonished to see the opulence of Ka.
This was verified by Bilvamagala hkura when in Ka-karmta he
addressed Ka thus: "My dear Lord, what can I say about the opulence of
Your Vndvana? Simply the ornaments on the legs of the damsels of
Vndvana are more than cintmai, and their dresses are as good as the
heavenly prijta flowers. And the cows exactly resemble the surabhi cows in
the transcendental abode. Therefore Your opulence is just like an ocean that
no one can measure."
49. All-honorable
A person who is chief among all important persons is called all honorable.
When Ka was living at Dvrak, demigods like Lord iva, Lord Brahm,
Indra the King of heaven and many others used to come to visit Him. The
doorkeeper, who had to manage the entrance of all these demigods, one very
busy day said, "My dear Lord Brahm and Lord iva, please sit down on this
204
bench and wait. My dear Indra, please desist from reading your prayers. This is
creating a disturbance. Please wait silently. My dear Varua, please go away.
And my dear demigods, do not waste your time uselessly. Ka is very busy;
He cannot see you!"
51. Changeless
Ka does not change His constitutional position, not even when He
appears in this material world. Ordinary living entities have their
constitutional spiritual positions covered. They appear in different bodies, and
under the different bodily concepts of life they act. But Ka does not change
His body. He appears in His own body and is therefore not affected by the
modes of material nature. In the First Canto, Eleventh Chapter, verse 38, of
rmad-Bhgavatam it is stated that the special prerogative of the supreme
controller is that He is not at all affected by the modes of nature. The
practical example of this is that devotees who are under the protection of the
Lord are also not affected by material nature. To overcome the influence of
material nature is very difficult, but the devotees or the saintly persons who
are under the protection of the Lord are not affected. So what need is there to
speak of the Lord Himself? To be more clear, although the Lord sometimes
appears in this material world, He has nothing to do with the modes of
material nature, and He acts with full independence in His transcendental
position. This is the special quality of the Lord.
52. All-cognizant
Any person who can understand the feelings of all persons and incidents in
all places at all times is called all-cognizant.
A nice example of the all-cognizant quality of the Lord is described in
rmad-Bhgavatam, First Canto, Fifteenth Chapter, verse 11, in connection
with Durvs Muni's visit to the house of the Pavas in the forest.
206
Following a calculated plan, Duryodhana sent Durvs Muni and his ten
thousand disciples to be guests of the Pavas in the forest. Duryodhana
arranged for Durvs and his men to reach the place of the Pavas just
when the Pavas' lunchtime ended, so that the Pavas would be caught
without sufficient means to feed such a large number of guests. Knowing
Duryodhana's plan, Ka came to the Pavas and asked their wife,
Draupad, if there were any remnants of food which she could offer to Him.
Draupad offered Him a container in which there was only a little fragment of
some vegetable preparation, and Ka at once ate it. At that moment all of
the sages accompanying Durvs were taking bath in the river, and when
Ka felt satisfaction from eating Draupad's offering, they also felt
satisfaction, and their hunger was gone. Because Durvs and his men were
unable to eat anything more, they went away without coming into the house
of the Pavas. In this way the Pavas were saved from the wrath of
Durvs. Duryodhana had sent them because he knew that since the Pavas
would not be able to receive such a large number, Durvs would become
angry, and the Pavas would be cursed. But Ka saved them from this
calamity by His trick and by His all-cognizant quality.
anxieties may be the first principle of joyfulness, but it is not actual joyfulness.
Those who realize the self, or become brahma-bhta [SB 4.30.20], are only
preparing themselves for the platform of joyfulness. That joyfulness can be
actually achieved only when one comes into contact with Ka. Ka
consciousness is so complete that it includes the transcendental pleasure
derived from impersonal or Brahman realization. Even the impersonalist will
become attracted to the personal form of Ka, known as ymasundara.
It is confirmed by the statement of Brahma-sahit that the Brahman
effulgence is the bodily ray of Ka; the Brahman effulgence is simply an
exhibition of the energy of Ka. Ka is the source of the Brahman
effulgence, as He Himself confirms in Bhagavad-gt. From this we can
conclude that the impersonal feature of the Absolute Truth is not the ultimate
end; Ka is the ultimate end of the Absolute Truth.
The members of the Vaiava schools therefore never try to merge into the
Brahman effulgence in their pursuit of spiritual perfection. They accept Ka
as the ultimate goal of self-realization. Therefore Ka is called
Parambrahman (the Supreme Brahman) or Paramevara (the supreme
controller). r Ymuncryaay Viu, the Krodakay Viu, the Mah-Viu, and beyond
them the spiritual sky and its spiritual planets, known as Vaikuhas, and the
Brahman effulgence in that spiritual skyall of these taken together are
nothing but a small exhibition of Your potency."
all very great personalities, by hearing the sound of Ka's flute they humbly
bow down and become grave from studying the sound vibrated."
In his book Vidagdha-mdhava, r Rpa Gosvm thus describes the
vibration of Ka's flute: "The sound vibration created by the flute of Ka
wonderfully stopped Lord iva from playing his iima drum, and the same
flute has caused great sages like the four Kumras to become disturbed in their
meditation. It has caused Lord Brahm, who was sitting on the lotus flower for
the creative function, to become astonished. And Anantadeva, who was
calmly holding all the planets on His hood, was moving in this way and that
due to the transcendental vibration from Ka's flute, which penetrated
through the covering of this universe and reached to the spiritual sky."
217
Dhrodtta
A dhrodtta is a person who is naturally very grave, gentle, forgiving,
merciful, determined, humble, highly qualified, chivalrous and physically
attractive.
218
Dhra-lalita
A person is called dhra-lalita if he is naturally very funny, always in full
youthfulness, expert in joking and free from all anxieties. Such a dhra-lalita
personality is generally found to be domesticated and very submissive to his
lover. This dhra-lalita trait in the personality of Ka is described by
Yaja-patn, the wife of one of the brhmaas who were performing sacrifices
in Vndvana. She tells her friends, "One day rmat Rdhr,
accompanied by Her associates, was taking rest in Her garden, and at that time
Lord r Ka arrived in that assembly. After sitting down, He began to
narrate very impudently about His previous night's pastimes with Rdhr.
While He was speaking in that way, Rdhr became very embarrassed. She
was feeling ashamed and was absorbed in thought, and Ka took the
opportunity to mark Her breasts with different kinds of tilaka. Ka proved
Himself to be very expert in that art." In this way Ka, as dhra-lalita, was
enjoying His youthful proclivities in the company of the gops.
Generally, those who are expert in writing drama choose to call Cupid the
ideal dhra-lalita, but we can more perfectly find in the personality of Ka all
219
Dhra-pranta
A person who is very peaceful, forbearing, considerate and obliging is
called dhra-pranta. This dhra-pranta trait of Ka was exhibited in His
dealings with the Pavas. On account of the Pavas' faithful devotion to
the Lord, He agreed to become their charioteer, their advisor, their friend,
their messenger and sometimes their bodyguard. Such is an example of the
result of devotional service toward Viu. When Ka was speaking to
Mahrja Yudhihira about religious principles, He demonstrated Himself to
be a great learned scholar, but because He accepted the position of younger
cousin to Yudhihira, He was speaking in a very gentle tone which enhanced
His beautiful bodily features. The movements of His eyes and the mode of His
speech proved that He was very, very expert in giving moral instruction.
Sometimes, Mahrja Yudhihira is also accepted by learned scholars as
dhra-pranta.
Dhroddhata
A person who is very envious, proud, easily angered, restless and
complacent is called dhroddhata by learned scholars. Such qualities were
visible in the character of Lord Ka, because when He was writing a letter to
Klayavana, Ka addressed him as a sinful frog. In His letter Ka advised
Klayavana that he should immediately go and find some dark well for his
residence, because there was a black snake named Ka who was very eager to
devour all such sinful frogs. Ka reminded Klayavana that He could turn all
the universes to ashes simply by looking at them.
The above statement by Ka seems apparently to be of an envious nature,
but according to different pastimes, places and times this quality is accepted as
a great characteristic. Ka's dhroddhata qualities have been accepted as
220
great because Ka uses them only to protect His devotees. In other words,
even undesirable traits may also be used in the exchange of devotional service.
Sometimes Bhma, the second brother of the Pavas, is also described as
dhroddhata.
Once, while fighting with a demon who was appearing as a deer, Ka
challenged him in this way: "I have come before you as a great elephant named
Ka. You must leave the battlefield, accepting defeat, or else there is death
awaiting you." This challenging spirit of Ka's is not contradictory to His
sublime character; because He is the Supreme Being, everything is possible in
His character.
There is a nice statement in the Krma Pura Ka's person are not at all surprising; one should not
consider the characteristics of Ka, the Supreme Personality of Godhead, to
be actually contradictory. One should try to understand the traits of Ka
from authorities and try to understand how these characteristics are employed
by the supreme will of the Lord.
In the Mah-varha Pura it is confirmed that the transcendental bodies
of the Supreme Personality of Godhead and His expansions are all existing
eternally. Such bodies are never material; they are completely spiritual and
full of knowledge. They are reservoirs of all transcendental qualities. In the
Viu-ymala-tantra there is a statement that because the Personality of
Godhead and His expanded bodies are always full of knowledge, bliss and
eternity, they are always free from the eighteen kinds of material
contaminationsillusion, fatigue, errors, roughness, material lust, restlessness,
pride, envy, violence, disgrace, exhaustion, untruth, anger, hankering,
dependence, desire to lord over the universe, seeing duality and cheating.
221
Decorated
It is said that a person is great if he is decorated with the qualities of being
very merciful toward the unfortunate, very powerful, superior, chivalrous,
enthusiastic, expert and truthful. These decorations were manifested in the
character of Ka during His govardhana-ll. At that time the whole tract of
land in Vndvana was being disturbed by the rains sent by Indra, as described
elsewhere. At first Ka thought, "Let Me retaliate against this vengeance of
222
Indra by destroying his heavenly kingdom," but later on, when He thought of
the insignificance of the King of heaven, Ka changed His mind and felt
merciful toward Indra. No one is able to tolerate the wrath of Ka, so
instead of retaliating against Indra, He simply showed His compassion for His
friends in Vndvana by lifting the whole of Govardhana Hill to protect them.
Enjoying
When a person is seen to be always happy and is accustomed to speak
smilingly, he is considered to be in the mode of enjoyment. This trait was
found in Ka when He appeared at the sacrificial arena of King Kasa. It is
described that the lotus-eyed Ka entered among the wrestlers without
being impolite to them, glanced over them with determination and seemed to
them just like an elephant attacking some plants. Even while speaking to
them, Ka was still smiling, and in this way He stood valiantly upon the
wrestling dais.
Pleasing
When one's characteristics are very sweet and desirable, his personality is
called pleasing. An example of Ka's pleasing nature is thus described in
rmad-Bhgavatam: "One day while Ka was awaiting the arrival of rmat
Rdhr by the bank of the Yamun, He began to make a garland of
kadamba flowers. In the meantime, rmat Rdhr appeared there, and at
that time Murri [Ka], the enemy of Mura, glanced over Rdhr very
sweetly."
Dependable
Any person who is reliable in all circumstances is called dependable. In this
connection Rpa Gosvm says that even the demons were relying upon the
223
Steady
A person who is not disturbed even in a situation of reverses is called
steady. This steadiness was observed in Ka in connection with His
chastising the demon known as Ba. The Ba demon had many hands, and
Ka was cutting off these hands one after another. This Ba was a great
devotee of Lord iva and the goddess Durg. Thus, when Ba was being
chastised, Lord iva and Durg became very furious at Ka. But Ka did
not care for them.
Predominating
A person who can affect the mind of everyone is called predominating. As
far as Ka's predomination is concerned, in the Tenth Canto, Forty-third
Chapter, verse 17, of rmad-Bhgavatam, Ka is described thus by ukadeva
Gosvm to King Parkit: "My dear King, Ka is a thunderbolt to the
wrestlers; to the common man He is the most beautiful human being; to the
young girls He is just like Cupid; to the cowherd men and women He is the
most intimate relative; to the impious kings He is the supreme ruler; to His
parents, Nanda and Yaod, He is just a baby; to Kasa, the King of Bhoja, He
224
is death personified; to the dull and stupid He is just like a stone; to the yogs
He is the Supreme Absolute Truth; and to the Vis He is the Supreme
Personality of Godhead. In such a predominating position, Ka appeared in
that arena along with His older brother, Balarma." When Ka, the reservoir
of all mellows, was present in the arena of Kasa, He appeared differently to
the different persons who were related to Him in different mellows. It is stated
in Bhagavad-gt that He appears to every person according to one's
relationship with Him.
Sometimes learned scholars describe "predominating" to mean a person
intolerant of being neglected. This peculiarity in Ka was visible when
Kasa was insulting Mahrja Nanda. Vasudeva was asking Ka's assistance
in killing Kasa, and Ka was glancing over Kasa with longing eyes, just
like a prostitute, and was just preparing to jump at the King.
Meticulous Dresser
A person who is very fond of dressing himself is called lalita, or a
meticulous dresser. This characteristic was found in Ka in two ways:
sometimes He used to decorate rmat Rdhr with various marks, and
sometimes, when He was preparing to kill demons like Arisura, He would
take care to arrange His belt very nicely.
Magnanimous
Persons who can give themselves to anyone are called magnanimous. No
one could be more magnanimous than Ka, because He is always prepared to
give Himself completely to His devotee. Even to one who is not a devotee,
Ka in His form of Lord Caitanya is prepared to give Himself and to grant
deliverance.
Although Ka is independent of everyone, out of His causeless mercy He
225
is dependent upon Garga i for religious instruction; for learning the military
art He is dependent upon Styaki; and for good counsel He is dependent upon
His friend Uddhava.
25. Devotees of Ka
A person who is always absorbed in Ka consciousness is called a devotee
of Ka. rla Rpa Gosvm says that all the transcendental qualities
discussed previously are also found in the devotees of Ka. The devotees of
Ka can be classified into two groups: those who are cultivating devotional
service in order to enter into the transcendental kingdom and those who are
already in the perfectional stage of devotional service.
A person who has attained the stage of attraction for Ka and who is not
freed from the material impasse, but who has qualified himself to enter into
the kingdom of God, is called sdhaka. Sdhaka means one who is cultivating
devotion in Ka consciousness. The description of such a devotee is found in
the Eleventh Canto, Second Chapter, verse 46, of rmad-Bhgavatam. It is
said there that a person who has unflinching faith in and love for the
Personality of Godhead, who is in friendship with devotees of Ka, sdhaka cultivating devotional service is
226
Bilvamagala hkura.
When a devotee is never tired of executing devotional service and is always
engaged in Ka conscious activities, constantly relishing the transcendental
mellows in relationship with Ka, he is called perfect. This perfectional
stage can be achieved in two ways: one may achieve this stage of perfection by
gradual progress in devotional service, or one may become perfect by the
causeless mercy of Ka, even though he has not executed all the details of
devotional service.
There is the following nice statement in the Third Canto, Fifteenth
Chapter, verse 25, of rmad-Bhgavatam, describing a devotee who achieves
perfection by regularly executing devotional service: A person who is freed
from the false egotism of material existence, or an advanced mystic, is eligible
to enter into the kingdom of God, known as Vaikuha. Such a mystic
becomes so joyful by constant execution of the regulative principles of
devotional service that he thereby achieves the special favor of the Supreme
Lord. Yamarja,hlda Mahrja said that no one can attain the perfectional stage of
devotional service without bowing down before exalted devotees. Learned
sages like Mrkaeya i attained perfection in devotional service simply by
executing such regulative principles of service.
A person's achieving perfection in devotional service simply by the
causeless mercy of the Lord is explained in rmad-Bhgavatam in connection
with the brhmaas and their wives who were engaged in performing yaja, or
227
sacrifice. When the wives of the brhmaas were favored by Lord Ka Ka, which is aspired after even by great mystics! How
wonderful it is that these women have attained such perfection, while we,
although brhmaas who have performed all the reformatory activities, cannot
attain to this advanced stage!"
There is a similar statement by Nrada, addressed to ukadeva Gosvm:
"My dear ukadeva Gosvm,."
ukadeva Gosvm and the wives of the brhmaas performing yaja are
vivid examples of devotees who achieved the perfectional stage of devotional
service by the grace of the Supreme Personality of Godhead.
Eternal Perfection
Persons who have achieved eternal, blissful life exactly on the level of r
Ka, and who are able to attract Lord Ka by their transcendental loving
service, are called eternally perfect. The technical name is nitya-siddha. There
are two classes of living entitiesnamely, nitya-siddha and nitya-baddha. The
distinction is that the nitya-siddhas are eternally Ka conscious without any
forgetfulness, whereas the nitya-baddhas, or eternally conditioned souls, are
forgetful of their relationship with Ka.
228
230
Ka's name is also Ka. Ka's fame is also Ka. Ka's entourage is
also Ka. Ka and everything related with Ka which gives stimulation
to love of Ka are all Ka, but for our understanding these items may be
considered separately.
Ka is the reservoir of all transcendental pleasure. Therefore, the
impetuses to love of Ka, although seemingly different, are not actually
distinct from Ka Himself. In the technical Sanskrit terms, such qualities as
Ka's name and fame are accepted both as reservoirs of and as stimulation
for love of Ka.
Ka's age is considered in three periods: from His appearance day to the
end of His fifth year is called kaumra, from the beginning of the sixth year up
to the end of the tenth year is called paugaa, and from the eleventh to the
end of the fifteenth year is called kaiora. After the beginning of the sixteenth
year, Ka is called a yauvana, or a youth, and this continues with no change.
As far as Ka's transcendental pastimes are concerned, they are mostly
executed during the kaumra, paugaa and kaiora periods. His affectionate
pastimes with His parents are executed during His kaumra age. His friendship
with the cowherd boys is exhibited during the paugaa period. And His
friendship with the gops is exhibited during the age of kaiora. Ka's
pastimes at Vndvana are finished by the end of His fifteenth year, and then
He is transferred to Mathur and Dvrak, where all other pastimes are
performed.
rla Rpa Gosvm gives us a vivid description of Ka as the reservoir of
all pleasure in his Bhakti-rasmta-sindhu. Here are some parts of that
description.
Ka's kaiora age may be divided into three parts. In the beginning of His
kaiora agethat is, at the beginning of His eleventh yearthe luster of His
body becomes so bright that it becomes an impetus for ecstatic love. Similarly,
there are reddish borders around His eyes, and a growth of soft hairs on His
body. In describing this early stage of His kaiora age, Kundalat, one of the
232
residents of Vndvana, said to her friend, "My dear friend, I have just seen an
extraordinary beauty appearing in the person of Ka. His blackish bodily
hue appears just like the indranla jewel. There are reddish signs on His eyes,
and small soft hairs are coming out on His body. The appearance of these
symptoms has made Him extraordinarily beautiful."
In this connection, in the Tenth Canto, Twenty-first Chapter, verse 5, of
rmad-Bhgavatam, ukadeva Gosvm tells King Parkit, "My dear King, I
shall try to describe how the minds of the gops became absorbed in thought of
Ka. The gops would meditate on Ka's dressing Himself just like a
dancing actor and entering the forest of Vndvana, marking the ground with
His footprints. They meditated on Ka's having a helmet with a peacock
feather and wearing earrings on His ears and yellow-gold colored garments
covered with jewels and pearls. They also meditated on Ka's blowing His
flute and on all the cowherd boys' singing of the glories of the Lord." That is
the description of the meditation which the gops used to perform.
Sometimes the gops would think about His soft nails, His moving eyebrows
and His teeth, which were catechu-colored from chewing pan. One
description was given by a gop to her friend: "My dear friend, just see how the
enemy of Agha has assumed such wonderful features! His brows are just like
the brows of Cupid, and they are moving just as though they were dancing.
The tips of His nails are so soft?"
Ka's attractive features are also described by Vnd, the gop after whom
Vndvana was named. She told Ka, "My dear Mdhava, Your newly
invented smile has so captivated the hearts of the gops that they are simply
unable to express themselves! As such, they have become bewildered and will
not talk with others. All of these gops have become so affected that it is as if
they had offered three sprinkles of water upon their lives. In other words, they
233
have given up all hope for their living condition." According to the Indian
system, when a person is dead there is a sprinkling of water on the body. Thus,
the statement of Vnd shows that the gops were so enchanted by the beauty
of Ka that because they could not express their minds, they had decided to
commit suicide.
When Ka arrived at the age of thirteen to fourteen years, His two arms
and chest assumed an unspeakable beauty, and His whole form became simply
enchanting. When Ka Ka? The special beauty of Ka's body was His mild smiling, His
restless eyes and His world enchanting songs. These are the special features of
this age.
There is a statement in this connection that Ka, Ka enjoyed the rsa-ll, exhibiting His power of joking with
the cowherd girls and enjoying their company in the bushes of the gardens by
the bank of the Yamun.
In this connection there is the following statement: "Throughout the whole
tract of land known as Vndvana there were the footprints of Ka and the
gops, and in some places peacock feathers were strewn about. In some places
there were nice beddings in the bushes of the Vndvana gardens, and in some
places there were piles of dust due to the group-dancing of Govinda and the
gops." These are some of the features which are due to the different pastimes
invented by r Ka in the place known as Vndvana.
234
Vndvana. While Ka was engaged in enjoyment with the boys and girls
within the forest of Vndvana, Kasa used to send his associates to kill
Ka, and Ka would show His prowess by killing them.
Ka. She praised His blackish complexion, the reddish color of chewing pan
enhancing His beauty hundreds of times, the curling hair on His head, the
kukum(29) red spots on His body and the tilaka on His forehead.
His helmet, His earrings, His necklace, His four garments, the bangles on
His head, the rings on His fingers, His ankle bells and His flutethese are the
different features of Ka's ornaments. Ka, the enemy of Agha, always
looked beautiful with His incomparable helmet, His earrings made of
diamonds, His necklace of pearls, His bangles, His embroidered garments and
the beautiful rings on His fingers.
Ka is sometimes called vana-ml. Vana means "forest," and ml means
"gardener," so vana-ml refers to one who extensively uses flowers and
garlands on different parts of His body. Ka was dressed like this not only in
Vndvana but also on the Battlefield of Kuruketra. Seeing such colorful
dress and the garlands of different flowers, some great sages prayed, "Lord
Ka was going to the Battlefield of Kuruketra not to fight, but to grace all
of the devotees with His presence."
Ka's Flute
As far as His flute is concerned, it is said that the vibration of this
wonderful instrument was able to break the meditation of the greatest sages.
Ka was thus challenging Cupid by advertising His transcendental glories all
over the world.
There are three kinds of flutes used by Ka. One is called veu, one is
called mural, and the third is called va. Veu is very small, not more than
six inches long, with six holes for whistling. Mural is about eighteen inches
long with a hole at the end and four holes on the body of the flute. This kind
of flute produces a very enchanting sound. The va flute is about fifteen
inches long, with nine holes on its body. Ka used to play on these three
flutes occasionally when they were needed. Ka has a longer va, which is
238
Ka's Conchshell
Ka's conchshell is known as Pcajanya. This Pcajanya conch is also
mentioned in Bhagavad-gt. Ka sounded it before the Battle of Kuruketra.
239
Ka's Footprints
It is stated in rmad-Bhgavatam that when Akrra, who drove Ka from
Vndvana to Mathur, saw the footprints of Ka on the land of Vndvana,
his ecstatic love for Kaops when they were going to the
bank of the Yamun and saw Ka's footprints in the dust. When Ka
walked on the ground of Vndvana, the marks of His sole (flag, thunderbolt,
fish, a rod for controlling elephants, and a lotus flower) would be imprinted
upon the dust of the land. The gops became overwhelmed simply at seeing
those marks on the ground.
240
Lord Ka is very fond of tulas leaves and buds. Because tulas buds are
usually offered up to the lotus feet of Ka, a devotee once prayed to the
tulas buds to give him some information about the lotus feet of the Lord. The
devotee expected that the tulas buds would know something about the glories
of Lord r Ka's lotus feet.
Ka's Devotees
One may sometimes become overwhelmed with joy by seeing a devotee of
the Lord. When Dhruva Mahrja saw two associates of Nryaa
approaching him, he immediately stood up out of sincere respect and devotion
and remained before them with folded hands; but because of his ecstatic love,
he could hardly offer them a proper reception.
There is a statement by a gop who addressed Subala, a friend of Ka: "My
dear Subala, I know that Ka is your friend and that you always enjoy
smiling and joking with Him. The other day I saw you both standing together.
You were keeping your hand upon Ka's shoulder, and both of you were
joyfully smiling. When I saw the two of you standing like that in the distance,
my eyes at once became overflooded with tears."
Dancing
While watching the rsa dance performed by Lord Ka and the gops,
Lord iva beheld the beautiful face of Ka and immediately began to dance
and beat upon his small diima drum. While Lord iva was dancing in
ecstasy, his eldest son, Gaea, joined him.
Not only is he a learned scholar and sinless, but he is also a devotee of Lord
Ka. He has such ecstatic love for Ka that I have seen him rolling upon
Ka's footprints in the dust as if bereft of all sense." Similarly, one gop gave
a message to Ka that Rdhr, because of Her separation from Him and
because of Her enchantment with the aroma of His flower garlands, was
rolling on the ground, thereby bruising Her soft body.
Singing Loudly
One gop informed Ka that when rmat Rdhr was singing about
His glories, She enchanted all of Her friends in such a way that they became
stonelike and dull. At the same time, the nearby stones began to melt away in
ecstatic love.
When Nrada Muni was chanting the Hare Ka mantra, he chanted so
loudly that it was apprehended that Lord Nsiha had appeared. Thus all the
demons began to flee in different directions.
Crying Loudly
A gop once said to Ka, "My dear son of Nanda Mahrja, by the sound
of Your flute rmat Rdhr has become full of lamentation and fear, and
thus, with a faltering voice, She is crying like a kurar bird."
243
Yawning
It is said that when the full moon rises, the lotus petals become expanded.
Similarly, when Ka used to appear before Rdhr, Her face, which is
compared to the lotus flower, would expand by Her yawning.
Breathing Heavily
As far as breathing heavily is concerned, it is stated, "Lalit [one of the
gops] is just like a ctak bird, which only takes water falling directly from the
rain cloud and not from any other source." In this statement Ka is
compared to the dark cloud, and Lalit is compared to the ctak bird seeking
only Ka's company. The metaphor continues to say, "As a heavy wind
sometimes disperses a mighty cloud, so the heavy breath from Lalit's nostrils
caused her to miss Ka, who had disappeared by the time she recovered
herself."
Drooling
As an example of the running down of saliva from the mouth, it is stated
that sometimes when Nrada Muni was chanting the Hare Ka mantra, he
remained stunned for a while, and saliva oozed from his mouth.
245
Belching
Sometimes belching also becomes a symptom of ecstatic love for Ka.
There is evidence of this in Paurams's address to one crying associate of
Rdhr: "My dear daughter, don't be worried because rmat Rdhr is
belching. I am about to offer a remedial measure for this symptom. Do not cry
so loudly. This belching is not due to indigestion; it is a sign of ecstatic love for
Ka. I shall arrange to cure this belching symptom immediately. Don't be
worried." This statement by Paurams is evidence that ecstatic love for
Ka is sometimes manifested through belching.
Sometimes trembling of the whole body and hemorrhaging from some part
of the body are also manifested in response to ecstatic love for Ka, but such
symptoms are very rare, and therefore rla Rpa Gosvm does not discuss
any further on this point..
When Uddhava was describing Ka's pastimes to Vidura, he said, "One
day the gops became stunned when Ka, in the dress of a gardening maid,
entered the greenhouse and enlivened them with joking and laughter. Then
when Ka left the greenhouse, the gops were seeing Ka so ecstatically
that it was as though both their minds and eyes were following Him." These
symptoms signify that although the gops' business was not finished, they had
become stunned with ecstatic love.
Another example of being stunned took place when Ka was surrounded
by various wrestlers in the sacrificial arena of Kasa. His mother, Devak(30),
then became stunned, and her eyes dried up when she saw Ka among the
wrestlers.
There is also an example of the astonishment of Lord Brahm. It is
explained in the Tenth Canto, Thirteenth Chapter, verse 56, of
rmad-Bhgavatam, that when Brahm understood that this cowherd boy was
the Supreme Personality of Godhead Himself, he became stunned. All of his
sensory activities stopped when he saw all the cowherd boys again, along with
Ka. Lord Brahm was so stunned that he appeared to be a golden statue
248
with four heads. Also, when the residents of Vraja found that Ka had lifted
Govardhana Hill with His left hand, they became stunned.
Astonishment caused by lamentation was exemplified when Ka was
entering into the belly of the Baksura demon and all the demigods from
higher planets became stunned with lamentation. A similar example of
becoming stunned was visible in Arjuna when he saw that Avatthm was
attempting to release his brahmstra(31) at Ka.
Perspiring
An example of perspiring because of jubilation is described in
rmad-Bhgavatam. One gop addressed Rdhr thus: "My dear Rdhr,
You are rebuking the sunshine unnecessarily, but I can understand that You
are perspiring only because of Your becoming too lusty at seeing Ka."
Perspiration caused by fearfulness was exhibited by Raktaka, one of the
servants of Ka. One day Ka dressed Himself just like Abhimanyu, the
husband of Rdhr. Abhimanyu did not like Rdhr's association with
Ka, and therefore when Raktaka saw Ka in the dress of Abhimanyu and
thus mistook His identity, he began to strongly rebuke Him. As soon as
Raktaka finally understood that it was Ka in the dress of Abhimanyu, he
began perspiring. This perspiration was caused by fearfulness.
Perspiration due to anger was exhibited by Garua, the eagle who is the
carrier of Viu. Once the heavenly king, Indra, was sending torrents of rain
over Vndvana. Garua was observing the incident from above the clouds,
and because of his anger, he began perspiring.
found within Ka's mouth all of the universal planetary systems. She had
asked Ka to open His mouth wide just to see whether He had eaten dirt.
But when Ka opened His mouth, she saw not only the entire earth, but also
many other planets within His mouth. This caused a standing up of the hair
on her body.
The standing up of hair on the body resulting from jubilation is described
in the Tenth Canto, Thirtieth Chapter, verse 10, of rmad-Bhgavatam, in
connection with the gops engaged in the rsa dance. During this rsa dance
Ka disappeared all of a sudden with Rdhr, and the gops began to
search Him out. At that time they addressed the earth and said, "Dear earthly
planet, how many austerities and penances you must have undergone to have
the lotus feet of Kamana or since you were delivered by the incarnation
Varha?"
Ka would sometimes perform mock fighting along with the cowherd
boys. When Ka blew His horn in this mock fighting, rdm, who was on
the opposing side, felt his bodily hairs stand up. Similarly, when Arjuna saw
Ka in His gigantic universal form, there was a standing of the hairs on his
body.
Trembling
When Ka was trying to capture the demon akha, Rdhr began
trembling out of fearfulness. Similar trembling of the body was exhibited in
Sahadeva, the younger brother of Nakula. When iupla was vehemently
blaspheming the Lord, Sahadeva began to tremble out of anger.
Trembling of the body was also exhibited by Rdhr out of tribulation.
Rdhr trembled as She told one of the gops, "Don't joke with this
disappointing boy! Please ask Him not to approach Me, because He is always
the cause of all grief for us."
251mi, the first queen of Ka in Dvrak, was
shedding tears out of ecstatic jubilation, she did not like the tears. There is a
passage in the Hari-vaa wherein Satyabhm begins to shed tears because of
her great affection for Ka.
An example of shedding tears because of anger was exhibited by Bhma
when he saw that iupla was insulting Ka in the Rjasya arena of
sacrifice. Bhma wanted to kill iupla immediately, but because Ka did
not order him to do so, he became morose with anger. It is described that there
252
were hot tears covering his eyes, as a thin cloud sometimes covers the evening
moon. In the evening, when the moon is slightly covered by a thin cloud, it
looks very nice, and when Bhma was shedding tears on account of his anger,
he also looked very nice.
In the Tenth Canto of rmad-Bhgavatam, Sixtieth Chapter, verse 23,
there is a nice example of Rukmi's shedding tears of lamentation. When
Ka and Rukmi were talking, Rukmi became frightened of separation
from Ka, and therefore she began scratching the earth with her red,
lotuslike nails. Because she was shedding tears, the black ointment from her
eyes was dripping, along with the tears, onto her breasts, which were covered
with kukum powder. Rukmiops were searching after Ka and all of a sudden He came out from the
bushes and creepers, all of them became stunned and almost senseless. In this
state the gops appeared very beautiful. This is an example of pralaya, or
devastation, in happiness.
There are also instances of pralaya in distress. One such example is
described in the Tenth Canto, Thirty-ninth Chapter, verse 15, of
rmad-Bhgavatam, wherein ukadeva Gosvm tells King Parkit, "My dear
King, when the gops were missing Ka, they were so much absorbed in
meditation upon Him that all of their senses stopped functioning, and they
lost all bodily sense. It was as though they had become liberated from all
material conditions."
253
rla Rpa Gosvm remarks that when various symptoms become manifest
very prominently, the devotee's condition may be called the brightest. For
example, a friend of Ka addressed Him as follows: "My dear Ptmbara,
because of separation from You all the residents of Goloka Vndvana are
perspiring. They are lamenting with different words, and their eyes have
become moistened with tears. Actually, all of them are in great confusion."
There is a supreme symptom of ecstatic love which is called mahbhva.
This mahbhva expression was possible only in Rdhr, but later on when
r Ka Caitanya appeared to feel the mode of love of Rdhr, He also
expressed all of the symptoms of mahbhva. r Rpa Gosvm says in this
connection that when the symptoms of ecstatic love become the most bright,
that stage is accepted as mahbhva.
rla Rpa Gosvm further analyzes the ecstatic loving expression into
four divisions which are called sttvikbhs.
Sometimes impersonalists, who are not actually in devotional service, may
also exhibit such symptoms of ecstatic love, but this is not accepted as actual
ecstasy. It is a reflection only. For example, sometimes in Vras, a holy city
for impersonalist scholars, there may be seen a sannys crying from hearing
the glories of the Lord. Impersonalists also sometimes chant the Hare Ka
mantra and dance, but their aim is not to serve the Lord. It is to become one
with the Lord and merge into His existence. Rpa Gosvm therefore says that
even if the reactions to chanting are manifested in the impersonalist's body,
they should not be considered to be symptoms of actual attachment, but
reflections only, just like the sun reflected in a dark room through some
polished glass. The chanting of Hare Ka, however, is so nice and
transcendental that it will eventually melt even the hearts of persons who are
impersonalists. Rpa Gosvm says that the impersonalists' symptoms are
simply reflections of ecstatic love, not the real thing.
Sometimes it is found that when staunch logicians, without any trace of
devotional service and without actually understanding the transcendental
256
Kapa Gosvm gives some instances where there is no actual devotional
service and such expressions are manifested.
257
Disappointment.
When Ka, in punishing the Kliya serpent, appeared to have drowned
Himself in the poisonous water of the Yamun, Nanda Mahrja addressed
Yaod-dev thus: "My dear wife, Ka has gone deep into the water, and so
there is no longer any need to maintain our bodies, which are so full of sinful
activities! Let us also enter into the poisonous water of the Yamun and
compensate for the sinful activities of our lives!" This is an instance of severe
shock, wherein the devotee becomes greatly disappointed.
When Ka left Vndvana, Subala, His intimate friend, decided to leave
also. While leaving, Subala was contemplating that without Ka there was
no longer any pleasure to be found in Vndvana. The analogy is given that as
the bees go away from a flower that has no honey, Subala left Vndvana
when he found that there was no longer any relishable transcendental
pleasure there.
In Dna-keli-kaumud rmat Rdhr addresses one of Her friends in
this manner: "My dear friend, if I cannot hear of the glorious activities of
Ka, it is better for Me to become deaf. And because I am now unable to see
Him, it would be good for Me to be a blind woman." This is another instance of
disappointment due to separation from Ka.
There is a statement in the Hari-vaa wherein Satyabhm, one of the
queens of Ka in Dvrak, tells her husband, "My dear Ka, since I heard
Nrada glorifying Rukmi before You, I can understand that there is no need
of any talking about myself!" This is an instance of disappointment caused by
258
Lamentation
When one is unsuccessful in achieving his desired goal of life, when one
finds no fulfillment in his present occupation, when one finds himself in
reversed conditions and when one feels guiltat such a time one is said to be
in a state of lamentation.
In this condition of lamentation one becomes questioning, thoughtful,
tearful, regretful and heavy-breathed. His bodily color changes, and his mouth
becomes dry.
One aged devotee of Ka addressed Him in this way: "My dear Ka, O
killer of the demon Agha, my body is now invalid due to old age. I cannot
speak very fluently, my voice is faltering, my mind is not strong, and I am
often attacked by forgetfulness. But, my dear Lord, You are just like the
259
moonlight, and my only real regret is that for want of any taste for Your
pleasant shining I did not advance myself in Ka consciousness." This
statement is an instance of lamentation due to one's being unable to achieve
his desired goal.
One devotee said, "This night I was dreaming of collecting various flowers
from the garden, and I was thinking of making a garland to offer to Ka. But
I am so unfortunate that all of a sudden my dream was over, and I could not
achieve my desired goal!" This statement is an instance of lamentation
resulting from nonfulfillment of one's duties.
When Nanda Mahrja saw his foster son Ka embarrassed in the
sacrificial arena of Kasa, he said, "How unfortunate I am that I did not keep
my son bolted within a room. Unfortunately, I have brought Him to Mathur,
and now I see that He's embarrassed by this giant elephant named Kuvalaya. It
is as though the moon of Ka were eclipsed by the shadow of the earth." This
is an instance of lamentation caused by reversed conditions.
In the Tenth Canto, Fourteenth Chapter, verse 9, of the
rmad-Bhgavatam there is a statement by Brahm: "My dear Lord, just see
my impudence! You are the unlimited, the original Personality of Godhead,
the Supersoulandhm is an instance of lamentation caused by committing
an offense.
Humility
A sense of weakness caused by distress, fear or offensiveness is called
260
them begged Ka not to commit this injustice upon them. The gops
addressed Him thus: "Dear Ka, we know that You are the son of Nanda
Mahrja and that You are the most beloved of all Vndvana. And You are
very much loved by us also! But why are You giving us this trouble? Kindly
return our garments. Just see how we are trembling from the severe cold!" This
humility was due to their shyness from being naked before Ka.
Guilt
When a person blames himself for committing an inappropriate action, his
feeling is called guilt.
One day rmat Rdhr was churning yogurt for Ka. At that time
the jeweled bangles on Her hands were circling around, and She was also
chanting the holy name of Ka. All of a sudden She thought, "I am chanting
the holy name of Ka, and My superiorsMy mother-in-law and My
sister-in-lawmay hear Me!" By this thought Rdhr became overanxious.
This is an instance of feeling guilty because of devotion to Ka.
One day the beautiful-eyed rmat Rdhr entered into the forest to
collect some flowers to prepare a garland for Ka. While collecting the
flowers, She became afraid that someone might see Her, and She felt some
fatigue and weakness. This is an instance of guilty feelings caused by labor for
Ka.
There is a statement in Rasa-sudhkara that after passing the night with
Ka, Rdhr became so weak that She was unable to get up from bed.
When Ka took Her hand to help Her, Rdhr felt guilty about having
passed the night with Him.
Fatigue
262
One feels fatigue after walking a long distance, after dancing and after
sexual activity. In this kind of fatigue there is dizziness, perspiration, inactivity
of the limbs, yawning and very heavy breathing.
One day Yaod was chasing Ka in the yard after He had offended her.
After a while, Yaod became very fatigued, and therefore she was perspiring,
and her bunched hair became loosened. This is an instance of becoming
fatigued because of working too much.
Sometimes all of the cowherd friends of Ka, along with Balarma,
danced together in some ceremony. At these times the garlands on their necks
would move, and the boys would begin to perspire. Their whole bodies became
wet from their ecstatic dancing. This is an instance of fatigue caused by
dancing.
In rmad-Bhgavatam, Tenth Canto, Thirty-third Chapter, verse 20, it is
said that after enjoying love affairs with Ka by dancing, embracing and
kissing, the gops would sometimes become very tired, and Ka, out of His
causeless mercy and compassion, would smear their faces with His lotus hands.
This is an example of fatigue caused by laboring in the rsa dance.
Intoxication
When one becomes arrogant with false prestige due to drinking intoxicants
or being too lustful, the voice becomes faulty, the eyes become swollen, and
there are symptoms of redness on the body. There is a statement in the
Lalita-mdh ac! Why are
you laughing? I am now prepared to smash the whole universe, and I know
that Ka will not be angry with Me."*(32) Then He addressed Ka, "My
dear Ka, tell Me immediately why the whole world is trembling and why
263
the moon has become elongated! And O you members of the Yadu dynasty,
why are you laughing at Me? Please give Me back My liquors made of honey
from the kadamba flower!" rla Rpa Gosvm prays that Lord Balarma will
be pleased with all of us while He is thus talking just like an intoxicated
person.
In this state of intoxication, Balarma.
rla Rpa Gosvm does not describe further in this direction because there is
no necessity for such a discussion.
There is another description of the symptoms of intoxication in the person
of r Rdhr after She saw Ka. Sometimes She was walking hither and
thither, sometimes She was laughing, sometimes She was covering Her face,
sometimes She was talking without any meaning, and sometimes She was
praying to Her associate gops. Seeing these symptoms in Rdhr, the gops
began to talk among themselves: "Just see how Rdhr has become
intoxicated simply by seeing Ka before Her!" This is an instance of ecstatic
love in intoxication.
Pride
Expressions of ecstatic love in pride may be the result of excessive wealth,
exquisite beauty, a first-class residence or the attainment of one's ideal goal.
One is also considered proud when he does not care about the neglect of
others.
Bilvamagala hkura said, "My dear Ka, You are leaving me, forcibly
getting out of my clutches. But I shall be impressed by Your strength only
when You can go forcibly from the core of my heart." This is an instance of
264
265
Doubt
After Lord Brahm had stolen all of the calves, cows and cowherd boys
from Ka, he was trying to go away. But all of a sudden he became doubtful
about his stealing affairs and began to watch on all sides with his eight eyes.
Lord Brahm has four heads, and therefore he has eight eyes. This is an
instance of ecstatic love in doubt, caused by stealing.
Similarly, just to please Ka, Akrra stole the Syamantaka mai, a stone
which can produce unlimited quantities of gold, but later on he repented his
stealing. This is another instance of ecstatic love for Ka in doubt caused by
stealing.
When the King of heaven, Indra, was causing torrents of rain to fall on the
land of Vraja, he was advised to surrender himself at the lotus feet of Ka.
At that time Indra's face became very dark because of doubt.
Apprehension.
In the Padyval there is the following statement: "My dear friend, Ka's
residence in the demoniac circle at Mathur, under the supremacy of the king
of demons, Kasa, is causing me much worry." This is one instance of
apprehending some danger to Ka in ecstatic love for Him.
When Vsura appeared in Vndvana as a bull, all of the gops became
266
greatly affected with fear. Being perturbed in that way, they began to embrace
the tamla trees. This is an instance of fear caused by a ferocious animal and
of the search for shelter while remembering Ka in ecstatic love. Upon
hearing the jackals crying in the forest of Vndvana, mother Yaod
sometimes became very careful about keeping Ka under her vigilance,
fearing that Ka might be attacked by them. This is an instance of ecstatic
love for Ka in fear caused by a tumultuous sound. This kind of fear is a
little different from being actually afraid. When one is afraid of something, he
can still think of past and future. But when there is this kind of ecstatic
apprehension, there is no scope for such thinking.
Intense Emotion
Emotion is caused by something very dear, by something very detestable, by
fire, by strong wind, by strong rainfall, by some natural disturbance, by the
sight of a big elephant or
flee. and show various signs of
fear, and sometimes one may keep looking behind him. When there is emotion
due to the presence of an enemy, one looks for a fatal weapon and tries to
escape.
When Ka returned from the forest of Vndvana, mother Yaod was so
267
emotional from seeing her son that milk began to flow from her breasts. This is
an instance of emotion caused by seeing a dear object.
In the Tenth Canto, Twenty-third Chapter, verse 18, of
rmad-Bhgavatam, ukadeva Gosvm informs King Parkit, "My dear King,
the wives of the brhmaas were usually very much attached to the
glorification of Ka, and they were always anxious to get an opportunity to
see Him. Because of this, when they heard that Ka was nearby, they became
very anxious to see Him and immediately left their homes." This is an instance
of emotional activity caused by the presence of someone very dear.
When Ptan, the demoniac witch, was struck down and killed by Ka,
mother Yaod was struck with wonder and began to cry emotionally, "Oh,
what is this? What is this?" When she saw that her dear baby Ka was
playing on the chest of the dead demoniac woman, mother Yaod, at a loss
what to do, began to walk this way and that. This is an instance of being
emotional on account of seeing something ghastly.
When Ka uprooted the two arjuna trees and Yaod heard the sound of
the trees crashing down, she became overcome with emotion and simply stared
upward, being too bewildered to know what else to do. This is an instance of
being emotional from hearing a tumultuous sound.
When there was a forest fire in Vndvana, all the cowherd men assembled
together and desperately appealed to Ka for protection. This is an instance
of emotion caused by fire.
The whirlwind demon known as Tvarta once carried Ka off from the
ground and blew Him around, along with some very big trees. At that time,
mother Yaod could not see her son, and she was so disturbed that she began
to walk this way and that. This is an instance of emotion caused by severe
wind.
In the Tenth Canto, Twenty-fifth Chapter, verse 11, of
rmad-Bhgavatam, there is a description of Indra's causing severe torrents of
rain at Vndvana. All the cows and cowherd boys became so afflicted by the
268
wind and cold that they all gathered together to take shelter under the lotus
feet of Ka. This is an instance of emotion caused by severe rainfall.
There were severe torrents of hail when Ka was staying in the forest of
Vndvana, and the elderly persons bade Him, "Ka, don't You move now!
Even persons who are stronger and older than You cannot move, and You are
just a little boy. So please stay still!" This is an instance of emotion caused by
heavy hailing.
When Ka was chastising Kliya in the poisonous water of the Yamun,
mother Yaod began to speak emotionally: "Oh, see how the earth appears to
be trembling! There appears to be an earth tremor, and in the sky tears are
flying here and there! My dear son has entered into the poisonous water of the
Yamun. What shall I do now?" This is an instance of emotion resulting from a
natural disturbance.
In the arena of Kasa, when Ka was attacked by big elephants, all of the
ladies present began to address Him in this way: "My dear boyplease leave
this place immediately! Please leave this place immediately! Don't You see the
big elephants coming to attack You? Your innocent gazing upon them is
causing us too much perturbation!" Ka then told mother Yaod, "My dear
mother, don't be perturbed by the appearance of the elephants and horses that
are so forcibly coming and raising dust, causing blindness to these lotus-eyed
women. Let even the Ke demon come before Me; My arms will still be
adequate for victory. So please don't be perturbed."
In the Lalita-mdhava, a friend tells mother Yaod, "How wonderful it is
that when the akhaca demonvast and strong as a great hillattacked
your Cupid-like beautiful son, there was no one present in Vndvana to help.
And yet the demon was killed by your little son. It appears to be due to the
result of severe penances and austerities in your past lives that your son was
saved in this way."
In the same Lalita-mdhava there is an account of Ka's kidnapping
Rukmi at her royal marriage ceremony. At that time all of the princes
269
present began to converse among themselves, saying, "We have our elephants,
horses, chariots, bows, arrows and swords, so why should we be afraid of Ka?
Let us attack Him! He is nothing but a lusty cowherd boy! He cannot take
away the princess in this way! Let us all attack Him!" This is an instance of
emotion caused by the presence of enemies.
rla Rpa Gosvm is trying to prove by the above examples that in
relationship with Ka there is no question of impersonalism. All personal
activities are there in relationship with Ka.
Madness
rla Bilvamagala hkura prays in his book as follows: "Let rmat
Rdhr purify the whole world, because She has surrendered Herself
completely unto Ka. Out of Her ecstatic love for Him, She sometimes acted
just like an addled person and attempted to churn yogurt, although there was
no yogurt in the pot. And seeing this, Ka became so enchanted by
Rdhr that He began to milk a bull instead of a cow." These are some of
the instances of insanity or madness in connection with the love affairs of
Rdh and Ka. In rmad-Bhgavatam it is said that when Ka entered
the poisonous waters of the Yamun, rmat Yaod-dev went insane. Instead
of searching for curative herbs, she began to speak to the trees as if they were
snake chanters. With folded hands she began to bow down to the trees, asking
them, "What is the medicinal herb which can check Ka's dying from this
poisonous water?" This is an instance of insanity caused by some great danger.
How a devotee can be in a state of insanity because of ecstatic love is
described in the Tenth Canto, Thirtieth Chapter, verse 4, of
rmad-Bhgavatam, wherein the gops were searching for Ka in the forests
of Vndvana. The gops were loudly singing the glories of Ka and
wandering from one forest to another in search of Him. They knew that Ka
is not localized, but all-pervading. He is in the sky, He is in the water, He is in
270
the air, and He is the Supersoul in everyone's heart. Thus the gops began to
inquire from all kinds of trees and plants about the Supreme Personality of
Godhead. This is an instance of ecstatic madness on the part of devotees.
Similarly, there are symptoms of diseases caused by ecstatic love. This
condition is credited by learned scholars as being mahbhva. This highly
elevated condition is also called divyonmda, or transcendental madness.
Forgetfulness
When Ka was absent from Vndvana and was staying in Mathur,
rmat Rdhr sent news to Him that His mother, the Queen of Vra Ka are called apasmra, or
forgetfulness. One completely forgets his position when he manifests these
symptoms in ecstatic love.
Another message was once sent to Ka informing Him that after He had
killed Kasa, one of Kasa's demon friends had gone insane. This demon was
foaming at the mouth, waving his arms and rolling on the ground. This
demoniac demonstration is in relationship with Ka in a ghastly humor.
This mellow or flavor is one of the indirect relationships with Ka. The first
five kinds of relationships are called direct, and the other seven are called
indirect. Some way or other, the demon must have had some relationship with
Ka, because these symptoms developed when he heard that Ka had
already killed Kasa. rla Rpa Gosvm remarks that there is also
transcendental excellence in this kind of symptom.
271
Disease
When Ka was absent from Vndvana and was staying at Mathur, some
of His friends informed Him, "Dear Ka, because of their separation from
You, the inhabitants of Vraja are so afflicted that they appear to be diseased.
Their bodies are feverish, and they cannot move properly. They are simply
lying down on the ground and breathing heavily."
In the Tenth Canto, Twelfth Chapter, verse 44, of rmad-Bhgavatam,
Mahrja Parkit asked about Lord Ananta, and upon hearing this question,
ukadeva Gosvm began to show symptoms of collapsing. Yet he checked
himself and answered King Parkit's question in a mild voice. This collapsing
condition is described as a feverish state resulting from ecstatic pleasure.
There is another statement in rmad-Bhgavatam telling of the damsels of
Vraja meeting Ka at the sacred place of Kuruketra, many years after their
childhood pastimes. When they met in that sacred place, all the gops became
stunned by the occurrence of a solar eclipse. Their breathing, blinking of the
eyes and all similar activities stopped, and they stood before Ka just like
statues. This is another instance of a diseased condition resulting from
exuberant transcendental pleasure.
Confusion
There is the following statement in the Hasadta: "One day when
272
rmat Rdhr was feeling much affliction because of Her separation from
Ka, She went to the bank of the Yamun with some of Her friends. There
Rdhr saw a cottage wherein She and Ka had experienced many loving
pleasures, and by remembering those incidents She immediately became
overcome with dizziness. This dizziness was very prominently visible." This is
an instance of confusion caused by separation.
Similarly, there is a statement describing confusion caused by fearfulness.
These symptoms were exhibited by Arjuna when he saw Ka's universal
form on the Battlefield of Kuruketra. His confusion was so strong that his
bow and arrows fell from his hand and he could not perceive anything clearly.
Death
Once the Baksura demon assumed the shape of a very big duck and
opened his mouth in order to swallow Ka and all the cowherd boys. When
Ka was entering into the demon's mouth, Balarma and the other cowherd
boys almost fainted and appeared as though they had no life. Even if devotees
are illusioned by some ghastly scene or by any accidental occurrence, they
never forget Ka. Even in the greatest danger they can remember Ka.
This is the benefit of Ka consciousness: even at the time of death, when all
the functions of the body become dislocated, the devotee can remember Ka
in his innermost consciousness, and this saves him from falling down into
material existence. In this way Ka consciousness immediately takes one
from the material platform to the spiritual world.
In this connection there is a statement about persons who died at Mathur:
"These persons had a slight breathing exhilaration, their eyes were wide open,
the colors of their bodies were changed, and they began to utter the holy name
of Ka. In this condition they gave up their material bodies." These
symptoms are prior manifestations of death.
273
Laziness
When, because of self-satisfaction or dislike of excessive labor, a person
does not perform his duty in spite of having the energy, he is called lazy. This
laziness also is manifested in ecstatic love of Ka. For example, when some
brhmaas were requested by Nanda Mahrja to circumambulate
Govardhana Hill, they told him that they were more interested in offering
benedictions than in circumambulating Govardhana Hill. This is an instance
of laziness caused by self-satisfaction.
Once when Ka, along with His cowherd boyfriends, was having a mock
battle, Subala showed the symptoms of fatigue. Ka immediately told His
other friends, "Subala is feeling too fatigued from mock-fighting with Me. So
please do not disturb him any more by inviting him to fight." This is an
instance of laziness caused by dislike of excessive labor.
Inertness
In the Tenth Canto, Twenty-first Chapter, verse 13, of
rmad-Bhgavatam, there is an appreciation by the gops of the inertia of the
cows in Vndvana. The gops saw that the cows were hearing the sweet songs
vibrated by Ka's flute and were appearing to be drinking the nectar of these
transcendental sounds. The calves were stunned, and they forgot to drink the
milk from the milk bags. Their eyes seemed to be embracing Ka, and there
were tears in their eyes. This is an instance of inertia resulting from hearing
the transcendental vibrations of Ka's flute.
When Lakma became disturbed upon hearing words against Ka, she
remained inert and did not move her eyelids. This is another example of
inertia caused by hearing.
In
the
Tenth
Canto,
Seventy-first
274
Chapter,
verse
39,
of
Bashfulness
When Rdhr was first introduced to Ka, She felt very bashful. One
of Her friends addressed Her in this way: "My dear friend, You have already
275
sold Yourself and all Your beauty to Govinda. Now You should not be bashful.
Please look upon Him cheerfully. One who has sold an elephant to another
person should not make a miserly quarrel about selling the trident which
controls the elephant." This kind of bashfulness is due to a new introduction
in ecstatic love with Ka.
The heavenly King, Indra, upon being defeated in his fight with Ka for
possession of the prijta flower, became very bashful because of his defeat. He
was standing before Ka, bowing down his head, when Ka said, "All right,
Indra, you can take this prijta flower. Otherwise, you will not be able to
show your face before your wife, acdev." Indra's bashfulness was due to
defeat. In another instance, Ka began to praise Uddhava for his various
high qualifications. Upon being praised by Ka, Uddhava also bowed down
his head bashfully.
In the Hari-vaa, Satyabhm, feeling slighted by Rukmi's high
position, said, "My dear Ka, the Raivataka Mountain is always full of spring
flowers, but when I have become persona non grata to You, what is the use of
my observing them?" This is an instance of bashfulness resulting from being
defeated.
Concealment cryas expert in
the study of psychological activities, these attempts at hiding one's real
affections are another part of ecstatic feeling for Ka.
In the Tenth Canto, Thirty-second Chapter, verse 15, of
rmad-Bhgavatam, ukadeva Gosvm states, "My dear King, the gops were
276
always beautiful and decorated with confidential smiles and alluring garments.
In their movements, intended to give impetus to lusty feelings, they would
sometimes press Ka's hand on their laps, and sometimes they would keep
His lotus feet on their breasts. After doing this, they would talk with Ka as
if they were very angry with Him."
There is another instance of this concealment in ecstatic love. When
Ka, the supreme joker, planted the prijta tree in the courtyard of
Satyabhm, Rukmi, the daughter of King Vidarbha, became very angry, but
due to her natural gentle behavior, she did not express anything. No one could
understand Rukmi's real mental condition. This is an instance of
competitive concealment.
There is another instance in the First Canto, Eleventh Chapter, verse 32,
of rmad-Bhgavatam. After entering Dvrak, Ka was received in
different ways by different members of His family. Upon seeing their husband
from a distance, the queens of Dvrak immediately embraced Him within
their minds and slowly glanced over Him. As Ka came nearer, they pushed
their sons forward to embrace Him. Others were trying, out of shyness, not to
shed tears, but they still could not keep the tears from gliding down. This is an
instance of concealment caused by shyness.
On another occasion, when rmat Rdhr thought that Ka was
involved with another woman, She addressed Her friend in this manner: "My
dear friend, as soon as I think of Ka the cowherd boy attached to some
other woman, I become stricken with fear, and the hairs on My body stand up.
I must be very careful that Ka not see Me at such times." This is an instance
of concealment caused by shyness and diplomatic behavior.
It has been stated, "Although rmat Rdhr developed a deep loving
affection for Ka, She hid Her attitude in the core of Her heart so that
others could not detect Her actual condition." This is an instance of
concealment caused by gentleness.
Once when Ka and His cowherd friends were enjoying friendly
277
Remembrance
There are many symptoms of ecstatic love caused by remembering Ka.
For example, one friend of Ka informed Him, "My dear Mukunda, just after
observing a bluish cloud in the sky, the lotus-eyed Rdhr immediately
began to remember You. And simply by observing this cloud She became lusty
for Your association." This is an instance of remembering Ka in ecstatic
love because of seeing something resembling Him. Ka's bodily complexion
is very similar to the bluish hue of a cloud, so simply by observing a bluish
cloud, rmat Rdhr remembered Him.
One devotee said that even when he was not very attentive he would
sometimes, seemingly out of madness, remember the lotus feet of Ka within
his heart. This is an instance of remembrance resulting from constant
practice. In other words, devotees who are constantly thinking of the lotus
feet of Ka, even if they are momentarily inattentive, will see the figure of
Lord Ka appearing within their hearts.
Argumentativeness
Madhumagala was an intimate friend of Ka coming from the brhmaa
community. Ka's friends were mostly cowherd boys belonging to the vaiya
community, but there were others who belonged to the brhmaa community.
Actually, in Vndvana the vaiya community and the brhmaa community
278
Anxiety
In the Tenth Canto, Twenty-ninth Chapter, verse 29, of
rmad-Bhgavatam, when Ka asked all the gops to go back to their homes,
they did not like it. Because of their grief at this, they were sighing heavily,
and their beautiful faces appeared to be drying up. In this condition they
remained, without making a sound. They began to draw lines on the ground
with their toes, and with their tears they washed the black ointment from
their eyes onto their breasts, which were covered with red kukum powder.
This is an instance of anxiety in ecstatic love.
One of the friends of Ka once informed Him, "My dear killer of the
demon Mura, Your kind and gentle mother is very anxious because You have
not returned home, and with great difficulty she has passed the evening
279
Thoughtfulness
In the Vaikha-mhtmya section of the Padma Pura a devotee states
that though in some of the eighteen Puras the process of glorifying Lord
Viu is not mentioned and the glorifying of some demigod is offered, such
glorification must be continued for millions of years. For when one studies the
Puras very scrutinizingly, he can see that ultimately Lord Viu is the
Supreme Personality of Godhead. This is an instance of ecstatic love
developed out of thoughtfulness.
In the Tenth Canto, Sixtieth Chapter, verse 39, of rmad-Bhgavatam,
there is an account of Rukmidev's writing a letter to Ka requesting Him
to kidnap her before her marriage to another person. At that time the specific
attachment of Rukmi for Ka was expressed by Rukmi as follows: "My
dear Lord Ka, Your transcendental glories are chanted by great sages who
are free from material contamination, and in exchange for such glorification
You are so kind that You freely distribute Yourself to such devotees. As one
can elevate oneself simply by Your grace, so also by Your direction alone one
may be lost to all benedictions, under the influence of eternal time. Therefore
I have selected Your Lordship as my husband, brushing aside personalities like
Brahm and Indranot to mention others." Rukmi enhanced her love for
280
Endurance
When a person is fully satisfied due to attaining knowledge, transcending
all distress or achieving his desired goal of life in transcendental devotional
service to God, his state of endurance or steady-mindedness is called dhti. At
this stage one is not perturbed by any amount of loss, nor does anything
appear to be unachieved by him.
According to the opinion of Bharthari, a learned scholar, when a person is
elevated to this state of endurance, he thinks as follows: "I do not wish to be a
highly posted government servant. I shall prefer to remain naked, without
proper garments. I shall prefer to lie down on the ground without any
mattress. And despite all these disadvantages, I shall refuse to serve anyone,
even the government." In other words, when one is in ecstatic love with the
Personality of Godhead, he can endure any kind of disadvantages calculated
under the material concept of life.
Nanda Mahrja, the father of Ka, used to think, "In my pasturing
ground the goddess of fortune is personally present, and I possess more than
ten hundred thousand cows, which loiter here and there. And above all, I
have a son like Ka, who is such a powerful, wonderful worker. Therefore,
even though I am a householder, I am feeling so satisfied!" This is an instance
of mental endurance resulting from the absence of all distress. Ka
281
consciousness.
Happiness
It is described in the Viu Pura that when Akrra came to take Ka
and Balarma to Mathur, just by seeing Their faces he became so cheerful
that all over his body there were symptoms of ecstatic love. This state is called
happiness.
It is stated in the Tenth Canto, Thirty-third Chapter, verse 11, of
rmad-Bhgavatam, "Upon seeing that Ka's arm was placed on her
shoulder, one of the gops engaged in the rsa dance became so ecstatically
happy that she kissed Ka on His cheek." This is an instance of feeling
happiness because of achieving a desired goal.
Eagerness
In the Tenth Canto, Seventy-first Chapter, verse 33, of
rmad-Bhgavatam, it is said, "When Ka first came from His kingdom,
Dvrak, to Indraprastha(34), Ka." This is an instance of eagerness in ecstatic love.
In his book Stavval, r Raghuntha dsa Gosvm has prayed for the
mercy of Rdhr, who was so captivated by the flute vibrations of Ka
that She immediately asked information of His whereabouts from residents in
the Vndvana forest. Upon first seeing Ka, She was filled with such
ecstatic love and pleasure that She began to scratch Her ears. The damsels of
282
Vraja and Rdhr were very expert in talking cunningly, so as soon as they
saw Ka they began their talkings; and Ka, pretending to go for some
flowers for them, immediately left that place and entered into a mountain
cave. This is another instance of eager loving exchanges on the parts of both
the gops and Ka.
Violence
When Ka was fighting with the Kliya snake by dancing on his heads,
Kliya bit Ka on the leg. At that time Garua became infuriated and began
to murmur, "Ka is so powerful that simply by His thundering voice the
wives of Kliya have had miscarriages. Ka.
When iupla objected to the worship of Ka in the Rjasya arena at a
sacrifice organized by Mahrja Yudhihira, Sahadeva, the younger brother of
Arjuna, said, "A person who cannot tolerate the worship of Ka is my enemy
and is possessed of a demoniac nature. Therefore I wish to strike my left foot
upon his broad head, just to punish him more strongly than the wand of
Yamarja!" Then Baladeva began to lament like this: "Oh, all auspiciousness to
Lord Ka! I am so surprised to see that the condemned descendants of the
Kuru dynasty, who so unlawfully occupied the throne of the Kuru kingdom,
are criticizing Ka with diplomatic devices. Oh, this is intolerable!" This is
another instance of eagerness caused by dishonor to Ka.
criticize Ka in this way: "Ka, You are standing here, and Rdhr, Ka.
Similarly, some of the gops once began to address Ka with these
dishonorable words: "My dear Ka, You are a first-class thief. So please leave
this place immediately. We know You love Candrval more than us, but there
is no use in praising her in our presence! Kindly do not contaminate the name
of Rdhr in this place!" This is another instance of dishonorable words
cast upon Ka in ecstatic love.
There is another statement in the Tenth Canto, Thirty-first Chapter, verse
16, of rmad-Bhgavatam. When all the gops came out of their homes to meet
Ka in the Vndvana forest, Ka refused to accept them and asked them
to go home, giving them some moral instruction. At that time the gops spoke
as follows: "Dear Ka, Ka in ecstatic love.
Envy
In the Padyval, one of the friends of Rdhr once addressed Her thus:
"My dear friend, please do not be too puffed up because Ka has decorated
284
Your forehead with His own hand. It may be that Ka is yet attracted by
some other beautiful girl. I see that the decoration on Your forehead is very
nicely made, and so it appears that Ka was not too disturbed in painting it.
Otherwise, He could not have painted such exact lines!" This is an instance of
envy caused by Rdh's good fortune.
In the Tenth Canto, Thirtieth Chapter, verse 30, of rmad-Bhgavatam,
there is the following statement: "When the gops were searching for Ka
and Rdh after the rsa dance, they thus began to speak among themselves:
'We have seen the footprints of Ka and Rdh on the ground of
Vndvana, and they are giving us great pain, because although Ka is
everything to us, that girl is so cunning that She has taken Him away alone
and is enjoying His kissing without sharing Him with us!' " This is another
instance of envy of the good fortune of rmat Rdhr.
Sometimes when the cowherd boys used to play in the forests of
Vndvana, Ka would play on one side, and Balarma would play on
another. There would be competition and mock fighting between the two
parties, and when Ka's party was defeated by Balarma, the boys would say,
"If Balarma's party remains victorious, then who in the world can be weaker
than ourselves?" This is another instance of envy in ecstatic love.
Impudence
In the Tenth Canto, Fifty-second Chapter, verse 41, of rmad-Bhgavatam,
Rukmi addresses a letter to Ka as follows: "My dear unconquerable Ka,
my marriage day is fixed for tomorrow. I request that You come to the city of
Vidarbha without advertising Yourself. Then have Your soldiers and
commanders suddenly surround and defeat all the strength of the King of
Magadha, and by thus adopting the methods of the demons, please kidnap and
marry me."
According to the Vedic system there are eight kinds of marriages, one of
285
Dizziness
Every evening at sunset Ka used to return from the pasturing ground
where He herded cows. Sometimes when mother Yaod could not hear the
sweet vibration of His flute she would become very anxious, and because of
this she would feel dizzy. Thus, dizziness caused by anxiety in ecstatic love for
Ka is also possible.
When Yaod had tied Ka up one time, she began to think, "Ka's
body is so soft and delicate. How could I have tied Him with rope?" Thinking
this, her brain became puzzled, and she felt dizziness.
The gops were advised by their superiors to bolt the doors at night, but
they were so carefree that they did not carry out this order very rigidly.
Sometimes, by thinking of Ka, they became so confident of being out of all
danger that they would lie down at night in the courtyards of their houses.
This is an instance of dizziness in ecstatic love due to natural affection for
Ka.
It may be questioned why devotees of Ka should be attacked by dizziness,
which is usually considered a sign of the mode of ignorance. To answer this
question, r Jva Gosvm has said that the devotees of Lord Ka are always
transcendental to all the modes of material nature; when they feel dizziness or
286
go to sleep, they are not considered to be sleeping under the modes of nature,
but are accepted as being in a trance of devotional service. There is an
authoritative statement in the Garua Pura about mystic yogs who are
under the direct shelter of the Supreme Personality of Godhead: "In all three
stages of their consciousnessnamely wakefulness, dreaming and deep
sleepthe devotees are absorbed in thought of the Supreme Personality of
Godhead. Therefore, in their complete absorption in thought of Ka, they
do not sleep."
Sleepiness
Once Lord Baladeva began to talk in His sleep as follows:"O lotus-eyed
Ka, Your childhood adventures are manifest simply according to Your own
will. Therefore, please immediately dispose of the stubborn pride of this Kliya
serpent." By saying this, Lord Baladeva astonished the assembly of the Yadus
and made them laugh for some time. Then, yawning so hard as to make ripples
on His abdomen, Lord Baladeva, the bearer of the plow, returned to His deep
sleep. This is an instance of sleepiness in ecstatic love.
Alertness
A devotee once stated, "I have already conquered the mode (e.g.,
287
standing of the hair on the body, rolling of the eyeballs and getting up from
sleep) are persistently visible.
When rmat Rdhr first saw Ka, She suddenly became conscious
of all transcendental happiness, and the functions of Her different limbs were
stunned. When Lalit, Her constant companion, whispered into Her ear the
holy name of Ka, Rdhr immediately opened Her eyes wide. This is an
instance of alertness caused by hearing the sound of Ka's name.
One day, in a joking mood, Ka informed Rdhr, "My dear
Rdhr, I am going to give up Your company." Upon saying this, He
immediately disappeared, and because of this Rdhr became so afflicted
that the hue of Her body changed, and She immediately fell down upon the
ground of Vndvana. She had practically stopped breathing, but when She
smelled the flavor of the flowers on the ground, She awoke in ecstasy and got
up. This is an instance of transcendental alertness caused by smelling.
When Ka was touching the body of one gop, the gop addressed her
companion thus: "My dear friend, whose hand is this touching my body? I had
become very afraid after seeing the dark forest on the bank of the Yamun,
but suddenly the touch of this hand has saved me from hysterical fits." This is
an instance of alertness caused by touching.
One of the gops informed Ka, "My dear Ka, when You disappeared
from the arena of the rsa dance, our most dear friend, Rdhr,
immediately fell on the ground and lost consciousness. But after this, when I
offered Her some of Your chewed betel nut remnants, She immediately
returned to consciousness with jubilant symptoms in Her body." This is an
instance of alertness caused by tasting.
One night rmat Rdhr was talking in a dream. "My dear Ka,"
288
Her. Thus Rdhr became ashamed and bowed Her head. This is an
instance of alertness after awakening from sleep.
There is another instance of this. A messenger from Ka came to rmat
Rdhr while She was sleeping, and Rdhr immediately awakened.
Similarly, when Ka began to blow on His flute in the night, all of the gops,
the beautiful daughters of the cowherd men, immediately got up from their
sleep. There is a very beautiful comparison made in this connection: gops' sleeping condition is compared to the white swans,
and the sound of Ka's flute is compared to a black wasp. When Ka's flute
sounded, the white swans, which represent the sleeping condition of the gops,
were immediately vanquished, and the black wasp sound of the flute began to
enjoy the lotus flower of the gops' beauty.
equivalents for many Sanskrit words used here, his analysis will now be
presented.
When one becomes malicious upon seeing another's advancement of life,
his state of mind is generally called envy. When one becomes frightened at
seeing a lightning bolt in the sky, that fearfulness brings on anxiety.
Therefore, fearfulness and anxiety may be taken as one. One's desire to hide
his real mentality is called avahitth, or concealment, and a desire to exhibit
superiority is called pride. Both of these may be classified under pretension. In
a pretentious attitude both avahitth and pride are to be found. One's inability
to tolerate an offense committed by another is called amara, and one's
inability to tolerate the opulence of another is called jealousy. Jealousy and
amara are both caused by intolerance. One's ability to establish the correct
import of a word may be called conclusiveness. And before such a conclusive
determination of import, there must be thoughtful consideration. Therefore,
the act of consideration is present during the establishment of a conclusion.
When one presents himself as ignorant, his attitude is called humility, and
when there is absence of enthusiasm it is called cowardice. Therefore, in
humility, there is sometimes cowardice also. When the mind is steadfast it is
called enduring, and one's ability to tolerate others' offenses is also called
endurance. Therefore, forgiveness and endurance can be synonymous.
Anxiousness for time to pass.
When all such symptoms are included in ecstatic love, they are called
sacr, or continuously existing ecstatic symptoms. All of these symptoms are
290
one pebble called Govardhana Hill, but what is more surprising than that is
your statement that this boy is the Personality of Godhead!" This is an
instance of a maliciously opposing element, caused by hopelessness in ecstatic
love for Ka.
One devotee tried to console a kadamba tree when the tree was lamenting
because Ka had not touched even its shadow. The devotee said, "My dear
kadamba tree, do not be worried. Just after defeating the Kliya snake in the
Yamun River, Ka will come and satisfy your desire." This is an instance of
inappropriate hopelessness in ecstatic love for Ka.
Garua the eagle, the carrier of Viu, once said, "Who can be more pure
than I? Where is there a second bird like me, so able and competent? Ka
may not like me, He may not wish to join my party, but still He has to take
advantage of my wings!" This is an instance of hopelessness in the neutral
mood of ecstatic love.
The symptoms of ecstatic love are sometimes grouped under four
headingsnamely generation, conjunction, aggregation and satisfaction.
Ka once told Rdhr, "My dear friend, when You tried to meet Me
alone in the morning, Your friend Mekhal remained hungry with envy. Just
look at her!" When Ka was joking with Rdhr in this way, Rdhr
moved Her beautiful eyebrows crossly. Rpa Gosvm prays that everyone may
become blessed by this movement of rmat Rdhr's eyebrows. This is an
instance of the generation of malice in ecstatic love of Ka.
One night, after the Ptan demon had been killed, baby Ka could be
seen playing upon her breast. Upon seeing this, Yaod became stunned for
some time. This is an example of a conjunction of various symptoms of ecstatic
love. The conjunction can be auspicious or inauspicious. That the Ptan
demon had been killed was auspicious, but that Ka was playing on her
breast in the dead of night, with no one to help Him in case of trouble, was
inauspicious. Yaod was caught between auspiciousness and inauspiciousness.
After Ka had just learned to walk, He was going in and out of the house
293
very frequently. Yaod became surprised and said, "This child is too restless
and cannot be controlled! He is incessantly going about the neighborhood of
Gokula [Vndvana], Yaod was becoming fearful of some danger. Here danger is the
cause, and Yaod's feelings are in a conjunction of two opposing symptoms. In
other words, Yaod was feeling both happiness and doubt, or growing fear.
When Devak, the mother of Ka, saw her son very jubilant in the
presence of the wrestlers in Kasa's arena, two kinds of tears were
simultaneously gliding down her cheeks: sometimes her tears were warm, and
sometimes they were cold. This is an instance of a conjunction of jubilation
and lamentation due to different causes of ecstatic love.
Once when rmat Rdhr was standing on the bank of the Yamun
River in the forest of Vndvana, She was attacked by Ka, who was
stronger than She. Although She externally expressed a disturbed mood from
this incident, within Herself She was smiling and feeling great satisfaction.
Externally She moved Her eyebrows and made a show of rejecting Ka. In
this mood Rdhr looked very beautiful, and rla Rpa Gosvm glorifies
Her beauty. This is an instance of exhibiting varying feelings in ecstatic love,
although the cause is one onlyKa.
Sometimes there were great festivals in the house of Nanda Mahrja, and
all of the inhabitants of Vndvana would assemble for these festivals. During
one such festival, rmat Rdhr was seen wearing a golden necklace given
Her by Ka. This was immediately detected by mother Yaod as well as by
Rdhr's mother, because the necklace was too long for Rdhr's neck.
At the same time Rdhr could see Ka nearby, as well as Her own
husband, Abhimanyu. So all of these things combined to make Rdhr feel
very much ashamed, and with Her face shriveled She began to look very
beautiful. In this case there was a combination of bashfulness, anger, jubilation
294
becomes too great and is not fulfilled until after seemingly hopeless
tribulation, that is taken as the greatest satisfaction. Once the cowherd boys
in Vndvana were vainly searching after Ka for a long time, and for that
reason their faces became blackened, and their complexions appeared faded.
Just then they could hear on the hill a faint vibration from Ka's flute.
Immediately all of them became very much gladdened. This is an instance of
satisfaction in the midst of disappointment.
rla Rpa Gosvm says that although he has no expert knowledge about
the sounds and meanings and mellows of the symptoms of ecstatic love, he has
tried to give some examples of different varieties of love of Ka. He further
states that the thirty-three disturbing symptoms of ecstatic love, plus eight
other symptoms, all taken together equal forty-one.
As one can detect the color of dye a cloth was soaked in by looking at the
cloth, so, simply by understanding the different signs of these symptomatic
features, one can understand the actual position. In other words, attachment
for Ka is one, but produce
296
when one's heart is very soft or gentle, these symptoms become very easily
visible, and one can understand them very clearly. The heart of one who is
highly elevated and grave is compared to gold. If one's heart is very soft and
gentle, his heart is compared to a cotton swab. When there is an ecstatic
sensation within the mind, the golden heart or grave heart is not agitated, but
the soft heart immediately becomes agitated..
A hard heart is compared to a lightning bolt, to gold and.
A soft heart is compared to honey, to butter and to nectar. And the
condition of the mind is compared to sunshine. As honey and butter become
melted even in slight sunshine, softhearted persons become easily melted.
Nectar, however, is by its nature always liquid. And the hearts of those who
are in pure ecstatic love with Ka are by nature always liquified, just like
nectar.
A pure devotee of Ka is always specifically qualified with nectarean
qualifications and sometimes with the qualifications of butter and honey. On
the whole, the heart in any of the different conditions mentioned above can
be melted under certain circumstances, just as a hard diamond is sometimes
melted by a combination of certain chemicals. In the Dna-keli-kaumud it is
stated, "When love develops in the heart of a devotee, he cannot check the
transformation of his sentiments. His heart is just like the ocean at the rising
of the moon, when the ebb tide cannot be checked: immediately there must be
297
movement of high waves." Although in its natural state the ocean is always
grave and unfathomable, when the moon rises, nothing can check the ocean's
agitation. Similarly, those who are pure devotees cannot on any account check
the movement of their feelings within.
Neutrality
Neutrality can be further subdivided into general, transparent and
peaceful. An attraction for Ka by the people in general or by children
cannot take any specific or satisfactory position. It can be manifest sometimes
in trembling of the body and changing of the color of the eyes (to red, white,
298
ecstatic love. To such a devotee the concept of inferiority to the Lord is very
prominent, and he rarely takes interest in any other kind of transcendental
loving humor with the Lord.
In the Mukunda-ml-stotra, compiled by King Kulaekh Ka are considered to be great authorities in the modes of friendly
relations with the Supreme Personality of Godhead. On that friendly platform
there are different kinds of laughing and joking conversations. An example of
such a friendly relationship with Ka is described in rmad-Bhgavatam
when Ka was once thinking, "Today, while I was engaged in tending the
cows in the pasturing ground of Vndvana, Ka thus: "My dear Dmodara, although You have
been defeated by rdm and have become sufficiently minimized in strength,
by a false expression of strength You have somehow covered Your shameful
condition of defeat."
301
Parenthood, or Superiority
When mother Yaod heard that Ka's cows were being forcibly moved
by the strong servants of Kasa and that the tender cowherd boys were trying
to protect their cows, she began to think, "How can I protect these poor boys
from the invasion of Kasa's servants?" This is an instance of a superior
attitude in a devotee.
As soon as mother Yaod found her son Ka returning from the
pasturing ground, she immediately began to pat Him, touching her fingers to
the cheeks of the Lord.
Conjugal Love
Above even the humor of love between Ka and His parents is the
relationship of conjugal love. The Lord and the young gops exhibit this in
different waysglancing, moving the eyebrows, speaking very sweet words
and exchanging smiles.
There is a statement in Govinda-vilsa to this effect: "rmat Rdhr
was looking for Ka very anxiously and almost disappointedly." When there
is such an indirect expression of conjugal.
302
Laughter
After He had stolen some yogurt from the pots of two gops, Ka told one
of His gop friends, "My dear beautiful friend, I can take oath that I have not
stolen even a drop of yogurt from your pot! But still your friend Rdhr is
very shamelessly smelling the flavor of My mouth. Kindly forbid Her from this
devious policy of putting Her face near Mine." When Ka was speaking like
this, the friends of Rdhr could not check their laughter. This is an
instance of laughter in ecstatic love.
Astonishment
Once Brahm was watching all the cows and the cowherd boys dressed in
yellow garments and decorated with valuable jewels. The boys were expanding
their four arms and were being worshiped by many hundreds of other
Brahms. All the cowherd boys began to express their joyfulness for being with
Ka, the Supreme Brahman. At that time, Brahm showed his astonishment
by exclaiming, "What am I seeing here?" This is an instance of astonishment in
ecstatic love.
Chivalry
303
On the bank of the Yamun, once there was the crackling sound of dry
leaves, giggling from the cowherd boys and thundering from the sky. rdm
was tightening his belt to fight with Ka, the conqueror of the demon Agha.
This is an instance of chivalry in ecstatic love.
Lamentation
In the Tenth Canto, Seventh Chapter, verse 25, of rmad-Bhgavatam,
there is a description of Ka's being taken away by the whirlwind demon,
Tvarta. As Ka was being thus carried up into the sky, all the gops began
to cry aloud. They approached mother Yaod, stating that they could not find
the son of Nanda. He had been taken away by a whirlwind. This is an instance
of lamentation in ecstatic love.
When Ka was fighting with Kliya, mother Yaod exclaimed, "Ka is
now entrapped within the hoods of the Kliya snake, and yet I am not tattered
to pieces! So I must admit how wonderful is the preserving power of this
material body!" This is another instance of lamentation in ecstatic love.
Anger
When Jail, the mother of Abhimanyu, saw Ka wearing a necklace, she
could understand that the jeweled ornament had been given to Him by
Rdhr. She therefore became absorbed in anger and began to move her
eyebrows, expressing her anger in ecstatic love.
Ghastliness
There is a statement by Ymuncrya to this effect: "Since I have begun to
304
enjoy these transcendental exchanges of love, which are always newer and
newer, whenever I remember the pleasure of past sex life, my lips curl and I
wish to spit on the idea." This is an instance of ecstatic love in ghastliness.
Dread Ka. Such ecstatic love is
palatable, and expert critics have compared such ecstatic love to a mixture of
curd, sugar candy and a little black pepper. The combined taste is very
palatable.
and sacri-bhva.
No one, while remaining on the material platform, should discuss these
different descriptions of bhva and anubhvabhrata, Udyama-parva, it is warned that things which
are inconceivable should not be subjected to arguments. Actually, the
transactions of the spiritual world are inconceivable to us in our present state
of life. Great liberated souls like Rpa Gosvm and others have tried to give
us some hints of transcendental activities in the spiritual world, but on the
whole these transactions will remain inconceivable to us at the present
moment. Understanding the exchanges of transcendental loving service with
Ka is possible only when one is actually in touch with the pleasure potency
of the Supreme Lord.
In this connection r Rpa Gosvm gives an example of the clouds in the
sky. The clouds in the sky arise from the ocean, and when the clouds become
water again and fall to the ground, they glide back to the ocean. Thus the
pleasure potency of Ka is compared to the ocean. The pure devotee is the
pleasure-possessing cloud, and when he is filled with transcendental loving
service, then he can bestow his mercy as a downpour of rainand the
pleasure potency returns to the ocean of Ka.
308
be just like boys of four or five years. Their complexions are very fair, there is
an effulgence in their bodies, and they always travel naked. These four saintly
persons almost always remain together.
In one of the prayers of the Kumra brothers, this declaration is made: "O
Lord Mukunda [Ka, the giver of liberation], only so long as one does not
happen to see Your eternal form of bliss and knowledge, appearing just like a
newly-grown tamla tree, with a bluish hueonly for so long can the
impersonal feature of the Absolute Truth, known as Brahman, be very
pleasing to a saintly person."
The qualifications of a saintly person are described in the
Bhakti-rasmaniadic portions, to live always in a place where there is no
disturbance from the common people, to think always of the eternal form of
Ka, to be ready to consider and understand the Absolute Truth, to be
always prominent in exhibiting knowledge, to see the Supreme Lord in His
312
the Lord and from smelling the tulas nta-rasa
devotional service, and these symptoms are exhibited as follows. They
concentrate their eyesight on the tip of the nose, and they behave just like an
avadhta. Avadhta means a highly elevated mystic who does not care for any
social, religious or Vedic conventions. Another symptom is that such persons
are very careful to step forward when giving speeches. When they speak, they
join together the forefinger and thumb. (This is called the jna-mudr nta-rasa.
Regarding concentration of the eyesight on the tip of the nose, there is a
statement in the Bhakti-rasmta-sindhu by a devotee who observed this being
performed by a yog. He remarked, "This great sage is concentrating his
eyesight on the tip of his nose, and from this it appears that he has already
realized the eternal form of the Lord within himself."
Sometimes a devotee in nta nta-rasa falls down on the ground, his hairs
314
stand up on his body, and he trembles all over. In this way, different symptoms
of ecstatic trance are exhibited automatically by such devotees.
In the Bhakti-rasmta-sindhu it is said that when Lord Ka was blowing
His conchshell known as Pcajanya, many great sages who were living in the
caves of the mountains immediately reacted, being awakened from their
trance of meditation. They immediately saw that the hairs of their bodies were
standing. Sometimes devotees in nta-rasa become stunned, peaceful,
jubilant, deliberate, reflective, anxious, dexterous and argumentative. These
symptoms indicate continuous ecstasy, or established emotion.
Once a great realized sage was lamenting that the Supreme Lord Ka was
living in Dvrak Ka, Ka, along with His elder brother Balarma and sister
Subhadr, came to Kuruketra in a chariot on the occasion of a solar eclipse,
many mystic yogs also came. When these mystic yogs saw Lord Ka and
Balarma, they exclaimed that now that they had seen the excellent bodily
315
effulgence of the Lord, they had almost forgotten the pleasure derived from
impersonal Brahman realization. In this connection one of the mystics
approached Ka Ka's Pcajanya conchshell, the mystic became
overpoweredso much so, in fact, that he began to bash his head on the
ground, and with eyes full of tears of ecstatic love, he violated all the rules and
regulations of his yoga performances. Thus he at once neglected the process of
Brahman realization.
Bilvamagala hkura, in his book Ka-karmta, says, "Let the
impersonalists be engaged in the process of transcendental realization by
worshiping the impersonal Brahman. Although I was also initiated into that
path of Brahman realization, I have now become misled by a naughty
boyone who is very cunning, who is very much attached to the gops and
who has made me His maidservant. So I have now forgotten the process of
Brahman realization."
Bilvamagala hkura was first spiritually initiated for impersonal
realization of the Absolute Truth, but later on, by his association with Ka
in Vndvana, he became an experienced devotee. The same thing happened
to ukadeva Gosvm, who also reformed himself by the grace of the Lord and
took to the path of devotional service, giving up the way of impersonal
realization.
ukadeva Gosvm and Bilvamagala hkura, rla Rpa Gosvm says that even if one does not accept
316
features, all the inhabitants of the heavenly planets, as well as the inhabitants
of this earth, feel transcendental bliss and consider themselves the eternal
servants of the Lord." Sometimes the devotee becomes filled with the same
awe and reverence by seeing a picture of Viu, who is dressed like Ka and
who has a similar complexion. The only difference is that Viu has four
hands, in which He holds the conchshell, the disc, the club and the lotus
flower. Lord Viu is always decorated with many valuable jewels, such as the
candraknta stone and the sryaknta stone.
In the Lalita-mdhava by Rpa Gosvm there is the following statement by
Druka, one of the servants of Ka: "Certainly Lord Viu is very beautiful
with His necklace of kaustubha jewels, His four hands holding conchshell, disc,
club and lotus flower, and His dazzlingly beautiful jewelry. He is also very
beautiful in His eternal position, riding upon the shoulder of Garua. But now
the same Lord Viu is present as the enemy of Kasa, and by His personal
feature I am completely forgetting the opulence of Vaikuha." personsthishm and Lord iva, who are appointed to
control the material modes of passion and ignorance), devotees in servitude
318
who are protected by the Lord, devotees who are always associates and
devotees who are simply following in the footsteps of the Lord.
Appointed Servants
In a conversation between Jmbavat, one of Ka's wives, and Klind,
her friend, Jmbavat inquired, "Who is this personality circumambulating our
Ka?"
Klind replied, "She is Ambik, the superintendent of all universal affairs."
Then Jmbavat inquired, "Who is this personality who is trembling at the
sight of Ka?"
Klind replied, "He is Lord iva."
Then Jmbavat inquired, "Who is the person offering prayers?"
Klind replied, "He is Lord Brahm."
Jmbavat then asked, "Who is that person who has fallen on the ground
and is offering respect to Ka?"
Klind replied, "He is Indra, the King of heaven."
Jmbavat next inquired, "Who is this person who has come with the
demigods and is laughing with them?"
Klind replied, "He is my elder brother, Yamarja, the superintendent of
death."
This conversation offers a description of all the demigods, including
Yamarja, who are engaged in services appointed by the Lord. They are called
adhikta-devat, or demigods appointed to particular types of departmental
service.
319
Constant Associates
In the city of Dvrak the following devotees are known as Ka's close
associates: Uddhava, Druka, Styaki, rutadeva, atrujit, Nanda, Upananda
and Bhadra. All of these personalities remain with the Lord as His secretaries,
321
but still they are sometimes engaged in His personal service. Among the Kuru
dynasty, Bhma, Mahrja Parkit and Vidura are also known as close
associates of Lord Ka. It is said, "All the associates of Lord Ka have
lustrous bodily features, and their eyes are just like lotus flowers. They have
sufficient power to defeat the strength of the demigods, and the specific
feature of their persons is that they are always decorated with valuable
ornaments."
When Ka was in the capital Indraprastha, someone addressed Him thus:
"My dear Lord, Your personal associates, headed by Uddhava, are always
awaiting Your order by standing at the entrance gate of Dvrak. They are
mostly looking on with tears in their eyes, and in the enthusiasm of their
service they are not afraid even of the devastating fire generated by Lord iva.
They are souls simply surrendered unto Your lotus feet."
Out of the many close associates of Lord Ka, Uddhava is considered the
best. The following is a description of him: "His body is blackish like the color
of the Yamun River, and it is similarly as cool. He is always decorated with
flower garlands first used by Lord Ka, r Ka as follows:
"Lord r Ka, who is our master and worshipable Deity, the controller of
Lord iva and Lord Brahm,."
322
love.
The first symptom of anubhva, or engagement in a particular type of
service, is exemplified by Druka, a servant of Ka who used to fan Ka
with a cmara, a bunch of hair. When he was engaged in such service, he was
filled with ecstatic love, and the symptoms of ecstatic love became manifest in
his body. But Druka was so serious about his service that he checked all of
these manifestations of ecstatic love and considered them hindrances to his
engagement. He did not care very much for these manifestations, although
they automatically developed.
In rmad-Bhgavatam, Tenth Canto, Eighty-sixth Chapter, verse 38, there
is a statement of how rutadeva, a brhmaa from the country called Mithil
in northern India, became so overpowered with joy as soon as he saw Ka
that immediately after bowing to the Lord's lotus feet he stood up and began to
dance, raising his two arms above his head.
One of the devotees of Lord Ka sttvika. Sttvika means
that they are from the transcendental platform. They are not symptoms of
material emotion; they come from the soul proper.
In rmad-Bhgavatam, Tenth Canto, Eighty-fifth Chapter, verse 38,
ukadeva Gosvm tells Mahrja Parkit that after surrendering everything
unto the lotus feet of Vmanadeva, Bali Mahrja immediately caught hold of
the lotus feet of the Lord and pressed them to his heart. Being overwhelmed
with joy, he manifested all the symptoms of ecstatic love, with tears in his eyes
and a faltering voice.
In such expressions of ecstatic love there are many other subsidiary
symptoms, such as jubilation, withering, silence, disappointment, moroseness,
327
very eager to learn of the transcendental qualities of the Lord. The most
important business of such a devotee is attaining the association of the Lord.
In the Nsiha Pura there is a statement about King Ikvku which
illustrates this state of ecstatic love. Because of his great affection for Ka,
King Ikvku became greatly attached to the black cloud, the black deer, the
deer's black eyes and the lotus flower, which is always compared to the eyes of
the Lord. In the Tenth Canto, Thirty-eighth Chapter, verse 10, of the
Bhgavatam, Akrra thinks, "Since the Lord has now appeared to diminish the
great burden of the world and is now visible to everyone's eyes in His personal
transcendental body, when we see Him before us, is that not the ultimate
perfection of our eyes?" In other words, Akrra realized that the perfection of
the eyes is fulfilled when one is able to see Lord Ka. Therefore, when Lord
Ka was visible on the earth by direct appearance, everyone who saw Him
surely attained perfection of sight.
In the Ka-karmta, written by Bilvamagala hkura, there is this
expression of eagerness in ecstatic love: "How miserable it is, my dear Ka, O
friend of the hopeless! O merciful Lord, how can I pass these thankless days
without seeing You?" A similar sentiment was expressed by Uddhava when he
wrote a letter to Ka Ka-karm Ka said, "When even aiekhara [Lord iva] is
unable to see You, what chance is there for me, who am lower than an
331
ordinary worm? I have only committed misdeeds. I know that I am not at all fit
to offer my prayers to You, but because You are known as Dn."
all lying down on the bank of the Yamun almost paralyzed. And it appears
that they are almost dead, because their breathing is very slow." This is an
instance of becoming unconscious due to separation from Ka.
Ka was once informed, "You are the life and soul of all the inhabitants
of Vndvana. So because You have left Vndvana, all of the servitors of
Your lotus feet there are suffering. It is as if the lakes filled with lotus flowers
have dried up from the scorching heat of separation from You." In the example
given here, the inhabitants of Vndvana are compared to lakes filled with
lotus flowers, and because of the scorching heat of separation from Ka, the
lakesalong with the lotus flowers of their livesare being burned up. And
the swans in the lakes, who are compared to the vitality of the inhabitants of
Vndvana, are no longer desiring to live there. In other words, because of the
scorching heat, the swans are leaving the lakes. This metaphor is used to
describe the condition of the devotees separated from Ka.
34, ukadeva Gosvm tells King Parkit, "My dear King, as soon as Akrra
the chariot driver saw Lord Ka and His elder brother Balarma in
Vndvana, he immediately got down from the chariot and, being greatly
afflicted by affection for the transcendental Lord, fell down upon His lotus
feet to offer respectful obeisances." These are some of the instances of
perfectional meetings with Ka.
When a devotee meets Ka after long separation, the meeting is one of
satisfaction. In the First Canto of rmad-Bhgavatam, Eleventh Chapter,
verse 10, it is stated that when Lord Ka returned to His capital, Dvrak,
the inhabitantsvrak, then it will be impossible for us to
live anymore." This is an instance of satisfaction in meeting Ka after long
separation.
Ka's personal servant, Druka, seeing Ka at the door of Dvrak,
forgot to offer Him respects with folded hands.
When a devotee is ultimately situated in association with Ka, his
position is called steadiness in devotional service. This steady position in
devotional service is explained in the book known as Hasadta. It is
described there how Akrra, who was considered by the gops to be terror
personified, would talk with Ka about the activities of the Kuru dynasty. A
similar steady position was held by Uddhava, the disciple of Bhaspati. He
would always massage the lotus feet of Ka while kneeling down on the
ground before Him.
When a devotee is engaged in the service of the Lord, he is said to have
reached the attainment of yoga. The English equivalent of the word yoga is
"linking up." So actual linking up with Ka, the Supreme Personality of
Godhead, begins when the devotee renders service unto Him. Devotees
337
they were silent, submissive and gentle, and they were always ready to carry
out Ka's orders, even at the risk of life. When present before Ka, they
bowed down on the ground. They were very silent and steady, and they used
to restrain coughing and laughing before the Lord. Also, they never discussed
Ka's pastimes in conjugal love. In other words, devotees who are engaged in
reverential devotional service should not discuss the conjugal love affairs of
Ka. No one should claim his eternal relationship with Ka unless he is
liberated. In the conditioned state of life, the devotees have to execute the
prescribed duties as recommended in the codes of devotional service. When
one is mature in devotional service and is a realized soul, he can know his own
eternal relationship with Ka. One should not artificially try to establish
some relationship. In the premature stage it is sometimes found that a lusty,
conditioned person will artificially try to establish some relationship with
Ka in conjugal love. The result of this is that one becomes prkta-sahajiy,
or one who takes everything very cheaply. Although such persons may be very
anxious to establish a relationship with Ka in conjugal love, their
conditioned life in the material world is still most abominable. A person who
has actually established his relationship with Ka can no longer act on the
material plane, and his personal character cannot be criticized.
When Cupid came on one occasion to visit Lord Ka, some devotee
addressed him thus: "My dear Cupid, because you have been so fortunate as to
have placed your eyesight on the lotus feet of Ka, the drops of perspiration
on your body have become frozen, and they resemble kaak fruits [a kind of
small fruit found in thorny bushes]." These are signs of ecstasy and veneration
for the Supreme Personality of Godhead. When the princes of the Yadu
dynasty heard the vibration of Ka's Pcajanya conchshell, the hairs on
their bodies immediately stood up in ecstatic jubilation. It seemed at that time
that all the hairs on the bodies of the princes were dancing in ecstasy.
In addition to jubilation, there are sometimes symptoms of disappointment.
Pradyumna once addressed Smba with these words: "My dear Smba, you are
such a glorified personality! I have seen that once when you were playing on
341
the ground, your body became covered with dust; yet our father, Lord Ka,
still took you up on His lap. But I am so unfortunate that I could never get
such love from our father!" This statement is an example of disappointment in
love.
To regard Ka as one's superior is called reverential feeling, and when, in
addition to this, a devotee feels that Ka is his protector, his transcendental
love for Ka Ka in the instance
of Arjuna's informing Him of the death of Arjuna's son, Abhimanyu, who was
also the nephew of Ka. Abhimanyu was the son of Subhadr, Ka's
younger sister. He was killed at the Battle of Kuruketra by the combined
efforts of all the commanders in King Duryodhana's armynamely Kara,
Avatthm, Jayadratha, Bhma, Kpcrya and Drocrya. In order to
assure Ka that there was no change of love on Subhadr's part, Arjuna
informed Him, "Although Abhimanyu was killed almost in Your presence,
Subhadr's love for You is not agitated at all, nor has it even slightly changed
its original color."
The affection that Ka."
342
343
celestial beauties, pleasing to the eyes of everyone. It is said that once Arjuna
was lying on his bed with his head upon Ka's lap and was talking and joking
with Ka in great relaxation, enjoying Ka's company with smiling and
great satisfaction.
As far as the vayasyas (friends) in Vndvana are concerned, they become
greatly distressed when they cannot see Ka even for a moment.
There is the following prayer by a devotee for the vayasyas in Vndvana:
"All glories to Ka's vayasyas, who are just like Ka in their age, qualities,
pastimes, dress and beauty. They are accustomed to playing on their flutes
made of palm leaves, and they all have buffalo-horn bugles ornamented like
Ka's with jewels such as indranla and with gold and coral. They are always
jubilant like Ka. May these glorious companions of Ka always protect
us!"
The vayasyas in Vndvana are in such intimate friendship with Ka that
sometimes they think themselves as good as Ka. Here is an instance of such
friendly feeling: When Ka was holding up Govardhana Hill with His left
hand, the vayasyasdm's hand. We are very much aggrieved to
see You in this position. If you think that Sudm is not able to support
Govardhana Ka.
In rmad-Bhgavatam, Tenth Canto, Twelfth Chapter, verse 11, ukadeva
Gosvm tells King Parkit, "My dear King, Ka is the Supreme Personality
of Godhead to the learned transcendentalist, He is the supreme happiness for
the impersonalist, He is the supreme worshipable Deity for the devotee, and
346
He is just like an ordinary boy to one who is under the spell of my. And just
imaginethese."
There is a description of Ka's feeling for His vayasyas in Vndvana. He
once said to Balarma, "My dear brother, when My companions were being
devoured by the Aghsura, hot tears poured down from My eyes. And as they
were washing My cheeks, My dear elder brother, for at least one moment I
completely lost Myself."
Within Gokula, Ka's vayasyas are generally divided into four groups: (1)
well-wishers, (2) friends, (3) confidential friends and (4) intimate friends.
Ka's well-wisher friends are a little bit older than Ka, and they have
some parental affection for Him. Because of their being older than Ka, they
always try to protect Him from any harm. As such, they sometimes bear
weapons so that they can chastise any mischievous persons who want to do
harm to Ka. Counted among the well-wisher friends are Subhadra(37),
Maalbhadra, Bhadravardhana, Gobhaa, Yaka, Indrabhaa, Bhadrga,
Vrabhadra, Mahgua, Vijaya and Balabhadra. They are older than Ka
and are always thinking of His welfare.
One of the elderly friends said, "My dear Maalbhadra, why are you
wielding a shining sword as though you were running toward Arcloud upon Govardhana Hill; it is
not the Arisura in the shape of a bull, as you have imagined." These older,
well-wishing friends of Ka had imagined a large cloud to be the Arisura,
appearing in the shape of a huge bull. In the midst of their excitement one of
them ascertained that it was actually only a cloud on Govardhana Hill. He
347
therefore informed the others not to take the trouble of worrying about Ka,
because there was no present danger from Arisura.
Among the well-wisher friends, Maalbhadra and Balabhadra are the
chiefs. Maalbhadra is described as follows. His complexion is yellowish, and
his dress is very attractive. He always carries a stick of various colors. He wears
a peacock feather on his head and always looks very beautiful.
Maalbhadra's attitude is revealed in this statement: "My dear friends, our
beloved Ka is now very tired from working with the cows in the pasturing
grounds and from traveling all over the forests. I can see that He is very
fatigued. Let me massage His head silently while He is taking rest in His house.
And you, Subalayou just massage His thighs."
One devotee described the personal beauty of Baladeva as follows "Let me
take shelter of the lotus feet of Balarma, whose beauty is enhanced by the
earrings touching His cheeks. His face is decorated with tilaka made from
kastr [musk], and His broad chest is decorated with a garland of guj arma(38)."
Baladeva's affection for Ka is illustrated in this statement to Subala: "My
dear friend, please inform Ka not to go to Kliya's lake today. Today is His
birthday, and so I wish to go along with mother Yaod to bathe Him. Tell
Him He should not leave the house today." This shows how Balarma, Ka's
elder brother, took care of Ka with parental love, within the scope of
fraternal affection.
Friends who are younger than Ka, who are always attached to Him and
who give Him all kinds of service are called ordinary friends, or, simply,
friends. Such ordinary friends are called sakhs, and the names of some sakhs
are Vila, Vabha, Ojasv, Devaprastha, Varthapa, Maranda, Kusumpa,
Maibandha and Karandhama. All of these sakh friends of Ka seek only
348
to serve Him. Sometimes some of them would rise early in the morning and
immediately go to Ka's place and wait at the door to see Ka and to
accompany Him to the pasturing grounds. In the meantime, Ka would be
dressed by mother Yaod, and when she would see a boy standing at the door,
she would call him, "Well, Vila, why are you standing there? Come here!" So
with the permission of mother Yaod, he would immediately enter the house.
And while mother Yaod was dressing Ka, he would try to help put on
Ka's ankle bells, and Ka would jokingly strike him with His flute. Then
mother Yaod would call, "Ka, what is this? Why are You teasing Your
friend?" And Ka would laugh, and the friend would also laugh. These are
some of the activities of Ka's sakhs. Sometimes the sakhs would take care
of the cows who were going hither and thither. They would tell Ka, "Your
cows were going off here and there," and Ka would thank them.
Sometimes when Ka and His sakhs went to the pasturing ground,
Kasa would send a demon to kill Ka. Therefore, almost every day there
was a fight with some different kind of demon. After fighting with a demon,
Ka would feel fatigued, the hairs on His head would be scattered, and the
sakhs would immediately come and try to relieve Him in different ways. Some
friends would say, "My dear Vila, please take this fan of lotus leaves and fan
Ka so that He may feel some comfort. Varthapa, you just brush the
scattered hairs on Ka's head which have fallen upon His face. Vabha,
don't talk unnecessarily! Immediately massage Ka's body. His arms have
become tired from fighting and wrestling with that demon. Oh, just see how
our friend Ka has become tired!" These are some examples of the treatment
given to Ka by the sakhs.
One of the sakhs, known as Devaprastha, is described as follows. He is very
strong, a ready scholar, and is very expert in playing ball. He wears a white
dress, and he ties his hair into a bunch with a rope. Whenever there is a fight
between Ka and the demons, Devaprastha is the first to help, and he fights
just like an elephant.
One of the gops once said to her friend, "My dear beautiful friend, when
349
Ka, the son of Mahrja Nanda, was taking rest within the cave of a hill,
He was keeping His head on the arms of rdm, and He was putting His left
hand on Dm's chest. Taking this opportunity, Devaprastha, out of his strong
affection for Ka, immediately began to massage His legs." Such are the
activities of Ka's friends out on the pasturing grounds.
The more confidential friends are called priya-sakhs and are almost
Ka's age. Because of their very confidential friendship, their behavior is
only on the basis of pure friendship. The behavior of other friends is on the
ground of paternal love or servitude, but the basic principle of the confidential
friends is simply friendship on an equal level. Some confidential friends are as
follows: rdm, Sudm, Dm, Vasudm, Kikii, Stoka-ka, Au,
Bhadrasena, Vils, Puarka, Viaka and Kalavika. By their various
activities in different pastimes, all of these friends used to give transcendental
pleasure to Ka.
The behavior of these confidential friends is described by a friend of
Rdhr who told Rdhr, "My dear graceful Rdhr, Your intimate
friend Ka is also served by His intimate boyfriends. Some of them cut jokes
with Him in mild voices and please Him very much by this." For example,
Ka had one brhmaa friend whose name was Madhumagala. This boy
would joke by playing the part of a greedy brhmaa. Whenever the friends
ate, he would eat more than all others, especially laus, of which he was very
fond. Then after eating more laus than anyone else, Madhumagala would
still not be satisfied, and he would say to Ka, "If You give me one more
lau, then I shall be pleased to give You my blessings so that Your friend
Rdhr will be very much pleased with You." The brhmaas are supposed
to give blessings to the vaiyas (farming and merchant caste), and Ka
presented Himself as the son of Mahrja Nanda, a vaiya; so the brhmaa
boy was right in giving blessings to Ka. Thus Ka was very pleased by His
friend's blessings, and He would supply him with more and more laus.
Sometimes a confidential friend would come before Ka and embrace
Him with great affection and love. Another friend would then come up from
350
the rear and cover Ka's eyes with his hands. Ka would always feel very
happy by such dealings with His confidential friends.
Out of all these confidential friends, rdm is considered to be the chief.
rdm used to put on a yellow-colored dress. He would carry a buffalo horn,
and his turban was of reddish, copper color. His bodily complexion was
blackish, and around his neck there was a nice garland. He would always
challenge Ka in joking friendship. Let us pray to rdm to bestow his
mercy upon us!
Sometimes rdm used to address Ka, "Oh, You are so cruel that You
left us alone on the bank of the Yamun,arm, or intimate friends. Counted among the priya-narm friends are
Subala, Arjuna, Gandharva, Vasanta and Ujjvala. There was talk among the
friends of Rdhr, the gops, about these most intimate friends. One gop
addressed Rdhr thus: "My dear Kg [delicate one], just see how Subala
is whispering Your message into Ka's ear, how he is delivering the
confidential letter of ym-ds silently into Ka's hand, how he is
delivering the betel nuts prepared by Plik into Ka's mouth, and how he is
decorating Ka with the garland prepared by Trak. Did you know, my dear
friend, that all these most intimate friends of Ka are always engaged in His
service in this way?" Out of the many intimate priya-narms, Subala and
Ujjvala are considered to be the most prominent.
Subala's body is described as follows. His complexion is just like molten
gold. He is very, very dear to Ka. He always has a garland around his neck,
and he wears yellow clothing. His eyes are just like lotus flower petals, and he
351
is so intelligent that by his talking and his moral instructions all the other
friends take the highest pleasure. Let us all offer our respectful obeisances
unto Ka's friend Subala!
The degree of intimacy shared by Ka Ka's, and on his neck there is always a
necklace of pearls. He is always very dear to Ka. Let us all worship Ujjvala,
the most intimate friend of Ka!
About the confidential service of Ujjvala, this statement is to be found,
addressed by Rdhr to one of Her friends: "My dear friend, it is impossible
for Me to keep My prestige! I wanted to avoid talking to Ka anymorebut
just see! There again is His friend Ujjvala, coming to Me with his canvassing
work. His entreaties are so powerful that it is very difficult for a gop to resist
her love for Ka, even though she may be very bashful, devoted to her family
duties and most faithful to her husband."
The following is a statement by Ujjvala, showing his jubilant nature: "My
dear Ka, O killer of Aghs."
Among the groups of different friends of Ka, some are well known from
various scriptures, and some are well known by popular tradition. There are
three divisions among Ka's friends: some are eternally in friendship with
352
Ka, some are elevated demigods, and some are perfected devotees. In all of
these groups there are some who by nature are fixed in Ka's service and are
always engaged in giving counsel; some of them are very fond of joking and
naturally cause Ka to smile by their words; some of them are by nature very
simple, and by their simplicity they please Lord Ka; some of them create
wonderful situations by their activities, apparently against Ka; some of
them are very talkative, always arguing with Ka and creating a debating
atmosphere; and some of them are very gentle and give pleasure to Ka by
their sweet words. All of these friends are very intimate with Ka, and they
show expertise in their different activities, their aim always being to please
Ka.
any of our friends. Since this is so, I do not know how these features of Your
body can fail to defeat the pride of all the young girls of Vndvana. When I
am so defeated by this beauty, what chance is there for those who are naturally
very simple and flexible?"
At this age Ka took pleasure in whispering into the ears of His friends,
and the subject of His talks was the beauty of the gops, who were just tarrying
before them. Subala once addressed Ka thus: "My dear Ka, You are very
cunning. You can understand the thoughts of others; therefore I am
whispering within Your ear that all of these five gops, who are most beautiful,
have been attracted by Your dress. And I believe that Cupid has entrusted
them with the responsibility of conquering You." In other words, the beauty of
the gops was capable of conquering Ka, although Ka is the conqueror of
all universes.
The symptoms of the kaiora age have already been described, and it is at
this age that devotees generally most appreciate Ka. Ka with Rdhr
is worshiped as Kiora-kior. Ka does not increase His age that although
He is the oldest personality and has innumerable different forms, His original
form is always youthful. In the pictures of Ka on the Battlefield of
Kuruketra we can see that He is youthful, although at that time He was old
enough to have sons, grandsons and great-grandsons. The cowherd boyfriends
of Ka once said, "Dear Ka, You need not decorate Your body with so
many ornaments. Your transcendental features are themselves so beautiful
that You do not require any ornamentation." At this age, whenever Ka
begins to vibrate His flute early in the morning, all of His friends immediately
get up from bed just to join Him in going to the pasturing grounds. One of the
friends once said, "My dear cowherd friends, the sound of Ka's flute from
above Govardhana Hill is telling us that we need not go to search Him out on
the bank of the Yamun."
Prvat, the wife of Lord iva, told her husband, "My dear Pacamukha
[five-faced], just look at the Pavas! After hearing the sound of Ka's
conchshell, known as Pcajanya, they have regained their strength and are
356
think it must be admitted that in your previous lives you have succeeded in
many kinds of austerities." The idea is that although Rdhr was
accustomed to putting Her arms on Ka's shoulders, it was not possible for
Her to do such a thing in the presence of Her superiors, whereas Subala could
do so freely. Rdhr therefore praised his good fortune.
When Ka entered the lake of Kliya, His intimate friends became so
perturbed that their bodily colors faded, and they all produced horrible
gurgling sounds. At that time all of them fell down on the ground as if
unconscious. Similarly, when there was a forest fire, all of Ka's friends
neglected their own protection and surrounded Ka on all sides to protect
Him from the flames. This behavior of the friends toward Ka is described
by thoughtful poets as vyabhicr. In vyabhicr ecstatic love for Ka there is
sometimes madness, dexterity, fear, laziness, jubilation, pride, dizziness,
meditation, disease, forgetfulness and humbleness. These are some of the
common symptoms in the stage of vyabhicr ecstatic love for Ka.
When there are dealings between Ka and His friends which are
completely devoid of any feelings of respect and they all treat one another on
an equal level, such ecstatic love in friendship is called sthy. When one is
situated in this confidential friendly relationship with Ka, one shows
symptoms of love such as attraction, affection, affinity and attachment. An
example of sthy was exhibited when Arjuna(40) told Akrra, "My dear son of
Gndin, please ask Ka when I shall be able to embrace Him in my arms."
When there is full knowledge of Ka's superiority and yet in dealings
with Him on friendly terms respectfulness is completely absent, that stage is
called affection. There is one brilliant example of this affection. When the
demigods, headed by Lord iva, were offering respectful prayers to Ka,
describing the glorious opulences of the Lord, Arjuna(41) stood before Him
with his hand on His shoulders and brushed the dust from His peacock
feather.
When the Pavas were banished by Duryodhana and forced to live
359
incognito in the forest, no one could trace out where they were staying. At
that time, the great sage Nrada met Lord Ka and said, "My dear Mukunda,
although You are the Supreme Personality of Godhead, the all-powerful
person, by making friendship with You the Pavas have become bereft of
their legitimate right to the kingdom of the worldand, moreover, they are
now living in the forest incognito. Sometimes they must work as ordinary
laborers in someone else's house. These symptoms appear to be very
inauspicious materially, but the beauty is that the Pavas have not lost their
faith and love for You, in spite of all these tribulations. In fact, they are always
thinking of You and chanting Your name in ecstatic friendship."
Another example of acute affection for Ka is given in the Tenth Canto,
Fifteenth Chapter, verse 18, of rmad-Bhgavatam. In the pasturing ground
Ka felt a little tired and wanted to take rest, so He lay down on the ground.
At that time, many cowherd boys assembled there and with great affection
began to sing suitable songs so that Ka would rest very nicely.
There is a nice example of the friendship between Ka and Arjuna on
the Battlefield of Kuruketra. When the fighting was going on, Avatthm,
the son of Drocrya, unceremoniously attacked Ka, although according
to the prevailing rules of chivalry one's chariot driver should never be
attacked by the enemy. Avatthm behaved heinously in so many ways that
he did not hesitate to attack Ka's body, although Ka was acting only as
charioteer for Arjuna. When Arjuna saw that Avatthm was releasing
various kinds of arrows to hurt Ka, he immediately stood in front of Ka
to intercept all of them. At that time, although Arjuna was being harmed by
those arrows, he felt an ecstatic love for Ka, and the arrows appeared to
him like showers of flowers.
There is another instance of ecstatic love for Ka in friendship. Once
when a cowherd boy named Vabha was collecting flowers from the forest to
prepare a garland to be offered to Ka, the sun reached its zenith, and
although the sunshine was scorching hot, Vabha felt it to be like the
moonshine. That is the way of rendering transcendental loving service to the
360
Lord; when devotees are put into great difficultieseven like the Pavas, as
described abovethey feel all their miserable conditions to be great facilities
for serving the Lord.
Another instance of Arjuna's friendship with Ka was described by
Nrada, who reminded Ka, Ka for a moment, and as soon as there was an opportunity to
see Ka, Arjuna immediately embraced Him.
One servant of Ka named Patr once addressed Him like this: "My dear
Lord, You protected the cowherd boys from the hunger of the Aghsura
demon, and You protected them from the poisonous effects of the Kliya
snake. And You also saved them from the fierce forest fire. But I am suffering
from Your separation, which is more severe than the hunger of Aghsura, the
poison of Lake Kliya and the burning of the forest fire. So why should You
not protect me from the pangs of separation?" Another friend once told Ka,
"My dear enemy of Kasa, since You have left us, the heat of separation has
become extraordinary. And this heat is felt more severely when we understand
that in Bhravana You are being refreshed by the waves of the cooling
river known as Bhnu-tanay [Rdhr]." The purport is that when Ka
was engaged with Rdhr, the cowherd boys headed by Subala were feeling
great separation, and that was unbearable for them.
Another friend addressed Ka thus: "My dear Ka, O killer of
Aghsura, when You left Vndvana to kill King Kasa in Mathur, all the
cowherd boys became bereft of their four bhtas [the elements earth, water,
fire and space]. And the fifth bhta, the air, was flowing very rapidly within
their nostrils." When Ka went to Mathur to kill King Kasa, all the
cowherd boys became so afflicted by the separation that they almost died.
When a person is dead it is said that he has given up the five elements, known
as bhtas, as the body again mixes with the five elements from which it was
361
prepared. In this case, although the four elements earth, water, fire and ether
were already gone, the remaining element, air, was still very prominent and
was blowing through their nostrils furiously. In other words, after Ka left
Vndvana, the cowherd boys were always anxious about what would happen
in His fight with King Kasa.
Another friend once informed Ka, Ka Ka.
An example of helplessness is described in the following statement: "Due to
Ka's departure from Vndvana to Mathur, Ka
Ka's separation. An example of impatience was also shown by the cowherd
boys when Ka went to Mathur. Out of the sorrow of separation, all these
boys forgot to take care of their cowherding and tried to forget all the
melodious songs they used to sing in the pasturing ground. At last they had no
desire to live anymore, being separated from Ka.
An example of stillness was described by a friend of Ka's who informed
Him in Mathur that all the cowherd boys had become just like leafless trees
on the tops of hills. They appeared almost naked, being skinny and frail, and
did not carry any fruits or flowers. He informed Ka that all the cowherd
boys residing in Vndvana were as still as the trees at the tops of hills.
Sometimes they felt diseased from their separation from Ka, and being so
greatly disappointed, they were aimlessly wandering on the banks of the
362
Yamun.
There is also an example of madness caused by separation from Ka.
When Ka was absent from Vndvana, Ka's criticized Him by saying, "My dear Lord, You
have become the King of Mathur after killing Kasa, and that is very good
news for us. But at Vndvana all the residents have become blind from their
continuous crying over Your absence. They are full only of anxieties and are
not cheered at all by Your becoming the King of Mathur."
Sometimes there were also signs of death caused by separation from Ka.
Once Ka was told, "My dear enemy of Kasa, because of their separation
from You, the cowherd boys are suffering too much, and they are now lying
down in the valleys, breathing only slightly. In order to sympathize with the
boys' regrettable condition, even the forest friends, the deer, are shedding
tears."
In the Mathur-khaa chapter of the Skanda Pura, there is a
description of Ka and Balarma, surrounded by all the cowherd boys,
always engaged in taking care of the cows and calves. When Ka was met by
Arjuna at a potter's shop in the city of Drupada-nagara, because of the
similarity of their bodily features they made intimate friendship. This is an
instance of friendship caused by the attraction of similar bodies.
In the Tenth Canto of rmad-Bhgavatam, Seventy-first Chapter, verse
27, it is stated that when Ka arrived in the city of Indraprastha, Bhma was
so overwhelmed with joy that with tears in his eyes and a smiling face he
immediately embraced his maternal cousin. Following him were his young
brothers Nakula and Sahadeva, along with Arjuna, and they all became so
overwhelmed at seeing Ka that with full satisfaction they embraced the
363
43. Parenthood
When ecstatic love develops into the relationship of parenthood and
becomes steadily established, the relationship is called vtsalya-rasa. The
364
such a devotee Ka could not possibly live. One devotee therefore prayed to
the parents of Lord Ka as follows: "Let me take shelter of the elderly
parental devotees of Lord Ka. They are always anxious to serve Ka and
to maintain Him, and they are always so kind to Him. Let us offer our
respectful obeisances unto them for being so kind to the Supreme Personality
of Godhead, who is the parent of the whole universe!"
There is a similar prayer by a brhmaa who says, "Let others worship the
Vedas and the Upaniads, and let others worship the Mahbhrata if they are
afraid of material existence and want to become liberated from that condition.
But as far as I am concerned, I wish only to worship Mahrja Nanda, because
the supreme absolute Personality of Godhead, Ka, is crawling in his
courtyard as his own child."
Following is a list of respectful personalities who enjoy parental affection
toward Ka: (1) mother Yaod, the Queen of Vraja, (2) Mahrja Nanda,
the King of Vraja, (3) mother Rohi, the mother of Balarma, (4) all the
elderly gops whose sons were taken away by Lord Brahm, (5) Devak, the wife
of Vasudeva, (6) the other fifteen wives of Vasudeva, (7) Kunt, the mother of
Arjuna, (8) Vasudeva, the real father of Ka and (9) Sndpani Muni,
Ka's teacher. All these are considered respectable elderly personalities with
parental love for Ka. This list is in order of superior importance, and thus
we can see that mother Yaod and Mahrja Nanda are considered to be the
supermost of all elderly personalities.
In rmad-Bhgavatam, Tenth Canto, Ninth Chapter, verse 3, ukadeva
Gosvm gives Mahrja Parkit a description of the form and beauty of
mother Yaod. He says, "My dear King, the wide hips of mother Yaod
366
her face."
There is another description of mother Yaod in a devotee's prayer: "Let
me be given protection by mother Yaod, whose curly hairs are bound with
thread, whose hair is very brightly beautified by the vermilion placed in the
part and whose bodily frame derides all her ornaments. Her eyes are always
engaged in seeing the face of Ka, my
and smoothly progress in our devotional service!"
There is the following description of mother Yaod's affection for Ka.
After rising early in the morning, mother Yaod first of all offered her breast
milk to Ka, and then she began to chant various mantras for His
protection. Then she would decorate His forehead very nicely and bind His
arms with protective talismans. By all of these activities, it is definitely
understood that she is the emblem of all maternal affection for Ka.
The description of Nanda Mahrja Ka was a baby, one day He was walking in the courtyard, capturing
the finger of His father, and because He could not walk steadily He appeared
to be almost falling down. While Nanda Mahrja Ka. The childhood ages of
Ka are divided into three periods: the beginning of kaumra age, the
367
middle of kaumra age and the end of kaumra age. During the beginning and
middle of the kaumra age, Ka's thighs are fatty, and the inner part of His
eyes are whitish. There are signs of teeth coming out, and He is very mild and
gentle. He is described as follows: "When Ka had only three or four teeth
coming out of His gums, His thighs were fatty, His body was very, very short,
and He began to enhance the parental love of Nanda Mahrja and mother
Yaod with the activities of His childish body. He was sometimes stepping
with His legs again and again, sometimes crying, sometimes smiling, sometimes
sucking His thumb and sometimes lying down flat. These are some of the
different activities of the child Ka. When Ka was lying down flat,
sometimes sucking the toes of His feet, sometimes throwing His legs upward,
sometimes crying and sometimes smiling, mother Yaod, seeing her son in
such pastimes, did not show any sign of restricting Him, but rather began to
watch her child with eagerness, enjoying these childhood pastimes." In the
beginning of Ka's kaumra age, the nails of tigers were set in a golden
necklace about His neck. There was protective tilaka on His forehead, black
mascara around His eyes and silk thread around His waist. These are the
descriptions of Ka's dress at the beginning of the kaumra age.
When Nanda Mahrja saw the beauty of child Ka, with tiger nails on
His chest, a complexion like the new-grown tamla tree, beautifully decorated
tilaka made with cow's urine, arm decorations of nice silk thread, and silk
clothes tied around His waistwhen Nanda Mahrja saw his child like this,
he never became satiated by the child's beauty.
In the middle kaumra age, the upper portion of Ka's hair falls around
His eyes. Sometimes He is covered with cloth around the lower part of His
body, and sometimes He is completely naked. Sometimes He tries to walk,
taking step by step, and sometimes He talks very sweetly, in broken language.
These are some of the symptoms of His middle kaumra age. He is thus
described when mother Yaod once saw Him in His middle kaumra age: His
scattered hairs were touching His eyebrows, and His eyes were restless, but He
could not express His feelings with proper words; still, when He was talking,
368
His talk was so nice and sweet to hear. When mother Yaod looked at His
little ears and saw Him naked, trying to run very quickly with His little legs,
she was merged into the ocean of nectar. Ka's ornaments at this age are a
pearl hanging from the septum of His nose, butter on His lotuslike palms, and
some small bells hanging from His waist. It is stated that when mother Yaod
saw that the child was moving, ringing the bells on His waist, smiling at her
with a pearl between His nostrils and with butter on His hands, she became
wonderfully pleased to see her little child in that fashion.
While Ka was in the middle of His kaumra age, His waist became
thinner, His chest became broader, and His head was decorated with His curly
hairs, resembling the falling of the wings of a crow. These wonderful features
of Ka's body never failed to astonish mother Yaod. At the end of His
kaumra age, Ka Ka's kaumra
age.
When Ka was a little grown up and was taking care of the small calves,
He would often go near the forest. And when He was a little bit late returning
home, Nanda Mahrja would immediately get up on the candra-lik (a
small shed built on the roof for getting a bird's-eye view all around), and he
would watch for Him. Worrying about the late arrival of his little son, Nanda
Mahrja would remain on the candra-lik until he could indicate to his
wife that Ka, surrounded by His little cowherd friends, was coming back
with the calves. Nanda Mahrja would point out the peacock feather on his
child's head and would inform his beloved wife how the child was pleasing his
eyes.
Mother Yaod would then address Nanda Mahrja, "See my dear son,
whose eyes are white, who has a turban on His head, a wrapper on His body
369
and leg bells which tinkle very sweetly on His feet. He is coming near, along
with His surabhi calves, and just see how He is wandering upon the sacred
land of Vndvana!"
Similarly, Mahrja Nanda would address his wife, "My dear Yaod, just
look at your offspring, Ka! See His blackish bodily luster, His eyes tinged
with red color, His broad chest and His nice golden neck lace! How wonderful
He looks, and how He is increasing my transcendental bliss more and more!"
When Ka, the beloved son of Nanda Mahrja, steps into His kaiora
age, although He becomes more beautiful, His parents still consider Him to be
in the paugaa ageeven though He is between the ages of ten and fifteen.
When Ka is in His paugaa age, some of His servants also accept Him as
being in the kaiora age. When Ka, Yaod.
In this connection mother Yaod once told Mukhar, her
maidservant,"Just look at Ka looking stealthily toward all sides and slowly
stepping forward from the bushes. It appears that He is coming just to steal the
butter. Don't expose yourself or He may understand that we are looking
toward Him. I want to enjoy the sight of His eyebrows moving in this cunning
way, and I want to see His fearful eyes and beautiful face."
In enjoying Ka's attitude of stealing butter very stealthily, mother
Yaod the
Supreme Personality of Godhead, and therefore this propensity is not
370ieka ceremony." It is the custom in
the temples of Deities that if there have been some impure activities, the
Deity has to be washed with milk. Ka is the Supreme Personality of
Godhead, and He was washed by the milk from the breast of mother Yaod,
which purified Him from the dust covering.
Sometimes there are examples of mother Yaod's becoming stunned in
ecstasy. This was exhibited when she saw her son lifting Govardhana Hill.
When Ka was standing, raising the hill, mother Yaod hesitated to
embrace Him and became stunned. The dangerous position that Ka had
accepted by lifting the hill brought tears to her eyes. With her eyes filled with
tears she could not see Ka anymore, and because her throat was choked up
by anxiety she could not even instruct Ka as to what He should do in that
position. This is a symptom of becoming stunned in ecstatic love.
Mother Yaod sometimes enjoyed transcendental ecstasy in happiness
when her child was saved from a dangerous situation, such as being attacked
by Ptan or some other demon. In rmad-Bhgavatam, Tenth Canto,
Seventeenth Chapter, verse 19, ukadeva Gosvm says that mother Yaod-mdhava of rla Rpa Gosvm, "My dear Ka, the touch of Your
mother is so pleasing and cooling that it surpasses the cooling capacity of the
pulp of sandalwood and of bright moonshine mixed with the pulp of ura
root." (Ura is a kind of root which when soaked with water has a very, very
cooling effect. It is especially used in the scorching heat of the sun.)
The parental love of mother Yaod for Ka steadily increases, and her
372
love and ecstasy are sometimes described as intense affection and sometimes as
overwhelming attachment. An example of attachment for Ka with
overwhelming affection is given in rmad-Bhgavatam, Tenth Canto, Sixth
Chapter, verse 43, where ukadeva Gosvm addresses Mahrja Parkit in
this way: "My dear King, when magnanimous Nanda Mahrja returned from
Mathur, he began to smell the head of his son, and he was merged in the
ecstasy of parental love." A similar statement is there in connection with
mother Yaod when she was too anxious to hear the sound of Ka's flute,
expecting Him back from the pasturing ground. Because she thought that it
was getting very late, her anxiety to hear the sound of Ka Ka, glorifying
His activities, the Queen of Gokula, mother Yaod, entered the Battlefield of
Kuruketra, wetting the lower part of her sr with the milk flowing from her
breast. This entrance of mother Yaod at Kuruketra was not during the
Battle of Kuruketra. At other times Ka went to Kuruketra from His
paternal home (Dvrak) during the solar eclipse, and at these times the
residents of Vndvana also went to see Him there.
When Ka arrived at Kuruketra in pilgrimage, all the people assembled
there began to say that Ka, the son of Devak, had arrived. At that time,
Devak, just like an affectionate mother, began to pat Ka's face. And again
when people cried that Ka, the son of Vasudeva, had come, both King
Nanda and mother Yaod became overwhelmed with affection and expressed
their great pleasure.
When mother Yaod, the Queen of Gokula, was going to see her son
Ka at Kuruketra, one of her friends addressed her thus: "My dear Queen,
the milk flowing out of your breast-mountain has already whitened the River
Ganges, and the tears from your eyes, mixed with black mascara, have already
blackened the color of the Yamun. And as you are standing just between the
373
two rivers, I think that there is no need for your anxiety to see your son's face.
Your parental affection has already been exhibited to Him by these two
rivers!"
The same friend of mother Yaod addressed Ka as follows: "My dear
Mukunda, if mother Yaod, the Queen of Gokula, is forced to stand on fire
but is allowed to see Your lotus face, then this fire will appear to Yaod of Vraja, always expecting to see the lotus
face of Ka, be glorified all over the universe!
A similar statement was given by Kuntdev to Akrra: "My dear brother
Akrra, my nephew Mukunda is long absent from us. Will you kindly tell Him
that His Aunt Kunt is sitting among the enemy and would like to know when
she will be able to see His lotus face again?"
In rmad-Bhgavatam, Tenth Canto, Forty-sixth Chapter, verse 28, there
is this statement: "When Uddhava was present at Vndvana and was
narrating the activities of Ka in Dvrak, mother Yaod, while hearing
this narration, began to pour milk from her breasts and shed tears from her
eyes." Another incident demonstrating Yaod's extreme love for Ka
occurred when Ka went to Mathur, the kingdom of Kasa. In separation
from Ka, mother Yaod was looking at Ka Yaod is
explained by expert devotees as ecstatic love in separation. Sometimes there
are many other symptoms, such as great anxiety, lamentation, frustration,
being stunned, humility, restlessness, madness and illusion.
As far as mother Yaod's anxieties are concerned, when Ka was out of
374
the house in the pasturing ground, a devotee once told her, "Yaod, I think
your movements have been slackened, and I see that you are full of anxieties. Yaod's
anxiety for Ka.
When Akrra was present in Vndvana and was narrating the activities of
Ka in Dvrak, mother Yaod was informed that Ka had married so
many queens and was very busy there in His householder affairs. Hearing this,
mother Yaod lamented how unfortunate she was that she could not get her
son married just after He passed His kaiora age and that she therefore could
not receive both her son and daughter-in-law at her home. She exclaimed,
"My dear Akrra, you are simply throwing thunderbolts on my head!" These
are signs of lamentation on the part of mother Yaod in separation from
Ka.
Similarly, mother Yaod felt frustration when she thought, "Although I
have millions of cows, the milk of these cows could not satisfy Ka.ndvana." This is a sign of frustration on the part of mother
Yaod in separation from Ka.
One friend of Ka's addressed Him thus: "My dear lotus-eyed one, when
You were living in Gokula You were always bearing a stick in Your hand. That
stick is now lying idle in the house of mother Yaod, and whenever she sees it
she becomes motionless just like the stick." This is a sign of becoming stunned
in separation from Ka. In separation from Ka, mother Yaod became so
humble that she prayed to the creator of the universe, Lord Brahm, with tears
in her eyes, "My dear creator, won't you kindly bring my dear son Ka back
to me so that I can see Him at least for a moment?" Sometimes, in restlessness
375
like a madwoman, mother Yaod used to accuse Nanda Mahrja, "What are
you doing in the palace? You shameless man! Why do people call you the King
of Vraja? It is very astonishing that while being separated from your dear son
Ka, you are still living within Vndvana as a hardhearted father!"
Someone informed Ka about the madness of mother Yaod in the
following words: "In madness mother Yaod has addressed the kadamba trees
and inquired from them, 'Where is my son?' Similarly, she has addressed the
birds and the drones and inquired from them whether Ka has passed before
them, and she has inquired if they can say anything about You. In this way,
mother Yaod in illusion was asking everybody about You, and she has been
wandering all over Vndvana." This is madness in separation from Ka.
When Nanda Mahrja was accused by mother Yaod of being
"hardhearted," he replied, "My dear Yaod, why are you becoming so agitated?
Kindly look more carefully. Just see, your son Ka is standing before you!
Don't become a madwoman like this. Please keep my home peaceful." And
Ka was informed by some friend that His father Nanda was also in illusion
in this way, in separation from Him.
When all the wives of Vasudeva were present in the arena of Kasa, they
saw the most pleasing bodily features of Ka, and immediately, out of
parental affection, milk began to flow from their breasts, and the lower parts
of their srs became wet. This symptom of ecstatic love is an example of the
result of fulfillment of desire.
In the First Canto of rmad-Bhgavatam, Eleventh Chapter, verse 29, it is
stated, "When Ka entered Dvrak after finishing the Battle of Kuruketra,
He first of all saw His mother and all His different stepmothers and offered
His respectful obeisances unto their feet. The mothers immediately took Ka
upon their laps, and because of their parental affection, there was milk flowing
out of their breasts. So their breast milk, mixed with the water of tears, became
the first offering to Ka." This is one of the examples of being satisfied after
a great separation.
376
377
complexion defeats the beauty of gold. Thus, let us all look upon the
transcendental beauty of rmat Rdhr." Ka's attraction for Rdhr
is described by Ka Himself thus: "When I create some joking phrases in
order to enjoy the beauty of Rdhr, Rdhr hears these joking words
with great attention; but by Her bodily features and counterwords She
neglects Me. And I even possess unlimited pleasure by Her neglect of Me, for
She becomes so beautiful that She increases My pleasure one hundred times."
A similar statement can be found in Gta-govinda, wherein it is said that when
the enemy of Kasa, r Ka, embraces rmat Rdhr, He immediately
becomes entangled in a loving condition and gives up the company of all other
gops.
In the Padyval of Rpa Gosvm it is stated that when the gops hear the
sound of Ka's flute, they immediately forget all rebukes offered by the
elderly members of their families. They forget their defamation and the harsh
behavior of their husbands. Their only thought is to go out in search of Ka.
When the gops meet Ka, the display of their exchanging glances as well as
their joking and laughing behavior is called anubhva, or subecstasy in
conjugal love.
In the Lalita-mdhava, Rpa Gosvm explains that the movements of
Ka's eyebrows are just like the Yamun and that the smiling of Rdhr is
just like the moonshine. When the Yamun and the moonshine come in
contact on the bank of the river, the water tastes just like nectar, and drinking
it gives great satisfaction. It is as cooling as piles of snow. Similarly, in the
Padyval, one constant companion of Rdhr says, "My dear moon-faced
Rdhr, Your whole body appears very content, yet there are signs of tears
in Your eyes. Your speech is faltering, and Your chest is also heaving. By all
these signs I can understand that You must have heard the blowing of Ka's
flute, and as a result of this, Your heart is now melting."
In the same Padyval there is the following description, which is taken as a
sign of frustration in conjugal love. rmat Rdhr said, "Dear Mr. Cupid,
please do not excite Me by throwing your arrows at My body. Dear Mr. Air,
379
front of Ka, Lord Baladeva was standing, causing a cooling effect. But even
amid all these different circumstances of soothing and disturbing effects, the
lotus flower of ecstatic conjugal love that Ka felt for Rdhr could not
wither." This love of Ka for Rdhr is often compared to a blooming
lotus; the only difference is that Ka) prvarga, or preliminary
attraction, (2) mna, or seeming anger, and (3) pravsa, or separation by
distance.
When the lover and the beloved have a distinct feeling of not meeting each
other, that stage is called prva-rga, or preliminary attraction. In Padyval
Rdhr told Her companion, "My dear friend, I was just going to the bank
of the Yamun,." This is an
instance of preliminary attraction for Ka. In rmad-Bhgavatam, Tenth
Canto, Fifty-third Chapter, verse 2, Ka told the messenger brhmaa who
came from Rukmi, "My dear brhmaa, just like Rukmi I cannot sleep at
night, and My mind is always fixed on her. I know that her brother Rukm is
against Me and that due to his persuasion My marriage with her has been
cancelled." This is another instance of preliminary attraction.
As far as mna, or anger, is concerned, there is the following incident
described in Gta-govinda: "When rmat Rdhr saw Ka enjoying
Himself in the company of several other gops,
381
disagreement.
An example of pravsa, or being out of contact because of living in a
distant place, is given in the Padyval as follows: "Since the auspicious day
when Ka left for Mathur, rmat Rdhr has been pressing Her head
on one of Her hands and constantly shedding tears. Her face is always wet
now, and therefore there is no chance of Her sleeping even for a moment."
When the face becomes wet, the sleeping tendency is immediately removed.
So when Rdhr was always weeping for Ka because of His separation,
there was no chance of Her getting any sleep for Herself. In the
prahlda-sahit Uddhava says, "The Supreme Personality of Godhead,
Govinda, panic-stricken due to being pierced by the arrows of Cupid, is always
thinking of you [the gops], and He is not even accepting His regular lunch.
Nor is He getting any proper rest."
When the lover and beloved come together and enjoy one another by
direct contact, this stage is called sambhoga. There is a statement in Padyval
as follows: "Ka embraced rmat Rdhr in such an expert manner that
He appeared to be celebrating the dancing ceremony of the peacocks."
r Rpa Gosvm thus ends the fifth wave of his Ocean of the Nectar of
Devotion. He offers his respectful obeisances to the Supreme Personality of
Godhead, who appeared as Gopla, the eternal form of the Lord.
Thus ends the Bhaktivedanta summary study of the third division of
Bhakti-rasmta-sindhu in the matter of the five primary relationships with
Ka.
the cause of the laughter. In such laughing devotional service, there are
symptoms of jubilation, laziness, concealed feelings and similar other
seemingly disturbing elements.
According to rla Rpa Gosvm Ka was stealing yogurt, Jarat, the headmistress of the house,
could detect His activities, and she was therefore coming very hurriedly to
catch Him. At that time, Ka became very much afraid of Jarat and went to
His elder brother, Baladeva. He said, "My dear brother, I have stolen yogurt!
Just seeJarat is coming hurriedly to catch Me!" When Ka was thus
seeking the shelter of Baladeva because He was being chased by Jarat, all the
great sages in the heavenly planets began to smile. This smiling is called smita
smiling.
Smiling in which the teeth are slightly visible is called hasita smiling. One
day Abhimanyu, the so-called husband of Rdhr, was returning home, and
at that time he could not see that Ka was there in his house. Ka
immediately changed His dress to look exactly like Abhimanyu and
approached Abhimanyu's mother, Jail, addressing her thus: "My dear mother,
I am your real son Abhimanyu, but just seeKa, dressed up like me, is
coming before you!" Jail, the mother of Abhimanyu, immediately believed
that Ka was her own son and thus became very angry at her real son who
was coming home. She began to drive away her real son, who was crying,
"Mother! Mother! What are you doing?" Seeing this incident, all the girl
friends of Rdhr, who were present there, began to smile, and a portion of
384
386
Astonishment
The ecstasy of astonishment in devotional service is perceived in two ways:
directly, by the experience of one's own eyes, and indirectly, by hearing from
others.
When Nrada came to see the activities of the Lord at Dvrak and he saw
that Ka was present within every palace in the same body and was engaged
in different activities, he was struck with wonder. This is one of the examples
of astonishment in devotional service by direct perception. One of the friends
of mother Yaod said, "Yaod, Mahrja Parkit heard from ukadeva Gosvm about Ka's
killing Naraksura, who had been fighting Ka with eleven akauhi
divisions of soldiers. Each division of akauhi soldiers contained several
thousand elephants, several thousand horses and chariots and several
hundreds of thousands of infantry soldiers. Naraksura possessed eleven such
divisions, and all of them were throwing arrows toward Ka, but Ka killed
them all, simply by throwing three arrows from His side. When Mahrja
Parkit heard of this wonderful victory, he immediately rubbed the tears from
his eyes and became overwhelmed with joy. This instance is an example of
astonishment in devotional service by indirect perception through aural
reception.
There is another example of indirect astonishment. Trying to test Ka to
see if He were truly the Supreme Personality of Godhead, Lord Brahm stole
387
all the cowherd boys and cows from Him. But after a few seconds, he saw that
Ka was still present with all the cows, calves and cowherd boys, exactly in
the same way as before. When Lord Brahm described this incident to his
associates on the Satyaloka planet, they all became astonished. Brahm told
them that after taking away all the boys, he saw Ka again playing with the
same boys in the same fashion. Their bodily complexion was blackish, almost
like Ka's, and they all had four arms. The same calves and cows were still
present there, in the same original fashion. Even while describing this
incident, Brahm became almost overwhelmed. "And the most astonishing
thing," he added, "was that many other Brahms from many different
universes had also come there to worship Ka and His associates."
Similarly, when there was a forest fire in the Bhravana, Ka
instructed His friends to close their eyes tightly, and they all did this. Then
when Ka had extinguished the fire, the cowherd boys opened their eyes
and saw that they had been relieved from the danger and that their cows and
calves were all safe. They began to perceive the wonder of the situation simply
by guessing how Ka had saved them. This is another instance of indirect
perception causing astonishment in devotional service..-vra. By
388
seeI am jumping with great chivalrous prowess. Please do not flee away."
Upon hearing these challenging words, a friend named Varthapa
counterchallenged the Lord and struggled against Him.
One of the friends once remarked, "Sudm is trying his best to see
Dmodara defeated, and I think that if our powerful Subala joins him, they
will be a very beautiful combination, like a valuable jewel bedecked with gold."
In these chivalrous activities, only Ka's friends can be the opponents.
Ka's enemies can never actually be His opponents. Therefore, this
challenging by Ka's friends is called devotional service in chivalrous
activities.
Dna-vra, or chivalry in giving charity, may be divided into two parts:
munificence and renunciation. A person who can sacrifice everything for the
satisfaction of Ka is called munificent. When a person desires to make a
sacrifice because of seeing Ka, Ka is called the impetus of the
munificent activity. When Ka appeared as the son of Nanda Mahrja, in
clear consciousness Nanda Mahrja desired all auspiciousness for his son and
thus began to give valuable cows in charity to all the brhmaas. The
brhmaas were so satisfied by this charitable action that they were obliged to
say that the charity of Nanda Mahrja had excelled the charity of such past
kings as Mahrja Pthu and Nga.
When a person knows the glories of the Lord completely and is prepared to
sacrifice everything for the Lord, he is called sampradnaka, or one who gives
everything in charity for the sake of Ka.
When Mahrja Yudhihira went with Ka in the arena of the Rjasya
sacrifice, in his imagination he began to anoint the body of Ka with pulp of
sandalwood, he decorated Ka with a garland hanging down to His knees, he
gave Ka garments all embroidered with gold, he gave Ka ornaments all
bedecked with valuable jewels, and he gave Ka many fully decorated
elephants, chariots and horses. He further wished to give Ka in charity his
kingdom, his family and his personal self also. After so desiring, when there
391
the reservoir of all places of pilgrimage.?"
One devotee has described his feelings about the charity exhibited by King
Mayradhvaja: "I am faltering even to speak about the activities of Mahrja
Mayradhvaja, to whom I offer my respectful obeisances." Mayradhvaja was
very intelligent, and he could understand why Ka came to him once, in the
garb of a brhmaa. Ka demanded from him half of his body, to be sawed
off by his wife and son, and King Mayradhvaja agreed to this proposal. On
account of his intense feeling of devotional service, King Mayradhvaja was
always thinking of Ka, and when he understood that Ka had come in
the garb of a brhmaa, he did not hesitate to part with half of his body. This
sacrifice of Mahrja Mayradhvaja for Ka's sake is unique in the world,
and we should offer our all-respectful obeisances to him. He had full
knowledge of the Supreme Personality of Godhead in the garb of a brhmaa,
and he is known as the perfect dna-vra, or renouncer.
Any person who is always ready to satisfy Ka and who is always
dexterous in executing devotional service is called dharma-vra, or chivalrous
in executing religious rituals. Only advanced devotees performing religious
ritualistic performances can come to this stage of dharma-vra. Dharma-vras
are produced after going through the authoritative scriptures, following moral
principles, being faithful and tolerant and controlling the senses. Persons who
execute religious rituals for the satisfaction of Ka are steady in devotional
service, whereas persons who execute religious rituals without intending to
please Ka are only called pious.
393
Compassion
When the ecstasy of devotional service produces some kind of lamentation
in connection with Ka, it is called devotional service in compassion. The
impetuses for this devotional service are Ka's transcendental quality, form
and activities. In this ecstasy of devotional service there are sometimes
symptoms like regret, heavy breathing, crying, falling on the ground and
beating upon one's chest. Sometimes symptoms like laziness, frustration,
394
Anger
In ecstatic loving service to Ka in anger, Ka is always the object. In
Vidagdha-mdhava, Second Act, verse 37, Lalit-gop expressed her anger,
which was caused by Ka, when she addressed rmat Rdhr thus: "My
dear friend, my inner desires have been polluted. Therefore I shall go to the
place of Yamarja. But I am sorry to see that Ka has still not given up His
smiling over cheating You. I do not know how You could repose all Your
loving propensities upon this lusty young boy from the neighborhood of the
cowherds."
After seeing Ka, Jarat sometimes said, "O You thief of young girls'
properties! I can distinctly see the covering garment of my daughter-in-law on
Your person." Then she cried very loudly, addressing all the residents of
396
Vndvana to inform them that this son of King Nanda was setting fire to the
household life of her daughter-in-law.
Similar ecstatic love for Ka in anger was expressed by Rohi-dev when
she heard the roaring sound of the two falling arjuna trees to which Ka had
been tied. The whole neighborhood proceeded immediately toward the place
where the accident had taken place, and Rohi-dev took the opportunity to
rebuke mother Yaodhi-dev's anger toward Yaod is an example of
ecstatic love in anger caused by Ka.
Once, while Ka was in the pasturing ground with His cowherd boys, His
friends requested Him to go to the Tlavana forest, where Gardabhsura, a
disturbing demon in the shape of an ass, resided. The friends of Ka wanted
to eat the fruit from the forest trees, but they could not go because of fear of
the demon. Thus they requested Ka to go there and kill Gardabhsura.
After Ka did this, they all returned home, and their report of the day's
activity perturbed mother Yaod because Ka had been sent alone into
such danger in the Tlavana forest. Thus she looked upon the boys with anger.
There is another instance of anger on the part of a friend of Rdhr's.
When Rdhr was dissatisfied with the behavior of Ka and had stopped
talking with Him, Ka was very sorry for Rdhr's great dissatisfaction,
and in order to beg forgiveness, He fell down at Her lotus feet. But even after
this, Rdhr was not satisfied, and She did not talk with Ka. Ka's peacock
feather has touched Your feet, You still appear to be red-faced."
397
Dread
In ecstatic love for Ka in dread, there are two causes of fear: either
Ka Himself or some dreadful situation for Ka. When a devotee feels
himself to be an offender at Ka's lotus feet, Ka Himself becomes the
object of dreadful ecstatic love. And when, out of ecstatic love, friends and
well-wishers of Ka apprehend some danger for Him, that situation becomes
the object of their dread.
When karja was in front of Ka fighting and suddenly realized that
Ka is the Supreme Personality of Godhead, Ka addressed him thus: "My
dear karja, why is your face so dry? Please do not feel threatened by Me.
There is no need for your heart to tremble like this. Please calm yourself down.
I have no anger toward you. You may, however, become as angry as you like
with Meto expand your service in fighting with Me and to increase My
sporting attitude." In this dreadful situation in ecstatic love for Ka, Ka
Himself is the object of dread.
There is another instance of a dreadful situation with Ka as the object
as follows. After being sufficiently chastised by child Ka in the Yamun
River, the Kli
400
actual position, and out of ignorance I have committed such horrible offenses.
Please save me. I am a most unfortunate, foolish creature. Please be merciful to
me." This is another instance of the ecstasy of dread in devotional service.
When the Ke demon was causing disturbances in Vndvana by assuming
a large horse's body that was so big that he could jump over the trees, mother
Yaod told her husband, Nanda Mahrja, "Our child is very restless, so we
had better keep Him locked up within the house. I have been very worried
about the recent disturbances of the Ke demon, who has been assuming the
form of a giant horse." When it was learned that the demon was entering
Gokula in an angry mood, mother Yaod became so anxious to protect her
child that her face dried up and there were tears in her eyes. These are some of
the signs of the ecstasy of dread in devotional service, caused by seeing and
hearing something that is dangerous to Ka.
After the Ptan witch had been killed, some friends of mother Yaod
inquired from her about the incident. Mother Yaod at once requested her
friends, "Please stop! Please stop! Don't bring up the incident of Ptan. I
become distressed just by remembering this incident. The Ptan behind oneself,
concealing oneself, bewilderment, searching after the endangered lovable
object and crying very loudly. Some other unconstitutional symptoms are
illusion, forgetfulness and expectation of danger. In all such circumstances the
ecstatic dread is the steady or constant factor. Such dread is caused either by
offenses committed or by dreadful circumstances. Offenses may Ptan witch. Dread
may be caused by mischievous demoniac characters, such as King Kasa, and
401
Ghastliness
It is understood from authoritative sources that an attachment for Ka
because of feelings of disgust sometimes presents a ghastly ecstasy in
devotional service. The person experiencing such ecstatic love for Ka is
almost always in the neutral stage of devotional service, or nta-rasa. A
description of ecstatic love caused by ghastliness is found in the following
statement: "This person was formerly interested solely in the matter of lust
and sense gratification, and he had perfected the greatest skill in exploiting
women to fulfill his lusty desires. But now how wonderful it is that this same
man is chanting the names of Ka with tears in his eyes, and as soon as he
sees the face of a woman, he immediately becomes disgusted. From the
indication of his face, I would think that now he hates sex life."
In this mellow of devotional service in ghastliness, the subecstatic.
When a devotee, lamenting for his past abominable activities, shows special
symptoms on his body, his feeling is called ecstasy in devotional service in
ghastliness. This is caused by the awakening of his Ka consciousness.
In this connection there is the following statement: "How can a person take
pleasure in the enjoyment of sex life in this body, which is a bag of skin and
bones, filled with blood and covered by skin and flesh, and which produces
mucus and evil smells?" This perception is possible only for one who is
402
403-vra and dharma-vra
405
loving service of this supreme fire, Lord Ka.", r Ka, Ka Ka. Simply by
observing his dance you will lose all interest in even the most beautiful
women!" In this statement the whole is in neutrality, and the part is in
ghastliness.
407ndvana who had the opportunity of enjoying Ka's kissing
must be the foremost of all the fortunate women in the world." In this
example, the ecstasy of fraternal devotional service is the whole, and the
ecstasy of conjugal love is the part.
The following statement was made by Ka to the gops: "My dear
enchanted, don't gaze at Me with longing eyes like this. Be satisfied and return
to your homes in Vndvana. There is no necessity of your presence here."
While Ka was joking in this way with the damsels of Vraja, who with great
hope had come to enjoy the rsa dance with Him, Subala was also on the
scene, and he began to look at Ka Ka saw that
Subala, in the dress of Rdhr, was silently hiding under the shade of a
beautiful aoka tree on the bank of the Yamun, He immediately arose from
His seat in surprise. Upon seeing Ka, Subala tried to hide his laughter by
covering his cheeks.
There is also an example of a mixture of parental love and compassion in
devotional service. When mother Yaod was thinking that her son was
walking in the forest without any umbrella or shoes, she became greatly
408
devotional service. Ka, in the dress of a young girl, told Rdhr, "Oh,
You hardhearted girl! Don't You know that I am Your sister? Why are You
unable to recognize Me? Be merciful upon Me and please capture My shoulders
and embrace Me with love!" While Ka was dressed up exactly like
Rdhr, He was speaking these nice words, and rmat Rdhrrval saw that Ka was preparing to fight with the
Vsura demon, she began to think, "How wonderful Ka is! His mind is
captivated by the eyebrows of Candrval in a smiling spirit, His snakelike
arms are on the shoulder of His friend, and at the same time He is roaring like
a lion to encourage Vsura to fight with Him!" This is an example of
conjugal love, fraternity and chivalry. The conjugal love is taken here as the
whole, and the fraternity and chivalry are taken as the parts.
When Kubj caught hold of Ka's yellow garment because she was feeling
almost lusty with sex urge, Ka.
Vila, a cowherd boy who was attempting to fight with Bhadrasena, was
addressed by another cowherd boy as follows:"Why are you attempting to show
your chivalrous spirit before me? Before this, you even attempted to fight with
rdm, but you must know that rdm does not even care to fight with
hundreds of Balarmas. So why are you acting so enthusiastically when you
actually have no importance at all?" This is an example of a mixture of
devotional fraternity and chivalry. The chivalry is taken as the whole, and the
fraternity is taken as the part.
410.
neutrality when he sarcastically prayed, "I am very anxious to see Ka, the
Supreme Personality of Godhead, who is many millions of times more
affectionate than the Pits [forefathers] in the Pitloka and who is always
worshiped by the great demigods and sages. I am a little surprised, however,
that although Ka is the husband of the goddess of fortune, His body is often
marked with the nail pricks of ordinary society girls!" Here is an example of
incompatibility due to a mixture of neutrality and high conjugal love.
There is the following statement by a gop: "My dear Ka, Ka, how can I address You as my son when
You are addressed by the great Vedntists as the Absolute Truth and by the
Vaiavas who follow the principles of Nrada-pacartra Ka, so I request you to please arrange for
my meeting Him immediately." In this statement there is the incompatibility
of a neutral mellow mixed with conjugal love.
A lusty woman in Kailsa once told Ka, "My dear Ka, may You have a
long life!" Then, after saying this, she embraced Ka. This is an example of
incompatibility resulting from a mixture of parental love and conjugal love.
The purpose of the above analysis is to show that in the mixture of various
mellows, or reciprocations of ecstatic love between Ka and the devotees, if
the result is not pure there will be incompatibility. According to the opinion
413-mdhava, Second Act, verse 31, Ka tells His friend, "My
dear friend, what a wonderful thing it is that since I have seen the beautiful
lotus eyes of rmat Rdhr, I have developed a tendency to spit on the
moon and the lotus flower!" This is an example of conjugal love mixed with
ghastliness, but there is no incompatibility.
The following is a statement which describes different mellows of
devotional service: "Although Ka was invincible to any enemy, the
cowherd boys of Vndvana became almost blackish with astonishment upon
seeing His wonderful royal garments and His fighting feats on the Battlefield
of Kuruketra." In this statement, although there is a mixture of chivalrous
activities and dread in devotional service, there is no perverted reflection of
mellows.
One resident of Mathur requested her father to bolt the doors and then go
with her to the school of Sndpani Muni to find Ka. She complained that
Ka had completely stolen her mind. In this incident there is a mixture of
conjugal love and parental love, but there is no incompatibility.
A brahmnand (impersonalist) expressed his desire as follows: "When shall
I be able to see that supreme absolute Personality of Godhead who is eternal
bliss and knowledge and whose chest has become smeared with red kukum
powder by touching the breast of Rukmi?" Here there is a mixture of
conjugal love and neutrality. Although this is a contradiction of mellows,
there is no incompatibility, because even a brahmnand will become attracted
to Ka.
416
Nanda Mahrja told his wife, "My dear Yaod, although your son, Ka,
is as delicate and soft as the mallik flower, He has gone to kill the Ke
demon, who is as strong as a mountain. Therefore I have become a little
disturbed. But never mind, all auspiciousness to my son! I shall raise this hand,
which is as strong as a pillar, and I shall kill the Ke demon, just to give
freedom from all anxieties to the inhabitants of Vraja-maala!" In this
statement there are two kinds of mellows: chivalry and dread. Both of them,
however, improve the position of parental love, and therefore there is no
incompatibility.
In the Lalita-mdhava of rla Rpa Gosvm it is stated, "After Ka's
arrival in Kasa's arena, Kasa's priest looked at Ka with a detestful
expression. The entire arena was filled with dread on the part of Kasa and
his priest and restless expressions of pleasure on the cheeks of Ka's friends.
Frustration was felt by His envious rivals. The great sages meditated. Hot tears
were in the eyes of Devak-mdhaja. He is the
cause of all pleasure to all young girls. May He be ever compassionate upon you
all!"
417
In the Lalita-mdhava, rla Rpa Gosvm says, "The wives of the yjika
brhmaas were all young girls, and they were attracted to Ka in the same
way as the gops of Vndvana. Out of their attraction, they distributed food to
Ka." Here the two devotional mellows are conjugal love and parental love,
and the result is called uparasa in conjugal love.
One of the friends of rmat Rdhr told Her, "My dear friend
Gndharvik [Rdhr], You were the most chaste girl in our village, but
now You have divided Yourself and are partially chaste and partially unchaste.
It is all due to Cupid's influence upon You after You saw Ka and heard the
sound of His flute." This is another example of uparasa caused by divided
interests in conjugal love.
According to some expert learned scholars, the feelings between lover and
beloved create perverted reflections of mellows in many ways.
"The gops have become purified by Ka's glance, and as such, Cupid's
influence is distinctly visible on their bodies." Although in the material sense
the glancing of a boy at a girl is a kind of pollution, when Ka threw His
transcendental glance at the gops, they became purified. In other words,
because Ka is the Absolute Truth, any action by Him is transcendentally
pure.
After Ka chastised the Kliya-nga in the Yamun River by dancing on
his heads, the Kliya-nga's wives addressed Ka, "Dear cowherd boy, we are
all only young wives of the Kliya-nga, so why do You agitate our minds by
sounding Your flute?" Kliya's wives were flattering Ka so that He would
spare their husband. Therefore this is an example of uparasa, or false
expression.
One devotee said, "My dear Govinda, here is a nice flowery bush in Kailsa.
I am a young girl, and You are a young poetic boy. After this, what more can I
say? You just consider." This is an example of uparasa, caused by impudence in
conjugal love.
When Nrada Muni was passing through Vndvana, he came to the
419
Bhravana forest and saw in one of the trees the famous parrot couple that
always accompanies Lord Ka. The couple was imitating some discussion
they had heard upon the Vednta philosophy, and thus were seemingly arguing
upon various philosophical points. Upon seeing this, Nrada Muni was struck
with wonder, and he began to stare without moving his eyelids. This is an
example of anurasa, or imitation.
When Ka was fleeing from the battlefield, from a distant place
Jarsandha was watching Him with restless eyes and was feeling very proud.
Being thus puffed up with his conquest, he was repeatedly laughing. This is an
example of aparasa.
Everything in connection with Ka is called ecstatic devotional love,
although it may be exhibited in different ways: sometimes in right order and
sometimes as a perverted reflection. According to the opinion of all expert
devotees, anything that will arouse ecstatic love for Ka is to be taken as an
impetus for transcendental mellow.
Thus ends the Bhaktivedanta summary study of r Bhakti-rasmta-sindhu by
rla Rpa Gosvm.
Concluding Words
rla Rpa Gosvm concludes by saying that Bhakti-rasmta-sindhu is
very difficult for ordinary men to understand, yet he hopes that Lord Ka,
the eternal Supreme Personality of Godhead, will be pleased with his
presentation of this book.
By rough calculation it is estimated that rla Rpa Gosvm finished r
Bhakti-rasmta-sindhu in Gokula Vndvana in the year 1552. While
physically present, rla Rpa Gosvm was living in different parts of
420
421
Endnotes
1 (Popup - Popup)
422
423
424
425
426
427
There is
Caitanya Mahprabhu taught the whole world how one can become
exalted simply by learning the science of K a,
428
429
2 (Popup - Popup)
430
So we can enjoy K
embrace of the
431
432
being is so small, it appears to merge into the spiritual sky. But it does not
merge. It is still there. The individuality is still there.
Following previous
434
435
So this is pure
436
Preacher must be
437
438
440
441
3 (Popup - Popup)
442
443
444
445
446
The senses are our enemies. That's all right. We also admit that. The
447
448
4 (Popup - Popup)
449
450
451
6 (Popup - Popup)
"When one is not too attached to or detached from this material world and
by some good fortune develops faith in the service of K a's lotus feet, he is
considered to possess the
452
453
454
455
Acyutnanda:
456
7 (Popup - Popup)
The fifth kind of liberation, merging with the Supreme, is not considered
an opulence in spiritual variegated existence.
8 (Popup - Popup)
So
457
458
459
11 (Popup - Popup)
460
One may question how he becomes purified if he's born into a family of
dog-eaters. How does he become purified? According to
461
462
12 (Popup - Popup)
18.5
"Acts of sacrifice, charity and penance are not to be given up but should be
performed. Indeed, sacrifice, charity and penance purify even the great soul."
Even if one is in the renounced order, he should never give up the regulative
principles. He should worship the Deity and give his time and life to the
service of K a. He should also continue following the rules and regulations
of austerity and penance. These things cannot be given up. One should not
think oneself very advanced simply because one has accepted the
463
You must see that they strictly follow the regulative principles, the four
prohibitions as well as the devotional practices of arising early, taking morning
bath, putting on
464
13 (Popup - Popup)
465
So the
So take the
466
Prabhupda:
467
7.5
468
469
470
471
14 (Popup - Popup)
472
473
One should be very humble and meek to offer one's desires and chant
prayers composed in glorification of the holy name, such as
474
The clearing stage means that we still commit offences, but we try to rectify
them.
No taste.
Remedy:
476
1. Fall at the devotee's feet and beg for forgiveness. Sincerely repent.
2. If the devotee is not appeased by our apologies, we should serve him for
many days according to his desires.
3. If the offence is so great that the devotee's anger does not die, one
should take full and constant shelter of the chanting of the holy name. rila
Visvanatha Cakravarti Thakura says that in time, the divine power of the holy
name will free the person from his offence. However, he warns that one
should not take advantage of this to avoid begging for forgiveness and serving
the devotee. This type of mentality implicates one in further offence.
Remedy:
1. Repent intensely and meditate on Lord Vi u, K
a.
477
Remedy:
1. Cast away the bad association and bogus scriptures.
2. Throw oneself at the lotus feet of one's spiritual master, repenting
piteously.
478
Remedy:
1. Approach a householder Vaisnava who originally came from a very low
caste.
2. Smear the dust of his feet all over one's body with great respect and
faith.
3. Eat the remnants of the Vaisnava's food and drink the water that washed
his feet.
4. In this way, the proper attitude towards the holy name will again develop
within the offender's heart.
(Kalidasa, Jhadu Thakura. Lord Caitanya's mercy upon Kalidasa).
479
Remedy:
1. Leave aside all material attachments and accept voluntary poverty.
2. Humbly worship K
Remedy:
1. To remove apathy, the recommended process is to chant in the company
of fixed up devotees in a secluded spot, or to sit by oneself with one's head
covered with a cloth so that there will be no distractions.
2. To remove laziness, one must make the effort to associate with advanced
devotees who are ceaselessly engaged in devotional service.
3. The remedy for distraction is to make a constant effort to drive these
thoughts away from the mind and diligently follow the rules of Vaisnava
etiquette, observe Ekadasi vows and fast and chant throughout the night
during important festivals.
If we chant nicely, avoiding all the offences, we will make great progress in
480
our K
a consciousness.
15 (Popup - Svarupa-siddhi)
9.32
481
482
11.28.1
"Of the two rules, Rmacandra Pur obeys the first by abandoning praise,
but although he knows that the second is more prominent, he neglects it by
criticising others."
Purport: The above-mentioned verse from
483
Pu a K
a:
484
485
17 (Popup - Popup)
10.14.8
486
487
10.14.8
12.7
488
489
18 (Popup - Popup)
490
491
19 (Popup - Popup)
Purport: All the great stalwart personalities in the universe, including Lord
Brahm and Lord iva, are fully under the control of the Supreme Personality
492
493
494
20 (Popup - Popup)
a)
"My dear friend, if you still have any desire to enjoy the company of your
friends within this material world, then don't look upon the form of K a,
who is standing on the bank of the Kesi-ghata (a bathing place in Vrindavan).
He is known as Govinda, and his eyes are very enchanting. He is playing upon
His flute, and on His head there is a peacock feather. And His whole body is
illuminated by the moonlight in the sky."
b)
"My dear foolish friend, I think that you have already heard some of the
auspicious
c)
"It is very astonishing that since I have seen this Personality of Godhead,
who is washed by the tears of my eyes, there is shivering of my body, and He
495
e)
"I remember the Lord standing by the banks of the Yamuna River, so
beautiful amid the
Hearing
496
497
498
499
21 (Popup - Popup)
500
501
502
503
504
505
506
"When one is not attached to anything, but at the same time accepts
everything in relation to K a, one is rightly situated above possessiveness."
(
507
508
509
22 (Popup - Popup)
23 (Popup - Popup)
510
511
512
Devotee (1):
513
514
24 (Popup - Popup)
515
516
25 (Popup - Popup)
517
a. This is
26 (Popup - Popup)
519
This centre is meant for giving a chance to the common people to have the
association of devotees.
520
Therefore in the
522
This is the
27 (Popup - Popup)
523
Devak was the "natural" mother of Ka, His father being Vasudeva. In
order to protect the divine baby from Devak's brother, Kasa, Vasudeva
delivered Ka to Nnda and mother Yaoda in Vndvana, and it was there
that He exhibited His childhood pastimes. At sixteen years of age He returned
to Mathur (where Devak had given birth to Him) and vanquished Kasa in
the arena mentioned here. See the author's Ka, as well as his
rmad-Bhgavatam, for fuller details of these events.
31 (Popup - Popup)
The tamla tree is always described as being the same color as Ka.
34 (Popup - Popup)
36 (Popup - Popup)
Bali was a king of the demons who waged war against the demigods and nearly
conquered the universe. When the demigods prayed for help, the Lord
appeared as Vmanadeva, a dwarf brhmaa, and asked Bali for three paces of
land. Bali agreed, and Vmana covered all the worlds with His first two steps.
Then He demanded to know where His third pace was to be. Bali offered his
own head beneath the Lord's foot and thus became a mahjana, or a great
devotee.
37 (Popup - Popup)
Balarma and Baladeva are different names for the same expansion of Ka.
He is Ka's elder brother.
39 (Popup - Popup)
The specific pastimes in this period took place in the forest known as
Bhravana. This Bhravana, along with eleven other vanas, or forests, is
still existing in the Vndvana area, and devotees who circumambulate the
whole area of Vndvana can know the beauty of these forests even today.
40 (Popup - Popup)
This Arjuna, living in Vndvana, is different from the friend of the same
name to whom Bhagavad-gt was spoken.
41 (Popup - Popup)
This Arjuna, living in Vndvana, is different from the friend of the same
name to whom Bhagavad-gt was spoken.
525
|
https://www.scribd.com/document/335791196/Nectar-of-Devotion-Bhakti-rasamrtha-sindhu
|
CC-MAIN-2019-35
|
refinedweb
| 54,767
| 58.62
|
TIP
📺 Watch the video : Use Azure Dev Spaces to collaborate with a team on Kubernetes (opens new window).
💡 Learn more : Azure Dev Spaces (opens new window).
# Part 3 - Use Azure Dev Spaces to collaborate with a team on Kubernetes
# Working with a team on a container-based solution
This is part 3 of a 3-part series about Azure Dev Spaces (opens new window). In part 1, we learned how to get started with Azure Dev Spaces and in part 2, we developed a multi-service application that runs in multiple containers.
- Part 1 Get started with .NET Core on Kubernetes with Azure Dev Spaces (opens new window)
- Part 2 Develop multi-service applications on Kubernetes with Azure Dev Spaces (opens new window)
- Part 3 Use Azure Dev Spaces to collaborate with a team on Kubernetes (this post) (opens new window)
So far, we have been the only developer for the solution. But often, we would be working on a solution in a team of multiple developers. Working on containers in a team can be difficult. Traditionally, each developer would have to create a local development environment and run all containers that make up the solution locally. Or you would set up a separate environment in Azure and use that for development. Both options require a lot of resources and maintenance and make it difficult to stay in sync with the work of the team.
Azure Dev Spaces offers a solution for working with a team on a container-based solution. It provides the concept of a space, which allows you to work in isolation, and without the fear of breaking your team members.
Here is how it works: In Kubernetes (in our case, Azure Kubernetes Service (opens new window), you can have multiple namespaces. Within a namespace you can deploy and run many services that make up a complete solution. In this case, our solution consists of the webfrontend that calls the mywebapi. They are both in the namespace called dev. When I want to work on the mywebapi service, without disrupting the rest of the team, I can set up a new namespace called tipsandtricks and run the mywebapi in there and make changes. Now, I can call the changed mywebapi from the webfrontend in the dev namespace, because Azure Dev Spaces routes everything together for me. Azure Dev Spaces is the magic ingredient that makes this easy. And because Azure Dev Spaces is enabled for these namespaces, we simply call them spaces from now on. Let's try it out.
# Prerequisites
If you want to follow along, you'll need the following:
- An Azure subscription (If you don't have an Azure subscription, create a free account (opens new window) before you begin)
- The .NET Core SDK (opens new window)
- The latest version of Visual Studio Code (opens new window)
- Execute all the steps of part 1 - Get started with .NET Core on Kubernetes with Azure Dev Spaces and part 2 - Develop multi-service applications on Kubernetes with Azure Dev Spaces
# Set up a baseline
If you have followed the steps in part 1 and 2 of this series, you are already running the webfrontend and mywebapi in a namespace called default. We are going to create a new space called dev, that we will use as the baseline for our development. This will be the place that contains the latest, stable version of the services, that everybody in the team uses.
- You should have the Azure Dev Spaces sample application (opens new window) on your local machine. Clone or download it if you don't have it anymore
- Open a command prompt and enter the following command to create the dev space:
azds space select --name dev
- When you are asked to select a parent space, select <none>
- Now navigate to the webfrontend directory (located in the sample application at samples/dotnetcore/getting-started/webfrontend) and execute the following command to deploy the app to the dev space:
azds up -d
- Navigate to the mywebapi directory and execute the following command again:
azds up -d
The baseline is now set up in the dev space. You can check to see what the URI of the webfrontend in the dev space is by executing:
azds list-uris
The result will look like this:
(The URIs of the services in dev)
# Develop and test in your own space
Now that we have a baseline, we can set up our own space to work in:
- In the command prompt, create a new space by executing the following:
azds space select --name tipsandtricks
- When asked if you want to select a parent space, select the dev space
- Open the mywebapi directory in VS Code and navigate to the ValuesController.cs file.
- In the ValuesController, change the Get(int id) method to this:
public string Get(int id) { return "The API says something new"; }
2
3
4
- Now run the API by pressing F5 or typing azds up in the terminal window of VS Code
The new version of mywebapi is now deployed to the dev/tipsandtricks space. You can see that it is running and what the URIs look like by executing azds list-up and azds list-uris, like in the image below:
(The list of services and URIs after changing the mywebapi)
Mywebapi is now running in the dev/tipsandtricks space. The version running in dev is still running but it is not listed. And the public access point URL for webfrontend is prefixed with tipsandtricks.s. This URL is unique to the dev/tipsandtricks space.
Test it out by opening a URL and navigating to the public endpoint of webfrontend (with the tipsandtricks.s prefix). You'll see the results of the changes in mywebapi, like in the image below:
(The result of the changes in mywebapi)
Now remove tipsandtricks.s from the URL and reload the page. Now, you see the baseline version of mywebapi that is running in the dev space.
# Conclusion
Azure Dev Spaces (opens new window) makes it easy to develop applications on Kubernetes (opens new window). It creates a fast develop-deploy-debug cycle and it removes the need to create an elaborate local development infrastructure. And Azure Dev Spaces also works very well for developers working in teams, because its concept of spaces and because its routing features make it easy to work in isolation without having a complete environment or mocking dependencies. You can learn more about how Azure Dev Spaces works here (opens new window). Go and check it out!
|
https://microsoft.github.io/AzureTipsAndTricks/blog/tip230.html
|
CC-MAIN-2021-17
|
refinedweb
| 1,091
| 63.93
|
We have learnt how to create django user registration form. Now in this article i am going to write about django user login form. Django comes with built in function that automatically generates user authentication form like log in form.
Django login and logout comes under django.contrib.auth.urls. If you are following my Django authentication tutorial than you will be able to easily grasp this tutorial, otherwise it will take some time to figure out about url patterns. That’s not too hard, you can do it.
Django user login form | Django login form
To use this you need to add django.contrib.auth.urls in your projects urls.py file. Open your main project’s urls.py and add these following lines.
main project/urls.py
from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('password/', include('password_generator.urls')), path('demo/', include('demo.urls')), path('accounts/', include('accounts.urls')), path('accounts/', include('django.contrib.auth.urls')), # add this line in your urls.py ]
You must be thinking about why there are two ‘accounts/’. That’s because i want my login page as ‘accounts/login/’ that’s why there are two ‘accounts/’ you can give anything in place of accounts, its your choice.
Django authentication provides functionality of login, logout, password_reset. You don’t need you specify in urls.py to open it. These are built in, you just need to open in browser you will see it opens without any burden. You don’t need to configure views.py file or anything.
Next step is to add login.html. For that we need to create a folder inside our accounts app and name it ‘registration’. IT IS VERY IMPORTANT TO KEEP THE NAME AS IT IS. You don’t need to change it. If you change the name of ‘registration’ to something else django will throw an error template does not exist. It is because Django searches for login, logout, password_reset inside registration folder.
After creating ‘registration’ folder, now create login.html page. Again name must be same.
In the previous tutorial, i have written about crispy forms, so i am not going to tell you in this post. Load crispy form tag before your html code.
{% load crispy_forms_tags %}
add bootstrap or css anything. I am not showing you whole code, just main form tag.
login.html
That’s it, you have created login page. Here is the look of final django user login form.
go to to go to login page. sign up page is at .Your sign up page url may be different. that does not matter.
Now you have to add login redirect page and log out redirect page. Where do you want to go after you have logged in and where you want to go after log out.
Go to your settings.py file and add these two line of code.
LOGIN_REDIRECT_URL = "/" LOGOUT_REDIRECT_URL = "/"
Here after log in, we will go to home page and after logged out, we will also go to home page. you can add your own page, where you want to go and you can also add logout redirect url. Its upon your choice.
Django Logout url | Django user login form
Now you have created django user login form, now you also have to create logout option. You have to add link to your logout url.
6 thoughts on “Django user login form | Django login form”
override
Ouguiya
Robust
Sleek
Gibraltar Pound
Officer
|
http://www.geekyshadow.com/2020/06/22/django-user-login-form-django-login-form/
|
CC-MAIN-2020-40
|
refinedweb
| 582
| 69.89
|
In order to call EJB components in applications deployed with Appeon, Appeon provides its own EJB solution which includes a customized object (EJBObject object in Appeon Workarounds PBL), a DLL (eonejbclient.dll), and a bridge (Appeon Bridge). With this EJB solution you can call an EJB component in both the PowerBuilder Client/Server application and the deployed Appeon application.
Compared to the EJB solution of PowerBuilder, Appeon EJB solution can support more complex parameters such as Structure; and there is no need to generate the proxy object in PowerBuilder.
eonejbclient.dll -- Located in the same folder as the Appeon Workarounds PBL, this DLL is used by the PowerBuilder Client/Server application only, not by the deployed Appeon application. If you want to make the PowerBuilder Client/Server application call the EJB component successfully using the same Appeon EJB solution as the deployed application uses, make sure this DLL is included in the PowerBuilder application directory on the client machine.
The Appeon EJB solution supports calling EJB 1.x/2.x/3.x components deployed to the J2EE-compliant application servers only (no .NET IIS application server). The certified supported application server includes WildFly 10, JBoss EAP 6.x, WebSphere 7/8/8.5, & WebLogic 12c.
JBoss application server requires no EJB proxy generated, but WebLogic and WebSphere application server requires you to generate the EJB proxy and copy the generated EJB proxy to Appeon Bridge.
To generate the EJB proxy in the WebSphere application server:
Run the DOS command window as an administrator, and then change the directory to IBM\WebSphere\AppServer\bin.
Execute this command:
createEJBStubs.bat name of the JAR file or EAR file
To generate the EJB proxy in the WebLogic application server:
Run the DOS command window as an administrator, and then change the directory to domains\base_domain\bin.
Execute this command:
setDomainEnv.cmd
Change the directory back to domains\base_domain\bin, and execute this command:
java weblogic.appc name of the JAR file or EAR file
The proxy functions will be automatically generated into the JAR file and the JAR file that contains the proxy functions is what we call the EJB proxy. Follow the next section to copy/bundle the EJB proxy to the Appeon Bridge.
Introduction to Appeon Bridge
Appeon Bridge is a standard J2EE-compliant Web application that can be deployed to any J2EE compliant application server regardless of whether EJB components exist on the server. It functions as the medium between the clients and EJB components, and can be deployed by installing the appeonbridge.war file, which is located in %appeon%\plugin\appeonbridege under the PowerServer installation folder.
Bundle EJB proxy with Appeon Bridge
Before deploying Appeon Bridge to the application server, you must bundle the EJB proxy (JAR file) with Appeon Bridge to implement the communication to EJB components.
Three ways of bundling the EJB proxy with Appeon Bridge:
Method 1: Add the proxy to the lib directory in the appeonbridge.war file. Since the appeonbridge.war file is a ZIP file, you can check the directory in the WAR file with a third-party tool such as WinZip.
Navigate to %appeon%\plugin\appeonbridge folder and open appeonbridge.war with the third-party tool such as WinZip. %appeon% indicates the installation folder of the PowerServer.
Navigate to the folder where the EJB proxy is located.
Copy the entire folder of the EJB proxy to the appeonbridge.war\WEB-INF\lib directory (you will need to create the lib folder first).
This method does not work for EJB 3.x in JBoss; try the second method if you are using EJB 3.x in JBoss.
Method 2: Add the classes of the EJB component to the classes directory in the appeonbridge.war file.
Navigate to %appeon%\plugin\appeonbridge folder and open appeonbridge.war with the third-party tool such as WinZip. %appeon% indicates the installation folder of the PowerServer.
Navigate to the folder where the EJB classes are located.
Copy the entire folder of the EJB classes to the appeonbridge.war\WEB-INF\classes directory.
Method 3: Copy the EJB proxy to the lib directory in the Java Web server, and add the lib directory (where the proxy is stored) to the CLASSPATH environment variable of the machine that hosts the Java Web server.
Now you are ready to deploy the following files to the application server one by one:
Appeon Bridge (appeonbridge.war) which includes the EJB proxy. View Generate the EJB proxy for how to generate the EJB proxy and Bundle EJB proxy with Appeon Bridge for how to copy the EJB proxy into appeonbridge.war.
Original JAR file for the EJB component without the EJB proxy functions.
PowerBuilder application that calls the EJB component. View Call EJB component in PowerBuilder application for how to write PowerScript to call the EJB component functions.
Deploying any of the above files is the same as deploying the file server. Please refer to the corresponding Deploying the Appeon File Server section under Configuring and deploying the file server. (Or you can refer to documents provided by the corresponding server vendors for the deployment instructions, as deploying the above file is the same as deploying any other applications.)
This section guides you through writing PowerScript to call the EJB component. Appeon provides an object called EJBObject in the Appeon Workarounds PBL to call the EJB component, and provides Appeon Bridge to communicate with the EJB component.
Step 1: Add the Appeon Workarounds PBL to the Library Search Path of your PowerBuilder application.
Step 2: Declare the EJBObject object.
Step 3: Configure the connection string, call the EJBObject connectserver function to connect with Appeon Bridge on the application server.
The connection string varies according to the application server. View connectserver to determine the connection string.
Step 4: Create the instance for EJB component using EJBObject lookupjndi function or createremoteinstance function.
Note: For EJB 3.x, lookupjndi function works exactly as the createremoteinstance function; both functions can directly return the corresponding instance session handle; while for EJB 2.x, lookupjndi function will need to obtain the home interface of the EJB component first, for example, ls_msg = lo_ejb.lookupjndi ("TestSBeanLess",ref ll_homeHandle), before it can return the corresponding instance handle.
The JNDI name has to be accurate, and it varies according to the application server. For WebSphere, you will also need to set the JNDI name first in the WebSphere console. View JNDI Name for more information.
Step 5: If the function to be called contains parameter(s), call the EJBObject registering functions to register the parameter.
Step 6: Call the EJBObject invoking component functions to invoke the EJB component method.
Step 7: Destroy the instance and disconnect from the application server.
Below is a PowerScript code example that calls an EJB 3.x component:
ejbobject lo_ejb //Declare EJBobject long ll_bean = 0 //For receiving instance's handle string ls_prop[5] string ls_serurl,ls_msg,ls_msg1,ls_parm //appeonbridge URL ls_serurl = "http://"+ip+":"+port1+"/appeonbridge/Dispatch" ls_prop[1]= is_appname //the deployed Appeon app name ls_prop[2]="javax.naming.Context.INITIAL_CONTEXT_FACTORY= 'org.jboss.as.naming.InitialContextFactory'" ls_prop[3]="javax.naming.Context.PROVIDER_URL='remote://"+ip+":"+port2+"'" ls_prop[4]= "username=" ls_prop[5]= "password=" ls_msg = lo_ejb.connectserver(ls_serurl, ls_prop) //Connect with server if ls_msg = "" then //Connection is successful else MessageBox("Not connected!",ls_msg) end if ls_jndi = sle_54.text //JNDI name has to be accurate otherwise instance will fail to create //EJB 3.x supports passing any character in the third parameter ls_msg = lo_ejb.createremoteinstance(ls_jndi,"AllDataType","sayHello", ref ll_bean) if ls_msg = "" then //Instance is created successfully sle_53.text = string(ll_bean) else MessageBox("createremoteinstance Failed!",ls_msg) end if ls_parm = "127.0.0.1" //Register the parameter that will be called by the EJB functions ls_msg = lo_ejb.regstring(ls_parm) if ls_msg = "" then else MessageBox("Regstring Failed !",ls_msg) end if //Call the function. Function name is case sensitive ls_msg = lo_ejb.invokeretstring(ll_bean,"sayHello1",true, ref ls_msg1) if ls_msg = "" then //Called successfully sle_52.text = ls_msg1 else MessageBox("invokestring Failed!",ls_msg) end if //Disconnect from server ls_msg = lo_ejb.destroyremoteinstance(ll_bean) if ls_msg <> '' then MessageBox("destroyremoteinstance Failed!",ls_msg) end if ls_msg = lo_ejb.disconnection( ) if ls_msg <> '' then MessageBox("disconnection Failed!",ls_msg) end if
Different application servers have different JNDI names.
JNDI name for JBoss
To call EJB 3.x in JBoss, the JNDI name should be in this format: ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName
appName: name of the EAR file. If it is JAR file instead of EAR file, then leave this empty.
moduleName: name of the deployed JAR file; file extension should not be contained here, for example, HelloWorld.
distinctName: if no such name is defined, then leave this empty.
beanName: name of the implementation class.
viewClassName: name of the interface and package, for example, com.ibytecode.business.HelloWorld.
JNDI name for WebSphere
To call EJB in WebSphere, you will need to define the JNDI name by yourself:
Log into the WebSphere Administration console.
In the left pane, expand Applications > Application Types, and then select WebSphere enterprise applications.
In the right pane, click the name of the EJB component, and then click Bind EJB Business or EJB JNDI Names.
Define the name in the JNDI Name text box.
JNDI name for WebLogic
To call EJB in WebLogic 12c, you can find out the JNDI name here:
Log into the WebLogic Server Administration Console.
In the left pane, expand Environment > Servers.
On the Server summary page, click the name of the server.
On the server Settings page, click View JNDI Tree.
The JNDI tree is displayed in a new browser window.
In the left pane for the JNDI tree, expand the java:global node, find the EJB component, expand the component to find the class, and select the class.
The Bind Name displayed in the right page is the JNDI name you are looking for.
Appeon EJBObject object implements the interaction between client and Appeon Bridge. To use this object, you need to load appeon_workaround.pbl into your application.
EJBObject object provides the following functions to perform the relevant actions:
Description
Connects a client application to Appeon Bridge.
Syntax
EJBObject.ConnectServer(string url, string properties[])
Return value
String.
Returns empty string ("") if it succeeds.
Here are a few examples of the URL for different application servers:
Example for EJB 1.x/2.x in JBoss:
String ls_serurl,ls_prop[5] ls_serurl = "" ls_prop[1]= "testappeon" //name of the deployed Appeon application ls_prop[2]= "javax.naming.Context.INITIAL_CONTEXT_FACTORY='org.jnp.interfaces.NamingContextFactory'" ls_prop[3]= "javax.naming.Context.PROVIDER_URL='jnp://127.0.0.1:8080'" ls_prop[4]= "username=" ls_prop[5]= "password="
Example for EJB 3.x in JBoss:
String ls_serurl,ls_prop[5] ls_serurl= "" ls_prop[1]= "testappeon" //name of the deployed Appeon application ls_prop[2]= "javax.naming.Context.INITIAL_CONTEXT_FACTORY= 'org.jboss.as.naming.InitialContextFactory'" ls_prop[3]= "javax.naming.Context.PROVIDER_URL= 'remote://127.0.0.1:4447'"//default port is 4447. //Port number can be configured in {$Home_DIR}\standalone\configuration\standalone.xml. ls_prop[4]= "username=" ls_prop[5]= "password="
Example for WebSphere:
String ls_serurl,ls_prop[5] ls_serurl = "" ls_prop[1]= "testappeon" //name of the deployed Appeon application ls_prop[2]="javax.naming.Context.INITIAL_CONTEXT_FACTORY='com.ibm.websphere.naming.WsnInitialContextFactory'" ls_prop[3]= "javax.naming.Context.PROVIDER_URL='iiop://127.0.0.1:2809'"//default port is 2809. //Port number can be obtained or changed in WebSphere console > server1 > BOOTSTRAP_ADDRESS. ls_prop[4]= "username=admin" ls_prop[5]= "password=admin"
Example for WebLogic:
String ls_serurl,ls_prop[5] ls_serurl = "" ls_prop[1]= "testappeon" //name of the deployed Appeon application ls_prop[2]= "javax.naming.Context.INITIAL_CONTEXT_FACTORY='weblogic.jndi.WLInitialContextFactory'" ls_prop[3]= "javax.naming.Context.PROVIDER_URL='t3://127.0.0.1:7001'" ls_prop[4]= "username=weblogic" ls_prop[5]= "password=appeon123"
Description
Disconnects a client application from Appeon Bridge.
Syntax
EJBObject.DisConnection()
Return value
String.
Returns empty string ("") if it succeeds.
Description
Obtains the home interface of an EJB component in order to create an instance for the component.
Syntax
EJBObject.lookupjndi (string jndiname, ref long objid)
Return value
String.
Returns empty string ("") if it succeeds.
Description
Sets the language of the error message in PowerBuilder IDE.
Syntax
EJBObject.initlocallanguage (long nlocalcode)
Return value
Long.
Description
Invoke an EJB component which returns a particular data type. All methods will share the same parameters, syntax and return value.
Syntax
string EJBObject.Invokeblob(long objid, string methodname, boolean autoremove, ref blob retval)
Return value
String.
Returns empty string ("") if it succeeds.
Usage
Variables cannot be null for structure and array.
For a structure to be registered, variables can be:
char, string, boolean, int, unit, long, ulong, real, double, datetime, date or time.
an array of the above types. The maximum dimension is 3.
a structure or a 1-dimensional structure array. And the array must be a fixed array.
For a return value of structure type, variables can be:
char, string, boolean, blob, int, unit, long, ulong, real, double, datetime, date or time.
a multidimensional array of the above types.
a structure or a 1-dimensional structure array. And the array must be a fixed array.
Register functions are provided to register parameters with different data type. Except RegStruct and RegstructArray, all functions will share the same parameters, syntax, return value.
Description
Registers a parameter with a certain data type. Syntax below takes RegBlob as an example.
Syntax
EJBObject.RegBlob(blob data)
Return value
String.
Returns empty string ("") if it succeeds.
Description
Registers a structure or structure array. The two functions will share the same parameters, syntax, return value. Syntax below takes regstructarrary as an example.
Syntax
EJBObject.regstructarrary (any data [], string javaclassname, readonly classdefinition cdef)
Return value
String.
Returns empty string ("") if it succeeds.
Usage
Variables cannot be null for structure and array.
For a structure to be registered, variables can be:
char, string, bool, int, unit, long, ulong, real, double, datetime, date or time.
an array of the above types. The maximum dimension is 3.
a structure or a 1-dimensional structure array. And the array must be a fixed array.
(Only for RegStruct method) For the javaclassname parameter, input the full name of the Java class on EJB server corresponding to the structure you defined in PowerBuilder. For example, a.b.c.d.myclassName.
Description
Creates the instance for an EJB component.
Syntax
EJBObject.CreateRemoteInstance(string jndiname, string homename, string methodname, ref long beanid)
Return value
String.
Returns empty string ("") if it succeeds.
Appeon Bridge maps datatypes (except structure) between Java and PowerBuilder is shown as below.
With Appeon EJB solution, Structure data can be passed when invoking EJB components. To implement this, you need to define a Java class in the EJB components. There are two necessary elements in Java Class: 1) private static String PBMap[] and 2) implementing java.io.Serializable interface. In PBMap array you need to map the members with the identical order and datatype to a PowerBuilder Structure.
Following is an example of defining a Java class (please note that the member variables should be in lower case.)
package test; import java.io.Serializable; public class Simple implements Serializable { private short l_int; private boolean b_bool; private String s_string; private static String PBMap[] = {"l_int", "b_bool", "s_string"}; public String[] getPBMap() { return PBMap; } public boolean isB_bool() { return b_bool; } public short getL_int() { return l_int; } public String getS_string() { return s_string; } public void setB_bool(boolean b_bool) { this.b_bool = b_bool; } public void setL_int(short l_int) { this.l_int = l_int; } public void setS_string(String s_string) { this.s_string = s_string; } }
|
https://docs.appeon.com/appeon_online_help/pb2019/workarounds_and_api_guide/ch01s03s06.html
|
CC-MAIN-2019-47
|
refinedweb
| 2,537
| 50.53
|
A while back, I wrote about how I disliked the word "Robustness" because it's meaning was so vague..
So what does it mean in the context of your "policy engine" 🙂
Policy – of or having to do with police
Policy in itself is a word that needs context to be useful.
From Dictionary.com: A plan or course of action, as of a government, political party, or business, intended to influence and determine decisions, actions, and other matters.
Perhaps it isn’t that the word lost it’s meaning, but rather that it never had the kind of meaning that you’re implying it had in the first place?
John, in almost everything I write, the context is as a Windows developer.
And the problem with "policy" is that it needs to be scoped so tightly that it cannot be used in a meaningful way.
Maybe teams need to get more creative about their names… Instead of calling it a policy engine why not for example SWACB (Small+Wide Audio Content Broadcast) — I have no idea what you’re developing but as you can see it isn’t hard to create an original name…
The only time I would use the term policy is when I am writing something that is *used* by third parties to set up a policy… Like when an outside source writes the policy and you are the method to facilitate that action. Then it is correct.
I read your blog regularly and I understand your background, but I still believe it is within the nature of the word that it must be scoped. Can you give me an example of where the word policy is used, as a Windows developer, that it does not indicate something "intended to influence and determine decisions, actions, and other matters"? I can’t think of any.
Perhaps it could be that refering to something as a "policy engine" would be like refering to Windows as a "software package". You may be correct to call it that, but you are not being specific enough for certain audiences.
John,
Maybe the problem here is that the common usage of the english language omits the qualifiers. So NT security people talk about policy with the implicit assumption that they’re talking about group policies.
The NT QOS people refer to policy without referencing that it’s the QOS policy.
There’s an internal tool called "policheck" which is intended to ensure that "policies" are checked. But the word is used without context.
We just need to add the scope resolution operator, umm I mean *punctuation* to the English language!
Software::Win32::Audio::Policy
Software::Win32::Group::Policy
Now sure this is a bit long, so just throw a “using namespace Software::Win32” directive on all your writing and at the being of all conversations. Since I’m sure we all agree it’s safe to say “Problem SOLVED!”
(would the period, slash, or backslash work better, hmmm maybe…?)
The problem with using namespace is that if I reference Larry’s blog, then Software::Win32 would pollute my global namespace…
*sigh*
I must avoid making geek jokes.
So Audio policy, sounds like a "Do not disturb" system. "Do not allow MSN messenger to make inane sounds in the middle of my fullscreen Powerpoint presentation" or "If I’m watching a movie don’t notify me of incoming email" that sort of thing?
I think theres is already too much metadata in Windows, and its too difficult to keep all these settings in sync across multiple personal machines.
It’s no worse than "options" or "settings" and everyone has to use those words anyway. If you decide to use a different word instead (or abuse a word that used to have a completely different meaning) then it won’t help this issue, it will only transfer the issue to the new word. Don’t bother trying; "policy" is fine.
|
https://blogs.msdn.microsoft.com/larryosterman/2005/07/27/words-i-dislike-policy/?replytocom=49861
|
CC-MAIN-2018-13
|
refinedweb
| 655
| 66.47
|
Issues
ZF-2899: Zend_Filter / Zend_Validate setDefaultNamespaces
Description
While creating my own filters and validators it's very annoying to have to add the name spaces everytime I use Zend_Filter::get() or Zend_Validate::is().
It would be much nicer to have a setDefaultNamespaces, which would allow namespaces for Zend_Filter and one for Zend_Vailidate to be setup in the bootstrap.
Posted by James Dempster (letssurf) on 2008-03-17T07:40:44.000+0000
An example of how I would implement DefaultNamespaces
Posted by Wil Sinclair (wil) on 2008-12-30T07:47:00.000+0000
Matthew, could you please evaluate this issue? I'm wondering how such functionality would work with Zend_Application, too.
Posted by Thomas Weidner (thomas) on 2009-06-25T08:13:37.000+0000
New feature added with r16286
|
http://framework.zend.com/issues/browse/ZF-2899
|
CC-MAIN-2015-48
|
refinedweb
| 128
| 58.18
|
Opened 2 years ago
Last modified 2 years ago
#12397 new Bugs
static_assert in arg.hpp failing when using boost::placeholder with std::bind
Description
In our project we currently use std::bind with boost::placeholers because boost::placeholders are already global namespace and some some of the dependency (header) libraries might depend on this so we can't use BOOST_BIND_NO_PLACEHOLDERS currently.
So we make boost::placeholers work with std::bin with this code:
namespace std { template<int N> struct is_placeholder<boost::arg<N>> : public integral_constant<int, N> {}; }
This worked fine, but since boost 1.60 when BOOST_CONSTEXPR was added to the boost::arg contructor the compliation fails for some of our developers with
error: static assertion failed: I == is_placeholder<T>::value BOOST_STATIC_ASSERT( I == is_placeholder<T>::value );
from arg.hpp
Attachments (1)
Change History (5)
comment:1 Changed 2 years ago by
comment:2 Changed 2 years ago by
I'll look into this if someone can present a simple example that triggers the error.
Changed 2 years ago by
comment:3 Changed 2 years ago by
This compiles fine with gcc 5.4.0 but fails with gcc 4.8.5 and 4.9.3, using -std=c++11 option
I'm contributor to the same project(namely Battle for Wesnoth), and I got this issue on debian while using mingw-w64 cross toolchain(gcc 4.9). While my gentoo crossdev based cross toolchain(gcc5.3 and the same boost version) compiled same code without errors. atm I'm using 5.3.0 for native builds and not getting this issue there either.
|
https://svn.boost.org/trac10/ticket/12397
|
CC-MAIN-2018-34
|
refinedweb
| 264
| 54.22
|
Important: Please read the Qt Code of Conduct -
Qt emit signal problem
Hi everyone here
i'm new in here and Qt.(having a lot problems)
what im doing is to draw a point (later a line a circle maybe) in a graphicsview mit mouse click
what ive done is like that:
mainwindow.h
namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void paintEvent(QPaintEvent *ev); private: Ui::MainWindow *ui; myview view; };
myview.h
#include <QGraphicsView> #include <QMouseEvent> #include <QEvent> class myview : public QGraphicsView { //Q_OBJECT public: myview(QWidget *parent = 0); int x,y; protected: void mousePressEvent(QMouseEvent *ev); signals: void Mousepressed(); };
myview.cpp
#include <QMouseEvent> myview::myview(QWidget *parent) : QGraphicsView(parent) { } void myview::mousePressEvent(QMouseEvent *ev) { x = ev->pos().x(); y = ev->pos().y(); emit Mousepressed(); }
mainwindow.cpp
#include <QPainter> #include <myview.h> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QObject::connect(ui->graphicsView,SIGNAL(Mousepressed()),this,SLOT(paintEvent(QPaintEvent *ev))); } MainWindow::~MainWindow() { delete ui; } void MainWindow::paintEvent(QPaintEvent *ev) { QPainter p(this); QPen pen(Qt::black); pen.setWidth(6); p.setPen(pen); p.drawPoint(view.x,view.y); }
when i bild the project i get this error:
undefined reference to myview::Mousepressed()
Thanks in advance
[edit: corrected coding tags: use ```before and after SGaist]
- SGaist Lifetime Qt Champion last edited by
Hi and welcome to devnet,
You commented out the Q_OBJECT macro from your myview class so moc doesn't run thus your signals are not implemented like they should be.
On a side note, your connection statement is invalid for two reasons:
- list item paintEvent is not a slot
- you can't connect a parameterless signal to a slot with parameters.
@SGaist Thank U so much. The Signal emit problem is solved perfect. I wanna ask how can I call the paintevent with a mouse click?
thanks in advance
- SGaist Lifetime Qt Champion last edited by
You can't. paintEvent is called when needed, you can ask for a repaint but it doesn't mean it will be done immediately
|
https://forum.qt.io/topic/54664/qt-emit-signal-problem
|
CC-MAIN-2021-31
|
refinedweb
| 348
| 53.1
|
LinkedList Sample program in Java
By: Jagan Printer Friendly Format
LinkedList( )
LinkedList(Collection c)
The first constructor builds an empty linked list. The second constructor builds a linked list that is initialized with the elements of the collection c.
In addition to the methods that it inherits, the LinkedList class defines some useful methods of its own for manipulating and accessing lists. To add elements to the start of the list, use addFirst( ); to add elements to the end, use addLast( ). Their signatures are shown here:
void addFirst(Object obj)
void addLast(Object obj)
Here, obj is the item being added.
To obtain the first element, call getFirst( ). To retrieve the last element, call getLast( ). Their signatures are shown here:
Object getFirst( )
Object getLast( )
To remove the first element, use removeFirst( ); to remove the last element, call removeLast( ). They are shown here:
Object removeFirst( )
Object removeLast( )
The following program illustrates several of the methods supported by LinkedList:
// Demonstrate LinkedList.
import java.util.*;
class LinkedListDemo {
public static void main(String args[]) {
// create a linked list
LinkedList ll = new LinkedList();
// add elements to the linked list
ll.add("F");
ll.add("B");
ll.add("D");
ll.add("E");
ll.add("C");
ll.addLast("Z");
ll.addFirst("A");
ll.add(1, "A2");
System.out.println("Original contents of ll: " + ll);
// remove elements from the linked list
ll.remove("F");
ll.remove(2);
System.out.println("Contents of ll after deletion: "
+ ll);
// remove first and last elements
ll.removeFirst();
ll.removeLast();
System.out.println("ll after deleting first and last: "
+ ll);
// get and set a value
Object val = ll.get(2);
ll.set(2, (String) val + " Changed");
System.out) append items to the end of the list, as does addLast( ). To insert items at a specific location, use the add(int, Object) form of add( ), as illustrated by the call to add(1, "A2") in the example. Notice how the third element in ll is changed by employing calls to get( ) and set( ). To obtain the current value of an element, pass get( ) the index at which the element is stored. To assign a new value to that index, pass set( ) the index and its new about all java application.
View Tutorial By: Ahasan at 2009-04-10 09:42:48
2. Very good tutorial!
View Tutorial By: Herve at 2011-04-04 08:06:21
3. Sir your example is god
but i am surprisin
View Tutorial By: Ata Ul Nasar at 2011-06-05 16:23:09
4. good but i needed you to implenent linked list usi
View Tutorial By: emmanueli at 2011-06-08 10:08:16
5. It is simply good and more informative
View Tutorial By: ARUNA at 2011-06-19 06:32:29
6. sir can you write the sample proram of this:
View Tutorial By: bryan labastida at 2011-06-29 02:53:14
7. Tnx. Very fast learning i think.
Just make
View Tutorial By: mahdi at 2011-07-09 20:20:39
8. can you give me a good example of exception handli
View Tutorial By: samik at 2011-08-07 06:51:20
9. sir i want to knw abt all simple java programs pls
View Tutorial By: sakthi at 2011-08-29 14:06:10
10. sir help me to do insertion in hash table using JA
View Tutorial By: Ananthi vasan at 2011-10-13 09:34:56
11. it is good to unstand and easy to remember forever
View Tutorial By: Abdul at 2011-11-10 21:03:41
12. i wont more of dis java
gi
View Tutorial By: Rishwin at 2011-12-10 19:20:12
13. very simple :)
View Tutorial By: cha at 2012-01-09 07:38:49
14. It would he helpful to know difference between a l
View Tutorial By: Tosh at 2012-04-28 18:00:20
15. thanks
a good example, just what i wanted :
View Tutorial By: vejdan at 2012-04-29 12:41:43
16. how to read one by one element from linkedlist.
View Tutorial By: shruthi at 2012-05-10 12:58:33
17. nice bt i wnt to implement link list n wanna to do
View Tutorial By: shlagha sharma at 2012-06-27 17:57:13
18. can anybody share those system that uses Linked Li
View Tutorial By: hazel at 2012-08-16 11:48:24
19. can you have a user input tutorial for LinkedList]
View Tutorial By: joedjoaquin at 2013-01-22 01:59:23
20. I like your linked list program. i've one doubt di
View Tutorial By: silambarasan at 2013-01-25 03:11:48
21. This is very useful for beginners.
I want f
View Tutorial By: shankar at 2013-02-04 13:28:16
22. Nice work,great Work,Thanks a lot for sharing this
View Tutorial By: at 2013-02-12 05:34:15
23. I want full information about Java & Data Stru
View Tutorial By: s.karthick at 2015-05-07 05:32:24
24. This design is steller! You certainly know how to
View Tutorial By: gold a good investment at 2017-04-27 05:21:21
|
https://java-samples.com/showtutorial.php?tutorialid=347
|
CC-MAIN-2022-21
|
refinedweb
| 862
| 65.62
|
How to Create a WhizzML Script (Part 4)
How to Create a WhizzML Script (Part 4)
Dive deeper into the world of machine learning automation via WhizzML and learn the BigML Python bindings way to create WhizzML scripts.
Join the DZone community and get the full member experience.Join For Free
Start coding something amazing with the IBM library of open source AI code patterns. Content provided by IBM.
As the final installment of our WhizzML blog series (here's Part 1, Part 2, and Part 3), it's time to learn the BigML Python bindings way to create WhizzML scripts. With this last tool at your disposal, you'll officially be a WhizzML-script-creator genius!
About BigML Python Bindings
BigML Python bindings allow you to interact with BigML.io, the API for BigML. You can use it to easily create, retrieve, list, update, and delete BigML resources (i.e. sources, datasets, models, and predictions). This tool becomes even more powerful when it is used with WhizzML. Your WhizzML code can be stored and executed in BigML by using three kinds of resources: Scripts, Libraries, and Executions (see the first post).
WhizzML scripts can be executed in BigML's servers in a controlled, fully scalable environment that automatically takes care of their parallelization and fail-safe operation. Each execution uses an Execution resource to store the arguments and the results of the process. WhizzML Libraries store generic code to be shared or reused in other WhizzML scripts. But this is not really new, so let's get into some new tricks instead.
Bindings
You can create and execute your WhizzML script via the bindings to create powerful workflows. There are multiple languages supported by BigML bindings i.e. Python, C#, Java or PHP. In this post, we'll use the Python bindings but you can find the others on GitHub. If you need a BigML Python bindings refresher, please refer to the dedicated Documentation.
Scripts
In BigML, a script resource stores WhizzML source code and the results of its compilation. Once a WhizzML script is created, it's automatically compiled. If compilation is successful, the script can be run, that is, used as the input for a WhizzML execution resource. This little program creates a script to create a model from a
dataset-id.
from bigml.api import BigML api = BigML() # define the code include in the script script_code = "(create-model {\"dataset\" dataset-id})" # create the script script = api.create_script(script_code) # waiting for the script compilation to finish api.ok(script)
You can also define some variables as the script inputs. In the code below, we use the same script code as in the example above, and we set a specific dataset id as input.
from bigml.api import BigML api = BigML() # define the code include in the script script_code = "(create-model {\"dataset\" dataset-id})" # define parameters inputs = {"inputs": [{"name": "dataset-id", "type": "string", "default": "dataset/598ceafe4006830450000046", "description": "Datset identifier"}]} # create the script script = api.create_script(script_code, inputs) # waiting for the script compilation to finish api.ok(script)
Executions
To execute a compiled WhizzML script in BigML, you need to create an execution resource. Each execution is run under its associated user credentials and its particular environment constraints. Furthermore, a script can be shared, and you can execute the same script several times under different usernames by creating a different execution. For this, you need to first identify the script you want to execute and determine your dictionary of inputs. In this execution, the parameters are the script inputs stored in the variable named
input. It's a piece of cake!
from bigml.api import BigML api = BigML() # choose workflow script = 'script/591ee3d00144043f5c003061' # define parameters inputs = {'x' : '2'} # execute and waite for the compilation to finish api.ok(api.create_execution(script, inputs))
Libraries
We haven't created libraries in the previous posts, but there's always a first time. A library is a shared collection of WhizzML functions and definitions usable by any script that imports them. It's a special kind of compiled WhizzML source code that only defines functions and constants. Libraries can be imported in scripts. The attribute of a script can contain a list of library IDs whose defined functions and constants will be usable in the script. It's very easy to create WhizzML libraries by using BigML Python bindings.
Let's go through a simple example. We'll define one function
get-max and a constant. The function will get the max value in a list. In WhizzML language this can be expressed as below.
from bigml.api import BigML api = BigML() # define the library code lib_code = "(define (get-max xs) (reduce (lambda (x y)" \ "(if (> x y) x y)) (head xs) xs))" # create a library library = api.create_library(lib_code) # waiting for the library compilation to finish api.ok(library)
For more examples, don't hesitate to take a look at the WhizzML resources section in the BigML Python Bindings documentation.
So that's it! You now know all the techniques needed to create and execute WhizzML scripts. We've covered the basic concepts of WhizzML, how to clone existing scripts or import them from Github (Part 1), how to create new scripts by using Scriptify and the editor (Part 2), how to use the BigMLer command line (Part 3), and finally the BigML Python bindings in this last post.
To go deeper into the world of machine learning automation via WhizzML, please check out our WhizzML tutorials such as the automated dataset transformation tutorial. If you need a WhizzML refresher, you can always visit the WhizzML documentation. Start with the Hello World section in the Primer Guide for a gentle introduction. And yes, please be on the lookout for more WhizzML related posts on our blog.
Start coding something amazing with the IBM library of open source AI code patterns. Content provided by IBM.
Published at DZone with permission of Barbara Martin , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
{{ parent.title || parent.header.title}}
{{ parent.tldr }}
{{ parent.linkDescription }}{{ parent.urlSource.name }}
|
https://dzone.com/articles/how-to-create-a-whizzml-script-part-4
|
CC-MAIN-2018-47
|
refinedweb
| 1,017
| 64.51
|
Hello again. There is a question. I know that the globalDict keeps data that is accesible from other scenes even from the same scene if it is restarted. For example if I create a variable logic.globalDict[“Player”] = Myself and then I execute startGame() using the same .blend file I can read the “Player” field added to the globalDict, it works perfectly in the bge player, but it doesnt work in the standalone executable, is there any way to save the globalDict data without creating a temporary file? I can do this but…I dont think is a good solution.
[SOLVED ]How to read data from globalDict between scenes(standalone)
Did you save the information first, because I did a quick test using globalDict in the standalone player and I found out that the issue might the fact that what you save in the embedded player can’t be loaded in the standalone player (but it will still load data providing you also used the same player to save the data).
Ok if it worked for you I might need a small test for this. I saved the information and loaded again, it works for me only in the embebed player. If I export the game to a standalone executable it works like if the data havent been saved. When I execute the “startGame” command I use the name of the standaloneplayer, I tried that because I thought that if I use the .blend name it will start the whole game as a new game and wont keep the data.
I just use logic to transfer data between scenes, it only saves it as long as the game is running, never failed on me yet.
from bge import logic #store logic.ammo = owner['ammo'] #load in the scene you want ammo = logic.ammo
Oh btw above code cannot be externally saved. Like globaldict can.
To clarify, the variable above can be saved and loaded to and from an external file; it just uses the normal built-in Python method of opening a file and writing to it. Globaldict can use a logic brick to save and load data to and from it.
Yes I know, but in this case I need to restart the same scene but with changes. the only way to do this is using the globalDict. You can assign values to the globalDict, reestart the scene, check if the globalDict has theese values and load them. My problem is that, what Im saying works in the embebed player, but when you create the external player it won’t work.
for example:
if "Player" in globalDict: print(globalDict["Player"]) globalDict["Player"] ="PlayerOne" logic.startGame("BlenderFile.blend")
Hello, thanks for your answer, I know that I can save the globalDict content in a temporary external file but that is something that I was trying to avoid, I was trying to find why you can read the globalDict in the embebed player and you cant do it in the external player, just in case if was a a configuration issue or something like that. But if there is no other alternative for sure I’ll do that, its my B plan
I did a test with 2.68:
When using the GameActuator to start a new game from blend, it keeps the content of globalDict in both embedded and with blenderplayer.
When running embedded the globalDict has the identical Id, when running from blenderplayer it has a different Id with equal content -> except you get errors (e.g. “Error, bge.logic.globalDict could not be marshal’d”).
Thanks a lot, I did another test, I attach it for the example bu I think I got what u meant.
DataSaveTestblend.blend (440 KB)
Finnally. Solved. The Game Actuator RestartScene combined with a function which stores in the globalDict everything I need accomplishes the goal I need. Thanks a lot again
|
https://blenderartists.org/t/solved-how-to-read-data-from-globaldict-between-scenes-standalone/588441
|
CC-MAIN-2019-43
|
refinedweb
| 649
| 69.11
|
Hi, I understand you guys do not give answers on homework or anything, but don't worry I am not wanting the answer I want to solve it on my own :). I have to write a simple lets make a deal program.
[Details
The game will be played where the contestant selects a door out of 3, the host then opens a door that is incorrect. The contestant then chooses to either keep his original choice or switch it to the other door. If he gets it right he win if not he loses. I need to write it so it runs it automatically. The other catch is I need to do it where it runs 1000 times where the contestant does not switch his choice, 1000 times when he does switch his choice and then 1000 times where its random.
So I was needing to know where I can find some tutorials or what type of commands I need to read up on. My book for this class is terrible and very hard to understand. Thanks for the help!
Point me in the right direction
Started by JanitorMoe, Oct 18 2010 04:22 PM
32 replies to this topic
#1
Posted 18 October 2010 - 04:22 PM
#2
Posted 18 October 2010 - 04:37 PM
Well, for the random part you're going to want to use either stdlib.h or cstdlib depending on whether you're using C or C++, respectively. Then:
#include <stdlib.h> #include <time.h> int main(int argc, char **argv) { ... blah... /* seed random number generator */ srand(time(NULL)); ... blah... /* get random door */ correct_door = rand() % 3; initial_chosen_door = rand() % 3; ... }You can hard-code two loops to have the user pick the same door, the other door, and then on your third loop you can use rand() again to switch the choice.
sudo rm -rf /
#3
Posted 18 October 2010 - 04:44 PM
Ok I am a little stumped. I understand how to generate the random number. But should I just set it assign the numbers 1,2, and 3 to a random door.
Edited by dargueta, 19 October 2010 - 07:44 PM.
Edited by dargueta, 19 October 2010 - 07:44 PM.
Double post
#4
Posted 19 October 2010 - 07:45 PM
0-2, because you're probably going to use an array. If not then 1-3. I'm not entirely sure what your question is, though.
sudo rm -rf /
#5
Posted 19 October 2010 - 08:40 PM
Yeah, I am just really confused about the whole thing. I assigned number 0 to be the winning number, and numbers 2 and 3 to be the losing numbers. I get how to make it select a random number, I am just very unsure how to then assign that number to a door. I mean do I need to label each door as
door_1 = rand ( ) % 3; if (door_1 == 0) { door_1 = winning_door door_2 != 0 door_3 != 0 } /* Repeat for each door and possible number for each door*/
Edited by JanitorMoe, 19 October 2010 - 09:55 PM.
#6
Posted 19 October 2010 - 10:30 PM
Actually I was more thinking something like:
bool doors[3] = {false, false, false}; doors[ rand() % 3 ] = true; /* do whatever */
sudo rm -rf /
#7
Posted 19 October 2010 - 11:31 PM
I haven't learned about bool yet, but if its more effective I would like to read up on it. I cannot find anything on the web that is clear about it in C. Do you know if a link or page that will explain what it is and how to use it?
#8
Posted 19 October 2010 - 11:36 PM
A bool is usually implemented as an int, though that varies from compiler to compiler and machine to machine. It's a relatively simple concept:
int x = 5, y = 6; bool comp; if( x != y ) do_something(); comp = (x != y); if( comp ) do_something();do_something() should be executed twice. Anything in a conditional expression--for, while, if blocks--is for all intents and purposes a boolean expression, either true or false.
sudo rm -rf /
#9
Posted 20 October 2010 - 12:11 AM
Ok, so let me see if I understand
The above code means there are 3 doors all of which are "false" and randomly one of them will be chosen to be "true"?
bool doors[3] = {false, false, false}; doors[ rand() % 3 ] = true; /* do whatever */
The above code means there are 3 doors all of which are "false" and randomly one of them will be chosen to be "true"?
#10
Posted 20 October 2010 - 12:52 AM
Correct..
#11
Posted 20 October 2010 - 12:54 AM
The one set to true should be your correct door.
sudo rm -rf /
#12
Posted 20 October 2010 - 06:26 AM
So then in turn I could use this?
if (door [1] == true) { door [1] = winning_door }
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
|
http://forum.codecall.net/topic/59539-point-me-in-the-right-direction/
|
crawl-003
|
refinedweb
| 821
| 79.19
|
#include <deal.II/multigrid/mg_coarse.h>
Coarse grid multigrid operator for an iterative solver.
This class provides a wrapper for a deal.II iterative solver with a given matrix and preconditioner as a coarse grid operator.
Definition at line 170 of file mg_coarse.h.
Default constructor.
Constructor. Only a reference to these objects is stored, so their lifetime needs to exceed the usage in this class.
Initialize with new data, see the corresponding constructor for more details.
Clear all pointers.
Implementation of the abstract function. Calls the solve method of the given solver with matrix, vectors, and preconditioner.
Implements MGCoarseGridBase< VectorType >.
Reference to the solver.
Definition at line 214 of file mg_coarse.h.
Reference to the matrix.
Definition at line 222 of file mg_coarse.h.
Reference to the preconditioner.
Definition at line 230 of file mg_coarse.h.
|
https://www.dealii.org/developer/doxygen/deal.II/classMGCoarseGridIterativeSolver.html
|
CC-MAIN-2017-43
|
refinedweb
| 137
| 54.9
|
I am mystified how you can be using the numbers package with mypy. Example:
Advertising
import numbers def f(a: numbers.Integral, b: numbers.Integral) -> numbers.Integral: return a + b f(12, 12) This gives an two errors on the last line when checked by mypy: _.py:10: error: Argument 1 to "f" has incompatible type "int"; expected "Integral" _.py:10: error: Argument 2 to "f" has incompatible type "int"; expected "Integral" On Tue, Feb 13, 2018 at 1:21 AM, Sylvain MARIE < sylvain.ma...@schneider-electric.com> wrote: > The main use case I had in mind was PEP484-based type hinting/checking > actually: > > > > def my_function(foo: Boolean): > > pass > > > > explicitly states that my_function accepts any Boolean value, whether it > is a python bool or a np.bool that would come from a numpy array or pandas > dataframe. > > Note that type hinting is also the use case for which I make extensive use > of the types from the ‘numbers’ package, for the same reasons. > > > > Sylvain > > > > *De :* Python-ideas [mailto:python-ideas-bounces+sylvain.marie=schneider- > electric....@python.org] *De la part de* David Mertz > *Envoyé :* mardi 13 février 2018 07:08 > *À :* Nick Coghlan <ncogh...@gmail.com> > *Cc :* python-ideas <python-ideas@python.org> > *Objet :* Re: [Python-ideas] Boolean ABC similar to what's provided in > the 'numbers' module > > > > I'm not sure I'm convinced by Sylvain that Boolean needs to be an ABC in > the standard library; Guido expresses skepticism. Of course it is possible > to define it in some other library that actually needs to use > `isinstance(x, Boolean)` as Sylvain demonstraits in his post. I'm not sure > I'm unconvinced either, I can see a certain value to saying a given value > is "fully round-trippable to bool" (as is np.bool_). > > > > But just for anyone who doesn't know NumPy, here's a quick illustration of > what I alluded to: > > > > In [1]: import numpy as np > > In [2]: arr = np.array([7,8,12,33]) > > In [3]: ndx1 = np.array([0,1,1,0], dtype=int) > > In [4]: ndx2 = np.array([0,1,1,0], dtype=bool) > > In [5]: arr[ndx1] > > Out[5]: array([7, 8, 8, 7]) > > In [6]: arr[ndx2] > > Out[6]: array([ 8, 12]) > > > > ndx1 and ndx2 are both nice things (and are both often programmatically > constructed by operations in NumPy). But indexing using ndx1 gives us an > array of the things in the listed *positions* in arr. In this case, we > happen to choose two each of the things an index 0 and index 1 in the > result. > > > > Indexing by ndx2 gives us a filter of only those positions in arr > corresponding to 'True's. These are both nice things to be able to do, but > if NumPy's True was a special kind of 1, it wouldn't work out > unambiguously. However, recent versions of NumPy *have* gotten a bit > smarter about recognizing the special type of Python bools, so it's less of > a trap than it used to be. Still, contrast these (using actual Python > lists for the indexes: > > > > In [10]: arr[[False, True, True, False]] > > Out[10]: array([ 8, 12]) > > In [11]: arr[[False, True, 1, 0]] > > Out[11]: array([7, 8, 8, 7]) > > > > > > > > On Mon, Feb 12, 2018 at 7:50 PM, Nick Coghlan <ncogh...@gmail.com> wrote: > > On 13 February 2018 at 02:14, David Mertz <me...@gnosis.cx> wrote: > > NumPy np.bool_ is specifically not a subclass of any np.int_. If it > we're, > > there would be an ambiguity between indexing with a Boolean array and an > > array of ints. Both are meaningful, but they mean different things (mask > vs > > collection of indices). > > > > Do we have other examples a Python ABC that exists to accommodate > something > > outside the standard library or builtins? Even if not, NumPy is > special... > > the actual syntax for '@' exists primarily for that library! > > collections.abc.Sequence and collections.abc.Mapping come to mind - > the standard library doesn't tend to distinguish between different > kinds of subscriptable objects, but it's a distinction some third > party libraries and tools want to be able to make reliably. > > The other comparison that comes to mind would be the distinction > between "__int__" ("can be coerced to an integer, but may lose > information in the process") and "__index__" ("can be losslessly > converted to and from a builtin integer"). > > Right now, we only define boolean coercion via "__bool__" - there's no > mechanism to say "this *is* a boolean value that can be losslessly > converted to and from the builtin boolean constants". That isn't a > distinction the standard library makes, but it sounds like it's one > that NumPy cares about (and NumPy was also the main driver for > introducing __index__). > > Cheers, > Nick. > > -- > Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia > > > > > > -- > >. > > > ______________________________________________________________________ > This email has been scanned by the Symantec Email Security.cloud service. > ______________________________________________________________________ > > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > > Code of Conduct: > > -- --Guido van Rossum (python.org/~guido)
_______________________________________________ Python-ideas mailing list Python-ideas@python.org Code of Conduct:
|
https://www.mail-archive.com/python-ideas@python.org/msg07423.html
|
CC-MAIN-2018-09
|
refinedweb
| 841
| 63.39
|
Google Spreadsheets
and the surprising things you can do with them
Google Spreadsheets is the Excel equivalent from Microsoft in the cloud. These spreadsheets can be filled with numbers and facts, column names can be defined and functions can be implemented. So far so standard, but doing all these things in the cloud opens up some interesting possibilities.
Documents can be accessed via various APIs and thus data can be loaded to and from these Spreadsheets. This makes the service eligible for building entire ETL processes. Looking at a cost factor of zero cents per document and ETL process this creates the equivalent of a free table storage in the cloud that can be used for private use cases or to set up entire Proof of Concepts.
Using Google Spreadsheets with Python
Python is a wildly popular programming language — especially within the data science community — and to no surprise does an API exist to connect to the Google Spreadsheet service. The package in this case is name gspread, the documentation can be found here.
The tedious but necessary process of access management in the cloud is documented in this paragraph in the official documentation. Remember to export those credentials into a JSON file to automate the authentication process and save yourself as much headache as possible.
After successfully creating the initial documents and a technical user, each document must be shared with this user before it can be manipulated via the API. The data is not accessible to anyone else and thus save in the cloud — as far as you trust Google to keep your data safe.
Think of each document as a set of tables, kinda like a schema in a SQL database. The worksheets per document become your tables in this process. Speaking names should be used (for example staging_crm, processed_sales, serving_dashboard) so that the overview never gets lost. As a disadvantage of this system primary or foreign keys can not be set and data integrity must be secured within the code if need should be.
In order to load the file into a pandas Dataframe use the gspread API as follows:
import gspread
import pandas as pd# create connection to google spreadsheet service
conn = gspread.service_account(filename=PATH_GOOGLE_SERVICE_ACCOUNT)# load sheet from file in google cloud
sheet_data = conn_google.open(DATA_SPREADSHEET_NAME)# open specific worksheet within the spreadsheet document
data_worksheet = sheet_data.worksheet(DATA_WORKSHEET_NAME)# load data into pandas dataframe
data = data_worksheet.get_all_values()
headers = data.pop(0)
df = pd.DataFrame(data, columns=headers)
A connection is opened and first the file and later a specific worksheet are accessed. Finally the data is extracted with "get_all_values()" and converted into a pandas dataframe.
Similairly the data can be loaded back into a sheet from a dataframe:
# fill worksheet with header line
all_cols = df.columns.values
header = all_cols.tolist()
worksheet.insert_row(header, 1)# fill worksheet with data lines
data_rows = []
for idx in range(2, len(df)): # counting starts at 1 not at 0
pd_row = df.iloc[idx]
row = pd_row.tolist()
data_rows.append(row)
worksheet.insert_rows(data_rows, 2)
Data can be inserted line by line with "worksheet.insert_row()" but the number of data inserts per session is limited. So the command "worksheet.insert_rows()" must be used.
Together with the "worksheet.delete_rows()" command you have now all the tools to build a data pipeline in the cloud.
Check out my Git Repo where I wrote some functions to abstract this process inside usable procedures. Now you can start building your own use cases with this easy to use and flexible cloud data storage solution. Build a Web Application with a backbone entirely made out of Google Spreadsheets. How amazing that would be!
Using Google Spreadsheets with Tableau Public
Tableau is a Dashboarding Tool that tries to make decision making within companies more data-drive then ever. The company offers a service called 'Tableau Public" where dashboards can be created and hosted on their site making them available online.
In order to create a hosted dashboard you have to download the official App here and publish your dashboard from within the Application. The Dashboard can later on be modified from within your browser, but connections can only be modified from within the App.
The visualised data can be loaded and stored within the hosted dashboard. As great a service as this may be, this is only true for static data. The kind tat gets loaded once and then remains unchanged. But what if you want to update your data regularly and want your dashboard to be also updated? Here come Google Spreadsheets into play.
Data in the spreadsheets is already stored in the cloud and the dashboards form the Tableau Public service are updated as soon as new data is loaded into the spreadsheets. Column names are taken from the header row in the spreadsheet documents, but beware: Tableau Public requires the data in pivoted form. Depending on your initial data ingestion phase some preprocessing might be necessary.
Afterwards the data can be used like any other data source within Tableau Public. You can now start creating those stunning dashboards you always had in you.
To make the dashboard publicly available it must be published from within the application. Due to a bug this can take up to 15 minutes if the sync with the Google Spreadsheets is activated. Do not be disheartened if this happens, just wait it out.
If you want to see such a dashboard in action visit my site ai-for-everyone.org and check out my Blog Entry about the German "Sonntagsfrage".
Final Thoughts
Using Google Spreadsheets as data storage does not offer an enterprise-ready solution but it offers a free, flexible and easy to implement storage solution in the cloud with some nice features towards services like Tableau Public.
But it is still surprising how far this service can be stretched and what it can be used for.
Check out my Blog and my corresponding GitHub repository where i steadily build a Data Science Portfolio. You are also invited to engage with me on Twitter.
|
https://andreas-ditte.medium.com/google-spreadsheets-5643952fe2be
|
CC-MAIN-2021-21
|
refinedweb
| 1,004
| 63.8
|
The Futhark Record System
Most programming languages, except perhaps for the most bare-bones, support some mechanism for creating records, although rarely using that term. For the purposes of this post, a record is an object containing labeled fields, each of which contains a value. In C, a struct is a record:
struct point { int x; int y; };
In object-oriented languages, records are further embellished with methods and (sometimes) access control, giving rise to classes. For this blog post, I will stick to the simpler incarnation of records as simply labeled collections of values. It turns out that even this simple idea contains interesting design questions. In the following, I will discuss the various ways records crop up in various programming languages, and describe the design and notation we have chosen for records in Futhark. I should note that there is (intentionally) little novelty in our design - we have mostly picked features that already seemed to work well elsewhere. Futhark is a simple language designed for (relatively) small programs that have to run really fast, so we don’t need language features that support very elaborate data structures. Constructing the compiler is plenty challenging already.
Basics of Records
At its core, a record is a mapping from keys to values. What sets records apart from associative arrays or other key-value data structures is that the keys for a record (the labels of the fields) are determined at compile time. Consider the
point struct defined above - there is no way to dynamically add or remove a field at run-time. In some languages (e.g. Python) the distinction is less clear-cut, but we still tend to organise our values as some where the keys are dynamic, and others where they are static. Records are a useful organising principle, even when they are all just hash tables underneath and there is no type system enforcement. However, as Futhark is a statically typed language, we will need to make decisions about how record types work.
One of the key differences between how languages handle records is whether they use nominal or structural typing. In C, for example, we could define two structs with identical fields:
struct point_a { int x; int y; } struct point_b { int x; int y; }
To the C compiler, these two types are distinct. If a function expects an argument of type
point_a and we call it with a value of type
point_b, we will get a type error. Thus, C is nominally typed: types with different names are completely distinct, except for type aliases defined via
typedef.
In a structural record system, the types
point_a and
point_b would be identical, because they have the same structure. This is sometimes called static duck typing. Go is an example of a language that uses structural types pervasively, but there are also languages that use both nominal and structural types for different parts of the type system. One such language is Standard ML, where records are structurally typed, and algebraic types are nominally typed.
Records in Futhark
The Futhark record system is primarily inspired by the records in Standard ML, and is therefore structurally typed. One particularly nice capability of a structural record system is anonymous record types, which we in Futhark write as a sequence of comma-separated field descriptions enclosed in curly braces. For example,
{x:i32, y:bool} describes a record with two fields:
x, containing a 32-bit integer, and
y containing a boolean. The order in which fields are listed does not matter, but duplicate labels are not allowed.
Anonymous record types may seem strange at first, but quickly become natural. If we can write
(int,bool) to denote an unnamed pair, why not also
{x:i32, y:bool} for an unnamed record? A record is nothing more than a tuple with labels, after all. This also means that there is no need for the language to have a facility for defining named records. The usual type abbreviation mechanism works the same whether the right-hand side is a primitive type, a tuple, or a record:
type point = {x:f64, y:f64}
(In Futhark, the built-in type
f64 is a double-precision floating point number.)
Records are constructed via record expressions:
let some_point: point = {x=1.0, y=2.0}
A record expression is a comma-separated sequence of field assignments, enclosed in curly braces. For example,
{x=1.0, y=2.0} produces a record of type
{x:f64, y:f64}, which is equivalent to the type
point defined above. The order in which fields are listed makes no difference (except in the case of duplicates), and so
{y=2.0, x=1.0} has the same type and produces the same value as
{x=1.0, y=2.0}.
This flexible use of anonymous record types and record expressions would be more difficult in a nominal record system. Consider the following two definitions in a hypothetical nominal record system:
type r1 = {x: bool} type r2 = {x: bool}
When we encounter a record expression
{x=true}, is the result of type
r1 or
r2? Most languages solve this by requiring type annotations. For example, in C, you have to declare the type of a variable when you introduce it, and hence name clashes between struct members it not an issue. In OCaml and Haskell, record labels are scoped: only one
x field label can exist at a time. In the case above, the
x from
r1 would be shadowed by the definition of
r2, and hence
{x=true} would have type
r2. A common consequence is that programmers assign the labels of a type a unique prefix:
type r1 = {r1_x: bool} type r2 = {r2_x: bool}
The need for such prefixes is one of the most common criticisms levied at the Haskell record system (although work is ongoing on fixing it). Altogether, for Futhark, we found the Standard ML approach simpler and more elegant.
Now that we can both describe record types and create record values, the next question is how to access the fields of a record, which we call field projection. In languages descended from C, this is done with dot-notation:
p.x extracts field
x from the record (well, struct)
p. Standard ML (but not OCaml) chooses a different notation, which we have also adopted for Futhark:
#x p. This notation feels more functional to me. You can pass it, in curried form, as the argument to
map, to project an array of records to an array of field values:
map #x ps. This requires an explicit lambda if done with dot-notation. However, this quality is a matter of subjective aesthetic preference (and Elm can do this with dot-notation anyway). A more important reason is ambiguity. Since module- and variable names reside in different namespaces, we can have both a module
p and a variable
p in scope simultaneously. Is
p.x then a module member access, or a field projection?
Other languages solve this ambiguity in a wealth of different ways. C sidesteps the issue by not having modules at all. C++’s namespaces use a different symbol (
::). Java implements modules as static class members, which means there is only one namespace, and either the “record” or the “module” will be in scope. OCaml makes module names lexically distinct by mandating that they begin with an uppercase letter, while variable names must begin with a lowercase letter. While this latter solution is elegant, I do not wish to impose such constraints on Futhark (for reasons I will not go into here). Hence, we are going with the SML notation:
#x p retrieves field
x from
p.
Field projection is not the only way to access the fields of a record. Just as we can use tuple patterns to take tuples apart, so do we have record patterns for accessing the fields of a record:
let {x=first, y=second} = p
This binds the variables
first and
second to the
x and
y fields of
p. Instead of just names,
first and
second could also be patterns themselves, permitting further deconstruction when the fields of a record are themselves records or tuples. For now, all fields of the record must be mentioned in the pattern. As a common-case shortcut, a field name can be listed by itself, to bind a variable by the same name:
let {x,y} = p -- same as let {x=x,y=y} = p
Record patterns can of course also appear as function parameters, although type annotations are necessary due to limitations in the type inference capabilities of the Futhark compiler:
let add_points {x1:f64, y1:f64} {x2:f64, y2:f64} = {x = x1 + x2, y = y1 + y2}
Record Updates
When working with records, it is frequently useful to change just one field of a record, while leaving the others intact. Using the constructs seen so far, this can be done by taking apart the record in a record pattern (or using projection), and constructing a new one:
let incr_x {x:f64, y:f64} = {x = x+1.0, y = y}
This works fine for small records, but quickly becomes unwieldy once the number of fields increases. OCaml supports a
with construct for this purpose:
{p with x = p.x+1.0} (using OCaml’s dot notation for field access). This works fine, and would also function in Futhark, but we opted for a more general construct instead.
So far, record expressions have consisted of comma-separated field assignments. We extend this notation, so that an arbitrary expression can occur in place of a field assignment:
{p, x = #x p}
An expression used like this (here,
p) must itself evaluate to a record. The fields of that record are added to the record constructed by the record expression. For example, we can rewrite
incr_x:
let incr_x (p: {x:f64,y:f64}) = {p, x = #x p + 1.0}
Record expressions are evaluated left-to-right, such that if duplicate fields occur, the rightmost one takes precedence. That means we could introduce a bug by erroneously writing the above expression as:
{x = #x p + 1, p}
Since
p already has a field
x, the result of the field assignment will not be included in the resultant record. This error is easy to make, but fortunately also easy to detect and warn about in a compiler.
These extended record expressions are not just for record updates, but perform general record concatenation. For any two records
r1 and
r2, the record expression
{r1,r2} produces a record whose fields are the union of the fields in
r1 and
r2 (the latter taking precedence).
We do not yet know which programming techniques are enabled by this capability, but we are looking forward to finding out. It seems likely that we will eventually add facilities for partial record patterns (only extracting a subset of fields), as well as some facility for removing fields from records. We may also adopt some form of row polymorphism once the time comes to add full parametric polymorphism to Futhark. But that will have to wait for another blog post.
|
https://futhark-lang.org/blog/2017-03-06-futhark-record-system.html
|
CC-MAIN-2021-31
|
refinedweb
| 1,853
| 67.89
|
Welcome back!
The main difference between option 2 and option 3 is that in case of option 2, only the cabin air is recirculated over the evaporator causing the temperature of too cold since same air is being recirculated while in option 3, the air of cabin is mixed with fresh air from outside, causing the cabin temperature a little better, not too cold.
There are two techniques for extracting steering wheel from the column:
OR
thanks for detailed reply
Thanks a lot Bhai. i will respond you after get rectifications shortly.
Dear Test driver and other experienced owners/friends,
Although number of user have already raised this question for installation of advancer (STAP 56 or better option) to get optimum output at petrol as well as on CNG, but I could not get clear answer: My daewoo gives knocking sound while runs on petrol and its performance on petrol is poor than on CNG.
Could you please advise me on following:1. Is it practical to install advancer to get ideal pic on petrol and cng on the same adjustments.2. from where i can get it and cost if some knows.3. The authentic workshop or professional mechanic, from where i can get it installed.4. I hope it will not creat any problem/ of disturb engine wiring /electric system. any precautions for do and donts.. 5. Lastly, should i go for bosh 4 tip plugs for performance and better mileage or any other better option.
The last thing i am worried about that DFC forum came to number three from number One, in terms of views and replies. I think the members are either busy or not providing their valuable inputs.
Regards and thanks in advance.
thanks alot dear i wud like to ask more questtions if the problem arises coz its my first experience to have daewoo
wow. Bilal bhai. 1165 days old on pakwheels and just 2 posts. nice
First of all we are not here to compete other forums, but to discuss and troubleshoot real time issues. Hope you won't mind.
Regarding your query, here is the summary:
Many thanks for reply. Just talked with Haroon Sb. and he said that advancer can be arranged within one week for around Rs. 7500/- which seems on higher side. Whats your opinion on price.
<?xml:namespace prefix = o<o:p></o:p>Secondly obviously DFC is not competing with anyone, but there is little decreased involvement of the users in these days.
its 8 kg
tried to upload pics but not successful
Dear test driver my daewoo is on paint job and i want matching bumpers but painter is not willing to paint them as matching coz as per him the daewoo bumpers cannot b painted but he is willing to make them mate finish paint u r requested to please guide me how can i convince him n what material shuld be used for matching paint
Metallic Matching bumper is recommended only for Cielo's bumper. Racer's bumpers having Waxy material which is not suitable for Metallic paint job. Although many racers having matching bumpers but in ruined condition , If you are really interested to have matching bumpers than you have care alot and avoid to hit bumpers any where. Better painting method is that first Painter has to apply Plastic Permier and than start Paint Job. Although Metallic bumpers looks far better than Mate Finish , but you have to do special care .
may be ur pic size is bigger than max recommended pic size
dear daewoo owners can we install power windows and power steering in daewoo and who is better installer in this case in rawalpindi thx
thanks asad actually he told me same as u said but u know in pakistan specially in lahore bumper care is so difficult i think i shuld go for mate finish thanks for ur support God bless u
Bilal bhai rang barangay karwa lay. I mean mixture of colour and Matt. Dual tone. Will look great.
Sent through Tapatalk
ya mate finish is better , get sprayed first time by professional Painter , with the passage of time , in case of getting fade u can re-spray by your self costing just Rs.150/-
|
https://www.pakwheels.com/forums/t/daewoo-fan-club/33414?page=242
|
CC-MAIN-2017-09
|
refinedweb
| 708
| 67.08
|
Merges (adds) an array of Slapi_Value data values to a specified attribute in an entry. If the entry does not contain the attribute specified, the attribute is created with the value supplied.
#include "slapi-plugin.h" int slapi_entry_merge_values_sv( Slapi_Entry *e, const char *type, Slapi_Value **vals );
This function takes the following parameters:
Entry into which you want to merge values.
Attribute type that contains the values you want to merge.
Values that you want to merge into the entry. Values are of type Slapi_Value.
This function returns either LDAP_SUCCESS or LDAP_NO_SUCH_ATTRIBUTE .
This function adds additional Slapi_Value data values to the existing values contained in an attribute. If the attribute type does not exist, it is created.
If the specified attribute exists in the entry, the function merges the value specified and returns LDAP_SUCCESS. If the attribute is not found in the entry, the function creates it with the Slapi_Value specified and returns LDAP_NO_SUCH_ATTRIBUTE.
Notice that if this function fails, it leaves the values for type within a pointer to e in an indeterminate state. The present value set may be truncated.
This function makes a copy of vals. vals can be NULL.
|
http://docs.oracle.com/cd/E19693-01/819-0996/aaigz/index.html
|
CC-MAIN-2014-42
|
refinedweb
| 191
| 58.69
|
Hi, I'm trying to call some functions in an external COM library, but for some reason after the functions are called, the stack is screwed up and my program crashes.
The way the SDK library is set up, you first do a LoadLibrary(), then a GetProcAddress() on a particular function. You then pass that function a pointer to a vtable, which is filled with a bunch of pointers to functions within the DLL.
Well, the vtable is getting filled with the correct function pointers... but when I call the library functions, they both a) don't work properly and b ) mess up the stack, causing my program to crash.
I've never worked dealt with COM libraries before, so I don't know if there's something special I need to do. I tried modifying the function pointer definitions to be either __stdcall or __cdecl, but neither fix the problem.
I tried compiling the program both in gcc and VC++, it works on neither. VC++ gives me Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention even though I have verified that the calling convention is correct.
Here's a short example of what I'm doing:
And here is the tgsdkx.h file. See the code starting at line 810 in particular for the vtable definition.And here is the tgsdkx.h file. See the code starting at line 810 in particular for the vtable definition.Code:
#include <stdio.h>
#include <windows.h>
#include "tgsdkx.h"
typedef HRESULT ( WINAPI *GetInterfaceProc )(LPSTR, LPSTR, LPVOID*);
struct textCapLib {
HINSTANCE lib;
ITextGRABSDK *sdk;
} textCapLib;
int main(int argc, char **argv) {
BSTR text = NULL;
HINSTANCE lib = textCapLib.lib = LoadLibrary("tgsdk.dll");
if (lib == NULL) {
return 1;
}
/* Now get the address of the GetInterface() function. */
GetInterfaceProc GetInterface;
if ((GetInterface = (GetInterfaceProc)GetProcAddress(lib, "GetInterface")) == NULL) {
goto ERROR_LIB;
}
/* Now call GetInterface(). It'll fill up our SDK structure with function pointers and stuff. */
if (FAILED(GetInterface("", "", (LPVOID *)&(textCapLib.sdk)))) {
goto ERROR_LIB;
}
/* Call the functions. The function pointers are set properly, as the proper functions
* are being called, but the functions appear to be looking for arguments in the wrong
* location, and the stack is messed up after calling them as well. */
(textCapLib.sdk)->lpVtbl->CaptureFromHWND((textCapLib.sdk), (INT_PTR)GetDesktopWindow(), &text);
return 0;
ERROR_LIB:
FreeLibrary(lib);
textCapLib.lib = NULL;
return 1;
}
One last thing: I ran my program through a debugger; it appears that the library functions are looking for arguments in the wrong position on the stack.
|
http://cboard.cprogramming.com/c-programming/116416-stack-issues-when-calling-com-library-printable-thread.html
|
CC-MAIN-2014-42
|
refinedweb
| 443
| 63.9
|
Hi, here is a patch for fluxbox-0.9.6.ebuild to enable xft2.
fluxbox-0.1.14-r2.ebuild applies the patch but it was removed
from fluxbox-0.9.6.ebuild (it didn't apply to 0.9.6 cleanly).
It was originally taken from momonga linux, at
(it is inluced to Portage as ${FILESDIR}/fluxbox-0.1.14-ja.patch)
and was modified by nakano to apply fluxbox-0.9.6.ebuild (and he
gave it to me).
I will attach the patch and a diff to fluxbox-0.9.6.ebuild using
"unicode" USE flag to apply it, but I'm not sure if this is the
correct USE flag (it could be "cjk" as in fluxbox-0.1.14-r2.ebuild or
"truetype" because it enables xft2 support).
Created attachment 22360 [details, diff]
diff to fluxbox-0.9.6.ebuild
Created attachment 22362 [details, diff]
fluxbox-0.9.6-xft.patch
I've spoken to fluxgen (one of the fluxbox authors) regarding this patch. He
asks:
This patch forces the use of XftDrawStringUtf8 even though one didn't specify
UTF-8 in any LC_* variable. What's the reason to not use locale_to_utf8 in the
first if-statement and use it where m_utf8mode == false...
Additional comments from fluxgen:
Please use new/delete instead of C function malloc...
I'm asking to the patch's author if he would rewrite it. If he
won't, I'll do that. (nakano, who gave me the modified patch,
said he will help me in doing so)
Any progress here?
Sorry for the delay. nakano knows the author of the patch personally
and he contacted him. nakano wrote that the author said he would
rewrite it during new year holidays. nakano is on vacation until
Thursday, so I'll ask him when he returns.
Sounds good, thanks for the update.
Created attachment 23640 [details, diff]
new patch
new version from patch author.
Summary of Changes:
* changed malloc/free to new/delete
* moved locale_to_utf8 to FbTk/StringUtil.cc
* changes to FbTk/XftFontImp.cc are same as before
As for the XftDrawStringUtf8 issue, here is a translated response from the author.
<start author's comment>
In the original FbTk/XftFontImp.cc around line 94 is the following code:
#ifdef HAVE_XFT_UTF8_STRING
if (m_utf8mode) {
XftDrawStringUtf8(draw,
&xftcolor,
m_xftfont,
x, y,
(XftChar8 *)(text), len);
} else
#endif // HAVE_XFT_UTF8_STRING
{
XftDrawString8(draw,
&xftcolor,
m_xftfont,
x, y,
(XftChar8 *)(text), len);
}
When HAVE_XFT_UTF8_STRING is true and a UTF-8 locale is set (m_utf8mode == true) then the text is a utf-8 string so XftDrawStringUtf8() works fine.
However, when m_utf8mode == false, problems arise, because the code assumes non-utf-8 text to be a single byte encoding. In the case of encodings like euc-jp, where characters are represented using two bytes each, XDrawString8 fails to render correctly.
It might be possibel to use XftDrawString16 in this case, but even in euc-jp, the lower ascii characters are represented using one byte only, so there is an extra step to figure out if characters are represented using 8 bits or 16 bits.
Instead of doing all this work, the patch just converts everything to utf-8 (which is a relatively well defined operation) and uses XftDrawStringUtf8
<end author's comment>
As for the second part of the comment, i think the new patch uses locale_to_utf8 only where m_utf8mode == false.
< fluxgen> tseng: could you make a comment...
< tseng> sure.
< fluxgen> tseng: that the utf8 == false doesn't work with swedish letters
< fluxgen> tseng: somethings wrong with the utf-8 conversion
Could one of you give this a look? Thanks.
< fluxgen> tseng: ah it gets EILSEQ add that to the comment
I'm guessing you know what this means, I'm just the middleman ;)
I wrote an email to confirm with the patch author, however, from my quick look at it, it seems to just be using iconv for hte conversion so my uneducated guess would be that something is wrong with the iconv setup of whoever is testing it.. but I'll write more once the author gets back to me.
I've recieved confirmation from the patch author that an EILSEQ means that
there is something wrong with the input to the function. Either iconv is not set up right, the locale is not specified correctly, or something in that vein.
from "man iconv"
EILSEQ An invalid multibyte sequence has been encountered in the input.
If you guys are still working on this, please try and get in touch with fluxgen@fluxbox.org, or in #fluxbox on the same name. Adding this to Fluxbox is his call, im not a fan of patching up Gentoo-only sources when the author seems to be willing to work with you. Keep me updated here. TIA
|
https://bugs.gentoo.org/show_bug.cgi?id=36004
|
CC-MAIN-2021-43
|
refinedweb
| 793
| 72.36
|
Dynamic field MVC
Budget $14-30 NZD
This need to be done using model view controller in .net core or mvc5. Avoid using Viewbags to dump data.
Load a datagrid which only shows fields that can be displayed. logic should not be done from the view but from controller as a datasource.
There should be a separate page where we can select the fields to be displayed on the grid.
if it is saved it as only firstname and last name, grid in the other page should only show first name and last name and should not display OrderId
public class Order
{
[Key]
public int Id { get; set; }
[Required]
public string Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
29 freelancers are bidding on average $28 for this job
Greetings! I can help you with your project at a high level! I have lots of experience in ASP.NET MVC. My skills and experience is a great match for your needs. Looking forward to hearing from you. Best regards.
I have a experience in asp.net, MVC, web API, c#, SQL, entity framework,linq, razor view (Cshtl), html, bootstrap,Angular JS, Jquery, Json,XML, reports (PDF,xls, crystal, rdlc,ssrs).
yes i can make Dynamic field MVC, message me i am ready to work from now
Hello I understood your requirement but I have few doubts, text me so I can clear all my doubts right away, I can help you and i am ready for work. Thank you.
|
https://www.freelancer.com/projects/c-sharp-programming/dynamic-field-mvc
|
CC-MAIN-2022-40
|
refinedweb
| 254
| 78.99
|
Hi,
First let me say think you in advance to anybody who is willing to take the time to help me out.
I am a VB6 guy from way back trying to update my programming skills. Rather than tackle vb.net I thought I would try C++. I'm working with Visual C++ 2008.
It's been going pretty well for being only a few days into it but I have run into a difficulty. It's probably a very simple thing for experienced programmers but C++ is great divergence from VB6 and I'm a stuck.
My goal is to output a simple log file. I thought this would work best via a source (cpp) file as opposed to rewriting it for every form. I have created the .h header file and the .cpp file but can't seem to make it work. I've rewritten it 50 times at this point and google searched and dug through my book but can't seem to figure it out.
I will throw some code out here but I know it's messed up and incomplete so please consider it a starting point.
Here is my CPPLog.cpp source file: (what do I actually need to #include and where and how do I need to innitialize the string?)
Here is my CPPLog.h header file: (I get an error saying invalid use of void. I read on some web site you can simply use the keyword string in the declaration but don't know if this is correct.)Here is my CPPLog.h header file: (I get an error saying invalid use of void. I read on some web site you can simply use the keyword string in the declaration but don't know if this is correct.)Code:
#include "stdafx.h"
#include "CPPLog.h"
#include <iostream>
#include <string>
using namespace System::IO;
using namespace System;
String ^ sLog;
void pLogWriter(String ^ sLog){
StreamWriter^ LogFile = gcnew StreamWriter("LogFile.txt");
LogFile->WriteLine(sLog);
LogFile->Close();
}
Code:
#ifndef CPPLOG_H
#define CPPLOG_H
void pLogWriter(string);
#endif
Here is my main form:
Thanks again for your help, I greatly appreciate it.Thanks again for your help, I greatly appreciate it.Code:
#include "CPPLog.h"
pLogWriter("Test");
|
http://forums.codeguru.com/printthread.php?t=546051&pp=15&page=1
|
CC-MAIN-2016-18
|
refinedweb
| 370
| 76.11
|
Barcode Software
qr code generator in vb.net
4: Managing Devices and Disks in .NET
Print qr codes in .NET 4: Managing Devices and Disks
The following question is intended to reinforce key information presented in this les son. If you are unable to answer the question, review the lesson materials and try the question again. You can find the answer to the question in the Questions and Answers section at the end of this chapter. 1. You receive a call from a user who manages a small business network. The busi ness has 10 computers on a network, all running Windows XP Professional and all members of the same workgroup. One of the computers has several folders on it that the manager shares on the network, but there are certain folders that the man ager does not want anyone else to access not even other users on the same com puter. The manager right-clicks the folder and selects Properties. You ask her to switch to the Sharing tab and select the Make This Folder Private check box. She says the option is there, but she cannot select it. The option is dimmed. What is the likely problem
using micro jasper to access barcodes with asp.net web,windows application
BusinessRefinery.com/ barcodes
generate, create barcode how to none with .net projects
BusinessRefinery.com/ barcodes
You can use the following questions to test your knowledge of the information in Les son 3, How to Manage the Lifetime of Remote Objects. The questions are also avail able on the companion CD if you prefer to review them in electronic form.
use visual studio .net bar code integrated to compose bar code on .net namespace
BusinessRefinery.com/barcode
winforms barcode generator
generate, create barcodes dll none on .net projects
BusinessRefinery.com/barcode
ISA Server, Enterprise Edition, supports remote-access virtual private networks (VPN), including network quarantine control, and site-to-site VPNs. With Enterprise Edition, you can configure the option to use NLB for VPN connections. ISA Server provides distributed caching through the use of the Cache Array Routing Protocol (CARP). CARP distributes the cache used by Web Proxy clients across an array of ISA Server computers.
birt barcode plugin
use birt reports barcode drawer to draw barcode for java import
BusinessRefinery.com/barcode
reportviewer barcode font
use report rdlc bar code creation to print bar code in .net apply
BusinessRefinery.com/ barcodes
17. 18. 19. 20.
generate, create qr code 2d barcode details none in microsoft excel projects
BusinessRefinery.com/qr-codes
to display qr bidimensional barcode and denso qr bar code data, size, image with java barcode sdk website
BusinessRefinery.com/Denso QR Bar Code
Important Properties of the Button Control
to build qr barcode and qr bidimensional barcode data, size, image with word documents barcode sdk getting
BusinessRefinery.com/QR Code JIS X 0510
sql reporting services qr code
use cri sql server reporting services qr-codes maker to print qrcode for .net backcolor
BusinessRefinery.com/QR
Lesson Review
qr code 2d barcode size abstract in excel
BusinessRefinery.com/qr bidimensional barcode
qr code jis x 0510 data connect on visual c#
BusinessRefinery.com/Quick Response Code
This causes the workstation to create a folder on the share, named for the user logging on, in which the workstation stores the user s roaming profile. You can configure workstations to use different roaming profile paths by creating multiple GPOs and applying them to different OUs or using filtering to apply them to different computers in a single OU. You can also configure profile paths for individual users by specifying a profile path on the Profile tab of a user s Properties sheet, as shown in Figure 4-39.
crystal reports pdf 417
using barcode generating for .net vs 2010 crystal report control to generate, create pdf417 2d barcode image in .net vs 2010 crystal report applications. version
BusinessRefinery.com/barcode pdf417
code 39 barcode font crystal reports
use visual .net barcode code39 integrating to insert 3 of 9 for .net webform
BusinessRefinery.com/Code-39
Lesson Summary
using resolution word documents to make pdf417 2d barcode in asp.net web,windows application
BusinessRefinery.com/pdf417
ssrs code 39
generate, create barcode 3/9 table none in .net projects
BusinessRefinery.com/Code-39
Conflicts occur when updates to the same data occur at different Subscribers at the same time and those Subscribers then synchronize with the Publisher. These conflicts are resolved through the application of conflict resolution policies. PRIMARY KEY constraints can encompass multiple columns and enforce uniqueness, but they do not allow for NULL values. Multiple UNIQUE constraints can be applied to a table. FOREIGN KEY constraints allow only values that exist in the target column. CHECK constraints evaluate entered data against a logical statement. DEFAULT definitions set a default value for a column if none is entered. An AFTER trigger performs an action once a modification in a transaction has been made. An INSTEAD OF trigger performs an action instead of allowing the modification in the transaction to occur. The 28 base Transact-SQL data types can be used to ensure that only a specific type of data can be entered into a column. An alias data type is a custom version of one of these 28 types and is used to standardize the formatting of data across many tables within a database. User-defined types (UDTs) allow you to extend the scalar type system, can contain more than one element, and allow the storage of CLR objects.
crystal reports data matrix
using update visual studio .net to receive gs1 datamatrix barcode in asp.net web,windows application
BusinessRefinery.com/barcode data matrix
using barcode writer for microsoft excel control to generate, create barcode 3 of 9 image in microsoft excel applications. readable
BusinessRefinery.com/ANSI/AIM Code 39
Understanding Disk Partitions
.net pdf 417 reader
Using Barcode scanner for website VS .NET Control to read, scan read, scan image in VS .NET applications.
BusinessRefinery.com/PDF 417
.net code 39 reader
Using Barcode decoder for align visual .net Control to read, scan read, scan image in visual .net applications.
BusinessRefinery.com/barcode code39
Deploying and Configuring SSIS Packages
Lesson 1
5. To provide a redundant copy of the Customer database using log shipping, which additional objects must be transferred to the secondary server A. Instance master key B. Database master key C. Certificate D. SQL Server Agent jobs 6. Which mechanisms do you use to guarantee security of credit card data (Choose all that apply.) A. Back up to an encrypted file system. B. Use the PASSWORD clause with the BACKUP command. C. Store the backup of your database master key in a locked location that is different from your backups. D. Store the backup of your database master key in a directory different from that of your database backups. 7. The Bookings database is accessed using several SQL Server logins. The Bookings database is made redundant to a secondary server. After the secondary database is made accessible, but before users are allowed to connect, which command should be executed against the secondary to ensure that each login has the appropriate permissions in the Bookings database A. sp_resolve_logins B. ALTER LOGIN C. GRANT D. sp_change_users_login 8. The CTO wants to provide multiple layers of redundancy for the Customer, Book ings, and Products databases. A primary failover must ensure that all databases come online in a short period of time while also maintaining the integrity of the Customer and Bookings databases. A complete failure of the primary solution needs to be backed up by a secondary solution that is allowed to lose up to 30 minutes of data as well as having integrity violations between the Customer and Bookings databases. Which technology combinations can be used to accomplish all business requirements A. Primary failover clustering; secondary Database Mirroring B. Primary failover clustering; secondary replication
Set up your computer according to the manufacturer s instructions. For the exercises that require networked computers, you need to make sure the com puters can communicate with each other. Once the computers are physically networked, install Windows Server 2003 on each computer. Use the following table during installation to help you configure each computer when the Windows Setup Wizard is run:
INSERT INTO Credit VALUES ('David', 'Hamilton', DEFAULT, NULL);
aForm = this.ActiveMDIChild;
Dim loadMessage As OpenFileDialog = New OpenFileDialog
MS-CHAP version 2 (MS-CHAPv2) An authentication protocol that uses mutual authentication, so both the client and the server are authenticated. Also uses separate session keys for encrypting transmitted and received data. MS Firewall Control Protocol An outbound Transmission Control Protocol (TCP) defined on Port 3847. It is used for communications between the Microsoft ISA Server Management Console and computers running ISA Server services. MS Firewall Storage Protocol An inbound LDAP-based protocol that uses Port 2172 (for Secure Sockets Layer, or SSL, connections) and Port 2171 (for non-SSL connections). Array members communicate with the Configuration Storage server using the MS Firewall Storage protocol. Computers running Microsoft ISA Server Management also use the MS Firewall Storage protocol to read from and write to the Configuration Storage server. MS Firewall Storage Replication Protocol An outbound Transmission Control Protocol (TCP) that is defined on Port 2173. MS Firewall Storage Replication is used for configuration replication between Configuration Storage servers. multimaster, or multiple-master, replication A replication model in which any computer hosting a directory service accepts and replicates directory changes. This model differs from single-master replication models, in which one domain controller stores the single modifiable copy of the directory and other domain controllers store backup copies. MX See Mail Exchanger record (MX).
What is the difference between the CONTAINS and FREETEXT functions FREETEXT is a less-precise way of querying full-text data because it automatically searches for all forms and synonyms of a word or words. CONTAINS allows a precise specification for a query, including the capability to search by word proximity, weighting, and complex pattern matching.
SymmetricAlgorithm myAlg = new RijndaelManaged();
data storage
The final tab available in a service s Properties dialog box is the Dependencies tab. You can use the Dependencies tab to determine which system components the service requires to be active to function properly. As shown in Figure 3-10, you can also determine which system components depend on this service to function properly.
More QR Code on .NET
.net barcode generator open source: Estimated lesson time: 50 minutes in .NET Integrated Denso QR Bar Code in .NET Estimated lesson time: 50 minutes
qr code generator in vb.net: Note in .NET Use QR Code JIS X 0510 in .NET Note
qr code generator in vb.net: EXAM TIP in .NET Develop QR Code in .NET EXAM TIP
qr code generator in vb.net: Use the Driver Verifier Monitor Tool in .NET Produce QR Code 2d barcode in .NET Use the Driver Verifier Monitor Tool
qr code generator in vb.net: Note in .NET Writer qrcode in .NET Note
qr code generator in vb.net: Lesson Sumary in .NET Develop QR Code ISO/IEC18004 in .NET Lesson Sumary
qr code generator in vb.net: Note in .NET Writer qrcode in .NET Note
qr code generator in vb.net: WARNING: DISABLING AUTOMATIC SWITCHING IS NOT ALWAYS A GOOD IDEA in .NET Draw QR-Code in .NET WARNING: DISABLING AUTOMATIC SWITCHING IS NOT ALWAYS A GOOD IDEA
.net barcode generator open source: Lesson 1: Managing Windows Firewall Lesson 2: Windows 7 Remote Management in .NET Creation qr bidimensional barcode in .NET Lesson 1: Managing Windows Firewall Lesson 2: Windows 7 Remote Management
barcode generator c# code: Sumary in .NET Get Quick Response Code in .NET Sumary
barcode generator c# code: EXAM TIP in .NET Draw Quick Response Code in .NET EXAM TIP
qr code generator in vb.net: Click Advanced. In the Advanced Security Settings dialog box, click the Effective Permissions tab. in .NET Development QR Code ISO/IEC18004 in .NET Click Advanced. In the Advanced Security Settings dialog box, click the Effective Permissions tab.
qr code generator in vb.net: 9: Authentication and Account Control in .NET Printing qr codes in .NET 9: Authentication and Account Control
qr code generator in vb.net: Note in .NET Make QR Code JIS X 0510 in .NET Note
how to generate qr code vb.net: Figure 9-20: Backup on Secure Desktop in .NET Implement qr-codes in .NET Figure 9-20: Backup on Secure Desktop
barcode generator c# code: Note in .NET Integration Quick Response Code in .NET Note
how to generate qr code vb.net: Figure 10-11: L2TP Advanced Properties in .NET Draw qr codes in .NET Figure 10-11: L2TP Advanced Properties
.net barcode generator open source: DirectAccess RemoteApp in .NET Insert Denso QR Bar Code in .NET DirectAccess RemoteApp
qr code generator using vb.net: Figure 11-9: Removable drive policies in .NET Connect qr codes in .NET Figure 11-9: Removable drive policies
.net barcode library: Data Recovery Agent (DRA) Transparent Caching Offline Files in .NET Generation qr bidimensional barcode in .NET Data Recovery Agent (DRA) Transparent Caching Offline Files
Articles you may be interested
barcode generator in c# windows application: Introducing the Application Object in C# Encoding qr bidimensional barcode in C# Introducing the Application Object
generate barcode using c#.net: Lesson Summary in vb Generator Denso QR Bar Code in vb Lesson Summary
qr code generator c# example: Part 8: Incorporating Advanced Content in C#.net Encode QR Code in C#.net Part 8: Incorporating Advanced Content
qr code generator vb.net 2010: Inside Out in visual basic Printer QR Code in visual basic Inside Out
qr code in c#: continued in C#.net Generator QR Code JIS X 0510 in C#.net continued
qr code vb.net open source: /netonly in vb Creation QR-Code in vb /netonly
barcode reader sdk vb.net: Finding and Organizing Messages with Search Folders in visual C# Development PDF 417 in visual C# Finding and Organizing Messages with Search Folders
generate barcode c# asp.net: Before You Begin in c sharp Add QR Code 2d barcode in c sharp Before You Begin
print barcode in asp.net c#: CAUTION in C#.net Maker qr bidimensional barcode in C#.net CAUTION
c# barcode scanner sdk: 8: Smart Client Application Performance in C#.net Draw 3 of 9 barcode in C#.net 8: Smart Client Application Performance
java read barcode from image open source: Managing Printing in .net C# Access Data Matrix in .net C# Managing Printing
qr code generator c# example: Fine-grained feature control in visual C# Include qr codes in visual C# Fine-grained feature control
barcode in c# windows application: f03ie10 in visual C#.net Encoding QR in visual C#.net f03ie10
c# qr code with logo: Configuring Name Resolution in .net C# Generator QR-Code in .net C# Configuring Name Resolution
c# create qr code with logo: Designing a Security Update Infrastructure in C#.net Encoding qr codes in C#.net Designing a Security Update Infrastructure
generate qr code programmatically c#: Troubleshooting in C# Implement QR Code in C# Troubleshooting
vb.net print barcode free: Property in .NET Writer code 128 code set c in .NET Property
generate qr code c# free: Deploying Software with Group Policy in visual C#.net Generation qrcode in visual C#.net Deploying Software with Group Policy
qr code generator for c#: f18ie02 in .net C# Writer QRCode in .net C# f18ie02
barcode scanner java app download: For a list of device setup classes and their GUIDs, see in visual C#.net Connect Data Matrix 2d barcode in visual C#.net For a list of device setup classes and their GUIDs, see
|
http://www.businessrefinery.com/yc2/298/45/
|
CC-MAIN-2022-05
|
refinedweb
| 2,613
| 50.63
|
strcmp?
and how would you clear the screen like
clrsrn() or somthin like that?
strcmp?
and how would you clear the screen like
clrsrn() or somthin like that?
strcmp() is a function that takes 2 strings and if they are equal it returns zero. For example:
if(strcmp("Equal","Equal")==0) {
//they are equal
}
Yes, you can clear the screen.
Either you can include conio.h and use clrscr() and hope that you have it in conio or hope that you even have conio or you can make a search on these forums and find one of the custom made clrscr()'s
For an actual calculator program you will need some knowledge of assembly, or at least how your CPU works.
A simple way to implement a calculator would be to use stacks.
For instance one stack calculation might be this
100
ADD
150
-------> Total
which in actual assembly would be
mov ax,64h
add ax,96h
mov [total],ax
you could implement your own push and pop functions
push will push a value onto the stack at stack(0). Before doing this it will move all the contents of the stack down by 1 or down by the appropriate data width.
pop will take the value at stack(0) off and place it in the variable after the pop mneumonic. All contents on the stack are moved up accordingly and the stack size is decremented by the data width of the item taken off of the stack.
You could also implement registers similar to the CPU, but you will only need a subset of what the actual CPU has unless you want your calculator to be robust.
Creating a calculator is very similar to creating an emulator and can get very complex. You are essentially emulating a small CPU inside of the virtual calculator with your CPU.
well i know i have conio... i have visual studio and use microsoft for a c++ compiler and i no they have alot of header files... plus i no i can add more i just dont no how
'strcmp' : undeclared identifier
does strcmp require a certain header file?
with MS VC++ i believe it can be found in string.h and also windows.hwith MS VC++ i believe it can be found in string.h and also windows.h'strcmp' : undeclared identifier
does strcmp require a certain header file?
clearing the screen is not part of VC++ but can be found on the FAQ of this board
in the project tab you can add header files to the project then
#include "aHeader.h"
And yes there are a whole lot of header files included with visual studios. If you installed the help files you might want to spend a couple hours going through them like i did once
Hope this stuff helps
|
https://cboard.cprogramming.com/cplusplus-programming/14045-im-new-trying-make-calculator-2.html
|
CC-MAIN-2017-13
|
refinedweb
| 470
| 70.02
|
I know calling
fork() sys_call
fork()
#include <stdio.h>
#include <pthread.h>
int main ()
{
thread_t pid;
pthread_create(&(pid), NULL, &(f),NULL);
pthread_join(tid, NULL);
return 0;
}
void* f()
{
int i;
i = fork();
if (i < 0) {
// handle error
} else if (i == 0) // son process
{
// Do something;
} else {
// Do something;
}
}
The new process will be the child of the main thread that created the thread. I think.
fork creates a new process. The parent of a process is another process, not a thread. So the parent of the new process is the old process.
Note that the child process will only have one thread because
fork only duplicates the (stack for the) thread that calls
fork. (This is not entirely true: the entire memory is duplicated, but the child process will only have one active thread.)
If its parent finishes first, the new process will be attached to init process.
If the parent finishes first a
SIGHUP signal is sent to the child. If the child does not exit as a result of the
SIGHUP it will get
init as its new parent. See also the man pages for
nohup and
signal(7) for a bit more information on
SIGHUP.
And its parent is main thread, not the thread that created it.
The parent of a process is a process, not a specific thread, so it is not meaningful to say that the main or child thread is the parent. The entire process is the parent.
One final note: Mixing threads and fork must be done with care. Some of the pitfalls are discussed here.
|
https://codedump.io/share/H15CRA5XoloZ/1/what-happens-when-a-thread-forks
|
CC-MAIN-2017-34
|
refinedweb
| 263
| 81.53
|
Many people think a fast-slow pointer solution is one-pass. Actually, it is not. It is more than one pass and less than two.
This is the same as if the list is iterated once to count the number of nodes, and then traversed from the beginning again for the count of slow-pointer.
Not really. In two pointer solution, the iteration takes only 1 pass. This greatly differs from 1.x pass you mentioned.
Here's my one pass solution.
public class Solution { public ListNode removeNthFromEnd(ListNode head, int n) { List<ListNode> list = new LinkedList<>(); ListNode temp = head; while(temp!=null){ list.add(temp); temp = temp.next; } int size=list.size(); if(n==1){ if(size<=1) return null; else list.get(size-n-1).next=null; } else if(n==size) head = list.get(1); else list.get(size-n-1).next = list.get(size-n+1); return head; }
}
Coping all ListNode nodes into List<ListNode> and then doing list.get(size-n+1) and claiming it's one pass is ridiculous.
Agree with Alpher.
Two pointer solution is not one pass solution.
Perhaps there is a confusion between one_pass and O(n) complexities.
Is two pointers an O(n) solution? Yes. Is it one_pass solution? Obviously not.
Moving two pointers, first one Length times and another one Len - n times is not different from get-length-of-the-list-first solution.
Basically they are the same: L (list Length) iterations to get length of the list and then Len - n iterations to get to the node which needs to be removed.
When n == 1 it's almost two passes, not one but still O(n).
@Alpher You are actually right. There is no real ONE pass solution with O(1) space complexity.
Two pointers solution is no different than combining the two loops. It doesn't save cycles, but only nice to the eyes.
For the other recursive solution, it is no different than saving all addresses in a vector in heap. In fact all addresses are saved in stack instead. If you pause at the most inner recursion and inspect stack, you will find all addresses of the linked list there.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.
|
https://discuss.leetcode.com/topic/44411/there-is-no-such-solution-with-one-pass
|
CC-MAIN-2017-51
|
refinedweb
| 381
| 69.58
|
Jerome,
update_po has now been changed to automatically scan the py files, so developers no longer need to add .py files somewhere to be scanned.
What is needed:
1/ files that should not be scanned: add them to POTFILES.skip
2/ files that the scan does not pick up and should be used: add them to POTFILES.in
Please check nothing is missing.
Benny
2012/10/3 Benny Malengier <benny.malengier@gmail.com>
One more thing.
I don't like the name gramps for the list of files. Can we use POTFILES.in again?
We can remove POTFILES.skip I suppose and that gramps file then.
I changed my mind. I would like to have it automatic, and only blacklist things. I'll quickly try that.
Benny
It sufficies there to svn skip empty lines or lines starting with #, which is the case in
latest rev 20502.
So if you could move back to POTFILES.in with the nice in directories divided structure?
Guideline would then again be: for code that must be translated: update POTFILES.in
Benny
2012/10/3 Benny Malengier <benny.malengier@gmail.com>Ok,
I don't follow everything you wrote :-)
I updated update_po.py, now py.in files are present in gramps.pot also. Please test.
So that is fixed. All works for python 2.7 now. Optionparser is deprecated, but not difficult to change to the new system, we can do that another time.
About documentation, I meant something in the lines of how to use update_po to be up to date for translation or release. The help only explains the options.
I don't see the problems in tips, you will have to be more specific if there is something I should look at.
The warnings you mention (I suppose you mean the output "../gramps/plugins/view/relview.py:1206: warning: 'msgid' format string with unnamed arguments cannot be properly localized:"
are things in the translation you can fix
I also fixed a bit for pt_BR output on check, not sure if that is the problem you meant.
Lastly, "5. What should be done with:
/data/gramps.xml, /data/gramps.desktop, /data/gramps.keys?"
I don't follow, is there a problem there? intltool-extract is used for these, will this stop working?
Benny2012/10/3 jerome <romjerome@yahoo.fr>> "I removed make and friends now."Oh, so fast!
Note, 'update_po' is a mix between 'get_strings' (Gramps 2.0) logic, the way used by Gnome (intltool, POTFILES), Stephen George (Windows port) and Kees Bakker's (check_po)!
Currently, only few translators have generated the template for translations via make. On trunk, we just need to check if something is not wrong or missing for a complete 'gramps.pot'.
The others flags are just set of commands often used by translators.
python po/update_po.py -hpython po/update_po.py -h
> "1/add some documentation at top of update_po on how it should be used. To me it is not clear at the moment :-)"
or
python po/update_po.py --help
You are right maybe because I generated and tested this file, I was aware of existing flags ... :(
Yes, I will do. :)Yes, I will do. :)
> "2/update the translation documentation on the wiki, so we have an old page which is for gramps 3.x and before, and a current page on how to do things with gramps 4."
Maybe when a function is 'deprecated', there is a transition period?Maybe when a function is 'deprecated', there is a transition period?
> "update_po seems to run here with python2.7"
ie. still work with 2.7, but will be removed soon?
The problem could occur when we try to retrieve strings from tips.xml.in with python 2.7 and the iteration function: a naming issue (and generator) between python 2.6 and python 2.7 ... :(
Note, about the output, there is some minor issues:
1. tips.xml.in has some special cases (not consistent by parsing).
During testing it was tips 7 and 18!
EOL or something like that, because the quick parser for getting these strings need special cases:
tip = tip.replace("\n</_tip>\n", "</_tip>\n") # special case tip 7
tip = tip.replace("\n<b>", "<b>") # special case tip 18
2. some translation strings might be improved according python mapping!
Just run 'update_po -p' for generating a new template and you will see some warnings. It was planned to improve current code.
The classical _('%s is %s with %s for %s under %s at %s')
What are these variables/values???
How to order them???
3. check flag ("-k", "--check") will not properly work for locale with more than two characters (pt_BR, zh_CN)...
4. generated 'gramps.pot' will ignore strings from 'const.py.in'.
A reference issue, which is set under 'gramps' file (plain text file).
5. What should be done with:
/data/gramps.xml, /data/gramps.desktop, /data/gramps.keys?
I guess they were unchanged since many years, but currently they are always parsed (gramps.pot) and regenerated every time during build time (under Linux, BSD, etc ...MacOS?)!
All cosmetic issues.
Jérôme
--- En date de : Mer 3.10.12, Benny Malengier <benny.malengier@gmail.com> a écrit :
De: Benny Malengier <benny.malengier@gmail.com>
Objet: Re: Re : po
À: "jerome" <romjerome@yahoo.fr>
Cc: "Gramps Development List" <gramps-devel@lists.sourceforge.net>Date: Mercredi 3 octobre 2012, 11h34
Jerome,
I removed make and friends now.
update_po seems to run here with python2.7.
If you need help with something, just let me know.
It would be great if you:
1/add some documentation at top of update_po on how it should be used. To me it is not clear at the moment :-)
2/update the translation documentation on the wiki, so we have an old page which is for gramps 3.x and before, and a current page on how to do things with gramps 4.9
Benny
2012/10/2 jerome <romjerome@yahoo.fr>
Benny,
It is still experimental for handling po files and gramps.pot with python libs and GNU tools only.
In fact, it was tested with python 2.6 some months ago...
One thing is remaining for a complete support with python 2.7: one "function/set of lines" is still working with python 2.6 only.
Something like:
from xml.etree import ElementTree
tree = ElementTree.parse(filename)
root = tree.getroot()
mark = _tip
for key in root.getiterator(mark):
I tested an other way, which seems to be more correct, something like:
for key in root.iter():
if key.attrib.get(mark):
...
To spare one line does not really makes sense if this does not work after a python update/migration... I suppose it could be one common function for both files who really need to be parsed: 'holidays.xml' and 'tips.xml'.
Note, 'optparse' is also a deprecated module under python 2.7 (migration)...
I know that it should rather use 'argparse' with this python version.
> Second, if you test on python version, don't check on the 7, but use instead > or <.
Currently, it should still work with python 2.6 and there is a partial support with python 2.7. About python 3.x, I do not think this will work!
Yes, the next step will be to support python 2.7 and +.
If so, do not need to test for python 2.6 anymore.
Note, about translation and 'src->gramps' migration, one module usage is not clear, but I guess it will be modified on next revisions: 'const.py.in'. It is cosmetic. ie. to change 'const.py.in' reference by 'const.py'. Else, 'update_po' has grouped all commands/steps for translation/template handling by using python.
John and Rob did not think that getting rid of 'intltool' was useful.
If Gramps provides a more 'python-standard' way for installation, I suppose to have a python script for translations might be also useful.
It could be also used under others pateforms with few efforts.
Thank you for advices about coding.
Jérôme
--- En date de : Lun 1.10.12, Benny Malengier <benny.malengier@gmail.com> a écrit :
De: Benny Malengier <benny.malengier@gmail.com>
Objet: po
À: "Jérôme" <romjerome@yahoo.fr>
Cc: "Gramps Development List" <gramps-devel@lists.sourceforge.net>
Date: Lundi 1 octobre 2012, 19h30
Jerome,
I see you changed update_po. Some things.
First, trunk requires python 2.7, so it is not needed to do python 2.6 workarounds.
Second, if you test on python version, don't check on the 7, but use instead > or <.
Benny
|
https://sourceforge.net/p/gramps/mailman/attachment/CAOyNq8rGwi+9e9-r%3D0xnjCvX2V6WQh2KWSmRk0obTpo69Bn-pQ@mail.gmail.com/1/
|
CC-MAIN-2017-47
|
refinedweb
| 1,423
| 78.55
|
santhoshsrg
14-05-2020
Hi everyone,
I wanted to create a POST servlet using Resource Type and pass form data. I will be calling this servlet from Component X which is an embedded component. I created a POST servlet using Page component's resourceType. It works fine when form data is not passed. But when form data is passed, it is throwing some exceptions like in the screenshot below. The data i am trying to pass is "img" as in screenshot.
I also tried to create POST servlet using Component Y's resourceType and i was able to pass form data here. Since I am using an embedded component, Servlet using Page resource type will be apt for this.
Any help would be great.
18-05-2020
I did a small mistake. I was using URL as pagePath.save.html in ajax to hit my servlet.
Then i changed URL to pagePath_jcr_content.save.html. This worked.
Thank you all for you inputs!
Shashi_Mulugu
MVP
15-05-2020
If asset creation is the moto, why cant you use the Assets HTTP API?
And if you want to use your custom servlet, try the following link
Hi,
I am passing Image in base64 format to servlet as form data and in servlet i am uploading image to asset. The issue occurs before servlet code ran.
JS Code:
Servlet code:
@component(immediate = true, service = Servlet.class,
property={
"sling.servlet.methods=" + HttpConstants.METHOD_POST,
"sling.servlet.resourceTypes="+ "project/components/structure/page",
"sling.servlet.selectors=" + "save",
"sling.servlet.extensions=" + "html"
})
public class SaveScreenshotServlet extends SlingAllMethodsServlet {
@Override
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response)
throws ServletException, IOException {
String img = request.getParameter(IMG_PARAM);
}
@santhoshsrg Can you paste some code snippet how are you trying to read the payload from the request. Also you said, you want to post formdata but in your question you commented as posting image. Can you please confirm what exactly you are trying to post and how are you reading payload from request.
This will help us to help you.
@smacdonald2008 @atyaf66 @Arun_Patidar Could you please share your input on this?
I am just using POST servlet to upload image to asset. But I am not able to pass any data. When i didn't pass data, servlet is working fine.
Ankur_Khare
Nothing to do with page or component resource type.
Where are you trying to post this data to?
|
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/post-servlet-using-page-resource-type-unable-to-pass-form-data/qaq-p/362234
|
CC-MAIN-2020-50
|
refinedweb
| 396
| 68.36
|
Provided by: alliance_5.1.1-3_amd64
NAME
viewlo - scan all lofig_lists and display their elements
SYNOPSYS
#include "mlo.h" void viewlo();
DESCRIPTION
viewlo scans all the elements of the entire lofig_list loaded in ram, and displays a textual output of the data strcuture contents. All the figures are treated, the first one beeing pointed to by HEAD_LOFIG, the global variable that points to the head of all lofigs. Its use is mostly for debugging purposes, and educational ones, since the output is quite verbose, if very easy to understand.
EXAMPLE
#include <stdio.h> #include "mlo.h" void view_all_to_file(name) char ∗name; { FILE ∗file = freopen(name, WRITE_TEXT, stdout); if (!file) { (void)fputs("Can't reopen stdout!\n", stderr); EXIT(); } viewlo(); /∗ to file called name ∗/ (void)fclose(file); }
SEE ALSO
mbk(1), lofig(3), viewlofig(3), viewloins(3), viewlotrs(3), viewlosig(3), viewloinscon(3), viewlofigcon(3).
|
http://manpages.ubuntu.com/manpages/eoan/man3/viewlo.3.html
|
CC-MAIN-2019-43
|
refinedweb
| 144
| 59.09
|
How to Do 10 Common Tasks in JSF 2.0
How to Do 10 Common Tasks in JSF 2.0
Here’s a list of 10 features you might need to implement everyday and how they are performed in JSF 2.0.
Join the DZone community and get the full member experience.Join For Free
Here’s a list of 10 features you might need to implement everyday and how they are performed in JSF 2.0.
TemplatingJSF 1.0 started by using JSP as the templating technology, but most people started using Facelets by Jacob Hookom and I haven’t since found a templating setup I like more. With JSP, templates work by including files, and with other templating setups you define the template to use and then each page defines the content placed in the template. JSF combines both of these and works very much like ASP.net master pages. Each template page defines areas and in each content page, you pull in the template you want to use and then push the content into the defined areas on the template. Here’s an example template file that defines our header, footer and content layout with specific named areas defined for inserting content with the ui:insert tag.
Notice we re-use the “title” insert point in the page title and the content header. Here is an example page that uses this template :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ""><html xmlns=""xmlns:<h:head><title>Application Name : <ui:insertPage Title</ui:insert></title><h:outputStylesheet</h:head><h:body><div id="page"> <div id="header"> <h1>App Name</h1> </div> <div id="container"> <h1><ui:insertDefault Page Title</ui:insert></h1> <div id="sidebar"> <h1>Sidebar</h1> Content for the sidebar goes here </div> <div id="content"> <ui:insertDefault value for Content</ui:insert> </div> <div id="footer">Footer goes Here</div> </div> </div></h:body></html>
And the result :
<?xml version="1.0" encoding="UTF-8"?><ui:composition <ui:defineHello World!</ui:define> <ui:define Here is some content that we are adding from our custom page. </ui:define></ui:composition>
Writing Code for the PageJSF pages are driven by pojo objects called backing beans that can be defined using annotations. Depending on whether you are using JCDI you will use the managed beans annotations or the JCDI bean annotations. The annotations are very similar except for the package names so care must be taken. You should use the JCDI annotations over the managed bean annotations as JCDI provides a richer set of features. Here is an example bean using the JCDI bean annotations.
This bean is fairly typical in that it is defined as having a name and a scope. Whenever a JSF page evaluates the expression #{calculator}, it will evaluate to a request scoped instance of this bean. This also applies to any other Java EE components that can use EL expressions. Attributes on the bean can be bound to components on the page using the same EL expressions. Here’s an example of displaying the message and inputs for the two numbers in our JSF page.
import javax.enterprise.context.RequestScoped;import javax.inject.Named;@Named("calculator")@RequestScopedpublic class MyBackingBean {private String message = "Welcome to my calculator";private Long number1 = new Long(100);private Long number2 = new Long(24);private Long result; ... getters and setters removed ...}
And the result :
<?xml version="1.0" encoding="UTF-8"?><ui:composition <ui:defineCalculate</ui:define> <ui:define #{calculator.message}<br/> <br/> Number 1 : <h:inputText<br/> <br/> Number 2 : <h:inputText<br/> <br/> </ui:define></ui:composition>
Trigger a method execution on the beanOnce you’ve put in all your data, you want to send it back to the server and do something with it. To do this, we put a form element around the content, and add either a command button or link. In this case, we are going to add a button to add the numbers and display the result. Add a new method to the backing bean to add the numbers and put it in result.
Now we will add the button to the form and a piece of text to show the result.
public void executeAdd() {result = number1 + number2;}
<ui:define <h:form #{calculator.message}<br/> <br/> Number 1 : <h:inputText<br/> <br/> Number 2 : <h:inputText<br/> <br/> <h:outputText<br/> <h:commandButton </h:form> </ui:define>
Hiding view elementsThere are many times you don’t want to render view elements depending on the state in the backing bean. This can range from a value not being set, to limitations based on user security or whether the user is logged in or not. To handle this, all JSF components have a rendered attribute which can be set to an expression. If the expression evaluates to true, then the JSF component is rendered. The rendering applies to all children as well so if one group component is not rendered, none of the children will be either. Here we will use it to hide the result message if there is no result available which is the case when the user first enters the form. We only render the message if the result is not null :
<h:outputText
Decorating contentTypically most content is wrapped in divs and spans that let you style the display easily, for example, data input form properties. Doing this manually for each form input control and then possibly having to change each one manually if something changes is a bad idea. Instead, we can use the ui:decorate tag that lets you wrap content on the content page with other content from a template. The ui:decorate takes a takes a template as a parameter and some content to be wrapped. Our form property template may look like the following :
This defines our structure for the decorator template. We expect a label value to be passed in to use as a caption for the property. The ui:insert tag without a name causes whatever content is placed in the ui:decorate tag in the content page to be inserted. In our case, we want to decorate our form input components.
<ui:composition<div class="property"> <span class="propertyLabel"> <ui:insert : </span> <span class="propertyControl"> <ui:insert /> </span></div></ui:composition>
Here we decorate our number 1 input box with our property decorator which surrounds it with divs which can be styled. We define the label value and pass it into the template so it can be included in the final page.
<ui:decorate <ui:defineLabel Text</ui:define> <h:inputText</ui:decorate>
Creating re-usable contentAnother facelets feature is the ability to create re-usable JSF fragments that can be used in any page. You can even parameterize it so the data that is displayed is relevant to the context of the form it is displayed in. For example, if your entities have auditing information to display the creation and last modified dates, you don’t want to re-produce the view code for that. Instead, you can create a facelet to display that information
Obviously, there would be more code in there for formatting and layout, but this page displays the created and modified dates of the p_entity object. This value is provided by the page into which the composition is being inserted.
<ui:composition Created On : #{p_entity.createdOn} Modified On : #{p_entity.modifiedOn}</ui:composition>
<ui:include <ui:param </ui:include>
Ajaxify a page.Pre-JSF 2.0 most AJAX solutions for JSF were third party ones that each chose their own path to handling AJAX. With JSF 2.0, AJAX is now a part of the framework and can be used by developers out of the box and also allow third party developers to build their own frameworks on top of. Making a form AJAX capable just requires you to do three things. First, you must identify what data is posted back to the server in the call, then you must determine what event the call is made on, and then you must indicate what part of the page will be re-rendered once the AJAX request is complete.
In our example, we’ll make the calculation AJAX enabled by adding the AJAX tag to the command button used to calculate the result. First off, we need to add the javascript for AJAX in JSF. We can do this by adding the following at the top of the content. You can also add it for all pages in the template.
Now we will wrap the result text in a named container called result. We will use this named container to tell JSF what we want to re-render.
<h:outputScript
Now we will add the AJAX features to the command button.
<h:panelGroup<h:outputText</h:panelGroup>
This tells JSF we want to postback the whole form (@form is a special name) and render the component identified by form:result. We could have used @form here as well to re-render the whole form. These two attributes can take these special names, a single component name, or a list of component names. Since we added this to a command button, the event defaults to the clicking of the button.
<h:commandButton<f:ajax</h:commandButton>
Page ParametersHandling page parameters with JSF 2.0 is really simple. We just add some metadata at the top of the page to bind parameters to backing bean attributes.
If we call this page with these parameters set, the form will be pre-populated with our values.
<f:metadata><f:viewParam<f:viewParam</f:metadata>
Validate pageThere are a few ways we can validate the data, but first things first, we need to add some places to put error messages using the h:message tag to display an error message associated with a component. Here is our data entry component using the decorator and the message components added.
In this first instance, we have validated in the view using the required attribute of the input for number 1 and provided a message to display if it is blank. We can also add validations using the standard bean validations in JSR 303. In our backing bean, locate the number2 field and add the validations you want.
<ui:decorate<ui:defineNumber 1</ui:define><h:inputText<h:message</ui:decorate><ui:decorate<ui:defineNumber 2</ui:define><h:inputText<h:message</ui:decorate>
This makes our number 2 value required and ranged to between 0 and 10. If we try and put anything else in and click the execute button, we will get an error. Note that if you are doing this yourself, you have to open up the ajax re-render section to include the whole form since otherwise the error messages will not be rendered as they are not part of the rendered components we specified.
@NotNull@Min(value=0)@Max(value=10)private Long number2;
public void executeAdd() {if (number1 == 27) {FacesContext.getCurrentInstance().addMessage("form:number1",new FacesMessage("Number 1 should not be 27"));}result = number1 + number2;}
Optional CSS StylingThere are many times when you want to style something differently depending on the state on the server. This can easily be done by using EL expressions in the style attribute. In fact, EL expressions can be used in most JSF attributes. To change the style of some text depending on priority of an issue, you can use the following :
<span class="#{issue.isUrgent ? 'urgentText' : ''}">This is not yet resolved</span>
As you can see, there are a lot of powerful things that can be done with JSF using a small amount of simple code and they all follow the same techniques and methods which can help when learning JSF.
From
Opinions expressed by DZone contributors are their own.
{{ parent.title || parent.header.title}}
{{ parent.tldr }}
{{ parent.linkDescription }}{{ parent.urlSource.name }}
|
https://dzone.com/articles/how-do-10-common-tasks-jsf-20?fromrel=true
|
CC-MAIN-2020-05
|
refinedweb
| 1,981
| 52.9
|
This section discusses XML Namespaces, a method of resolving conflicts between similar tagnames having separate meanings. Also a choice between the use of namespaces and the ebXML context mechanism is discussed.
When designing an XML schema, many designers re-use other schemas. It is quite common to use a subset of HTML when you need a piece of formatted text somewhere in your XML files. But, when using elements from multiple sources (read: XML schemas), you need to distinguish between the elements. <title> can be the title of a chapter or the title of a person. When one tag exists in multiple schemas, you need a way of telling them apart.
XML's way of telling tags apart is to add a namespace reference in front of the tags. A namespace reference is a string added in front of the tagname, separated by a colon. The definition of that namespace reference has to be done beforehand, linking the reference (in itself just a string) with the intended XML schema. See Example A-9
Example A-9. Example use of namespaces to distinguish between two title tags, one indicating a chapter's title, the other indicating a person's title.
There are more possibilities, for example defining a default namespace for all unspecified tags within a tag (handy when including HTML for documentation). But above example covers the basics.
The mentioned example of including some HTML markup within an XML document is one of the normal uses of namespaces. It can, however, also be used to glue together different classifications or different models. ceXML could define a set of general tags (including addressing etc.), which can be complemented by allowing tags from, say, a prefab concrete namespace. This can be used as an alternative to ebXML's context mechanism (see the section called ebXML's context mechanism in Chapter 5).
Using namespaces results in an XML-only solution, which can be readily used by everyone. The context mechanism needs a purpose-build software solution to accompany it. But the context mechanism is more flexible and it can generate schemas without any need for action on the client side.
The namespace mechanism has been devised to tell apart tags with the same name but a different meaning. The context mechanism has been devised to construct a set of tags applicable to a certain intersection of contexts. As the intended usage of ceXML is to communicate about building and construction data, it is likely that one has to deal with a number of different classification systems and models. This means that it will be difficult to assemble the right set of tags, excluding the namespace mechanism for that task.
Namespaces can be useful, but their use is limited. For the detailed assembling of the right set of tags for communicating a about a specific building or construction, the context mechanism is best suited. For separating included documentation (probably in an HTML-like format), the actual tags containing the construction data and the generic addressing-like tags, the namespace mechanism is the best method to prohibit possible tagname conflicts.
|
http://reinout.vanrees.org/afstudeerverslag/x1384.html
|
CC-MAIN-2017-09
|
refinedweb
| 515
| 53.92
|
Re: gracefully removing a child domain
- From: "Jorge Silva" <jorgesilva_pt@xxxxxxxxxxx>
- Date: Fri, 16 Jun 2006 14:37:21 +0100
Hi
The best that you can do with 2 different forests in this scenario, is to
create a external trust, 2 way direction , you don't need to create a child
domain in your forest, unless security needs are different from yours.
- , Migration
Wizard cannot match a mailbox to an account; instead, the wizard creates a
disabled user account to associate with the mailbox.
Active Directory Migration Tool (ADMT).
Here's some information for upgrade 2000 ->2003 to the Windows Server 2003
Active Directory service, ensure that you have designed a DNS and Active
Directory namespace and have either configured DNS servers or are planning
to have the Active Directory Installation Wizard automatically install the
DNS service on the domain controller.
Active Directory is integrated with DNS in the following ways:
Active Directory and DNS have the same hierarchical structure. Although
separate and implemented differently for different purposes, an
organization's namespace for DNS and Active Directory have an identical
structure. For example, microsoft.com is both a DNS domain and an Active
Directory domain.
DNS zones can be stored in Active Directory. If you are using the Windows
Server DNS service, primary zone files can be stored in Active Directory for
replication to other Active Directory domain controllers.
Active Directory uses DNS as a locator service, resolving Active Directory
domain, site, and service names to an IP address. To log on to an Active
Directory domain, an Active Directory client queries its configured DNS
server for the IP address of the Lightweight Directory Access Protocol
(LDAP) service running on a domain controller for a specified domain.
While Active Directory is integrated with DNS and they share the same
namespace structure, it is important to distinguish the basic difference
between them:
DNS is a name resolution service. DNS clients send DNS name queries to their
configured DNS server. The DNS server receives the name query and either
resolves the name query through locally stored files or consults another DNS
server for resolution. DNS does not require Active Directory to function.
Active Directory is a directory service. Active Directory provides an
information repository and services to make information available to users
and applications. Active Directory clients send queries to Active Directory
servers using LDAP. In order to locate an Active Directory server, an Active
Directory client queries DNS. Active Directory requires DNS to function.
If use BIND DNS servers Make sure that you have BIND 8.1.2
- Supports: Srv records, Dynamic Updates, Doesn't Support
Secure Dynamic Updates (this is one disadvantage over the MS Dns server
Servers, and represents security issues).
- Create Primary Zone
If Use 2003 DNS
* Create Primary Zone
* You can use an pre existent Dns or you can create it during the upgrade
process.
* Convert to AD-Integrated.
* NetDiag /fix (This is an extra measure, to register the necessary dns
records).
*on" <Jon@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:EDDEEE31-5408-4CE7-A61C-2E69A6845656@xxxxxxxxxxxxxxxx
My company is preparing to acquire another company. Both my forest and the
forest from which company x will be leaving are W2K. I would like to think
that on the cut over day this could be a graceful move. However,
experience
has taught me otherwise. How do I prepare for this day? Is the only
solution
creating a new child domain of my forest and using ADMT to transfer their
accounts prior to cut over? If they can run as usual within their domain
after the cut over, this would be fine. As I am planning to deploy 2k3 in
the
next couple of months. I need to limit the impact to the acquired company
as
much as possible.
.
- Prev by Date: setup a dc in a remote site
- Next by Date: changing passwords
- Previous by thread: Re: gracefully removing a child domain
- Next by thread: Re: 2K3-NT4 Trust
- Index(es):
|
http://www.tech-archive.net/Archive/Windows/microsoft.public.windows.server.active_directory/2006-06/msg01021.html
|
crawl-002
|
refinedweb
| 661
| 53.41
|
# Why does my app send network requests when I open an SVG file?

You decided to make an app that works with SVG. Encouraged by the enthusiasm, you collected libraries and successfully made the application. But suddenly you find that the app is sending strange network requests. And data is leaking from the host-machine. How so?
In today's world, you can have a library for every occasion. So, let's not reinvent the wheel for our application and take a ready-made solution. For example, the SVG.NET library. The source code of the project is [available on GitHub](https://github.com/svg-net/SVG). SVG.NET is distributed as a NuGet package, which comes in handy if you want to add the library to the project. By the way, according to the [project's page in NuGet Gallery](https://www.nuget.org/packages/svg), the library has 2.5 million downloads — impressive!
Let's look at the synthetic code example of the previously described application:
```
void ProcessSvg()
{
using var svgStream = GetSvgFromUser();
var svgDoc = SvgDocument.Open(svgStream);
// SVG document processing...
SendSvgToUser(svgDoc);
}
```
The program's logic is simple:
1. We get a picture from a user. It doesn't matter how we get the picture.
2. The instance of the *SvgDocument* type is created. Further, some actions are performed with this instance. For example, some transformations.
3. The app sends the modified picture back to the user.
In this case, the implementation of the *GetSvgFromUser* and *SendSvgToUser* methods is not that important. Let's think that the first method receives the picture over the network, and the second one sends it back.
What is hidden behind "SVG document processing..."? And again, it's not that important to us what's hidden there, so… the application won't perform any actions.
In fact, we just upload the image and get it back. It seems that there is nothing complicated. But it's enough for strange things to start happening. :)
For our experiments, let's take a specially prepared SVG file. It looks like the logo of the PVS-Studio analyzer. Let's see how the logo looks in the browser to make sure that everything is fine with it.

So, no problems with the logo. Next, let's upload it to the app. The application doesn't perform any actions (let me remind you that nothing is hidden behind the comment in the code above). The app just sends the SVG file back to us.
After that, we open the received file and expectedly see the same picture.

The most interesting thing happened behind the scenes (during the *SvgDocument.Open* method call)
First, the app sent an unplanned request to [pvs-studio.com](https://pvs-studio.com/). You can see that, for example, by monitoring the network activity of the application.

And second, the user of the app received the [hosts](https://en.wikipedia.org/wiki/Hosts_(file)) file from the machine on which the SVG was opened.
How? Where is the hosts file? Let's look at the text representation of the SVG file received from the application. Let me remove unnecessary parts so that they do not distract us.
```
xml version="1.0" encoding="utf-8"?
....
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
#
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
#
# A special comment indicating that XXE attack was performed successfully.
#
```
Here is the hosts file from the machine — carefully hidden in the SVG file without any external manifestations.
Where does the hosts content come from? Where does the additional network request come from? Well, let's figure it out.
About the XXE attack
--------------------
Those who know about the [XXE attack](https://pvs-studio.com/en/blog/terms/6546/) may have already figured out what's going on. If you haven't heard about XXE or have forgotten what it is, I strongly recommend reading the following article: "[Vulnerabilities due to XML file processing: XXE in C# applications in theory and in practice](https://pvs-studio.com/en/blog/posts/csharp/0918/)". In the article, I talk about what is XXE, the causes and consequences of the attack. This information will be required to understand the rest of the article.
Let me remind you, to perform an XXE attack you need:
* the user's data that may be compromised;
* the XML parser that has an insecure configuration.
The attacker also benefits if the compromised data processed by the XML parser returns to them in some form.
In this case, "all the stars are aligned":
* compromised data is the SVG file that the user sends to the application;
* insecurely configured XML parser — we have it inside the SVG processing library;
* the result of the parser's work is returned to the user in the form of the "processed" SVG file.
### Compromised data
First, remember that the [SVG format is based on XML](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics). That means we can define and use XML entities in the SVG-files. These are the entities that are needed for XXE.
Even though the "dummy" SVG file looks normal in the browser, it contains a declaration of two entities:
```
xml version="1.0" encoding="utf-8"?
]>
....
....
&queryEntity
&hostsEntity
```
If the XML parser works with external entities, then:
* when processing *queryEntity*, it'll send a network request to files.pvs-studio.com;
* when processing *hostsEntity*, instead of the entity, it'll substitute the contents of the hosts file.
It turns out to be a kind of SVG trap: when rendering, the file looks normal, but inside — it's got something tricky.
### Insecurely configured XML parser
Remember that you have to pay a price for using external libraries. If you already had a list of possible negative consequences, here's one more thing – potential security defects.
To create the *SvgDocument* instance, we used the *Open* method. Its source code looks as follows:
```
public static T Open(Stream stream) where T : SvgDocument, new()
{
return Open(stream, null);
}
```
This method, in turn, invokes another overload:
```
public static T Open(Stream stream, Dictionary entities)
where T : SvgDocument, new()
{
if (stream == null)
{
throw new ArgumentNullException("stream");
}
// Don't close the stream via a dispose: that is the client's job.
var reader = new SvgTextReader(stream, entities)
{
XmlResolver = new SvgDtdResolver(),
WhitespaceHandling = WhitespaceHandling.Significant,
DtdProcessing = SvgDocument.DisableDtdProcessing ? DtdProcessing.Ignore
: DtdProcessing.Parse,
};
return Open(reader);
}
```
Looking ahead, I'd like to say that in *Open(reader)*, the SVG file is read and instance of the *SvgDocument* is created.
```
private static T Open(XmlReader reader) where T : SvgDocument, new()
{
....
T svgDocument = null;
....
while (reader.Read())
{
try
{
switch (reader.NodeType)
{
....
}
}
catch (Exception exc)
{
....
}
}
....
return svgDocument;
}
```
The *while (reader.Read())* and *switch (reader.nodeType)* constructions should be familiar to everyone who worked with *XmlReader*. It is kind of typical code of XML reading, let's not dwell on it, but return to creating an XML parser.
```
var reader = new SvgTextReader(stream, entities)
{
XmlResolver = new SvgDtdResolver(),
WhitespaceHandling = WhitespaceHandling.Significant,
DtdProcessing = SvgDocument.DisableDtdProcessing ? DtdProcessing.Ignore
: DtdProcessing.Parse,
};
```
To understand whether the parser configuration is unsafe, you need to clarify the following points:
* what the SvgDtdResolver instance is;
* whether DTD processing is enabled.
And here I want to say once again — hail to Open Source! It's such an ineffable pleasure — to have a chance to tinker with the code and understand how/the way something works.
Let's start with the *DtdProcessing* property, that depends on *SvgDocument.DisableDtdProcessing*:
```
///
/// Skip the Dtd Processing for faster loading of
/// svgs that have a DTD specified.
/// For Example Adobe Illustrator svgs.
///
public static bool DisableDtdProcessing { get; set; }
```
Here's a static property whose value we haven't changed. The property does not appear in the type constructor either. Its default value is *false*. Accordingly, *DtdProcessing* takes the *DtdProcessing.Parse* value.
Let's move on to the *XmlResolver* property. Let's see what the *SvgDtdResolver* type is like:
```
internal class SvgDtdResolver : XmlUrlResolver
{
/// ....
public override object GetEntity(Uri absoluteUri,
string role,
Type ofObjectToReturn)
{
if (absoluteUri.ToString()
.IndexOf("svg",
StringComparison.InvariantCultureIgnoreCase) > -1)
{
return Assembly.GetExecutingAssembly()
.GetManifestResourceStream("Svg.Resources.svg11.dtd");
}
else
{
return base.GetEntity(absoluteUri, role, ofObjectToReturn);
}
}
}
```
In fact, *SvgDtdResolver* is still the same *XmlUrlResolver*. The logic is just a little different for the case when *absoluteURI* contains the *"svg"* substring. And from the [article about XXE](https://pvs-studio.com/en/blog/posts/csharp/0918/), we remember that the usage of the *XmlUrlResolver* instance to process external entities is fraught with security issues. It turns out the same situation happens with *SvgDtdResolver*.
So, all the necessary conditions are met:
* DTD processing is enabled (the *DtdProcessing* property has the *DtdProcessing.Parse* value);
* the parser uses an unsafe resolver (the *XmlResolver* property refers to an instance of an unsafe *SvgDtdResolver*).
As a result, the created *SvgTextReader* object is potentially vulnerable to an XXE attack (as we've seen in practice — it is actually vulnerable).
Problem fixes
-------------
An issue was opened about this problem on the project page on GitHub — "[Security: vulnerable to XXE attacks](https://github.com/svg-net/SVG/issues/869)". A week later, [another](https://github.com/svg-net/SVG/issues/872) issue was opened. A PR was made for each issue: the [first](https://github.com/svg-net/SVG/pull/870) pull request, the [second](https://github.com/svg-net/SVG/pull/873) one.
In short, the fix is the following: the processing of external entities is turned off by default.
In the first PR, the *ResolveExternalResources* option was added. The option is responsible whether *SvgDtdResolver* will process external entities. Processing is disabled by default.

In the second PR, contributors added more code, and the boolean flag was replaced with an enumeration. By default, resolving external entities is still prohibited. There are more changes in the code. If you are interested, you can check them [here](https://github.com/svg-net/SVG/pull/873/files).
If we update the 'Svg' package to a secure version, run it in the same application and with the same input data (i.e., with a dummy SVG file), we will get different results.
The application no longer performs network requests, nor does it "steal" files. If you look at the resulting SVG file, you may notice that the entities simply weren't processed:
```
xml version="1.0" encoding="utf-8"?
....
....
```
How to protect yourself?
------------------------
It depends on who wants to be on the safe side. :)
At least, you should know about XXE to be more careful when it comes to working with XML files. Of course, this knowledge won't protect against all dangerous cases (let's be honest — nothing will protect from them). However, it will give you some awareness of the possible consequences.
SAST solutions can help find similar problems in code. Actually, the list of things that can be caught by SAST is large. And XXE may well be on that list.
The situation is a bit different if you are using an external library, and not working with sources. For example, as in the case of our application, when the SVG library was added as a NuGet package. Here, SAST won't help since the tool does not have access to the source code of the library. Although if the static analyzer works with intermediate code (IL, for example), it still can detect the problem.
However, separate tools — SCA solutions — are used to check project dependencies. You can read the following [article](https://pvs-studio.com/en/blog/posts/csharp/0876/) to learn about SCA tools. Such tools monitor the use of dependencies with known vulnerabilities and warn about them. In this case, of course, the base of these vulnerable components plays an important role. The larger the base, the better.
And, of course, remember to update the software components. After all, in addition to new features and bug fixes, security defects are also fixed in new versions. For example, in SVG.NET, the security flaw dealt with in this article was closed in the [3.3.0](https://www.nuget.org/packages/Svg/3.3.0) release.
Conclusion
----------
I've already said, XXE is a rather tricky thing. The instance described in this article is super tricky. Not only did it hide behind the processing of SVG files, it also "sneaked" into application through the NuGet package. Who knows how many other vulnerabilities are hidden in different components and successfully exploited?
Following a good tradition, I invite you to follow [me on Twitter](https://twitter.com/_SergVasiliev_) so as not to miss interesting publications.
|
https://habr.com/ru/post/652253/
| null | null | 2,268
| 50.63
|
Post your Comment
JUnit Test 'assertSame' Example Using Ant
JUnit Test 'assertSame' Example Using Ant
... sec
[junit]
[junit] Testcase: test(AssertSameExample): FAILED
[junit...] at AssertSameExample.test(Unknown Source)
[junit]
[junit]
[junit] Test
JUnit Test 'assertTrue' Example Using Ant
JUnit Test 'assertTrue' Example Using Ant
This example illustrates about how... properly the it return false and throw
a Test Failure method. In this example
JUnit Test 'assertFalse' Example Using Ant
JUnit Test 'assertFalse' Example Using Ant
... that is,
[junit] Testcase: test(AssertFalseExample): FAILED
[junit...] at AssertFalseExample.test(Unknown Sou
[junit]
[junit]
[junit] Test AssertFalseExample
JUnit Test 'assertNotEquals' Example Using Ant
JUnit Test 'assertNotEquals' Example Using Ant... sec
[junit]
[junit] Testcase: test(AssertNotEqualsExample): FAILED
[junit...]
[junit]
[junit] Test AssertNotEqualsExample FAILED
but if both are not equal
JUnit Test 'assertNotSame' Example Using Ant
JUnit Test 'assertNotSame' Example Using Ant..., Errors: 0, Time elapsed: 0.046 sec
[junit]
[junit] Testcase: test...(Unknown Source)
[junit]
[junit]
[junit] Test AssertNotSameExample FAILED
but if both
ANT Tutorials
This example illustrates how to implement junit test case with ant script...;
Using Ant Build Scripts to Drop Mysql Table
This example illustrates how... in your development environment. Ant can be used
to compile, test and package
HttpUnit Test
HttpUnit Test
This example illustrates about how to write a Black Box
test using HttpUnit. The Block Box test is useful in evaluating the overall
health
10 Minutes Guide to Ant
using java technologies.
Lesson 1
Downloading and Installing Ant
Before installing...;project name="Ant test project" default="build"...;project name="Ant test project" default="build"
basedir
Ant and JUnit
Ant and JUnit
This example illustrates how to implement junit test case with ant script.
This is a basic tutorial to implement JUnit framework with ANT
Java Testing
;
JUnit Test 'assertSame' Example Using Ant...;
JUnit Test 'assertTrue' Example Using Ant
This example...;
JUnit Test 'assertNotEquals' Example Using Ant
In the previous
Ant Tutorial
to the Ant installation folder. For example,
c:\apache-ant-1.8.2-bin...Ant Tutorial
In this section we will learn about the various aspect of Apache Ant such as
what is Apache Ant, what is build tool, how to configure ant
Java Ant
, archiving and deployment. Getting
Hands-on Ant For this article I am using jdk1.6.0 and Application Server JBoss
3.2.3 to deploy and test JEE application.
Ant... systems using build.xml.
To know more about Apache Ant
click on:
http
Ant
the
applications.
Ant tool can be used to run the automated test...
Ant
Ant is a tool for building and testing the Java applications. Ant
How to download, compile and test the tutorials using ant.
to install ant.
You can read more about installing and using ant at
http...
Compiling and running Struts 2.1.8 examples with ant
... and run Struts 2.1.8 examples
discussed here.
You will have to install ant
Build and test application
Build and test application
Building and application using ant
At first download the Ant from the
Apache site and then configure it in your system... prompt
and go to the source directory and then type ant and press enter
Ant Script Problem - Ant
Ant Script Problem I refer roseindia's() Ant tutorial. According to that I tried to create tables using Ant script, but it throws following exception.
C:\ksenthuran\workspace\AntDemo2\build.xml:10: Class
Java Glossary : ANT
of java applications. The applications developed by using
the ant build tool...
of using namespaces in order to avoid name clashes of custom tasks.
Benefits of Ant
Ant is build IN Java, USING Java, and FOR Java
It supports Java Tools
Eclipse flex ant coding example
Eclipse flex ant coding example
... .swf
with either web browser or adobe flash player, using the ant build.xml
file... environment, to be
installed on the
system. And for using ant build tool, apache
Test Actions
Test Actions
An example of Testing a struts Action is given below using the junit. In this
example the execute method is being test.
HelloAction.java... method stub
result = helloAction.execute();
super.setUp();
}
@Test
Using Ant Build Scripts to Drop Mysql Table
Using Ant Build Scripts to Drop Mysql Table
This example illustrates how to drop table through the build.xml file
by simply running the ant command. In this build.xml
How to create database in mysql using ANT build - Ant
How to create database in mysql using ANT build Hello ,
can anybody tell me how to create a database in mysql using ant build.Please tell.../ant/AntScriptCreateMysqlTable.shtml
Build and Test tools
tools available in
Java:
Java build and Test Tools
DBUNIT
ANT... then such
test will help you in testing your applications thoroughly. For example if once...Build and Test tools
Application Build and Test tools tutorials
Ant Script to Insert Data in Mysql Table
Ant Script to Insert Data in Mysql Table
This example illustrates how to insert data in table through the build.xml
file by simply running the ant command
Test and debug enterprise components
projects using an existing test environment...
When you have finished using the Universal Test.... For example, if a bean was entered, then the EJB page of the test client
Introduction to Ant
Introduction to Ant
Ant is a platform-independent build tool that specially supports for the Java programming language. It is written purely in Java. Ant
ANT
ANT hi sir how to use JavaAnt?
pls tell me sir
Ant is a Java-based build tool .It there is much more to building software than just... and Tutorials on Ant visit to :
Post your Comment
|
http://www.roseindia.net/discussion/22055-JUnit-Test-assertSame-Example-Using-Ant.html
|
CC-MAIN-2015-22
|
refinedweb
| 927
| 58.08
|
Learning Clojure/Calling Java
- (. instance method args*)
- (. class method args*)
The special form
. also known as host, invokes a public Java method or retrieves the value of a public Java field:
(. foo bar 7 4) ; call the method bar of the instance/class foo with arguments 7 and 4 (. alice bob) ; return the value of public field bob of the instance/class alice
Notice that accessing a field might be mistaken for invoking a parameter-less method: if a class has a parameter-less method and public field of the same name, the ambiguity is resolved by assuming that calling the method is what's intended.
If the first argument to . is a symbol, the symbol is evaluated specially: if the symbol resolves to a Class referred in the current namespace, then this is a call to one of that Class's static methods; otherwise, this is a call to a method of the instance resolved from the symbol. So confusingly, using . with a non-referred symbol resolving to a Class is an invocation of a method of that Class object, not an invocation of a static method of the class represented by that Class object:
(. String valueOf \c) ; invoke the static method String.valueOf(char) with argument 'c' (def ned String) ; interned Var mapped to ned now holds the Class of String (. ned valueOf \c) ; exception: attempt to call Class.valueOf, which doesn't exist
While the . operator is the generic operator for accessing java, there are more readable reader macros that should be preferred instead of using . directly:
- (.field instance args*)
- Class/StaticField or (Class/StaticMethod args*)
Note: Prior to Subversion revision 1158, .field was also usable for static access. However, in recent versions of Clojure, a (.field ClassName) form is treated as if ClassName were the corresponding instance of class java.lang.Class.
Thus, the above examples would be written as:
(String/valueOf \c) ; Static method access! (def ned String) (.valueOf ned \c) ; This will fail (.valueOf String \c) ; And in recent versions, so will this.
If there is need to manipulate the Class object, for example to call the Class.newInstance method, one can do the following:
(. (identity String) newInstance "fred") ; will create a new instance; this will work in all versions of clojure (.newInstance String "fred") ; will work only in a recent enough version of clojure. Expands to the above form. (.newInstance (identity String) "fred") ; this was required in old versions
- (new class args*)
The special form
new instantiates a Java class, calling its constructor with the supplied arguments:
(new Integer 3) ; instantiate Integer, passing 3 as argument to the constructor
Like with calling static methods with ., the class must be specified as a symbol, not as the Class object of the class you wish to instantiate:
(new String "yo") ; new String("yo") (def ned String) ; interned Var mapped to ned now holds the Class of String (new ned "yo") ; exception: new Class("yo") is invalid
A reader macro exists for new as well:
- (Classname. args*)
(String. "yo") ; equivalent to (new String "yo"). Notice the dot!
|
http://en.m.wikibooks.org/wiki/Learning_Clojure/Calling_Java
|
CC-MAIN-2013-20
|
refinedweb
| 511
| 64.41
|
Introduction:
Introduction:
Apart from programming, a lot of my spare time sat at the computer is spent reading group, blog postings, etc from other developers. One particular posting that caught my eye recently provoked a lot of response and mixed answers to a question posed by a poster. This question was, 'What is the difference between composition and aggregation and how would I express it in my programs'?
Reading the responses to the post, I had a mixed reaction, many of the responses reflected my understanding of the difference, others turned my understanding right around and explained composition as my understanding of aggregation.
This short article will put forward my understanding of composition and aggregation and how I would express it in C# code.
Composition:
As we know, inheritance gives us an 'is-a' relationship. To make the understanding of composition easier, we can say that composition gives us a 'part-of' relationship. Composition is shown on a UML diagram as a filled diamond (see Figure 1).
If we were going to model a car, it would make sense to say that an engine is part-of a car. Within composition, the lifetime of the part (Engine) is managed by the whole (Car), in other words, when Car is destroyed, Engine is destroyed along with it. So how do we express this in C#?
public class Engine{ . . . }
public class Car
{
Engine e = new Engine();
.......
}
As you can see in the example code above, Car manages the lifetime of Engine.
Aggregation:
If inheritance gives us 'is-a' and composition gives us 'part-of', we could argue that aggregation gives us a 'has-a' relationship. Within aggregation, the lifetime of the part is not managed by the whole. To make this clearer, we need an example. For the past 12+ months I have been involved with the implementation of a CRM system, so I am going to use part of this as an example.
The CRM system has a database of customers and a separate database that holds all addresses within a geographic area. Aggregation would make sense in this situation, as a Customer 'has-a' Address. It wouldn't make sense to say that an Address is 'part-of' the Customer, because it isn't. Consider it this way, if the customer ceases to exist, does the address? I would argue that it does not cease to exist. Aggregation is shown on a UML diagram as an unfilled diamond (see Figure 2).
So how do we express the concept of aggregation in C#? Well, it's a little different to composition. Consider the following code:
public class Address{ . . .}
public class Person
private Address address;
public Person(Address address)
{
this.address = address;
}
. . .
Person would then be used as follows:
Address address = new Address();Person person = new Person(address);
or
Person person = new Person( new Address() );
As you can see, Person does not manage the lifetime of Address. If Person is destroyed, the Address still exists. This scenario does map quite nicely to the real world.
Conclusion:
As I said at the beginning of the article, this is my take on composition and aggregation. Making the decision on whether to use composition or aggregation should not be a tricky. When object modelling, it should be a matter of saying is this 'part-of' or does it 'have-a'?
View All
|
http://www.c-sharpcorner.com/article/difference-between-composition-and-aggregation/
|
CC-MAIN-2017-22
|
refinedweb
| 557
| 63.8
|
Opened 5 years ago
Closed 11 months ago
#13480 closed Cleanup/optimization (wontfix)
(patch) Gracefully handling ImportErrors in user modules.
Description
(This issue is filed against 1.0 because that's the version I have installed (1.0.2, specifically) and can confirm it with. Code inspection suggests that the problem still exists in SVN, and the attached patch applies to SVN successfully, albeit with some grumbling about the line numbers being wrong.)
Consider the following line of code, taken from a Django application's views.py file:
from django.contrib.models.auth import User
This represents a fairly common type of programmer error, a mistake in naming. In this case, I attempted to import models.auth instead of the correct auth.models. As expected, this generates an error which must be fixed.
If this error happens within a view function, Django will catch it and (if DEBUG is on) print a nice error message.
If, however, this error happens at the module level, Django fails to catch the error, and it becomes a generic 500 error. The exception falls through to the webserver's error logs instead of being instantly displayed to the programmer.
The reason for this distinction is that at the module level, any exception is transformed into an ImportError, making the module completely unavailable and propagating the exception instantly. This causes Django to fail before it has entered the usual error-catching mechanism.
The attached patch fixes this by wrapping the code which triggers the initial import in the same error-catching routines, and also alters the point of import so that the original ImportError may be displayed instead of the ViewDoesNotExist exception which Django raises in its stead.
This patch should be considered a proof-of-concept. It has not been polished beyond basic debugging, and may well be implemented at a suboptimal level of the initial traceback or written in a non-idiomatic fashion. It may also be worth searching for other places where a similar treatment is necessary, but this is beyond my current understanding of Django.
The patch does, however, solve my problem.
Attachments (1)
Change History (10)
comment:1 Changed 5 years ago by axiak
- Cc mike@… added
- Keywords exception handling added
- milestone set to 1.3
- Needs documentation set
- Needs tests set
- Owner changed from nobody to axiak
- Patch needs improvement set
- Status changed from new to assigned
- Triage Stage changed from Unreviewed to Design decision needed
- Version changed from 1.0 to SVN
Changed 5 years ago by FunnyMan3595
Updated version of patch, catches SyntaxError as well.
comment:2 Changed 5 years ago by FunnyMan3595
SyntaxError is now caught. I had assumed that it would be transformed into an ImportError like other exceptions, but as was pointed out, this was incorrect. Indeed, SyntaxError slips through the ViewNotFound transformation as well.
As far as other errors on module load go, I don't know that it's safe to handle them carte blanche, without considering the implications of each one individually. ImportError and SyntaxError are, to my knowledge, the two most common ones to hit, and they're both relatively well-defined as "the programmer screwed up; we should tell them".
Standard webserver error logging is not bad per se, but it's clearly sub-optimal. The webserver's error log may be disabled, inaccessible, unknown to the programmer, or simply inconvenient to reach. The case can also be made that it's nontrivial to read, and that unrelated errors from other parts of the webserver may mask the one which the programmer is concerned with. If the programmer is testing, they're guaranteed to have the webpage open, so Django should give them the information they need directly (provided, of course, it's allowed to by settings.DEBUG).
Put another way, if the webserver's error log is sufficient, why does Django have a custom debugging error page at all? Clearly, the decision has already been made that a custom error page is preferable, so it makes sense to extend it to cover (at minimum) the most common types of programmer error. I can't speak for others, but my experience is that after any given change, there's about a 50% chance that my code contains a syntax error, either a missing : on an if, for, or while statement or some mismatched parentheses. Module-level errors are up there too, but SyntaxError is by far the most common exception I see.
comment:3 Changed 5 years ago by FunnyMan3595
- Cc funnyman3595@… added
comment:4 Changed 4 years ago by julien
- Severity set to Normal
- Type set to Cleanup/optimization
comment:5 Changed.
comment:13 Changed 2 years ago by jacob
- Triage Stage changed from Design decision needed to Accepted
comment:14 Changed 11 months ago by timo
- Resolution set to wontfix
- Status changed from assigned to closed
ImportError in a module seems to cause runserver to crash and display the traceback there. I think that's fine and not worth adding additional complexity to display the message in a browser.
I think this is pretty nifty, though there are a few questions that I think about. This only works when you catch an ImportError, but what about SyntaxError. Then what about all of the other errors you can get on module load?
And why is regular module error logging such a bad thing?
All in all, it's an interesting feature request. I think that this should be raised as a possible feature addition during the 1.3 feature discussion phase (which might occur in 2 weeks or so on django-developers?).
Marking as design decision needed.
|
https://code.djangoproject.com/ticket/13480
|
CC-MAIN-2015-27
|
refinedweb
| 939
| 52.6
|
Agenda
See also: IRC log
rssagent, make log public
<markbirbeck> running a couple of minutes late....sorry
<markbirbeck> be there shortly
<wing> elias should be along in a few minutes as well; he got stuck in traffic
<scribe> Scribe: Steven
-> Previous minutes
<mhausenblas> an inital step XMLLiteral
<scribe> ACTION: Ben to add issue to issues list and start discussion with previous reference and issue reference [recorded in] [PENDING]
<scribe> ACTION: Ben start a list of RDF/XML features that are not supported by RDFa [recorded in] [PENDING]
<scribe> ACTION: Ben to include agenda item for approval of existing tests [recorded in] [DONE]
<scribe> ACTION: Ben to look into Science Commons use case [recorded in] [PENDING]
<scribe> ACTION: Elias to look for cases where plain literal is more of a common use. [recorded in] [PENDING]
<scribe> ACTION: Elias to send email to list with use case from IBM [recorded in] [PENDING]
<scribe> ACTION: Mark produce more examples of applicability of n-ary relations from IPTC documents [recorded in] [PENDING]
<scribe> ACTION: MarkB to work rdf:label back into RDFa syntax when using @content [recorded in] [PENDING]
<scribe> ACTION: Steven to put together sample XHTML2 doc with all mime type, etc. [recorded in] [ONGOING]
<scribe> ACTION: Wing add a property to the test case schema for tracking origin and approval of an individual test [recorded in] [PENDING]
<scribe> ACTION: Ben to take a look at to see if issue has been resolved [recorded in] [ONGOING]
<mhausenblas> RDFa TC status
Mh: Still need some time to finalize
<mhausenblas> RDFa TC status
Mh: happy for feedback
Ben: The partitioning is great
... great to partition along host language types
... might need a grid HTML4/XHTML 1.1/XHTML 2.0
... and SVG might be another column in time
Shane: I think partitioning is great, I have an SGML DTD for HTML 4.01
Mh: Public available?
Shane: For small values of public, sure
<ShaneM> html401+rdfa SGML DTD is at
Ben: About conformance of existing
implementations:
... the bookmarklets are almost uptodate
... Elias's parser is not up-to-date
... but we need to track which implementations are following the latest version
... Do we have an XSLT guru on the team?
... since we could update Fabian's XSLT version
Mh: I'd be happy to do it
Ben: I'm thrilled!
ACTION Michael to update Fabian's XSLT
<scribe> ACTION: Michael to update Fabian's XSLT [recorded in]
Ben: Do we agree with the hybrid solution?
... where mixed content gives XML Literal, otherwise a plain literal
... with an attribute to override
Mark: The hybrid isn't as good as I had
originally thought
... for instance the <table> example
Ben: This is the case with RDFa attribute on the <tr>, and you don't want the <td>s. Isn't the override then the solution?
Mark: Yes, could be
... The solution has to be consistent
Ben: I don't want to reopen the whole issue. I don't see what the problem is with your current example
<tr property="foaf:name"><td>Fred</td><td>Bloggs</td></tr>
Mark: I would like the markup to be preserved, but the query to work
<EliasT> <> foaf:name "<td>Fred</td><td>Bloggs</td>"^^rdfs:XMLLiteral ?
Ben: That's what the hybrid gives us
... I don't get the problem
Elias: I agree that you can write the SPARQL
queries in a defensive manner
... I don't think it should be a driver for the design of RDFa
... why is the snippet above useful to me?
Mark: Why is it not useful?
Elias: I'm OK with that output
... I don't want to go in circles again
<Zakim> mhausenblas, you wanted to ask about the procedure
Mh: I thought we were going to investigate
APIs
... I don't see the problem here.
Ben: I agree with Mark that RDFa brings in a whole new world of semantic markup
Elias: The question is about what should the
default be. Plain, or XML literal.
... but the hybrid solution seems to make this question moot
Mark: My remaining issue is not with the markup
but with the people writing the queries
... if we agree that defensive queries is the solution, then I am happy
<EliasT> Ben, could you please write a PROPOSAL text so we can agree on that and have that on the minutes?
PROPOSAL: Use the hybrid approach, and query defensively
<EliasT> Steven, but I need more explicit text...
<EliasT> :-)
<ShaneM> It would be great if the Primer could capture an example of a defensive query
<benadida> PROPOSAL: we use a hybrid approach: no markup gives a plain literal by default, markup gives an XMLLiteral by default, and datatype can override it in either direction with shorthands.
<EliasT> <> foaf:name "<td>Elias</td>"
<EliasT> <> foaf:name "Elias"^^rdfs:XMLLiteral
Ben: This is not our problem
... i.e. reserialising RDF triples as X/HTML
<benadida> PROPOSAL: we use a hybrid approach: no markup gives a plain literal by default, markup gives an XMLLiteral by default, and datatype can override it in either direction with shorthands. datatype=plain either explicit or by default strips the markup (in some way).
Mark: We need to be explicit what happens when mixed content gets recorded as Plain
<ShaneM> I would like to see whatever the decision is reflected in the description of @datatype in the xhtml-rdfa draft.
<ShaneM> if there are reserved values in the xhtml namespace for @datatype, we need todocument those.
Ben: We still need to resolve what happens when markup gets stripped
<benadida> PROPOSAL:).
Mark: I think we need all text nodes to be concatenated
<EliasT> Second
<mhausenblas> +1
<Simone> +1
<wing> +1
<ShaneM> abstain
RESOLUTION:).
<benadida>
Ben: Opposed?
[none]
<EliasT> +1
Ben: Opposed?
[None]
Ben: href on all elements. Opposed?
[None]
<scribe> ACTION: Ben to update issues list [recorded in]
<ShaneM> coming back.... arrgh
Ben: an earlier proposal had src representing
subject
... we rejected this
... as an object was another proposal
Mark: I sent a private email on this
... the reason src is different, is because the relationship to the document is obvious
<ShaneM> let's debate in e-mail?
Ben: We have opened the discussion, we need to discuss it, and should debate in email
<ShaneM> gotta run - on html call in 3 minutes
Ben: no resolution yet
ADJOURN
Meeting next week, Monday
This is scribe.perl Revision: 1.128 of Date: 2007/02/23 21:38:13 Check for newer version at Guessing input format: RRSAgent_Text_Format (score 1.00) Succeeded: s/Done/Pending/ Succeeded: s/--/-- / Succeeded: s/is/is not/ Succeeded: s/Y/T/ Succeeded: s/tion/tion?/ Succeeded: s/Liet/Lit/ Succeeded: s/irlc/ircl/ Succeeded: s/vb/v/ Succeeded: s/ oc/doc/ Succeeded: s/6// Found Scribe: Steven Inferring ScribeNick: Steven Default Present: mhausenblas, McCarron, Simone, Steven, Ben_Adida, MarkB, ShaneM, wing, EliasT Present: mhausenblas McCarron Simone Steven Ben_Adida MarkB ShaneM wing EliasT Regrets: Ralph Agenda: Got date from IRC log name: 11 Apr 2007 Guessing minutes URL: People with action items: ben elias mark markb michael steven wing[End of scribe.perl diagnostic output]
|
http://www.w3.org/2007/04/11-rdfa-minutes.html
|
CC-MAIN-2015-06
|
refinedweb
| 1,178
| 60.45
|
Bug #1816
rsb-python 0.10 not deployed to pypi
Description
When trying the python basic communication example from the rsb trunk documentation, I get an
AttributeError: __exit__ in the
with statement (
with rsb.createInformer("/example/informer", dataType=str) as informer:):
Traceback (most recent call last): File "basic.py", line 10, in <module> with rsb.createInformer("/example/informer", dataType=str) as informer: AttributeError: __exit__
I am using the
rsb_python-0.11.0-py2.7.egg as it comes with
easy_install rsb-python on Ubuntu Precise 64bit.
History
#1 Updated by J. Wienke over 7 years ago
I can't reproduce this. Any special transport?
#2 Updated by J. Wienke over 7 years ago
Oh I see the problem. There seems to be no upload of rsb version 0.10 to pip. What is the output of
import rsb.version rsb.version.getVersion()
#3 Updated by J. Wienke over 7 years ago
- Subject changed from Python: "with ... as informer" raises AttributeError: __exit__ to rsb-python 0.10 not deployed to pypi
- Status changed from New to Resolved
I have added a CI job to deploy version 0.10 to pypi. Once you update your local installation everything should work
#4 Updated by J. Wienke over 7 years ago
- Target version changed from rsb-0.11 to rsb-0.10
- % Done changed from 0 to 100
Also available in: Atom PDF
|
https://code.cor-lab.de/issues/1816
|
CC-MAIN-2021-39
|
refinedweb
| 229
| 71.1
|
FastAPI
Warning
The current page still doesn't have a translation for this language.
But you can help translating it: Contributing.
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Documentation:
Source Code:
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
The key features are:.
* estimation ---> 100%
Example¶
Create it¶
- Create a file
main.pywith:
from fastapi import FastAPI from typing import Optional app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: str = Optional[None]): return {"item_id": item_id, "q": q}
Or use
async def...
If your code uses
async /
await, use
async def:
from fastapi import FastAPI from typing import Optional fastapi import FastAPI from pydantic import BaseModel from typing import Optional app = FastAPI() class Item(BaseModel): name: str price: float is_offer: bool = Optional¶
And now, go to.
- The alternative documentation will also reflect the new query parameter and body:
Recap¶:
¶
Independent TechEmpower benchmarks show FastAPI applications running under Uvicorn as one of the fastest Python frameworks available, only below Starlette and Uvicorn themselves (used internally by FastAPI). (*)
To understand more about it, see the section Benchmarks.
Optional Dependencies¶
Used by Pydantic:
ujson- for faster JSON "parsing".
Used by Starlette:
requests- Required if you want to use the
TestClient.
aiofiles- Required if you want to use
FileResponseor
StaticFiles..
|
https://fastapi.tiangolo.com/it/
|
CC-MAIN-2020-50
|
refinedweb
| 235
| 56.35
|
Create a Small Interactive Application with Sencha Animator
Sencha Animator is very flexible, and it can be used for a variety of purposes, from prototyping mobile applications to creating interactive animated features for iBooks. This tutorial shows how an animation can quickly be enhanced to an interactive mini-app by adding actions and custom code.
Download Sencha Animator Download Project Files View Animator Docs
Before you get started
To successfully complete this tutorial, you will need to be familiar with Animator. Before getting started, it’s a good idea to have absorbed the basics:
- Download and install the latest Sencha Animator.
- Review Animator documentation and follow the Animator Quickstart tutorial.
- Download project files and resources. They include a partially built “before” version,
startQuiz.animproj, which you can open in Animator and use during the tutorial so we can focus on adding interactivity, logic, and JavaScript code. Also included is an “after” version,
finishedQuiz.animproj, which shows the finished project after completing the steps described in this tutorial.
- Have a WebKit browser like Google Chrome or Apple Safari to preview your Animator projects. (You can also use the iOS Simulator included with Xcode for Mac OS X.)
Open the project
Open
startQuiz.animproj in Sencha Animator. In the Scenes Panel, you should see five scenes, as follows:
- Intro
- Questions
- Incorrect
- Correct
- Score
Select and run each scene to see what it does. You should also select the elements in each scene to familiarize yourself with them before we start adding interactivity. As you select elements, keep in mind that Animator lets you select an object on the Center Stage in two ways:
- Base state mode. When you select an object that’s not on a keyframe, Animator displays it inside a purple box in the Center Stage. To view an object in this mode, click its name in the Object Tree or click the object in the timeline in between keyframes. Selecting an object in base state mode means you can edit its base properties, which persist with the object throughout the scene.
- Keyframe mode. When you select an object currently on a keyframe, Animator displays it inside a blue box in the Center Stage. To view an object in this mode, click on a keyframe in the Object Tree. Selecting an object in keyframe mode means you can edit its keyframe properties, which can change when the object reaches the next keyframe.
In the File menu, select “Preview Project in Browser” to view the project in the browser. You’ll see the first scene, which doesn’t allow for any user interaction yet. We’ll take care of that in the tutorial by adding actions and a little JavaScript code to each scene. In the process, we’ll turn the project into a generic interactive quiz template.
Scene 1: Intro
Select Scene 1 in the Scenes Panel, and select the element called Button in the Object Tree. You can also select it in the Center Stage — it contains the text “Start”. In the Property Panel, in the Click action property under General, select “Go to next scene”. When the user clicks the button in the running animation, it will now advance to the next scene. Go ahead and try this by saving your project and selecting Preview Project in the File menu. (Be sure to save your project from time to time after this.)
Let’s also add some JavaScript to initialize a new set of quiz questions. Be sure the Intro scene is selected in the Scene panel, and in the Property Panel set the Start property under Actions to Custom JavaScript. Click Open editor and paste the following code into the Custom JS window:
// Create a global object/namespace for the project to use. if (typeof(quizData) === "undefined") { quizData = {}; } // To help work with scenes, translate some // scene ids into names. The scene id can be found // by hovering the mouse over a scene in the Scene Panel. if (!quizData.sceneIDs) { quizData.sceneIDs = { question: 1, wrong: 2, correct: 3, score: 4 }; } // Set up some questions. if (!quizData.questions) { // Each question text entry consists of a question, 4 answers, // and the index of the correct answer. quizData.questions = [ { question: "Which one of these is a CSS3 property?", answers: [ 'animation-degradation', 'animation-path', 'animation-fill-mode', 'animation-speed' ], correctAnswerIndex: 2 }, { question: "What is the syntax to start a keyframe segment in CSS3?", answers: [ "@keyframes 'name'", "@animation 'name'", ".element:animation", ".element:keyframes" ], correctAnswerIndex: 0 }, { question: "Which is a valid CSS3 animation-timing-function?", answers: [ 'slide-in', 'ease-out', 'jump-out', 'fast-in' ], correctAnswerIndex: 1 } ]; } // Set up or reset variable for the current question. quizData.currentQuestionIndex = -1; // Set up or reset variables to keep track of score. quizData.scoreRight = 0; quizData.scoreWrong = 0;
Read through the code comments so you can see what each section does. Close the Custom JS window and save the project.
Scene 2: Questions
Select the Questions scene in the Scenes Panel, then select the Question text element in the Object Tree. In the Properties Panel set General->CSS ID to
question. This will give the DOM element an ID of
question in the exported code so it can easily be referred to from JavaScript code. Similarly, set the CSS IDs of the four buttons (from top to bottom in the Object Tree) to
button1 (top-most),
button2,
button3, and
button4. Note that Animator will not let you assign the same CSS ID to two elements; Animator automatically changes any redundant name.
Be sure the scene is still selected in the Scenes Panel, and in the Properties Panel, under Actions, se the Start property to Custom Javascript and add the following code, again being sure to review the comments so you can see what each section does:
// Increment the question index. var index = ++quizData.currentQuestionIndex; // If there are no more questions, go to the Score scene. if (index >= quizData.questions.length) { controller.startSceneByID(quizData.sceneIDs.score); return; } // Get the current question. var currentQuestion = quizData.questions[index]; // Get references to the different elements on the stage; // notice that the text we want to edit resides inside // span elements. var question = document.querySelector('#question span'); var button1 = document.querySelector('#button1 span'); var button2 = document.querySelector('#button2 span'); var button3 = document.querySelector('#button3 span'); var button4 = document.querySelector('#button4 span'); // Update the question text. question.innerHTML = currentQuestion.question; // Update buttons and answers. button1.innerHTML = currentQuestion.answers[0]; button2.innerHTML = currentQuestion.answers[1]; button3.innerHTML = currentQuestion.answers[2]; button4.innerHTML = currentQuestion.answers[3]; // Store the correct answer index. quizData.correctAnswerIndex = currentQuestion.correctAnswerIndex;
Preview the project again, and you should see that the questions and answers have been updated.
Next, add logic to each of the objects labelled Button to detect if an answer is correct. One at a time for each button, in the Properties Panel select the Custom JavaScript in the Click action property under General, and the following JavaScript, setting buttonIndex in each Button (from top to bottom in the Object Tree) to
0,
1,
2, and
3:
// Check if this is the button with the correct answer. var buttonIndex = 0; if (quizData.correctAnswerIndex === buttonIndex) { controller.startSceneByID(quizData.sceneIDs.correct); } else { controller.startSceneByID(quizData.sceneIDs.wrong); }
Scene 3: Incorrect
Select the Incorrect scene in the Scenes Panel, then select the Answer text element (which contains the text “Texas” in the Content field under General in the Properties Panel) in the Object Tree. Set the CSS ID for the Answer element to
correct-answer. Then set the start action of the scene to Custom JavaScript and insert the following code:
// Get the current question. var question = quizData.questions[quizData.currentQuestionIndex]; // Get the element that displays the correct answer. var correctElement = document.querySelector('#correct-answer span'); // Update the answer. correctElement.innerHTML = question.answers[question.correctAnswerIndex]; // Increase the wrong answer score. quizData.scoreWrong++;
Set the click action for the object called Button (which displays the text “Continue”) to Go to Scene and select “2. Questions”.
Scene 4: Correct
Select the Correct scene in the Scenes Panel, set the start action of the scene to Custom JavaScript, and insert the following code in the Custom JS window:
// Increment the correct score. quizData.scoreRight++;
Select the Button element in the Object Tree, set its Click action property to Go to scene, and select 2. Questions. You may have to open the disclosure triangle next to the Click action property to view the list of scenes.
Scene 5: Score
Select the Score scene in the Scenes Panel, then select the Score element in the Object Tree. Set its CSS ID to
final-score. Then set the start action of the scene to Custom JavaScript and insert the following code to the Custom JS window:
// Get element for score. var scoreElement = document.querySelector('#final-score span'); // Get score and total possible points. var right = quizData.scoreRight; var total = quizData.scoreRight + quizData.scoreWrong; // Create score text. var text = right + '/' + total + ' points'; // Display score text. scoreElement.innerHTML = text;
Finally, set the Click action property for the scene’s Button element to Go to scene and select “1. Intro”.
Finishing Touches
To make this display well on an iPhone, we need to add meta tags to make the app occupy the full screen and so it can be easily saved as a web app on the Home screen. Note that the dimensions set for the app are optimized for full screen mode. We also add a couple of lines of JavaScript to hide the address bar when the page loads.
To do that, select the Project tab, click the Head HTML field under Export, and enter the following code:
<meta name="viewport" content="user-scalable=no, width=device-width"> <meta name="apple-mobile-web-app-capable" content="yes"> <script type="text/javascript"> // hide the address bar window.addEventListener("load",function() { setTimeout(function(){ window.scrollTo(0, 1); }, 0); }); </script>
Deploy the App
Now that the project is complete, select Export in the File menu to create a directory containing an HTML file for the project and its image assets. You can put this directory on your web server to host the quiz mini-app. Here is a link to a hosted version of the app. If you have access to an iPhone or the iOS Simulator, save the app to your home screen and see how it works!
Conclusion and Next Steps
This guide has shown you how to add actions and custom code to create rich interactive animations that can be combined into a mini-app with little effort.
Since the mini-app is based on open standards it can easily be extended. It could be wrapped for native and submitted to the App Store. Instead of using hard-wired content, the app could get questions and answers through a JSON request. It could be integrated with Sencha.io to provide scoreboard functionality and much more.
If you expand this application, go ahead and show us your work by creating a new thread in the Sencha Animator forum.
There are 5 responses. Add yours.
Dinesh M3 years ago
Hi,this is good
Dinesh M3 years ago
great!!!!!!!!
tom eloph3 years ago
whenever i try to load any of the code examples, Animator throws an error and i can’t open the project… help please
narcis3 years ago
very nice of you to share this, but it’s very complicated.
NOC3 years ago
Great it’s Allow us to show creativity.
Comments are Gravatar enabled. Your email address will not be shown.Commenting is not available in this channel entry.
|
http://www.sencha.com/blog/interactive-application-with-sencha-animator/
|
CC-MAIN-2014-42
|
refinedweb
| 1,918
| 56.35
|
The wrapper class for the SDL_Window class. More...
#include <window.hpp>
The wrapper class for the SDL_Window class.
At the moment of writing it is not certain yet how many windows will be created. At least one as main window, but maybe the GUI dialogs will have their own window. Once that is known it might be a good idea to evaluate whether the class should become a singleton or not.
The class also wraps several functions operating on SDL_Window objects. For functions not wrapped the class offers an implicit conversion operator to a pointer to the SDL_Window object it owns.
Definition at line 44 of file window.hpp.
Referenced by windows_tray_notification::get_window_handle().
Constructor.
The function calls SDL_CreateWindow and SDL_CreateRenderer.
Definition at line 25 of file window.cpp.
References fill(), lg::info(), pixel_format_, render(), and window_.
Definition at line 74 of file window.cpp.
Dummy function for centering the window.
Definition at line 102 of file window.cpp.
Clears the contents of the window with a given color.
Definition at line 127 of file window.cpp.
Dummy function for setting the window to fullscreen mode.
Definition at line 122 of file window.cpp.
Definition at line 161 of file window.cpp.
Referenced by CVideo::video_settings_report().
Definition at line 151 of file window.cpp.
Gets the window's renderer output size, in pixels.
Definition at line 94 of file window.cpp.
Gets the window's size, in screen coordinates.
For the most part, this seems to return the same result as get_output_size. However, SDL indicates for high DPI displays these two functions could differ. I could not observe any change in behavior with DPI virtualization on or off, but to be safe, I'm keeping the two functions separate and using this for matters of window resolution.
Definition at line 86 of file window.cpp.
Dummy function for maximizing the window.
Definition at line 107 of file window.cpp.
Conversion operator to a SDL_Renderer*.
Definition at line 171 of file window.cpp.
Conversion operator to a SDL_Window*.
Definition at line 166 of file window.cpp.
Renders the contents of the window.
Definition at line 136 of file window.cpp.
Dummy function for restoring the window.
Definition at line 117 of file window.cpp.
Sets the icon of the window.
This is a wrapper for SDL_SetWindowIcon.
iconis a SDL_Surface and not a SDL_Texture, this is part of the SDL 2 API.
Definition at line 146 of file window.cpp.
Set minimum size of the window.
This is a wrapper for SDL_SetWindowMinimumWindowSize.
Definition at line 156 of file window.cpp.
Wrapper for SDL_SetWindowSize.
Definition at line 81 of file window.cpp.
Sets the title of the window.
This is a wrapper for SDL_SetWindowTitle.
Definition at line 141 of file window.cpp.
Dummy function for returning the window to windowed mode.
Definition at line 112 of file window.cpp.
The preferred pixel format for the renderer.
Definition at line 189 of file window.hpp.
The SDL_Window we own.
Definition at line 186 of file window.hpp.
Referenced by center(), full_screen(), get_display_index(), get_flags(), maximize(), operator SDL_Renderer *(), operator SDL_Window *(), restore(), set_icon(), set_minimum_size(), set_size(), set_title(), to_window(), window(), and ~window().
|
http://devdocs.wesnoth.org/classsdl_1_1window.html
|
CC-MAIN-2020-24
|
refinedweb
| 522
| 62.85
|
Memory limitations in the flash playerKrisKohlstedt Aug 18, 2009 3:33 PM
I've been running into some memory limitations in a flex application that I'm working on. As a test I wrote the code below to try and determine what the true memory limitations of a flex application running in the flash player are. What I've found is the following. On both the windows and linux machines there is a total of 4G of space available and in none of these cases was the OS near hitting the physical memory limit.
Max memory usage on various configurations:
flash player 10 on windows = ~650M
flash player 9 on windows = ~800M
flash player 10 on linux = unlimited (I was able to get up to 2.5G without any problems)
Has anyone else run into these limitations? Can anyone comment on possible work arounds to these limitations or provide any insight on why the flash player would have an artificial memory limit below what the OS can provide?
In the following application each button click takes up about 100M making it fairly easy to see at what point the flash player is crapping out.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:
<mx:Script>
<![CDATA[
import mx.formatters.NumberFormatter;
var outer:Array = new Array(1000);
var outerCnt:int = 0;
private const MBYTE : int = 1024 * 1024;
private function onButtonClick():void {
var inner:Array = new Array(5000000);
var formatter:NumberFormatter = new NumberFormatter();
formatter.useThousandsSeparator = true;
var cnt:int = 0;
for(var i:int=0;i<50000000;i++) {
inner[cnt++] = "testsstringtestsstringtestsstringtestsstringtestsstringtestsstringtestsstringtestsstring testsstringtestsstring";
}
outer[outerCnt++] = inner;
text.text = formatter.format(flash.system.System.totalMemory/MBYTE);
}
]]>
</mx:Script>
<mx:Button
<mx:Text
</mx:Application>
1. Re: Memory limitations in the flash playerFlex harUI
Aug 18, 2009 4:11 PM (in response to KrisKohlstedt)
What error did you get at the limit? System.totalMemory is not the same as total process memory. See my blog for details?
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
2. Re: Memory limitations in the flash playerKrisKohlstedt Aug 19, 2009 6:06 AM (in response to Flex harUI)
In some cases I get the stack trace below and in other cases the application just crashes with no flex stack trace at all. Was there something specifically related on your blog that I should take a look at? Thanks.
Error: Error #1000: The system is out of memory.
at global$init():: reloader/timerHandler()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
3. Re: Memory limitations in the flash playerFlex harUI
Aug 19, 2009 7:52 AM (in response to KrisKohlstedt)
There's a post on how to use the profiler that explains the difference between System.totalMemory and process memory. There may also be a limit on how much memory plug-ins can use, but I'd say that if you've used up 500MB, that's quite a bit and some sort of memory management strategy is in order. Otherwise, if the customer is using your app along with Excel and some other biggies, there'll be lots of thrashing.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
4. Re: Memory limitations in the flash playerKrisKohlstedt Aug 20, 2009 9:28 AM (in response to Flex harUI)
Its a big application, there is no doubt about that but regardless we are trying to figure out why the flash player limits the amount of memory that the application can use. Especially when the machine itself has plenty of memory available. Was this by design? Is there any known workaround? Is this something that is expected to be fixed in upcoming releases?
5. Re: Memory limitations in the flash playerFlex harUI
Aug 20, 2009 9:44 AM (in response to KrisKohlstedt)
Like I said, System.totalMemory is not the same as process memory (and can be a fraction of total process memory). What kind of process memory do you see when System.totalMemory is at 500MB? AFAIK, the player has no official limits but the plug-in browser hosts might.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
6. Re: Memory limitations in the flash playerKrisKohlstedt Aug 20, 2009 4:35 PM (in response to Flex harUI)
The process memory seems to stay fairly well in line with what totalMemory is reporting. For example when the test application that I posted earlier first launches the browser process takes around 200M. As I force the flex app to conume more memory the amount of memory that flex/flash reports being i n use and the amount that the process is actually using seem to grow in line with each other. So when flex/flash reports 300M in use the browser process is at about 500M and when flex/flash reports 500M the process is at 700M.
The reason I was suspecting that the flash player was the limitation is because we see this same behavior in firefox, crome and IE. I suppose its possible that under the hood somehow they all share a plugin framekwork which is imposing the limitation.
Thanks for the information, any other thoughts or possible workarounds (I'm not hopeful here) are appreciated.
7. Re: Memory limitations in the flash playerFlex harUI
Aug 20, 2009 4:41 PM (in response to KrisKohlstedt)
Each browser has its own plug-in architecture. Each browser may be imposing limits. The only workarounds I would suggest are ones that would get your app to run in less than 200MB. Unless you're hosting on a kiosk, that's quite a load to take against other apps running on the same system.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
8. Re: Memory limitations in the flash playerKrisKohlstedt Aug 21, 2009 6:12 AM (in response to Flex harUI)
Yep, we are running the app on dedicated machines. In the end what this means is that the size of the applications that can be developed in flex is somewhat limited. Look for example at eclipse itself, it is currently running on my machine and using over 1G of memory. I'm running another fat client Java application that often takes well over 1G of memory. While that is a lot of memory to be using, it is the requirement of applications with enough functionality that they will use a lot of memory to operate. Perhaps flex/flash wasn't designed for that level of application.
In any case, thanks again for the information.
9. Re: Memory limitations in the flash playerFlex harUI
Aug 21, 2009 8:14 AM (in response to KrisKohlstedt)
It probably isn't a design issue. We have to live in browsers. Did you try the standalone player or AIR?
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
10. Re: Memory limitations in the flash playersunil patrapati Feb 27, 2014 5:28 AM (in response to Flex harUI)
hi,
I am facing the exact same issue even in Adobe Air. Here is the code snippet. Any help/input would be of great help.
<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns: <fx:Script> <![CDATA[ import mx.events.FlexEvent; private var byteArray:ByteArray = new ByteArray(); protected function button1_clickHandler(event:MouseEvent):void { var count:int = 1048576*600; for(var i:uint = 0; i<=count; i++) { try{ byteArray.writeBoolean(true); }catch(e:Error){ trace(e.message); break; } } } ]]> </fx:Script> <s:Button </s:WindowedApplication>
11. Re: Memory limitations in the flash playerFlex harUI
Feb 27, 2014 9:25 AM (in response to sunil patrapati)
What error did you get and at what memory level?
12. Re: Memory limitations in the flash playersunil patrapati Feb 27, 2014 6:59 PM (in response to Flex harUI)
13. Re: Memory limitations in the flash playerFlex harUI
Feb 28, 2014 10:14 AM (in response to sunil patrapati)
You might want to file a bug at bugbase.adobe.com. Or try a later version of AIR.
14. Re: Memory limitations in the flash playersunil patrapati Mar 2, 2014 4:51 AM (in response to Flex harUI)
I tried with Adobe Air V4, but still the crash issue persists. As suggested by you I will rasie a bug.
thanks & Regards
Sunil.P
|
https://forums.adobe.com/thread/479297
|
CC-MAIN-2017-51
|
refinedweb
| 1,358
| 63.29
|
69007/how-to-read-mp4-video-file-stored-at-hdfs-using-pyspark
Hi@Amey,
You can enable WebHDFS to do this task. Follow the below given steps.
Enable WebHDFS in HDFS configuration file. (hdfs-site.xml)
Set dfs.webhdfs.enabled as true.
Restart HDFS daemons.
We can now access HDFS with the WebHDFS API.
Now you can browse your video by using curl command.
$ curl -i "http://<HOST>:<PORT>/webhdfs/v1/<PATH>
As we know video file is combination of arrays. So read your video file in a variable.
Hope this helps!
To know more about Pyspark, it's recommended that you join Pyspark course online.
Thanks.
Hey,
You can try this:
from pyspark import SparkContext
SparkContext.stop(sc)
sc ...READ MORE
How can one parse an S3 XML ...READ MORE
As parquet is a column based storage ...READ MORE
Yes, you can go ahead and write ...READ MORE
You aren't actually overwriting anything with this ...READ MORE
You can save the RDD using saveAsObjectFile and saveAsTextFile method. ...READ MORE
You can add external jars as arguments ...READ MORE
The amount of data to be transferred ...READ MORE
Hi@dani,
As you said you are a beginner ...READ MORE
Hi,
Use this below given code, it will ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.
|
https://www.edureka.co/community/69007/how-to-read-mp4-video-file-stored-at-hdfs-using-pyspark
|
CC-MAIN-2022-33
|
refinedweb
| 234
| 70.8
|
28 October 2013 17:00 [Source: ICIS news]
HOUSTON (ICIS)--Here is Monday’s midday ?xml:namespace>
CRUDE: Dec WTI: $98.41/bbl, up 56 cents; Dec Brent: $109.00/bbl, up $2.07
NYMEX WTI crude futures rose, tracking a strong rally on ICE Brent in response to a drop in Libyan crude exports due to protests. The market also responded to released data showing a jump in US industrial output. WTI topped out at $98.82/bbl before retreating.
RBOB: Nov. $2.6332gal, up 4.61 cents/gal
Reformulated blendstock for oxygen blending (RBOB) gasoline futures rallied in early trading, following strength in crude oil. Additionally, last week’s slump was seen as a buying opportunity early in the day.
NATURAL GAS: Nov: $3.571/MMBtu, down 13.6 cents
NYMEX natural gas futures slumped through Monday morning, crashing nearly 4% on the back of warmer weather forecasts for early November and concerns over near-record high production output and its impact on already-robust storage levels.
ETHANE: lower at 25.38 cents/gal
Ethane spot prices were lower, tracking weak natural gas futures.
AROMATICS: benzene wider at $4.12-4.23/gal
Prompt benzene spot prices were wider early in the day, sources said. The morning range was further apart compared with $4.12-4.16/gal FOB (free on board) the previous session.
OLEFINS: ethylene higher at 47.5-48.5 cents/lb, PGP wider at 62-65 cents/lb
US October ethylene bid/offer levels moved up to 47.5-48.5 cents/lb to start the week, compared with 46.5-48.0 cents/lb at the close of the previous week. US October polymer-grade propylene (PGP) bid/offer levels widened to 62.0-65.0 cents/lb from 62.5-64.0 cents/lb at the close of
|
http://www.icis.com/Articles/2013/10/28/9719579/NOON-SNAPSHOT---Americas-Markets-Summary.html
|
CC-MAIN-2015-14
|
refinedweb
| 306
| 70.5
|
I would like to hire a Programmer
Budget £10-20 GBP
Need python script to calculate digits from a data file to FFT (fast fourier transformation) values.
I have found this code for FFT which works (see below) but it seems to take values from the array given. I want the code to take values from a file and export FFT values to a different file.
from cmath import exp, pi
def fft(x):
N=len(x)
if N<=1:return x
even=fft(x[0::2])
odd=fft(x[1::2])
T=[exp(-2j*pi*k/N)*odd[k] for k in range (N//2)]
return [even[k]+T[k]for k in range(N//2)]+\
[even[k]-T[k] for k in range(N//2)]
print( ' '.join("%[url removed, login to view]" % abs(f)
for f in fft([1.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0])))
Décerné à:
Dear Client. We are a web and mobile development team in China. We can handle this task within 1 hour. We would like to discuss more detail about the requirements with you. Thanks for your reply, Crusader.
|
https://www.fr.freelancer.com/projects/php/would-like-hire-programmer-13073252/
|
CC-MAIN-2018-13
|
refinedweb
| 195
| 82.24
|
Mercurial contains the code below for Posix platforms. None of the os.W*
attributes are present in Jython.
def explain_exit(code):
"""return a 2-tuple (desc, code) describing a process's status"""
if os.WIFEXITED(code):
val = os.WEXITSTATUS(code)
return _("exited with status %d") % val, val
elif os.WIFSIGNALED(code):
val = os.WTERMSIG(code)
return _("killed by signal %d") % val, val
elif os.WIFSTOPPED(code):
val = os.WSTOPSIG(code)
return _("stopped by signal %d") % val, val
raise ValueError(_("invalid exit code"))
Frank Wierzbicki says: "I would say that (for now) acting like being on
Jython has the same disadvantages as being on Windows is the right
approach, after all, it could be on Windows, and it is inconvenient to
check for Windows from Jython." This seems sensible to me, so a "wont
fix"/"rejected" resolution would be fine if this is not reasonable for
Jython.
For future reference in case of a "wont fix"/"rejected", the workaround
that Mercurial uses on Windows is:
def explain_exit(code):
return _("exited with status %d") % code, code
|
http://bugs.jython.org/msg5058
|
CC-MAIN-2018-13
|
refinedweb
| 179
| 58.48
|
Contents
Abstract
This PEP proposes an ordered dictionary as a new data structure for the collections module, called "OrderedDict" in this PEP. The proposed API incorporates the experiences gained from working with similar implementations that exist in various real-world applications and other programming languages.
Patch
A working Py3.1 patch including tests and documentation is at:
OrderedDict patch
The check-in was in revisions: 70101 and 70102
Rationale
In current Python versions, the widely used built-in dict type does not specify an order for the key/value pairs stored. This makes it hard to use dictionaries as data storage for some specific use cases.
Some dynamic programming languages like PHP and Ruby 1.9 guarantee a certain order on iteration. In those languages, and existing Python ordered-dict implementations, the ordering of items is defined by the time of insertion of the key. New keys are appended at the end, but keys that are overwritten are not moved to the end.
The following example shows the behavior for simple assignments:
>>> d = OrderedDict() >>> d['parrot'] = 'dead' >>> d['penguin'] = 'exploded' >>> d.items() [('parrot', 'dead'), ('penguin', 'exploded')]
That the ordering is preserved makes an OrderedDict useful for a couple of situations:
XML/HTML processing libraries currently drop the ordering of attributes, use a list instead of a dict which makes filtering cumbersome, or implement their own ordered dictionary. This affects ElementTree, html5lib, Genshi and many more libraries.
There are many ordered dict implementations in various libraries and applications, most of them subtly incompatible with each other. Furthermore, subclassing dict is a non-trivial task and many implementations don't override all the methods properly which can lead to unexpected results.
Additionally, many ordered dicts are implemented in an inefficient way, making many operations more complex then they have to be.
PEP 3115 allows metaclasses to change the mapping object used for the class body. An ordered dict could be used to create ordered member declarations similar to C structs. This could be useful, for example, for future ctypes releases as well as ORMs that define database tables as classes, like the one the Django framework ships. Django currently uses an ugly hack to restore the ordering of members in database models.
The RawConfigParser class accepts a dict_type argument that allows an application to set the type of dictionary used internally. The motivation for this addition was expressly to allow users to provide an ordered dictionary. [1]
Code ported from other programming languages such as PHP often depends on an ordered dict. Having an implementation of an ordering-preserving dictionary in the standard library could ease the transition and improve the compatibility of different libraries.
Ordered Dict API
The ordered dict API would be mostly compatible with dict and existing ordered dicts. Note: this PEP refers to the 2.7 and 3.0 dictionary API as described in collections.Mapping abstract base class.
The constructor and update() both accept iterables of tuples as well as mappings like a dict does. Unlike a regular dictionary, the insertion order is preserved.
>>> d = OrderedDict([('a', 'b'), ('c', 'd')]) >>> d.update({'foo': 'bar'}) >>> d collections.OrderedDict([('a', 'b'), ('c', 'd'), ('foo', 'bar')])
If ordered dicts are updated from regular dicts, the ordering of new keys is of course undefined.
All iteration methods as well as keys(), values() and items() return the values ordered by the time the key was first inserted:
>>> d['spam'] = 'eggs' >>> d.keys() ['a', 'c', 'foo', 'spam'] >>> d.values() ['b', 'd', 'bar', 'eggs'] >>> d.items() [('a', 'b'), ('c', 'd'), ('foo', 'bar'), ('spam', 'eggs')]
New methods not available on dict:
- OrderedDict.__reversed__()
- Supports reverse iteration by key.
Questions and Answers
What happens if an existing key is reassigned?
The key is not moved but assigned a new value in place. This is consistent with existing implementations.
What happens if keys appear multiple times in the list passed to the constructor?
The same as for regular dicts -- the latter item overrides the former. This has the side-effect that the position of the first key is used because only the value is actually overwritten:>>> OrderedDict([('a', 1), ('b', 2), ('a', 3)]) collections.OrderedDict([('a', 3), ('b', 2)])
This behavior is consistent with existing implementations in Python, the PHP array and the hashmap in Ruby 1.9.
Is the ordered dict a dict subclass? Why?
Yes. Like defaultdict, an ordered dictionary `` subclasses dict. Being a dict subclass make some of the methods faster (like __getitem__ and __len__). More importantly, being a dict subclass lets ordered dictionaries be usable with tools like json that insist on having dict inputs by testing isinstance(d, dict).
Do any limitations arise from subclassing dict?
Yes. Since the API for dicts is different in Py2.x and Py3.x, the OrderedDict API must also be different. So, the Py2.7 version will need to override iterkeys, itervalues, and iteritems.
Does OrderedDict.popitem() return a particular key/value pair?
Yes. It pops-off the most recently inserted new key and its corresponding value. This corresponds to the usual LIFO behavior exhibited by traditional push/pop pairs. It is semantically equivalent to k=list(od)[-1]; v=od[k]; del od[k]; return (k,v). The actual implementation is more efficient and pops directly from a sorted list of keys.
Does OrderedDict support indexing, slicing, and whatnot?
As a matter of fact, OrderedDict does not implement the Sequence interface. Rather, it is a MutableMapping that remembers the order of key insertion. The only sequence-like addition is support for reversed.
An further advantage of not allowing indexing is that it leaves open the possibility of a fast C implementation using linked lists.
Does OrderedDict support alternate sort orders such as alphabetical?
No. Those wanting different sort orders really need to be using another technique. The OrderedDict is all about recording insertion order. If any other order is of interest, then another structure (like an in-memory dbm) is likely a better fit.
How well does OrderedDict work with the json module, PyYAML, and ConfigParser?
For json, the good news is that json's encoder respects OrderedDict's iteration order:>>> items = [('one', 1), ('two', 2), ('three',3), ('four',4), ('five',5)] >>> json.dumps(OrderedDict(items)) '{"one": 1, "two": 2, "three": 3, "four": 4, "five": 5}'
In Py2.6, the object_hook for json decoders passes-in an already built dictionary so order is lost before the object hook sees it. This problem is being fixed for Python 2.7/3.1 by adding a new hook that preserves order (see ). With the new hook, order can be preserved:>>>>> json.loads(jtext, object_pairs_hook=OrderedDict) OrderedDict({'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5})
For PyYAML, a full round-trip is problem free:>>> ytext = yaml.dump(OrderedDict(items)) >>> print ytext !!python/object/apply:collections.OrderedDict - - [one, 1] - [two, 2] - [three, 3] - [four, 4] - [five, 5] >>> yaml.load(ytext) OrderedDict({'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5})
For the ConfigParser module, round-tripping is also problem free. Custom dicts were added in Py2.6 specifically to support ordered dictionaries:>>> config = ConfigParser(dict_type=OrderedDict) >>> config.read('myconfig.ini') >>> config.remove_option('Log', 'error') >>> config.write(open('myconfig.ini', 'w'))
How does OrderedDict handle equality testing?
Comparing two ordered dictionaries implies that the test will be order-sensitive so that list (od1.items())==list(od2.items()).
When ordered dicts are compared with other Mappings, their order insensitive comparison is used. This allows ordered dictionaries to be substituted anywhere regular dictionaries are used.
How __repr__ format will maintain order during an repr/eval round-trip?
OrderedDict([('a', 1), ('b', 2)])
What are the trade-offs of the possible underlying data structures?
- Keeping a sorted list of keys is fast for all operations except __delitem__() which becomes an O(n) exercise. This data structure leads to very simple code and little wasted space.
- Keeping a separate dictionary to record insertion sequence numbers makes the code a little bit more complex. All of the basic operations are O(1) but the constant factor is increased for __setitem__() and __delitem__() meaning that every use case will have to pay for this speedup (since all buildup go through __setitem__). Also, the first traveral incurs a one-time O(n log n) sorting cost. The storage costs are double that for the sorted-list-of-keys approach.
- A version written in C could use a linked list. The code would be more complex than the other two approaches but it would conserve space and would keep the same big-oh performance as regular dictionaries. It is the fastest and most space efficient.
Reference Implementation
An implementation with tests and documentation is at:
OrderedDict patch
The proposed version has several merits:
- Strict compliance with the MutableMapping API and no new methods so that the learning curve is near zero. It is simply a dictionary that remembers insertion order.
- Generally good performance. The big-oh times are the same as regular dictionaries except that key deletion is O(n).
Other implementations of ordered dicts in various Python projects or standalone libraries, that inspired the API proposed here, are:
- odict in Python [2]
- odict in Babel [3]
- OrderedDict in Django [4]
- The odict module [5]
- ordereddict [6] (a C implementation of the odict module)
- StableDict [7]
- Armin Rigo's OrderedDict [8]
Future Directions
With the availability of an ordered dict in the standard library, other libraries may take advantage of that. For example, ElementTree could return odicts in the future that retain the attribute ordering of the source file.
|
http://www.python.org/dev/peps/pep-0372/
|
crawl-003
|
refinedweb
| 1,584
| 57.06
|
I'm in the process of trying to port NSS to run on FreeBSD (3.5), and it's
very quickly becoming obvious that the current build system is going to
be a portability nightmare. I'm having to go through and add #ifdef(FREEBSD)
in far far far too many places.
It's also pretty clear that mozilla/security/coreconf is descended from
the same source that gave us mozilla/nsprpub/config, but hasn't been touched
for anything but the core platforms.
Things would be a immeasurably easier if NSS were using feature tests rather
than platform tests, and if these feature tests were generated automatically
rather than having to be set by hand in coreconf/*.mk.
Assigned the bug to Bob.
Please refrain from starting a religious debate in this
bug report. That should be done in the mozilla.crypto
newsgroup.
My proposal is a hybrid solution.
1. Convert all the Makefile's in NSS to Makefile.in's.
2. Add a configure shell or Perl script for NSS that
does the following.
- Translate the configure options (e.g., --enable-optimize)
to coreconf's make variables (e.g., BUILD_OPT=1).
- Generate Makefile's from Makefile.in's in either the
source tree or an object build tree (created by the
configure script).
- The generated Makefile's still use coreconf.
This proposal solves two problems.
1. It presents a familiar configure interface for
specifying build options.
2. It allows building NSS from a read-only source tree.
It does not solve the following problems.
1. It may not allow you to specify an arbitrary compiler
by saying
CC=cc ./configure
Each compiler (e.g., native compiler or gcc) must
be specified by a configure option. For example,
./configure --with-gcc
2. Each platform still requires a <platform>.mk in
coreconf.
I think the majority of the people who build NSS from
source can live with and won't even notice these two
problems.
Unfortunately, this proposal doesn't seem to address the original reporter's
concerns of using feature tests instead of hardcoding the values per platform.
It will alieviate some of the build issues we've had though.
So I have a question. Is the problem that NSS does not have feature tests or
that NSS does not use autoconf. These are two very different and separable problems.
The first problem should be a big which enumerates where NSS incorrectly uses
platforms rather than feature tests. These places do exist but reside mostly in
the following areas: depricated commands, pkcs #11, and FORTEZZA. Of these only
pkcs #11 should be an issue.
The second problem is providing an autoconf front end so the existing scripts.
because 1) the current title implies this problem, and 2) the bug does not
contain the specific areas to fix feature based verse platform based issues,
I'll treat the bug as if it was for this second problem. Fixes for specific
ifdef problems should be filed under a specific bug.
Discussions on this should be initiated in the mozilla.crypto newsgroup.
bob
I'm going to skip this round of "post issue to ng, have just a handful of people
post an opinion _once_ to the thread and then watch the issue be stalled out for
9 more weeks" and skip straight to the chase. We need to figure out what we are
going to do about nss/psm and whatever other modules that mozilla depends upon
*now*.
In answer to your question, Bob: The original bug report was on the fact that
NSS does not use feature tests but makes assumptions about based upon the
platform. A separate issue (and more essential to the big picture) is the fact
that NSS as it builds today cannot be integrated into the mozilla build system
without breaking several of our supported build configurations. As I pointed
out in bug 60912, the key building issues are:
* building in parallel (-j)
* multiple objtree builds
* cross-compiling
The easiest (most common?) way for most people to solve the 2 issues
(feature-tests & extended build features) is to use autoconf. It handles
building outside of the source tree natively and without having to worry about
generating .OBJ subdirs on the fly, we fix the parallel build problem as well.
As with bug 60912, if you can figure out how to accomplish this without using
autoconf, more power to you. I don't have time to search for that alternative
so I'll stick with what I know.
This simple build issue sparks so many Mozilla policy discussions that it's near
sickening. And probably off-topic, so I'll skip it.
This bug is 6 months old. How much more time are we going to waste discussing
the simple matter of whether or not to autoconf the build when we could have
implemented it and had it working in production by now? If the NSS team does
not want to provide a usable (to someone other than NSS) build system, then why
can we (read Mozilla developers) create our own copy of one of their releases
(3.2?) and modify it to our needs? Although I still disagree with creating such
forks in principle, we've done it in the past with several libraries developed
by an external group (jpeg, zlib, png, mng). And if the Mozilla team decides
not to fork for whatever reason, how do we resolve this? Make it an external
dependency for all platforms? Last I (mis)remembered, no feature is enabled on
a platform by default unless it is enabled on all platforms. And is NSS in a
state where it can be installed on a platform as a system lib (win32, linux &
mac) or does 'make install' just populate dist/?
I think the best way to handle this is by creating an NSS_CLIENT_BRANCH, so we
can make modifications to the files we need to support building in the client
build configurations.
Chris,
Please post your discussion to netscape.public.mozilla.crypto as Wan-Teh
suggested. I can respond there. As it stands I'm treating this bug as a request
to implement Wan-Teh's proposal. "Fully autoconf'ing" NSS has *NOT* been
accepted by the team because the preconditions we layed out for that has not
been met. We can discuss this in the news group.
bob
Bob, when did you ever lay out these preconditions for moving to autoconf? Or
are you referring to wtc's proposal? If this bug is going to be about wtc's
proposal as opposed to the orignal bug report, then we're going to be switching
things over to use the autoconf framework anyways so let's get to it.
Leaf or bryner, create the NSS_CLIENT_BRANCH and let's get going. I'm guessing
that we'll want it branched from the 3.2 branch rather than the tip.
Wan-Teh laid these preconditions out long ago.
The Mozilla browser is not the only product that uses NSS.
It is one of many.
The NSS group's products have many customers, some paying, some not.
We absolutely must meet the needs of our paying customers first.
The iPlanet servers are paying customers. They have their own build
group with their own standards for build systems.
So, having a build system that meets their needs is an absolute
precondition. It is not acceptable to replace the existing
build system with one that warms the hearts of lots of open source
people, but doesn't meet the needs of our paying customers.
If you branch the tree, I believe there will be little or no new
crypto development in that branch. You'll have makefiles to your
liking however.
Finally, I'll opine that NSS needs many things done to it, mostly
difficult things that have to do with cryptography and certificates.
Since we _are_ able to build working code for mozilla at the present
time, I believe the need for a new build system is minor compared
to the other needs.
nelsonb:
Saying that the build system must meet the needs of your paying customers is
pretty vague, especially when you give us no idea of what is required for that
to happen. Surely the existing build system is not the only possible build
system that meets these needs.
If we were to branch the tree, we would land stable NSS releases on the branch
as they happen. This is the strategy currently being used for our NSPR branch.
Yes, NSS needs crypto work done on it. Very few people working on Mozilla know
the intricacies of this as well as the NSS team does. However, there *are*
people outside the NSS team who are ready and willing to put in the time to
implement a new build system. The NSS team is denying them the opportunity to
contribute this on the NSS tip. We (Mozilla developers) have been laying out
for months now the shortcomings of the existing build system, but no one seems
to be listening.
If NSS wasn't hosted on cvs.mozilla.org we wouldn't have hesitated at all to
check it into our tree and convert it to the Mozilla build system (see libjpeg,
libpng, zlib, and others).
By branching the tree we would actually be taking the responsibility for a
large number of client build integration issues off the hands of the NSS team,
which would let you (as you said) focus on improving crypto functionality and
delivering builds for your paying customers. And if the NSS team ever wanted
to land the branch back onto the tip, that would always be an option.
So here's my concern:
You branch the tree and but in *mozilla* autoconf (which is presumably what we
are really talking about when we say we want to 'autoconf' nss).
Because mozilla autoconf is not yet mature in handling components, the NSS team
have the bandwidth to support the autoconf build system, and continue on it's
development with it's existing system. Official NSS releases, and instructions
to build NSS will still be coreconf and mozilla will always be working with an
old, and unsupported version of NSS.
I'm not against using autoconf. My problem is we can't even get autoconf to
correctly and reliably build NSPR and DBM on all of our platforms as components.
Sure, you can pull all of mozilla and get them to work, but if you want to build
just a single component, autoconf just isn't there yet. Right now it's actually
easier for us to walk through each of Chris's requirements and back fill them
into coreconf than it would be for us to try to maintain a mozilla autoconf system.
I don't think this state of affairs will continue forever, as binary components
will become more and more important to the mozilla autoconf and a lot of the
unnecessary baggage and complications it adds to people just trying to build a
component will get ironned out, but it's just not there yet, and it doesn't yet
seem to be a priority. Currently I can build on all my platforms (Unix, Windows,
Open/VMS, and OS/2, with just the most basic tools (native compilers and the
small set of nstools) using all the same makefiles. The current build
instructions (including machine setup) for NSS is half a page long. Trying to
build DBM for NSS is several pages with dozens on unecessary environment
variables, and dozens of exceptions for platforms like AIX and HP.
When we can build DBM and NSPR as binary components with autoconf on all
platforms as smoothly as we can build them with coreconf, then we can start
looking at converting NSS.
So what do we do in the meantime?
First if Chris' concerns are real concerns, and not just excuses to move to
autoconf, Chris needs to right bugs that say 'NSS does not support XXXXXXX' so
we can prioritize these features appropriately. Given the current state of
affairs, the NSS team would most likely support these features by modifying
coreconf.
If these features are just a red herring and religion dictates that mozilla must
have it's monolithic autoconf system, then perhaps a setup similar to what NSS
did to fix our problems with DBM. We created our own DBM directory, which
contains our own makefiles. These makefiles link the real mozilla dbm code, but
uses it's own makefiles to build dbm. It took Nelson one day to get this
working. This code could live on the tip, and get tagged when appropriate
branches are made. There is still the problem of keeping the parallel build
system in sync, but it sounds like the mozilla community is willing to carry
this burden.
bob
By "autoconf'ing NSS", we mean convert the NSS build system over to use
autoconf. Full stop. Additional dependencies upon the mozilla build system is
neither required nor desired. NSS would continue to be a standalone package
like NSPR.
Your problems with building dbm are not problems with autoconf. They are
organizational problems with Mozilla's build system. Pull the pristine sources
from sleepycat.com and see how they use autoconf to build it for many platforms
without a hitch. Having several pages of instructions to do:
./configure --enable-modules=dbm; make
seems to indicate a severe lack of understanding about the build system.
As I said, if you can resolve the build issues I've pointed out *and* the
original reporter's problem without switching to autoconf, go for it. My
impression is that fixing these problems is not a priority for the NSS team but
they are quickly becoming so for the Mozilla team as we get daily requests to
pull & build nss/psm by default. If we have to solve this problem, then we'll
do it as we know how. If the NSS team wants to solve it as they know how, then
they need to step up and do it.
The statement about using an "unsupported" release of NSS confuses me and brings
up another issue. Are you saying that you will *only* support the _latest_
release of NSS? If that's true (which I really don't believe it is), then what
makes Mozilla any different than any other client that you have using NSS? Are
they forced to upgrade whenever a new release comes out or are they free to
upgrade at their leisure?
Weren't the original reporters problems solved long ago?
Doesn't NSS build on freeBSD now?
The NSS team doesn't support branches other than those we create. This
is a policy of long standing. If other groups create branches, they
have the full burden of support for those branches. If the mozilla team
makes its own branch, and there are problems with the code on that
branch, problems that are not also seen on the supported branches, we
don't have time to deal with those problems. I think that's what Bob
was mentioning about "unsupported versions of NSS".
We don't have the cycles to support two build systems in parallel,
nor to support one whose requirements are constantly changing.
Any build system that we use (and are expected to maintain) must
understand all the build targets and environment variables that are now
understood and supported by coreconf. The ability to build packaged jar
files, for example, must be supported. The ability to use iPlanet's
conventions for object directory names must be supported.
We cannot impose new work on the iPlanet build team, or on our paying
customers, to convert to a new build system. Any replacement build
system must be a "drop in" replacement, as far as the iPlanet build
people are concerned, and the outputs of those builds must not require
changes by the server groups that use them.
The performance sensitive code (mostly in nss/lib/freebl and
subdirectories thereof) must continue to perform as well or better than
it does now. It isn't enough to produce code that merely successfully
compiles on all platforms. It must run optimally, too.
mozilla may not be very performance sensitive, but our paying customers
all are, without exception. Our paying customers won't stand for poorer
performance brought about by new build systems and/or conversion from
system-based #ifs to feature-based #ifs.
Some platforms (e.g. Solaris, HPUX, and possibly AIX) support 32-bit
CPUs, 64-bit CPUs running 32-bit ABI (32-bit pointers and libs), and
64-bit CPUs running 64-bit ABI (64-bit pointers and libs). NSS must
continue to produce optimal code for all those combinations. Today, NSS
allows a single application running with 32-bit code to get optimal
performance on both 32-bit CPUs and 64-bit CPUs. It must continue to do
so.
Anyone who wants to tackle converting NSS MUST seriously evaluate the
work to be done on freebl. Any proposals to convert NSS that don't
include details of how to convert freebl are incomplete.
This is not an exhaustive list of the requirements for the NSS build
system, but it's a good start, I think. And I believe all the
things above are motivated by _business_ requirements, not mere
personal preferences of style.
IMO, if someone were to produce a new build system that is a drop in
replacement for coreconf, meeting all the requirements of our iPlanet
customers, and also mozilla, that would allow all existing build scripts
to continue to work, I think such a proposal would not be rejected out
of hand. But so far, I've seen no proposals that addressed any of the
requirements of anything but mozilla itself, and proposals that ignore
the needs of our supporting customers probably won't receive more
serious consideration than they have in the past, IMO.
In trying to get PSM1 or PSM2 to compile on IRIX6.5 (when using a separate
object tree) NSS uses IRIX6_mips_DBG.OBJ and IRIX6.5_DBG.OBJ inconsistently;
resulting in build problems. It also trys to link n32 and o32 objects
together. While this is probably a different bug, NSS using autoconf would
sure help. While it does not block 68591, it makes the build process very
tedious to automate.
John
It's not NSS being inconsistant. It's very component having it's own idea about
what OBJDIR needs to be and which compilier flags to use. These choices are made
based on different criteria (Servers want to use compilers and ABI's supported
by the vendors and run on the latest version of the OS. Mozilla prefers
compilers freely available (gcc) and ABI's that run on the oldest reasonable
platform). Going to Autoconf won't help that. NSS still has to supply both types
of binaries.
BTW most of the inconsistancies go away with the latest NSS build scheme
(independent of autoconf).
Your comment on different criteria for servers vs mozilla is not accurate in
this case, as NSS was building O32 (which is extremely old) whereas
mozilla/autoconf choose N32(SGIs prefered ABI to distribute). I think it would
be accurate for most unix vendors that mozilla requires more optimisation than
a 'server', because it is quite large, and hence needs to be optimised more
than most 'applications', added to the fact that there could be 100 copies of
mozilla running on a server, whereas few systems would run 100 copies of any
server.
Using the instructions posted to n.p.m.crypto for building PSM2.0 Milestone 1.5
against the latest trunk, I was able to get PSM2 to build after creating
symbolic links from dist/IRIX6_mips_DBG.OBJ to dist/IRIX6.5_DBG.OBJ.
IRIX6_mips_DBG.OBJ is created in the build process, however both are utilised,
even in the same compilation commands.
---
cd crmf; gmake libs
gmake[3]: Entering directory
`/projects/sise/mozilla/devel/workpits/moz/latest_debug/workarea/security/nss/li
b/crmf'
cc -o IRIX6.5_DBG.OBJ/crmfenc.o -c -g -dollar -fullwarn -xansi -n32 -mips3 -
exceptions -DSVR4 -DIRIX -multigot -D_SGI_MP_SOURCE -MDupdate
IRIX6.5_DBG.OBJ/.md -DIRIX6_5 -mips3 -DXP_UNIX -DDEBUG -UNDEBUG -DDEBUG_johnv -
I../../../../dist/IRIX6.5_DBG.OBJ/include -
I/projects/sise/mozilla/devel/workpits/moz/latest_debug/workarea/dist/IRIX6_mips
_DBG.OBJ/public/security -
I/projects/sise/mozilla/devel/workpits/moz/latest_debug/workarea/dist/IRIX6_mips
_DBG.OBJ/private/security -
I/projects/sise/mozilla/devel/workpits/moz/latest_debug/workarea/dist/IRIX6_mips
_DBG.OBJ/public/dbm crmfenc.c
cc WARNING: -I../../../../dist/IRIX6.5_DBG.OBJ/include does not refer to a
valid directory
cc WARNING: -
I/projects/sise/mozilla/devel/workpits/moz/latest_debug/workarea/dist/IRIX6_mips
_DBG.OBJ/public/dbm does not refer to a valid directory
cc-1005 cc: ERROR File
= /projects/sise/mozilla/devel/workpits/moz/latest_debug/workarea/dist/IRIX6_mip
s_DBG.OBJ/public/security/seccomon.h, Line = 47
The source file "prtypes.h" is unavailable.
#include "prtypes.h"
^
1 catastrophic error detected in the compilation of "crmfenc.c".
Compilation terminated.
---
I had the exact same problem with PSM1 on 0.8. How is it that "It's not NSS
being inconsistant. ". Within NSS it is obviously having problems working out
what "... it's own idea about what OBJDIR needs to be ..." .
Why cant we have two build systems? Netscape retain coreconf & co for servers
that require it, and mozilla start the process of creating an autoconf build.
Should it not have all that netscape requires, they dont need to use it.
Should it become developed enough to produce optimal binaries on all platforms,
Netscape could re-assess their use of coreconf & co.
In building NSS, the PSM makefiles alter some of NSS's makefile variables so
that NSS can be built in the Mozilla environment. It appears to me that IRIX
breaks that layer. The above error doesn't show an inconsistency in the NSS
build, but an inconsistency in the named OBJ directories between mozilla and
NSS.
What needs to be looked at here is the PSM makefile which has never been tested
on IRIX, not the NSS build mechanism.
I think you're right, Javi. There are two more environment variables
that are relevant to builds of NSS on IRIX. They are:
USE_N32 - set to 1 if you want the build to generate n32 binaries.
default is to generate o32 binaries.
This is mutually exclusive with USE_64 (which is documented).
USE_PTHREADS - set to 1 if you want to use IRIX's pthreads implementation
for threads. As I recall, the default is to use IRIX's sprocs
for threads.
I just sucesfully built NSS 3.2 on an IRIX 6.5.5 machine with the above two
variables set, using the instructions Sean posted.
I have built and tested PSM2 M1.5/NSS 3.2; the build dump was to show why I
assumed NSS was breaking due to differently named OBJDIRs. As suggested this
could be a PSM problem, but the best fix for this problem would be to enable
NSS to compile its object in a separate tree (without copying source/make
files).
I've made my decision: NSS will continue to use its current
build system.
Many Mozilla developers have requested that the NSS build
system be converted to use autoconf. In fact, some have
already started doing that on the unofficial, experimental
NSS_AUTOCONF_BRANCH.
In a meeting in February with mozilla.org, I agreed to have
the NSPR build system (which is similar to the NSS build
system) converted to use autoconf (the "NSPR experiment")
and then decide whether the same should be done for NSS.
Below is a summary of my findings and decisions.
1. Cost.
The NSPR experiment gave us a realistic estimate of
how much work will be required to convert NSS to
use autoconf. Our requirement is that the NSS
autoconf build system be 100% equivalent to the
current NSS coreconf build system on the platforms
that the NSS team supports. Assuming that the new
autoconf build system will be implemented by volunteers
and the NSS team is only responsible for the verification
(including making the necessary fixes), I estimate that
it requires six working days of one person to do the
first round of verification, and five man-days to do
the second round of verification. Note that the first
verification pass is best done by the same person; the
second round can be parallelized.
Then, additional time is needed to modify our binary
release and nightly build scripts to work with the new
build procedure and build tree structure. Unfortunately
the NSPR experiment did not offer any insight into how
much time is required to complete this work. This could
just require minor tweaking as is the case with NSPR. A
rough estimate would be four days.
We would also need to convert JSS to use autoconf as it
shares the "coreconf" build configuration system with
NSS. Since the volunteers are only interested in building
the Mozilla client, which does not use JSS, the NSS team
would need to both implement the autoconf build system for
JSS and verify its equivalence to the current build system.
2. Benefits.
This change will affect three kinds of people who need
to build NSS.
For the NSS team, the current build system works just
fine. There is little benefit to be derived from
ditching a working system and rewriting it in another
language.
For developers new to NSS who need to use NSS in their
products, it is necessary to read the build instructions
to learn how to specify the build options in the current
NSS build system. But it is not rocket science.
Moreover, our experience has been that most NSS users
would happily use our binary distributions once they
learned that the binary distributions exist.
For people building the Mozilla client, the NSS build
system has been a continual source of pain due to the
lack of support of certain Mozilla build features. Some
of the complaints are a matter of taste, but there are
more substantive issues (e.g., the ability to build from
a read-only source tree and support for cross-compilation).
Our team has taken steps to address them. We have a
solution ready that should meet the needs of the majority
of the people building the Mozilla client (see the patches
attached to bug #83225 and bug #82324).
With the cost-benefit analysis above, I have decided that
NSS should continue to use its current build system. We
will meet the requirements of the majority of the NSS users
and people building Mozilla client by providing better NSS
binary distributions and better integration with the Mozilla
client build system. To those who have requirement that
are not met, I ask for your understanding and your cooperation
in the best interests of the Mozilla and NSS projects. We
did not ignore your requests. They have all been carefully
considered and rejected because there is not a big demand
for them or easy workarounds are present
If you could host & link to a forum/wiki with subsections for
the different build targets & cross compilation, that would
help the open source community help itself. Better internal
documentation of the NSS build would also be nice.
Building NSS on a Linux native compiler was a breeze, but
cross-compiling for Win32 on Linux using mingw was such
a pain, I ultimately gave up and used a pre-build Win32
binary (and did the necessary dance with nm, sed, and dlltool
to create the proper .dll.a import library in order to link
with all the other mingw-compiled stuff).
The pre-built msvc NSS binary isn't a very good substitute
for being able to build from source, because it limits my
ability to follow things in a debugger. While it's true
that some libraries are more difficult to cross-compile than
others (e.g.: zlib is also kind of cantankerous), I was able
to get everything to work _except_ for NSS.
If there were an official wiki/forum on mozilla.org for the 3rd tier,
someone more familiar with NSS than I am would probably have posted
an answer & patches by now. :) Would you consider hosting such a wiki?
Cheers,
-Jon
(In reply to comment #19)
> I've made my decision: NSS will continue to use its current
> build system.
So, 10 years later...one thing that isn't obvious to me from this discussion is what issues would be involved in simply having "one and a half" build systems. More precisely, add a plain autoconf configure script, and a Makefile that supports the automake conventions (even if not actually being automake).
In that vein, I wanted to link to the current nss patch we're using in GNOME:
The impact as you can see on the nss tree is small - it's not a large patch. The biggest cost is having to reimplement the "install" logic so we get support for "make install DESTDIR=", which is crucial for us.
|
https://bugzilla.mozilla.org/show_bug.cgi?id=52990
|
CC-MAIN-2016-36
|
refinedweb
| 4,829
| 62.98
|
The QAssistantClient class provides a means of using Qt Assistant as an application's help tool. More...
#include <qassistantclient.h>
Inherits QObject.
List of all member functions..
The assistant client object is a child of parent and is called name.
This signal is emitted when the connection to Qt Assistant is closed. This happens when the user exits Qt Assistant, or when an error in the server or client occurs, or if closeAssistant() is called.
This signal is emitted when Qt Assistant is open and the client-server communication is set up.
See also assistantClosed().
This signal is emitted if Qt Assistant cannot be started or if an error occurs during the initialization of the connection between Qt Assistant and the calling application. The msg provides an explanation of the error.
Returns TRUE if Qt Assistant is open; otherwise returns FALSE. See the "open" property for details.
See also assistantOpened()..
This property holds whether Qt Assistant is open.
Get this property's value with isOpen().
This file is part of the Qt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.
|
http://idlebox.net/2007/apidocs/qt-x11-free-3.3.8.zip/qassistantclient.html
|
CC-MAIN-2014-10
|
refinedweb
| 180
| 61.63
|
.. docpictures:: some_type
highly readable description
and have the docpicture module parse the "highly readable description" based on the syntax defined in some_type. Note that I chose this notation to be compatible with reStructuredText directives. The "highly readable description" will depend on the context. For example, the mathematically inclined will be able to read this:
.. docpictures:: equation
e^{i\pi} = -1
while the following might be easy to understand by programmers:
In this last example using the syntax of this site which generates the following picture:In this last example using the syntax of this site which generates the following picture:
..docpicture:: uml_sequence
User --> Browser: clicks on a link
Browser -> Crunchy: requests file
Crunchy --> Browser: Authentication Request
Browser --> Crunchy: Authentication Response
note over Crunchy: Retrieves and processes file
Crunchy -> Browser: Sends processed file
Browser --> User: Displays file
(Btw, the picture above is generated automatically each time this page is loaded - so it depends on the availability of the server. I have used a static version of this picture in the documentation for Crunchy.)
Using svg to do graphics is fairly easy. Using svg as embedded objects in an html document requires a bit of searching on the internet. Creating such documents and displaying dynamically requires even more searching (or perhaps more careful reading...). The thing important to remember is to serve the document as "application/xhtml+xml" instead of the usual "text/html". I thought it would be useful to share an almost minimal working example (tested only on Firefox) and perhaps save some time for others that would like to do the same. Feel free to adapt it as you like.
svg_test = """<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"">
<html xmlns=""
xmlns:
<head></head>
<body>
<h1>SVG embedded inline in XHTML</h1>
<svg:svg
<svg:circle
</svg:svg>
</body>
</html>
"""
And, if you know how to suppress the output of the webserver, feel free to leave a comment.
6 comments:
About the last sentence of my post, after re-reading the documentation carefully, I found out that all that is needed is to define something like
def log_message(self, *args):
''' will suppress the usual output'''
return
as a method of the request handler.
I had been working on something to do the equations in rst, but it required some nasty hacks backing off to LaTeX to do the real work. I never really liked it. SVG does seem like the better way to go.
It might be good to support a subset of the dot language but maybe making things simpler on the auto-layout side?
()
- Paddy.
@paddy: Good idea. Ideally, one would do a Python port of WebDot.
For embedding in html (and other things) it would also be good to consider this pidgeon-dot (based on python-like indentation)
@jon schull:
This does look like a very neat approach, and complements an earlier suggestion. The only downside is the external dependency on GraphViz. I'm trying (at least for now) to design things based on Python-only modules - preferably with no dependency outside of the standard library.
|
http://aroberge.blogspot.com/2008/10/more-on-docpictures-and-almost-minimal.html
|
CC-MAIN-2014-42
|
refinedweb
| 519
| 59.94
|
This article demonstrates how to work with collections in XAML.
Introduction
XAML provides UI element objects that can host child collection items. XAML also provides support to work with .NET collection types as data sources.
XAML Collections
A collection element usually is a parent control with child collection elements. The child collection elements are an ItemCollection that implements IList<object>. A ListBox element is a collection of ListBoxItem elements.
The code listing in Listing 1 creates a ListBox with a few ListBoxItems.
Listing 1
The code listed above in Listing 1 generates Figure 1.
Figure 1
Add Collection Items
In the previous section, we saw how to add items to a ListBox at design-time from XAML. We can add items to a ListBox from the code.
Let's change our UI and add a TextBox and a button control to the page. See Listing 2.
Listing 2
The final UI looks like Figure 2.
Figure 2.
We can access collection items using the Items property. On the button click event handler, we add the content of the TextBox to the ListBox by calling the ListBox.Items.Add method. The code in Listing 3 adds the TextBox content to the ListBox items.
Listing 3
Now if you enter text into the TextBox and click the Add Item button, it will add the contents of the TextBox to the ListBox. See Figure 3.
Figure 3
Delete Collection Items
We can use the as in the following.
Listing 4
The button click event handler looks like the following. On this button click, we find the index of the selected item and call the ListBox.Items.RemoveAt method as in the following.
Listing 5
Collection Types
XAML allows developers to access .NET class library collection types from the scripting language. The code snippet in the Listing creates an array of String types, a collection of strings. To use the Array and String types, we must import the System namespace.
The code listing in Listing 6 creates an Array of String objects in XAML. As you may noticed in Listing 2, you must import the System namespace in XAML using the xmlns.
Listing 6
The ItemsSource property if ListBox in XAML is used to bind the ArrayList. See Listing 7.
Listing 7
Summary
XAML supports collections including collection items and working with .NET collection types. In this article, we saw how to create a control with collection items and how to access its items dynamically. Later, we saw how to create a .NET collection type in XAML and bind it within the XAML.
Recommended Readings
Check out these articles if you want to learn more about XAML and Collections.
View All
|
https://www.c-sharpcorner.com/uploadfile/mahesh/working-with-collections-in-xaml/
|
CC-MAIN-2019-47
|
refinedweb
| 447
| 67.86
|
By default, all the C# Value types are non-nullable, and Reference types called C# nullable types. The default value for Value types is some form of 0. We already discussed the data types categories, i.e., Value types and Reference types in our previous article.
For example, the default value of any C# integer type variable is 0, and they cannot hold null values.
using System; class Class1 { string str = null; // Valid statement int i = null; //Not Valid }
int i= null is Not valid because the integer is one of the Value types, and all Value types are non-nullable.
Note: Value types can be made nullable using ?
The syntax of the C# Nullable Types
int? i = null; // valid statement
C# introduced this concept of Nullable types to solve the issues in the database while storing some particular data. For instance,
bool AreYouMajor = null; // invalid statement
Bool is a data type that can accept either true or false. But here is a case where null value should be stored in the database if the user did not answer the question
Are You Major:
In that case, there will be confusion about what data should store in the database. If we store false, i.e., ‘No’, we can not differentiate whether they use answered ‘no’ or didn’t answer. To avoid that confusion, the C# bool variable ‘AreYouMajor’ make as nullable.
i.e., bool? AreYouMajor = null; // valid statement
using System; class Class { static void Main() { bool? AreYouMajor = null; if (AreYouMajor == true) { Console.WriteLine("User is major"); } else if (AreYouMajor == false) { Console.WriteLine("User is not a major"); } else { Console.WriteLine("User did not answered the question"); } } }
OUTPUT
|
https://www.tutorialgateway.org/csharp-nullable-types/
|
CC-MAIN-2021-43
|
refinedweb
| 277
| 74.29
|
I am using Jersey and have exposed a resource
Resource which implements an
Interface. One of the methods from
Interface has a parameter
a of type
A which is an abstract class.
Here is some code for explanation:
//Interface.java public interface Interface { public void setA(A a); } //Resource.java @Path("/hello") public class Resource implements Interface { @POST public void setA(A a){ //Here I want to specify AImpl instead of A //Code that uses AImpl } } //A.java public abstract class A{ //Some abstract stuff } //AImpl.java public class AImpl extends A{ //Some concrete stuff }
This leads to an error:
JsonMappingException: Can not construct instance of A, problem: abstract types can only be instantiated with additional type information
How can this be avoided/ overcome?
One solution would be to make Jersey/Jackson aware that it can use the concrete implementation of
A (which is
AImpl) in method
setA() of
Resource. Is there any annotation that I can use to do that?
|
http://www.howtobuildsoftware.com/index.php/how-do/gjy/java-jersey-jackson-jax-rs-how-to-specify-concrete-type-for-abstract-method-param-in-jersey-jackson
|
CC-MAIN-2017-47
|
refinedweb
| 161
| 54.22
|
The RotatingFileHandler and TimedRotatingFileHandler classes provide basic log file rotation functionality, but there are times when more functionality is required than is provided in these classes. One requirement is to compress log files when they are rotated. Currently, if you want this kind of functionality, you have to subclass the relevant handler and override the doRollover method. This works, but requires you to copy and paste the entire method, and then adapt it to your needs; clearly, this is not ideal. An example of this can be found in this ActiveState recipe for a TimedCompressedRotatingFileHandler. This uses the .zip format to compress log files.
In order to provide improved flexibility for log file processing (which will generally be compression, but in practice any transformation could be performed), I propose to add two new methods to these handlers (in their common base class, BaseRotatingHandler).
The first method is named rotate. It takes two arguments, source and dest. The source argument is the name of the log file about to be rotated (e.g. test.log), and the dest argument names the target of the rotation (e.g test.log.1). Under normal circumstances, the file named by dest should not exist, having been explicitly removed by the rollover logic. the default behaviour is what happens currently – a call to os.rename(source, dest).
Since we are potentially transforming log files, we might also want to change their extension, so that they are more usable with e.g. file system viewers like Nautilus or Windows Explorer. To facilitate this, a second method is provided, called filename. This takes a single argument – the filename of a destination file in a rotation (for example, test.log.1) – and returns a modified version (for example, adding an extension – test.log.1.gz). The default behaviour is to return the name unchanged.
The definition of the new methods is as follows.
def filename(self, name): """ Modify the filename of a log file when rotating. This is provided so that a custom filename can be provided, say by adding an extension. The default implementation returns the name unchanged. :param name: The default name for the destination log file. """ def rotate(self, source, dest): """ When rotating, rotate the current log in the file named by source to the file named by dest. On entry, the file named by source should exist and the file named by dest should not exist. On exit, the file named by source should not exist and the file named by dest should exist. The default implementation simply renames source to dest. :param source: The source filename. This is normally the base filename, e.g. 'test.log' :param dest: The destination filename. This is normally what the source is rotated to, e.g. 'test.log.1'. """
This will allow a custom rotation strategy to be implemented relatively easily: for example, if you want to gzip rotated log files, you can ensure that filename returns test.log.1.gz when passed test.log.1, and that rotate gzips test.log to test.log.1.gz.
The ActiveState example I cited earlier used the .zip format, but what if you want to use .gz, .bz2, .7z or some other compression algorithm? You would need to support all of them in a single handler, or write multiple handler classes for each format.
To avoid the need for users to subclass the rotating handlers, I further propose to allow configurability of the rotate and filename methods by providing two new handler attributes (both, by default, set to None in BaseRotatingHandler).
The first handler attribute is named rotator. You can set it to a callable that takes two arguments, source and dest. The meanings of these arguments are the same as for the rotate method. If a callable is provided in the rotator attribute, it is called by the rotate method to perform the rotation.
The second handler attribute is called namer. You can set this to a callable which takes a single argument – the filename of a destination file in a rotation (for example, test.log.1) – and modifies it to, for example, add an extension. If a callable is set, then it is called by the filename method to return the new name.
I’m aware that these are not “true” .gz files, as they are bare compressed data, with no “container” such as you’d find in an actual gzip file. This snippet is just for illustration purposes.
Note: The namer function is called quite a few times during rollover, so it should be as simple and as fast as possible. It should also return the same output every time for a given input, otherwise the rollover behaviour may not work as expected. If either the namer or rotator function raises an exception, this will be handled in the same way as any other exception during an emit() call, i.e. via the handleError method of the handler.
The internal logic for determining which files to delete (when a backupCount is specified on a rotating file handler) uses, in the case of TimedRotatingFileHandler, regular expressions for the date/time-based suffix. The regular expressions used have been updated to allow an optional file extension consisting of a period followed by one or more letters and digits.
These changes will soon appear in Python 3.3’s development repository. Your comments are welcome.
|
http://plumberjack.blogspot.my/2011/
|
CC-MAIN-2018-13
|
refinedweb
| 896
| 65.93
|
).
Using the Source property is simpler and more readable. However, if multiple properties bind to the same source, consider using the DataContext property. The DataContext property provides a convenient way to establish a data scope. Say you have many controls and you want all of them to bind to the same source.
I've made a WPF demo that uses the Newton Game Dynamics physics engine to roll some things down the screen, all using databinding. You might want to check it out: :)
Wow, that's a really cool demo, Chris! Somehow I really enjoy seeing the car rolling off the screen. :)"
xmlns=""
xmlns:x=""
xmlns:local="clr-namespace:ThemeResource" (Change this value to match the namespace in your project}
|
http://blogs.msdn.com/wpfsdk/archive/2006/10/19/wpf-basic-data-binding-faq.aspx
|
crawl-002
|
refinedweb
| 120
| 65.62
|
Question:
Here's my code:
34 35 /** 36 ** \file position.hh 37 ** Define the example::position class. 38 */ 39 40 #ifndef BISON_POSITION_HH 41 #define BISON_POSITION_HH 42 43 #include <iostream> 44 #include <string> 45 46 namespace example 47 { 48 /// Abstract a position. 49 class position 50 { 51 public: 52 53 /// Construct a position. 54 position () 55 : filename (0), line (1), column (0) 56 {
Thanks, speeder, that's great. Necrolis, thank you as well. Both of you guys are onto the same track on the compilation units. Here's the full error report:
In file included from location.hh:45, from parser.h:64, from scanner.h:25, from scanner.ll:8: position.hh:46: error: expected unqualified-id before ânamespaceâ
location.hh looks like this:
35 /** 36 ** \file location.hh 37 ** Define the example::location class. 38 */ 39 40 #ifndef BISON_LOCATION_HH 41 # define BISON_LOCATION_HH 42 43 # include <iostream> 44 # include <string> 45 # include "position.hh" 46 47 namespace example 48 { 49 50 /// Abstract a location. 51 class location 52 { 53 public:
I should also add that these files are being generated by bison. it's when i try to compile the c++ scanner class generated by flex++ that I get to this stage. I get the .cc code by issuing flex --c++ -o scanner.cc scanner.ll.
Solution:1
this happen when a ; or some other closing thing is lacking before the namespace. Are you sure that the lines before 34 have no code? If they have code (even if that code is other #include) the error is there.
EDIT: Or in case all 34 lines have no code, the error is on the file that includes this header, most likely there are a code without a ending ; or } or ) or some other ending character, and right after it (ignoring comments, of course) there are the #include position.hh
Or if there are two includes in a row, one before position.hh, the last lines of the header included before position.hh are with the error, usually a structure without a ; after the closing }
Solution:2
The error might be occuring in a file other than the file its reported in(due to the compilation units), namely at or near the end of that 'other' file(such as a missing '}' or ';' or '
« Prev Post
Next Post »
EmoticonEmoticon
|
http://www.toontricks.com/2019/02/tutorial-positionhh46-error-expected.html
|
CC-MAIN-2019-09
|
refinedweb
| 386
| 66.54
|
The following form allows you to view linux man pages.
#include <aio.h>
int
aio_write(struct aiocb *iocb);
The aio_write() system call allows the calling process to write
iocb->aio_nbytes from the buffer pointed to by iocb->aio_buf to the
descriptor ioc iocb->aio_fildes, aio_write() operations append to
the file in the same order as the calls were made. If O_APPEND is not
set for the file descriptor, the write operation will occur at the abso-
lute.
If the request is successfully enqueued, the value of iocb->aio_offset
can be modified during the request as context, so this value must not be
referenced after the request is enqueued._write().
The aio_write() function returns the value 0 if successful; otherwise, or is not
opened for writing.
.
If the request is successfully enqueued, but subsequently canceled or an
error occurs, the value returned by the aio_return() system call is per
the write(2) system call, and the value returned by the aio_error() sys-
tem.
aio_cancel(2), aio_error(2), aio_return(2), aio_suspend(2),
aio_waitcomplete(2), siginfo(3), aio(4)
The aio_write() system call is expected to conform to the IEEE Std 1003.1
("POSIX.1") standard.
The aio_write() system call first appeared in FreeBSD 3.0.
This manual page was written by Wes Peters <wes@softweyr.com>.
Invalid information in iocb->_aiocb_private may confuse the kernel.
webmaster@linuxguruz.com
|
http://www.linuxguruz.com/man-pages/aio_write/
|
CC-MAIN-2018-26
|
refinedweb
| 226
| 59.33
|
I want to fly a bullet straight, but when I hit the bullet in a normal state, it will fly straight, but when jumping, it will fly diagonally.
What amendments will make you fly straight at any time?
** Jump processing ** if (isJump == false&&gameClear == false&&WaitStop == false) { // Jump in space. if (jumpCount<MAX_JUMP_COUNT&&(Input.GetKeyDown ("space") || Input.GetKeyDown ("joystick button 0"))) { isJump = true; anim.SetBool ("Charge", false); anim.SetTrigger ("Jump"); } } float velY = rigidbody2D.velocity.y; bool isJumping = velY>0.1f? true: false; bool isFalling = velY<-0.1f? true: false; anim.SetBool ("isJumping", isJumping); anim.SetBool ("isFalling", isFalling); if (isJump) { // The second jump after clearing the speed will behave the same as the first jump. rigidbody2D.velocity = Vector2.zero; // Jump. rigidbody2D.AddForce (Vector2.up * force); // Count the number of jumps. jumpCount ++; // Allow jumps. isJump = false; // anim.SetBool ("Jump", true); } Code
** Add this action to the shooting animation ** void Bullet () // generate a bullet { Instantiate (bullet, transform.position + new Vector3 (0f, 1.2f, 0f), transform.rotation); } Code
** Scripts added to the generated bullet prefab ** using UnityEngine; using System.Collections; public class BulletScript: MonoBehaviour { private GameObject player; private int speed = 10; void Start () { player = GameObject.FindWithTag ("UnityChan");// Get Unity-chan object Rigidbody2D rigidbody2D = GetComponent<Rigidbody2D>();// Get rigidbody2D component // Shoot the bullet in the direction of Unity rigidbody2D.velocity = new Vector2 (speed * player.transform.localScale.x, 0); // Align image orientation with Unity Vector2 temp = transform.localScale; temp.x = player.transform.localScale.x; transform.localScale = temp; // 5 seconds later Destroy (gameObject, 5); } // ********** Start ********** // void OnTriggerEnter2D (Collider2D col) { if (col.gameObject.tag == "Enemy") // Delete bullets when colliding with Enemy { Destroy (gameObject); } } private void OnCollisionEnter2D (Collision2D col) { if (col.gameObject.tag == "Enemy") // Deletes bullet if it collides with Enemy { Destroy (gameObject); } } // ********** End ********** // } Code
- Answer # 1
Related articles
- unity3d how to shorten code that is too long
- c# - how to use unity initialization code
- unity - i want to make the bullets fired by the enemy fire laterally
- unity - the enemy's bullets on the moving scaffold do not fly + the first bullet flies and disappears without going
- c # - how to use dlls in unity
- unity - the player's bullets fly back, the direction does not change
- How to use Unity timestamp
- unity - multiple bullets will be fired with one touch of the "attack" button
- unity - sometimes only bullets are ejected without playing animation or se
- unity - how to simplify (simplify) sequences
- how to run unity on android
- unity - how to use invoke
- unity - i want to fly in the direction of the arrow
- unity - how to end executeineditmode
- unity2d - launch of unity magic bullets, etc
- c# - how to use unity namespace
- how to use jag array in unity
- unity - how to open the setting file in the vfx lwrp environment
- how to get the size of an object in unity
- how to use sqlite in unity
Related questions
- c # - player production in unity (shooting game)
- a question about unity please tell me how to display animatorsettrigger in onclick() of button
- [unity] i want to make a page that can be swiped vertically
- c# - unity) video shooting function in ios application
- c# - i want to make a unity texture fade
- [unity] i want to determine in what order multiple collision detection objects collided
- c# - i want to change the specified value of the y coordinate to stop each time one object is generated
- c# - unity2d script shouldn't be placed, but could not load symbol is displayed
- c# - i am making a shooting game
- [unity][c#] i can only jump at the edge of the ground
There seemed to be no problem with the code, so I actually tried it.
As long as you test here, it will be ejected straight to the side without a problem even during jumping.
Is there a problem elsewhere?
Test video
Please check for the following problems.
・ The bullet and the operating character's corridor are in slight contact with each other, and vertical inertia is added
・ There is a problem with another omitted code
・ There is a problem with the omitted component settings
|
https://www.tutorialfor.com/questions-150666.htm
|
CC-MAIN-2021-10
|
refinedweb
| 670
| 50.36
|
Generating extra hoops, since most PDF libraries expect they'll be able to use an imaging library, which isn't available on App Engine.
This came up for me recently when I wanted to implement this fantastic 'map envelope' concept using the Google Maps APIs and App Engine. The generated envelopes need to be easily printable, sized correctly, and contain both embedded images, text, and shapes - which pretty much made PDF a shoo-in.
Today we're going to take a look at the ReportLab Toolkit, the best known and probably best supported PDF generation library for Python. We'll look at what's required to use it for basic PDF generation on App Engine, and then what's necessary to be able to include images in a PDF from within the App Engine environment.
Getting started with ReportLab on App Engine
Due to a combination of coincidence and good coding on the part of ReportLab, the ReportLab toolkit works out of the box for basic functionality on App Engine! All you have to do is download it and copy the 'reportab' directory into the root directory of your app. You can now use the library exactly as described in the User Guide. Let's go over a few simple examples with the Webapp framework (adapting these to your choice of framework should be straightforward, though):
from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import A4 class PDFHandler(webapp.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'application/pdf' self.response.headers['Content-Disposition'] = 'attachment; filename=my.pdf' c = canvas.Canvas(self.response.out, pagesize=A4) c.drawString(100, 100, "Hello world") c.showPage() c.save()
This is the absolute basics of PDF generation with ReportLab. First, we set two response headers - the content type, to indicate we're returning a PDF, and the content disposition, which tells the user's browser to download it, and provides a default name. Next, we create a new Canvas object. The Canvas object is the main interface to PDF generation, and has methods that take care of common operations like outputting text and drawing shapes. In the constructor, we pass a pagesize argument. Here, we're using a predefined size, 'A4', but in general you can specify any tuple of two numbers, being the x and y dimensions of a page. We also supply self.response.out as the object to write the generated PDF document to.
A quick aside about measurements in PDFs is worthwhile here. All measurements used by the ReportLab toolkit are in 'points', which are equal to 1/72 of an inch. Reportlab provides conversion factors in the reportlab.lib.units module, so if you'd prefer, you can express sizes in any other unit - for example, the expression 10*units.mm is the number of points in 10 millimeters.
The other thing to remember is that the coordinate system in PDFs places 0,0 at the bottom left. If you're used to coordinate systems where 0,0 is in the top left, you'd best mentally invert your Y axis, or you'll be drawing everything upside-down!
Back to the example, the next thing we do is call the canvas's drawString method. This method takes two coordinates, again in points, and a text string, and draws it to the current page of the PDF. PDFs use a state-machine approach, so attributes such as the font face, size, and color all depend on the current state, which can be modified with methods such as setStrokeColorRGB and setFont.
As we've already seen, PDFs are page-oriented. The call to c.showPage() reflects this, informing the PDF library that we're done with the current page and ready (potentially) to start on a new one. Finally, c.save() tells the library we're done with the whole PDF, and it should write the rest of it to the output.
Drawing operations are handled similarly, using methods such as line() and rect(). All of this is covered in the guide linked to above, which is well worth a read.
Since a large part of PDF generation is likely to be concerned with outputting text, ReportLab's support for text generation is worth a closer look. While drawString is fine for short pieces of text, drawing multiple lines of text requires better support. ReportLab provides this in the form of text objects. To create one, call beginText() on a canvas object. You can then manipulate the text object to draw text as desired, and finally, call drawText() on the canvas object, passing in the text object, to draw it all to the canvas. Here's a simple example:
text = c.beginText() text.setTextOrigin(1*cm, 5*cm) text.setFont("Times Roman", 14) text.textLine("Hello world!") text.textLine("Look ma, multiple lines!") c.drawText(text)
There's a lot more to text objects than this, of course - again, take a look at the user's guide for more details.
Images in PDFs
It's also quite possible to insert images in a PDF, of course, and ReportLab supports doing so in a limited fashion without requiring access to the PIL imaging library. Unfortunately, a couple of issues - one incompatibility and one outright bug - require us to make a couple of small patches to the library before we can use it with images.
First, open up reportlab/lib/utils.py, and go to the rl_isdir() function, starting on line 463. This function depends on some internals of the Python classloader that aren't available on App Engine, so we need to change it. Comment out the last line, line 469, and in its place, insert "return False".
Next, look at the _isPILImage() function, starting on line 520. Line 523 reads "except ImportError:". Change this to read "except AttributeError:".
Now that we've made these modifications, we can insert images in our PDFs! The PDF format effectively supports two types of image - raw image data (optionally compressed with zlib), and JPEGs. As it stands, the ReportLab library only exposes the latter to users, so we'll only be able to include JPEGs for now. If your images are in another format, you can use the Images service to convert them to JPEG.
In order to insert an image into a PDF, we first have to create an ImageReader object from the JPEG data. Then, we call the canvas's drawImage() method to actually draw it to the PDF. Here's an example:
image = canvas.ImageReader(StringIO.StringIO(image_data)) # image_data is a raw string containing a JPEG c.drawImage(image, 0, 0, 144, 144) # Draw it in the bottom left, 2 inches high and 2 inches wide
Straightforward, right? The width and height arguments can be anything you like, so you can stretch and scale the image arbitrarily. What's more, if you include the same image repeatedly, the ReportLab toolkit is smart enough to embed it in the PDF only once, and reference it from multiple locations.
You may be wondering what would be required to support other image formats, such as PNG, so you can get rid of those pesky JPEG compression artefacts. In principle, this should be quite doable, but it'd require some serious hacking: In a nutshell, using the pure-Python pypng library to decode the PNG, and subclassing ReportLab's ImageReader class to support getting its raw data from the decoded PNG, without involving the PIL imaging library. Perhaps a future article will cover this challenge. ;)Previous Post Next Post
|
http://blog.notdot.net/2010/04/Generating-PDFs-on-App-Engine-Python-and-introducing-Mapvelopes
|
CC-MAIN-2017-13
|
refinedweb
| 1,257
| 64.2
|
Help building custom rules
Hello
I have a sitecore project I'm building in which I need the search to be filtered by the site where the user is at. The site structure is something like this:
Site A /sitecore/content/siteA/SearchPage
Site B /sitecore/content/SiteB/SearchPage … Site Z /sitecore/content/SiteZ/SearchPage
So we are building microsites and we are looking at having a lot of those microsites but we need to filter the search results for those microsites only. so if the user is at siteA, only the content within that site should be showing up on the search results and so on.
I considered creating a custom rule for sitecore and apply on the searchpage template and every single of those items will have that rule. The rule I'm trying to build essentially needs to get the current item which will be the searchpage and look for the parent of it(SiteA, SiteB, etc) and get it´s descendants. I built and extension method that gets the descendants:
public static List
return new List<Item>(Context.Database.SelectItems(item.Paths.LongID + "//*")); }
So if I do something like this: var d = ruleContext.Item.GetDescendants(); I get all the descendants for that item.This works just fine. I also tried to follow this tutorial but I'm not sure how the GetQueryExpression and the Execute method should look like in order to achieve that.
I thought in maybe comparing by parent path but again I should be checking for its descendants so I'm open for suggestions I am familiar with Linq but not much with linq expressions. Anyone ever done anything like this?
thanks
The rule you want to create is very similar to the "where item is the specific item or one of its descendants" rule but it does not have a configurable item and the item must be dynamically found using the search page parents.
You can create a "where the item is the site root item or one of its descendants" rule by inheriting from the rule above like this:
public class WhenIsSiteRootOrDescendant<T> : WhenIsDescendantOrSelf<T> where T : RuleContext { public WhenIsSiteRootOrDescendant() { // Force the WhenIsDescendantOrSelf<T>.ItemId to the site root item ID. ItemId = GetSiteRootItemID(); } private ID GetSiteRootItemID() { // TODO: Implement this method with your custom logic to find the current item root item. } }
Coveo for Sitecore already supports the
WhenIsDescendantOrSelf<T> rule and generates the appropriate Expression for it. Coveo for Sitecore will detect your new rule as a
WhenIsDescendantOrSelf<T> rule because it inherits from it and will also generates the appropriate Expression for it
In Sitecore, your new "Site Root or Descendant" rule will have the following field values:
- Text: where the item is the site root item or one of its descendants
- Type: Your.Namespace.WhenIsSiteRootOrDescendant,Your.Assembly
Comment by Diego, Jan 14, 2015 3:02 PM
thank you jflheureux
A couple of questions though. should I need an Execute method for this? In the constructor or in that GetSiteRootItemID method I don´t have the context to get the item where I set the rules, in this case the search page. The only place I can set a context from what I understand is through the Execute method with the context parameter. thanks
Comment by Jean-François L'Heureux, Jan 14, 2015 4:08 PM
You can simply use Sitecore.Context.Item.
Comment by Jean-François L'Heureux, Jan 14, 2015 4:09 PM
The Execute method is only used by Sitecore. Coveo for Sitecore never calls the Execute method on the rules.
|
http://answers.coveo.com/questions/3588/help-building-custom-rules.html
|
CC-MAIN-2019-47
|
refinedweb
| 594
| 57.61
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.