text
stringlengths
20
1.01M
url
stringlengths
14
1.25k
dump
stringlengths
9
15
lang
stringclasses
4 values
source
stringclasses
4 values
Author: Joel Neubeck – Director of Technology / Silverlight MVPBlog : This article appeared in the Expression Newsletter; In this series of articles, we will explore the process of designing and building a casual online game in Silverlight 2 (SL2). It should be no surprise that the popularity of online gaming continues to increase. Our desire to be interactively entertained makes casual games a great outlet for the increasing time we spend on the Internet. Traditionally, Adobe Flash has been the platform of choice for casual games. With the upcoming RTM release of SL2, now is the perfect time to use Silverlight to build your next online game. In this series, we will target the interactive developer and construct our own version of the classic 1980’s game “sabotage”. If you own an iPod, you may have played Apples version called “Parachute”, where you shoot down paratroopers before they land and destroy your bunker. Over the years we have seen numerous version of this classic: Figure 1 shows a few of the ways this games has been visualized over the years. Figure 1 - Game Examples In this first module we will conceptualize our game, and build the architectural framework that will serve as the foundation for our project. All of our code will be written in Microsoft.NET C#, and will leverage the following tools and frameworks. This game has a simple premise: get as many points as possible by shooting down parachuters and helicopters before the enemy destroys your bunker. Last fall Microsoft released its first version of the Model-View-Controller (MVC) framework for ASP.NET. The goal was to help developers implement this proven separation pattern, as a way to divide an application’s implementation into three components: models, views, and controllers. This “separation” improves a developer’s ability to decouple and isolate the visualization of elements, from any necessary business logic.. Figure 2 illustrates the relationship between each component in MVC. The solid lines represent direct associations where as dashed lines represent indirect associations. Figure 2 - MVC Relationships Each visual element of our game represents a View. This will include our shell that contains our stage, dialogs used for loading, beginning and ending our game, and each game element such as the paratrooper, helicopter, turret and bullet. To achieve true MVC separation we must make our models completely independent of our views and controllers. No model should hold instance variables to either of these components. There are two methodologies used when designing a model. Passive Model - In this implementation a view is notified of a change by the controller, only once the controller has updated the appropriate model. Active Model. In this implementation each model notify the appropriate view of a change by using an observer pattern. In .NET the easiest implementation of an observer pattern is through the use of delegates and events. In game development, this technique works quite well by allowing each view to subscribe to events fired by a model, when there is a change in state (new position or collision). The last and final type of component is the controller. We will use a single controller that acts as the games central nervous system. The controller will be responsible for maintaining the primary game loop used to move sprites and monitor collisions. The controller is the only component that will insert a visual element into our game. Figure 3 and 4 shows how the controller is constructed and initialized by our page.xaml. Once the controller is constructed, we can call the controllers Initialize method to pass all further commands to this component. Within this “Initialize” method we will setup our timer and load our starting dialog. Much discussion has centered on the use of either a DispaterTimer or Storyboard, and which is more efficient. Contrary to what one might expect, an empty storyboard with a short duration, is the better choice. It will perform more efficiently and consistently. public partial class Page : UserControl{ private Controllers.Controller _controller; public Page() { InitializeComponent(); this.Loaded += new RoutedEventHandler(Page_Loaded); } void Page_Loaded(object sender, RoutedEventArgs e) { _controller = new Controllers.Controller(this); _controller.Initialize(); }} Figure 3 - Code from Page.xaml.cs public Controller(Page pageView){ _pageView = pageView; _shellView = new Game.Views.Shell(new Models.Shell()); _pageView.LayoutRoot.Children.Add(_shellView); }private Storyboard _sbTick = new Storyboard();public void Initialize(){ //setup my game timer _sbTick.Duration = TimeSpan.FromMilliseconds(10); _sbTick.Completed += new EventHandler(_sbTick_Completed); //place the start dialog into the shell _startView = new Views.Start(); //attach to the start event of the view _startView.Begin += new Game.Views.Start.BeginHandler(_startView_Begin); //add the view to the shell _shellView.LayoutRoot.Children.Add(_startView);} Figure 4 - Controller initialization Let’s look at Figure 3 and 4 in more detail. By default, a SL2 object declaration will load “page.xaml” as its default entry point. We will leverage this as a way to instantiate our Controller, and use dependency injection to pass the controller a reference to Page.xaml. Dependency injection is a common way to supply an external dependency to a class or component. Once we have a reference to this top most UserControl, we can add our Shell as a child to its LayoutRoot (the default name given to a UserControls primary Grid). Our shell will contain our status bar, background and a container that will server as the stage for each of our game elements. Figure 5 is the XAML used to construct this view. <UserControl x: <Grid x: <Grid Width="450" Height="400" x: <Rectangle Margin="0,0,0,50" Height="30" Width="50" Fill="Black" VerticalAlignment="Bottom" HorizontalAlignment="Center"></Rectangle> <Grid Width="450" Height="50" x: <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="60" /> </Grid.ColumnDefinitions> <TextBlock Grid. <TextBlock Grid. </Grid> </Grid> </UserControl> Figure 5 - Shell Xaml Similar to how our controller acquired reference to Page.xaml, our Views.Shell uses dependency injection to receive a reference to its appropriate model (Figure 7). The Shell’s model is used to maintain the games score, and fire an event that trigger the shell to update. Figure 6 details how this model is passed to the view, stored and used to attach to the Models.Shell.UpdateScore event. public partial class Shell : UserControl{ private Models.Shell _model; public Models.Shell Model { get { return _model; } } public Shell(Models.Shell model) { InitializeComponent(); _model = model; _model.UpdateScore += new Game.Models.Shell.UpdateScoreHandler(_model_UpdateScore); } void _model_UpdateScore(object sender, int points) { tbScore.Text = points.ToString(); }} Figure 6 - Views.Shell.xaml.cs public class Shell{ public delegate void UpdateScoreHandler(object sender, int points); public event UpdateScoreHandler UpdateScore; private int _score = 20; public int Score { get { return _score; } set { _score = value; OnUpdateScore(); } } protected void OnUpdateScore() { if (UpdateScore != null) { UpdateScore(this, Score); } }} Figure 7 - Models.Shell Now that we have an idea of how to get things organized, lets take a look at how our view interacts with the controller. When a user first downloads the game the initial view they will see is our Start.xaml. This view contains some instructions and a button that begins the game. Figure 4 illustrates how we will insert this view into our shell, and attach a handler to its Begin event. Look Ahead: In module 5 we will demonstrate how to create an Introduction project that gets loaded before the game, and is responsible for asynchronously downloading the larger game assembly. Once a user has clicked the “Start” button, our controller will prepare to begin play by attaching to the Shell’s Mouse events. We will use the mouse to control the direction and velocity of bullets fired from our gun. When the cursor enters the perimeter of our Shell, we will begin to track the angle produced be the gun and the cursor. Clicking the left mouse button will fire a bullet in that direction. To visualize the location we are aiming, we will place an image of a crosshair at the same location as the cursor. Velocity will be calculated based on the distance from the crosshair to the gun barrel. In Module 2, we will show how to track this movement and calculate the angle of trajectory. Figure 7 is the code used to track and respond to mouse movements. As we continue our game development, we will expand this StartGame method to place our player, begin our loop and start flying our helicopters. Public void StartGame(){ .... _shellView.MouseEnter += new MouseEventHandler(_shellView_MouseEnter); _shellView.MouseLeave += new MouseEventHandler(_shellView_MouseLeave); _shellView.MouseMove += new MouseEventHandler(_shellView_MouseMove); _shellView.MouseLeftButtonDown += new MouseButtonEventHandler(_shellView_MouseLeftButtonDown); //add the crosshair Crosshair cross = new Crosshair(new Vector(0.0, 0.0)); _crosshair = new Game.Views.Crosshair(cross); _shellView.Container.Children.Add(_crosshair); .... }void _shellView_MouseMove(object sender, MouseEventArgs e){ Point m = e.GetPosition(_shellView.Container); _crosshair.Model.Move(_shellView.Container, m); _player.Model.ChangeAngle(m);}void _shellView_MouseLeave(object sender, MouseEventArgs e){ _shellView.CaptureMouse();}void _shellView_MouseEnter(object sender, MouseEventArgs e){ _shellView.CaptureMouse();}void _shellView_MouseLeftButtonDown(object sender, MouseButtonEventArgs e){ . . . .} Figure 8 - Tracking Mouse movement Now that we have this essential framework defined, its time to start building our game elements! In the next article, we will focus on movement and determine how to get our parachuters to fall, helicopters to fly and gun to shot. Prepare yourself for a small dose of trigonometry and some basic physics. Nothing to complicated, but enough to ensure our movement and collisions are realistic, and game is fun to play. For complete source or to make a comment on this article, drop by my blog at: Thank you and see you next time. ![CDATA[ Third party scripts and code linked to or referenced from this website are licensed to you by the parties that own such code, not by Microsoft. See ASP.NET Ajax CDN Terms of Use –. ]]>
http://msdn.microsoft.com/en-us/expression/cc964002.aspx
CC-MAIN-2013-20
en
refinedweb
Warning This very experimental (and possibly not working) Note This requires scons installed. No plumbing happens without pipes at some point; this package also provides tools for handling pipelines. SCons is a system to build software, akin to make and Makefile, but it also be used to run any sequence of computing steps depending on one another such as in an analysis pipeline. This is of interest for implementing some kind of fault tolerance and be able to resume a pipeline after interruption without re-runnning everything. Causes for an interrupted pipeline go from hardware failure, to running out of ressources (storage, or memory), to unavailable third-party ressources, and to a queuing system with defined timeout killing tasks. An SConstruct file taking FASTAQ files to sorted and indexed files ready to use with pysam would look like: from ngs_plumbing.scons import Bowtie_5500_ECC # path to the reference index file reference = '/path/to/index' bowtie_5500_ecc = Bowtie_5500_ECC(mapper = 'bowtie', reference = reference, nproc = 3) env = Environment(BUILDER = {'bowtie': bowtie_5500_ecc, 'st_view': samtools_view, 'st_sort': samtools_sort, 'st_index': samtools_index}) Decider('timestamp-match') # loop over the file names (no extension) my_samples = ('foo', 'bar') for fn in my_files: env.bowtie(fn) env.st_view(fn) env.st_sort(fn) env.st_index(fn) Running the pipeling can now go as simply as: scons It is easy to create one’s own functions. See Mapper. Note that mapper_opts, suffix, and src_suffix should not be specified. Create a building mapping reads.
http://pythonhosted.org/ngs_plumbing/scons.html
CC-MAIN-2013-20
en
refinedweb
OpenMP* Diagnostic 1392: variable "entity" in firstprivate or lastprivate clause of an OpenMP pragma must be shared in the enclosing context Cause One case that the Intel C++ Compiler will emitting this diagnostic message is when using the "firstprivate" of OpenMP* with a wrong syntax. Example t.cpp: #include <stdio.h> int main(int argc, char* argv[]) { int mysum=0; #pragma omp for firstprivate(mysum) for (int i=0; i<1000; i++) { mysum += i; } printf("mysum=%drn", mysum); return 0; } Output from build environment on Windows: Advanced OpenMP* Programming Introduction What Cilk™ Plus solves for C and C++ programmers C and C++, like most programming languages in use today, were not designed as parallel programming languages. Performance Tools for Software Developers - Cluster OpenMP* frequently asked questions Intel® Fortran Compiler - OpenMP* specification support Intel® Fortran Compiler The Intel® Fortran compiler supports the OpenMP* 2.5 specification for Fortran in the 10.x compiler and OpeMP* specification 3.0 for Fortran in the 11.x compiler. For more information, see the section on Parallelization in the Optimizing Applications section of the compiler documentation. Operating System: Intel® 20 Questions Contest: Question 12 Intel® 20 Questions Contest: Question #12 Question: Intel® Parallel Composer: Extract project and source files from <Intel Parallel Studio directory>\Composer\Samples\en_US\C++\NQueens.zip. Study project nq-openmp-intel. What function does nq-openmp-intel use to get the OpenMP* thread number? Threading Models for High-Performance Computing: Pthreads or OpenMP? by Andrew Binstock Threading Fortran applications for parallel performance on multi-core systems OMP Abort: Initializing libguide40.dll but found libiomp5md.dll already initialized Pages
http://software.intel.com/en-us/taxonomy/term/20860?page=16
CC-MAIN-2013-20
en
refinedweb
This article is the next step in a Catharsis documented tutorial. Catharsis is Web-application framework gathering best-practices, using ASP.NET MVC (preview 5), NHibernate 2.0. You can find on all the needed source code on. Catharsis in version 0.9.5 provides new - sometimes fundamental - extensions and improvements. To let you quickly know I've created 7 snapshots which are (as I do believe) self-explanatory. The main localization improvement is in fact the possibility to order by any language used in the application (what's a bit complicated then it could look like) and searching for localized phrase. You can add new languages in runtime - when application is deployed. Newly added language can be immediately selected by user. Default Action for every controller is the List. The not localized Keys are decorated with '$'. Translator entity management allows to add new phrases for every language in the system. Phrases are stored in the static cache. That results in a very high performance. But every change (new phrase or updated one) is replaced immediately. Default order is based on the DB clustered keys As said above, Catharsis now provides the simple way how to order by any language in the application. Whatever was localized, it can be searched out now. There is a strong tool for localizing the user UI built-in Catharsis. You will use it even if you are developing mono-language application, because Catharsis provides run-time 'Phrases management' for your application users. They won't 'disturb you' to change your some misspellings or incorrectness - they will be able to adjust whatever 'text' they want. But firstly small review of the approach used in ASP.NET We are not talking about translation only! The main purpose of localization is adjusting. You (as programmer) use words Like 'SearchForResults' but use prefer 'Search for results'. That's the added value you gain from localization. Every rendered text can be sent through Catharsis localization and adjusted to be as user-friendly as needed (and even translated) ASP.NET provides among others features - strong support for localization. Usually used are Resources (local or global) stored in special XML files with suffix .resx. They are not bad and can do a lot of things for you. The real disadvantage of such solution comes when your application grows and the amount of your *.resx file is starting to be unmanageable. The same must be applied for every new language; every file (with ‘lang’ suffix) must be added. Do not forget, that before you can add them, you have to create them and distribute to translator, who must be able to edit ‘sophisticated’ xml files … .resx ASP.NET provides (correct would be ‘can be provided’) with database storage for all resources. You can implement only few classes (ResourcesReader etc.) and the localization than can be completely stored in database. I would say, this is the real improvement. Anything stored in DB can be “simply” converted to ‘translator-user-friendly’ output, which can be subsequently (after translating) converted as an input back to DB. Really good approach! ResourcesReader Catharsis does not use ASP.NET ResourceManager, she has its own. You can find it as a static ResourceManager object in a Common project (which every upper layer is referencing). ResourceManager has GetLocalized() method with two overloads. The first takes only one string as the ‘key’ for searching; the second is more precious and takes two: ‘key’ and adjusting second one: ‘area’. ResourceManager Common GetLocalized() The ‘key’ could be anything, action name (Search, List…), controller Name (Language, AppUser) and even Error message (CannotDelete). The ‘area’ can be used for better translation granularity, on one place the word “Search” could be explained as “Search” on other as “Searching”. And at that point the ‘area’ identifier comes into play. Catharsis on UI uses ResourceMangar.GetLocalized() in a smart way. There are base classes for pages and web-controls, which provide GetLocalized() method with one attribute ‘key’ – the second ‘area’ is provided behind, the current controller name is used. If you call GetLocalized(“Search”) on Person controller, then your call is translated into GetLocalized(“Search”, “Person”); ResourceMangar.GetLocalized() GetLocalized() GetLocalized( ) ); Of course, you can avoid this default behavior, only just using the GetLocalized(“Search”, “yourArea”) – simple as you can expect. Catharsis is very kind, she will never force you … She just tries to help you) GetLocalized( , It’s a kind of waterfall based on user selected language, provided ‘key’ and ‘area’. If user selected ‘en-GB’ and is looking for a key ‘Brainy’ in area ‘Entity’: the first look is for match of all three attributes en-GB If not found the ‘en-GB’ with key ‘Brainy’ is evaluated (area is not used) If not found the ‘en’ ‘Brainy’ ‘Entity’ comes to play Next is ‘en’ ‘Brainy’ Next step is the default language – so if default is Czech than ‘cs’ ‘Brainy’ with ‘Entity’ and next without is evaluated cs Still nothing? Then at least the ‘key’ is returned == ‘Brainy’ You do not like this behavior? Adjust it as you wish, no *.dll - pure source code is provided with Catharsis. (And let me know!) Catharsis can be localized to as many languages as you want, and what is really cool – in a run-time. (Application User can add new language if (s)he has needed access rights). Languages can be general ‘en’ or specific ‘en-GB’. public class Language : Persistent { public virtual string LanguageName { get; set; } public virtual string EnglishName { get; set; } public virtual string NativeName { get; set; } public override string ToDisplay() { return LanguageName + "(" + EnglishName + ")"; } protected override string GetDomainObjectSignature() { return LanguageName; } } Object Language has three properties: Language LanguageName NativeName EnglishName Translator has two properties ‘Key’ and ‘Area’ - for searching. Phrases for application languages are stored in a IDictionary with key equal to language abbr. If new language is added to application, new item to IDictionary is added. That’s all. IDictionary public class Translator : Persistent { IDictionary<string, string> _translations = new Dictionary<string, string>(); public virtual IDictionary<string, string> Translations { get { return _translations; } set { _translations = value; } } public virtual string Key { get; set; } public virtual string Area { get; set; } public override string ToDisplay() { return Key; } protected override string GetDomainObjectSignature() { return Key + Area; } } Translations are stored in application cache. They are loaded lazily – when they are needed. If there are any changes to language or translator objects made, cache is cleared. For accessing storage Catharsis uses business Facades. Nothing surprising, this is the essence of framework communication (Façade – Dao – Storage). Catharsis allows users to change UI language in a few ways. The first important place handling localization is the default language in application web.config. There is magical element <globalization> which can determine the UI language: web.config <globalization> <globalization uiCulture='cs' culture='cs-CZ' /> This is working but a little bit brutal. The user's browser settings are now out of the play. With a more gentle approach, we can reach similar result, but more comfortable for our user: <globalization enableClientBasedCulture='true' uiCulture='auto:cs' culture='auto:cs-CZ' /> This is what we want. We did set default language, which is as spoken above crucial for translations. But we (user) gained the ability to set application language via browser setting. Because of gentle setting in web.config user can switch among languages using browser, selecting the language in options. The translated phrases are changed after first postback (the same goes for numbers, dates … formats). But sometimes users cannot adjust settings on their PCs. Some restrictions can forbid some changes like 'Internet options' in Internet Explorer. Sad for user but reality in some organizations. Luckily, Catharsis provides the second way how to set the language - just by clicking the language name in the upper right corner (if you are using Catharsis default layout). This way of switching languages is a little bit different. Firstly, user clicks on a link, it means there is a response. Catharsis therefore does two things: But there is more. User selection is done once (opposite to browser language setting, which is appended to every request). Catharsis must store that clicked value. For that purposes the session is used as the storage. And also HttpModules starts to work – they are evaluated before every user request is handled, and set the CurrentCulture to user selected value. HttpModule CurrentCulture That behavior (and also the implementation) is simple. Now you know how it works. But I guess that you will just: Consume the fruits of Catharsis by calling GetLocalized() in your code. Insert knew ‘keys’ using Catharsis TranslatorController UI TranslatorController Grant access for ‘User or Translator’ to manage phrases, they want to see… Enjoy Catharsis! You can find all the needed source code on. This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL) General News Suggestion Question Bug Answer Joke Rant Admin Math Primers for Programmers
http://www.codeproject.com/Articles/29417/Web-Application-Framework-Catharsis-part-IV-Locali
CC-MAIN-2013-20
en
refinedweb
Lingua Programmatica Typical non-programmer question: Why are there so many programming languages? Why doesn’t everyone just pick the best one and use that? Fair enough. The definition of the term “computer language” can be really nebulous if you encounter someone who is in the mood to engage in social griefing through pedantry. Instructions for a machine to follow? Does that include 19th century player pianos? Machine code? Flipping switches and wiring on those first-gen electric computer-type contraptions? Considering over half the “language” consists of dragging and dropping icons, does Scratch count? Let’s just sweep that all aside and assume languages began with the idea of stuff like COBOL and FORTRAN and we don’t care to refine the definition further. Humor me. It’s pretty much standard practice to do the “Hello World” program when you’re learning a new language. The goal is to simply print the worlds “Hello World!”, and that’s it. It’s basically the simplest possible program that can still do something observable and meaningful for someone new to the language. Here is the program in assembly language: _start: mov edx,len mov ecx,msg mov ebx,1 mov eax,4 int 0x80 mov eax,1 int 0x80 section .data msg db 'Hello, world!',0xa len equ $ - msg Here is a functionally identical program, written in standard C: #include <stdio.h> int main(void) { printf("hello, world\n"); return 0; } And in BASIC: 10 PRINT "Hello, world!" The first is incomprehensible to anyone who doesn’t understand assembler. The second is tricky, but you might be able to intuit what it does. The last one is simple and obvious. So why would you ever use anything other than BASIC? Here is how the trade-off works: On one end you have a powerful, flexible language that makes highly efficient code. It can be used to make anything and the code will always be extremely speedy and have the lowest possible memory overhead. (Setting aside the issue of individual programmer skill.) On the other end you have a language that’s easy to use and understand. Some languages are optimized for specific tasks. If you happen to be doing one of those tasks, then your work as a coder will be easier. Let’s say you want to write a program to take a given number and perform two tasks: 1) Print the number normally in base ten. So, ten and a half would look like: 10.5 2) Print the number in a base-6 number system and use an @ symbol instead of a decimal point. So, ten and a half would look like: 14@3. I don’t know why you would want a program that does this, but I promise this isn’t really any more arbitrary or goofy than a lot of crazy stuff a boss might assign the hapless coder. The first task is conventional and almost all languages will have a shortcut for making that happen. The second task is unconventional and thus we’re not likely to have a lot of built-in language tools for doing it. In assembler, these two tasks will be of a similar level of difficulty. You’ll have to write your own number-printing code from scratch, but when you’re done the two bits of code will be about the same level of complexity (very complex) and the same level of efficiency. (Highly optimized. (Again, this is assuming you know what you’re doing.)) In C, the first task will be trivial, and the second will take some extra effort. Printing the base ten number will be much, much faster than printing in base 6 with @ symbols. (Although both will be so fast on modern computers you’d have trouble measuring them. Still, if you had to print out a LOT of numbers, the differences between base 10 and base 6 would become apparent.) In BASIC, the first task would be super-trivial. One line of code. The second task would require pages of code. 99% of your programing time would be spent on the second task, and it would be much, much slower than the first task. Assembly is referred to as a “low level” language. You’re down there interfacing with the machine on a pure, fundamental level. Every line of code is basically an instruction carried out by the processor. BASIC is a very high level language. You’re writing things in abstracted, human-friendly terms, and a single line of code might represent hundreds or even thousands of processor instructions. Generally, the higher the level of the language, the more tasks become either trivially easy, or impossible. The C / C++ language seems to be the “sweet spot” in this particular tradeoff. Most software on your computer was written in that language. But despite its dominance, there are still a tremendous number of situations where other languages are better for specific tasks. Some examples: - Java is totally cross platform. Write one bit of code and it’ll run the same everywhere. Downside: It’s slower. Really slow.* - Visual basic is dynamite if you need lots of small programs with simple functionality but complicated interfaces. If you need a lot of complex dialog boxes with sliders and buttons and drop downs, it will be easier to set them up in Visual Basic than C++. 10 PRINT "My chosen computer language is better than yours!" 20 GOTO 10 * There. Now we can be friends again. I bet you won't even read all 186 comments before leaving your own. In my country, we say that programming languages are like soccer teams. Everyone has their favourite, and not necessarily for any identifiable reason. Still, the choice of language (at least for general-purpose languages like C or Basic, and not specific like SQL) is a very personal choice for a coder. Sometimes it’s as simple as “what I’m used to”, sometimes they can spout a list of twenty items mentioning such exotics as Hindley-Milner type inference. For the record, my favourite languages are, in no particular order, C, Scala and Lua. A programming metaphor that involves sports? Heresy! Hm, I’d have to say “Common Lisp”, “Python” and would have a hard choice picking “C” or “go” as my third choice. (this is very late for a reply, but!..) sounds like a reasonable metaphor to me, what country though? interested.. My favorites are very close to your actually, Mine(also no particular order as well) are C(++), Lua, and Python. Python is really easy, and i usually think about it more than others. Great post…haven’t seen assembly like that in at least five years. Different tools for different tasks for people with different skill levels…that’s what it basically boils down to. If you don’t mind me asking, what are the differences between PERL and Python? What are they used for? PERL’s primary domain is in performing common tasks very well. Use PERL if you want to scan file directories, use regular expressions, etc… Application and human interface type stuff. Python has a lot of overlap with PERL, but what it’s best at is stuff that goes beyond PERL’s intended purpose…something like a complex data structures, OOD, etc… They’re sort of like first cousins as far as languages go. THere are a million programs that you could do just as well in either language, but some that will be much much easier in one or the other. Personally I prefer PERL, because I use those kinds of features a lot more. I will often write a program that scans a data set and performs regular expressions on it, but I rarely need to do anything with a complex data structure. A lot of languages are like this. They’re about 90% similar, and the other 10% is the stuff that the original designer felt was lacking in other languages. Python tends to be more readable; Perl can certainly be written readably, but it’s also much easier to end up with a visual disaster if you’re not careful. The tradeoff is that Python doesn’t give you as many ways to do the same thing; in Perl you have many options with their own upsides and downsides, so you can do either much better or much worse than Python, depending on your experience, attention levels etc. Perl is also very nice to use for people with an old-school UNIX background, as it uses many conventions from that environment. They say that good Perl code is indistinguishable (?) from line noise :) My favorites would probably be Python, bash (er.) and awk (um.); and Delphi for windows platforms – precisely for the reason Shamus mentioned VB. Programming basic applications in Delphi is a childs’ play, really. – include standard disclaimer about english not being my first language Aw, man. Don’t write Perl as “PERL”. It was never an acronym and all the definitive texts write it ‘Perl’ for the language and ‘perl’ for the interpreter. ‘PERL’ makes it seem like FORTRAN or COBOL, not the lovely, thriving language that it is. Perl is the Practical Extraction and Report Language. I’m fairly sure the full text was devised mostly after Wall had a name for it. There are many backronyms for Perl, but they’re just that backronyms. I’ll point to the Perl 1.0 man page (side note: I never used Perl 1.0, but I have a vague recollection of seeing Perl 2.0 come across Usenet). Though there’s also this note, at the end of the same man page: Are you saying FORTRAN isn’t a lovely, thriving language? Cuz I’d probably have to agree. PERL is a comparatively older language, evolved (I think) from a set of macros to manipulate text, so it is very good at that. Its development has always been very haphazard, with features added as time went. As a result, it’s a very heterogeneous language, and a bit tough to learn. It is, however, a very good language to write things like batch files and initialisation scripts. Python is comparatively newer, and tries to make its syntax be as clear as possible. It’s a language that can be used for embedded scripting (for example, in games), but it’s rather large and generally is used on its own for all sorts of small to medium-size projects. I unfortunately don’t have snippets of code to show you the difference, but suffice to say they have very different feels. More specifically, Perl was devised as a way to pull together the functionality of a bunch of Unix text tools that traditionally were pieced together using shell scripts: awk, grep, sed, tr (and others, but these are pretty clearly the most important and most influential). Perl was intended to help automate Unix system adminstration tasks. Aha! here is the original public release (on the Usenet group, comp.sources.unix). Python is a much more elegant and modern language with a robust library that supplies the functionality that’s embedded into Perl’s language core. As such, Python tends to be rather more verbose but more understandable than Perl code often tends to be. From a “what are they good at” point of view, they’re close enough that they’re basically interchangeable. Both are quite good at text processing, acting as glue between other programs, and are powerful enough to do Real Work, if you’re willing to accept that they’re slower than, say, C. Both provide a rich set of primitives and vast libraries of supporting tools allowing you to get on with your actual task instead of spending time building infrastructure. Both are great for the sort of small one-off programs that programmers frequently find themselves needing; tasks like, “We need a program to covert all of our data from the old database system to the new one.” The difference is primarily mindset. “The Zen of Python” include this key element: “There should be one– and preferably only one — obvious way to do it.” (That’s from the Z Python says that uniformity is best; part of the payoff is that if I need to work on another person’s Python code, it likely look very similar to how I would have written it. I shouldn’t have to learn the unique idioms of a particular project or developer when a common set of idioms could have solved the problem. The Perl motto is: “There’s more than one way to do it.” Perl says that a programming language shouldn’t tell you how to do your work, that you’re a smart human being and know the best way to approach your problem. Sure, you could solve the problem given more limited tools, but the resulting solution won’t be quite as succinct, quite as clear, and quite as idiomatic to the problem. Larry Wall, the creator or Perl, once pointed out that the real world is a messy place with all sorts of unusual problems, and that Perl provides a messy language that frequently lines up well with the unusual problems programmers have to solve. For most programmers, one of those two mindsets will better fit how you approach problems. The other language will look stupid. Interestingly, this argument plays out in other sets of languages as well. Scheme versus Lisp, Java versus C++. Python is also really, really good at graphical processing. Perl, not so much. I don’t see why you say that, perl has SDL and openGL just like python does, both have access to a huge range of GUI interface toolsets like GTK or QT. I’ll admit that perl wasn’t written that way, it’s got some quirks as a result, but the functionality is there, and it works perfectly. The downside of: “There’s more than one way to do it.” is that reading other people’s code can be a real challenge. Hence this remark lifted from Wikipedia: Some languages may be more prone to obfuscation than others. C, C++, and Perl are most often cited as easy to obfuscate. Wow. I wasn’t expecting that many replies, but thanks all: that helped a lot. Then there are also languages like LISP and Prolog, which are very good at doing things quite unlike the things BASIC and C are good at, and really terrible at doing other things (including, sadly, a lot of practical tasks); and then there’s the really fun stuff like Scheme and the simply-typed lambda calculus, which are terrible at pretty much everything but are much beloved by computer scientists because, while doing things with them is pretty close to impossible (or at least, pretty mind-numbing), proving things about them is amazingly easy. God help you if you want to prove something about C++. I never felt like Scheme was difficult to use…but the only thing I’d ever want to use it for would be AI programming. Maybe that’s because that’s what I was taught to use it for. I can’t even wrap my head around writing a genetic algorithm in C++, but in Scheme it’s no problem. It’s a niche language, for sure, though. Having done genetic algs in C++ let me tell you: they’re really not that bad at all. I second this. I took a genetics algorithm course with a bunch of mechanical engineers, where I was the only one who knew C/C++. While they wrote stuff in a higher level language that took forever in their various complex solution-spaces, I was able to tailor my code to make it efficient, without much coding time added. All it takes is some carefully planned object manipulations. The GA’s I used for my Master’s Thesis were originally encoded in C (written as a single-semester project), ported to C# when I went independent study (I was learning C# and coding new stuff for it in C# was a good way of doing it), and continued in C# when I ripped it apart and rewrote it. Finaly project involved complex data processing, database creation and storage, a really complex GA, automated run/load/train/test/re-start processes, and worked quite well. Sadly, 2 of my three “Big ideas” utterly failed to pan out. Still, got my degree, learned C#, and patted myself on the back for being rigorous with my OO-design when I found myself rewriting the low-level stuff for the third time and realized how much time I’d saved by properly black-boxing things. In college I got to learn ML (which is a LISP-type language) and Prolog. Prolog is a ridiculous language. It’s sort of fun from an AI perspective, but it seems kind of useless if you want to actually want to make it do something. ML, on the other hand, was a lot of fun. It’s a hard language to learn, but once you figure it out, it’s a pretty solid language. The trick with LISP-type languages is learning how to do everything recursively. It’s counter-intuitive at first, but once you get the hang of it, it’s pretty useful. I think it’s worth learning a LISP-type language, if only so you can better understand how recursion works. Of course, given that recursion tends to take up a lot of memory, LISP type languages probably aren’t the most efficient for everyday tasks. I don’t think that’s true in most cases. Tail Call Optimization is extremely common in functional languages (though perhaps not in every implementation). I believe it’s required by the spec of Common Lisp. Essentially, if the recursive call is the last thing in the function (i.e. a Tail Call), then it can be converted into a loop by the compiler. You certainly can write recursive programs that don’t take advantage of this, and therefore have memory issues, but it isn’t as much an issue as you might think. Required by the Scheme spec(s), not required by the Common Lisp standard, but frequently available at the right optimization settings. surprisingly not in CLISP’s default settings I’m assuming when you say “LISP-type” you mean “functional”, since that is the only way this post really makes sense. In that case, it’s full of wrongness, as Haskell is actually one of the more efficient languages out there right now. Scarily efficient, actually. I was wondering how long it was going to take to get Haskell mentioned! “These are your father’s parentheses. Elegant weapons for a more… Civilized age.” Some languages even exist in a weird limbo zone whose tasks are so highly specialised they’re practically useless outside that task – RPG, for instance, creates reports. It will never do anything else. But fifty years ago it was a tremendous boon to the industry because it was much simpler to make a nicely formatted report in RPG than in COBOL. And that’s another issue – programming has been around for seventy years. We have seventy years worth of programming tools laying around, and like most tools, programming languages don’t just go away because a better tool comes along. Those old tools may be better for working on older programs, and the newer tools might be lacking a key, but obscure, feature an older one had. So all these programming languages just linger around, still being somewhat useful and not quite obsolete. One thing to keep in mind is this: BASIC got us to the moon. Even a high-level, low-powered language can be highly useful. Beg pardon? Are you saying the Apollo Guidance Computer was programmed in BASIC? Systems inside the lander itself, if I remember correctly. I doubt the BASIC we use now would be recognisable as the version used by NASA, however. Taken from – “AGC software was written in AGC assembly language…” and “The AGC also had a sophisticated software interpreter, developed by MIT, that implemented a virtual machine with more complex and capable pseudo-instructions”. However, no mention of BASIC. RPG has changed radically in the past 10 years or so, and is much more general purpose language these days. It does have a whole boatload of things that make handling formatted files really easy, including the ability to embed SQL into the program and run that on files… Whilst I’ve been having to suffer Java recently, I do feel the need to point out that these days most operations have no noticeable speed difference between native code and managed code. The real speed hit with Java is on startup, but once it’s running most differences are negligible. For a fuller discussion, but it basically boils down to ‘It used to be RE-HE-HE-HEALLY slow but each new version has brought optimizations such that it’s to the point where the winner will depend on context’ Yeah, nowadays Java is more of a server-side language in my experience (my experience being a server-side programmer, so…) Ironically this utterly ignores Java’s so-called portability (which is much less functional in reality once you start writing complicated programs). What it gets you is fast-enough performance, ease of coding (nice libraries, esp with network code), and free memory management. Even that is possible to defeat (believe me, there are still plenty of out of memory issues) but it’s much less likely you’ll write a program that will choke and die after a few hours of non-stop use. Which, you know, is good for servers. The motto of Java is supposed to be “write once, run anywhere.” But, really, it’s “write once, test everywhere.” Each Java VM is slightly different in annoying ways. Oh, how I do not miss my 5 years as a Java programmer. I learned to code with pascal back in high school might just be nostalgia, but it’s still my favorite language. I really like java, too Unsurprising. The whole reason Pascal exists is to create a good language for teaching general programming structure, while being robust enough to create complex-enough programs to show students why they would want to learn programming in the first place. I, too, learned Pascal in high school and I, too, hold a special place in my heart for it. But I also understand why it doesn’t have the hold that C does. Ah, the joy of being so distant from a problem that it becomes difficult to see. You didn’t even have to get into libraries, the nature of variables, definitions, and the thousand other things that usually mean you consider whatever you got trained in first / most thoroughly to be “superior” because the way the language behaves in the same as the way you “think” a solution to a coding problem, and so it becomes natural to express your solution in that language, trying to express it in another language can be very difficult. For these reasons I still have a soft spot for PASCAL, despite not actually using it on a computer in over a decade, I still write my to-do/task lists in a shorthand version of Ruscal. (dating myself there) Heh, you reminded me of a story on The Daily WTF: there was a bit of C code that opened with #define BEGIN { #define END } and went on from there. “A true programmer can write FORTRAN code in any language.” Full text in RSS now? When did that start happening? Yeah! we want just a teaser, or otherwise we feel like it’s a waste to click into the actual site! Wait, so I didn’t actually have to come here? I clicked the link before even seeing the RSS contained the whole text. Regardless, this is one of the few sites I like to visit rather than read the posts in RSS. I noticed that too. I think the thing people need to understand is that there isn’t really any such thing as a “best” programming language. In principle, all programming languages are equally powerful. If you can write a program for it in Assembly, you can write in C or in BASIC or in Python or in LISP. The difference between languages is usually a matter of tradeoffs. Lower level languages are more efficient, but harder to use and much more platform dependent. Higher level languages tend to be less efficient, but they’re much easier to use and are less platform dependent. Then there’s the fact that learning a new programming language isn’t an easy task and most people tend to stick with what they know. As a result most programmers favor C or C-like languages (C++, C#, Java). C was the first good, high-level programming language that worked on most platforms, so everybody learned it. When I was in college my professors all hated C++, even though out in the working world that was the language everybody used. Even if other languages are better, when you get a job, you’re probably going to work with C++ (or these days, C#). Knowing a better programming language is worthless if no one else is using it (unless you’re a one man development team). No point in learning the awesome powers of LISP if you’re the only one who knows it. Whoa, whoa, whoa. Hold it right there! We learn other languages for a variety of reasons, and actually using said language in practice is one of the small reasons. In my mind, the two major reasons to learn other languages are to get used to thinking about programming in a different light (for example, LISP is a great way to get comfortable with recursion!) and for helping us better understand the strengths of the language we do use. Definitely agreed with this. In my opinion, every serious programmer needs to learn to program in at least one assembly language and at least one functional language, even if they never use them. Plus, learning Lisp makes you really comfortable with operating on lists, and a great boon in learning how to do nifty magical things in languages with native list types (Perl and PHP, for example) What about Python? I heard a lot of things about that language.. The nice thing about python is that it’s easy to learn and easy to use. It has the gentlest learning curve of any programming language I know. The result is you spend less time struggling to learn how to accomplish even the most basic tasks and more time writing programs that do cool things. Like flying: Python is “the best” to me – easy to learn & write, vast built in library, cross-platform, and if you need speed can be extended with C. I’ve been tinkering with Python on and off over the last two years, and I’ve come to one inescapable conclusion: it’s great if you’re writing a processing script for one specific task, but I wouldn’t ever try to use Python to write anything with a GUI. That’s what C# and Java are for. I might consider using Python to do a quick functional demo of a concept (even a GUI), but I don’t think I’d go any further than that. The reason is this: Python tries to pretend it’s dynamically typed, but it’s actually strongly typed — but even worse, it sometimes swallows type errors silently, producing invalid behavior. I once spent three hours debugging something that turned out to be Python choking on an int when it was expecting a string, only it never actually gave me an error message about it. As a result I have become extremely wary of anything more complicated than Project Euler when it comes to Python. As for speed, well, depending on what you’re doing it’s not really that slow… but if you really do need the speed difference, and you’re going to write Python extensions in C, why not do the whole program in C/C++ in the first place? I’m not sure what you mean here. Those are not incompatible concepts. (Edit: May be a terminology problem. I found this article very useful: What To Know Before Debating Type Systems. ) Static vs. Dynamic typing has to do with when names are bound. Static languages require you to specify ahead of time, the types used in your program. If you call an invalid function for a type, the compiler will yell at you. In a dynamic language, the error doesn’t show up until runtime. Weak vs. Strong typing has to with whether types are coerced by the runtime. With weak typing, if you pass a int to a function that expects a double, the language will convert the int to a double for you. With strong typing, you get a type error, and have to cast it yourself. I don’t use Python much, so I can’t comment on the other issues you brought up. Sorry, I misspoke. Python (at least when you learn it) appears to be weakly typed, but it’s actually strongly typed. By “pretends to be” I don’t necessarily mean from the language’s point of view, I really just meant from the programmer’s point of view (at least if you’re not already familiar with how it works). But maybe the real lesson to take from this is that I suck at Python. I read that article you linked. It’s pretty interesting. Towards the end the author talked about using static typing to prove program correctness. I’d never thought about typing that way before. Also, I was always told that proving program correctness was something that only mathematicians and academics cared about. It seems like this guys making the case that we should use statically typed languages to prove program correctness, rather than testing our programs until we’re pretty sure that we’ve removed most of the bugs, which is an interesting thought. The reason why we don’t program in C or (shudder) C++ instead of Python is because Python has automatic garbage collection and high level abstractions that lower level languages lack. For example, try writing the following Python code in C: from random import randint foo = [randint(1,100000) for i in xrange(10000)] foo.sort() # code tags don't seem to like indentation... for item in foo: print item del foo It would be huge. First you’d have to write your own linked list implementation, then your own sorting algorithm for said linked list implementation. You’d have to allocate and deallocate memory, probably including some temporary storage for your sort. If I had to write that program in C, I would bet that it would take longer to run (albeit with less memory) than the Python snippet above the first time it worked. And it would definitely not work the first time. It would take hours to write. I didn’t run that example code in an interpreter and I’m fairly confident it will print out a sorted list of 10,000 pseudorandom numbers. I’m not saying C doesn’t have its place; I write C code for a living. I’m just saying that if you have the option and the compute time and resources, there’s no reason whatsoever to write in C these days. By the way, PyLint will help a lot with finding those strongly dynamically typed errors. I use it heavily on bigger Python programs and it’s found many bugs. Now this is getting long, but another benefit is that while the same C code will run on many architectures, that Python code will run on any major and many minor operating systems. I’m fairly sure porting the C stuff would be a nontrivial amount of work. I used to program BASIC games from books as a kid. In high school we used BASIC on the Apple IIs. My favorite though was AMOS, a graphical programming tool for the Amiga. I used to make games like Asteroids and Pacman on it. Was lots of fun! I haven’t programmed in years now, really want to get back to it and learn some more C but I don’t really have the time (I PLAY too many video games to be making them). I’m in the same boat, with a couple of additional caveats. My job is developing web applications, and often, when I get home, I don’t have the interest to work on one of my personal projects. Plus, I feel like if a game is going to go anywhere, I would need to write it in C++, which at this point I would have to relearn, especially the memory management stuff. So when it comes down to either learning C++, so that several months down the line, I can write some interesting code that actually does something, or playing video games, video games always wins. I do work on other personal projects sometimes, but they are all things that are fun/interesting on their own, and that let me see interesting results right away. If you don’t want to deal with memory management and C++, check out the XNA Framework which will let you write games using C#. The creators site also has a ton of useful samples to help you get something interesting going quickly. Which brings up the other issue. I run Linux (Ubuntu, specifically) on my primary laptop. I was booting to Windows for a while, and working through a C# DirectX book (not XNA specific), until I found out that my video card is so out of date that some of the examples just didn’t work. The one I remember had to do with putting a three color gradient on a triangle. It worked like it was supposed to on my work machine, but on my laptop, the triangle was a single color. I have another laptop with Vista on it, and a slightly newer video card, but I just haven’t gotten around to trying it there. obligatory SDL bump. Don’t tie yourself to Windows, says the fanatic. XNA is a good tool to learn about development. You can master concepts like drawing graphics and the update loop quickly. It’s memory management isn’t foolproof. Once, I needed an array of about 500 sprites. For some reason, XNA wouldn’t initialize one that large, even though I remade my project. It didn’t work until I rebooted my system. I write all my code in Superbase Data Management Language, a 16-bit Basic-like with an integrated non-SQL database engine. Because I like it, that’s why. Yeah… Java is comparable in speed to C++ in most situations these days, after the JVM has fully started up. It’s not interpreted any more, it’s just-in-time compiled. That was actually true five years ago. Often times a Java program winds up being faster and more efficient than something comparable in C++, as well, plus faster to code. Depending on the ability of the programmer, of course. I think the example you wanted for a very high level, but slow language was probably Python or Ruby. Not sure I’d ever use the word “dynamite” to describe VB, unless the connotation you were looking for was “will leave your computer a pile of smoking rubble”. Though the thing to remember is that the biggest JVM around today doesn’t JIT code until it needs to, to cut down on startup time. Java starts out running pretty slowly, then once it gets a feel for what code paths are often-utilized it gets much faster. Huh. I always think of a different trade off – time to write vs time to run. Some languages are easy to write (python), some are hard (assembler). Easy to write generally means slow to run. Great if your writing something that will be only ever be run once (e.g. research), terrible if it will be run many times (e.g. web page generator). Factored alongside this is “time to learn” – your first program in any language will take a while (though this overhead decreases as you know more languages) but as you do more, you get quicker. Hence why some use FORTRAN; they don’t want the overhead of learning another one. And then there is portability – if you only need it to run on one machine vs customers need to install it on Windows / Mac / Linux / mobile / etc. Why are there so many types of vehicle on the road? Subcompacts, compacts, coupes, full size, minivans, vans, pickups, trucks, semis, motorcycles, scooters. Why doesn’t everyone just pick the best one and use that? Why are there so many types of aircraft? Dedicated cargo haulers, dedicated fighters, fighter-interceptors, fighter bombers, dedicated bombers, jetliners, electronics platforms, single engine personals? Why are there so many types of firearms? *Channeling my inner McNamara–the **** Paul Graham has a detailed essay on this topic: Beating the Averages. He says that, in general, you should be using the most powerful programming language available. And he’s right. I think deciding which language is the most powerful is a complicated task. The power of a language depends on the task at hand, where a domain-specific language could be more powerful than a language that’s a lot more powerful for more general tasks. There’s also the matter of support. Some languages in wide use are crappier than other languages no longer in use, but it’s better to go with the lesser language as it has much better support and a larger community. As for the definition of programming language, Turing-completeness is a good rule-of-thumb, but is by no means a requirement. All Turing-complete languages are equal in computation ability. Since my brain refuses to memorize anything as arbitrary as programming/script-languages’ syntax, my ..uh.. language of choice goes like this: Hello World Its a treat sometimes to see you explain these programming concepts. When I was finnishing High School, I had taken an advanced placement computer science course that was equivelent at the time (over ten years ago) to a first year university course on computer programming. The year I took this course was the last year that turbo pascal was being taught and the curicullum was moving over to C++. It was frustrating for me at the time because it was evident that the languages used were going to change often and frequently. I did not continue due to this, as I wasnt prepared to re-learn a new language each time. I guess C++ held on, but they still seem to carry obvious similaritys to what I had learned. Its fun to see what things still remain the same in the languages. And heres to those who ‘sucked it up’ and continued the learning process in this field of study. I admire it and enjoy reading about it. THanks again Shamus, and to your pals that add thier own knoledge on this subject. Its fun reading for me :) Time for the Stupidest Comment of the Day: “How does the computer know what the code means?” Surely the microchip doesn’t understand the word “print”. Sorry. Assuming you’re serious, and not just making a funny, see that bit of Assembly code up top? There’s a very complicated program called a compiler that translates the basic code (or the C++ code, or the Python code, etc.) into that code. It does the heavy lifting so you don’t have to. As Shamus mentioned, the Assembly code is the language the processor speaks. Further pendantry: Assembly still has to be assembled, by an assembler, before an actual binary executable is produced. Well, same question then. Before there was assembly code, how did they program the computer such that it understood assembly code? The assembler is the compiler for Assembly. Someone wrote in direct machine code a program that took Assembly commands and translated them back to machine code. Early programmers, the very first ones, wrote directly in machine code – binary codes, simple commands that manipulated bits in memory and produced results. To understand why assembly “works” (or, rather, why the 1s and 0s (the machine language) it so closely corresponds to work), you have to understand how the processor on the machine works. You don’t program a computer to know assembly (or, rather, the machine language), the computer understands it by construction. Like the line “mov edx,len” might really be (by the way, this binary is made up, not even close to real – for example, in reality, these would be at least whole bytes, not nibbles as I’ve shown. And, really, the first two codes might be combined in some clever way): 0001 0001 1010 the chip on the machine gets fed ’0001′ that puts it in a ‘state’ where it next expects to see a reference to one of the tiny memory buffers on the chip. Then it sees ’0001′ which (in my silly example machine language) corresponds to the ‘edx’ register). Now it’s in a state where it next expects to find a memory address. ’1010′ is fed in, so it looks in the 10th byte of memory (this computer only has 16 bytes of memory. yipes!) and copies that memory into the edx register. All of this because the chip itself changes state with each input of bits. It isn’t programmed to have these states, it’s built to have them – you could, given a diagram of the chip, follow how the ’0001′ toggles a couple flip flops as the voltage goes down the ‘wires’ (traces in silicon. or something more advanced than silicon these days). Essentially, assembly instructions correspond to bit strings (for instance, on a 32-bit processor, a series of 32 ones and zeroes in a row). This is what the CPU actually acts on. As a gross simplification, consider that the CPU understands that a string of bits is an Add command because the first 4 bits are all ones, whereas a Subtract command would be 4 zeroes, then the remaining 28 bits contain data like the two numbers to be added and the location in memory where the result should be stored. Now, before assembly languages existed, a programmer would have to somehow manually create these strings of bits, and have the CPU execute them (I have no idea how they did this back then ;P). I assume that this is how an assembler was written. They literally toggled switches for the next byte, and pushed a button to process the “next clock tick”. Then someone made punch card readers to automate that… Yah. These days we measure millions or billions of cycles per second, back then it was seconds per cycle. Fun stuff. Glad I started after there were keyboards and disk files to store the code in :) I was going to guess punch cards. ;) “Real programmers use bare copper wires connected to a serial port” :P Oh yes, the days of the altair 8800 with its switch interface and 7-segment LED display come back to mind. Yes, in the old days people actually worked like that. Keyboards and crt monitors were unheard of except for the big multi-million dollar corporations. If you were a hobbyist you were lucky to have switches, and a display like a cheap four-function calculator. How did it you manually create the strings of bits? Well, back in the day (you kids get off my lawn!), there were coding sheets. They were exactly one instruction wide, marked into bits, and had columns for each field in the assembly instruction. For example, the first 5 bits may be the opcode, next the first operand type, then the details of the first operand, then the second operand type, and so on. Those were filled out by hand in binary. Repeat for every instruction in the program. Then they had to be entered into the machine, at first by toggle switches. Set 8 switches, press the enter button, go to the next byte, repeat. As you may guess, one of the very first programs written for most machines was some way to read the program from a paper tape, punch cards, or other storage, so you could stop flipping switches. :) Once you had a working system, you could program it to read text and output binary – that was an assembler. The difference between an assembler and a compiler is that the assembler ONLY converts from text to binary and back. The text version of the assembler has to have all the same fields that the coding sheets did. They were just written in something that a human could learn to read. Cue horrible memories of coding a Z80 in machine language to produce saw-toothed waves back in 1982 for my Physics 111 lab at Cal. (Shudder.) The worst thing about keying in the hex code was that if you missed an entry, suddenly a memory reference would become a command or vice versa, and off the pointer would go to gibberish land. Debugging was non-existant, and you just had to keep trying to re-enter the code until ou got the chip to do something. Needless to say, the experience scared me away from low-level coding forever. Minor nitpick: An n-bit processor doesn’t mean that each instruction is n bits – for example, Itanium was a 64-bit architecture, and contained three instructions in 128 bits. Good point, thanks for the correction! That’s what the Compiler does, actually. The compiler’s job is to translate the language you understand – “print” – into the machine code that creates the effect you desire. Compiled code generally only runs on a specific subset of machines – those that understand the particular machine code the compiler created. You can take your “Print” program to any machine, compile it, and get the same result, but if you took the compiled code from a PC to a Mac, it wouldn’t work at all, because Mac doesn’t speak PC. That’s not a stupid question at all. Asking that question, over and over at each level of explanation, is how I ended up with a degree in hardware instead of software. Gnagn has the basics right, so let me just add one followup and get even more pedantic. Assembler is not just one language. There are as many different types of assembler as types of processor. The main CPU in your computer speaks one version, which is different from the computer in your car engine, which is different from the one in your microwave, which is different from the one in your modem/router, which is different from… You get the idea. But for all of those different assembler languages, the Basic/C++/Java code is always the same, so the programmer doesn’t have to care what the assembler looks like. This was the original reason for high-level languages, before the Intel processors got so common. The differences can be hidden by the compiler, which reads the common high-level code and translates it to the specific binary assembler code for the kind of processor you actually need. The compiler is what allows someone to be a “programmer” and not have to get separately certified for every unique processor type in existence. Not to mention, it saves us all from having to write in assembler. :) NO! I was promised I would never ever have to remember PAL-Asm existed again. The post right before this one in the RSS reader was from Lambda the Ultimate, and I managed to mix them up. When you described Java as “slow, really slow” I thought, “Holy shit, the comments section will be insane.” Just mentioning Java on LtU is enough to spark a flame war, let alone calling it slow. But no, it was d20, so the comment thread was mostly sycophantry. (Also: heck yes full text RSS feed) Yeah, I’m not seeing sycophantry here on the topic of Java. I’m seeing polite disagreement on the issue of whether Java is ass slow, which the majority of commenters seem to have decided it is not. Sidney: That’s why the assembly code exists – so the computer doesn’t need to know. The C gets compiled into basically that exact code by something that understands print, and the BASIC gets interpreted (or sometimes compiled) by something else that knows what print means. Shamus: I disagree on your Base 6 example. I think the code for printing that out would be considerably easier in BASIC than in C, because you’re basically going to be writing the same things (take the number modulo 6, put it in the next slot to the left, and recurse on the number divided by 6), but of course BASIC makes things like that much easier than C (how much space do you malloc for the string? In BASIC you don’t care). Actually, it’d be pretty easy to do in either if you just wanted to print it and ignored the fraction part. void printbase6(int num) { if(0 == num) return printbase6(num/6); printf(“%d”, num % 6); } I bet BASIC would be easier for writing the fraction part just because C makes a lot of things harder than they should be. Not a bad explanation. I have some things to add: You say that C/C++ seems to be the sweet spot for complexity vs simplicity. I believe that C/C++ don’t so much hit “the” sweet spot in complexity vs simplicity rather than hit “every” required sweet spot, from kernel to high-level GUI application programming. In fact, it illustrates most magnificently the drawbacks that a unique lingua programmatica has: integrating every feature for everyone results in something that is only really understandable by seasoned programmers, who will only use a small subset of functionalities in any given program. You could conclude that, in the end, there is no “best” programming language, because the criteria for determining best depend on the design goals, time constraints, programmers experience, etc. C is the English of programming. Like English, it’s flexible enough to cover most concepts, and if there’s a concept it can’t cover, it will simply steal the concept from some other language and pretend it was there all along. Most people can grasp the basics of both languages with a bit of schooling, but it takes years being immersed in the language to truly grasp all its nuances and call yourself fluent. Echoing comments above – Java is really not slow once the JVM is up and running. C/C++ can be faster, especially on low-level stuff, but Java is in general a lot more useful with it’s libraries nowadays. @Sydney: The code goes through a program called a compiler, which turns the instructions into 1s and 0s that the processor can execute. The binary file is what is executed, not the text file. I want to add that C is actually not that much faster than Java any more. Years ago, it was. By now, not so much: (The only thing that could be called “slow” is Python3, everything else is pretty much similar) On average, it is less than a factor of two. To someone in computer science, a fixed factor is nothing, we are usually interested in orders of magnitues. You could essentially just use a machine that is three times faster, and program in Java. This is often way cheaper than writing code in C, because C is more complicated and therefore more error-prone, which means that it takes that much longer to finish any given task. And since even a single programmer-month is more expensive than a dozen computers (and the computers stay with you for more than a month to boot) this more often than not makes the “easiest” language a good choice for most tasks. Instead of throwing money at a problem, we beat it to death with processing power. :) Additionally, writing the same code in a higher-level language (such as C# compared to C++) is not just “easier”. In C++, you have to write your own memory management system. In C#, you do not have to do that, but instead you can spend the same amount of time on optimizing your code. Assuming infinite time, the C++ code will (nearly) always end up faster. But assuming limited time (and realistically, your deadline was last week), you will often end up with optimized C# code compared to unoptimized C++ code, because the C++ guy spent all his time writing stuff the C# guy got for free. I dare you to take a single hour and implement and tune a simple application in Java, and once in C++. Your Java version will most likely run faster, because it can use sophisticated algorithms and optimizations and be properly tested, while your C++ version will be pretty much bare-bones, if you can even finish it in this very short time frame. And it probably crashes ;) But most people do not choose language by listening to reason, but rather by “I’ve always written my code in [antique monster]! There’s no reason why we cannot use it for this project!” I’m 50% graphics programmer. I’m pretty sure I’m not the victim of dogma when I insist that the speed advantages of C++ are worth the cost. Sometimes those “trivial” speed differences are really, really important. And you need access to libraries / SDK’s that won’t be available to Java. You should check out the XNA Framework, Shamus. C# is of course slower than C/C++, but I find writing in it really satisfying, for some reason, and ironically enough I hated Java back in school… Edit: Btw, I don’t mean this in a “C# will change your mind” way at all, I simply mean you might be interested to check out XNA out of curiosity or to experiment, since I know from some of the programming projects you’ve written about that you like to do that sometimes. (Edit: I worded this poorly, and I think it may come off as an insult. Please don’t take it that way.) Then say that. It’s a trade off either way, and what constitutes “Really slow” depends on the problem space. Using something besides C for graphics is probably a bad idea, but if you are working on a web app, then Java, or something like it, is great. Heck, even Ruby is fine unless you are planning to become the next Twitter. Uh. I think it’s better for Java programmers to not be so thin-skinned than to add a bunch of qualifiers that the target audience of this post will not care about in the least. (This is for non-programmers, remember.) I spend a lot of time in the graphics area, so to me, Java IS really slow. :) (And to be fair, I didn’t hear about how much the speed gap had closed until this thread. I tried Java about 4 years ago and concluded the differences were too extreme for me to spend time getting to know the language better.) Shamus, I think part of this is that Java is still very much a language that is growing, developing, and becoming more and more optimized. While C and C++ constantly see the addition of new libraries, they are older and more mature libraries for which speed improvements are likely harder won (in terms of compiler optimizations and whatnot). Because Java is JIT compiled code and Java compilers are comparatively young, there is, or at least was, apparently a good deal of performance yet to be wrung. At the actual language level it’s a fine, high quality language. At the compiler level it has seen much improvement. So while it may not be the preferred language for an area as twitchily performance dependent as 3D graphics, it performs quite well in many other areas. I think Java has established it’s longevity and isn’t going anywhere. And it’s certainly not the whipping boy it was when I was learning it in 1999. If you do any work that’s not 3D graphics dependent you may wish to give it another chance. You may be pleasantly surprised. I’m a C#/ASP.NET programmer, actually, but I get your point. However, if the goal is to educate non-programmers, in a broad way, then mentioning performance at all doesn’t seem all that useful, especially next to your good VB example. Maybe something like “Often used for server applications”, or something like that, would be better? Not sure. Regarding your parenthetical note, I haven’t used Java since college, (except as an end user, and even then, only sparingly). At the time, it seemed to offer some benefit over C++ in that “everything” (but not really) was OO, and it had built in memory management. These days, I’ve seen and used better, more cohesive, and just in general better designed languages. Java seems to suffer from a lack of an identity. (C# does to, but it seems to have learned, to some degree, from Java’s mistakes.) My information about Java is out of date at this point, but I do read things occasionally about Java, and I never see enough interesting stuff there to bother trying it out again. I wouldn’t turn down a job, just because it required Java, but I’m not itching to use it (or C# for that matter) for a personal project. The reason we Java programmer get a little twitchy is that you were so dismissive of java that new programmers would be completely put off learning it. It’s as if I described programming, used Java as my natural language of choice and then mentioned C at the end as ‘unnecessarily low-level and non-object oriented’. That sentence may have some elements of truth to it, but it’s more than a little unfair to C and would discourage people from learning it Let me just say though, as a guy who professionally programs in both Java and C++, that no student should ever study Java until their last year. It’s too much like BASIC in that it makes it too easy to take shortcuts without actually understanding what you are asking the processor to do. At my university we did a whole year of Java before touching C++. I found it to be a perfect way to go about it because we learned OO concepts and how to structure and write programs without needing to worry about memory management and with far more useful compiler error messages than you’d get in C to get us up and working faster. The rest of the course was in C++ where we could really dig deep learning to write memory systems, optimize code, deal with preprocessor macros etc. I’ve been working in the games industry for nearly 2 years now and firmly believe learning languages in the order I did made it a very easy transition. Don’t you think it is a lot easier to first learn how to use something, and then learn how it works on the inside? but if you are working on a web app, then Java, or something like it, is great Please, nobody do this. Maybe it’s great for you, but having to deal with some huge Java-laden webpage on a lower-end machine sucks. (Especially when I have to use different browsers for different tasks because the site is differently buggy in each one. This is what I’m talking about. That system is great… for hurling invective at.) Unless you’re making something just for yourself, I mean. Then I guess you can do whatever you want. Perhaps I didn’t phrase my point well, but I wasn’t referring to Java applets, or client apps. I meant using Java on the backend, and rendering HTML. Javascript is a different issue, but if that’s causing performance problems, then you have done something seriously wrong. When I work on personal project, I prefer minimalist Javascript, if I use it at all. I agree. Generally, for web development I think the language of choice should be no lower level than Java or C#, i.e. managed code with a level of hard abstraction from the bare machine (no pointers or malloc). Assuming that you’re talking about OpenGL, then it’s all made available by the JOGL and LWJGL libraries. It’s not an ideal solution (and can be quite slow), but the Java Native Interface can give you access to just about anything. Automatically generating Java, Python and C# bindings for a C++ library is what I’m working on at work at the moment. And another thing… If you native compile Java (such as with Excelsior Jet, which my company uses for security reasons) then you get some additional speed increase as well, and completely loose any penalty for calling native code. One last thing… I’m actually starting to get interested in Objective-C, which seems to have a lot of the benefits of C++ and Java and few of the downfalls. It’s fully native, object orientated, can directly call C and C++ code and has optional garbage collection. Why would you need to work on your own language bindings when there is SWIG? I’m using SWIG, but there is a non trivial amount of work to be done to actually implement the input to swig. Especially when your build system is CMake… A fair analysis if (and only if), you actually need the features C# provides that C++ doesn’t (such as memory management). I wrote a compiler (in college) in C++, and didn’t malloc a thing – I had a few fixed sized buffers to contain the next symbol and wrote my output directly to disk. The memory management in C# wouldn’t have bought me anything, so I had the same amount of time to optimize as the C# programmer would have had. :) What, what?!? For my job, I’ve had to program in Java, C, and C++ (mostly the latter) so … “This is often way cheaper than writing code in C, because C is more complicated and therefore more error-prone, which means that it takes that much longer to finish any given task.” Um, syntax-wise, I don’t see all that much difference, except for pure C not having objects. Objects — and everything being such — are often more complicated than just having a function to call, and Java has it’s own peculiarities (only passing by reference, for example) that can complicate certain things. I don’t see how C, therefore, is inherently more error-prone or more complicated than Java is (we’ll get to memory management later). “Instead of throwing money at a problem, we beat it to death with processing power. :) ” This only works if you can convince your USERS to buy new machines. Sometimes, that isn’t possible. And with really, really large software suites, if all of them require that you might have a real problem in that your inefficiencies add up process-by-process to an utterly ridiculous level. “In C++, you have to write your own memory management system. In C#, you do not have to do that, but instead you can spend the same amount of time on optimizing your code. ” Huh?!? Using “new” and “delete” doesn’t work for you? SOMETIMES, a new memory management system is required. In some cases, that might not have been required with something like Java. But in a lot of cases, that new memory management system is written BECAUSE the default system simply doesn’t work. Thus, C++ would win in those cases because it LETS you re-write that memory management system to do what you want, and let’s you take the consequences. Otherwise “x = new ClassA()” and “delete x” works fine. There are issues if you forget to delete the class you created, but then again at least it definitely gets deleted when you don’t want it anymore. “Your Java version will most likely run faster, because it can use sophisticated algorithms and optimizations and be properly tested, while your C++ version will be pretty much bare-bones, if you can even finish it in this very short time frame. And it probably crashes ;)” And you aren’t using libraries in your C++ version to get pretty much what Java gives you because … why, exactly? Using libraries lets you use those same algorithms and optimizations, with the same amount of testing. I have no idea what C++ code you have that doesn’t allow for this. Well, Java MIGHT come with more standard jars, but that’s about it as far as advantage goes. I’m not saying that C++ is the best language to use. My view on it is this: Java does everything for you, C++ gives you control. In many cases, for very basic functionality, standard libs and jars gives you what you need for both. Java might go a little further in that, but because a lot of those are so tightly intertwined it’s often VERY hard to change the behaviour if it doesn’t suit you. C++’s advantage is that it is, in general, pretty easy to do that if you need to. Now, that also sometimes makes it easier to screw-up, since C++ won’t tell you that you are screwing up until you run it. I prefer more control, so I prefer C++. Python’s also cool for quick work where I don’t need graphics. But I can see why people like Java; it’s the same people that like Microsoft Word [grin]. I will say that the standardization effort of C++ and the invention of STL really did help the language. I only used C++ in High School, (keep meaning to relearn it) so take this with a grain of salt, but I consistently hear several complaints about C++. 1. Manual Memory Management. The problem isn’t with newand delete. It’s with having to always call them your self. Yes, it’s deterministic, which is good, but forgetting to delete your variable when your done leads to a memory leak. A garbage collector is non-deterministic, but it means that memory management is one less thing to worry about. How big of a deal this is probably depends on the project. 2. The surface area of C++ is so large that everyone ends up using a subset of the language features, and it is a often a different subset. This is probably true for other languages as well, but I get the impression that it is really bad for C++. 3. The syntax itself is needlessly complicated, so e.g. it’s hard to write parsers for it. Like I said, I don’t use C++, so I can’t judge if these issues are accurate, but I do get the impression that a lot of the complaints amount to whining that a hammer makes a really bad screw driver. Nondeterminism isn’t what makes a garbage collector :) There are C++ libraries that somewhat relieve you of having to do manual garbage collection – Boost’s smart pointers, for example. The problem is that reference counting doesn’t catch cyclic dependencies (so there is still stuff you need to watch out for and manually free), and that a lot of the smart pointer syntax is incredibly arcane and it’s easy to mistakenly add an extra addref or release somewhere. 1) Yep, that’s the problem I mentioned: having to remember to delete it (and preferably nullify it) or else it’s a memory leak. Mostly my reply was aimed at needing to write your own memory management system, which I took as something far stronger than “remember to delete after your news”. 2) Same problem happens with Java for certain. A lot of people on the project before me used GridBagLayout for the GUI work. I had a hard time getting that to work out, since it resizes its grid according to what I ask it to stick in. After discovering that other people struggled with it, I used SpringLayout. The more variety in your libs you have, the more likely it is that everyone will pick their favourite and use it. And that’s not even including things like window builders … 3) Comparing it to Java or even Python, the syntax is remarkably similar. I knew pretty much what everything did before learning them because their syntax matched C’s and C++’s so well. Other languages might be better. I was really not going for syntax, which is really the same in nearly all OO-languages. C++ is much more difficult to get right because of things such as these: - No garbage collection. Seriously, freeing all your memory perfectly and correctly is a ton of work when projects get big and does not improve performance by much, compared to a GC. - Segmentation Faults. In Java, you do not have to bother with arrays, you can just use templated Lists (though I hear the C++ people have a library for that too), which will only go into pointer-nirvana when you make grave mistakes and offer very practical accessors such as for-each loops. And even if stuff goes wrong, it is easy to debug or handle. - Hard Typing and no pointer arithmetic. It is very easy to mess up a construct along the lines of *pointer& in C. Since you are not allowed to do such things in Java, you cannot make mistakes and that means you do not have to debug such problems. - It is incredibly easy to write incredibly ugly code which nobody else can understand, because there are twenty billion ways to do every simple thing and another twenty billion short hands which are hard to read. Sure, once in a blue moon you actually need that functionality, but at the same time, it would be a lot easier if your every day code was written and understood twice as fast. And if you write twice as fast, you get to do ugly hacks twice as often, and we all love to do those, right? :D A programmer spends the majority of his time debugging, and that means that code that can be read and understood quickly is incredibly important. C++ is really bad at that. That said, I am not much fond of Java either, with its horrible Swing-layouts and sometimes rather complicated ways of doing things: Creating a new, empty XML-document takes four instructions instead of one, and basically requires you to look them up every time you have to use them. ;) That said, the language I am currently learning in my free time is Objective C. “I was really not going for syntax, which is really the same in nearly all OO-languages.” You should try F# (yes, it’s OO, because it’s just as multi-paradigm as C++, just the paradigm “functional” on top of it). You pretty much have to learn like 80-90% totally new syntax. Good thing is, the syntax is still pretty good to understand when reading. Example: type Person(_name: string) = let mutable _name = _name member this.Name with get() = _name and set(name) = _name <- name member this.Greet someone = printfn "Hello %s, my name is %s!" someone _name (Yes, F# reintroduced the good old printf family of C-functions, just with real built-in strings instead of pointers) For 2), I actually meant language features specifically, not API, but I suppose they amount to the same thing. For 3), yes, it is fairly similar from a programmer’s perspective, but what I was referring to, poorly (I couldn’t think of the right word), was that C++ has a context-sensitive grammar, which leads to undecidability, and really nasty errors. (The guy who wrote that site seems to really hate C++, but it comes up a lot in discussions. I haven’t seen a rebuttal of it, but that doesn’t imply that it’s correct.) Then again, you know the saying: There are two types of programming languages: those that people complain about, and those that no one uses. I was trying to work out where to jump in, and here seems as good a point as anywhere. I don’t have time to make a proper post, and most people have done great already, so have some bullet points: - C still cheaper than C++ (barely) - Java pretty fast nowadays, esp. with JOGL and JNA - STL not great for portability (much worse than Java) - Neither Java nor STL are good enough for high-performance apps (i.e. games). Often need to write own containers for specific problems, avoiding cache misses etc. - Garbage collector is a pain (Java, C#), but can be worked around - C# as a scripting language is lovely (interop) - C#/XNA woefully inadequate on the XBox 360 (Cache misses for managed memory, mark-and-sweep garbage collection churns on an in-order processor) - I’ve used C++, Java, C# and Python (and BASIC) a *lot*. I love them all, and assembly too. But not VB (shudder). >> The only thing that could be called “slow” is Python3 << That just depends on how many languages are measured :-) You only looked at measurements made on x64 allowing all 4 cores to be used. More languages were measured on x86 forced onto just one core. (And ye olde out-of-date measurements from years ago included even more language implementations.) >> less than a factor of two << Compare Java and C programs side-by-side. >> In C++, you have to write your own memory management system. << Really? Why wouldn't you re-use a memory management library written by someone else? Why don’t we all speak English? As you mention languages have different purposes. It’s a trade-off between quickly programming something and speed. Speed is becoming less and less of a concern these days. Our GUI is written in C#, our server backend in C++. It really doesn’t matter if a language is “slow” for the GUI side. None the less I’d say speed doesn’t matter much these days unless if you’re working on embedded devices or kernels. Else? Go for a higher level language, you’ll program a lot faster. Grahams story is indeed nice. Since they were competent in a higher level languages they could implement features faster and provide eadier, more maintainable code. And that’s why English is spoken so much worldwide, isn’t it? It’s so easy to pick up, not too many prescriptive rules, little in the way of conjugation. The trade-off there is that it’s a lot easier to speak it than to understand it, precisely because of the “fast and loose” feel of the language. No, it’s not. In fact, English is one of the more difficult languages to learn. It’s got a lot of rules and, perhaps more importantly, a lot of exceptions to those rules. It’s not the hardest language — some of the American Indian languages are harder, and the major Chinese dialects are both tonal and ideographic, making both speaking and reading them a grueling process to learn. But it’s up there. The reason it’s so widely spoken is because of geopolitical, economic, and cultural influence. It was the language of the British Empire, which came to dominate most of the globe by the end of the 18th century, and it’s the language of the US, which has been reasonably influential since World War II or so. For similar reasons, in ancient Rome, the dominant language among the educated upper classes was… Greek. OT, more or less: this is one of the most reasonable and even-handed discussions I’ve ever seen on the Internet. Thanks so much for posting this! Now I want to flood your questions page with dumb non-programmer questions about programming. I’ll restrain myself. For now. I kind of like “dumb non-programmer questions about programming” personally, it’s always an interesting challenge to explain something about programming in a straightforward and clear manner. A lot of the time I think we as programmers underestimate how arcane some of the stuff we say can sound. Bear in mind that what makes c easily able to do the magic thing with the printing specially-formatted output is in the #include <stdio.h> not c itself. BASIC is similarly extensible, even at some pretty primitive versions, via the DEF FN functionality. As a budding programmer, I’m desperately trying to glean some sense of what languages I should learn from all this. I’m getting the impression that programmers are a completely conservative lot, and I better learn some powerful languages soon, or I’ll be jaded and forever stuck with an inferior language if I go with the popular stuff. I really don’t know, I’m not too into the industry, history and platform-dependence, I just want to code stuff. Python is a good place to start. It’s a bit of a toy programming language, and it tends to encourage really bad programming practice in some cases, but it’s very easy to pick up and very fast to code. It’s also some use in web programming and an increasing number of actual applications are being written in it. If you want to program for windows you probably want to be looking at C# and/or C++. I’d start with C#, it’s a blatant knockoff of Java and it maintains a few of C++’s more dodgy design decisions, but an easier language to work with. If you want to program for Mac learn Objective-C. Here, it’s the best option by far. If you want to program for the web then Java and Ruby are your best bets, though Python and Groovy* have some utility as well. If you’ve got games on your mind… that’s a tricky one. C / C++ will give you the performance, but will also make your life a lot harder. Java has pretty good support for 3D graphics (see) and is good language for writing any AI (I did my PhD using it and it needed 3D graphics and a lot of AI). Likewise, C# has pretty good support for building games, XNA is a good place to start. *Groovy is my personal favourite scripting language. You will be jaded as stuck with an inferior language no matter what language you actually chose. As demonstrated here: It really doesn’t matter what language you pick as long as it gets the job done. The hight of the hurdles for different tasks depends on the language you use but with an affinity for programming and experience you can overcome these hurdles in a reasonable time or pick up another language which can. As a programmer, you will sooner or later have more then one language under your belt anyway. The first few languages you learn are the hardest. Everything after that is easy. I’m suspicious of any professional programmer who isn’t comfortable in at least 3 programming languages. So where to start? A common concern for new programmers, but it turns out that it largely doesn’t matter. What’s more important is to just start. My recommendation would be to look to what you want to accomplish, and look what languages people in that area tend to use. There is probably a good reason, typically either the language is innately well suited to the task, or have good libraries for the task. In the long run, you’ll want to learn enough languages to cover the range of techniques. My really quick and dirty list: Object Oriented: Java or C++. C# or Objective-C are also fine, but tend to cluster more strongly around specific companies offerings (Microsoft and Apple). Object oriented imperative languages are where most work is being done these days. Scripting/glue language: Python. Perl or Ruby are also good options. Most programmers end up doing lots of glue work or one-off work, and a scripting language really speeds it up. Imperative (notably, sans-objects): C. Maybe Pascal or Fortran. Non-object oriented imperative languages are disappearing, which is a shame because working in one sheds a lot of light onto object-oriented programming. Functional: Lisp or Scheme. When you start to really “get” functional programming, it opens your mind up to lots of useful techniques that apply even outside of functional languages. I would add that it’s important to learn an assembly language at some point. Knowing exactly what the computer is capable of, and what’s just being abstracted away by your choice of high-level language, stops you doing silly things like for(int i = 0; i < arraylen; i++) strcat(mystring, array[i]); I think we can add to that a good grasp of algorithmic principles. This way you get all your bases covered: what is theoretically possible and how it works in practice. “If you all have is a hammer, everything looks like a nail.” A programmer that can’t learn a new language in a couple of weeks is like a carpenter that can’t learn a new tool in a couple of minutes. Hopefully, the programmer (or carpenter) in question is merely inexperienced, because that is something which fixes itself with practice. If you’re looking at a programmer’s resume and it only includes one language, don’t hire them. Even if it’s the language you’re hiring programmers for (unless you purposefully want a newb so you can mold everything they know, muhuwahaha. er. ahem) And, really, learning a new syntax is trivial (except maybe APL). The reason it takes time to learn a new language is you have to pick up on idioms and explore the libraries. Although, these days, Google makes that a lot easier than it was when I started :) I’m not sure why, but I feel like this article should have a reference to Lingua::Romana::Perligata. Damian Conway is awe inspiring, isn’t he? :) This reminds me… How does the optimization of your website fair, Shamus? Been hit with another wave of traffic that would have crashed the old site off of Reditt or something yet? Sadly, no traffic spikes in the last month or so. Just get Stephen Fry to twitter about this place :P Where does Prolog stand on the complexity vs. simplicity scale? DON’T DO IT! Prolog is a different mindset. The closest thing it resembles that most (*n*x) programmers deal with is writing a “Makefile” – you write rules, and ask the database questions and it tries to deduce the answers from the rules. You don’t use it to “write programs” – it’s not something you’d make a web page with. It’s a deduction engine and has limited use outside of that field. The best trade-off I’ve found is Cython, a branch of Python that’s closely linked with its C framework. You can do anything you’d normally do in Python, but it’s amazingly integrateable with C, in case you run into tricky things that need C, or would be easier to write in C. It’s very versatile, and generally very user-friendly. To anyone that likes mathematics, logic puzzles, and/or programming: Go to Project Euler. Awesome problems that you solve by programming. Very awesome. Finally, realize this: Chris Sawyer wrote RCT1, RCT2, Transport Tycoon, and Locomotion entirely in Assembly. Worship the man. WORSHIP. Being an amateur programmer, I don’t judge programming languages by adaptability or efficiency. I can devour memory and make it only work on Windows 7 64-bit in Bulgarian, and I’d still be over the moon; my code is based on what I’m doing. At the moment, I’m not very diverse with my languages. For networking, I like Java, albeit I will never use that damn language outside anything to do with sockets and packets. ‘Number crunching’, databases, and other such business practices are lovingly prepared in C++. Go into the indie gaming side of me, however, and it takes a twist towards C# coupled with XNA. Now that I’ve put it on paper(?!), I can see that my choices are mainly based on the ease of the language to do the task I want it to do. I don’t have much pride in crowbarring a fully-working packet sender into C++, but I do have the desire to keep head-desking to a minimum. :) A reasonable programming discussion? This is still the Internet, isn’t it? oO But this may be an opportunity to get help with a problem I have. I’ve tried to learn one or two neww languages recently (since C and Perl are the only things I can work with and I’m interested in new things). However, every single book I stumble upon for whatever language is utter garbage. I’m a learning-by-doing guy so the best way for me to learn a new language is getting a task and a programming reference to accomplish this task. As a hobbyist I have no running projects and all books have either copy&paste examples explaining what they do (which I don’t need because I can handle a reference book and I’m not a typist) or outlandish tasks with no foundation in reality (let’s program a car or otherwise stupid projects; it should be a program that not only runs but accomplishes something useful) Someone got an idea or some recommendation on how to tackle this problem? Because I tried to broaden my horizon a bit for over 3 years now an I’m always falling back to my status quo. Well, if you want to branch into Java, think of a nice web-based app you’d like people to have access to. Only think of something that would work better client-side than server-side. Since Java is very cross-platform you could offer this app or functionality to almost anyone with a robust web browser and Java installed. Structure and Interpretation of Computer Programs is a decent book for learning Scheme. Starts off fairly simply (it is an introductory text after all), but ends up getting you to write a Lisp interpreter in Scheme. You could always look on open-source websites such as Soureforge.net or github.com. Their search engine lets you filter by project language and release status (e.g. coding, Alpha testing, production etc). So you could browse the non-Production projects in a language you want to learn, find a project that sounds interesting, download/checkout the source and see if they have a TODO or BUGS list. That way you can use the existing source as an example of the language and you can extend it for the practise. Btw, does anyone still use BASIC for anything serious? I think a better example of a very high level language would be python or ruby. Also you forget that the abstraction level is not the only factor. Different languages offer different features. Some languages are compiled, some are interpreted and some offer both. Some languages are procedural, some are functional, others are object oriented. There is static typing and dynamic typing. Then there are logical languages like prolog. At the end of the day the speed and optimization is only a fraction of the argument. For example, if you compare Java, Jython and Clojure they will all likely have similar performance. They all compile into Java bytecode and run on the JVM. But picking one language over the other is a matter of features and aesthetics. If you want static typing and OO, use Java. If you want dynamic typing and more flexibility use Jython. If you want functional language with lisp style macros use Clojure. It is a very complex question – nevertheless this is a decent crack at explaining it to a non-programmer. Still, you should put a disclaimer there that it is an oversimplification. :) Yes, people use Basic — especially Visual Basic. Note that these days Basic has OO capabilities and the occasional label instead of omnipresent line numbers. You wouldn’t recognize it :) Not sure about Clojure, but Jython has significantly slower performance than Java, slower than CPython, even. My understanding is that one of the main reasons for this is that the JVM doesn’t natively support dynamic typing, and so this basically has to be emulated. Plans for Java 7 include an update to the JVM to make this work correctly. Groovy, which I mentioned earlier, is capable of both static and dynamic typing, which is a nice feature. I think computer languages are to programmers as tools are to carpenters – you need a few, for different situations. (And any decent programmer – not elite, just “normal” – should be able to adapt to new languages fairly easily). I started with BASIC, because pretty much all you can get your hands on at an 80′s elementary school ;) High school was Macs, so you learn Hypercard. In University I was subjected to Modula-2 before getting the true power of C and C++ (and Unix in general). I started Web programming with C++, but once I was out of school webhosting companies had this odd dislike of compiled programs on their servers. (Can’t imagine why…). So it was time to learn Perl (which I think gets a bad rap, to be honest). My current job is VBA with some JScript and batch files. (Mainly because the intended users pretend it’s just an Excel/Access file ;) And just for kicks I’m trying to learn some Java (so I can fix some stupidity Corporate wants us to implement). Never learned assembly, though… Why are there so many programming languages? Why doesn’t everyone just pick the best one and use that? Why are there so many tools? Why doesn’t everyone just pick the best one and use that? You can hammer in a nail with a saw, but it’ll take a while and be a pain to do it. Equally, you can ‘cut’ that piece of wood in half with a hammer, but it’ll take a while and produce a really ugly end product. Programming languages are tools. They’re (mostly) designed with a particular purpose in mind, so there is no ‘best’ language in the same way that there is no ‘best’ tool. The goal is to simply print the worlds “Hello World!”, and that’s it. Print the “word” or “world”. Funny typo, just letting you know. There is exactly ONE thing I like better about C++ compared to Java, and it’s template programming. Which ironically is the one thing most C++ programmers (who are actually mostly C programmers with objects thrown in) don’t use much. Java is probably not worth it for triple-A games programming, but IMO it’s definitly worth using for more indy/retro games. The only disadvantage of Java is if you want to leverage its cross-platform capabilities you need to stick to OpenGL instead of DirectX. At my workplace we do a graphics-heavy program (though not speed critical like an action game) and we’re busy switching our code from C++ to Java where necessary (because we have a client/server architecture, whenever we move functionalities to the client or want to remove cross-platform headaches). OK, don’t have time to read it all today (sadly), but I do have to say one thing about C/C++. Generally, I agree that many languages have their strengths and purposes – your general point in the article is spot on. HOWEVER. C is just plain stupid. It drives me crazy that it continues to be used, almost exclusively out of habit. SURE, it gives you a lot more power/flexibility, and occasionally you need some of that… but there are other ways to get it than a language that allows bloody POINTER ARITHMETIC (among other crazy things). It’s like saying that you really need that 30 inch, 80 horsepower handsaw with no guard – sure, it’s powerful… but there’s a reason none of those (if they even exist) actually see any use. Even if you made a successful case that C hits some kind of sweet spot for certain things (a big if, but I’ll grant it for this argument), why oh why oh WHY is it used for SO MUCH OTHER BLOODY STUFF?!? GAH!!! Edit: I’ve done actual paid work in VB, C++, VB.net, C#.net, COBOL (and Cobol), and bits and pieces in a few other things, and C# is really not much like C other than syntax, but C++ is. Python is on my hobby list, but I haven’t touched much on my hobby list in a while, really. /Edit Just to end this post on a little nicer note, I will point out that there’s really nothing special about the Java language itself (it’s primarily a rip-off from C) – the ability to run multiple places with the same code could easily be (and in a few other cases that aren’t nearly as wide-spread, actually has been) implemented with any language. The big bonus to Java is simply that it’s already been done and the resulting “virtual machine” widely distributed. Hmm… I commented, then edited the comment to add a list of languages I’ve worked in, and “Your edited comment was marked as spam”. ??? I wonder how I did that – honestly, the only thing I could see about my edit that seemed much different than the rest of my post was a few all caps words and words for a couple of the programming languages. Weird. Sometimes my spam filter is just a sadistic imbecile. It will let pass some obvious bit of spam and then eat a perfectly innocent post with no “danger” words and no links. I dunno. In any case: Comment restored. Thanks! Not just imbecile, but sadistic imbecile, eh? Sounds like you should check that code for useful video-game AI teammate code – sadistic imbecile would be an improvement for most of them. I’ve already seen that implemented in at least one game: Army of Two the 40th Day. There are spots where you are supposed to save civilians from the bad guys. When you come up to one of these spots, rather than getting to cover, or shooting back at the guys actually firing on them, the bad guys kill the civilians. Uh… what? Wow, a lot of programmers sure do read this blog! Haskell! That is the language to which my vote goes. One more point on JAVA I was taught it in first year in CS&SE and then they changed course directors and from year 2 on it was C all the way. More relevant, maybe, but when you’ve done your ‘Coding 101′ courses ignoring memory management arriving into year 2 with lecturers expecting you to be up to speed with C memory management is a real issue. I never really got over this hurdle personally (my nightmares are haunted by segment faults and pointers) and struggled through the degree. Most of my friends who stayed in SE work with Java ironically but the whole experience soured me and now I sell PCs for a living! To bring this back on point I think a lot of talented programmers can underestimate how much the core conceptual differences between languages can throw novices for a loop. I still love the core logic of code which is why I find discussion so f programming topics so fascinating. I had a similar experience at Curtin University. LOGO man.. LOGO.. I enjoy reading all this material about general-purpose languages. One think most people would be amazed at also is the crazy variety of languages that exist for very specialized fields, especially academic fields. The wikipedia comparison pages are fairly instructive in that regard. I can kinda understand why, seeing how I think this discussion is primarily focused on languages meant to complete some specific task, but I think this comment thread could stand to be a bit more esoteric. A lot of programmers (in my experience) like to toy with esoteric languages just as fun pastimes, and they’re fun to show non-programmers and reinforce all those movie-based stereotypes about programming (it’s just a bunch of seemingly meaningless symbols, that is). Some examples: My, and probably most people’s, first esoteric language: Brainfuck Only eight instructions, no graphical capabilities (though you could theoretically make a roguelike of some kind, as far as I know), and pretty much everything you ever write in it will be a blast because you actually made the language do anything recognizable. “Hello, world!” as seen by Brainfuck: ++++++++++[>+++++++>++++++++++>+++>+<<<++.>+.+++++++..+++.>++.<.+++.------.--------.>+.>. A more interesting one: Piet A language where every piece of code is literally a work of art. The code is an image, with a cursor that gets its instructions and where it needs to go next from colors in the image. "Hello, world!" as seen by Piet: One that takes the term "esoteric" to levels of pure insanity: Malbolge Named after the eighth level of Hell, the language is so contrived that it took two full years after it was made public in 1997 for any functional program at all to be written, and even then, the program wasn't even written by a human. "Hello, World!" as seen by Malbolge: ('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#" `CB]V?Tx A slightly more hilarious one: LOLCODE IM IN YR CODE MAKIN U LOL “HAI WORLD” LIKE SEEN N LOLCODE: HAI CAN HAS STDIO? VISIBLE "HAI WORLD!" KTHXBYE (LOLCODE has actually been used to for web page scripting, so it is definitely a functional language. It’s also a funny language.) EDIT: I will be moderately amazed if this doesn’t get caught in a spam-filter of some kind. Take the link to a .gif, a ling containing the word “fuck”, the loltalk, the lines of crap that amount to essentially gibberish… Impressive. No, marking as spam is only for those that appear innocent – as Shamus mentioned above, the spam filter is a sadistic imbecile. I’ll see your Malboge, and raise you Whitespace. I’ve never quite understood why programming languages don’t program other languages. Program in the easiest language for the task then output that into assembly. Then compile the assembly and have that language instruct the computer. In theory it would be efficient both for the computer and efficient for the human programmer. But I’m a non-programmer and understand only the very basics of coding. I’m sure there’s got to be a reason why that isn’t done. That’s just what compilers do, actually: turn your high level (easy to write in) language into assembly, and then turn the assembly into machine code… It’s become trendy of late, though, to make programming languages write their assembly/machine code for “virtual machines” instead of the actual chip in the computer, because you can make the virtual machine the same for every computer – meaning you get to compile it once and run it on any machine. But, let us set that aside and address the core of your question, the unasked next question: well, if we compile programs just like that, why aren’t all these languages at the peak of potential efficiency, then? The answer is because the assembly code they generate comes from templates and patterns which naturally express what you wrote in the high level language, and which do not necessarily represent the best possible machine language program you could write for the task. For example, to make a string in assembly (like what Mr Young did at the end of his example): section .data msg db 'Hello, world!',0xa That string contains exactly the number of bytes it needs and no more. However, in _even the most efficient compiled language there is_, the code it generates for a string will be msg db 'Hello, world!',0xa,0x0 The extra byte is so that it knows where the string ends. C is, however, blazingly efficient, and the compiler code is so old that people have taught it all kinds of tricks to speed things up here and there (they call it “optimization” of the compiled code)… It gets worse in the next logical jump from C to C++, because in addition to allocating the string, it’s going to allocate memory to contain data about the “string object” that it’s a part of (probably a couple bytes representing the object ID, several more so it can map object IDs to code, a couple bytes representing a reference count on the string, and so on). And so far I’ve just covered the memory footprint. Even in C, when you call printf(“Hello, world!n”); you don’t get the 9 assembly instructions Mr Young wrote to to perform the print. You get a bunch of assembly to define the function of “printf()” (which has quite a few features, and so generates a lot of code), code to set up the string in memory so that it can call printf, code to call printf… when you jump to C++, you get even more ‘free code’ to go with the ‘extra features’ of the language. If you compile Java straight to assembly, you get even more free code to do the “memory management” stuff people keep bringing up. If you compile a really high level language like Perl straight to assembly (though, to my knowledge, there isn’t such a compiler), then you get Yet Even More ‘free code’ so that it can treat strings as potential containers of numbers and all kinds of spiffy features. and you get all that code even though in each of those languages the program is very, very simple indeed: (in C: #include <stdio.h> void main() { printf("Hello, World\n"); } in C++, the C code will work. I don’t remember it in Java, but I think it’s class Main { public void main() { System.out.println("Hello, World"); } } and in Perl it’s print "Hello, World\n"; Each language (except Java :) ) gets simpler as you move “up” the hierarchy, but each generates more assembly language, as well, to handle all the neat features you aren’t even using in this example program. Whereas a human writing assembly would just generate the 9 instructions needed, because the human knows there aren’t any more features needed. (okay, for some reason I can’t get Word Press to let me insert backslashes where they go, but in the C and Perl examples, there’s a backslash before the final ‘n’) In theory, the compiler could determine which stuff to include – that is to say, only include the “extra” code if the code being compiled makes use of features that require that extra code. Assembly created by such a system would be, in many cases, perfectly efficient (in other cases, the person writing the high-level code would be using features in unnecessary ways, but the compiler wouldn’t know that). Unfortunately, no one has written a compiler like that… it would be insanely complicated to write. That may be true for some languages, but many these days have reflective features that let you modify the code itself, and thus have to be prepared for any eventualities. I say “may” be true, because there’s a lot of past thought that has gone into this sort of thing, with phrases like “NP Complete Problems” which may apply here, but I’m not current on the topic, so I can’t say for sure (I do know that “determining whether or not an arbitrary program terminates in a finite time” is a literally unsolvable problem) In BASIC, the first task would be super-trivial. One line of code. The second task would require pages of code. 99% of your programing time would be spent on the second task, and it would be much, much slower than the first task. You might want to read up on your BASIC, Shamus. Check out a language called FreeBASIC while you’re at it ;) For a concrete example of what puny slow BASIC can do nowadays check my website link, it’s even in OpenGL ;) [...] Lingua Programmatica – Twenty Sided Typical non-programmer question: Why are there so many programming languages? Why doesn’t everyone just pick the best one and use that? [...] Over the last (and I cannot believe I am writing this) 30 years or so, I have written production real world code in a significant plurality of the languages mentioned in this thread, including all of the BIG ones, and several others not mentioned. One can only really understand the value of a programming language in context of its place in history and the understanding of the craft (and I use that word carefully, not a science, and not an art, but elements of both) of programming. The one trend that I see absolutely governing my choice of tools as it has changed over the years is this: human time is more valuable than computer time, in most circumstances (I will not argue that there are exceptions). Therefore, the more the development environment (including the language features like garbage collection, and my latest love, dynamic typing, as well as the libraries, and even the IDE in which the work is done) take care of, the more the human time is expended on the actual business (or scientific, or gaming) project at hand, and not the mechanics. In many programming domains (with the notable exception of Shamus’ one), optimization is too expensive to do except when it is really needed–because humans are more expensive than machines, over the lifetime of an application. I teach my team to optimize -maintainability- over everything else. Again, not appropriate in all domains, but I believe it shows the value and trend of the evolution of tools. The lowest level tools haven’t evolved much since the macro assembler; but the highest level ones continue to be a hot bed of innovation. I code often in C++, C# and Delphi. But Delphi is my favorite. It strikes a balance between awesome ease of use (setting up an interface) and power. I haven’t found anything that I can do in C++ that I can’t do in Delphi. It even has the ability to inbed assembly code on the fly. It compiles super fast (seriously anyone used to any other language will wet themselves at the speed). On the Win32 versions the .exe’s it produce are rediculously small (easily 30 to 40% smaller than other languages). So. Basically. I love Delphi to death.
http://www.shamusyoung.com/twentysidedtale/?p=7452
CC-MAIN-2013-20
en
refinedweb
, This is the latest version of the NFS label support patch set. The set contains one patch which will be removed when it makes it's way upstream from the NFS maintainers' trees. This is the patch to fix a use before init bug in the nfs4recovery code. Changes since the last patchset are listed below. If you want a tree with the patches already applied we have posted a public git tree that is ready for cloning and use. This tree can be found at. You can find information on how to build and setup a labeled nfs at. Features: * Client * Obtains labels from server for NFS files while still allowing for SELinux context mounts to override untrusted labeled servers. * Allows setting labels on files over NFS via xattr interface. * Server * Exports labels to clients. As of the moment there is no ability to restrict this based on label components such as MLS levels. * Persistent storage of labels assuming exported file system supports it. Changes since last patchset: The life cycle management patch has been fixed to return the error from kmalloc up the call stack. The patch use to have a panic in the case of memory allocation failure which was a temporary measure until this was ready. Inode locking was added around the functions in the NFS server code which assign the label to the inode when received from the wire. Memory allocations were changed from GFP_ATOMIC to GFP_KERNEL An bug that resulted in memory corruption when MLS support was enabled has also been fixed. The process label transport mechanism has been removed from the patchset since a new version of it is in the works. This new method provides the security guarantees needed for our purposes while providing compatibility with existing rpcsec flavors and fixing a potential MITM attack against kerberos. A more detailed explanation of the mechanism will be given when the design has been solidified and we have an initial implementation. fs/Kconfig | 30 +++ fs/nfs/client.c | 16 ++ fs/nfs/dir.c | 32 +++- fs/nfs/getroot.c | 44 +++- fs/nfs/inode.c | 69 +++++- fs/nfs/namespace.c | 3 + fs/nfs/nfs3proc.c | 7 + fs/nfs/nfs4proc.c | 489 +++++++++++++++++++++++++++++++--- fs/nfs/nfs4xdr.c | 55 ++++- fs/nfs/proc.c | 12 +- fs/nfs/super.c | 46 ++++- fs/nfs/unlink.c | 12 +- fs/nfsd/export.c | 3 + fs/nfsd/nfs4proc.c | 35 +++- fs/nfsd/nfs4recover.c | 6 +- fs/nfsd/nfs4xdr.c | 106 +++++++- fs/nfsd/vfs.c | 28 ++ fs/xattr.c | 55 +++- include/linux/nfs4.h | 8 + include/linux/nfs4_mount.h | 6 +- include/linux/nfs_fs.h | 26 ++ include/linux/nfs_fs_sb.h | 2 +- include/linux/nfs_xdr.h | 7 + include/linux/nfsd/export.h | 5 +- include/linux/nfsd/nfsd.h | 9 +- include/linux/nfsd/xdr4.h | 3 + include/linux/security.h | 88 +++++++ include/linux/xattr.h | 1 + security/capability.c | 29 ++ security/security.c | 32 +++ security/selinux/hooks.c | 141 +++++++++-- security/selinux/include/security.h | 4 + security/selinux/ss/policydb.c | 5 +- security/smack/smack_lsm.c | 10 + 34 files changed, 1315 insertions(+), 109 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at Linux is a registered trademark of Linus Torvalds
http://lwn.net/Articles/309026/
CC-MAIN-2013-20
en
refinedweb
ASP.NET Configuration .NET Framework 1.1 The ASP.NET configuration system features an extensible infrastructure that enables you to define configuration settings at the time your ASP.NET applications are first deployed so that you can add or revise configuration settings at any time with minimal impact on operational Web applications and servers. The ASP.NET configuration system provides the following benefits: - Configuration information is stored in XML-based text files. You can use any standard text editor or XML parser to create and edit ASP.NET configuration files. - Multiple configuration files, all named Web.config, can appear in multiple directories on an ASP.NET Web application server. Each Web.config file applies configuration settings to its own directory and all child directories below it. Configuration files in child directories can supply configuration information in addition to that inherited from parent directories, and the child directory configuration settings can override or modify settings defined in parent directories. The root configuration file named systemroot\Microsoft.NET\Framework\versionNumber\CONFIG\Machine.config provides ASP.NET configuration settings for the entire Web server. - At run time, ASP.NET uses the configuration information provided by the Web.config files in a hierarchical virtual directory structure to compute a collection of configuration settings for each unique URL resource. The resulting configuration settings are then cached for all subsequent requests to a resource. Note that inheritance is defined by the incoming request path (the URL), not the file system paths to the resources on disk (the physical paths). - ASP.NET detects changes to configuration files and automatically applies new configuration settings to Web resources affected by the changes. The server does not have to be rebooted for the changes to take effect. Hierarchical configuration settings are automatically recalculated and recached whenever a configuration file in the hierarchy is changed. The <processModel> section is an exception. - The ASP.NET configuration system is extensible. You can define new configuration parameters and write configuration section handlers to process them. - ASP.NET help protect configuration files from outside access by configuring Internet Information Services (IIS) to prevent direct browser access to configuration files. HTTP access error 403 (forbidden) is returned to any browser attempting to request a configuration file directly. In This Section - Format of ASP.NET Configuration Files - Explains how ASP.NET configuration files are organized. - Hierarchical Configuration Architecture - Explains configuration setting inheritance. - Accessing ASP.NET Configuration Settings - Explains how to programmatically read configuration settings. - Creating New Configuration Sections - Explains how to add custom configuration sections. Related Sections - Configuring Applications - Explains how to use the configuration system to control your applications. - ASP.NET Settings Schema - Presents the members of the ASP.NET configuration system. - System.Web.Configuration Namespace - Documents the classes contained in the System.Web.Configuration namespace.
http://msdn.microsoft.com/en-us/library/aa719558(VS.71).aspx
CC-MAIN-2013-20
en
refinedweb
aio_write − asynchronous write to a file (REALTIME) #include <aio.h> int aio_write(struct aiocb *aiocbp); priority. The aio_write() function shall return the value zero to the calling process if the I/O operation is successfully queued; otherwise, the function shall return the value -1 and set errno to indicate the error. The aio_write() function shall fail if: Each of the following conditions may be detected synchronously at the time of the call to aio_write(), or asynchronously. If any of the conditions: ECANCELED The requested I/O was canceled before the I/O completed due to an explicit aio_cancel() request. .
http://man.cx/aio_write(3)
CC-MAIN-2013-20
en
refinedweb
09-14-2012 09:54 AM As any "good" developer does... I want to try and avoid hardcoding any screen size information in my AIR based apps to ensure that they can work on the PlayBook (1024x600), the BB10 FullTouch (1280x720), the BB10 w/Keyboard (720x720)... and anything else that may ever come up in the future... (even though RIM has indicated they are constraining themsleves for BB10 to the above dimensions as noted here: So in order for this to work... I need to ensure: a.) any default configuration doesn't lock in a size... b.) I need to be able to programatically read in the device dimensions (and know if I need to "rotate" my view) For item (a) I've been a bit confused by the opening line I've seen in documentation for your *.as class files that starts like this... package{ import abc; ... [SWF(width="1024", height="600", backgroundColor="#000000", frameRate="30")] public class MyAppName extends Sprite{ ... } } Although I'll be honest I haven't even tried... can I drop that metadata line? or can I change the values to variables like ${DeviceWidth}, $DeviceHeight}...? or is there a better option? For item (b) I need to be able to read in the actual device dimensions.... (width, height) and potentially "know" how to force the rotation. e.g. for a Game I'm making... it is intended to run in the "Landscape" orientation on the PlayBook (and on a full touch BB10 phone)... and although it really wouldn't matter... I'm guessing I'd prefer the "portrait" orientation for a BB10 keyboard phone (even though the screen resolution would be the same at any orientation. Am I right to be looking at these values for width and height? var width:int = qnx.display.DisplayMode.width; var height:int = qnx.display.DisplayMode.height; and for orientation... this one? var isPreferred:Boolean = qnx.display.DisplayMode.isPreferred; Cheers, Steve 09-14-2012 10:24 AM If you are looking to force the application into Portriat or Landscape mode, you are best off doing that from the xml file instead of in code. Also I believe that it is safe to drop the metadata line (but have to admit that I haven't tried it). 09-14-2012 10:27 AM 09-14-2012 07:44 PM You can drop the meta line and include this in your main constructor: this.stage.frameRate = 30; this.stage.align = StageAlign.TOP_LEFT; this.stage.scaleMode = StageScaleMode.NO_SCALE; The stage size is picked up from the device boundary. In the update display function, you can compare the width and height to determine orientation. Portrait ( w < h ) is "normal" orientation of the device. 09-14-2012 07:47 PM 09-17-2012 11:45 AM Sarah Northway wrote a good article on this topic here -- Cheers, Dustin
http://supportforums.blackberry.com/t5/Adobe-AIR-Development/Avoiding-hardcoding-screen-sizes-in-AIR-apps/m-p/1909743
CC-MAIN-2013-20
en
refinedweb
Today.. The provider source code comes with a buildable VS 2005 Project all setup. Jeff Prosise also wrote 130+ pages of awesome whitepapers that walkthrough the code, database schema, and how they work. You can read them here: The beauty of the ASP.NET 2.0 Provider model is that it delivers rich extensibility and flexibility to the built-in productivity features you get with ASP.NET 2.0. Out of the box with ASP.NET 2.0 you get a secure user management and role credential store (no need to write any database code -- just call Membership.CreateUser() or use the <asp:login> controls and you are good to go). Because you can plug-in custom provider implementations, though, you also have the flexibility to customize the implementations in the future if you want (or adapt them to go against existing databases or stores that you already have with other applications). Code written to the Membership APIs or <asp:login> controls will work regardless of what provider you have configured in your web.config file. To learn more the new ASP.NET 2.0 Security Features, please check out this post I did a month ago. It provides links to tons of content (including a nice 12 minute video you can watch to learn how easy it is to add Membership and Roles to a site from scratch). It also links off to a number of other providers (including Access and MySql ones) that people have already written. Hope this helps, Scott P.S. Earlier this month I blogged about a bunch of the cool ASP.NET releases we were doing this month, but I forgot to mention this one.... Sorry! :-) It has been done, thank you for you help. :) and I posted another question, Did you get it? I'm unable to see anything after installing the msi above. Have tried on a couple of pcs, it says it's successfully installed, but nothing in the folder, have tried dropping to different folders, but no joy, very strange! Hi Keith, The MSI by default installs the files here: C:\Program Files\Microsoft\ASP.NET Provider Toolkit SQL Samples\ Can you check there to see if you can find them? Thanks, Hi Dan, This page contains a bunch of tutorials and information on using the built-in ASP.NET 2.0 security features: Included part way down is an Access provider for membership/roles/profiles that you can use. Hi Robert, You can definitely use the membership provider against a full SQL Server database. The aspnet_regsql utility that comes with ASP.NET provides a GUI based interface for provisioning it. This post walksthrough how to-do this: Hi Mohsen, Unfortunately some of the links on MSDN are temporarily not working. You can find the provider download directly here: One of the most popular features in ASP.NET 2.0 was the introduction of the "provider model" for the Hi Vamsi, I'm actually not entirely sure why the directory names are different. On the bright side, it looks like you still found them though <g>. Scott Hi Rick, Eilon has a sample Custom Resource Provider here: Send me mail if you are stuck with yours and I'd be happy to get a loop going with some folks who can help. Hi Zoran, You should be able to add the files to a class library project, and then add a reference to the System.Web.dll assembly. You should then be able to compile and get it going. Hi Jas, Storing properties about users in the Profile object is definitely the easiest way to accomplish this. You might also want to look at these simple providers that you can plug into your application if you want total control over the database schema used: Hi Saumin, Unfortunately we haven't shipped the source code for the ADProvider yet. Sorry, Code Available in C# for File Downloading The aspnet_Membership_FindUsersByName stored procedure and the aspnet_Membership_GetAllUsers SP extract the entire User/Membership tables (or potentially large portions of them) into a temporary table with an identity column. While this method works great with <100 members, I was hoping to scale it to perhaps 3,000,000 members. I tried increasing the timeout and it performs awful, if at all. Is there a recommended strategy for addressing this situation? Hi Tom, Can you send me email with this question? I can then loop you in with some folks who might be able to help. thanks, I few people have asked for VB versions of the provider source code. I needed a VB version myself, so I converted it. No warranty, but it works well, as far as I can tell. I didn't go to a lot of trouble to include documentation, but if anyone needs a working VB version of the membership provider it is available for download at the link provided. Scott, Has anyone taken these and ported them to use in Smart Client or WinForm applications? I need to do this as I want to use this for our own apps, but if nobody has done it I'll update the code and put it back into the community. Let me know. Thanks. Any chance of getting the ActiveDirectoryMembershipProvider source code yet? We need it desperately! Why no ActiveDirectoryRoleProvider? Anyone know if one is planned? Hi Greg, If you want to email me directly, I can help answer some questions you might have about the ActiveDirectoryMembershipProvider. Are there specific scenarios that you are running into? Also - there is a role provider for activedirectory. Unfortunately I don't have VS on me right now - but if you search in the System.Web.Security namespace you should see a WindowsRoleProvider or something like that. Can you point me towards any source of information about how the ActiveDirectoryMembershipProvider implements it's derived MembershipUser? I need to create a custom MembershipUser for ADAM. Thanks, Phil Hi Phil, Probably the easiest way to see how this is implemented is to use Lutz' Reflector tool here: It will provide you with a C# listing of the ActiveDirectoryMembershipProvider implementation. When I tried to use the code without removing or adding. I get RS and SecUtility can't be used due to private or internal? How can I get around that. Hi Kiryn, You shouldn't see any errors about internal. What class are you compiling and how are you using it? I'm looking to build an Active Directory Profile Provider. Is there an implementation that you know of already? Hi Jonno, Unfortunately I don't know of an Active Directory Provider for the Profile object yet. Let me know if/when you put one together and I'd be happy to point people at it in the future! Hi Scott, Is there a simple way to use an existing SQL 2005 Database schema instead of having to run the aspnet_regsql.exe tool to create a different Schema? I've not seen any articles on this. I've already got a SQL Server 2005 database with thousands of User Login information in a table and need the ASP.NET membership provider to use that table/database instead of a new schema added to my already existing database structure. Are there any good tutorials on this subject? Chris Hi Chris, I'd recommend checking out this set of Simple Membership Providers: It provides a good example of how you can build your own Membership provider that goes against your existing User tables. how run sql in remote control of my sqlserver2005 program for add table to my database in server????(my english is bad!sorry!!) Scott, do you know any web part personalization provider for IDM DB2 backend. Hi Prashant, Unfortunately I don't know of a built-in provider for DB2 databases I'm afraid. Sorry! Hey Scott, Your Blog has been the source of countless "That's It!" moments for me already - thanks. My custom role provider will handle multiple databases on a per session basis (ie the user profile tells me where to connect). All the child DBs will also use the standard ASPNETDB schema within them, so all I really want to do is sneak in a new connection string into SqlRoleProvider on a per-session basis. However, it looks to me that I'll have to re-write the bulk of the code since I don't have access to a sqlConnectionString property. 1. If there's an easier way to insert a new connection string into your Sql Providers on a per-session basis via user.profile, I'd be happy... 2. Since I want to reuse the bulk of your SqlRoleProvider code, I've run into an issue where I can't access your providers SqlConnectionHelper class (Among others): Error: System.Web.DataAccess.SqlConnectionHelper is inaccessible due to its protection level. Will I have to write a my own Data Access Layer for my provider even though it will do the same thing as yours (at least for security)? Thanks in advance, -Logan Hi Logan, I believe there is a way to dynamically switch the connection string - although I can't remember right now exactly how to-do it. Can you send me email (scottgu@microsoft.com) repeating the question and I can loop you in with someone who can help? Hello Scott, Thanks for your efforts. Unfortunately, after installation I am unable to find the source code in targeted location. Can you please help me. Thanks in advance. Murali HI Krishna, You should be able to find the source under: C:\Program Files\ASP.NET Provider Toolkit SQL Samples From what I can see SharePoint 2007 uses the Provider model? I have two domains, we are currently in the progress of migating from "OldDomain" to new "NewDomain" users exist with the same name on both domains. Do you think it would be possible to extend the existing windows provider so that the logged on identity to authenticate users in a domain agnostic manner? Same here, I couldn't see the source codes even in the default path. Help. Hi Kim, Look under the \Program Files\ directory for an ASP.NET Provider Toolkit directory. Hi Mike, I believe you could build a new provider that in turn wrapped the Windows provider, and allowed you to check both domains. I haven't tried it myself - but in theory I think that would work. This is just a heads up to provide a very useful link about .NET provider models and some actual sample
http://weblogs.asp.net/scottgu/archive/2006/04/13/442772.aspx
CC-MAIN-2013-20
en
refinedweb
03 December 2010 19:30 [Source: ICIS news] By Stefan Baumgarten TORONTO (ICIS)--?xml:namespace> The German Chamber of Industry and Commerce (DIHK) said 90% of 1,100 producers that it polled in a recent survey complained about rising raw material prices and increasing difficulties in accessing raw material markets. Just over 50% of firms even feared that they may soon be cut off from important raw materials altogether, the chamber said. DIHK did not disclose how many chemical producers were included in the survey. Manfred Ritz, spokesman for Frankfurt-based German chemical producers group VCI, told ICIS that some medium-sized firms in certain niches had reported problems in obtaining certain raw materials. However, VCI did not currently have sufficient feedback from member firms to say to what extent there was a broad-based raw materials supply problem thoughout the industry, he added. "We have heard from some firms, but we cannot say if there is a general trend," he added. In its recent third-quarter update, VCI noted a "slight relaxation" in raw material cost pressures as oil prices fell, compared with the second quarter. However, DHIK president Hans Heinrich Driftmann said that this year alone, He predicted that raw material prices would would continue to rise next year amid strong demand because of the global recovery. “Reliable and secure raw material supplies are becoming an ever larger economic risk, even though Driftmann said an additional difficulty for German industry was that more and more raw material suppliers insisted on short contract terms - thus making it harder for firms to plan ahead. The chamber called for broad European and international agreements to create transparency on raw material markets and remove barriers to supplies, and it also called for increased research and development into alternative materials and solutions. It also said that However, it warned against further increases in industry recycling quotas, as planned by Earlier this year, BASF CEO Jurgen Hambrecht said that access to affordable raw material was a concern, and former Bayer CEO Werner Wenning has also said that raw material supply would be a key challenge. In related news, an economics institute said earlier this week that The full DIHK survey report is available, in German, on the chamber’s website. ($1 = €0.76).
http://www.icis.com/Articles/2010/12/03/9416686/germany-facing-raw-material-supply-squeeze.html
CC-MAIN-2013-20
en
refinedweb
Seeing your browser's headers using python Saturday, December 15, 2007 There's a very annoying website that won't send their CSS to my normal web browser (epiphany) which makes it rather ugly. However when I use iceweasel the CSS gets applied. Since both browsers use exactly the same rendering engine, gecko, on my machine as far as I know, I thought they must sniff the headers sent by my browser. So I needed to check the headers, Python to the rescue: import BaseHTTPServer class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.send_header('Content-type', 'text/html') self.end_headers() self.wfile.write('<html><body><pre>') self.wfile.write(self.headers) self.wfile.write('</pre></body></html>') return def main(): try: server = BaseHTTPServer.HTTPServer(('', 80), MyHandler) print 'serving...' server.serve_forever() except KeyboardInterrupt: print 'ttfn' server.socket.close() if __name__ == '__main__': main() Running this as root (80 is a privileged port) will show you the headers sent by your browser to the server. It's so simple that it took me longer to write this post then to write that code. Only a pity that it didn't help me solve my problem...
http://blog.devork.be/2007_12_01_archive.html
CC-MAIN-2013-20
en
refinedweb
1 Jun 2008 13:07 Cleaning text to take word frequency True Friend <true.friend2004 <at> gmail.com> 2008-06-01 11:07:38 GMT 2008-06-01 11:07:38 GMT HI I am a corpus linguistics student and learning C# for this purpose as well. I've created a simple application to find the frequency of a given word in two files. Actually this simple application is a practice version in C# of a Perl script a respected subscriber of this list (Alexander Schutz) written for me on my request on this list. I needed it then, now I am trying to programm myself so I tried to implement that idea in C#. I have done that all and it works also but it does not give me 100% frequency of the word as the Perl script does. What I've done is that the application takes three files as input. 1 wordlist which it reads line by line and stores in an array. other two are simple text files which are splitted by c# String.Split() method. I've used an array of characters like ';', ',' etc. The resulting string array was cleaned from such characters but I couldn't get the 100% result. The frequency of most words are less than that of Perl script (which does the same thing). After trying myself I am requesting here if someone can help me. I am attaching both files (Perl script and C# .cs file) so you can examine the code and point out where I am wrong. Regards -- Muhammad Shakir Aziz محمد شاکر عزیز using System; using System.IO; namespace Frequency { class Frequency { public static string[] File1; // array for first file public static string[] File2; // array for second file public static string[] find = new string[50]; // array for wordlist file static void Main() { Run(); // main method } public static void Run() { FileOne(); //invoke all file mthods FileTwo(); Find(); for(int i=0; i<find.Length; i++) // main for loop counts until the lits ends { int count1 = 0; // int for freq in file 1 int count2 = 0; // int for freq in file 2 for(int j=0; j<File1.Length; j++) //sub for loop 1 counts until main's // word is not iterated through it { if(find[i].Equals(File1[j]) == true) { count1++; } } for(int j=0; j<File2.Length; j++) //sub for loop 2 counts until main's // word is not iterated through it { if(find[i].Equals(File2[j]) == true) { count2++; } } Console.WriteLine("{0,-10} {1} {2}", find[i], count1, count2); StreamWriter ss = new StreamWriter( <at> "F:\file2.txt", true); ss.WriteLine("{0,-20} {1} {2}", find[i], count1, count2); ss.Close(); } Console.ReadLine(); } static void FileOne() // get file one by stream reader, put it equal to string, get it to lower and split to array { char[] delims = new char[]{ ' ', '.', ',',';', '"', ':', '(', ')', '[', ']', '\'' }; string path = <at> "F:\AgriAll.txt"; StreamReader sr = new StreamReader(path); string str = sr.ReadToEnd(); sr.Close(); string str1 = str.ToLower(); File1 = str1.Split(delims); } static void FileTwo() // get file two by stream reader, put it equal to string, get it to lower and split to array { char[] delims = new char[]{ ' ', '.', ',',';', '"', ':', '(', ')', '[', ']', '\'', '/', '?' }; string path = <at> "F:\PWE-AllAgri.txt"; StreamReader sr = new StreamReader(path); string str = sr.ReadToEnd(); sr.Close(); string str1 = str.ToLower(); File2 = str1.Split(delims); } static void Find() //get list by stream reader, put it equal to string, get it to lower and split to array { string path = <at> "F:\Agriculture\EditedAgriKeywords.txt"; StreamReader sw = new StreamReader(path); for(int i=0; i<find.Length; i++) { find[i] = sw.ReadLine(); } sw.Close(); } } } _______________________________________________ Corpora mailing list Corpora <at> uib.no
http://blog.gmane.org/gmane.science.linguistics.corpora/month=20080601
CC-MAIN-2013-20
en
refinedweb
From: Greg KH <gregkh@linuxfoundation.org>3.4-stable review patch. If anyone has any objections, please let me know.------------------From: Linus Torvalds <torvalds@linux-foundation.org>commit a2080a67abe9e314f9e9c2cc3a4a176e8a8f8793 upstream.Add a new interface, add_device_randomness() for adding data to therandom pool that is likely to differ between two devices (or possiblyeven per boot). This would be things like MAC addresses or serialnumbers, or the read-out of the RTC. This does *not* add any actualentropy to the pool, but it initializes the pool to different valuesfor devices that might otherwise be identical and have very littleentropy available to them (particularly common in the embedded world).[ Modified by tytso to mix in a timestamp, since there may be some variability caused by the time needed to detect/configure the hardware in question. ]Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>--- drivers/char/random.c | 28 ++++++++++++++++++++++++++++ include/linux/random.h | 1 + 2 files changed, 29 insertions(+)--- a/drivers/char/random.c+++ b/drivers/char/random.c@@ -125,11 +125,20 @@ * The current exported interfaces for gathering environmental noise * from the devices are: *+ * void add_device_randomness(const void *buf, unsigned int size); * void add_input_randomness(unsigned int type, unsigned int code, * unsigned int value); * void add_interrupt_randomness(int irq, int irq_flags); * void add_disk_randomness(struct gendisk *disk); *+ * add_device_randomness() is for adding data to the random pool that+ * is likely to differ between two devices (or possibly even per boot).+ * This would be things like MAC addresses or serial numbers, or the+ * read-out of the RTC. This does *not* add any actual entropy to the+ * pool, but it initializes the pool to different values for devices+ * that might otherwise be identical and have very little entropy+ * available to them (particularly common in the embedded world).+ * * add_input_randomness() uses the input layer interrupt timing, as well as * the event type information from the hardware. *@@ -646,6 +655,25 @@ static void set_timer_rand_state(unsigne } #endif +/*+ * Add device- or boot-specific data to the input and nonblocking+ * pools to help initialize them to unique values.+ *+ * None of this adds any entropy, it is meant to avoid the+ * problem of the nonblocking pool having similar initial state+ * across largely identical devices.+ */+void add_device_randomness(const void *buf, unsigned int size)+{+ unsigned long time = get_cycles() ^ jiffies;++ mix_pool_bytes(&input_pool, buf, size, NULL);+ mix_pool_bytes(&input_pool, &time, sizeof(time), NULL);+ mix_pool_bytes(&nonblocking_pool, buf, size, NULL);+ mix_pool_bytes(&nonblocking_pool, &time, sizeof(time), NULL);+}+EXPORT_SYMBOL(add_device_randomness);+ static struct timer_rand_state input_timer_state; /*--- a/include/linux/random.h+++ b/include/linux/random.h@@ -50,6 +50,7 @@ struct rnd_state { extern void rand_initialize_irq(int irq); +extern void add_device_randomness(const void *, unsigned int); extern void add_input_randomness(unsigned int type, unsigned int code, unsigned int value); extern void add_interrupt_randomness(int irq, int irq_flags);
http://lkml.org/lkml/2012/8/13/765
CC-MAIN-2013-20
en
refinedweb
NAME ::clig::parseCmdline - command line interpreter for Tcl SYNOPSIS package require clig namespace import ::clig::* setSpec var parseCmdline _spec argv0 argc argv DESCRIPTION This manual page describes how to instrument your Tcl-scripts with a command line parser. It requires that package clig is installed whenever your script is run. To find out how to create a parser which is independent of clig, read clig(1). (Well, don’t, it is not yet implemented.) The options to be understood by your script must be declared with calls to ::clig::Flag, ::clig:String etc., which is best done in a separate file, e.g. cmdline.cli, to be sourced by your script. Having these declarations in a separate file allows you to run clig, the program, on that file to create a basic manual page. setSpec The option-declaring functions want to store the declarations in an array with a globally accessible name. For compatibility with older software, the name of this array can not be passed as a parameter. Consequently, your script must declare it before sourcing cmdline.cli. A call like setSpec ::main declares ::main as the database (array) to be filled by subsequent calls to ::clig::Flag and the like. The array should not contain anything except entries created with the declarator functions. parseCmdline After declaring the database and sourcing your declarations from cmdline.cli your script is ready to call parseCmdline. This is typically done with: set Program [file tail $argv0] if {[catch {parseCmdline ::main $Program $argc $argv} err]} { puts stderr $err exit 1 } If parseCmdline finds an unknown option in $argv, it prints a usage- message to stderr and exits the script with exit-code 1. If it finds any other errors, like numerical arguments being out of range, it prints an appropriate error-message to stderr and also exits your script with code 1. Setting Program and passing it to parseCmdline instead of $argv0 results in nicer error-messages. If no errors occur, parseCmdline enters the values found into variables of its callers context. The names of these variables are those declared with the declarator functions. For example with a declaration like Float -ival ival {interval to take into account} -c 2 2 the caller will find the variable ival set to a list with 2 elements, if option -ival was found with two numeric arguments in $argv. If option -ival is not existent on the given command line, ival will not be set. Consequently, it is best to not set the declared variables to any value before calling parseCmdline. Summary The typical skeleton of your script should look like package require clig namespace import ::clig::* setSpec ::main source [file join path to your installed base cmdline.cli] set Program [file tail $argv0] if {[catch {parseCmdline ::main $Program $argc $argv} err]} { puts stderr $err exit 1 } REMARK Of course parseCmdline can be called from a within any proc with a specification database previously filled with the declarator functions. I am not using OptProc because it is not documented and the declaration syntax used here was used for C-programs probably long before it existed. SEE ALSO clig(1), clig_Commandline(7), clig_Description(7), clig_Double(7), clig_Flag(7), clig_Float(7), clig_Int(7), clig_Long(7), clig_Name(7), clig_Rest(7), clig_String(7), clig_Usage(7), clig_Version(7)
http://manpages.ubuntu.com/manpages/hardy/en/man7/clig_parseCmdline.7.html
CC-MAIN-2013-20
en
refinedweb
Wouldn't it be nice if there was a button you could click to give you the MLA citing information for you?!? Neoliminal 18:48, 3 February 2006 (UTC) Can someone tell me if that conversation log is truly true? 200.112.49.116 07:20, 18 February 2006 (UTC) - Yes, it really happened. --—rc (t) 07:23, 18 February 2006 (UTC) - Oh wow, that poor bastard. Goes to show, you can't trust everything (anything?) you read on the internet. I'd feel sorry for him except that it serves him right for not knowing enough about his subject to be able to perform even a cursory fact check. --Sir gwax (talk) 17:59, 3 April 2006 (UTC) - Actually, I'm guessing he was being (at least a little) facetious. I mean, the topic was George W. Bush, right? Surely the Uncyclopedia piece on that is rather low on Google's list. Unlike, say, Vietnam War Hoax.—Lenoxus 00:43, 20 February 2007 (UTC) - Come on. We all know If it is on the Internet it must be true. Besides, I think that Google had blocked Uncyclopedia from its results. -- D'oh, just checked. It looks like they've unblocked it. Samwaltz 13:13, 20 February 2007 (UTC) - Er...actually, Bush was a random example someone gave. The subject was Jim Anderton. If you abandon any faith you may have had in humanity, which you really ought to do anyway just for your own sake, you'll see that it's possible he read a couple lines and thought they were true. It's a fairly short article which reads more as a bunch of random insults and fictitious factoids than a parody encyclopedia article. - Though I really hope he was just messing with you, or quoting it for some humor in a dry essay or something. --67.110.209.218 07:43, 13 April 2007 (UTC) - Here --AAA! (AAAA) 10:57, 5 October 2007 (UTC) - Ouch. VGD >=3 22:06, 22 May 2008 (UTC) Why cite this site edit Namespace? This page doesn't really appear to be intended as an article. Shouldn't it be moved to the project (Uncyclopedia:) namespace? --Pentium5dot1 t~^_^~c 00:06, 25 May 2009 (UTC)
http://uncyclopedia.wikia.com/wiki/Uncyclopedia_talk:Citing_Uncyclopedia?diff=prev&oldid=4814015
CC-MAIN-2013-20
en
refinedweb
Our first task is to build a simple command-line application with .NET Core version 1.0.0. We will use the light weight Visual Studio Code for our text editor. 1) Create a working folder named “Institution” 2) Change directory into the “Institution” node and type in This creates a .NET Core “Hello World” project containing two files: Program.cs and project.json.This creates a .NET Core “Hello World” project containing two files: Program.cs and project.json.dotnet new 3) Start Visual Studio Code and open this project folder. There are two others ways, I know of, that can achieve the same result: a. In the command-line, change directory to the “Institution” folder and type “code .”. This will open up your project folder contents in Visual Studio Code in the current directory (.).4) Once in Visual Studio Code, you can view the contents of this file. The Program.cs file looks like this: b. Alternatively, navigate to the “Institution” folder using File Explorer (in Windows). Right-click on the folder and select “Open with Code”. using System;The project.json file looks like this: namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Console.WriteLine("Hello World!"); } } } {The project.json file has NuGet dependencies necessary to build our console app. You may also notice the presence of another file named project.lock.json. This file is auto-generated and expands on project.json with more detailed dependencies required by your application. There is no need to commit file project.lock.json to source control. "version": "1.0.0-*", "buildOptions": { "debugType": "portable", "emitEntryPoint": true }, "dependencies": {}, "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0" } }, "imports": "dnxcore50" } } } 5) Change the namespace from ConsoleApplication to Institution. Also, change the statement Console.WriteLine("Hello World!"); to Console.WriteLine("Welcome to our institution!");6) Save and back in the command prompt, type in: dotnet restoreThis instruction causes dependencies to be brought in from the NuGet repository 7) To execute the application, you can simple run the following command from the command-line: dotnet run“dotnet run” calls “dotnet build” to ensure that the app has been built, and then calls “dotnet institution.dll” to run the application. You can find the resulting institution.dll file in the bin\Debug\netcoreapp1.0 directory. Notice that the build process does not produce a institution.exe file. This is because we just created a portable app. Instead of creating a portable app, let us produce a self-contained .exe app. Note that the name of the .dll file is dictated by the name of the primary project folder, and not by the name of your primary class file (Program.cs). Compiling a self-contained .exe appWe will need to make some changes to the project.json file. 1) Delete the "type": "platform" element from all dependencies. 2) Next, add a new runtimes node as follows: "runtimes": { "win10-x64": {}, "osx.10.11-x64": {} } This causes the build system to generate native executables for the current environment. In Windows, you will build a Windows executable. On the Mac, you will build the OS X executable. Save the project.json file, then run the following commands from the command-line: dotnet restore dotnet build The self-contained .exe file can be found at bin\Debug\netcoreapp1.0\win10-x64\Institution.exe. You can execute the institution.exe file by typing the following on the command line while in the Institution folder: bin\Debug\netcoreapp1.0\win10-x64\hello.exe or simply: dotnet runLet us add a Student class to the project. It is good practice to organize our files in folders. This is especially beneficial when you are dealing with large projects. Therefore, create a folder named Model and add to it a Student.cs class file with the following code: using System; using System.Collections.Generic; namespace Institution { Id = 1, FirstName = "Ann", LastName = "Lee", Major = "Medicine", DateOfBirth = Convert.ToDateTime("2004/09/09") }, new Student { Id = 2, FirstName = "Bob", LastName = "Doe", Major = "Engineering", DateOfBirth = Convert.ToDateTime("2005/09/09") }, new Student { Id = 3, FirstName = "Sue", LastName = "Douglas", Major = "Pharmacy", DateOfBirth = Convert.ToDateTime("2006/01/01") }, new Student { Id = 4, FirstName = "Tom", LastName = "Brown", Major = "Business", DateOfBirth = Convert.ToDateTime("2000/09/09") }, new Student { Id = 5, FirstName = "Joe", LastName = "Mason", Major = "Health", DateOfBirth = Convert.ToDateTime("2001/01/01") } }; return students; } } } The above code describes a Student class with properties: Id, FirstName, LastName, Major, and DateOfBirth. It also generates some dummy data that can be accessed through the GetSampleStudents() static method. Back in Program.cs, replace the Main() method with the following: public static void Main(string[] args) { List<Student> students = Student.GetSampleStudents(); foreach(var i in students) { Console.WriteLine("{0}\t{1}\t{2}", i.Id, i.FirstName, i.LastName); } } Do not forget to resolve the Student and List classes by using the following namespaces: using System.Collections.Generic;If you run the application by executing “dotnet run” from the command-line, you should see the following output: using Institution.Models; 1 Ann LeeIn future posts, I am hoping to explore more complicated data driven apps developed using .NET Core. Meantime, I hope you benefited from this article. 2 Bob Doe 3 Sue Douglas 4 Tom Brown 5 Joe Mason
http://blog.medhat.ca/2016/09/building-simple-command-line.html
CC-MAIN-2020-05
en
refinedweb
Get-NetFirewallServiceFilter Get-NetFirewallServiceFilter Retrieves service filter objects from the target computer. Syntax Parameter Set: ByAssociatedNetFirewallRule Get-NetFirewallServiceFilter -AssociatedNetFirewallRule <CimInstance> [-AsJob] [-CimSession <CimSession[]> ] [-GPOSession <String> ] [-PolicyStore <String> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>] Parameter Set: ByQuery Get-NetFirewallServiceFilter [-AsJob] [-CimSession <CimSession[]> ] [-GPOSession <String> ] [-PolicyStore <String> ] [-Service <String[]> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>] Parameter Set: GetAll Get-NetFirewallServiceFilter [-All] [-AsJob] [-CimSession <CimSession[]> ] [-GPOSession <String> ] [-PolicyStore <String> ] [-ThrottleLimit <Int32> ] [ <CommonParameters>] Detailed Description The Get-NetFirewallServiceFilter cmdlet returns the service filter objects associated with the piped input firewall rules. Service filter objects represent the Windows services associated with firewalls rules. The Service parameter of a single rule is represented in a separate NetFirewallServiceFilter object. The filter-to-rule relationship is always one-to-one and is managed automatically. Rule parameters associated with filters can only be queried using filter objects. This cmdlet displays the service settings associated with firewall rules. This allows for rule querying based on the Service parameter. The resultant filters are passed into the Get-NetFirewallRule cmdlet to return the rules queried by service. To modify the service conditions, two methods can be used starting with the service filters returned by this cmdlet. The array of NetFirewallServiceFilter objects can be piped into the Get-NetFirewallRule cmdlet, which returns the rules associated with the filters. These rules are then piped into the Set-NetFirewallRule cmdlet where the service properties can be configured. Alternatively, piping the array of NetFirewallServiceFilter objects directly to this cmdlet allows the Service parameter of the rules to be modified. Parameters -All Indicates that all of the service filters within the specified policy store are retrieved. -AsJob -AssociatedNetFirewallRule<CimInstance> Gets the service filters associated with the specified firewall rule to be retrieved. This parameter represents a firewall rule, which defines how traffic is filtered by the firewall. See the New-NetFirewallRule Group Policy Object of of. -Service<String[]> Specifies the short name of a Windows Server 2012 service to which the firewall rule applies. If service is not specified, then network traffic generated by any program or service matches this rule._NetServiceFilter The Microsoft.Management.Infrastructure.CimInstanceobject is a wrapper class that displays Windows Management Instrumentation (WMI) objects. The path after the pound sign ( #) provides the namespace and class name for the underlying WMI object. Examples Example 1 This example retrieves the service conditions associated with all of the firewall rules in the active store. Running this cmdlet without specifying the policy store retrieves the persistent store. PS C:\> Get-NetFirewallServiceFilter -PolicyStore ActiveStore This cmdlet shows the same information in a dynamically-sized, formatted table. PS C:\> Get-NetFirewallServiceFilter -PolicyStore ActiveStore | Format-Table – Property * Example 2 This example gets the service associated with a firewall rule specified by using the localized name. PS C:\> Get-NetFirewallRule –DisplayName "Wireless Portable Devices" | Get-NetFirewallServiceFilter Example 3 This example gets the disabled firewall rules associated with the dnscache service from the persistent store. PS C:\> Get-NetFirewallServiceFilter –Service dnscache | Get-NetFirewallRule | Where-Object –Property { $_.Enabled –Eq "False" } Related topics Get-NetIPSecRule New-NetIPSecRule Set-NetFirewallServiceFilter Set-NetIPSecRule New-GPO
https://docs.microsoft.com/fr-fr/previous-versions/windows/powershell-scripting/jj554894%28v%3Dwps.620%29
CC-MAIN-2020-05
en
refinedweb
In this article by Erik Westra, author of the book Building Mapping Applications with QGIS, we will learn how QGIS symbols and renderers are used to control how vector features are displayed on a map. In addition to this, we will also learn saw how symbol layers work. The features within a vector map layer are displayed using a combination of renderer and symbol objects. The renderer chooses which symbol is to be used for a given feature, and the symbol does the actual drawing. There are three basic types of symbols defined by QGIS: - Marker symbol: This displays a point as a filled circle - Line symbol: This draws a line using a given line width and color - Fill symbol: This draws the interior of a polygon with a given color These three types of symbols are implemented as subclasses of the qgis.core.QgsSymbolV2 class: - qgis.core.QgsMarkerSymbolV2 - qgis.core.QgsLineSymbolV2 - qgis.core.QgsFillSymbolV2 You might be wondering why all these classes have “V2” in their name. This is a historical quirk of QGIS. Earlier versions of QGIS supported both an “old” and a “new” system of rendering, and the “V2” naming refers to the new rendering system. The old rendering system no longer exists, but the “V2” naming continues to maintain backward compatibility with existing code. Internally, symbols are rather complex, using “symbol layers” to draw multiple elements on top of each other. In most cases, however, you can make use of the “simple” version of the symbol. This makes it easier to create a new symbol without having to deal with the internal complexity of symbol layers. For example: symbol = QgsMarkerSymbolV2.createSimple({'width' : 1.0, 'color' : "255,0,0"}) While symbols draw the features onto the map, a renderer is used to choose which symbol to use to draw a particular feature. In the simplest case, the same symbol is used for every feature within a layer. This is called a single symbol renderer, and is represented by the qgis.core.QgsSingleSymbolRenderV2class. Other possibilities include: - Categorized symbol renderer (qgis.core.QgsCategorizedSymbolRendererV2): This renderer chooses a symbol based on the value of an attribute. The categorized symbol renderer has a mapping from attribute values to symbols. - Graduated symbol renderer (qgis.core.QgsGraduatedSymbolRendererV2): This type of renderer has a series of ranges of attribute values, and maps each range to an appropriate symbol. Using a single symbol renderer is very straightforward: symbol = ... renderer = QgsSingleSymbolRendererV2(symbol) layer.setRendererV2(renderer) To use a categorized symbol renderer, you first define a list of qgis.core.QgsRendererCategoryV2 objects, and then use that to create the renderer. For example: symbol_male = ... symbol_female = ... categories = [] categories.append(QgsRendererCategoryV2("M", symbol_male, "Male")) categories.append(QgsRendererCategoryV2("F", symbol_female, "Female")) renderer = QgsCategorizedSymbolRendererV2("", categories) renderer.setClassAttribute("GENDER") layer.setRendererV2(renderer) Notice that the QgsRendererCategoryV2 constructor takes three parameters: the desired value, the symbol to use, and the label used to describe that category. Finally, to use a graduated symbol renderer, you define a list of qgis.core.QgsRendererRangeV2 objects and then use that to create your renderer. For example: symbol1 = ... symbol2 = ... ranges = [] ranges.append(QgsRendererRangeV2(0, 10, symbol1, "Range 1")) ranges.append(QgsRendererRange(11, 20, symbol2, "Range 2")) renderer = QgsGraduatedSymbolRendererV2("", ranges) renderer.setClassAttribute("FIELD") layer.setRendererV2(renderer) Working with symbol layers Internally, symbols consist of one or more symbol layers that are displayed one on top of the other to draw the vector feature: The symbol layers are drawn in the order in which they are added to the symbol. So, in this example, Symbol Layer 1 will be drawn before Symbol Layer 2. This has the effect of drawing the second symbol layer on top of the first. Make sure you get the order of your symbol layers correct, or you may find a symbol layer completely obscured by another layer. While the symbols we have been working with so far have had only one layer, there are some clever tricks you can perform with multilayer symbols. When you create a symbol, it will automatically be initialized with a default symbol layer. For example, a line symbol (an instance of QgsLineSymbolV2) will be created with a single layer of type QgsSimpleLineSymbolLayerV2. This layer is used to draw the line feature onto the map. To work with symbol layers, you need to remove this default layer and replace it with your own symbol layer or layers. For example: symbol = QgsSymbolV2.defaultSymbol(layer.geometryType()) symbol.deleteSymbolLayer(0) # Remove default symbol layer. symbol_layer_1 = QgsSimpleFillSymbolLayerV2() symbol_layer_1.setFillColor(QColor("yellow")) symbol_layer_2 = QgsLinePatternFillSymbolLayer() symbol_layer_2.setLineAngle(30) symbol_layer_2.setDistance(2.0) symbol_layer_2.setLineWidth(0.5) symbol_layer_2.setColor(QColor("green")) symbol.appendSymbolLayer(symbol_layer_1) symbol.appendSymbolLayer(symbol_layer_2) The following methods can be used to manipulate the layers within a symbol: - symbol.symbolLayerCount(): This returns the number of symbol layers within this symbol - symbol.symbolLayer(index): This returns the given symbol layer within the symbol. Note that the first symbol layer has an index of zero. - symbol.changeSymbolLayer(index, symbol_layer): This replaces a given symbol layer within the symbol - symbol.appendSymbolLayer(symbol_layer): This appends a new symbol layer to the symbol - symbol.insertSymbolLayer(index, symbol_layer): This inserts a symbol layer at a given index - symbol.deleteSymbolLayer(index): This removes the symbol layer at the given index Remember that to use the symbol once you’ve created it, you create an appropriate renderer and then assign that renderer to your map layer. For example:renderer = QgsSingleSymbolRendererV2(symbol) layer.setRendererV2(renderer) The following symbol layer classes are available for you to use: These predefined symbol layers, either individually or in various combinations, give you enormous flexibility in how features are to be displayed. However, if these aren’t enough for you, you can also implement your own symbol layers using Python. We will look at how this can be done later in this article. Combining symbol layers By combining symbol layers, you can achieve a range of complex visual effects. For example, you could combine an instance of QgsSimpleMarkerSymbolLayerV2 with a QgsVectorFieldSymbolLayer to display a point geometry using two symbols at once: One of the main uses of symbol layers is to draw different LineString or PolyLine symbols to represent different types of roads. For example, you can draw a complex road symbol by combining multiple symbol layers, like this: This effect is achieved using three separate symbol layers: Here is the Python code used to generate the above map symbol: symbol = QgsLineSymbolV2.createSimple({}) symbol.deleteSymbolLayer(0) # Remove default symbol layer. symbol_layer = QgsSimpleLineSymbolLayerV2() symbol_layer.setWidth(4) symbol_layer.setColor(QColor("light gray")) symbol_layer.setPenCapStyle(Qt.FlatCap) symbol.appendSymbolLayer(symbol_layer) symbol_layer = QgsSimpleLineSymbolLayerV2() symbol_layer.setColor(QColor("black")) symbol_layer.setWidth(2) symbol_layer.setPenCapStyle(Qt.FlatCap) symbol.appendSymbolLayer(symbol_layer) symbol_layer = QgsSimpleLineSymbolLayerV2() symbol_layer.setWidth(1) symbol_layer.setColor(QColor("white")) symbol_layer.setPenStyle(Qt.DotLine) symbol.appendSymbolLayer(symbol_layer) As you can see, you can set the line width, color, and style to create whatever effect you want. As always, you have to define the layers in the correct order, with the back-most symbol layer defined first. By combining line symbol layers in this way, you can create almost any type of road symbol that you want. You can also use symbol layers when displaying polygon geometries. For example, you can draw QgsPointPatternFillSymbolLayer on top of QgsSimpleFillSymbolLayerV2 to have repeated points on top of a simple filled polygon, like this: Finally, you can make use of transparency to allow the various symbol layers (or entire symbols) to blend into each other. For example, you can create a pinstripe effect by combining two symbol layers, like this: symbol = QgsFillSymbolV2.createSimple({}) symbol.deleteSymbolLayer(0) # Remove default symbol layer. symbol_layer = QgsGradientFillSymbolLayerV2() symbol_layer.setColor2(QColor("dark gray")) symbol_layer.setColor(QColor("white")) symbol.appendSymbolLayer(symbol_layer) symbol_layer = QgsLinePatternFillSymbolLayer() symbol_layer.setColor(QColor(0, 0, 0, 20)) symbol_layer.setLineWidth(2) symbol_layer.setDistance(4) symbol_layer.setLineAngle(70) symbol.appendSymbolLayer(symbol_layer) The result is quite subtle and visually pleasing: In addition to changing the transparency for a symbol layer, you can also change the transparency for the symbol as a whole. This is done by using the setAlpha() method, like this: symbol.setAlpha(0.3) The result looks like this: Note that setAlpha() takes a floating point number between 0.0 and 1.0, while the transparency of a QColor object, like the ones we used earlier, is specified using an alpha value between 0 and 255. Implementing symbol layers in Python If the built-in symbol layers aren’t flexible enough for your needs, you can implement your own symbol layers using Python. To do this, you create a subclass of the appropriate type of symbol layer (QgsMarkerSymbolLayerV2, QgsLineSymbolV2, or QgsFillSymbolV2) and implement the various drawing methods yourself. For example, here is a simple marker symbol layer that draws a cross for a Point geometry: class CrossSymbolLayer(QgsMarkerSymbolLayerV2): def __init__(self, length=10.0, width=2.0): QgsMarkerSymbolLayerV2.__init__(self) self.length = length self.width = width def layerType(self): return "Cross" def properties(self): return {'length' : self.length, 'width' : self.width} def clone(self): return CrossSymbolLayer(self.length, self.width) def startRender(self, context): self.pen = QPen() self.pen.setColor(self.color()) self.pen.setWidth(self.width) def stopRender(self, context): self.pen = None def renderPoint(self, point, context): left = point.x() - self.length right = point.x() + self.length bottom = point.y() - self.length top = point.y() + self.length painter = context.renderContext().painter() painter.setPen(self.pen) painter.drawLine(left, bottom, right, top) painter.drawLine(right, bottom, left, top) Using this custom symbol layer in your code is straightforward: symbol = QgsMarkerSymbolV2.createSimple({}) symbol.deleteSymbolLayer(0) symbol_layer = CrossSymbolLayer() symbol_layer.setColor(QColor("gray")) symbol.appendSymbolLayer(symbol_layer) Running this code will draw a cross at the location of each point geometry, as follows: Of course, this is a simple example, but it shows you how to use custom symbol layers implemented in Python. Let’s now take a closer look at the implementation of the CrossSymbolLayer class, and see what each method does: - __init__(): Notice how the __init__ method accepts parameters that customize the way the symbol layer works. These parameters, which should always have default values assigned to them, are the properties associated with the symbol layer. If you want to make your custom symbol available within the QGIS Layer Properties window, you will need to register your custom symbol layer and tell QGIS how to edit the symbol layer’s properties. We will look at this shortly. - layerType(): This method returns a unique name for your symbol layer. - properties(): This should return a dictionary that contains the various properties used by this symbol layer. The properties returned by this method will be stored in the QGIS project file, and used later to restore the symbol layer. - clone(): This method should return a copy of the symbol layer. Since we have defined our properties as parameters to the __init__ method, implementing this method simply involves creating a new instance of the class and copying the properties from the current symbol layer to the new instance. - startRender(): This method is called before the first feature in the map layer is rendered. This can be used to define any objects that will be required to draw the feature. Rather than creating these objects each time, it is more efficient (and therefore faster) to create them only once to render all the features. In this example, we create the QPen object that we will use to draw the Point geometries. - stopRender(): This method is called after the last feature has been rendered. This can be used to release the objects created by the startRender() method. - renderPoint(): This is where all the work is done for drawing point geometries. As you can see, this method takes two parameters: the point at which to draw the symbol, and the rendering context (an instance of QgsSymbolV2RenderContext) to use for drawing the symbol. - The rendering context provides various methods for accessing the feature being displayed, as well as information about the rendering operation, the current scale factor, etc. Most importantly, it allows you to access the PyQt QPainter object needed to actually draw the symbol onto the screen. The renderPoint() method is only used for symbol layers that draw point geometries. For line geometries, you should implement the renderPolyline() method, which has the following signature: def renderPolyline(self, points, context): The points parameter will be a QPolygonF object containing the various points that make up the LineString, and context will be the rendering context to use for drawing the geometry. If your symbol layer is intended to work with polygons, you should implement the renderPolygon() method, which looks like this: def renderPolygon(self, outline, rings, context): Here, outline is a QPolygonF object that contains the points that make up the exterior of the polygon, and rings is a list of QPolygonF objects that define the interior rings or “holes” within the polygon. As always, context is the rendering context to use when drawing the geometry. A custom symbol layer created in this way will work fine if you just want to use it within your own external PyQGIS application. However, if you want to use a custom symbol layer within a running copy of QGIS, and in particular, if you want to allow end users to work with the symbol layer using the Layer Properties window, there are some extra steps you will have to take, which are as follows: - If you want the symbol to be visually highlighted when the user clicks on it, you will need to change your symbol layer’s renderXXX() method to see if the feature being drawn has been selected by the user, and if so, change the way it is drawn. The easiest way to do this is to change the geometry’s color. For example: if context.selected(): color = context.selectionColor() else: color = self.color - To allow the user to edit the symbol layer’s properties, you should create a subclass of QgsSymbolLayerV2Widget, which defines the user interface to edit the properties. For example, a simple widget for the purpose of editing the length and width of a CrossSymbolLayer can be defined as follows: class CrossSymbolLayerWidget(QgsSymbolLayerV2Widget): def __init__(self, parent=None): QgsSymbolLayerV2Widget.__init__(self, parent) self.layer = None self.lengthField = QSpinBox(self) self.lengthField.setMinimum(1) self.lengthField.setMaximum(100) self.connect(self.lengthField, SIGNAL("valueChanged(int)"), self.lengthChanged) self.widthField = QSpinBox(self) self.widthField.setMinimum(1) self.widthField.setMaximum(100) self.connect(self.widthField, SIGNAL("valueChanged(int)"), self.widthChanged) self.form = QFormLayout() self.form.addRow('Length', self.lengthField) self.form.addRow('Width', self.widthField) self.setLayout(self.form) def setSymbolLayer(self, layer): if layer.layerType() == "Cross": self.layer = layer self.lengthField.setValue(layer.length) self.widthField.setValue(layer.width) def symbolLayer(self): return self.layer def lengthChanged(self, n): self.layer.length = n self.emit(SIGNAL("changed()")) def widthChanged(self, n): self.layer.width = n self.emit(SIGNAL("changed()")) We define the contents of our widget using the standard __init__() initializer. As you can see, we define two fields, lengthField and widthField, which let the user change the length and width properties respectively, for our symbol layer. The setSymbolLayer() method tells the widget which QgsSymbolLayerV2 object to use, while the symbolLayer() method returns the QgsSymbolLayerV2 object this widget is editing. Finally, the two XXXChanged() methods are called when the user changes the value of the fields, allowing us to update the symbol layer’s properties to match the value set by the user. - Finally, you will need to register your symbol layer. To do this, you create a subclass of QgsSymbolLayerV2AbstractMetadata and pass it to the QgsSymbolLayerV2Registry object’s addSymbolLayerType() method. Here is an example implementation of the metadata for our CrossSymbolLayer class, along with the code to register it within QGIS: class CrossSymbolLayerMetadata(QgsSymbolLayerV2AbstractMetadata): def __init__(self): QgsSymbolLayerV2AbstractMetadata.__init__(self, "Cross", "Cross marker", QgsSymbolV2.Marker) def createSymbolLayer(self, properties): if "length" in properties: length = int(properties['length']) else: length = 10 if "width" in properties: width = int(properties['width']) else: width = 2 return CrossSymbolLayer(length, width) def createSymbolLayerWidget(self, layer): return CrossSymbolLayerWidget() registry = QgsSymbolLayerV2Registry.instance() registry.addSymbolLayerType(CrossSymbolLayerMetadata()) Note that the parameters of QgsSymbolLayerV2AbstractMetadata.__init__() are as follows: - The unique name for the symbol layer, which must match the name returned by the symbol layer’s layerType() method. - A display name for this symbol layer, as shown to the user within the Layer Properties window. - The type of symbol that this symbol layer will be used for. The createSymbolLayer() method is used to restore the symbol layer based on the properties stored in the QGIS project file when the project was saved. The createSymbolLayerWidget() method is called to create the user interface widget that lets the user view and edit the symbol layer’s properties. Implementing renderers in Python If you need to choose symbols based on more complicated criteria than what the built-in renderers will provide, you can write your own custom QgsFeatureRendererV2 subclass using Python. For example, the following Python code implements a simple renderer that alternates between odd and even symbols as point features are displayed: class OddEvenRenderer(QgsFeatureRendererV2): def __init__(self): QgsFeatureRendererV2.__init__(self, "OddEvenRenderer") self.evenSymbol = QgsMarkerSymbolV2.createSimple({}) self.evenSymbol.setColor(QColor("light gray")) self.oddSymbol = QgsMarkerSymbolV2.createSimple({}) self.oddSymbol.setColor(QColor("black")) self.n = 0 def clone(self): return OddEvenRenderer() def symbolForFeature(self, feature): self.n = self.n + 1 if self.n % 2 == 0: return self.evenSymbol else: return self.oddSymbol def startRender(self, context, layer): self.n = 0 self.oddSymbol.startRender(context) self.evenSymbol.startRender(context) def stopRender(self, context): self.oddSymbol.stopRender(context) self.evenSymbol.stopRender(context) def usedAttributes(self): return [] Using this renderer will cause the various point geometries to be displayed in alternating colors, for example: Let’s take a closer look at how this class was implemented, and what the various methods do: - __init__(): This is your standard Python initializer. Notice how we have to provide a unique name for the renderer when calling the QgsFeatureRendererV2.__init__() method; this is used to keep track of the various renderers within QGIS itself. clone(): This creates a copy of this renderer. If your renderer uses properties to control how it works, this method should copy those properties into the new renderer object. - symbolForFeature(): This returns the symbol to use for drawing the given feature. - startRender(): This prepares to start rendering the features within the map layer. As the renderer can make use of multiple symbols, you need to implement this so that your symbols are also given a chance to prepare for rendering. - stopRender(): This finishes rendering the features. Once again, you need to implement this so that your symbols can have a chance to clean up once the rendering process has finished. - usedAttributes():This method should be implemented to return the list of attributes that the renderer requires if your renderer makes use of feature attributes to choose between the various symbols,. If you wish, you can also implement your own widget that lets the user change the way the renderer works. This is done by subclassing QgsRendererV2Widget and setting up the widget to edit the renderer’s various properties in the same way that we implemented a subclass of QgsSymbolLayerV2Widget to edit the properties for a symbol layer. You will also need to provide metadata about your new renderer (by subclassing QgsRendererV2AbstractMetadata) and use the QgsRendererV2Registry object to register your new renderer. If you do this, the user will be able to select your custom renderer for new map layers, and change the way your renderer works by editing the renderer’s properties. Summary In this article, we learned how QGIS symbols and renderers are used to control how vector features are displayed on a map. We saw that there are three standard types of symbols: marker symbols for drawing points, line symbols for drawing lines, and fill symbols for drawing the interior of a polygon. We then learned how to instantiate a “simple” version of each of these symbols for use in your programs. We next looked at the built-in renderers, and how these can be used to choose the same symbol for every feature (using the QgsSingleSymbolRenderV2 class), to select a symbol based on the exact value of an attribute (using QgsCategorizedSymbolRendererV2), and to choose a symbol based on a range of attribute values (using the QgsGraduatedSymbolRendererV2 class). We then saw how symbol layers work, and how to manipulate the layers within a symbol. We looked at all the different types of symbol layers built into QGIS, and learned how they can be combined to produce sophisticated visual effects. Finally, we saw how to implement our own symbol layers using Python, and how to write your own renderer from scratch if one of the existing renderer classes doesn’t meet your needs. Using these various PyQGIS classes, you have an extremely powerful set of tools at your disposal for displaying vector data within a map. While simple visual effects can be achieved with a minimum of fuss, you can produce practically any visual effect you want using an appropriate combination of built-in or custom-written QGIS symbols and renderers. Resources for Article: Further resources on this subject: - Combining Vector and Raster Datasets [article] - QGIS Feature Selection Tools [article] - Creating a Map [article]
https://hub.packtpub.com/how-vector-features-are-displayed/
CC-MAIN-2020-05
en
refinedweb
grapl_analyzerlibgrapl_analyzerlib Analyzer library for Grapl This library provides two main constructs, Queries and Entities. Queries are used for performing subgraph searches against Grapl's Master or Engagement graphs. Entities are designed for pivoting off of query results. pip install grapl_analyzer QueryingQuerying from pydgraph import DgraphClient, DgraphClientStub from grapl_analyzerlib.counters import ParentChildCounter from grapl_analyzerlib.entities import ProcessQuery from grapl_analyzerlib.entity_queries import Not mclient = DgraphClient(DgraphClientStub('alpha0.mastergraphcluster.grapl:9080')) # Query for suspicious svchost.exe's, based on the parent process not being whitelisted p = ( ProcessQuery() .with_process_name(contains=[ Not("services.exe"), Not("lsass.exe"), ]) .with_children( ProcessQuery() .with_process_name(ends_with="svchost.exe") ) .query_first(mclient) ) if p: # We now have a ProcessView, representing a concrete subgraph print(f"Found: {p.process_name} at path: {p.get_bin_file()}") Entity PivotingEntity Pivoting Given an entity p, such as from the above example. parent = p.get_parent() siblings = parent.get_children() bin_file = p.get_bin_file() bin_file_creator = bin_file.get_creator() We can easily pivot across the graph, incrementally expanding the scope. CountingCounting Counters are currently provided as simple, specialized helpers. Given an entity p, such as from the above example. counter = ParentChildCounter(mclient) count = counter.get_count_for( parent_process_name=p.process_name, child_process_name=p.children[0].process_name, excluding=p.node_key ) if count <= Seen.Once: print("Seen one time or never")
https://libraries.io/pypi/grapl-analyzerlib
CC-MAIN-2020-05
en
refinedweb
Starting with module loading I have been slowly working on rebuilding a web application from ASP.Net MVC into a SPA application over the last six months. The timescale of this work has been a blessing and a curse. It is a blessing because there has been an amazing churn in the client frameworks, build pipelines and current best practices so I get to learn a lot of new things. This is directly linked to the curse however as it makes it very difficult to rewrite an existing system and keep up with that rate of change. I want to share what I have learnt about module loaders as part of this journey. It is new to me so please shout out any inaccuracies in the comments. I originally started my rewrite using Angular 1.5 and its subsequent patch releases. While I have used Angular before and really like it as a framework, I started to dislike the constraints it was putting on my implementation. At the time, I was waiting for Angular 2 to be released and then Aurelia just snuck across the line before it. The upskill required to go to either of these frameworks seemed quite immense. One thing that was clear in my Angular 1.5 rewrite was that I need to start to understand and use a module loader. Module loaders essentially let your class file indicate what it requires such that the runtime will then load it for you. Lacking a module loader lead to my code being fragile during a build because the ordering of dependencies in the bundler was critical. The latest rewrite of my web application is currently a combination of Vue.js and TypeScript for the front-end and Node.js for the back-end. It is using Webpack as the compiler/bundler to put together both parts of the system. The most common module loaders are CommonJS, SystemJS and AMD. I chose CommonJS as my module loader due to the similarities to the node module loader and the consumption of front-end and back-end libraries from NPM which are mostly targeting Node.js. CommonJS works with the concept of exporting from a module which is really just a file. Other modules/files then import them for use in their own module. From what I can understand, there are several ways you can import a module. Keep in mind that I’m using TypeScript (see here for more information). Single import import otherModuleA from "./otherModuleA"; This is the simplest import. You use it when there is a single export from the exported module. There is nothing to distinguish in terms of exported artefacts as there is only one. Multiple import import { otherModuleB, otherModuleC } from "otherModules"; Modules are often more complex than just exporting a single class, function or data object. This module import syntax allows you to define which items you want to bring in from the external module. I use this syntax if I need to import both an interface and a class that implements it. Wildcard import import * as otherModuleD from "./otherModuleD"; This syntax imports everything exported from the external module and pins each against the otherModuleD variable. I generally avoid this syntax as it is not descriptive about the items you are importing. I normally use this syntax if the prior two have not worked. A great example of this is importing the excellent iziToast library. Neither the single or multiple import syntax worked for this library, however the wildcard import did work. I dug into the iziToast source to try to understand why but didn’t get very far. I suspect the reason is because the export from iziToast is a function that exposes other functions rather than exporting a class like in TypeScript. Smarter people that me will hopefully pitch in here. Require let otherModuleE = require("./otherModuleE"); I’m still confused with this one as I use it in different circumstances. My compilation process using Webpack is all traditional JavaScript that uses module.exports syntax which is pulled in via the require syntax. My build process exports a combination of objects, functions and data for the build process. In the context of TypeScript, this syntax is used when importing a module that explicitly defines an export rather than exporting interface and class definitions. See the documentation for a good explanation of this. One scenario I have used this is exporting a function in TypeScript rather than a class definition. In this example, I have a function that wraps an async/await function for a callback parameter. import "es6-promise/auto"; export function runAsync(fn) { return async (done) => { try { await fn(); done(); } catch (err) { done.fail(err); } }; }; I use this in Jasmine unit tests when I am testing an async function. It makes the unit test class code cleaner rather than importing a class to get access to this function. const core = require("../../tests/core"); describe("send", () => { it("sends message via service when validation passes", core.runAsync(async () => { spyOn(service, "sendMessage"); await sut.send(); expect(service.sendMessage).toHaveBeenCalledWith(sut.request); })); }); I guess the equivalent would be exporting this function as a static in a class that is then imported using the single import syntax above. Conclusion I think I have covered the main ways to do module importing with CommonJS. There is also default exports you can read about in the TypeScript documentation. I generally stick with the import syntax as it is more aligned with TypeScript and then fall back on wildcard and require import syntaxes for anything that is out of the ordinary.
https://www.neovolve.com/2017/01/17/starting-with-module-loading/
CC-MAIN-2020-05
en
refinedweb
What if we, the authors of this directive, are the final consumers? What if another developer is reusing the directive as an API? How do we make it flexible enough with dynamic values? When you ask yourself these questions while writing directives, then it's time to make it dynamic. All this while, we have been using the directive without any value. We can actually use attribute values to receive inputs into the directive: <button appUiButtonClick!!</button> We added a new attribute, bgColor, which is not a directive but an input property. The property is used to send dynamic values to the directive, as follows: import { Directive, ElementRef, HostListener, Input, OnInit } from '@angular/core'; ...
https://www.oreilly.com/library/view/typescript-2x-for/9781786460554/ca75b1f5-435c-4b53-9670-9f88d95b1eba.xhtml
CC-MAIN-2020-05
en
refinedweb
Technical Support On-Line Manuals RL-ARM User's Guide (MDK v4) #include <rtl.h> int ffind ( const char *pattern, /* pattern to match files to */ FINFO *info); /* file info structure */ The function ffind searches for files that match specific patterns. The function is included in the RL-FlashFS library. The prototype is defined in the file rtl.h. The parameter pattern is a character pointer specifying the searching rule. The parameter can include: The parameter info is a pointer to a structure that stores information about the matching files. ffree #include <rtl.h> void file_directory (void) { FINFO info; info.fileID = 0; /* info.fileID must be set to 0 */ while (ffind ("R:*.*", &info) == 0) { /* find whatever is in drive "R0:" */ printf ("\n%-32s %5d bytes, ID: %04d", info.name, info.size, info.fileID); } if (info.fileID == 0) { printf ("\nNo.
http://www.keil.com/support/man/docs/rlarm/rlarm_ffind.htm
CC-MAIN-2020-05
en
refinedweb
Technical Support On-Line Manuals RL-ARM User's Guide (MDK v4) #include <net_config.h> U16 ftp_fread ( FILE* file, /* Pointer to the file to read from. */ U8* buf, /* Pointer to buffer, to store the data. */ U16 len ); /* Number of bytes to read. */ The ftp_fread reads len bytes from the file identified by the file stream pointer in the function argument. The argument buf is a pointer to the buffer where the function stores the read data. The ftp_fread function is in the FTP_uif.c module. The prototype is defined in net_config.h. note The ftp_fread function returns the number of bytes read from the file. ftp_fclose, ftp_fopen, ftp_fwrite U16 ftp_fread (void *file, U8 *buf, U16 len) { /* Read 'len' bytes from file to buffer 'buf'. The file will be */ /* closed, when the number of bytes read is less than .
http://www.keil.com/support/man/docs/rlarm/rlarm_ftp_fread.htm
CC-MAIN-2020-05
en
refinedweb
Technical Support On-Line Manuals RL-ARM User's Guide (MDK v4) #include <rtl.h> void os_tsk_pass (void); The os_tsk_pass function passes control to the next task of the same priority in the ready queue. If there is no task of the same priority in the ready queue, the current task continues and no task switching occurs. The os_tsk_pass function is in the RL-RTX library. The prototype is defined in rtl.h. Note None os_tsk_prio, os_tsk_prio_self #include <rtl.h> OS_TID tsk1; __task void task1 (void) { .. os_tsk.
http://www.keil.com/support/man/docs/rlarm/rlarm_os_tsk_pass.htm
CC-MAIN-2020-05
en
refinedweb
Drop XML Events from the default build RESOLVED WONTFIX Status () ▸ DOM People (Reporter: Hixie (not reading bugmail), Unassigned) Tracking Firefox Tracking Flags (Not tracked) Details One of the things we might want to cut from Firefox's default builds is XML Events. It is, as far as I can tell, never used on the Web, and is just yet another way of doing what can already be done multiple ways (e.g. with event handlers attributes and the DOM EventTarget API). er, this would totally break XForms extension. Though, I think the best solution would be that XML Events could be implemented as an extension too. So basically XTF for namespaced attributes. Argh. Yes, this is definately a no-go from XForms. OS: MacOS X → All Hardware: Macintosh → All The code isn't that big to make any difference. I assume that means that Webforms 2 won't go in since no one uses it and there are other ways of achieving the same behavior? I think that Firefox should look at XML Events not as something that stands alone, but rather XML Events is an important piece of things to come from the W3C. Especially for any XML-based UI standards. XForms 1.0 and 1.1, SVG 1.2, XHTML 2 and X+V all use XML Events. Opera implements X+V and XML Events, so I'd think that there is SOME content out there already. > XForms 1.0 and 1.1, SVG 1.2, XHTML 2 and X+V all use XML Events. ...and they all suck, and I'd strongly recommend that Mozilla not implement any of those, either (in default builds, at least). Summary: Cut XML Events from the default build? → Drop XML Events from the default build (In reply to comment #5) > > XForms 1.0 and 1.1, SVG 1.2, XHTML 2 and X+V all use XML Events. > > ...and they all suck, and I'd strongly recommend that Mozilla not implement any > of those, either (in default builds, at least). > Your personal opinion is irrelevant to this discussion. Unlike XForms, XML Events cannot be easily separated out into an extension and in order for us to create XForms extensions (and other technologies) XML Events need to be there. If you really think this is a codesize issue, post some numbers and we'll go from there. Status: NEW → RESOLVED Last Resolved: 12 years ago Resolution: --- → WONTFIX
https://bugzilla.mozilla.org/show_bug.cgi?id=312966
CC-MAIN-2018-13
en
refinedweb
Category:OpenStreetMap documentation pages This category lists documentation pages for templates that are currently located in one of the article namespaces (the main namespace, or one of the 7 dedicated language-namespaces). These documentation pages (generally named with a "/doc" subpage) are using {{Documentation subpage}}. This category should ideally remain empty, but some Wikiproject pages in the article namespaces are creating their own subpages used locally as if they were generic templates. In all other cases, these templates should be relocated in the Template namespace (but a redirecting page may be left in the main namespace for templates translated in one of the 7 languages with dedicated namespaces, to simplify their use). Pages in category "OpenStreetMap documentation pages" The following 5 pages are in this category, out of 5 total.
https://wiki.openstreetmap.org/wiki/Category:OpenStreetMap_documentation_pages
CC-MAIN-2018-13
en
refinedweb
, you learned how to create a very simple Mac app called “Scary Bugs” with a table view, images, and editing capabilities. In this tutorial you’ll go a bit deeper, and will learn how to: - Use Core Data to save your Scary Bugs - Utilize an NSArrayController - Implement Cocoa Bindings - Transform values using NSValueTransformers Before you get started on this tutorial, you’ll need to be familiar with the information in the tutorials below: Okay — ready to dive into the depths of Mac development? Great! Time to get started! :] An Introduction to Cocoa Bindings Apple describes Cocoa Bindings as: “a collection of technologies that help you encapsulate data, and write less glue code”. “Glue code” is the code in your app that doesn’t actually perform any real function, but helps you out in sticky situations (pun fully intended) when you are trying to tie together sets of code that weren’t designed to interoperate. For example, in the Scary Bugs app you’ve been working on, your goal has been to display the ScaryBugData’s title and rating properties in the text field and rating view in the right side of the window: In order to do this, so far you have written some “glue code” like this: -(void)setDetailInfo:(ScaryBugDoc*)doc { NSString *title = @""; NSImage *image = nil; float rating=0.0; if( doc != nil ) { title = doc.data.title; image = doc.fullImage; rating = doc.data.rating; } [self.bugTitleView setStringValue:title]; [self.bugImageView setImage:image]; [self.bugRating setRating:rating]; } You’re probably used to doing this all the time as an iOS developer, but wouldn’t it be nice if you didn’t have to write that code at all? That’s exactly what Cocoa Bindings does for you! Basically, Cocoa Bindings allows you to use the properties inspector to bind a UI control to a property on an object. Then the control will display the value of the property, and when you modify the value of the control it will update the value of the property. This tutorial will give you hands on experience with how this works – you will convert the ScaryBugs project to use Cocoa Bindings and remove all need for the old “glue code!” By the time you’re done, you’ll really start wishing iOS had this cool feature ;] Behind the Scenes: KVO You might wonder how this magic all works behind the scenes. If you’ve ever used key-value coding and observing in iOS, you might have a good guess – and you’d be right! Assume you have a class named “Person”, with an NSNumber property named “age”. One way of setting the property would be as follows: [aPerson setAge:@26]; An alternative way of assigning the property would be: aPerson.age = @26; The key-value coding way of doing it would be like this: [aPerson setValue:@26 forKey:@"age"]; In short, key-value coding allows you to set the value of a property by the name, or the key, of the property. Behind the scenes, Cocoa Bindings uses KVO to update the associated property when a UI control is edited. In addition to key-value coding, Cocoa Bindings also uses key-value observing (KVO). KVO allows you to register observers for an object’s properties. The observer implements key-value observing as follows: observeValueForKeyPath:ofObject:change:context: So whenever a change to the observed property occurs, observeValueForKeyPath is called and passed several parameters, including the object value and the property key. Cocoa Bindings uses this as well behind the scenes, so it knows to update the controls when the property changes. If you are interested in learning more about how Cocoa Bindings works behind the scenes, check out these documents: - Apple’s Cocoa Bindings Documentation Page - Apple’s Key-Value Coding Documentation - Apple’s Key-Value Observing Documentation Getting Started In this tutorial, you will continue on with the project from the previous tutorial series. However, there have been a few changes: - All of the methods and outlets that used to implement the “glue code” have been removed from the app, since you will not be needing those anymore! - This tutorial is going to use Core Data, so I’ve added a few Core Data related methods and properties into AppDelegate.m to make it easier to get started. - Converted the table view to be from view-based to cell-based, to keep the tutorial simpler, as I’ll explain later. Go ahead and download the starter project and open it in Xcode. Build and run the app to make sure it runs – at this point you should just see a blank screen like this (and none of the buttons work): Now get ready to start coding! :] Bug Entity Go to File/New/File…. Under OS X, click “Core Data”, and choose “Data Model”. Click “Next,” and name it ScaryBugsApp.xcdatamodeld. Note: it’s important that you use the suggested names in this tutorial, so that the existing project code — and the tutorial explanation of the code — line up! :] Select ScaryBugsApp.xcdatamodeld. Click “Add Entity,” and name the Entity Bug. You need to add three attributes to your Bug entity: name, rating, and imagePath. Under Attributes, click the “+” three times, each time naming the attribute as “name”, “rating”, and “imagePath”. Set the Type of each attribute so that name and imagePath are both “String,” and rating is “Float”. Select “rating”, and then select the Data Model inspector (the third tab on the top half of the right sidebar) in the utilities drawer. Under the Attribute section, you will see a subsection named “Validation.” For Minimum, enter 1; Maximum enter 5; and set Default to 1. Doing this will guarantee that a rating will never be a value other than 1 – 5. Save your changes with Command-S, then select Editor/Create NSManagedObject Subclass: If you’re asked what entities you would like to manage in the step above, select “Bug” and click “Next”. Finally, click “Create”. Go ahead, build and run your application to make sure that everything is OK so far. You should not receive any warnings or errors, but if you do verify the following: - Check the name of the .xcdatamodeld file. - Check that each attribute has a type associated with it. Everything look good? Okay, move on to working with the NSArrayController! :] NSArrayController Now that you have your Entity working, it’s time to set up an NSArrayController. You’re likely wondering “what is an NSArrayController, and why do I need it?” :] An NSArrayController is a bindings compatible class, adding features for sorting and selection management. When you populate a table with data from an array, you typically have to calculate which row a user has selected from the table, and grab the object from that index in the array. NSArrayController provides you with a method to return the object that is associated with whichever table row has been selected. This prevents you from having to do copious amounts of login in methods like selectionDidChange:, and sometimes even removes the need to have them at all. In this tutorial, you’ll actually get rid of selectionDidChange: entirely, giving you a chance to see how much work Bindings really will do for you. An NSArrayController, as its name implies, controls an array, or collection, of objects. It can also be used to manage the relationships of an NSManagedObject, which is usually used to create Core Data models. There are also Object, Dictionary, Tree, and User Default Controllers that can be used with Bindings. For instance, the Bug class that you created earlier is a sub-class of NSManagedObject and you’ll be using NSArrayController to work with the Bug class. Open MasterViewController.h, and add the following property: @property (strong, nonatomic) NSManagedObjectContext *managedObjectContext; Now switch to AppDelegate.m, and add the following to the end of applicationDidFinishLaunching:: self.masterViewController.managedObjectContext = self.managedObjectContext; This will allow you to use the same instance of the managedObjectContext that is created when the app is loaded, from the MasterViewController. This is going to be critical for setting up the NSArrayController. Switch to MasterViewController.xib, and drag an Array Controller from the Object Library (third tab on the lower half of the right sidebar) to the objects list in the Document Outline: Select the Array Controller, hit “Enter,” and rename the Array Controller to BugArrayController. Note: it may appear that the name change did not take place when you enter the new name for the Array Controller. Just switch to some other file and then switch back to MasterViewController.xib. Now you should see that the array controller shows up with the correct name! :] Select BugArrayController in the Document Outline, then select the Attributes Inspector in the right sidebar. Under Object Controller, change Mode to “Entity Name”; for Entity Name, enter “Bug”; and finally check the box “Prepares Content”, as shown in the following screenshot: Entering the name Bug for entity name tells the BugArrayController that it is going to be managing Bug objects, while “Prepares Content” will make the BugArrayController grab any content from the managed object context. Switch to the Bindings Inspector — the 7th tab on the right sidebar. Under “Parameters,” expand “Managed Object Context.” Check “Bind To,” and in the drop down, select “File’s Owner.” Change the Model Key Path from “self” to “managedObjectContext”, as shown below: You have just set the BugArrayController to use the objects found in MasterViewController’s managedObjectContext. Again, this is another great example on how using an NSArrayController eliminates the need to write a bunch of boiler plate or glue code. Go ahead — Build and Run your app! Your app should look the same as before, but make sure the Log is not giving you any warnings or errors. You may not realize it yet, but you have just created something wonderful: your BugArrayController will now contain any and all Bug entities that are created in your managedObjectContext! Bindings While working in XCode is hardly comparable to dabbling in the dark arts, Cocoa Bindings isn’t too far off from appearing magical! :] Now you’re finally going to try out Bindings. Switch to MasterViewController.xib, Control-drag from the plus (+) button to the BugArrayController and select the “add:” action from the popup menu, as below: Do the same for the “-” button, but this time select “remove:”. Now, whenever you click “+”, the NSArrayController will add a Bug entity to the managedObjectContext, and it will also remove one whenever you click “-“. Wow, pretty easy, eh? Just think of all the glue code you didn’t have to write! :] Next select the textfield under “Name” in the interface. With the Bindings Inspector selected, expand Value under the Value section. Check the Bind To checkbox, make sure the dropdown has BugArrayController selected, and enter name for the Model Key Path as demonstrated in this screenshot: Remember how NSArrayControllers manage what objects are selected in a table? Whatever row is selected in the table a Bug object resides in an array within the NSArrayController called selectedObjects at index 0. When using the bindings view in Interface Builder, the “selection” key refers to this same object. Using “name” for model key path refers to the “name” property of the Bug object. The name field will now display the name value in whatever Bug has been selected in the table. Next, time to set up the table view! Note: In this tutorial, the NSTableView on the view has been changed to be cell-based. As this tutorial is only an introduction to Cocoa Bindings, it’s likely easier to grasp the tutorial concepts this way, as opposed to using a View-based NSTableView. Apple cautions that you should be extremely familiar with bindings and View-based table views before using them together. Select the TextCell Column in the TableView. This step can be a bit tricky, as the first click on the table will select the ScrollView, the second click will select the tableView, the third click will select the column, and the fourth click will select the individual TextCell column. However, you can instead choose to use the Document Outline to expand the table view structure and find the column that way. Switch to the Attributes inspector, and once the column is properly selected, the inspector will display information about the column like this: Switch back to the Bindings Inspector, and expand Value. Check the Bind To box, make sure BugArrayController is selected in the drop down, and enter name for the Model Key Path, exactly as you did with the name textfield. As with setting up the binding on the “name” text field, you are setting the table to display the value for “name” for all of the objects in the NSArrayController. However, using the “arrangedObjects” key returns all of the objects, which is exactly what the table needs, as you are wanting all of the Bug objects to be listed out. Save your changes — time to Build and Run the application! Click the + button — it should add an entry to the table view, and the Name textfield should be empty. Enter the name “Lady Bug” in the name field, and click Enter. You should now see the name Lady Bug in the table and in your name field: Quit your app by selecting ScaryBugsApp/Quit(⌘+Q). Run the app in Xcode again, and you should still see Lady Bug in the table. If you did, you have successfully set up bindings! Congratulations! :] Note: If you stop the app in Xcode, or close the app via the close button, instead of quitting the app as mentioned above, your changes will not be saved. So make sure to follow the steps as directed! :] Bindings: Next Steps Open the Assistant Editor by clicking the second button on the Editor group of buttons on the Xcode toolbar on the top right. Add an outlet by Control+dragging from BugArrayController to MasterViewController.h. Name the outlet bugArrayController as shown below: You can’t directly set a binding for the EDStarRating view’s value through Interface Builder, which is the view for setting a bug rating with the surprised faces. Because EDStarRating’s view is created programmatically, you’ll need to add a little bit of code to make that part work. Go to MasterViewController.m. At the top, add an import as follows: #import "Bug.h" Next, add the following method anywhere in the file between the @implementation and @end lines): -(Bug*)getCurrentBug { if ([[self.bugArrayController selectedObjects] count] > 0) { return [[self.bugArrayController selectedObjects] objectAtIndex:0]; } else { return nil; } } The method above finds which item is selected in the table view (and in actual fact, finds what is selected in the NSArrayController), and returns that entity. At the end of loadView, add the = NO; self.bugRating.displayMode = EDStarRatingDisplayFull; self.bugRating.rating = 0.0; // Manual Bindings [self.bugRating bind:@"rating" toObject:self.bugArrayController withKeyPath:@"selection.rating" options:nil]; [self.bugRating bind:@"editable" toObject:self.bugArrayController withKeyPath:@"selection.@count" options:nil]; } The last two lines you added are programmatically created bindings, rather than bindings created through Interface Builder. Because EDStarRating’s view is created programmatically, you’ll also need to set your bindings programmatically. Here, the bindings for the displayed rating, and whether or not the ratings view is editable are set. There are four things you need to do in order to programmatically set a binding on an object: - bind: Know the key you are binding. In this case, you’re binding both “rating” and “editable” respectively. - toObject: Tell your object what object it’s getting bound to, which is your NSArrayController, bugArrayController. - withKeyPath: The key-path refers to what property or value of your object is getting bound. For rating, you set “selection.rating,” just as you did with the name text field. “selection.@count” will be explained a little bit later, so watch out for that. - options: Finally, you can choose to have “options.” In both cases here you’re passing nil because you don’t need to set values like default placeholder text, or “validates on update.” Just about all of the options you can set are available to you in Interface Builder’s bindings view. Also replace starsSelectionChanged:rating: with the following: -(void)starsSelectionChanged:(EDStarRating*)control rating:(float)rating { Bug *selectedBug = [self getCurrentBug]; if (selectedBug) { selectedBug.rating = [NSNumber numberWithFloat:self.bugRating.rating]; } } The method above handles the update of the currently selected Bug instance after the rating has been changed. The above two methods are very similar to the equivalent methods from the previous tutorial, but they have been reworked to using Core Data. Build and Run the app! You can now change the rating for the Lady Bug record, and for any new bug you may wish to add. If your table is empty, you can’t change the ratings view. Bindings and Enabling Since the ratings view is disabled if there’s no data to edit, you can now use bindings to disable the name field, “-” button and “Change Picture” button if the table is empty, just as you did in the previous tutorial. Switch to MasterViewController.xib. Select the minus (-) button, and go the Bindings Inspector. Under Availability, expand Enabled. In the Model Key Path, enter @count and hit enter. Do the same for the name text field and the “Change Picture” button, as below: Using the selection key here means you are wanting behavior the relates specifically to an object being selected in the table. The “@count” is a Collection Operator that returns the actual count of the selectedObjects array. If it is 0, then these elements will be disabled; if it is 1, they will enable. Run the app and click the minus (-) button to delete records until the table is empty. You should see that the buttons and text field are now disabled. Adding a new entry re-enables them, as shown in the screenshot here: NSValueTransformers: More than meets the eye When you work with Core Data (or any database), you have several ways to save images. One way is to save the image directly to the database. Another option is to save the image to a location on disk, and then save the path to the image in the database as a string. You’ll notice that when you made your Bug entity, the imagePath attribute had a type of String. This is because you are not going to save the image directly to Core Data, but instead will save it to the Application Support directory. Saving an image directory to Core Data can be taxing. By saving the location of the image to Core Data, and the image to a safe location, you run lessen the chances of poor performance of your applications. Are you wondering how a string is going to turn into an image using bindings? Unfortunately, this doesn’t happen automagically. But it can be done with only a few lines of code using an NSValueTransformer. What’s an NSValueTransformer? It is exactly what it sounds like: a value transformer! :] It takes one value and changes, or transforms, it into something else. You’re going to create two new classes which are value transformers – one to handle changing the path string to an image in the detail area, and another to handle changing the path to a thumbnail in the table view. Create the first class by going to File\New\File…. Choose the OS X\Cocoa\Objective-C class template from the choices. Name the class DetailImageTransformer, and make it a subclass of NSValueTransformer. Add the following code to DetailImageTransformer.m (between the @implmentation and @end lines): +(Class)transformedValueClass { return [NSImage class]; } -(id)transformedValue:(id)value { if (value == nil) { return nil; } else { return [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:value]]; } } In the code above you first create a class method that returns a Class, which in this case returns an NSImage class. NSValueTransformers can transform the value of any class to another, and transformedValueClass simply returns the class type that will come from transformedValue: . The second method, transformedValue:, gets a parameter named value passed to it. This value is going to be the path string that is stored in the entity’s imagePath attribute. If the value is empty, then do nothing. However, if it has a value, then return an NSImage with the contents of the image at the specified path. You might ask yourself why there isn’t a conversion going the other way, and what a great question that is. You can override reverseTransformedValue:(id)value and do exactly that. However, for this application, it isn’t necessary, as we are not saving the images through a drag-and-drop, or some other alternative scenario. In the same fashion, create another class by going to File\New\File…. Choose the OS X\Cocoa\Objective-C class template from the choices. Name the class TableImageCellTransformer, and make it a subclass of NSValueTransformer. Open TableImageCellTransformer.m and add the following import to it at the top: #import "NSImage+Extras.h" Then, add the following code to the class implementation: +(Class)transformedValueClass { return [NSImage class]; } -(id)transformedValue:(id)value { if (value == nil) { return nil; } else { NSImage *image = [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:value]]; image = [image imageByScalingAndCroppingForSize:CGSizeMake( 44, 44 )]; return image; } } The above code is very similar to what you did in DetailImageTransformer. The only difference is that when you transform the path, instead of simply returning an image, you scale the image down to 44 x 44 to create a thumbnail version, then return the thumbnail to the caller. In MasterViewController.m, replace the empty implementation for changePicture: with the following: -(IBAction)changePicture:(id)sender { Bug *selectedBug = [self getCurrentBug]; if (selectedBug) { [[IKPictureTaker pictureTaker] beginPictureTakerSheetForWindow:self.view.window withDelegate:self didEndSelector:@selector(pictureTakerDidEnd:returnCode:contextInfo:) contextInfo:nil]; } } This code is very similar to the previous tutorial; the only difference is that the above method checks if a Bug Entity, rather than a SelectedBugDoc. IKPictureTaker is a really helpful class which allows users to choose images by browsing the file system. However, it doesn’t return a name for the image it gets as it is not saving the path or name of the image, just an NSImage instance. To remedy this, you will create a unique string generator to provide a name for the selected images. Add the following method to MasterViewController.m: // Create a unique string for the images -(NSString *)createUniqueString { CFUUIDRef theUUID = CFUUIDCreate(NULL); CFStringRef string = CFUUIDCreateString(NULL, theUUID); CFRelease(theUUID); return (__bridge NSString *)string; } createUniqueString() will return a string made from a UUID, thus ensuring that the photos you add to the application are never named the same as another. Next, you need a way to actually save an image to your Application Support directory. This is important so that no matter what happens to the original image that was selected by the user, the application will still be able to display an image for each record in the application. Switch to MasterViewController.h and add the following property: @property (strong, nonatomic) NSURL *pathToAppSupport; The above property will hold the path to the Application Support directory which is where you’ll be storing the images for the app. Next, switch back to MasterViewController.m and add the following method: -(BOOL)saveBugImage:(NSImage*)image toBug:(Bug*)bug { // 1. Get an NSBitmapImageRep from the image passed in [image lockFocus]; NSBitmapImageRep *imgRep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect(0.0, 0.0, [image size].width, [image size].height)]; [image unlockFocus]; // 2. Create URL to where image will be saved NSURL *pathToImage = [self.pathToAppSupport URLByAppendingPathComponent:[NSString stringWithFormat:@"%@.png",[self createUniqueString]]]; NSData *data = [imgRep representationUsingType: NSPNGFileType properties: nil]; // 3. Write image to disk, set path in Bug if ([data writeToURL:pathToImage atomically:NO]) { bug.imagePath = [pathToImage absoluteString]; return YES; } else { return NO; } } If you review the code above step-by-step, you’ll see that the following actions take place: - Create an NSBitmapImageRep from the image passed in. - Create a unique url string with the .png extension, and append the resulting string to the Application Support directory path. An NSData value is then created from the NSBitmapImageRep. - The data is written to the Application Support directory using the path set in pathToImage. As well, the path string is saved to the current bug’s imagePath attribute. Next switch back to MasterViewController.m and replace the existing empty implementation of pictureTakerDidEnd:returnCode:contextInfo: with the following: -(void) pictureTakerDidEnd:(IKPictureTaker *) picker returnCode:(NSInteger) code contextInfo:(void*) contextInfo { NSImage *image = [picker outputImage]; if( image !=nil && (code == NSOKButton) ) { if ([self makeOrFindAppSupportDirectory]) { Bug *bug = [self getCurrentBug]; if (bug) { [self saveBugImage:image toBug:bug]; } } } } The above code gets the image from the image picker. If the image is valid and the user did not cancel the picker, then the code calls a method to create or find the Application Support directory. This function doesn’t exist yet — you’ll create it a bit later in this tutorial. If creating or finding the Application Support directory was successful, then the code gets the current Bug. Finally if there is a selected bug, then save the image path to that bug record. Now add the makeOrFindAppSupportDirectory method referenced above which guarantees that there will be a directory to save the image to: -(BOOL)makeOrFindAppSupportDirectory { BOOL isDir; NSFileManager *manager = [NSFileManager defaultManager]; if ([manager fileExistsAtPath:[self.pathToAppSupport absoluteString] isDirectory:&isDir] && isDir) { return YES; } else { NSError *error = nil; [manager createDirectoryAtURL:self.pathToAppSupport withIntermediateDirectories:YES attributes:nil error:&error]; if (!error) { return YES; } else { NSLog(@"Error creating directory"); return NO; } } } The above method is fairly straightforward. First, check to see if the path specified in the pathToAppSupport property is a valid directory. If it is a valid directory, return YES. If the path doesn’t exist, then try to create the path. If the attempt succeeds, return YES, otherwise return NO indicating that the Application Support directory does not exist. Now switch to AppDelegate.m and add the following at the end of applicationDidFinishLaunching:: self.masterViewController.pathToAppSupport = [self applicationFilesDirectory]; The above statement uses a method in the AppDelegate to find the Application Support directory, and then creates a special sub-path specific to your app. This path is then passed on to MasterViewController via the pathToAppSupport property. Are you wondering when you can actually try out all of the code you’ve been writing? Don’t worry, you’re getting close! :] Open MasterViewController.xib, and select the NSTableView, being careful to select the table, not the scroll view! Again, check the Document Outline if you’re not sure what is selected, or use the Document Outline to select exactly what you want. In the Attributes Inspector, change Columns to 2. Then resize the first column so that you see both columns. You can resize the columns by selecting the first column in the Document Outline, and then using the resize handle to drag it to the size you want, as shown below: Remember that the first column is the one bound to “name,” and the second one is the new, unbound column. In the Object Library, search for Image Cell. Drag an Image Cell to the new column, as below: With the second column selected, change the order of the columns by dragging the Image Cell column to be the first column, as such: With the Image Cell column selected, go the Bindings Inspector and under “Value”, set Model Key Path to imagePath. For Value Transformer, select TableImageCellTransformer. Also ensure that the Bind checkbox is checked, although it should get automatically get checked when you set the Model Key Path, as seen in the following screenshot: Next, select the detail image view, go to the Bindings Inspector, and set the Model Key Path to imagePath again. However, set the Value Transformer to DetailImageTransformer, as below: Now’s your chance to Build and Run the app! :] If your table is empty, create a bug and give it a name. Click the “Change Picture” button, and find an image you’d like. If you don’t have any other images, there’s always the original lady bug picture in the project folder. Your image will show up in the table cell, and in the detail image as well: If you’d like to see how the image is saved, switch to Finder, select Go > Go to Folder, and type ~/Library/Application Support/com.razeware.ScaryBugsApp/, which is the Application Support sub-folder where your images will be saved. You’ll see two files: the .storedata file, and a png with a random name: At this point, you have fully recreated the application from the previous tutorial, but this time using bindings and Core Data. Much easier this way, eh? :] But wouldn’t it be nice if there were some bugs to view the very first time the app is started, to give the user an idea of what the app looks like, and how it functions? Pre Populating Bugs Open AppDelegate.m and add the following method: -(void)prePopulate { if (![[NSUserDefaults standardUserDefaults] valueForKey:@"sb_FirstRun"]) { NSString *file = @"file://"; NSManagedObject *centipede = [[NSManagedObject alloc] initWithEntity:[NSEntityDescription entityForName:@"Bug" inManagedObjectContext:self.managedObjectContext] insertIntoManagedObjectContext:self.managedObjectContext]; [centipede setValue:[NSNumber numberWithFloat:3] forKey:@"rating"]; [centipede setValue:@"Centipede" forKey:@"name"]; [centipede setValue:[file stringByAppendingString:[[NSBundle mainBundle] pathForImageResource:@"centipede.jpg"]] forKey:@"imagePath"]; NSManagedObject *potatoBug = [[NSManagedObject alloc] initWithEntity:[NSEntityDescription entityForName:@"Bug" inManagedObjectContext:self.managedObjectContext] insertIntoManagedObjectContext:self.managedObjectContext]; [potatoBug setValue:[NSNumber numberWithFloat:4] forKey:@"rating"]; [potatoBug setValue:@"Potato Bug" forKey:@"name"]; [potatoBug setValue:[file stringByAppendingString:[[NSBundle mainBundle] pathForImageResource:@"potatoBug.jpg"]] forKey:@"imagePath"]; NSManagedObject *wolfSpider = [[NSManagedObject alloc] initWithEntity:[NSEntityDescription entityForName:@"Bug" inManagedObjectContext:self.managedObjectContext] insertIntoManagedObjectContext:self.managedObjectContext]; [wolfSpider setValue:[NSNumber numberWithFloat:5] forKey:@"rating"]; [wolfSpider setValue:@"Wolf Spider" forKey:@"name"]; [wolfSpider setValue:[file stringByAppendingString:[[NSBundle mainBundle] pathForImageResource:@"wolfSpider.jpg"]] forKey:@"imagePath"]; NSManagedObject *ladyBug = [[NSManagedObject alloc] initWithEntity:[NSEntityDescription entityForName:@"Bug" inManagedObjectContext:self.managedObjectContext] insertIntoManagedObjectContext:self.managedObjectContext]; [ladyBug setValue:[NSNumber numberWithFloat:1] forKey:@"rating"]; [ladyBug setValue:@"Lady Bug" forKey:@"name"]; [ladyBug setValue:[file stringByAppendingString:[[NSBundle mainBundle] pathForImageResource:@"ladybug.jpg"]] forKey:@"imagePath"]; [[NSUserDefaults standardUserDefaults] setValue:[NSNumber numberWithBool:YES] forKey:@"sb_FirstRun"]; } } In the code above, you’ve created a way to use an NSUserDefault value to determine if the app has been run before. If the app doesn’t have a value for sb_FirstRun, it will create 4 new Bug entities and set sb_FirstRun, so that the same initial Bug information is not added to the app multiple times. Note: NSUserDefaults allows you to create key-value user settings. You could store just about anything you’d like using NSUserDefaults, but you should try to limit it to user settings. At the end of applicationDidFinishLaunching:, add the following line to call the new method: [self prePopulate]; Run the app, and you should see the 4 original tutorial bugs, with their names, images, and ratings, just like in the screenshot below: Note:If you had previously added some data to the app, that data will remain intact. If you had added a Lady Bug record as mentioned previously, you’ll notice that you now have two Lady Bug records, since the initial data addition routine does not check for duplicates! Finishing Touches When working with Core Data, your managedObjectContext isn’t saved until you specifically instruct it to. This is why your bug records aren’t saved unless you quit the app by using the Quit menu option. Check applicationShouldTerminate: in AppDelegate.m to see the relevant code. If your app crashes, or you stop the app via Xcode rather than quitting, you will likely lose any unsaved data. You should provide the user with a way to manually save their data at any point, or else you’ll drive your users buggy! :] Go to MainMenu.xib. In interface builder, you should see a menu bar. If not, you can select Main Menu from the outline view. There are many menu items that you will not need, so remove Edit, Format, and View from the menu by selecting them and clicking delete. If you select the menu items on the main Interface Builder, view and delete them, you’ll notice that there’s a gap left behind! This is because the full menu item sometimes doesn’t get deleted properly. If this happens to you, use the Document Outline view and remove the relevant menu items. Your resulting menu should look like: Select the File menu item in IB, and then Control+drag from Save to App Delegate in the Document Outline. Select saveAction: from the poup. Now, whenever a user performs a File\Save, the context will be saved. In the File menu, change the title for Revert to Saved to Revert to Original via the Attributes Inspector. Then, select the Key Equivalent field and press ⌘R. This will set the menu item’s shortcut to ⌘R. This menu item will delete all of the current Bug records and replace them with the original set, as below: In AppDelegate.h add the following method definition: -(IBAction)resetBugs:(id)sender; Switch to AppDelegate.m and add the following import: #import "Bug.h" Next add the following method: -(IBAction)resetBugs:(id)sender { NSFetchRequest *request = [[NSFetchRequest alloc] initWithEntityName:@"Bug"]; NSError *error; NSArray *allBugs = [self.managedObjectContext executeFetchRequest:request error:&error]; for (Bug *bug in allBugs) { [self.managedObjectContext deleteObject:bug]; } if (!error) { [self saveAction:self]; [[NSUserDefaults standardUserDefaults] setValue:nil forKey:@"sb_FirstRun"]; [self prePopulate]; } } The code above will do an NSFetchRequest to get all of the bugs and delete them. It will then save the context and set sb_FirstRun to nil so that when prePopulate gets called, it will create all the default bugs. Go to MainMenu.xib and Control+drag from Revert to Original to App Delegate and select resetBugs:, as below: Build and run the app! Remove a couple of bug records. Then select File\Revert to Original. All of the original bugs should reappear. You can also try making some changes to a bug record, using File\Save, and then stopping the app via Xcode. Your changes should still be intact when you next run the app. Subclassing NSArrayController Currently, when you delete a bug record, there is no confirmation at all. You tap the minus (-) button and the record immediately gets deleted. But what if you accidentally tapped the button? There is no way to get the record back. It’s best to add a confirmation before you do a destructive operation! :] However, there is no direct way to control the deletion of NSManagedObjects in the application in it’s present state. One way to handle the deletion of objects is through subclassing NSArrayController and overriding the methods used to remove an object. Go to File\New File, select the Objective-C Class template, name the class BugArrayController, and make it a subclass of NSArrayController, as below: Open BugArrayController.h and add support for the NSAlertDelegate protocol by changing the @interface line to look like: #import <Cocoa/Cocoa.h> @interface BugArrayController : NSArrayController <NSAlertDelegate> @end Switch to BugArrayController.m and add the following import at the top: #import "Bug.h" Next, add the following methods: -(void)remove:(id)sender { NSAlert *alert = [[NSAlert alloc] init]; [alert addButtonWithTitle:@"Delete"]; [alert addButtonWithTitle:@"Cancel"]; [alert setMessageText:@"Do you really want to delete this scary bug?"]; [alert setInformativeText:@"Deleting a scary bug cannot be undone."]; [alert setAlertStyle:NSWarningAlertStyle]; [alert setDelegate:self]; [alert respondsToSelector:@selector(doRemove)]; [alert beginSheetModalForWindow:[[NSApplication sharedApplication] mainWindow] modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil]; } -(void)alertDidEnd:(NSAlert*)alert returnCode:(NSInteger)returnCode contextInfo:(void*)contextInfo { if (returnCode == NSAlertFirstButtonReturn) { // We want to remove the saved image along with the bug Bug *bug = [[self selectedObjects] objectAtIndex:0]; NSString *name = [bug valueForKey:@"name"]; if (!([name isEqualToString:@"Centipede"] || [name isEqualToString:@"Potato Bug"] || [name isEqualToString:@"Wolf Spider"] || [name isEqualToString:@"Lady Bug"])) { NSError *error = nil; NSFileManager *manager = [[NSFileManager alloc] init]; [manager removeItemAtURL:[NSURL URLWithString:bug.imagePath] error:&error]; } [super remove:self]; } } By overriding the remove method, you prevent the deletion from happening immediately. Instead, you create an NSAlert to warn the user that what is being done cannot be undone. When the user taps a button on the alert dialog, the alertDidEnd:returnCode:contextInfo: delegate method is executed. alertDidEnd:returnCode:contextInfo: checks to see if the user elected to continue with the deletion by checking if the Delete button was tapped. If so, delete the first selected object in the NSAraryController. An additional bonus of overriding NSArrayController is that you can now delete the image for the deleted bug record from the Application Support directory. In the original version of the code, this would not have been possible. There is also a check to make sure that none of the images for the original data are deleted, since those images come directly from the application bundle. Now it’s time to use your new BugArrayController class, instead of using a plain old NSArrayController!] Open MasterViewController.h and add the following import: #import "BugArrayController.h" Then, change: @property (strong) IBOutlet NSArrayController *bugArrayController; to: @property (strong) IBOutlet BugArrayController *bugArrayController; Next, open MasterViewController.xib, select BugArrayController in the Document Outline, and change its Class to BugArrayController in the Identity Inspector, as such: Sometimes Xcode doesn’t recognize that you’ve changed the class for the BugArrayController. In this case, right-click on the “-” button, and remove the action remove:. Then Control+drag from the “-” button to BugArrayController, and select remove: again to associate the button with the method on the new class. Save your changes and build and run the app! Click the minus (-) button for any record — you should now get a warning. If you click Delete, your bug will be removed, but clicking Cancel aborts the deletion process: And you’re done! Because you know that the only thing more scary than bugs is deleting your hard-entered data by mistake ;] Where To Go From Here? Here is the complete project from the above tutorial. The app is complete at this point, but here are a few things that you might want to try as additional challenges: - Learn how to use View-based cells with bindings. While it isn’t difficult, it is different from what you’ve done here. And fun :] - Add a Search Field to the interface that would allow a user to search the table for bugs. You can do this without adding a single line of code using Bindings. You won’t bind “Value”, but rather, you’ll bind “Predicate.” Leave “Model Key Path” empty; “Predicate Format” is where you will want to use: name contains[c] $value. I hope you’ve enjoyed learning about Cocoa Bindings and Core Data in Mac apps! If you have any comments or questions, please join the forum discussion below! This is a blog post by Andy Pereira, a software developer at USAA in San Antonio, TX, and freelance iOS and OS X developer.
https://www.raywenderlich.com/21752/how-to-use-cocoa-bindings-and-core-data-in-a-mac-app
CC-MAIN-2018-13
en
refinedweb
Are you sure? This action might not be possible to undo. Are you sure you want to continue? O≈ THE BHAGAVADG∫TÅ or THE SONG DIVINE (With Sanskrit Text and English Translation) Gita Press, Gorakhpur India àfl◊fl ◊ÊÃÊ ø Á¬ÃÊ àfl◊fl àfl◊fl ’ãœÈ‡ø ‚πÊ àfl◊fl– àfl◊fl ÁfllÊ º˝ÁfláÊ¢ àfl◊fl àfl◊fl ‚flZ ◊◊ ŒflŒflH ❖ Price : Rs. 6 ( Six Rupees only) Printed & Published by : Gita Press, Gorakhpur—273005 (INDIA) (a unit of Gobind Bhavan-Karyalaya, Kolkata) Phone - (0551) 2334721; Fax - (0551) 2336997 Thirty-eighth Reprint 2007 15,000 Total 10,42,625 ISBN 81-293-0437-6 Publisherís Note As a book of scripture, the Bhagavadg∂tå has assumed a position of universal interest. Its teachings have gained appreciation not only in India, but far beyond its borders, Our G∂tå-Library alone comprises about 1400 editions of the Bhagavadg∂tå published in 34 different languages including 8 foreign languages. This is our humble attempt for bringing out this English edition of the G∂tå in pocket-size and in a popular form. We trust it will find favour with the English-reading public. The English translation of this edition has been based on the Hindi rendering of the G∂tå made by Syt. Jayadayal Goyandka appearing in the G∂tå-Tattva Number of the Hindi monthly ëKalyaní, published by the Gita Press. In preparing the present English translation, the translators have made use, every now and then, of other English translations of the G∂tå, and we express our grateful acknowledgement for the same. In order to add to the utility of this small volume an introduction by Syt. Jayadayal Goyandka and a synopsis of the G∂tå have been prefixed to the translation and an article by the same author bearing on the G∂tå has been appended thereto. óPublisher Z The Greatness of The G∂tå Truly speaking, none has power to describe in words the glory of the G∂tå, for it is a book containing the highest esoteric doctrines. It is the essence of the Vedas; its language is so sweet and simple that man can easily understand it after a little practice; but the thoughts are so deep that none can arrive at their end even after constant study throughout a lifetime. Everyday they exhibit new facets of Truth, therefore they remain ever fresh and new. When scrutinized with a concentrated mind, possessed of faith and reverence, every verse of the G∂tå will clearly appear as full of the deepest mystery. The manner in which the G∂tå describes the virtues, glory and secrets of God, is hardly found in any other scripture; for in other books, the teachings are generally mixed up, more or less, with worldly subjects; but the G∂tå uttered by the Lord is such an incomparable book that not a word will be found in it, which is devoid of some spiritual import. That is why ›r∂ Vedavyåsa, after describing the G∂tå in the Mahåbhårata, said in the end:ó ªËÃÊ ‚ȪËÃÊ ∑§Ã¸√ÿÊ Á∑§◊ãÿÒ— ‡ÊÊSòÊÁflSÃ⁄Ò —– ÿÊ Sflÿ¢ ¬kŸÊ÷Sÿ ◊Èπ¬kÊÁmÁŸ—‚ÎÃÊH The G∂tå should be carefully studied, i.e., after reading the text, its meaning and idea should be gathered and held in the mind. It emanated from the lotus-like lips of Bhagavån Vi¶ƒu Himself, from whose navel sprung the lotus. What is the use of studying the other elaborate scriptures? Moreover, the Lord Himself also described its glory at the end of the G∂tå (Vide Chapter XVIII verses 68 to 71). All men, irrespective of Varƒa and Å‹rama, possess the right to study the G∂tå; the only qualifications needed are faith and reverence, for it is Godís injunction to propagate the G∂tå only among His devotees, and He further said that women, Vai‹yas, ›µudras and even men born of sinful wombs can attain the supreme state of salvation, if they cultivate devotion to Him. And through worship of Him by the performance of their own nature-born duties, men can attain perfection (Chapter XVIII verse 46). Reflection on these verses make it clear that all men have equal right to God-realization. But owing to lack of understanding of the truth behind this subject, many persons who have only heard the name of the G∂tå, make this assertion that the book is intended only for monks and ascetics, and they refrain from placing the book for study before their children out of fear lest through knowledge of the G∂tå the latter renounce their hearths and homes and turn ascetics themselves. But they should consider the fact that Arjuna, who had, due to infatuation, prepared himself to turn away from the duty of a K¶atriya (6) (7) and live on alms, being influenced by the most secret and mysterious teachings of the G∂tå, lived the life of a householder all his life and performed his duties; how can that very G∂tå produce this diametrically opposite result? Therefore, men who desire their own welfare should give up this delusion and with utmost faith and reverence induce their children to study the G∂tå understanding the meaning and the underlying idea of every verse, and while studying and reflecting on it themselves, should, according to the injunction of the Lord, earnestly take to spiritual practice. For obtaining this most valuable human body, it is improper to waste even a single moment of oneís time in indulging in transient enjoyments, the roots of sorrow. Principal Teachings of the G∂tå For His own realization, God has laid down in the G∂tå two principal waysó(1) Så∆khyayoga, and (2) Karmayoga. Of theseó (1) All objects being unreal like the water in a mirage, or the creation of a dream, Guƒas, which are the products of Måyå, move in the Guƒas, understanding this, the sense of doership should be lost with regard to all activities of the mind, senses and the body (Chapter V verses 8-9), and being established ever in identity with all- pervading God, the embodiment of Truth, Knowledge and Bliss, consciousness should be lost of the existence of any other being but God. This is the practice of Så∆khyayoga. (2) Regarding everything as belonging to God, maintaining equanimity in success or failure, renouncing attachment and the desire for fruit, all works should be done according to Godís behests and only for the sake of God (Chapter II verse 48; Chapter V verse 10); and, with utmost faith and reverence, surrendering oneself to God through mind, speech and body, constant meditation on Godís Form with remembrance of His names, virtues and glory, should be practised (Chapter VI verse 47). This is the practice of Yoga by disinterested action. The result of both these practices being the same, they are regarded as one in reality (Chapter V verses 4-5). But during the period of practice, they being different according to the qualifications of the Sådhaka, the two paths have been separately described (Chapter III verse 3). Therefore, the same man cannot tread both the paths at one and the same time, even as though there may be two roads to the Ganges, a person cannot proceed by both the paths at the same time. Out of these, Karmayoga cannot be practised in the stage of Sannyåsa, for in that stage renunciation of Karma in every form has been advised. The practice of Så∆khyayoga, however, is possible in every Å‹rama, or stage of life. If it is argued that the Lord has described Så∆khyayoga as synonymous with Sannyåsa, (8) therefore, Sannyås∂s or monks alone are entitled to practise it, and not householders, the argument is untenable, because in the course of His description of Så∆khyayoga in Chapter II verses 11 to 30, the Lord, here and there, showed to Arjuna that he was qualified to fight, even according to that standard. If householders were ever disqualified for Så∆khyayoga, how could these statements of the Lord be reconciled? True, there is this special saving clause that the Sådhaka qualified for the path of Så∆khya should be devoid of identification with the body; for so long as there is identification of the ego with the body, the practice of Så∆khyayoga cannot be properly understood. That is why the Lord described the practice of Så∆khyayoga as difficult (Chapter V verse 6) and disinterested Karmayoga, being easier of practice, the Lord exhorted Arjuna, every now and then, to practise it, together with constant meditation on him. ÿ¢ ’˝ rÊÔ Ê flL§áÊ ãº˝ L§º˝ ◊L§Ã— SÃÈ ãflÁãà ÁŒ√ÿÒ — SÃflÒ - fl¸ŒÒ— ‚ÊXÔ ¬Œ∑˝§◊ʬÁŸ·ŒÒªÊ¸ÿÁãà ÿ¢ ‚Ê◊ªÊ—–. äÿÊŸÊflÁSÕÃÃŒ˜ÔªÃŸ ◊Ÿ‚Ê ¬‡ÿÁãà ÿ¢ ÿÊÁªŸÊ ÿSÿÊãâ Ÿ ÁflŒÈ— ‚È⁄ Ê‚È⁄ ªáÊÊ ŒflÊÿ ÃS◊Ò Ÿ◊—H ìWe bow to that Supreme Puru¶a, Nåråyaƒa, who is extolled even by great gods like Brahmå, Varuƒa (the god of water), Indra (the god of rain), (9) Rudra (the god of destruction), and the Maruts (the wind-gods) through celestial hymns; whose glories are sung by those proficient in chanting the Såmaveda through the Vedas along with the six A∆gas (branches of knowledge auxiliary to the Vedas), Pada (division of the Vedic text into separate words), Krama and Ja¢å (particular forms of reciting the Vedas) and the Upani¶ads; who is perceived by the Yog∂s by means of their mind made steady through meditation and fixed on the Lord; and whose reality is not known even to gods and Asuras.î ‡ÊÊãÃÊ∑§Ê⁄¢ ÷È¡ª‡ÊÿŸ¢ ¬kŸÊ÷¢ ‚È⁄ ‡Ê¢ Áfl‡flÊœÊ⁄¢ ªŸŸ‚ŒÎ‡Ê¢ ◊ÉÊfláÊZ ‡ÊÈ÷ÊXÔ ◊˜– ‹ˇ◊Ë∑§Êãâ ∑§◊‹ŸÿŸ¢ ÿÊÁªÁ÷äÿʸŸªêÿ¢ fl㌠ÁflcáÊÈ ÷fl÷ÿ„ ⁄¢ ‚fl¸‹Ê∑Ò§∑§ŸÊÕ◊˜H ìObeisance to Vi¶ƒu, the dispeller of the fear of rebirths, the one Lord of all the regions, possessed of a tranquil form, lying on a bed of snake, from whose navel has sprung the lotus, the Lord of all celestials, the support of the universe, similar to the sky, possessed of the colour of a cloud and possessed of handsome limbs, the Lord of Lak¶m∂ (the Goddess of Wealth), having lotus-like eyes, and realized by Yog∂s in meditation.î óJayadayal Goyandka (10) Synopsis of the G∂tå No. of Verse Subject Discussed Chapter I entitled ìThe Yoga of Dejection of Arjunaî 11ó11Description of the principal warriors on both sides with their fighting qualities. 12ó19Blowing of conches by the warriors on both sides. 20ó27Arjuna observes the warriors drawn up for battle. 28ó47Overwhelmed by infatuation, Arjuna gives expression to his faint-heartedness, tenderness and grief. Chapter II entitled ìSå∆khyayogaî (the Yoga of Knowledge) 21ó10 Arjuna and ›r∂ K涃a discussing Arjunaís faint-heartedness. 11ó30Så∆khyayoga (the Yoga of Knowledge) described. 31ó38The K¶atriyaís duty to engage himself in fight. 39ó53Karmayoga (the Yoga of Selfless Action) described. 54ó72Marks of the man of stable mind and his glories described. Chapter III entitled ìKarmayoga, or the Yoga of Actionî 21ó8 Importance of the performance of duty, in a detached way, according to both J¤ånayoga and Karmayoga. 9ó16The necessity of performing sacrifices, etc. 17ó24The necessity for action on the part of the wise, and even on the part of God Himself, for the good of the world. 25ó35Marks of the wise and the unwise; instruction about performance of action without attraction and repulsion. 36ó43How to overcome desire. Chapter IV entitled ìThe Yoga of Knowledge as well as the disciplines of Action and Knowledgeî 1ó18The glory of God with attributes; (12) No. of Verse Subject Discussed Karmayoga, or selfless action, described. 19ó23The conduct of Yog∂s and sages, its glory described. 24ó32Different forms of sacrifices described with their fruits. 33ó42The glory of Knowledge described. Chapter V entitled ìThe Yoga of Action and Knowledgeî 1ó6 Så∆khyayoga and the Yoga of disinterested action described. 7ó12 Marks of the Så∆khyayog∂ and Ni¶kåma Karmayog∂ótheir glories described. 13ó26J¤ånayoga, or the Yoga of Knowledge. 27ó29Dhyånayoga, or meditation, together with Devotion, described. Chapter VI entitled ìThe Yoga of Self-Controlî 1ó4 Karmayoga, or the Yoga of disinterested Action, described; marks of one who has attained Yoga. 5ó10 Urging one to uplift the self; marks of the God-realized soul. 11ó32Detailed description of Dhyånayoga. (13) No. of Verse Subject Discussed 33ó36The question of Mind-control discussed. 37ó47The fate of one who falls from Yoga; the glory of Dhyånayoga described. Chapter VII entitled ìThe Yoga of J¤åna (Knowledge of Nirguƒa Brahma) and Vij¤åna (Knowledge of Manifest Divinity)î 1ó7 Wisdom with real Knowledge of Manifest Divinity. 8ó12 Inherence of God in all objects as their Cause. 13ó19Condemnation of men of demoniacal nature and praise of devotees. 20ó23The question of worship of other gods. 24ó30Condemnation of men, who are ignorant of the glory and true nature of God, and approbation of those who know them. Chapter VIII entitled ìThe Yoga of the Indestructible Brahmaî 1ó7 Answer to Arjunaís seven questions on Brahma, Adhyåtma and Karma (Action), etc. 8ó22 The subject of Bhaktiyoga discussed. 23ó28The bright and dark paths described. (14) No. of Verse Subject Discussed Chapter IX entitled ìThe Yoga of Sovereign Science and the Sovereign Secret.î 1ó6 The subject of J¤åna (Knowledge) with its glory described. 7ó10 The origin of the world discussed. 11ó15Condemnation of men of the demoniacal nature, who despise God, and the method of Bhajana of men possessed of the divine nature. 16ó19Description of God, as the soul of everything, and His glory. 20ó25The fruits of worship with a motive and without motive. 26ó34The glory of Devotion practised disinterestedly. Chapter X entitled ìThe Yoga of Divine Gloriesî 1ó7 Description of Godís glories and power of Yoga with the fruit of their knowledge. 8ó11 Bhaktiyogaóits fruit and glory. 12ó18 Arjuna offers his praises to God and prays to the Lord for a description of His glories and power of Yoga. 19ó42The Lord describes His glories and power of Yoga. (15) No. of Verse Subject Discussed Chapter XI entitled ìThe Yoga of the Vision of the Universal Formî 1ó4 Arjuna prays to the Lord for a vision of His Universal Form. 5ó8 The Lord describes His Universal Form. 9ó14 The Universal Form described by Sa¤jaya to Dhætarå¶¢ra. 15ó31Arjuna sees the Lordís Universal Form and offers praises to the Lord. 32ó34God describes His glory and exhorts Arjuna to fight. 35ó46Overtaken by fright, Arjuna offers praises to God, and prays for a sight of the Lordís Four-armed Form. 47ó50 The Lord describes the glory of the vision of His Universal Form, and reveals to Arjuna His Four-armed, gentle Form. 51ó55 The impossibility of obtaining a sight of the Four-armed Form without exclusive Devotion, which is described with its fruit. Chapter XII entitled ìThe Yoga of Devotionî 1ó12 Respective merits of the worshippers (16) No. of Verse Subject Discussed of God with Form and without Form, and the means of God-realization. 13ó20Marks of the God-realized soul. Chapter XIII entitled ìThe Yoga of Discrimination between the Field and the Knower of the Fieldî 1ó18 The subject of ìFieldî and the Knower of the ìFieldî, together with Knowledge. 19ó34The subject of Prakæti and Puru¶a (Matter and Spirit) together with knowledge. Chapter XIV entitled ìThe Yoga of Division of three Guƒasî 1ó4 The glory of Knowledge; evolution of the world from Prakæti and Puru¶a. 5ó18 The qualities of Sattva, Rajas and Tamas described. 19ó27Means of God-realization, and marks of the soul who has transcended the Guƒas. Chapter XV entitled ìThe Yoga of the Supreme Personî 1ó6 Description of the Universe as a tree and the means of God-realization. (17) No. of Verse Subject Discussed 7ó11 The J∂våtmå, or individual soul. 12ó15 God and His Glory described. 16ó20The perishable (bodies of all beings), the imperishable (J∂våtmå) and the Supreme Person. Chapter XVI entitled ìThe Yoga of Division between the Divine and the Demoniacal Propertiesî 1ó5 The Divine and the demoniacal properties described with their fruit. 6ó20 Marks of man possessed of the demoniacal properties and their damnation described. 21ó24 Instruction about renouncing conduct opposed to the scriptures and exhortation to follow the scriptures. Chapter XVII entitled ìThe Yoga of the Division of the Threefold Faithî 1ó6 Discussion on Faith and on the fate of men who perform austere penance not enjoined by the scriptures. 7ó22 Different kinds of food, sacrifice, penance and charity described. (18) No. of Verse Subject Discussed 23ó28 The meaning and intention of uttering ìO≈ Tat Satî explained. Chapter XVIII entitled ìThe Yoga of Liberation through the Path of Knowledge and Self-Surrenderî 1ó12 The subject of Tyåga or Relinquishment. 13ó18Causes of Karma according to the Så∆khya system. 19ó40Classification of knowledge, action, doer, reason, firmness and joy according to the three Guƒas. 41ó48Duties attaching to each caste and the fruit of their performance. 49ó55The path of Knowledge described. 56ó66The path of Karmayoga, or selfless action, together with Devotion. 67ó78The glory of the G∂tå described. God-realization through Practice of Renunciation. ....... 205ó224 Z (19) No. of Verse Subject Discussed ∑ΧcáÊÊà¬⁄¢ Á∑§◊Á¬ Ãûfl◊„¢ Ÿ ¡ÊŸ ˙>ii¤⁄ ◊i·◊Ÿ Ÿ◊— The Bhagavadg∂tå The Song Divine Chapter I œÎÃ⁄ Êc≈˛ © flÊø œ◊ˇr·r ∑=ˇr·r ‚◊flar ¤¤-‚fl—– ◊r◊∑r— ¤r¢z flr‡¤fl f∑◊∑fla ‚=¬¤+ {+ Dhætarå¶¢ra said: Sa¤jaya, gathered on the holy land of Kuruk¶etra, eager to fight, what did my sons and the sons of P僌u do? (1) ‚Ü¡ÿ © flÊø Œr≈˜flr a ¤r¢z flrŸt∑ √¤¸… Œ¤rœŸtaŒr– •r¤r¤◊¤‚y r¤ ⁄ r¬r fl¤Ÿ◊’˝flta˜+ ·+ Sa¤jaya said: At that time, seeing the army of the P僌avas drawn up for battle and approaching Droƒåcårya, King Duryodhana spoke the following words : (2) ¤‡¤ar ¤r¢z ¤·rr¢rr◊r¤r¤ ◊„at ¤◊¸◊˜– √¤¸… r ¢˝¤Œ¤·r¢r afl f‡rr¤¢r œt◊ar+ -+ Behold, O Revered Master, the mighty army of the sons of P僌u arrayed for battle by your talented pupil, Dhæ¶¢adyumna, son of Drupada. (3) 22 •·r ‡r¸⁄ r ◊„ rflr‚r ¤t◊r¬Ÿ‚◊r ¤fœ– ¤¤œrŸr ffl⁄ r≈ ‡¤ ¢˝¤Œ‡¤ ◊„ r⁄ ¤—+ ×+ œr≈∑a‡¤f∑arŸ— ∑rf‡r⁄ r¬‡¤ flt¤flrŸ˜– ¤=f¬-∑f-a¤r¬‡¤ ‡rª¤‡¤ Ÿ⁄ ¤y fl—+ ~+ ¤œr◊-¤‡¤ ffl∑˝r-a s -r◊ı¬r‡¤ flt¤flrŸ˜– ‚ı¤¢˝r ¢˝ı¤Œ¤r‡¤ ‚fl ∞fl ◊„ r⁄ ¤r—+ º+ There are in this army, heroes wielding mighty bows and equal in military prowess to Bh∂ma and ArjunaóSåtyaki and Virå¢a and the Mahårath∂ (warrior chief) Drupada; Dhæ¶¢aketu, Cekitåna and the valiant King of Kå‹∂, and Purujit, Kuntibhoja, and ›aibya, the best of men, and mighty Yudhåmanyu, and valiant Uttamaujå, Abhimanyu, the son of Subhadrå, and the five sons of Draupad∂ó all of them Mahårath∂s (warrior chiefs). (4ó6) •t◊r∑ a fflf‡rr≈ r ¤ arf-Ÿ’rœ fç¬r-r◊– Ÿr¤∑r ◊◊ ‚-¤t¤ ‚=-rr¤ ar-’˝fltf◊ a+ ¬+ O best of Bråhmaƒas, know them also who are the principal warriors on our sideó the generals of my army. For your information I mention them. (7) ¤flr-¤tr◊‡¤ ∑¢r‡¤ ∑¤‡¤ ‚f◊fa=¬¤—– •‡fl-¤r◊r ffl∑¢r‡¤ ‚ı◊Œf-rta¤fl ¤+ c+ ìYourself and Bh∂¶ma and Karƒa and Kæpa, who is ever victorious in battle; and even so A‹vatthåmå, Vikarƒa and Bhµuri‹ravå (the son of Somadatta); (8) Bhagavadg∂tå [Ch. 1 23 •-¤ ¤ ’„ fl— ‡r¸⁄ r ◊Œ¤ -¤+¬tfflar—– ŸrŸr‡rt·r¤˝„ ⁄ ¢rr— ‚fl ¤qffl‡rr⁄ Œr—+ º + And there are many other heroes, equipped with various weapons and missiles, who have staked their lives for me, all skilled in warfare. (9) •¤¤rta aŒt◊r∑ ’‹ ¤tr◊rf¤⁄ fˇra◊˜– ¤¤rta f-flŒ◊a¤r ’‹ ¤t◊rf¤⁄ fˇra◊˜+ {«+ This army of ours, fully protected by Bh∂¶ma, is unconquerable; while that army of theirs, guarded in everyway by Bh∂ma, is easy to conquer.(10) •¤Ÿ¤ ¤ ‚fl¤ ¤¤r¤rn◊flft¤ar—– ¤tr◊◊flrf¤⁄ ˇr-a ¤fl-a— ‚fl ∞fl f„ + {{+ Therefore, stationed in your respective positions on all fronts, do you all guard Bh∂¶ma in particular on all sides. (11) at¤ ‚=¬Ÿ¤-„ ¤ ∑=flq— f¤ar◊„ —– f‚„ ŸrŒ fflŸur¤r— ‡rg Œ·◊ı ¤˝ar¤flrŸ˜+ {·+ The grand old man of the Kaurava race, their glorious grand-patriarch Bh∂¶ma, cheering up Duryodhana, roared terribly like a lion and blew his conch. (12) aa— ‡rg r‡¤ ¤¤‡¤ ¤¢rflrŸ∑nr◊πr—– ‚„ ‚flr+¤„ -¤-a ‚ ‡rªŒta◊‹r˘¤fla˜+ {-+ Then conchs, kettledrums, tabors, drums and trumpets suddenly blared forth and the noise was tumultuous. (13) Text 9ó13] Bhagavadg∂tå 24 aa— ‡fla„ ¤¤+ ◊„ fa t¤-ŒŸ ft¤aı– ◊rœfl— ¤r¢z fl‡¤fl fŒ√¤ı ‡rg ı ¤˝Œ·◊a—+ {×+ Then, seated in a glorious chariot drawn by white horses, ›r∂ K涃a as well as Arjuna blew their celestial conchs. (14) ¤r=¤¬-¤ z ¤t∑‡rr ŒflŒ-r œŸ=¬¤—– ¤ı¢z˛ Œ·◊ı ◊„ r‡rg ¤t◊∑◊r fl∑rŒ⁄ —+ {~+ ›r∂ K涃a blew His conch named På¤cajanya; Arjuna, Devadatta; while Bh∂ma of ferocious deeds blew his mighty conch PauƒŒra. (15) •Ÿ-affl¬¤ ⁄ r¬r ∑-at¤·rr ¤fœfr∆⁄ —– Ÿ∑‹— ‚„ Œfl‡¤ ‚rrr¤◊f¢r¤r¤∑ı+ {º+ King Yudhi¶¢hira, son of Kunt∂, blew his conch Anantavijaya, while Nakula and Sahadeva blew theirs, known as Sugho¶a and Maƒipu¶paka respectively. (16) ∑r‡¤‡¤ ¤⁄ ◊rflr‚— f‡rπ¢z t ¤ ◊„ r⁄ ¤—– œr≈urŸr ffl⁄ r≈ ‡¤ ‚r-¤f∑‡¤r¤⁄ rf¬a—+ {¬+ ¢˝¤Œr ¢˝ı¤Œ¤r‡¤ ‚fl‡r— ¤f¤flt¤a– ‚ı¤¢˝‡¤ ◊„ r’r„ — ‡rg r-Œ·◊— ¤¤∑˜ ¤¤∑˜+ {c+ And the excellent archer, the King of Kå‹∂, and ›ikhaƒŒ∂ the Mahårath∂ (the great chariot-warrior), Dhæ¶¢adyumna and Virå¢a, and invincible Såtyaki, Drupada as well as the five sons of Draupad∂, and the mighty-armed Abhimanyu, son of Subhadrå, all of them, O lord of the earth, severally blew their respective conchs from all sides. (17-18) Bhagavadg∂tå [Ch. 1 25 ‚ rrr¤r œra⁄ rr≈˛ r¢rr z Œ¤rfŸ √¤Œr⁄ ¤a˜– Ÿ¤‡¤ ¤f¤flt ¤fl a◊‹r √¤ŸŸrŒ¤Ÿ˜+ {º+ And the terrible sound, echoing through heaven and earth, rent the hearts of Dhætarå¶¢raís army. (19) •¤ √¤flft¤ar-Œr≈˜ flr œra⁄ rr≈˛ rŸ˜ ∑f¤·fl¬—– ¤˝fl-r ‡rt·r‚r¤ra œŸ=ur¤ ¤r¢z fl—+ ·«+ z ¤t∑‡r aŒr flr¤¤f◊Œ◊r„ ◊„ t¤a– •¡È¸Ÿ © flÊø ‚Ÿ¤r=¤¤r◊·¤ ⁄ ¤ t¤r¤¤ ◊˘-¤a+ ·{+ Now, O lord of the earth, seeing your sons arrayed against him and when missiles were ready to be hurled, Arjuna, who had the figure of Hanumån on the flag of his chariot, took up his bow and then addressed the following words to ›r∂ K涃a; ìK涃a, place my chariot between the two armies. (20-21) ¤rflŒarf-Ÿ⁄ tˇr˘„ ¤rŒ˜œ∑r◊rŸflft¤arŸ˜– ∑◊¤r ‚„ ¤rq√¤◊ft◊-⁄ ¢r‚◊u◊+ ··+ ìAnd keep it there till I have carefully observed these warriors drawn up for battle, and have seen with whom I have to engage in this fight. (22) ¤r-t¤◊rŸrŸflˇr˘„ ¤ ∞a˘·r ‚◊rnar—– œra⁄ rr≈˛ t¤ Œ’q¤q f¤˝¤f¤∑t¤fl—+ ·-+ ìI shall scan the well-wishers of evil-minded Duryodhana, in this war whoever have assembled on his side and are ready for the fight.î (23) Text 19ó23] Bhagavadg∂tå 26 ‚Ü¡ÿ © flÊø ∞fl◊+r z ¤t∑‡rr nz r∑‡rŸ ¤r⁄ a– ‚Ÿ¤r=¤¤r◊·¤ t¤r¤f¤-flr ⁄ ¤r-r◊◊˜+ ·×+ ¤tr◊¢˝r¢r¤˝◊πa— ‚fl¤r ¤ ◊„ tfˇrar◊˜– s flr¤ ¤r¤ ¤‡¤ar-‚◊flar-∑=fŸfa+ ·~+ Sa¤jaya said: O king, thus addressed by Arjuna, ›r∂ K涃a placed the magnificent chariot between the two armies in front of Bh∂¶ma, Droƒa and all the kings and said, ìArjuna, behold these Kauravas assembled here.î (24-25) a·rr¤‡¤f-t¤ar-¤r¤— f¤a Ÿ¤ f¤ar◊„ rŸ˜– •r¤r¤r-◊ra‹r-¤˝ra -¤·rr-¤ı·rr-‚πtta¤r + ·º+ ‡fl‡r⁄ r-‚z Œ‡¤fl ‚Ÿ¤r=¤¤r⁄ f¤– Now Arjuna saw stationed there in both the armies his uncles, grand-uncles and teachers, even great grand-uncles, maternal uncles, brothers and cousins, sons and nephews, and grand-nephews, even so friends, fathers-in-law and well-wishers as well. (26 & first half of 27) ar-‚◊tˇ¤ ‚ ∑ı-a¤— ‚flr-’-œ¸Ÿflft¤arŸ˜+ ·¬+ ∑¤¤r ¤⁄ ¤rfflr≈ r ffl¤tŒfªrŒ◊’˝flta˜– Seeing all the relations present there, Arjuna was overcome with deep compassion and spoke thus in sorrow. (Second half of 27 and first half of 28) Bhagavadg∂tå [Ch. 1 27 •¡È¸Ÿ © flÊø Œr≈˜ fl◊ tfl¬Ÿ ∑r¢r ¤¤-‚ ‚◊¤ft¤a◊˜+ ·c+ ‚tŒf-a ◊◊ nr·rrf¢r ◊π ¤ ¤f⁄ ‡rr¤fa– fl¤¤‡¤ ‡r⁄ t⁄ ◊ ⁄ r◊„ ¤‡¤ ¬r¤a+ ·º+ Arjuna said: K涃a, as I see these kinsmen arrayed for battle, my limbs give way, and my mouth is getting parched; nay, a shiver runs through my body and hair stands on end. (Second half of 28 and 29) nr¢z tfl n‚a „ tar-fl¤¤fl ¤f⁄ Œna– Ÿ ¤ ‡r¤Ÿrr¤flt¤ra ¤˝◊atfl ¤ ◊ ◊Ÿ—+ -«+ The bow, G僌∂va, slips from my hand and my skin too burns all over; my mind is whirling, as it were, and I can no longer hold myself steady. (30) fŸf◊-rrfŸ ¤ ¤‡¤rf◊ ffl¤⁄ tarfŸ ∑‡rfl– Ÿ ¤ >r¤r˘Ÿ¤‡¤rf◊ „ -flr tfl¬Ÿ◊r„ fl+ -{+ And, Ke‹ava, I see such omens of evil, nor do I see any good in killing my kinsmen in battle. (31) Ÿ ∑rz˜ ˇr ffl¬¤ ∑r¢r Ÿ ¤ ⁄ rº¤ ‚πrfŸ ¤– f∑ Ÿr ⁄ rº¤Ÿ nrffl-Œ f∑ ¤rn¬tfflaŸ flr+ -·+ K涃a, I do not covet victory, nor kingdom, nor pleasures. Govinda, of what use will kingdom or luxuries or even life be to us! (32) Text 28ó32] Bhagavadg∂tå 28 ¤¤r◊¤ ∑rz˜ fˇra Ÿr ⁄ rº¤ ¤rnr— ‚πrfŸ ¤– a ;◊˘flft¤ar ¤q ¤˝r¢rrt-¤¤-flr œŸrfŸ ¤+ --+ •r¤r¤r— f¤a⁄ — ¤·rrta¤fl ¤ f¤ar◊„ r—– ◊ra‹r— ‡fl‡r⁄ r— ¤ı·rr— ‡¤r‹r— ‚r’f-œŸta¤r+ -×+ Those very persons for whose sake we covet the kingdom, luxuries and pleasuresñteachers, uncles, sons and nephews and even so, grand- uncles and great grand-uncles, maternal uncles, fathers-in-law, grand-nephews, brothers-in-law and other relationsñare here arrayed on the battlefield staking their lives and wealth. (33-34) ∞ar-Ÿ „ -af◊-ø rf◊ rŸar˘f¤ ◊œ‚¸ŒŸ– •f¤ ·r‹r¤¤⁄ rº¤t¤ „ ar— f∑ Ÿ ◊„ t∑a+ -~+ O Slayer of Madhu, I do not want to kill them, even though they slay me, even for the sovereignty over the three worlds; how much the less for the kingdom here on earth! (35) fŸ„ -¤ œra⁄ rr≈˛ r-Ÿ— ∑r ¤˝tfa— t¤r¬rŸrŒŸ– ¤r¤◊flr>r¤Œt◊r-„ -flarŸraarf¤Ÿ— + -º+ K涃a, how can we hope to be happy slaying the sons of Dhætarå¶¢ra; by killing even these desperadoes, sin will surely accrue to us. (36) at◊r-Ÿr„ r fl¤ „ -a œra⁄ rr≈˛ r-tfl’r-œflrŸ˜– tfl¬Ÿ f„ ∑¤ „ -flr ‚fπŸ— t¤r◊ ◊rœfl+ -¬+ Bhagavadg∂tå [Ch. 1 29 Therefore, K涃a, it does not behove us to kill our relations, the sons of Dhætarå¶¢ra. For, how can we be happy after killing our own kinsmen? (37) ¤ut¤a Ÿ ¤‡¤f-a ‹r¤r¤„ a¤a‚—– ∑‹ˇr¤∑a Œr¤ f◊·r¢˝r„ ¤ ¤ra∑◊˜+ -c+ ∑¤ Ÿ -r¤◊t◊rf¤— ¤r¤rŒt◊rf-Ÿflfaa◊˜– ∑‹ˇr¤∑a Œr¤ ¤˝¤‡¤fǬŸrŒŸ+ -º+ Even though these people, with their mind blinded by greed, perceive no evil in destroying their own race and no sin in treason to friends, why should not we, O K涃a, who see clearly the sin accruing from the destruction of oneís family, think of desisting from committing this foul deed. (38-39) ∑‹ˇr¤ ¤˝¢r‡¤f-a ∑‹œ◊r— ‚ŸraŸr—– œ◊ Ÿr≈˛ ∑‹ ∑-tŸ◊œ◊r˘f¤¤fl-¤a+ ׫+ Age-long family traditions disappear with the destruction of a family; and virtue having been lost, vice takes hold of the entire race. (40) •œ◊rf¤¤flr-∑r¢r ¤˝Œr¤f-a ∑‹ft·r¤—– t·rt¤ Œr≈ r‚ flrr¢r¤ ¬r¤a fl¢r‚¿ ⁄ —+ ×{+ With the preponderance of vice, K涃a, the women of the family become corrupt; and with the corruption of women, O descendant of V涃i, there ensues an intermixture of castes. (41) Text 38ó41] Bhagavadg∂tå 30 ‚¿ ⁄ r Ÿ⁄ ∑r¤fl ∑‹rŸrŸr ∑‹t¤ ¤– ¤af-a f¤a⁄ r n¤r ‹taf¤¢z rŒ∑f∑˝¤r—+ ×·+ Progeny due to promiscuity damns the destroyers of the race as well as the race itself. Deprived of the offerings of rice and water (›råddha, Tarpaƒa etc.,) the manes of their race also fall. (42) Œr¤⁄ a— ∑‹rŸrŸr fl¢r‚¿ ⁄ ∑r⁄ ∑—– s -‚ru-a ¬rfaœ◊r— ∑‹œ◊r‡¤ ‡rr‡flar—+ ×-+ Through these evils bringing about an intermixture of castes, the age-long caste traditions and family customs of the killers of kinsmen get extinct. (43) s -‚-Ÿ∑‹œ◊r¢rr ◊Ÿr¤r¢rr ¬ŸrŒŸ– Ÿ⁄ ∑˘fŸ¤a flr‚r ¤flat-¤Ÿ‡r>r◊+ ××+ K涃a, we hear that men who have lost their family traditions dwell in hell for an indefinite period of time. (44) •„ r ’a ◊„ -¤r¤ ∑a √¤flf‚ar fl¤◊˜– ¤¢˝rº¤‚π‹r¤Ÿ „ -a tfl¬Ÿ◊uar—+ ×~+ Oh what a pity! Though possessed of intelligence we have set our mind on the commission of a great sin; that due to lust for throne and enjoyment we are intent on killing our own kinsmen. (45) ¤fŒ ◊r◊¤˝at∑r⁄ ◊‡rt·r ‡rt·r¤r¢r¤—– œra⁄ rr≈˛ r ⁄ ¢r „ -¤ta-◊ ˇr◊a⁄ ¤fla˜+ ׺+ Bhagavadg∂tå [Ch. 1 31 It would be better for me if the sons of Dhætarå¶¢ra, armed with weapons, kill me in battle, while I am unarmed and unresisting. (46) ‚Ü¡ÿ © flÊø ∞fl◊¤-flr¬Ÿ— ‚z˜ =¤ ⁄ ¤r¤t¤ s ¤rffl‡ra˜– ffl‚º¤ ‚‡r⁄ ¤r¤ ‡rr∑‚fflªŸ◊rŸ‚—+ ׬+ Sa¤jaya said: Arjuna, whose mind was agitated by grief on the battlefield, having spoken thus, and having cast aside his bow and arrows, sank into the hinder part of his chariot. ˘¤Ÿlfl¤iŒ¤iªi Ÿi◊ ¤˝· first chapter entitled ìThe Yoga of Dejection of Arjuna.î Z Text 47] Bhagavadg∂tå Chapter II ‚Ü¡ÿ © flÊø a a¤r ∑¤¤rfflr≈◊>r¤¸¢rr∑‹ˇr¢r◊˜– ffl¤tŒ-af◊Œ flr¤¤◊flr¤ ◊œ‚¸ŒŸ—+ {+ Sa¤jaya said : ›r∂ K涃a then addressed the following words to Arjuna, who was, as mentioned before, overwhelmed with pity, whose eyes were filled with tears and agitated, and who was full of sorrow. (1) üÊË÷ªflÊŸÈ flÊø ∑at-flr ∑‡◊‹f◊Œ ffl¤◊ ‚◊¤ft¤a◊˜– •Ÿr¤¬r≈ ◊tflª¤◊∑tfa∑⁄ ◊¬Ÿ + ·+ ›r∂ Bhagavån said : Arjuna, how has this infatuation overtaken you at this odd hour? It is shunned by noble souls; neither will it bring heaven, nor fame to you. (2) ¤‹ª¤ ◊r t◊ n◊— ¤r¤ Ÿa-flƒ¤¤¤ua– ˇr¢˝ z Œ¤Œı’r¤ -¤¤-flrf-rr∆ ¤⁄-a¤+ -+ Yield not to unmanliness, Arjuna; this does not become you. Shaking off this base faint- heartedness stand-up, O scorcher of enemies.(3) •¡È¸Ÿ © flÊø ∑¤ ¤tr◊◊„ ‚z˜ =¤ ¢˝r¢r ¤ ◊œ‚¸ŒŸ– ;¤f¤— ¤˝fa¤r-t¤rf◊ ¤¸¬r„ rflf⁄ ‚¸ŒŸ+ ×+ 33 Arjuna said : How K涃a, shall I fight Bh∂¶ma and Droƒa with arrows on the battlefield? They are worthy of deepest reverence, O destroyer of foes. (4) n=Ÿ„ -flr f„ ◊„ rŸ¤rflrŸ˜ >r¤r ¤r+ ¤ˇ¤◊¤t„ ‹r∑– „ -flr¤∑r◊rta n=fŸ„ fl ¤=¬t¤ ¤rnr-=fœ⁄ ¤˝fŒªœrŸ˜+ ~+ It is better to live on alms in this world without slaying these noble elders, because even after killing them we shall after all enjoy only bloodstained pleasures in the form of wealth and sense-enjoyments. (5) Ÿ ¤af笗 ∑a⁄ -Ÿr n⁄ t¤r- ¤çr ¬¤◊ ¤fŒ flr Ÿr ¬¤¤—– ¤rŸfl „ -flr Ÿ f¬¬tffl¤r◊- ta˘flft¤ar— ¤˝◊π œra⁄ rr≈˛ r—+ º+ We do not even know which is preferable for usóto fight or not to fight; nor do we know whether we shall win or whether they will conquer us. Those very sons of Dhætarå¶¢ra, killing whom we do not even wish to live, stand in the enemy ranks. (6) ∑r¤¢¤Œr¤r¤„ atfl¤rfl— ¤-ø rf◊ -flr œ◊‚r◊¸… ¤ar—– ¤-ø˛ ¤— t¤rf-Ÿf‡¤a ’˝¸f„ a-◊ f‡rr¤ta˘„ ‡rrfœ ◊r -flr ¤˝¤-Ÿ◊˜+ ¬+ Text 5ó7] Bhagavadg∂tå 34 With my very being smitten by the vice of faint-heartedness and my mind puzzled with regard to duty, I beseech You! tell me that which is decidedly good; I am your disciple. Pray, instruct me, who have taken refuge in You. (7) Ÿ f„ ¤˝¤‡¤rf◊ ◊◊r¤ŸurŒ˜ ¤-ø r∑◊-ø r¤¢rf◊f-¢˝¤r¢rr◊˜ – •flrt¤ ¤¸◊rfl‚¤-Ÿ◊q- ⁄ rº¤ ‚⁄ r¢rr◊f¤ ¤rfœ¤-¤◊˜+ c+ For even on obtaining undisputed sovereignty and an affluent kingdom on this earth and lordship over the gods, I do not see any means that can drive away the grief which is drying up my senses. (8) ‚Ü¡ÿ © flÊø ∞fl◊¤-flr z ¤t∑‡r nz r∑‡r— ¤⁄-a¤– Ÿ ¤r-t¤ ;fa nrffl-Œ◊¤-flr a¸r¢rt ’¤¸fl „ + º + Sa¤jaya said : O King, having thus spoken to ›r∂ K涃a, Arjuna again said to Him, ìI will not fight,î and became silent. (9) a◊flr¤ z ¤t∑‡r— ¤˝„ ‚f-Ÿfl ¤r⁄ a– ‚Ÿ¤r=¤¤r◊·¤ ffl¤tŒ-af◊Œ fl¤—+ {«+ Then, O Dhætarå¶¢ra, ›r∂ K涃a, as if smiling addressed the following words to grieving Arjuna in the midst of the two armies. (10) Bhagavadg∂tå [Ch. 2 35 üÊË÷ªflÊŸÈ flÊø •‡rr-¤rŸ-fl‡rr¤t-fl ¤˝-rrflrŒr‡¤ ¤r¤‚– nar‚¸Ÿnar‚¸‡¤ ŸrŸ‡rr¤f-a ¤f¢z ar—+ {{+ ›r∂ Bhagavån said: Arjuna, you grieve over those who should not be grieved for and yet speak like the learned; wise men do not sorrow over the dead or the living. (11) Ÿ -flflr„ ¬ra Ÿr‚ Ÿ -fl Ÿ◊ ¬Ÿrfœ¤r—– Ÿ ¤fl Ÿ ¤fflr¤r◊— ‚fl fl¤◊a— ¤⁄ ◊˜+ {·+ In fact, there was never a time when I was not, or when you or these kings were not. Nor is it a fact that hereafter we shall all cease to be. (12) Œf„ Ÿr˘ft◊-¤¤r Œ„ ∑ı◊r⁄ ¤ıflŸ ¬⁄ r– a¤r Œ„ r-a⁄ ¤˝rftaœt⁄ ta·r Ÿ ◊nfa+ {-+ Just as boyhood, youth and old age are attributed to the soul through this body, even so it attains another body. The wise man does not get deluded about this. (13) ◊r·rrt¤‡rrta ∑ı-a¤ ‡rtarr¢r‚πŒ—πŒr—– •rn◊r¤rf¤Ÿr˘fŸ-¤rtarftafaˇrtfl ¤r⁄ a+ {×+ O son of Kunt∂, the contacts between the senses and their objects, which give rise to the feelings of heat and cold, pleasure and pain etc., are transitory and fleeting; therefore, Arjuna, endure them. (14) ¤ f„ Ÿ √¤¤¤--¤a ¤=¤ ¤=¤¤¤– ‚◊Œ—π‚π œt⁄ ‚r˘◊a-flr¤ ∑r¤a+ {~+ Text 11ó15] Bhagavadg∂tå 36 Arjuna, the wise man to whom pain and pleasure are alike, and who is not tormented by these contacts, becomes eligible for immortality. (15) Ÿr‚ar fflua ¤rflr Ÿr¤rflr fflua ‚a—– s ¤¤r⁄ f¤ Œr≈ r˘-at-flŸ¤rta-flŒf‡rf¤—+ {º+ The unreal has no existence, and the real never ceases to be; the reality of both has thus been perceived by the seers of Truth. (16) •fflŸrf‡r a afçfq ¤Ÿ ‚flf◊Œ aa◊˜– fflŸr‡r◊√¤¤t¤rt¤ Ÿ ∑f‡¤-∑a◊„ fa+ {¬+ Know that alone to be imperishable which pervades this universe; for no one has power to destroy this indestructible substance. (17) •-afl-a ;◊ Œ„ r fŸ-¤t¤r+r— ‡r⁄ tf⁄ ¢r—– •Ÿrf‡rŸr˘¤˝◊¤t¤ at◊ru·¤tfl ¤r⁄ a+ {c+ All these bodies pertaining to the imperishable, indefinable and eternal soul are spoken of as perishable; therefore, Arjuna, fight. (18) ¤ ∞Ÿ flf-r „ -ar⁄ ¤‡¤Ÿ ◊-¤a „ a◊˜– s ¤ı aı Ÿ ffl¬rŸtar Ÿr¤ „ f-a Ÿ „ -¤a+ {º+ Both of them are ignorant, he who considers the soul to be capable of killing and he who takes it as killed; for verily the soul neither kills, nor is killed. (19) Ÿ ¬r¤a f◊˝¤a flr ∑Œrf¤- -Ÿr¤ ¤¸-flr ¤fflar flr Ÿ ¤¸¤—– •¬r fŸ-¤— ‡rr‡flar˘¤ ¤⁄ r¢rr- Ÿ „ -¤a „ -¤◊rŸ ‡r⁄ t⁄ + ·«+ Bhagavadg∂tå [Ch. 2 37 The soul is never born, nor it ever dies; nor does it become only after being born. For, it is unborn, eternal, everlasting and primeval; even though the body is slain, the soul is not. (20) flŒrfflŸrf‡rŸ fŸ-¤ ¤ ∞Ÿ◊¬◊√¤¤◊˜– ∑¤ ‚ ¤=¤— ¤r¤ ∑ rrra¤fa „ f-a ∑◊˜+ ·{+ Arjuna, the man who knows this soul to be imperishable; eternal and free from birth and decayóhow and whom will he cause to be killed, how and whom will he kill? (21) flr‚rf‚ ¬t¢rrfŸ ¤¤r ffl„ r¤ ŸflrfŸ nˆ rfa Ÿ⁄ r˘¤⁄ rf¢r– a¤r ‡r⁄ t⁄ rf¢r ffl„ r¤ ¬t¢rr- -¤-¤rfŸ ‚¤rfa ŸflrfŸ Œ„ t+ ··+ As a man shedding worn-out garments, takes other new ones, likewise, the embodied soul, casting off worn-out bodies, enters into others that are new. (22) ŸŸ fø -Œf-a ‡rt·rrf¢r ŸŸ Œ„ fa ¤rfl∑—– Ÿ ¤Ÿ ¤‹Œ¤--¤r¤r Ÿ ‡rr¤¤fa ◊r=a—+ ·-+ Weapons cannot cut it nor can fire burn it; water cannot wet it nor can wind dry it. (23) •-ø ur˘¤◊Œrnr˘¤◊¤‹ur˘‡rrr¤ ∞fl ¤– fŸ-¤— ‚flna— t¤r¢r⁄ ¤‹r˘¤ ‚ŸraŸ—+ ·×+ For this soul is incapable of being cut, or burnt by fire; nor can it be dissolved by water and is undriable by air as well; This soul is eternal, omnipresent, immovable, constant and everlasting. (24) Text 21ó24] Bhagavadg∂tå 38 •√¤+r˘¤◊f¤--¤r˘¤◊ffl∑r¤r˘¤◊-¤a – at◊rŒfl fflfŒ-flŸ ŸrŸ‡rrf¤a◊„ f‚+ ·~+ This soul is unmanifest; it is incomprehensible and it is spoken of as immutable. Therefore, knowing it as such, you should not grieve. (25) •¤ ¤Ÿ fŸ-¤¬ra fŸ-¤ flr ◊-¤‚ ◊a◊˜– a¤rf¤ -fl ◊„ r’r„ r Ÿfl ‡rrf¤a◊„ f‚+ ·º+ And, Arjuna, if you should suppose this soul to be subject to constant birth and death, even then you should not grieve like this. (26) ¬rat¤ f„ œ˝flr ◊-¤œ˝fl ¬-◊ ◊at¤ ¤– at◊rŒ¤f⁄ „ r¤˘¤ Ÿ -fl ‡rrf¤a◊„ f‚+ ·¬+ For, in that case death is certain for the born, and rebirth is inevitable for the dead. You should not, therefore, grieve over the inevitable. (27) •√¤+rŒtfŸ ¤¸arfŸ √¤+◊·¤rfŸ ¤r⁄ a– •√¤+fŸœŸr-¤fl a·r ∑r ¤f⁄ ŒflŸr+ ·c+ Arjuna, before birth beings are not manifest to our human senses; on death they return to the unmanifest again. They are manifest only in the interim between birth and death. What occasion, then, for lamentation? (28) •r‡¤¤fl-¤‡¤fa ∑f‡¤ŒŸ- ◊r‡¤¤flçŒfa a¤fl ¤r-¤—– •r‡¤¤fl¤rŸ◊-¤— n¢rrfa >r-flrt¤Ÿ flŒ Ÿ ¤fl ∑f‡¤a˜+ ·º+ Bhagavadg∂tå [Ch. 2 39 Hardly anyone perceives this soul as marvellous, scarce another likewise speaks thereof as marvellous, and scarce another hears of it as marvellous, while there are some who know it not even on hearing of it. (29) Œ„ t fŸ-¤◊fl·¤r˘¤ Œ„ ‚flt¤ ¤r⁄ a– at◊r-‚flrf¢r ¤¸arfŸ Ÿ -fl ‡rrf¤a◊„ f‚+ -«+ Arjuna, this soul dwelling in the bodies of all, can never be slain; therefore, you should not mourn for anyone. (30) tflœ◊◊f¤ ¤rflˇ¤ Ÿ ffl∑fr¤a◊„ f‚– œr¤rfq ¤qr-ø˛ ¤r˘-¤-ˇrf·r¤t¤ Ÿ fflua+ -{+ Besides, considering your own duty too, you should not waver, for there is nothing more welcome for a man of the warrior class than a righteous war. (31) ¤Œ-ø ¤r ¤r¤¤-Ÿ tflnçr⁄ ◊¤rfla◊˜– ‚fπŸ— ˇrf·r¤r— ¤r¤ ‹¤-a ¤q◊tŒ‡r◊˜+ -·+ Arjuna, happy are the K¶atriyas who get such an unsolicited opportunity for war, which is an open gateway to heaven. (32) •¤ ¤-flf◊◊ œr¤ ‚z ˜ n˝r◊ Ÿ ∑f⁄ r¤f‚– aa— tflœ◊ ∑tfa ¤ f„ -flr ¤r¤◊flrtt¤f‚+ --+ Now, if you refuse to fight this righteous war, then, shirking your duty and losing your reputation, you will incur sin. (33) •∑tfa ¤rf¤ ¤¸arfŸ ∑¤f¤r¤f-a a˘√¤¤r◊˜– ‚r¤rfflat¤ ¤r∑tfa◊⁄ ¢rrŒfaf⁄ -¤a+ -×+ Text 30ó34] Bhagavadg∂tå 40 Nay, people will also pour undying infamy on you; and infamy brought on a man enjoying popular esteem is worse than death. (34) ¤¤r¢˝¢rrŒ¤⁄ a ◊t¤-a -flr ◊„ r⁄ ¤r—– ¤¤r ¤ -fl ’„ ◊ar ¤¸-flr ¤rt¤f‚ ‹rrrfl◊˜+ -~+ And the warrior-chiefs who thought highly of you, will now despise you, thinking that it was fear which drove you away from battle. (35) •flr-¤flrŒr‡¤ ’„¸ -flfŒr¤f-a aflrf„ ar—– fŸ-Œ-atafl ‚r◊º¤ aar Œ—πa⁄ Ÿ f∑◊˜+ -º+ And your enemies, disparaging your might, will speak many unbecoming words; what can be more distressing than this? (36) „ ar flr ¤˝rtt¤f‚ tfln f¬-flr flr ¤rˇ¤‚ ◊„ t◊˜– at◊rŒf-rr∆ ∑ı-a¤ ¤qr¤ ∑afŸ‡¤¤—+ -¬+ Die, and you will win heaven; conquer, and you enjoy sovereignty of the earth; therefore, stand up, Arjuna, determined to fight. (37) ‚ πŒ —π ‚◊ ∑ -flr ‹r¤r‹r¤ı ¬¤r¬¤ı– aar ¤qr¤ ¤º¤tfl Ÿfl ¤r¤◊flrtt¤f‚+ -c+ Treating alike victory and defeat, gain and loss, pleasure and pain, get ready for the battle; fighting thus you will not incur sin. (38) ∞¤r a˘f¤f„ ar ‚rz˜ =¤ ’fq¤rn f-fl◊r n¢r– ’qvr ¤+r ¤¤r ¤r¤ ∑◊’-œ ¤˝„ rt¤f‚+ -º+ Arjuna, this attitude of mind has been presented Bhagavadg∂tå [Ch. 2 41 to you from the point of view of J¤ånayoga; now hear the same as presented from the standpoint of Karmayoga (the Yoga of selfless action). Equipped with this attitude of mind, you will be able to throw off completely the shackles of Karma. (39) Ÿ„ rf¤∑˝◊Ÿr‡rr˘fta ¤˝-¤flr¤r Ÿ fflua– tflr¤◊t¤t¤ œ◊t¤ ·rr¤a ◊„ ar ¤¤ra˜+ ׫+ In this path (of disinterested action) there is no loss of effort, nor is there fear of contrary result, even a little practice of this discipline saves one from the terrible fear of birth and death. (40) √¤fl‚r¤rf-◊∑r ’fq⁄ ∑„ ∑=Ÿ-ŒŸ– ’„ ‡rrπr nŸ-ar‡¤ ’q¤r˘√¤fl‚rf¤Ÿr◊˜+ ×{+ Arjuna, in this Yoga (of disinterested action) the intellect is determinate and directed singly towards one ideal; whereas the intellect of the undecided (ignorant men moved by desires) wanders in all directions, after innumerable aims. (41) ¤rf◊◊r ¤fr¤ar flr¤ ¤˝flŒ--¤ffl¤f‡¤a—– flŒflrŒ⁄ ar— ¤r¤ Ÿr-¤Œtatfa flrfŒŸ—+ ×·+ ∑r◊r-◊rŸ— tfln¤⁄ r ¬-◊∑◊¤‹¤˝Œr◊˜– f∑˝¤rffl‡r¤’„ ‹r ¤rn‡fl¤nfa ¤˝fa+ ×-+ ¤rn‡fl¤¤˝‚+rŸr a¤r¤z a¤a‚r◊˜– √¤fl‚r¤rf-◊∑r ’fq— ‚◊rœı Ÿ fflœt¤a+ ××+ Arjuna, those who are full of worldly desires and devoted to the letter of the Vedas, who look upon heaven, as the supreme goal and argue that there is nothing beyond heaven are unwise. They utter Text 40ó44] Bhagavadg∂tå 42 flowery speech recommending many rituals of various kinds for the attainment of pleasure and power with rebirth as their fruit. Those whose minds are carried away by such words, and who are deeply attached to pleasures and worldly power, cannot attain the determinate intellect concentrated on God. (42ó44) ·rn¢¤ffl¤¤r flŒr fŸt·rn¢¤r ¤flr¬Ÿ– fŸç-çr fŸ-¤‚-flt¤r fŸ¤rnˇr◊ •r-◊flrŸ˜+ ×~+ Arjuna, the Vedas thus deal with the evolutes of the three Guƒas (modes of Prakæti), viz., worldly enjoyments and the means of attaining such enjoy- ments; be thou indifferent to these enjoyments and their means, rising above pairs of opposites like pleasure and pain etc., established in the Eternal Existence (God), absolutely unconcerned about the fulfilment of wants and the preservation of what has been already attained, and self-controlled. (45) ¤rflrŸ¤ s Œ¤rŸ ‚fla— ‚rt‹arŒ∑– arflr-‚fl¤ flŒ¤ ’˝rzr¢rt¤ ffl¬rŸa—+ ׺+ A Bråhmaƒa, who has obtained enlightenment, has as much use for all the Vedas as one who stands at the brink of a sheet of water overflowing on all sides has for a small reservoir of water. (46) ∑◊¢¤flrfœ∑r⁄ ta ◊r ¤‹¤ ∑Œr¤Ÿ– ◊r ∑◊¤‹„ a¤¸◊r a ‚y r˘t-fl∑◊f¢r+ ׬+ Your right is to work only and never to the fruit thereof. Do not be the cause of the fruit of action; nor let your attachment be to inaction. (47) Bhagavadg∂tå [Ch. 2 43 ¤rnt¤— ∑= ∑◊rf¢r ‚y -¤¤-flr œŸ=¬¤– f‚qvf‚qvr— ‚◊r ¤¸-flr ‚◊-fl ¤rn s -¤a+ ×c+ Arjuna, perform your duties established in Yoga, renouncing attachment, and be even-minded in success and failure; evenness of mind is called ëYogaí. (48) Œ¸⁄ ¢r nfl⁄ ∑◊ ’fq¤rnrqŸ=¬¤– ’qı ‡r⁄ ¢r◊f-fl-ø ∑¤¢rr— ¤‹„ afl—+ ׺+ Action with a selfish motive is far inferior to this Yoga in the form of equanimity. Do seek refuge in this equipoise of mind, Arjuna; for poor and wretched are those who are instrumental in making their actions bear fruit. (49) ’fq¤+r ¬„ rat„ s ¤ ‚∑aŒr∑a– at◊rurnr¤ ¤º¤tfl ¤rn— ∑◊‚ ∑ı‡r‹◊˜+ ~«+ Endowed with equanimity, one sheds in this life both good and evil. Therefore, strive for the practice of this Yoga of equanimity. Skill in action lies in the practice of this Yoga. (50) ∑◊¬ ’fq¤+r f„ ¤‹ -¤¤-flr ◊Ÿtf¤¢r—– ¬-◊’-œfflfŸ◊+r— ¤Œ n-ø --¤Ÿr◊¤◊˜+ ~{+ For, wise men possessing equipoised mind, renouncing the fruit of actions and freed from the shackles of birth, attain the blissful supreme state. (51) ¤Œr a ◊r„ ∑f‹‹ ’fq√¤faaf⁄ r¤fa– aŒr n-arf‚ fŸflŒ >rra√¤t¤ >rat¤ ¤+ ~·+ When your mind will have fully crossed the mire of delusion, you will then grow indifferent Text 48ó52] Bhagavadg∂tå 44 to the enjoyments of this world and the next that have been heard of as well as to those that are yet to be heard of. (52) >rfaffl¤˝fa¤-Ÿr a ¤Œr t¤rt¤fa fŸ‡¤‹r– ‚◊rœrfl¤‹r ’fqtaŒr ¤rn◊flrtt¤f‚+ ~-+ When your intellect, confused by hearing conflicting statements, will rest steady and undistracted in meditation on God, you will then attain Yoga (everlasting union with God). (53) •¡È¸Ÿ © flÊø ft¤a¤˝-rt¤ ∑r ¤r¤r ‚◊rfœt¤t¤ ∑‡rfl– ft¤aœt— f∑ ¤˝¤r¤a f∑◊r‚ta fl˝¬a f∑◊˜+ ~×+ Arjuna said : K涃a, what is the definition (mark) of a God-realized soul, stable of mind and established in Samådhi (perfect tranquillity of mind)? How does the man of stable mind speak, how does he sit, how does he walk? (54) üÊË÷ªflÊŸÈ flÊø ¤˝¬„ rfa ¤Œr ∑r◊r-‚flr-¤r¤ ◊ŸrnarŸ˜– •r-◊-¤flr-◊Ÿr ar≈ — ft¤a¤˝-rtaŒr-¤a+ ~~+ ›r∂ Bhagavån said: Arjuna, when one thoroughly casts off all cravings of the mind, and is satisfied in the Self through the joy of the Self, he is then called stable of mind. (55) Œ—πrflŸf窟◊Ÿr— ‚π¤ fflnat¤„ —– flta⁄ rn¤¤∑˝rœ— ft¤aœt◊fŸ=-¤a+ ~º+ The sage, whose mind remains unperturbed amid sorrows, whose thirst for pleasures has altogether Bhagavadg∂tå [Ch. 2 45 disappeared, and who is free from passion, fear and anger, is called stable of mind. (56) ¤— ‚fl·rrŸf¤tŸ„ ta-r-¤˝rt¤ ‡r¤r‡r¤◊˜– Ÿrf¤Ÿ-Œfa Ÿ çfr≈ at¤ ¤˝-rr ¤˝fafr∆ar+ ~¬+ He who is unattached to everything, and meeting with good and evil, neither rejoices nor recoils, his mind is stable. (57) ¤Œr ‚„ ⁄ a ¤r¤ ∑¸◊r˘y rŸtfl ‚fl‡r—– ;f-¢˝¤r¢rtf-¢˝¤r¤+¤tat¤ ¤˝-rr ¤˝fafr∆ar+ ~c+ When, like a tortoise, that draws in its limbs from all directions, he withdraws all his senses from the sense-objects, his mind becomes steady. (58) ffl¤¤r fflfŸfla-a fŸ⁄ r„ r⁄ t¤ Œf„ Ÿ—– ⁄ ‚fl¬ ⁄ ‚r˘t¤t¤ ¤⁄ Œr≈˜ flr fŸflaa+ ~º+ Sense-objects turn away from him, who does not enjoy them with his senses; but the taste for them persists. This relish also disappears in the case of the man of stable mind when he realizes the Supreme. (59) ¤aar nf¤ ∑ı-a¤ ¤=¤t¤ ffl¤f‡¤a—– ;f-¢˝¤rf¢r ¤˝◊r¤tfŸ „ ⁄ f-a ¤˝‚¤ ◊Ÿ—+ º«+ Turbulent by nature, the senses (not free from attachment) even of a wise man, who is practising self-control, forcibly carry away his mind, Arjuna.(60) arfŸ ‚flrf¢r ‚¤r¤ ¤+ •r‚ta ◊-¤⁄ —– fl‡r f„ ¤t¤f-¢˝¤rf¢r at¤ ¤˝-rr ¤˝fafr∆ ar+ º{+ Therefore, having controlled all the senses and concentrating his mind, he should sit for meditation, devoting himself heart and soul to Me. Text 57ó61] Bhagavadg∂tå 46 For, he whose senses are under his control, is known to have a stable mind. (61) ·¤r¤ar ffl¤¤r-¤‚— ‚y ta¤¸¤¬r¤a– ‚y r-‚=¬r¤a ∑r◊— ∑r◊r-∑˝rœr˘f¤¬r¤a+ º·+ The man dwelling on sense-objects develops attach- ment for them; from attachment springs up desire, and from desire (unfulfilled) ensues anger. (62) ∑˝rœrÇflfa ‚r◊r„ — ‚r◊r„ r-t◊faffl¤˝◊—– t◊fa¤˝‡rrŒ˜ ’fqŸr‡rr ’fqŸr‡rr-¤˝¢r‡¤fa+ º-+ From anger arises delusion; from delusion, confusion of memory; from confusion of memory, loss of reason; and from loss of reason one goes to complete ruin. (63) ⁄ rnç¤ffl¤+ta ffl¤¤rfŸf-¢˝¤‡¤⁄ Ÿ˜– •r-◊fl‡¤fflœ¤r-◊r ¤˝‚rŒ◊fœn-ø fa+ º×+ But the self-controlled Sådhaka, while enjoying the various sense-objects through his senses, which are disciplined and free from likes and dislikes, attains placidity of mind. (64) ¤˝‚rŒ ‚flŒ—πrŸr „ rfŸ⁄ t¤r¤¬r¤a– ¤˝‚-Ÿ¤a‚r nr‡r ’fq— ¤¤flfar∆ a+ º~+ With the attainment of such placidity of mind, all his sorrows come to an end; and the intellect of such a person of tranquil mind soon withdrawing itself from all sides, becomes firmly established in God. (65) Ÿrfta ’fq⁄ ¤+t¤ Ÿ ¤r¤+t¤ ¤rflŸr– Ÿ ¤r¤rfl¤a— ‡rrf-a⁄ ‡rr-at¤ ∑a— ‚π◊˜+ ºº+ Bhagavadg∂tå [Ch. 2 47 He who has not controlled his mind and senses can have no determinate intellect, nor contemplation. Without contemplation, he can have no peace; and how can there be happiness for one lacking peace of mind? (66) ;f-¢˝¤r¢rr f„ ¤⁄ ar ¤-◊Ÿr˘Ÿfflœt¤a– aŒt¤ „ ⁄ fa ¤˝-rr flr¤Ÿrflf◊flrr¤f‚+ º¬+ As the wind carries away a boat upon the waters, even so of the senses moving among sense-objects, the one to which the mind is attached, takes away his discrimination. (67) at◊rut¤ ◊„ r’r„ r fŸn„ tarfŸ ‚fl‡r—– ;f-¢˝¤r¢rtf-¢˝¤r¤+¤tat¤ ¤˝-rr ¤˝fafr∆ ar+ ºc+ Therefore, Arjuna, he, whose senses are completely restrained from their objects, is said to have a stable mind. (68) ¤r fŸ‡rr ‚fl¤¸arŸr at¤r ¬rnfa ‚¤◊t– ¤t¤r ¬rn˝fa ¤¸arfŸ ‚r fŸ‡rr ¤‡¤ar ◊Ÿ—+ ºº+ That which is night to all beings, in that state of Divine Knowledge and Supreme Bliss the God- realized Yog∂ keeps awake, and that (the ever- changing, transient worldly happiness) in which all beings keep awake, is night to the seer. (69) •r¤¸¤◊r¢r◊¤‹¤˝far∆ - ‚◊¢˝◊r¤— ¤˝ffl‡rf-a ¤ça˜– aç-∑r◊r ¤ ¤˝ffl‡rf-a ‚fl ‚ ‡rrf-a◊rtŸrfa Ÿ ∑r◊∑r◊t+ ¬«+ Text 67ó70] Bhagavadg∂tå 48 As the waters of different rivers enter the ocean, which, though full on all sides, remains undisturbed; likewise, he, in whom all enjoyments merge themselves without causing disturbance, attains peace; not he who hankers after such enjoyments. (70) ffl„ r¤ ∑r◊r-¤— ‚flr-¤◊r‡¤⁄ fa fŸ—t¤„ —– fŸ◊◊r fŸ⁄ „ ¿ r⁄ — ‚ ‡rrf-a◊fœn-ø fa+ ¬{+ He who has given up all desires, and moves free from attachment, egoism and thirst for enjoyment attains peace. (71) ∞¤r ’˝rzrt ft¤fa— ¤r¤ ŸŸr ¤˝rt¤ ffl◊nfa– ft¤-flrt¤r◊-a∑r‹˘f¤ ’˝zrfŸflr¢r◊-ø fa+ ¬·+ Arjuna, such is the state of the God-realized soul; having reached this state, he overcomes delusion. And established in this state, even at the last moment, he attains Brahmic Bliss. (72) ‚i÷˜ º¤¤iªi Ÿi◊ l, second chapter entitled ìSå∆khyayogaî (the Yoga of Knowledge). Z Bhagavadg∂tå [Ch. 2 Chapter III •¡¸ÈŸ © flÊø º¤r¤‚t ¤-∑◊¢rta ◊ar ’fq¬ŸrŒŸ– af-∑ ∑◊f¢r rrr⁄ ◊r fŸ¤r¬¤f‚ ∑‡rfl+ {+ Arjuna said : K涃a if You consider Knowledge as superior to Action, why then do You urge me to this dreadful action, Ke‹ava! (1) √¤rf◊>r¢rfl flr¤¤Ÿ ’fq ◊r„ ¤‚tfl ◊– aŒ∑ flŒ fŸf‡¤-¤ ¤Ÿ >r¤r˘„ ◊rtŸ¤r◊˜+ ·+ You are, as it were, puzzling my mind by these seemingly conflicting expressions; therefore, tell me the one definite discipline by which I may obtain the highest good. (2) üÊË÷ªflÊŸÈ flÊø ‹r∑˘ft◊f-çfflœr fŸr∆ r ¤⁄ r ¤˝r+r ◊¤rŸrr– -rrŸ¤rnŸ ‚rz˜ =¤rŸr ∑◊¤rnŸ ¤rfnŸr◊˜+ -+ ›r∂ Bhagavån said: Arjuna, in this world two courses of Sådhanå (spiritual discipline) have been enunciated by Me in the past. In the case of the Så∆khyayog∂, the Sådhanå proceeds along the path of Knowledge; whereas in the case of the Karma- yog∂, it proceeds along the path of Action. (3) Ÿ ∑◊¢rr◊Ÿr⁄ r¤r-Ÿr∑r¤ ¤=¤r˘‡Ÿa– Ÿ ¤ ‚--¤‚ŸrŒfl f‚fq ‚◊fœn-ø fa+ ×+ 50 Man does not attain freedom from action (culmination of the discipline of Action) without entering upon action; nor does he reach perfection (culmination of the discipline of Knowledge) merely by ceasing to act. (4) Ÿ f„ ∑f‡¤-ˇr¢r◊f¤ ¬ra far∆ -¤∑◊∑a˜– ∑r¤a nfl‡r— ∑◊ ‚fl— ¤˝∑fa¬n¢r—+ ~+ Surely, none can ever remain inactive even for a moment; for, everyone is helplessly driven to action by modes of Prakæti. (5) ∑◊f-¢˝¤rf¢r ‚¤r¤ ¤ •rta ◊Ÿ‚r t◊⁄ Ÿ˜– ;f-¢˝¤r¤rf-fl◊¸… r-◊r f◊º¤r¤r⁄ — ‚ s -¤a+ º+ He who outwardly restraining the organs of sense and action, sits mentally dwelling on the objects of senses, that man of deluded intellect is called a hypocrite. (6) ¤ft-flf-¢˝¤rf¢r ◊Ÿ‚r fŸ¤r¤r⁄ ¤a˘¬Ÿ– ∑◊f-¢˝¤— ∑◊¤rn◊‚+— ‚ fflf‡rr¤a+ ¬+ On the other hand, he who controlling the organs of sense and action by the power of his will, and remaining unattached, undertakes the Yoga of selfless Action through those organs, Arjuna, he excels. (7) fŸ¤a ∑= ∑◊ -fl ∑◊ º¤r¤r n∑◊¢r—– ‡r⁄ t⁄ ¤r·rrf¤ ¤ a Ÿ ¤˝f‚qvŒ∑◊¢r—+ c+ Therefore, do you perform your allotted duty; for action is superior to inaction. Desisting from action, you cannot even maintain your body. (8) Bhagavadg∂tå [Ch. 3 51 ¤-rr¤r-∑◊¢rr˘-¤·r ‹r∑r˘¤ ∑◊’-œŸ—– aŒ¤ ∑◊ ∑ı-a¤ ◊+‚y — ‚◊r¤⁄ + º + Man is bound by his own action except when it is performed for the sake of sacrifice. Therefore, Arjuna, do you efficiently perform your duty, free from attachment, for the sake of sacrifice alone. (9) ‚„ ¤-rr— ¤˝¬r— ‚r≈˜ flr ¤⁄ rflr¤ ¤˝¬r¤fa—– •ŸŸ ¤˝‚fflr¤·fl◊¤ flr˘ft-flr≈∑r◊œ∑˜+ {«+ Having created mankind along with (the spirit of) sacrifice at the beginning of creation, the creator, Brahmå, said to them, ìYou shall prosper by this; may this yield the enjoyments you seek. (10) Œflr-¤rfl¤arŸŸ a Œflr ¤rfl¤-a fl—– ¤⁄ t¤⁄ ¤rfl¤-a— >r¤— ¤⁄ ◊flrtt¤¤+ {{+ Foster the gods through this sacrifice, and let the gods be gracious to you. Thus, each fostering the other selflessly, you will attain the highest good. (11) ;r≈ r-¤rnrf-„ flr Œflr Œrt¤-a ¤-r¤rfflar—– aŒ-rrŸ¤˝Œr¤+¤r ¤r ¤z˜ + taŸ ∞fl ‚—+ {·+ Fostered by sacrifice, the gods will surely bestow on you unasked all the desired enjoyments. He who enjoys the gifts bestowed by them without offering anything to them in return, is undoubtedly a thief. (12) ¤-rf‡rr≈ rf‡rŸ— ‚-ar ◊-¤-a ‚flf∑fr’¤—– ¤=¬a a -flrr ¤r¤r ¤ ¤¤--¤r-◊∑r⁄ ¢rra˜+ {-+ Text 9ó13] Bhagavadg∂tå 52 The virtuous who partake of what is left over after sacrifice, are absolved of all sins. Those sinful ones who cook for the sake of nourishing their bodies alone, partake of sin only. (13) •-ŸrÇflf-a ¤¸arfŸ ¤¬-¤rŒ-Ÿ‚r¤fl—– ¤-rrÇflfa ¤¬-¤r ¤-r— ∑◊‚◊Çfl—+ {×+ ∑◊ ’˝zrrÇfl fflfq ’˝zrrˇr⁄ ‚◊Çfl◊˜– at◊r-‚flna ’˝zr fŸ-¤ ¤-r ¤˝fafr∆ a◊˜+ {~+. (14-15) ∞fl ¤˝flfaa ¤∑˝ ŸrŸfla¤at„ ¤—– •rrr¤f⁄ f-¢˝¤r⁄ r◊r ◊rrr ¤r¤ ‚ ¬tflfa+ {º+ Arjuna, he who does not follow the wheel of creation thus set going in this world i.e., does not perform his duties, leads a sinful and sensual life, he lives in vain. (16) ¤t-flr-◊⁄ fa⁄ fl t¤rŒr-◊ata‡¤ ◊rŸfl—– •r-◊-¤fl ¤ ‚-ar≈ tat¤ ∑r¤ Ÿ fflua+ {¬+ He, however, who takes delight in the Self alone and is gratified with the Self, and is contented in the Self, has no duty. (17) Bhagavadg∂tå [Ch. 3 53 Ÿfl at¤ ∑aŸr¤r Ÿr∑aŸ„ ∑‡¤Ÿ– Ÿ ¤rt¤ ‚fl¤¸a¤ ∑f‡¤Œ¤√¤¤r>r¤—+ {c+ In this world that great soul has nothing to gain by action nor by abstaining from action; nor has he selfish dependence of any kind on any creature. (18) at◊rŒ‚+— ‚aa ∑r¤ ∑◊ ‚◊r¤⁄ – •‚+r nr¤⁄ -∑◊ ¤⁄ ◊rtŸrfa ¤¸=¤—+ {º+ Therefore, go on efficiently doing your duty at all times without attachment. Doing work without attachment man attains the Supreme. (19) ∑◊¢rfl f„ ‚f‚fq◊rft¤ar ¬Ÿ∑rŒ¤—– ‹r∑‚z˜ n˝„ ◊flrf¤ ‚r¤‡¤-∑a◊„ f‚+ ·«+ It is through action without attachment alone that Janaka and other wise men reached perfection. Having in view the maintenance of the world order too, you should take to action. (20) ¤uŒr¤⁄ fa >rr∆ ta-rŒfla⁄ r ¬Ÿ—– ‚ ¤-¤˝◊r¢r ∑=a ‹r∑taŒŸflaa+ ·{+ For whatever a great man does, that very thing other men also do; whatever standard he sets up, the generality of men follow the same. (21) Ÿ ◊ ¤r¤rfta ∑a√¤ f·r¤ ‹r∑¤ f∑=¤Ÿ– ŸrŸflrta◊flrta√¤ fla ∞fl ¤ ∑◊f¢r+ ··+ Arjuna, there is no duty in all the three worlds for Me to perform, nor is there anything worth attaining, unattained by Me; yet I continue to work. (22) Text 18ó22] Bhagavadg∂tå 54 ¤fŒ n„ Ÿ fla¤ ¬ra ∑◊¢¤af-¢˝a—– ◊◊ fl-◊rŸfla-a ◊Ÿr¤r— ¤r¤ ‚fl‡r—+ ·-+ Should I not engage in action, scrupulously at any time, great harm will come to the world; for, Arjuna, men follow My way in all matters. (23) s -‚tŒ¤f⁄ ◊ ‹r∑r Ÿ ∑¤r ∑◊ ¤Œ„ ◊˜– ‚¿ ⁄ t¤ ¤ ∑ar t¤r◊¤„ -¤rf◊◊r— ¤˝¬r—+ ·×+ If I ever cease to act, these worlds would perish; nay, I should prove to be the cause of confusion, and of the destruction of these people. (24) ‚+r— ∑◊¢¤fflçr‚r ¤¤r ∑flf-a ¤r⁄ a– ∑¤rfççrta¤r‚+f‡¤∑t¤‹r∑‚z˜ n˝„ ◊˜ + ·~+ Arjuna, as the unwise act with attachment, so should the wise man, with a view to maintain the world order, act without attachment. (25) Ÿ ’fq¤Œ ¬Ÿ¤Œ-rrŸr ∑◊‚fy Ÿr◊˜– ¬r¤¤-‚fl∑◊rf¢r fflçr-¤+— ‚◊r¤⁄ Ÿ˜+ ·º+ A wise man established in the Self should not unsettle the mind of the ignorant attached to action, but should get them to perform all their duties, duly performing his own duties. (26) ¤˝∑a— f∑˝¤◊r¢rrfŸ n¢r— ∑◊rf¢r ‚fl‡r—– •„ ¿ r⁄ ffl◊¸… r-◊r ∑ar„ f◊fa ◊-¤a+ ·¬+ In fact all actions are being performed by the modes of Prakæti (Primordial Matter). The fool, whose mind is deluded by egoism, thinks: ìI am the doer.î (27) Bhagavadg∂tå [Ch. 3 55 a-flffl-r ◊„ r’r„ r n¢r∑◊ffl¤rn¤r—– n¢rr n¢r¤ fla-a ;fa ◊-flr Ÿ ‚¬ra+ ·c+ However, he, who has true insight into the respective spheres of Guƒas (modes of Prakæti) and their actions, holding that it is the Guƒas (in the shape of the senses, mind, etc.,) that move among the Guƒas (objects of perception), does not get attached to them, Arjuna. (28) ¤˝∑an¢r‚r◊¸… r— ‚¬r-a n¢r∑◊‚– arŸ∑-tŸfflŒr ◊-Œr-∑-tŸffl-Ÿ ffl¤r‹¤a˜+ ·º+ Those who are completely deluded by the Guƒas (modes) of Prakæti remain attached to those Guƒas and actions; the man of perfect Knowledge should not unsettle the mind of those ignorants of imperfect knowledge. (29) ◊f¤ ‚flrf¢r ∑◊rf¢r ‚--¤t¤r·¤r-◊¤a‚r– fŸ⁄ r‡rtfŸ◊◊r ¤¸-flr ¤·¤tfl fflnaºfl⁄ —+ -«+ Therefore, dedicating all actions to Me with your mind fixed on Me, the Self of all, freed from desire and the feeling of meum and cured of mental agitation, fight. (30) ¤ ◊ ◊af◊Œ fŸ-¤◊Ÿfar∆ f-a ◊rŸflr—– >rqrfl-ar˘Ÿ‚¸¤-ar ◊-¤-a a˘f¤ ∑◊f¤—+ -{+ Even those men who, with an uncavilling and devout mind, always follow this teaching of Mine are released from the bondage of all actions. (31) Text 28ó31] Bhagavadg∂tå 56 ¤ -flaŒ+¤‚¸¤-ar ŸrŸfar∆ f-a ◊ ◊a◊˜– ‚fl-rrŸffl◊¸… rtarf-flfq Ÿr≈ rŸ¤a‚—+ -·+ But they, however, who, finding fault with this teaching of Mine, do not follow it, take those fools to be deluded in the matter of all knowledge as lost. (32) ‚Œ‡r ¤r≈ a tflt¤r— ¤˝∑a-rrŸflrŸf¤– ¤˝∑fa ¤rf-a ¤¸arfŸ fŸn˝„ — f∑ ∑f⁄ r¤fa+ --+ All living creatures follow their tendencies; even the wise man acts according to the tendencies of his own nature. Of what use is any external restraint? (33) ;f-¢˝¤t¤f-¢˝¤t¤r¤ ⁄ rnç¤ı √¤flft¤aı– a¤rŸ fl‡r◊rn-ø -rı nt¤ ¤f⁄ ¤f-¤Ÿı+ -×+ Attraction and repulsion are rooted in all sense- objects. Man should never allow himself to be swayed by them, because they are the two principal enemies standing in the way of his redemption. (34) >r¤r-tflœ◊r ffln¢r— ¤⁄ œ◊r-tflŸfr∆ ara˜– tflœ◊ fŸœŸ >r¤— ¤⁄ œ◊r ¤¤rfl„ —+ -~+ Oneís own duty, though devoid of merit, is preferable to the duty of another well performed. Even death in the performance of oneís own duty brings blessed- ness; anotherís duty is fraught with fear. (35) •¡È¸Ÿ © flÊø •¤ ∑Ÿ ¤˝¤+r˘¤ ¤r¤ ¤⁄ fa ¤¸=¤—– •fŸ-ø -Ÿf¤ flrr¢r¤ ’‹rfŒfl fŸ¤rf¬a—+ -º+ Bhagavadg∂tå [Ch. 3 57 Arjuna said : Now impelled by what, K涃a does this man commit sin even involuntarily, as though driven by force? (36) üÊË÷ªflÊŸÈ flÊø ∑r◊ ∞¤ ∑˝rœ ∞¤ ⁄ ¬rn¢r‚◊Çfl—– ◊„ r‡rŸr ◊„ r¤rt◊r fflqvŸf◊„ flf⁄ ¢r◊˜+ -¬+ ›r∂ Bhagavån said : It is desire begotten of the element of Rajas, which appears as wrath; nay, it is insatiable and grossly wicked. Know this to be the enemy in this case. (37) œ¸◊Ÿrffl˝¤a flfrŸ¤¤rŒ‡rr ◊‹Ÿ ¤– ¤¤rr’Ÿrflar n¤ta¤r aŸŒ◊rfla◊˜+ -c+ As fire is covered by smoke, mirror by dust, and embryo by the amnion, so is knowledge covered by desire. (38) •rfla -rrŸ◊aŸ -rrfŸŸr fŸ-¤flf⁄ ¢rr– ∑r◊=¤¢r ∑ı-a¤ Œr¤¸⁄ ¢rrŸ‹Ÿ ¤+ -º+ And, Arjuna, Knowledge stands covered by this eternal enemy of the wise known as desire, which is insatiable like fire. (39) ;f-¢˝¤rf¢r ◊Ÿr ’fq⁄ t¤rfœr∆ rŸ◊-¤a– ∞affl◊r„ ¤-¤¤ -rrŸ◊rfl-¤ Œf„ Ÿ◊˜+ ׫+ The senses, the mind and the intellect are declared to be its seat; covering the knowledge through these, it (desire) deludes the embodied soul. (40) at◊r-flf◊f-¢˝¤r¢¤rŒı fŸ¤r¤ ¤⁄ a¤¤– ¤rt◊rŸ ¤˝¬f„ nŸ -rrŸffl-rrŸŸr‡rŸ◊˜+ ×{+ Text 37ó41] Bhagavadg∂tå 58 Therefore, Arjuna, you must first control your senses, and then kill this evil thing which obstructs J¤åna (Knowledge of the Absolute or Nirguƒa Brahma) and Vij¤åna (Knowledge of Såkåra Brahma or manifest Divinity). (41) ;f-¢˝¤rf¢r ¤⁄ r¢¤r„ f⁄ f-¢˝¤+¤— ¤⁄ ◊Ÿ—– ◊Ÿ‚ta ¤⁄ r ’fq¤r ’q— ¤⁄ ata ‚—+ ×·+ The senses are said to be greater than the body; but greater than the senses is the mind. Greater than the mind is the intellect; and what is greater than the intellect is He, the Self. (42) ∞fl ’q— ¤⁄ ’Œ˜·flr ‚ta+¤r-◊rŸ◊r-◊Ÿr– ¬f„ ‡r·r ◊„ r’r„ r ∑r◊=¤ Œ⁄ r‚Œ◊˜+ ×-+ Thus, Arjuna, knowing the Self which is higher than the intellect and subduing the mind by reason, kill this enemy in the form of desire that is hard to overcome. ¤iªi Ÿi◊ - third chapter entitled ì4Karmayoga, or the Yoga of Action.î Z Bhagavadg∂tå [Ch. 3 Chapter IV üÊË÷ªflÊŸÈ flÊø ;◊ fflfltfla ¤rn ¤˝r+flrŸ„ ◊√¤¤◊˜– fflfltflr-◊Ÿfl ¤˝r„ ◊Ÿf⁄ ˇflr∑fl˘’˝flta˜+ {+ ›r∂ Bhagavån said: I revealed this immortal Yoga to Vivasvån (Sun-god); Vivasvån conveyed it to Manu (his son); and Manu imparted it to (his son) Ik¶våku. (1) ∞fl ¤⁄ r¤⁄ r¤˝rtaf◊◊ ⁄ r¬¤¤r fflŒ—– ‚ ∑r‹Ÿ„ ◊„ ar ¤rnr Ÿr≈ — ¤⁄-a¤+ ·+ Thus transmitted in succession from father to son, Arjuna, this Yoga remained known to the Råjar¶is (royal sages). Through long lapse of time, this Yoga got lost to the world. (2) ‚ ∞flr¤ ◊¤r a˘u ¤rn— ¤˝r+— ¤⁄ raŸ—– ¤+r˘f‚ ◊ ‚πr ¤fa ⁄ „ t¤ naŒ-r◊◊˜+ -+ The same ancient Yoga, which is the supreme secret, has this day been imparted to you by Me, because you are My devotee and friend. (3) •¡È¸Ÿ © flÊø •¤⁄ ¤flar ¬-◊ ¤⁄ ¬-◊ fflfltfla—– ∑¤◊afç¬rŸt¤r -fl◊rŒı ¤˝r+flrfŸfa+ ×+ Arjuna said: You are of recent origin, while 60 the birth of Vivasvån dates back to remote antiquity. How, then, am I to believe that You imparted this Yoga at the beginning of the creation! (4) üÊË÷ªflÊŸÈ flÊø ’„¸fŸ ◊ √¤atarfŸ ¬-◊rfŸ afl ¤r¬Ÿ– ar-¤„ flŒ ‚flrf¢r Ÿ -fl fl-¤ ¤⁄-a¤+ ~+ ›r∂ Bhagavån said : Arjuna, you and I have passed through many births, I remember them all; you do not remember, O chastiser of foes. (5) •¬r˘f¤ ‚-Ÿ√¤¤r-◊r ¤¸arŸr◊t‡fl⁄ r˘f¤ ‚Ÿ˜– ¤˝∑fa tflr◊fœr∆ r¤ ‚r¤flrr¤r-◊◊r¤¤r+ º+ Though birthless and immortal and the Lord of all beings, I manifest Myself through My own Yogamåyå (divine potency), keeping My nature (Prakæti) under control. (6) ¤Œr ¤Œr f„ œ◊t¤ ª‹rfŸ¤flfa ¤r⁄ a– •+¤-¤rŸ◊œ◊t¤ aŒr-◊rŸ ‚¬rr¤„ ◊˜+ ¬+ Arjuna, whenever righteousness is on the decline, unrighteousness is in the ascendant, then I body Myself forth. (7) ¤f⁄ ·rr¢rr¤ ‚rœ¸Ÿr fflŸr‡rr¤ ¤ Œr∑ar◊˜– œ◊‚t¤r¤Ÿr¤r¤ ‚r¤flrf◊ ¤n ¤n+ c+ For the protection of the virtuous, for the extirpation of evil-doers, and for establishing Dharma (righteousness) on a firm footing, I manifest Myself from age to age. (8) Bhagavadg∂tå [Ch. 4 61 ¬-◊ ∑◊ ¤ ◊ fŒ√¤◊fl ¤r flf-r a-fla—– -¤¤-flr Œ„ ¤Ÿ¬-◊ Ÿfa ◊r◊fa ‚r˘¬Ÿ+ º + Arjuna, My birth and activities are divine. He who knows this in reality is not reborn on leaving his body, but comes to Me. (9) flta⁄ rn¤¤∑˝rœr ◊-◊¤r ◊r◊¤rf>rar—– ’„ flr -rrŸa¤‚r ¤¸ar ◊Çrfl◊rnar—+ {«+ Completely rid of attachment, fear and anger, wholly absorbed in Me, depending on Me, and purified by the penance of wisdom, many have become one with Me even in the past. (10) ¤ ¤¤r ◊r ¤˝¤u-a arta¤fl ¤¬rr¤„ ◊˜– ◊◊ fl-◊rŸfla-a ◊Ÿr¤r— ¤r¤ ‚fl‡r—+ {{+ Arjuna, howsoever men seek Me, even so do I respond to them; for all men follow My path in everyway. (11) ∑rz˜ ˇr-a— ∑◊¢rr f‚fq ¤¬-a ;„ Œflar—– fˇr¤˝ f„ ◊rŸ¤ ‹r∑ f‚fq¤flfa ∑◊¬r+ {·+ In this world of human beings, men seeking the fruition of their activities, worship the gods; for success born of actions follows quickly. (12) ¤rafl¢¤ ◊¤r ‚r≈ n¢r∑◊ffl¤rn‡r—– at¤ ∑ar⁄ ◊f¤ ◊r fflqv∑ar⁄ ◊√¤¤◊˜+ {-+ The four orders of society (viz., the Bråhmaƒa, the K¶atriya, the Vai‹ya and the ›µudra) were created by Me, classifying them according to the Guƒas predominant in each and apportioning Text 9ó13] Bhagavadg∂tå 62 corresponding duties to them; though the originator of this creation, know Me, the Immortal Lord, to be a non-doer. (13) Ÿ ◊r ∑◊rf¢r f‹r¤f-a Ÿ ◊ ∑◊¤‹ t¤„ r– ;fa ◊r ¤r˘f¤¬rŸrfa ∑◊f¤Ÿ ‚ ’·¤a+ {×+ Since I have no craving for the fruit of actions, actions do not taint Me. Even he who thus knows Me in reality is not bound by actions. (14) ∞fl -rr-flr ∑a ∑◊ ¤¸fl⁄ f¤ ◊◊ˇrf¤—– ∑= ∑◊fl at◊r-fl ¤¸fl— ¤¸fla⁄ ∑a◊˜+ {~+ Having known thus, action was performed even by the ancient seekers for liberation; therefore, do you also perform actions as have been performed by the ancients from antiquity. (15) f∑ ∑◊ f∑◊∑◊fa ∑fl¤r˘t¤·r ◊rf„ ar—– a-r ∑◊ ¤˝flˇ¤rf◊ ¤º-rr-flr ◊rˇ¤‚˘‡r¤ra˜+ {º+ What is action and what is inaction? Even men of intelligence are puzzled over this question. Therefore, I shall expound to you the truth about action, knowing which you will be freed from its evil effects i.e., the shackles of karma. (16) ∑◊¢rr nf¤ ’rq√¤ ’rq√¤ ¤ ffl∑◊¢r—– •∑◊¢r‡¤ ’rq√¤ n„ Ÿr ∑◊¢rr nfa—+ {¬+ The truth about action must be known and the truth of inaction also must be known; even so, the truth about prohibited action (Vikarma) must be known. For, mysterious are the ways of action. (17) Bhagavadg∂tå [Ch. 4 63 ‚ ’fq◊r-◊Ÿr¤¤ ‚ ¤+— ∑-tŸ∑◊∑a˜+ {c+ He who sees inaction in action, and action in inaction, is wise among men; he is a Yog∂, who has performed all actions. (18) ¤t¤ ‚fl ‚◊r⁄ r¤r— ∑r◊‚ ¿ r¤flf¬ar—– -rrŸrfªŸŒªœ∑◊r¢r a◊r„ — ¤f¢z a ’œr—+ {º+ Even the wise call him a sage, whose undertakings are all free from desire and Sa∆kalpa (thoughts of the world) and whose actions are burnt up by the fire of wisdom. (19) —+ ·«+ He, who, having totally given up attachment to actions and their fruit, no longer depends on anything in the world, and is ever content, does nothing at all, though fully engaged in action. (20) fŸ⁄ r‡rt¤af¤-rr-◊r -¤+‚fl¤f⁄ n˝„ —– ‡rr⁄ t⁄ ∑fl‹ ∑◊ ∑fl-ŸrtŸrfa f∑fr’¤◊˜+ ·{+ Having subdued his mind and body, and giving up all objects of enjoyment, and free from craving, he who performs sheer bodily action, does not incur sin. (21) ¤Œ-ø r‹r¤‚-ar≈ r ç-çratar ffl◊-‚⁄ —– ‚◊— f‚qrflf‚qı ¤ ∑-flrf¤ Ÿ fŸ’·¤a+ ··+ The Karmayog∂, who is contented with Text 18ó22] Bhagavadg∂tå 64 whatever is got unsought, is free from jealousy and has transcended all pairs of opposites like joy and grief, and is balanced in success and failure, is not bound by his action. (22) na‚y t¤ ◊+t¤ -rrŸrflft¤a¤a‚—– ¤-rr¤r¤⁄ a— ∑◊ ‚◊n˝ ¤˝ffl‹t¤a+ ·-+ All his actions get dissolved entirely, who is free from attachment and has no identification with the body; and free from the feeling of mine, whose mind is established in the knowledge of Self and who works merely for the sake of sacrifice. (23) ’˝zrr¤¢r ’˝zr „ ffl’˝zrrªŸı ’˝zr¢rr „ a◊˜– ’˝zrfl aŸ n-a√¤ ’˝zr∑◊‚◊rfœŸr+ ·×+ In the practice of seeing Brahma everywhere as a form of sacrifice, Brahma is the ladle (with which oblation is poured into the fire, etc.);) Œfl◊flr¤⁄ ¤-r ¤rfnŸ— ¤¤¤r‚a– ’˝zrrªŸrfl¤⁄ ¤-r ¤-rŸflr¤¬ç fa+ ·~+ Other Yog∂s duly offer sacrifice only in the shape of worship to gods, while others perform sacrifice by offering the self by the Self itself in the fire of Brahma through the sacrifice known as the perception of identity. (25) Bhagavadg∂tå [Ch. 4 65 >rr·rrŒtŸtf-¢˝¤r¢¤-¤ ‚¤◊rfªŸ¤ ¬ç fa– ‡rªŒrŒtf-fl¤¤rŸ-¤ ;f-¢˝¤rfªŸ¤ ¬ç fa+ ·º+ Others offer as sacrifice their senses of hearing etc., into the fires of self-discipline. Other Yog∂s, again, offer sound and other objects of perception into the fires of the senses. (26) ‚flr¢rtf-¢˝¤∑◊rf¢r ¤˝r¢r∑◊rf¢r ¤r¤⁄ – •r-◊‚¤◊¤rnrªŸı ¬ç fa -rrŸŒtf¤a+ ·¬+ Others sacrifice all the functions of their senses and the functions of the vital airs (Pråƒa) into the fire of Yoga in the shape of self-control, kindled by wisdom. (27) ¢˝√¤¤-rrta¤r¤-rr ¤rn¤-rrta¤r¤⁄ – tflr·¤r¤-rrŸ¤-rr‡¤ ¤a¤— ‚f‡rafl˝ar—+ ·c+ Some perform sacrifice with material possessions; some offer sacrifice in the shape of austerities; others sacrifice through the practice of Yoga; while some striving souls, observing austere vows, perform sacrifice in the shape of wisdom through the study of sacred texts. (28) •¤rŸ ¬çfa ¤˝r¢r ¤˝r¢r˘¤rŸ a¤r¤⁄ – ¤˝r¢rr¤rŸnat =Œ˜·flr ¤˝r¢rr¤r◊¤⁄ r¤¢rr—+ ·º+ •¤⁄ fŸ¤ar„ r⁄ r— ¤˝r¢rr-¤˝r¢r¤ ¬ç fa– ‚fl˘t¤a ¤-rfflŒr ¤-rˇrf¤a∑r◊¤r—+ -«+ Other Yog∂s offer the act of exhalation into Text 26ó30] Bhagavadg∂tå 66 that of inhalation; even so, others the act of inhalation into that of exhalation. There are still others given to the practice of Pråƒåyåma (breath- control), who having regulated their diet and controlled the processes of exhalation and inhalation both pour their vital airs into the vital airs themselves. All these have their sins consumed away by sacrifice and understand the meaning of sacrificial worship. (29-30) ¤-rf‡rr≈ r◊a¤¬r ¤rf-a ’˝zr ‚ŸraŸ◊˜– Ÿr¤ ‹r∑r˘t-¤¤-rt¤ ∑ar˘-¤— ∑=‚-r◊+ -{+ Arjuna, Yog∂s who enjoy the nectar that has been left over after the performance of a sacrifice attain the eternal Brahma. To the man who does not offer sacrifice, even this world is not happy; how, then, can the other world be happy? (31) ∞fl ’„ fflœr ¤-rr fflaar ’˝zr¢rr ◊π– ∑◊¬rf-flfq ar-‚flrŸfl -rr-flr ffl◊rˇ¤‚+ -·+ Many such forms of sacrifice have been set forth in detail in the Vedas; know them all as involving the action of mind, senses and body. Thus, knowing the truth about them you shall be freed from the bondage of action (through their performance). (32) >r¤r-¢˝√¤◊¤ru-rrº-rrŸ¤-r— ¤⁄ -a¤– ‚fl ∑◊rfπ‹ ¤r¤ -rrŸ ¤f⁄ ‚◊rt¤a+ --+ Bhagavadg∂tå [Ch. 4 67 Arjuna, sacrifice through Knowledge is superior to sacrifice performed with material things. For all actions without exception culminate in Knowledge, O son of Kunt∂. (33) afçfq ¤˝f¢r¤raŸ ¤f⁄ ¤˝‡ŸŸ ‚fl¤r– s ¤Œˇ¤f-a a -rrŸ -rrfŸŸta-flŒf‡rŸ—+ -×+ Understand the true nature of that Knowledge by approaching illumined soul. If you prostrate at their feet, render them service, and question them with an open and guileless heart, those wise seers of Truth will instruct you in that Knowledge.(34) ¤º-rr-flr Ÿ ¤Ÿ◊r„ ◊fl ¤rt¤f‚ ¤r¢z fl– ¤Ÿ ¤¸ar-¤‡r¤¢r ¢˝ˇ¤t¤r-◊-¤¤r ◊f¤+ -~+ Arjuna, when you have achieved enlightenment, ignorance will delude you no more. In the light of that knowledge, you will see the entire creation first within your own Self, and then in Me (the Oversoul). (35) •f¤ ¤Œf‚ ¤r¤+¤— ‚fl+¤— ¤r¤∑-r◊—– ‚fl -rrŸt‹flŸfl flf¬Ÿ ‚-af⁄ r¤f‚+ -º+ Even if you were the most sinful of all sinners, this Knowledge alone would carry you, like a raft, across all your sins. (36) ¤¤œrf‚ ‚f◊qr˘fªŸ¤t◊‚r-∑=a˘¬Ÿ– -rrŸrfªŸ— ‚fl∑◊rf¢r ¤t◊‚r-∑=a a¤r+ -¬+ Text 34ó37] Bhagavadg∂tå 68 For, as the blazing fire turns the fuel to ashes, Arjuna, even so the fire of Knowledge turns all actions to ashes. (37) Ÿ f„ -rrŸŸ ‚Œ‡r ¤ffl·rf◊„ fflua– a-tfl¤ ¤rn‚f‚q— ∑r‹Ÿr-◊fŸ ffl-Œfa+ -c+ In this world there is no purifier as great as Knowledge; he who has attained purity of heart through prolonged practice of Karmayoga, automatically sees the light of Truth in the self in course of time. (38) >rqrflrr‹¤a -rrŸ a-¤⁄ — ‚¤af-¢˝¤—– -rrŸ ‹ª·flr ¤⁄ r ‡rrf-a◊f¤⁄ ¢rrfœn-ø fa+ -º+ He who has mastered his senses, is exclusively devoted to his practice and is full of faith, attains Knowledge; having had the revelation of Truth, he immediately attains supreme peace in the form of God-realization. (39) •-r‡¤r>rzœrŸ‡¤ ‚‡r¤r-◊r fflŸ‡¤fa– Ÿr¤ ‹r∑r˘fta Ÿ ¤⁄ r Ÿ ‚𠂇r¤r-◊Ÿ—+ ׫+ He who lacks discrimination, is devoid of faith, and is at the same time possessed by doubt, is lost to the spiritual path. For the doubting soul there is neither this world nor the world beyond, nor even happiness. (40) Bhagavadg∂tå [Ch. 4 69 ¤rn‚--¤ta∑◊r¢r -rrŸ‚f=ø -Ÿ‚‡r¤◊˜– •r-◊fl-a Ÿ ∑◊rf¢r fŸ’·Ÿf-a œŸ=¬¤+ ×{+ Arjuna, actions do not bind him who has dedicated all his actions to God according to the spirit of Karmayoga, whose doubts have been dispelled by wisdom and who is self-possessed. (41) at◊rŒ-rrŸ‚r¤¸a z -t¤ -rrŸrf‚Ÿr-◊Ÿ—– fø -flŸ ‚‡r¤ ¤rn◊rfar∆ rf-rr∆ ¤r⁄ a+ ×·+ Therefore, Arjuna slashing to pieces, with the sword of knowledge, this doubt in your heart, born of ignorance, establish yourself in Karmayoga in the shape of even-mindedness, and stand up for the fight. -iiŸ∑◊‚--¤i‚¤iªi Ÿi◊ --·i˘·¤i¤—+ ÷+ Thus, in the Upani¶ad sung by the Lord, the Science of Brahma, the scripture of Yoga, the dialogue between ›r∂ K涃a and Arjuna, ends the fourth chapter entitled ìThe Yoga of Knowledge as well as the disciplines of Action and Knowledge.î Z Text 41ó42] Bhagavadg∂tå Chapter V •¡È¸Ÿ © flÊø ‚--¤r‚ ∑◊¢rr ∑r¢r ¤Ÿ¤rn ¤ ‡r‚f‚– ¤-ø˛ ¤ ∞a¤r⁄ ∑ a-◊ ’˝¸f„ ‚fŸf‡¤a◊˜+ {+ Arjuna said : K涃a, you extol Så∆khyayoga (the Yoga of Knowledge) and then the Yoga of Action. Pray, tell me which of the two is decidedly conducive to my good. (1) üÊË÷ªflÊŸÈ flÊø ‚--¤r‚— ∑◊¤rn‡¤ fŸ—>r¤‚∑⁄ rfl¤ı– a¤rta ∑◊‚--¤r‚r-∑◊¤rnr fflf‡rr¤a+ ·+ ›r∂ Bhagavån said : The Yoga of Knowledge and the Yoga of Action both lead to supreme Bliss. Of the two, however, the Yoga of Action, being easier of practice, is superior to the Yoga of Knowledge. (2) -r¤— ‚ fŸ-¤‚--¤r‚t ¤r Ÿ çfr≈ Ÿ ∑rz˜ ˇrfa– fŸç-çr f„ ◊„ r’r„ r ‚π ’-œr-¤˝◊-¤a+ -+ The Karmayog∂ who neither hates nor desires should ever be considered a man of renunciation. For, Arjuna, he who is free from the pairs of opposites is easily liberated from bondage. (3) ‚rz˜ =¤¤rnı ¤¤ª’r‹r— ¤˝flŒf-a Ÿ ¤f¢z ar—– ∞∑◊t¤rft¤a— ‚r¤n¤¤rffl-Œa ¤‹◊˜+ ×+ 71 It is the ignorant, not the wise, who say that Så∆khyayoga and Karmayoga lead to divergent results. For, one who is firmly established in either, gets the fruit of both which is the same, viz., God- realization. (4) ¤-‚rz˜ =¤— ¤˝rt¤a t¤rŸ aurn⁄ f¤ nr¤a– ∞∑ ‚rz˜ =¤ ¤ ¤rn ¤ ¤— ¤‡¤fa ‚ ¤‡¤fa+ ~+ The (supreme) state which is reached by the Så∆khyayog∂ is attained also by the Karmayog∂. Therefore, he alone who sees Så∆khyayoga and Karmayoga as identical so far as their result goes, sees truly. (5) ‚--¤r‚ta ◊„ r’r„ r Œ—π◊rta◊¤rna—– ¤rn¤+r ◊fŸ’˝zr Ÿf¤⁄ ¢rrfœn-ø fa+ º+ Without Karmayoga, however, Så∆khyayoga i.e., renunciation of doership in relation to all activities of the mind, senses and body is difficult to accomplish; whereas the Karmayog∂, who keeps his mind fixed on God, reaches Brahma in no time, Arjuna. (6) ¤rn¤+r ffl‡rqr-◊r fflf¬ar-◊r f¬af-¢˝¤—– ‚fl¤¸ar-◊¤¸ar-◊r ∑fl-Ÿf¤ Ÿ f‹t¤a+ ¬+ The Karmayog∂, who has fully conquered his mind and mastered his senses, whose heart is pure, and who has identified himself with the Self of all beings (viz., God), remains untainted, even though performing action. (7) Text 5ó7] Bhagavadg∂tå 72 Ÿfl f∑f=¤-∑⁄ r◊tfa ¤+r ◊-¤a a-flffla˜– ¤‡¤=n ¢fl-t¤ ‡rf=¬rr˝ -Ÿ‡Ÿ-n-ø -tfl¤=‡fl‚Ÿ˜ + c + ¤˝‹¤f-fl‚¬-nˆ -Ÿf-◊¤f-Ÿf◊¤-Ÿf¤ – ;f-¢˝¤r¢rtf-¢˝¤r¤¤ fla-a ;fa œr⁄ ¤Ÿ˜+ º + However, the Så∆khyayog∂, who knows the reality of things, must believe that he does nothing, even though seeing, hearing, touching, smelling, eating or drinking, walking, sleeping, breathing, speaking, answering the calls of nature, grasping, and opening or closing the eyes, holding that it is the senses alone that are moving among their objects. (8-9) ’˝zr¢¤rœr¤ ∑◊rf¢r ‚y -¤¤-flr ∑⁄ rfa ¤—– f‹t¤a Ÿ ‚ ¤r¤Ÿ ¤¬¤·rf◊flrr¤‚r+ {«+ He who acts offering all actions to God, and shaking off attachment, remains untouched by sin, as the lotus leaf by water. (10) ∑r¤Ÿ ◊Ÿ‚r ’qvr ∑fl‹f⁄ f-¢˝¤⁄ f¤– ¤rfnŸ— ∑◊ ∑flf-a ‚y -¤¤-flr-◊‡rq¤+ {{+ The Karmayog∂s perform action only with their senses, mind, intellect and body as well, without the feeling of mine in respect of them and shaking off attachment, simply for the sake of self-purification. (11) ¤+— ∑◊¤‹ -¤¤-flr ‡rrf-a◊rtŸrfa Ÿfr∆ ∑t◊˜– •¤+— ∑r◊∑r⁄ ¢r ¤‹ ‚+r fŸ’·¤a+ {·+ Bhagavadg∂tå [Ch. 5 73 Offering the fruit of actions to God, the Karmayog∂ attains everlasting peace in the shape of God-realization; whereas, he who works with a selfish motive, being attached to the fruit of actions through desire, gets tied down. (12) ‚fl∑◊rf¢r ◊Ÿ‚r ‚--¤t¤rta ‚π fl‡rt– Ÿflçr⁄ ¤⁄ Œ„ t Ÿfl ∑fl-Ÿ ∑r⁄ ¤Ÿ˜+ {-+ The self-controlled Så∆khyayog∂, doing nothing himself and getting nothing done by others, rests happily in Godóthe embodiment of Truth, Knowledge and Bliss, mentally relegating all actions to the mansion of nine gates (the body with nine openings). (13) Ÿ ∑a-fl Ÿ ∑◊rf¢r ‹r∑t¤ ‚¬fa ¤˝¤—– Ÿ ∑◊¤‹‚¤rn tfl¤rflta ¤˝flaa+ {×+ God determines neither the doership nor the doings of men, nor even their contact with the fruit of actions; but it is Nature alone that functions. (14) ŸrŒ-r ∑t¤f¤-¤r¤ Ÿ ¤fl ‚∑a ffl¤—– •-rrŸŸrfla -rrŸ aŸ ◊nf-a ¬-afl—+ {~+ The omnipresent God does not partake the virtue or sin of anyone. Knowledge is enveloped by ignorance; hence it is that beings are constantly falling a prey to delusion. (15) -rrŸŸ a aŒ-rrŸ ¤¤r Ÿrf‡ra◊r-◊Ÿ—– a¤r◊rfŒ-¤flº-rrŸ ¤˝∑r‡r¤fa a-¤⁄ ◊˜+ {º+ Text 13ó16] Bhagavadg∂tå 74 In the case, however, of those whose said ignorance has been destroyed by true knowledge of God, that wisdom shining like the sun reveals the Supreme. (16) aŒ˜’q¤taŒr-◊rŸtaf-Ÿr∆ rta-¤⁄ r¤¢rr— – n-ø --¤¤Ÿ⁄ rflf-r -rrŸfŸœ¸a∑r◊¤r—+ {¬+ Those whose mind and intellect are wholly merged in Him, who remain constantly established in identity with Him, and have finally become one with Him, their sins being wiped out by wisdom, reach the supreme goal whence there is no return. (17) fflurfflŸ¤‚r¤-Ÿ ’˝rzr¢r nffl „ ftafŸ– ‡rfŸ ¤fl ‡fl¤r∑ ¤ ¤f¢z ar— ‚◊Œf‡rŸ—+ {c+ The wise look with equanimity on all whether it be a Bråhmaƒa endowed with learning and culture, a cow, an elephant, a dog and a pariah, too. (18) ;„ fl af¬a— ‚nr ¤¤r ‚rr¤ ft¤a ◊Ÿ—– fŸŒr¤ f„ ‚◊ ’˝zr at◊rŒ˜’˝zrf¢r a ft¤ar—+ {º+ Even here is the mortal plane conquered by those whose mind is established in unity; since the Absolute is untouched by evil and is the same to all, hence they are established in the Eternal. (19) Ÿ ¤˝z r¤f-¤˝¤ ¤˝rt¤ Ÿrfç¬-¤˝rt¤ ¤rf¤˝¤◊˜– ft¤⁄ ’fq⁄ ‚r◊¸… r ’˝zrfflŒ˜ ’˝zrf¢r ft¤a—+ ·«+ He who, with firm intellect and free from doubt, rejoices not on obtaining what is pleasant and does not feel perturbed on meeting with the Bhagavadg∂tå [Ch. 5 75 unpleasant, that knower of Brahma lives eternally in identity with Brahma. (20) ’rnt¤‡rrfl‚+r-◊r ffl-Œ-¤r-◊fŸ ¤-‚π◊˜– ‚ ’˝zr¤rn¤+r-◊r ‚π◊ˇr¤◊‡Ÿa+ ·{+ He whose mind remains unattached to sense- objects, derives through meditation the Såttvika joy which dwells in the mind; then that Yog∂, having completely identified himself through meditation with Brahma, enjoys eternal Bliss. (21) ¤ f„ ‚t¤‡r¬r ¤rnr Œ—π¤rŸ¤ ∞fl a– •ru-afl-a— ∑ı-a¤ Ÿ a¤ ⁄ ◊a ’œ—+ ··+ The pleasures which are born of sense-contacts are verily a source of suffering only (though appearing as enjoyable to worldly-minded people). They have a beginning and an end (they come and go); Arjuna, it is for this reason that a wise man does not indulge in them. (22) ‡r¤Ÿrat„ fl ¤— ‚r… ¤˝r¤‡r⁄ t⁄ ffl◊rˇr¢rra˜– ∑r◊∑˝rœrÇfl fln ‚ ¤+— ‚ ‚πt Ÿ⁄ —+ ·-+ He alone, who is able to withstand, in this very life before casting off this body, the urges of lust and anger, is a Yog∂, and he alone is a happy man. (23) ¤r˘-a—‚πr˘-a⁄ r⁄ r◊ta¤r-aº¤rfa⁄ fl ¤—– ‚ ¤rnt ’˝zrfŸflr¢r ’˝zr¤¸ar˘fœn-ø fa+ ·×+ Text 21ó24] Bhagavadg∂tå 76 He who is happy within himself, enjoys within himself the delight of the soul, and even so, is illumined by the inner light (light of the soul), such a Yog∂ (Så∆khyayog∂) identified with Brahma attains Brahma, who is all peace. (24) ‹¤-a ’˝zrfŸflr¢r◊¤¤— ˇrt¢r∑r◊¤r—– fø -Ÿçœr ¤ar-◊rŸ— ‚fl¤¸af„ a ⁄ ar—+ ·~+ The seers whose sins have been purged, whose doubts have been dispelled by knowledge, whose disciplined mind is firmly established in God and who are devoted to the welfare of all beings, attain Brahma, who is all peace. (25) ∑r◊∑˝rœffl¤+rŸr ¤atŸr ¤a¤a‚r◊˜– •f¤ar ’˝zrfŸflr¢r flaa fflfŒar-◊Ÿr◊˜+ ·º+ To those wise men who are free from lust and anger, who have subdued their mind and have realized God, Brahma, the abode of eternal peace, is present all-round. (26) t¤‡rr-∑-flr ’f„ ’rnr‡¤ˇr‡¤flr-a⁄ ¤˝flr—– ¤˝r¢rr¤rŸı ‚◊ı ∑-flr Ÿr‚r+¤-a⁄ ¤rf⁄ ¢rı+ ·¬+ ¤af-¢˝¤◊Ÿr’fq◊fŸ◊rˇr¤⁄ r¤¢r— – fflna-ø r¤¤∑˝rœr ¤— ‚Œr ◊+ ∞fl ‚—+ ·c+ Shutting out all thoughts of external enjoyments, with the gaze fixed on the space Bhagavadg∂tå [Ch. 5 77 between the eye-brows, having regulated the Pråƒa (outgoing) and the Apåna (incoming) breaths flowing within the nostrils, he who has brought his senses, mind and intellect under controlñsuch a contemplative soul intent on liberation and free from desire, fear and anger, is ever liberated. (27-28) ¤r+r⁄ ¤-ra¤‚r ‚fl‹r∑◊„ ‡fl⁄ ◊˜– ‚z Œ ‚fl¤¸arŸr -rr-flr ◊r ‡rrf-a◊-ø fa+ ·º+ Having known Me in reality as the enjoyer of all sacrifices and austerities, the supreme Lord of all the worlds, and the selfless friend of all beings, My devotee attains peace. ‚--¤i‚¤iªi Ÿi◊ ¤~-◊i˘·¤i¤—+ -+ Thus, in the Upani¶ad sung by the Lord, the Science of Brahma, the scripture of Yoga, the dialogue between ›r∂ K涃a and Arjuna, ends the fifth chapter entitled ìThe Yoga of Action and Knowledge.î Z Text 29] Bhagavadg∂tå Chapter VI üÊË÷ªflÊŸÈflÊø •Ÿrf>ra— ∑◊¤‹ ∑r¤ ∑◊ ∑⁄ rfa ¤—– ‚ ‚--¤r‚t ¤ ¤rnt ¤ Ÿ fŸ⁄ fªŸŸ ¤rf∑˝¤—+ {+ ›r∂ Bhagavån said : He who does his duty without expecting the fruit of actions is a Sannyås∂ (Så∆khyayog∂) and a Yog∂ (Karmayog∂) both. He is no Sannyås∂ (renouncer) who has merely renounced the sacred fire; even so, he is no Yog∂ who has merely given up all activity. (1) ¤ ‚--¤r‚f◊fa ¤˝r„ ¤rn a fflfq ¤r¢z fl– Ÿ n‚--¤ta‚¿ r¤r ¤rnt ¤flfa ∑‡¤Ÿ+ ·+ Arjuna, you must know that what they call Sannyåsa is no other than Yoga; for none becomes a Yog∂, who has not abandoned his ëSa∆kalpasí (thoughts of the world). (2) •r==ˇrr◊Ÿ¤rn ∑◊ ∑r⁄ ¢r◊-¤a– ¤rnr=… t¤ at¤fl ‡r◊— ∑r⁄ ¢r◊-¤a+ -+ To the contemplative soul who desires to attain Karmayoga, selfless action is said to be the means; for the same man when he is established in Yoga, absence of all ëSa∆kalpasí (thoughts of the world) is said to be the way to blessedness. (3) 79 ¤Œr f„ Ÿf-¢˝¤r¤¤ Ÿ ∑◊tflŸ¤¬ra– ‚fl‚¿ r¤‚--¤r‚t ¤rnr=… taŒr-¤a+ ×+ When a man ceases to have any attachment for the objects of senses and for actions, and has renounced all ëSa∆kalpasí (thoughts of the world), he is said to have attained Yoga. (4) s q⁄ Œr-◊Ÿr-◊rŸ Ÿr-◊rŸ◊fl‚rŒ¤a˜– •r-◊fl nr-◊Ÿr ’-œ⁄ r-◊fl f⁄ ¤⁄ r-◊Ÿ—+ ~+ One should lift oneself by oneís own efforts and should not degrade oneself; for oneís own self is oneís friend, and oneís own self is oneís enemy. (5) ’-œ⁄ r-◊r-◊Ÿtat¤ ¤Ÿr-◊flr-◊Ÿr f¬a—– •Ÿr-◊Ÿta ‡r·r-fl flaar-◊fl ‡r·rfla˜+ º+ Oneís own self is the friend of the soul by whom the lower self (consisting of the mind, senses and body) has been conquered; even so, the very self of him, who has not conquered his lower self, behaves antagonistically like an enemy. (6) f¬ar-◊Ÿ— ¤˝‡rr-at¤ ¤⁄ ◊r-◊r ‚◊rf„ a—– ‡rtarr¢r‚πŒ—π¤ a¤r ◊rŸr¤◊rŸ¤r—+ ¬+ The Supreme Spirit is rooted in the knowledge of the self-controlled man whose mind is perfectly serene in the midst of pairs of opposites, such as cold and heat, joy and sorrow, and honour and ignominy. (7) Text 4ó7] Bhagavadg∂tå 80 -rrŸffl-rrŸatar-◊r ∑¸≈ t¤r fflf¬af-¢˝¤—– ¤+ ;-¤-¤a ¤rnt ‚◊‹rr≈ r‡◊∑r=¤Ÿ—+ c + The Yog∂ whose mind is sated with J¤åna (Knowledge of Nirguƒa Brahma) and Vij¤åna (Knowledge of manifest Divinity), who is unmoved under any circumstances, whose senses are completely under control, and to whom earth, stone and gold are all alike, is spoken of as a God- realized soul. (8) ‚z f-◊·rr¤Œr‚tŸ◊·¤t¤çr¤’-œ¤ – ‚rœrflf¤ ¤ ¤r¤¤ ‚◊’fqfflf‡rr¤a+ º + He who looks upon well-wishers and neutrals as well as mediators, friends and foes, relatives and inimicals, the virtuous and the sinful with equanimity, stands supreme. (9) ¤rnt ¤=¬ta ‚aa◊r-◊rŸ ⁄ „ f‚ ft¤a—– ∞∑r∑t ¤af¤-rr-◊r fŸ⁄ r‡rt⁄ ¤f⁄ n˝„ —+ {«+ Living in seclusion all by himself, the Yog∂ who has controlled his mind and body, and is free from desires and void of possessions, should constantly engage his mind in meditation. (10) ‡r¤ı Œ‡r ¤˝far∆ rt¤ ft¤⁄ ◊r‚Ÿ◊r-◊Ÿ—– Ÿr-¤f-ø˛ a ŸrfaŸt¤ ¤‹rf¬Ÿ∑‡rr-r⁄ ◊˜+ {{+ Having firmly set his seat in a spot which is free from dirt and other impurities with the sacred Ku‹a grass, a deerskin and a cloth spread thereon, one upon the other, (Ku‹a below, deerskin in the Bhagavadg∂tå [Ch. 6 81 middle and cloth uppermost), neither very high nor very low. (11) a·r∑rn˝ ◊Ÿ— ∑-flr ¤af¤-rf-¢˝¤f∑˝¤—– s ¤ffl‡¤r‚Ÿ ¤=º¤rurn◊r-◊ffl‡rq¤+ {·+ And occupying that seat, concentrating the mind and controlling the functions of the mind and senses, he should practise Yoga for self- purification. (12) ‚◊ ∑r¤f‡r⁄ rn˝tfl œr⁄ ¤-Ÿ¤‹ ft¤⁄ —– ‚r¤˝ˇ¤ Ÿrf‚∑rn˝ tfl fŒ‡r‡¤rŸfl‹r∑¤Ÿ˜+ {-+ Holding the trunk, head and neck straight and steady, remaining firm and fixing the gaze on the tip of his nose, without looking in other directions. (13) ¤˝‡rr-ar-◊r fflna¤t’˝zr¤rf⁄ fl˝a ft¤a—– ◊Ÿ— ‚¤r¤ ◊f¤r-rr ¤+ •r‚ta ◊-¤⁄ —+ {×+ Firm in the vow of complete chastity and fearless, keeping himself perfectly calm and with the mind held in restraint and fixed on Me, the vigilant Yog∂ should sit absorbed in Me. (14) ¤=¬-Ÿfl ‚Œr-◊rŸ ¤rnt fŸ¤a◊rŸ‚—– ‡rrf- a fŸflr¢r¤⁄ ◊r ◊-‚t¤r◊fœn-ø fa+ {~+ Thus, constantly applying his mind to Me, the Yog∂ of disciplined mind attains everlasting peace, consisting of Supreme Bliss, which abides in Me. (15) Ÿr-¤‡Ÿata ¤rnr˘fta Ÿ ¤∑r-a◊Ÿ‡Ÿa—– Ÿ ¤rfa tfltŸ‡rt‹t¤ ¬rn˝ar Ÿfl ¤r¬Ÿ+ {º+ Text 12ó16] Bhagavadg∂tå 82 Arjuna, this Yoga is neither for him who overeats, nor for him who observes complete fast; it is neither for him who is given to too much sleep, nor even for him who is ceaselessly awake. (16) ¤+r„ r⁄ ffl„ r⁄ t¤ ¤+¤r≈ t¤ ∑◊‚– ¤+tfltŸrfl’rœt¤ ¤rnr ¤flfa Œ—π„ r+ {¬+ Yoga, which rids one of woe, is accomplished only by him who is regulated in diet and recreation, regulated in performing actions, and regulated in sleep and wakefulness. (17) ¤Œr fflfŸ¤a f¤-r◊r-◊-¤flrflfar∆ a– fŸ—t¤„ — ‚fl∑r◊+¤r ¤+ ;-¤-¤a aŒr+ {c+ When the mind which is thoroughly disciplined gets riveted on God alone, then the person who is free from yearning for all enjoyments is said to be established in Yoga. (18) ¤¤r Œt¤r fŸflrat¤r Ÿy a ‚r¤◊r t◊ar– ¤rfnŸr ¤af¤-rt¤ ¤=¬ar ¤rn◊r-◊Ÿ—+ {º+ As a flame does not flicker in a windless place, such is stated to be the picture of the disciplined mind of the Yog∂ practising meditation on God. (19) ¤·rr¤⁄ ◊a f¤-r fŸ=q ¤rn‚fl¤r– ¤·r ¤flr-◊Ÿr-◊rŸ ¤‡¤-Ÿr-◊fŸ ar¤fa+ ·«+ The state in which, the Citta (mind-stuff) subdued through the practice of Yoga, becomes Bhagavadg∂tå [Ch. 6 83 passive, and in which realizing God through subtle reasoning purified by meditation on God; the soul rejoices only in God; (20) ‚π◊r-¤f-a∑ ¤-rŒ˜’fqn˝rn◊atf-¢˝¤◊˜– flf-r ¤·r Ÿ ¤flr¤ ft¤a‡¤‹fa a-fla—+ ·{+ Nay, in which the soul experiences the eternal and super-sensuous joy which can be intuited only through the subtle and purified intellect, and wherein established the said Yog∂ moves not from Truth on any account; (21) ¤ ‹ª·flr ¤r¤⁄ ‹r¤ ◊-¤a Ÿrfœ∑ aa—– ¤ft◊f-t¤ar Ÿ Œ—πŸ n=¢rrf¤ ffl¤rr¤a+ ··+ And having obtained which he does not reckon any other gain as greater than that, and established in which he is not shaken even by the heaviest of sorrows; (22) a fflurŒ˜ Œ—π‚¤rnffl¤rn ¤rn‚f=-ra◊˜– ‚ fŸ‡¤¤Ÿ ¤r+√¤r ¤rnr˘fŸffl¢¢r¤a‚r+ ·-+ That state, called Yoga, which is free from the contact of sorrow (in the form of transmigration), should be known. Nay, this Yoga should be resolutely practised with an unwearied mind. (23) ‚¿ r¤¤˝¤flr-∑r◊rt-¤¤-flr ‚flrŸ‡r¤a—– ◊Ÿ‚flf-¢˝¤n˝r◊ fflfŸ¤r¤ ‚◊-aa—+ ·×+ Completely renouncing all desires arising from Sa∆kalpas (thoughts of the world), and fully restraining all the senses from all sides by the mind; (24) Text 21ó24] Bhagavadg∂tå 84 ‡rŸ— ‡rŸ=¤⁄ ◊Œ˜’qvr œfan„ ta¤r– •r-◊‚t¤ ◊Ÿ— ∑-flr Ÿ f∑f=¤Œf¤ f¤-a¤a˜+ ·~+ He should through gradual practice, attain tranquillity; and fixing the mind on God through reason controlled by steadfastness, he should not think of anything else. (25) ¤ar ¤ar fŸ‡¤⁄ fa ◊Ÿ‡¤=¤‹◊ft¤⁄ ◊˜– aataar fŸ¤r¤aŒr-◊-¤fl fl‡r Ÿ¤a˜+ ·º+ Drawing back the restless and fidgety mind from all those objects after which it runs, he should repeatedly fix it on God. (26) ¤˝‡rr-a◊Ÿ‚ nŸ ¤rfnŸ ‚π◊-r◊◊˜– s ¤fa ‡rr-a⁄ ¬‚ ’˝zr¤¸a◊∑r◊¤◊˜+ ·¬+ For, to the Yog∂ whose mind is perfectly serene, who is sinless, whose passion is subdued, and who is identified with Brahma, the embodiment of Truth, Knowledge and Bliss, supreme happiness comes as a matter of course. (27) ¤=¬-Ÿfl ‚Œr-◊rŸ ¤rnt fflna∑r◊¤—– ‚πŸ ’˝zr‚t¤‡r◊-¤-a ‚π◊‡Ÿa+ ·c+ The sinless Yog∂, thus uniting his Self constantly with God, easily enjoys the eternal Bliss of oneness with Brahma. (28) ‚fl¤¸at¤◊r-◊rŸ ‚fl¤¸arfŸ ¤r-◊fŸ– ;ˇra ¤rn¤+r-◊r ‚fl·r ‚◊Œ‡rŸ—+ ·º+ The Yog∂ who is united in identity with the all- pervading, infinite consciousness, whose vision Bhagavadg∂tå [Ch. 6 85 everywhere is even, beholds the Self existing in all beings and all beings as assumed in the Self. (29) ¤r ◊r ¤‡¤fa ‚fl·r ‚fl ¤ ◊f¤ ¤‡¤fa– at¤r„ Ÿ ¤˝¢r‡¤rf◊ ‚ ¤ ◊ Ÿ ¤˝¢r‡¤fa+ -«+ He who sees Me (the Universal Self) present in all beings, and all beings existing within Me, he is never lost to me, nor am I ever lost to him. (30) ‚fl¤¸aft¤a ¤r ◊r ¤¬-¤∑-fl◊rft¤a—– ‚fl¤r fla◊rŸr˘f¤ ‚ ¤rnt ◊f¤ flaa+ -{+ The Yog∂ who is established in union with Me, and worships Me as residing in all beings as their very Self, though engaged in all forms of activities, dwells in Me. (31) •r-◊ı¤r¤Ÿ ‚fl·r ‚◊ ¤‡¤fa ¤r˘¬Ÿ– ‚π flr ¤fŒ flr Œ—π ‚ ¤rnt ¤⁄ ◊r ◊a—+ -·+ Arjuna, he, who looks on all as one, on the analogy of his own self, and looks upon the joy and sorrow of all equallyñsuch a Yog∂ is deemed to be the highest of all. (32) •¡È¸Ÿ © flÊø ¤r˘¤ ¤rnt-fl¤r ¤˝r+— ‚rr¤Ÿ ◊œ‚¸ŒŸ– ∞at¤r„ Ÿ ¤‡¤rf◊ ¤=¤‹-flrf-t¤fa ft¤⁄ r◊˜+ --+ Arjuna said : K涃a, owing to restlessness of mind I do not perceive the stability of this Yoga in the form of equanimity, which You have just spoken of. (33) ¤=¤‹ f„ ◊Ÿ— ∑r¢r ¤˝◊rf¤ ’‹flŒ˜Œ… ◊˜– at¤r„ fŸn˝„ ◊-¤ flr¤rf⁄ fl ‚Œr∑⁄ ◊˜+ -×+ Text 30ó34] Bhagavadg∂tå 86 For, K涃a, the mind is very unsteady, turbulent, tenacious and powerful; therefore, I consider it as difficult to control as the wind. (34) üÊË÷ªflÊŸÈ flÊø •‚‡r¤ ◊„ r’r„ r ◊Ÿr ŒfŸn˝„ ¤‹◊˜– •+¤r‚Ÿ a ∑ı-a¤ fl⁄ rª¤¢r ¤ nna+ -~+ ›r∂ Bhagavån said : The mind is restless no doubt, and difficult to curb, Arjuna; but it can be brought under control by repeated practice (of meditation) and by the exercise of dispassion, O son of Kunt∂. (35) •‚¤ar-◊Ÿr ¤rnr Œr¤˝r¤ ;fa ◊ ◊fa—– fl‡¤r-◊Ÿr a ¤aar ‡r¤¤r˘flrta◊¤r¤a—+ -º+ Yoga is difficult of achievement by one whose mind is not subdued by him; however, who has the mind under control, and is ceaselessly striving, it can be easily attained through practice. Such is My conviction. (36) •¡È¸Ÿ © flÊø •¤fa— >rq¤r¤ar ¤rnr¤rf‹a◊rŸ‚—– •¤˝rt¤ ¤rn‚f‚fq ∑r nfa ∑r¢r n-ø fa+ -¬+ Arjuna said : K涃a, what becomes of the aspirant who, though endowed with faith, has not been able to subdue his passions, and whose mind is, therefore, diverted from Yoga at the time of death, and who thus fails to reach perfection in Yoga (God-realization)? (37) Bhagavadg∂tå [Ch. 6 87 ∑f¤r-Ÿr¤¤ffl¤˝r≈ f‡ø -Ÿr¤˝f◊fl Ÿ‡¤fa– •¤˝far∆ r ◊„ r’r„ r ffl◊¸… r ’˝zr¢r— ¤f¤+ -c+ K涃a, swerved from the path leading to God-realization and without anything to stand upon, is he not lost like the scattered cloud, deprived of both God-realization and heavenly enjoyment? (38) ∞a-◊ ‚‡r¤ ∑r¢r ø -r◊„ t¤‡r¤a—– -flŒ-¤— ‚‡r¤t¤rt¤ ø -rr Ÿ n¤¤ua+ -º+ K涃a, only You are capable to remove this doubt of mine completely; for none other than you can dispel this doubt. (39) üÊË÷ªflÊŸÈ flÊø ¤r¤ Ÿfl„ Ÿr◊·r fflŸr‡rtat¤ fflua– Ÿ f„ ∑r¤r¢r∑-∑f‡¤Œ˜Œnfa ara n-ø fa+ ׫+ ›r∂ Bhagavån said : Dear Arjuna, there is no fall for him either here or hereafter. For O my beloved, none who strives for self-redemption (i.e., God-realization) ever meets with evil destiny. (40) ¤˝rt¤ ¤¢¤∑ar ‹r∑rŸf¤-flr ‡rr‡flat— ‚◊r—– ‡r¤tŸr >rt◊ar n„ ¤rn¤˝r≈ r˘f¤¬r¤a+ ×{+ Such a person who has strayed from Yoga, obtains the higher worlds, (heaven etc.) to which men of meritorious deeds alone are entitled, and having resided there for innumerable years, takes birth of pious and prosperous parents. (41) Text 38ó41] Bhagavadg∂tå 88 •¤flr ¤rfnŸr◊fl ∑‹ ¤flfa œt◊ar◊˜– ∞afq Œ‹¤a⁄ ‹r∑ ¬-◊ ¤ŒtŒ‡r◊˜+ ×·+ Or (if he is possessed of dispassion) then not attaining to those regions he is born in the family of enlightened Yog∂s; but such a birth in this world is very difficult to obtain. (42) a·r a ’fq‚¤rn ‹¤a ¤ıflŒf„ ∑◊˜– ¤aa ¤ aar ¤¸¤— ‚f‚qı ∑=Ÿ-ŒŸ+ ×-+ Arjuna, he automatically regains in that birth the spiritual insight of his previous birth; and through that he strives harder than ever for perfection in the form of God-realization. (43) ¤¸flr+¤r‚Ÿ aŸfl fç ¤a nfl‡rr˘f¤ ‚—– f¬-rr‚⁄ f¤ ¤rnt¤ ‡rªŒ’˝zrrfaflaa+ ××+ The other one who takes birth in a rich family, though under the sway of his senses, feels drawn towards God by force of the habit acquired in his previous birth; nay, even the seeker of enlighten- ment on Yoga (in the form of even-mindedness) transcends the fruit of actions performed with some interested motive as laid down in the Vedas. (44) ¤˝¤-Ÿrua◊rŸta ¤rnt ‚‡rqf∑fr’¤—– •Ÿ∑¬-◊‚f‚qtaar ¤rfa ¤⁄ r nfa◊˜+ ×~+ The Yog∂, however, who diligently takes up the practice attains perfection in this very life with the help of latencies of many births, and being Bhagavadg∂tå [Ch. 6 89 thoroughly purged of sin, forthwith reaches the supreme state. (45) a¤ftfl+¤r˘fœ∑r ¤rnt -rrfŸ+¤r˘f¤ ◊ar˘fœ∑—– ∑f◊+¤‡¤rfœ∑r ¤rnt at◊rurnt ¤flr¬Ÿ+ ׺+ The Yog∂ is superior to the ascetics; he is regarded superior even to those versed in sacred lore. The Yog∂ is also superior to those who perform action with some interested motive. Therefore, Arjuna, do become a Yog∂. (46) ¤rfnŸr◊f¤ ‚fl¤r ◊Œ˜naŸr-a⁄ r-◊Ÿr– >rqrflr-¤¬a ¤r ◊r ‚ ◊ ¤+a◊r ◊a—+ ׬+ Of all Yog∂s, again, he who devoutly worships Me with his mind focussed on Me is considered by Me to be the best Yog∂. i·◊‚¤◊¤iªi Ÿi◊ ¤·∆ i˘·¤i¤—+ ·+ Thus, in the Upani¶ad sung by the Lord, the Science of Brahma, the scripture of Yoga, the dialogue between ›r∂ K涃a and Arjuna, ends the sixth chapter entitled ìThe Yoga of Self-Control.î Z Text 46-47] Bhagavadg∂tå Chapter VII üÊË÷ªflÊŸÈflÊø ◊ƒ¤r‚+◊Ÿr— ¤r¤ ¤rn ¤=¬-◊Œr>r¤—– •‚‡r¤ ‚◊n˝ ◊r ¤¤r -rrt¤f‚ a-ø ¢r+ {+ ›r∂ Bhagavån said : Arjuna, now listen how with the mind attached to Me (through exclusive love) and practising Yoga with absolute dependence on Me, you will know Me, the repository of all power, strength and glory and other attributes, the Universal soul, in entirety and without any shadow of doubt. (1) -rrŸ a˘„ ‚ffl-rrŸf◊Œ flˇ¤rr¤‡r¤a—– ¤º-rr-flr Ÿ„ ¤¸¤r˘-¤º-rra√¤◊flf‡rr¤a+ ·+ I shall unfold to you in its entirety this wisdom (Knowledge of God in His absolute formless aspect) along with the Knowledge of the qualified aspect of God (both with form and without form), having known which nothing else remains yet to be known in this world. (2) ◊Ÿr¤r¢rr ‚„ n¤ ∑f‡¤uafa f‚q¤– ¤aar◊f¤ f‚qrŸr ∑f‡¤-◊r flf-r a-fla—+ -+ Hardly one among thousands of men strives to realize Me; of those striving Yog∂s, again, some rare one, devoting himself exclusively to Me, knows Me in reality. (3) 91 ¤¸f◊⁄ r¤r˘Ÿ‹r flr¤— π ◊Ÿr ’fq⁄ fl ¤– •„ ¿ r⁄ ;at¤ ◊ f¤-Ÿr ¤˝∑fa⁄ r≈ œr+ ×+ •¤⁄ ¤f◊at-fl-¤r ¤˝∑fa fflfq ◊ ¤⁄ r◊˜– ¬tfl¤¸ar ◊„ r’r„ r ¤¤Œ œr¤a ¬na˜+ ~+ Earth, water, fire, air, ether, mind, reason and also ego; these constitute My nature divided into eight parts. This indeed is My lower (material) nature; the other than this, by which the whole universe is sustained, know it to be My higher (or spiritual) nature in the form of J∂va (the life- principle), O Arjuna. (4-5) ∞aurŸtfŸ ¤¸arfŸ ‚flr¢rt-¤¤œr⁄ ¤– •„ ∑-tŸt¤ ¬na— ¤˝¤fl— ¤˝‹¤ta¤r+ º+ Arjuna, know that all beings have evolved from this twofold Prakæti, and that I am the source of the entire creation, and into Me again it dissolves. (6) ◊-r— ¤⁄ a⁄ Ÿr-¤f-∑f=¤Œfta œŸ=¬¤– ◊f¤ ‚flf◊Œ ¤˝ra ‚¸·r ◊f¢rn¢rr ;fl+ ¬+ There is nothing else besides Me, Arjuna. Like clusters of yarn-beads formed by knots on a thread, all this is threaded on Me. (7) ⁄ ‚r˘„ ◊t‚ ∑ı-a¤ ¤˝¤rft◊ ‡rf‡r‚¸¤¤r—– ¤˝¢rfl— ‚flflŒ¤ ‡rªŒ— π ¤ı=¤ Ÿ¤+ c+ Arjuna, I am the sap in water and the radiance of the moon and the sun; I am the sacred syllable Text 4ó8] Bhagavadg∂tå 92 OÀ in all the Vedas, the sound in ether, and virility in men. (8) ¤¢¤r n-œ— ¤f¤√¤r ¤ a¬‡¤rft◊ ffl¤rfl‚ı– ¬tflŸ ‚fl¤¸a¤ a¤‡¤rft◊ a¤ftfl¤+ º + I am the pure odour (the subtle principle of smell) in the earth and the brightness in fire; nay, I am the life in all beings and austerity in the ascetics. (9) ’t¬ ◊r ‚fl¤¸arŸr fflfq ¤r¤ ‚ŸraŸ◊˜– ’fq’fq◊ar◊ft◊ a¬ta¬ftflŸr◊„ ◊˜+ {«+ Arjuna, know Me the eternal seed of all beings. I am the intelligence of the intelligent; the glory of the glorious am I. (10) ’‹ ’‹flar ¤r„ ∑r◊⁄ rnfflflf¬a◊˜– œ◊rffl=qr ¤¸a¤ ∑r◊r˘ft◊ ¤⁄ a¤¤+ {{+ Arjuna, of the mighty I am the might, free from passion and desire; in beings I am the sexual desire not conflicting with virtue or scriptural injunctions. (11) ¤ ¤fl ‚rf-fl∑r ¤rflr ⁄ r¬‚rtar◊‚r‡¤ ¤– ◊-r ∞flfa arf-flfq Ÿ -fl„ a¤ a ◊f¤+ {·+ do they in Me. (12) Bhagavadg∂tå [Ch. 7 93 f·rf¤n¢r◊¤¤rfl⁄ f¤— ‚flf◊Œ ¬na˜– ◊rf„ a Ÿrf¤¬rŸrfa ◊r◊+¤— ¤⁄ ◊√¤¤◊˜+ {-+ The whole of this creation is deluded by these objects evolved from the three modes of Prakætió Sattva, Rajas and Tamas; that is why the world fails to recognize Me, standing apart from these the imperishable. (13) Œflt n¤r n¢r◊¤t ◊◊ ◊r¤r Œ⁄ -¤¤r– ◊r◊fl ¤ ¤˝¤u-a ◊r¤r◊ar a⁄ f-a a+ {×+ For, this most wonderful Måyå (veil) of Mine, consisting of the three Guƒas (modes of Nature), is extremely difficult to breakthrough; those, however, who constantly adore Me alone, are able to cross it. (14) Ÿ ◊r Œr∑faŸr ◊¸… r— ¤˝¤u-a Ÿ⁄ rœ◊r—– ◊r¤¤r¤z a-rrŸr •r‚⁄ ¤rfl◊rf>rar—+ {~+ Those whose wisdom has been carried away by Måyå, and are of demoniac nature, such foolish and vile men of evil deeds do not adore Me. (15) ¤afflœr ¤¬-a ◊r ¬Ÿr— ‚∑faŸr˘¬Ÿ– •rar f¬-rr‚⁄ ¤r¤t -rrŸt ¤ ¤⁄ a¤¤+ {º+ Four types of devotees of noble deeds worship Me, Arjuna, the seeker after worldly possessions, the afflicted, the seeker for knowledge, and the man of wisdom, O best of Bharatas. (16) Text 13ó16] Bhagavadg∂tå 94 a¤r -rrŸt fŸ-¤¤+ ∞∑¤f+fflf‡rr¤a– f¤˝¤r f„ -rrfŸŸr˘-¤¤◊„ ‚ ¤ ◊◊ f¤˝¤—+ {¬+ Of these, the best is the man of wisdom, ever established in identity with Me and possessed of exclusive devotion. For, I am extremely dear to the wise man who knows Me in reality, and he is extremely dear to Me. (17) s Œr⁄ r— ‚fl ∞fla -rrŸt -flr-◊fl ◊ ◊a◊˜– •rft¤a— ‚ f„ ¤+r-◊r ◊r◊flrŸ-r◊r nfa◊˜+ {c+ Indeed, all these are noble, but the man of wisdom is My very self; such is My view. For such a devotee, who has his mind and intellect merged in Me, is firmly established in Me alone as the highest goal. (18) ’„¸ Ÿr ¬-◊Ÿr◊-a -rrŸflr-◊r ¤˝¤ua– flr‚Œfl— ‚flf◊fa ‚ ◊„ r-◊r ‚Œ‹¤—+ {º+ In the very last of all births the enlightened person worships Me by realizing that all this is God. Such a great soul is very rare indeed.(19) ∑r◊tataz a-rrŸr— ¤˝¤u-a˘-¤Œflar—– a a fŸ¤◊◊rt¤r¤ ¤˝∑-¤r fŸ¤ar— tfl¤r+ ·«+ Those whose wisdom has been carried away by various desires, being prompted by their own nature, worship other deities, adopting norms relating to each. (20) ¤r ¤r ¤r ¤r aŸ ¤+— >rq¤rf¤af◊-ø fa– at¤ at¤r¤‹r >rqr ar◊fl fflŒœrr¤„ ◊˜+ ·{+ Bhagavadg∂tå [Ch. 7 95 Whatever celestial form a devotee (craving for some worldly object) chooses to worship with reverence, I stabilize the faith of that particular devotee in that very form. (21) ‚ a¤r >rq¤r ¤+tat¤r⁄ rœŸ◊t„ a– ‹¤a ¤ aa— ∑r◊r-◊¤fl fflf„ arf-„ arŸ˜+ ··+ Endowed with such faith he worships that particular deity and obtains through that deity without doubt his desired enjoyments as ordained by Me. (22) •-afl-r ¤‹ a¤r aÇfl-¤r¤◊œ‚r◊˜– Œflr-Œfl¤¬r ¤rf-a ◊Ç+r ¤rf-a ◊r◊f¤+ ·-+ The fruit gained by these people of small understanding, however, is perishable. The worshippers of gods attain the gods; whereas My devotees, howsoever they worship Me, eventually come to Me and Me alone. (23) •√¤+ √¤f+◊r¤-Ÿ ◊-¤-a ◊r◊’q¤—– ¤⁄ ¤rfl◊¬rŸ-ar ◊◊r√¤¤◊Ÿ-r◊◊˜+ ·×+ Not knowing My supreme nature, unsurpassable and undecaying, the ignorant persons regard Me, who am the Supreme Spirit, beyond the reach of mind and senses, and the embodiment of Truth, Knowledge and Bliss, to have assumed a finite form through birth as an ordinary human being. (24) Ÿr„ ¤˝∑r‡r— ‚flt¤ ¤rn◊r¤r‚◊rfla—– ◊¸… r˘¤ Ÿrf¤¬rŸrfa ‹r∑r ◊r◊¬◊√¤¤◊˜+ ·~+ Text 22ó25] Bhagavadg∂tå 96 Veiled by My Yogamåyå, divine potency, I am not manifest to all. Hence these ignorant folk fail to recognize Me, the birthless and imperishable Supreme Deity i.e., consider Me as subject to birth and death. (25) flŒr„ ‚◊atarfŸ fla◊rŸrfŸ ¤r¬Ÿ– ¤fflr¤rf¢r ¤ ¤¸arfŸ ◊r a flŒ Ÿ ∑‡¤Ÿ+ ·º+ Arjuna, I know all beings, past as well as present, nay, even those that are yet to come; but none, devoid of faith and devotion, knows Me. (26) ;-ø r礂◊-¤Ÿ ç-ç◊r„ Ÿ ¤r⁄ a– ‚fl¤¸arfŸ ‚r◊r„ ‚n ¤rf-a ¤⁄-a¤+ ·¬+ O valiant Arjuna, through delusion in the shape of pairs of opposites (such as pleasure and pain etc.,) born of desire and aversion, all living creatures in this world are falling a prey to infatuation. (27) ¤¤r -fl-ana ¤r¤ ¬ŸrŸr ¤¢¤∑◊¢rr◊˜– a ç-ç◊r„ fŸ◊+r ¤¬-a ◊r Œ… fl˝ar—+ ·c+ But those men of virtuous deeds, whose sins have come to an end, being freed from delusion in the shape of pairs of opposites born of attraction and repulsion, worship Me with a firm resolve in every way. (28) Bhagavadg∂tå [Ch. 7 97 ¬⁄ r◊⁄ ¢r◊rˇrr¤ ◊r◊rf>r-¤ ¤af-a ¤– a ’˝zr af猗 ∑-tŸ◊·¤r-◊ ∑◊ ¤rfπ‹◊˜+ ·º+ ‚rfœ¤¸arfœŒfl ◊r ‚rfœ¤-r ¤ ¤ fflŒ—– ¤˝¤r¢r∑r‹˘f¤ ¤ ◊r a fflŒ¤+¤a‚—+ -«+ They who, having taken refuge in Me, strive for deliverance from old age and death know Brahma (the Absolute), the whole Adhyåtma (the totality of J∂vas or embodied souls), and the entire field of Karma (action) as well as My integral being, comprising Adhibhµuta (the field of Matter), Adhidaiva (Brahmå) and Adhiyaj¤a (the unmanifest Divinity dwelling in the heart of all beings as their witness). And they who, possessed of a steadfast mind, know thus even at the hour of death, they too know Me alone. (29-30) -iiŸlfl-iiŸ¤iªi Ÿi◊ seventh chapter entitled ìThe Yoga of J¤åna (Knowledge of Nirguƒa Brahma) and Vij¤åna (Knowledge of Manifest Divinity).î Z Text 29-30] Bhagavadg∂tå Chapter VIII •¡È¸Ÿ © flÊø f∑ aŒ˜’˝zr f∑◊·¤r-◊ f∑ ∑◊ ¤=¤r-r◊– •fœ¤¸a ¤ f∑ ¤˝r+◊fœŒfl f∑◊-¤a+ {+ Arjuna said : K涃a, what is that Brahma (Absolute), what is Adhyåtma (Spirit), and what is Karma (Action)? What is called Adhibhµuta (Matter) and what is termed as Adhidaiva (Divine Intelligence)? (1) •fœ¤-r— ∑¤ ∑r˘·r Œ„ ˘ft◊-◊œ‚¸ŒŸ– ¤˝¤r¢r∑r‹ ¤ ∑¤ -r¤r˘f‚ fŸ¤ar-◊f¤—+ ·+ K涃a, who is Adhiyaj¤a here and how does he dwell in the body? And how are You to be realized at the time of death by those of steadfast mind? (2) üÊË÷ªflÊŸÈ flÊø •ˇr⁄ ’˝zr ¤⁄ ◊ tfl¤rflr˘·¤r-◊◊-¤a– ¤¸a¤rflrÇfl∑⁄ r ffl‚n— ∑◊‚f=-ra—+ -+ ›r∂ Bhagavån said:The supreme Indestructible is Brahma, oneís own Self (the individual soul) is called Adhyåtma; and the discharge of spirits, (Visarga), which brings forth the existence of beings, is called Karma (Action). (3) 99 •fœ¤¸a ˇr⁄ r ¤rfl— ¤=¤‡¤rfœŒfla◊˜– •fœ¤-rr˘„ ◊flr·r Œ„ Œ„ ¤ar fl⁄ + ×+ All perishable objects are Adhibhµuta; the shining Puru¶a (Brahmå) is Adhidaiva; and in this body I Myself, dwelling as the inner witness, am Adhiyaj¤a, O Arjuna! (4) •-a∑r‹ ¤ ◊r◊fl t◊⁄ -◊¤-flr ∑‹fl⁄ ◊˜– ¤— ¤˝¤rfa ‚ ◊Çrfl ¤rfa Ÿrt-¤·r ‚‡r¤—+ ~+ He who departs from the body, thinking of Me alone even at the time of death, attains My state; there is no doubt about it. (5) ¤ ¤ flrf¤ t◊⁄ -¤rfl -¤¬-¤-a ∑‹fl⁄ ◊˜– a a◊flfa ∑ı-a¤ ‚Œr aÇrfl¤rffla—+ º+ Arjuna, thinking of whatever entity one leaves the body at the time of death, that and that alone one attains, being ever absorbed in its thought. (6) at◊r-‚fl¤ ∑r‹¤ ◊r◊Ÿt◊⁄ ¤·¤ ¤– ◊ƒ¤f¤a◊Ÿr’fq◊r◊flr¤t¤‚‡r¤◊˜ + ¬+ Therefore, Arjuna, think of Me at all times and fight. With mind and reason thus set on Me, you will doubtless come to Me. (7) •+¤r‚¤rn¤+Ÿ ¤a‚r Ÿr-¤nrf◊Ÿr– ¤⁄ ◊ ¤=¤ fŒ√¤ ¤rfa ¤r¤rŸf¤-a¤Ÿ˜+ c+ Arjuna, he who with his mind disciplined through Yoga in the form of practice of meditation Text 4ó8] Bhagavadg∂tå 100 and thinking of nothing else, is constantly engaged in contemplation of God attains the supremely effulgent Divine Puru¶a (God). (8) ∑ffl ¤⁄ r¢r◊Ÿ‡rrf‚ar⁄ - ◊¢rr⁄ ¢rt¤r‚◊Ÿt◊⁄ u— – ‚flt¤ œrar⁄ ◊f¤--¤=¤- ◊rfŒ-¤fl¢r a◊‚— ¤⁄ tara˜+ º + He who contemplates on the all-knowing, ageless Being, the Ruler of all, subtler than the subtle, the universal sustainer, possessing a form beyond human conception, effulgent like the sun and far beyond the darkness of ignorance. (9) ¤˝¤r¢r∑r‹ ◊Ÿ‚r¤‹Ÿ ¤¤-¤r ¤+r ¤rn’‹Ÿ ¤fl– ¤˝flr◊·¤ ¤˝r¢r◊rfl‡¤ ‚r¤∑˜- ‚ a ¤⁄ ¤=¤◊¤fa fŒ√¤◊˜+ {«+ Having by the power of Yoga firmly held the life-breath in the space between the two eyebrows even at the time of death, and then contemplating on God with a steadfast mind, full of devotion, he reaches verily that supreme divine Puru¶a (God). (10) ¤Œˇr⁄ flŒfflŒr flŒf-a ffl‡rf-a ¤ua¤r flta⁄rnr—– ¤fŒ-ø -ar ’˝zr¤¤ ¤⁄ f-a a-r ¤Œ ‚z˜ n˝„ ¢r ¤˝flˇ¤+ {{+ I shall tell you briefly about that Supreme goal Bhagavadg∂tå [Ch. 8 101 (viz., God, who is an embodiment of Truth, Knowledge and Bliss), which the knowers of the Veda term as the Indestructible, which striving recluses, free from passion, merge into, and desiring which the celibates practise Brahmacarya. (11) ‚flçr⁄ rf¢r ‚¤r¤ ◊Ÿr z fŒ fŸ=·¤ ¤– ◊¸·-¤rœr¤r-◊Ÿ— ¤˝r¢r◊rft¤ar ¤rnœr⁄ ¢rr◊˜+ {·+ •rf◊-¤∑rˇr⁄ ’˝zr √¤r„ ⁄ -◊r◊Ÿt◊⁄ Ÿ˜– ¤— ¤˝¤rfa -¤¬-Œ„ ‚ ¤rfa ¤⁄ ◊r nfa◊˜+ {-+ Having controlled all the senses, and firmly holding the mind in the heart, and then drawing the life-breath to the head, and thus remaining steadfast in Yogic concentration on God, he who leaves the body and departs uttering the one Indestructible Brahma, OÀ, and dwelling on Me in My absolute aspect, reaches the supreme goal. (12-13) •Ÿ-¤¤ar— ‚aa ¤r ◊r t◊⁄ fa fŸ-¤‡r—– at¤r„ ‚‹¤— ¤r¤ fŸ-¤¤+t¤ ¤rfnŸ—+ {×+ Arjuna, whosoever always and constantly thinks of Me with undivided mind, to that Yog∂ ever absorbed in Me I am easily attainable. (14) ◊r◊¤-¤ ¤Ÿ¬-◊ Œ—πr‹¤◊‡rr‡fla◊˜– ŸrtŸflf-a ◊„ r-◊rŸ— ‚f‚fq ¤⁄ ◊r nar—+ {~+ Great souls, who have attained the highest perfection, having come to Me, are no more subject to rebirth, which is the abode of sorrow, and transient by nature. (15) Text 12ó15] Bhagavadg∂tå 102 •r’˝zr¤flŸrr‹r∑r— ¤Ÿ⁄ rflfaŸr˘¬Ÿ– ◊r◊¤-¤ a ∑ı-a¤ ¤Ÿ¬-◊ Ÿ fflua+ {º+ Arjuna, all the worlds from Brahmaloka (the heavenly realm of the Creator, Brahmå) downwards are liable to birth and rebirth. But, O son of Kunt∂, on attaining Me there is no rebirth (For, while I am beyond Time, regions like Brahmaloka, being conditioned by time, are transitory). (16) ‚„ n¤n¤¤-a◊„ ¤Œ˜’˝zr¢rr fflŒ—– ⁄ rf·r ¤n‚„ nr-ar a˘„ r⁄ r·rfflŒr ¬Ÿr—+ {¬+ Those Yog∂s who know from realization Brahmåís day as covering a thousand Mahåyugas, and so his night as extending to another thousand Mahåyugas know the reality about Time. (17) •√¤+rŒ˜√¤+¤— ‚flr— ¤˝¤fl--¤„ ⁄ rn◊– ⁄ r·¤rn◊ ¤˝‹t¤-a a·rflr√¤+‚=-r∑+ {c+ All embodied beings emanate from the Unmanifest (i.e., Brahmåís subtle body) at the coming of the cosmic day; at the cosmic nightfall they merge into the same subtle body of Brahmå, known as the Unmanifest. (18) ¤¸an˝r◊— ‚ ∞flr¤ ¤¸-flr ¤¸-flr ¤˝‹t¤a– ⁄ r·¤rn◊˘fl‡r— ¤r¤ ¤˝¤fl-¤„ ⁄ rn◊+ {º+ Arjuna, this multitude of beings, being born again and again, is dissolved under compulsion of its nature at the coming of the cosmic night, and rises again at the commencement of the cosmic day. (19) Bhagavadg∂tå [Ch. 8 103 ¤⁄ tat◊r-r ¤rflr˘-¤r˘√¤+r˘√¤+r-‚ŸraŸ—– ¤— ‚ ‚fl¤ ¤¸a¤ Ÿ‡¤-‚ Ÿ fflŸ‡¤fa+ ·«+ Far beyond even this unmanifest, there is yet another unmanifest Existence, that Supreme Divine Person, who does not perish even though all beings perish. (20) •√¤+r˘ˇr⁄ ;-¤+ta◊r„ — ¤⁄ ◊r nfa◊˜– ¤ ¤˝rt¤ Ÿ fŸfla-a aqr◊ ¤⁄ ◊ ◊◊+ ·{+ The same unmanifest which has been spoken of as the Indestructible is also called the supreme Goal; that again is My supreme Abode, attaining which they return not to this mortal world.(21) ¤=¤— ‚ ¤⁄ — ¤r¤ ¤¤-¤r ‹+¤t-flŸ-¤¤r– ¤t¤r-a—t¤rfŸ ¤¸arfŸ ¤Ÿ ‚flf◊Œ aa◊˜+ ··+ Arjuna, that eternal unmanifest supreme Puru¶a in whom all beings reside and by whom all this is pervaded, is attainable only through exclusive Devotion. (22) ¤·r ∑r‹ -flŸrflf-r◊rflf-r ¤fl ¤rfnŸ—– ¤˝¤rar ¤rf-a a ∑r‹ flˇ¤rf◊ ¤⁄ a¤¤+ ·-+ Arjuna, I shall now tell you the time (path) departing when Yog∂s do not return, and also the time (path) departing when they do return. (23) •fªŸº¤rfa⁄ „ — ‡r¤‹— ¤¢◊r‚r s -r⁄ r¤¢r◊˜– a·r ¤˝¤rar n-ø f-a ’˝zr ’˝zrfflŒr ¬Ÿr—+ ·×+ Text 20ó24] Bhagavadg∂tå 104 (Of the two paths) the one is that in which are stationed the all-effulgent fire-god and the deities presiding over daylight, the bright fortnight, and the six months of the northward course of the sun respectively; proceeding along it after death Yog∂s, who have known Brahma, being successively led by the above gods, finally reach Brahma. (24) œ¸◊r ⁄ rf·rta¤r ∑r¢r— ¤¢◊r‚r Œfˇr¢rr¤Ÿ◊˜– a·r ¤r-¢˝◊‚ º¤rfa¤rnt ¤˝rt¤ fŸflaa+ ·~+ The other path is that wherein are stationed the gods presiding over smoke, night, the dark fortnight, and the six months of the southward course of the sun; the Yog∂ (devoted to action with an interested motive) taking to this path after death is led by the above gods, one after another, and attaining the lustre of the moon (and enjoying the fruit of his meritorious deeds in heaven) returns to this mortal world. (25) ‡r¤‹∑r¢r nat na ¬na— ‡rr‡fla ◊a– ∞∑¤r ¤r-¤Ÿrflf-r◊-¤¤rflaa ¤Ÿ—+ ·º+ For these two paths of the world, the bright and the dark, are considered to be eternal. Proceeding by one of them, one reaches the supreme state from which there is no return; and proceeding by the other, one returns to the mortal world, i.e., becomes subject to birth and death once more. (26) Bhagavadg∂tå [Ch. 8 105 Ÿa ‚at ¤r¤ ¬rŸ-¤rnt ◊nfa ∑‡¤Ÿ– at◊r-‚fl¤ ∑r‹¤ ¤rn¤+r ¤flr¬Ÿ+ ·¬+ Knowing thus the secret of these two paths, O son of Kunt∂, no Yog∂ gets deluded. Therefore, Arjuna, at all times be steadfast in Yoga in the form of equanimity (i.e., strive constantly for My realization). (27) flŒ¤ ¤-r¤ a¤—‚ ¤fl ŒrŸ¤ ¤-¤¢¤¤‹ ¤˝fŒr≈◊˜– •-¤fa a-‚flf◊Œ fflfŒ-flr ¤rnt ¤⁄ t¤rŸ◊¤fa ¤ru◊˜+ ·c+ The Yog∂, realizing this profound truth, doubtless transcends all the rewards enumerated for the study of the Vedas as well as for the performance of sacrifices, austerities and charities, and attains the supreme and primal state. ˇi⁄ ’˝ti¤iªi Ÿi◊i· eighth chapter entitled ìThe Yoga of the Indestructible Brahma.î Z Text 27-28] Bhagavadg∂tå Chapter IX üÊË÷ªflÊŸÈ flÊø ;Œ a a nna◊ ¤˝flˇ¤rr¤Ÿ‚¸¤fl– -rrŸ ffl-rrŸ‚f„ a ¤º-rr-flr ◊rˇ¤‚˘‡r¤ra˜+ {+ ›r∂ Bhagavån said : To you, who are devoid of the carping spirit, I shall now unfold the most secret knowledge of Nirguƒa Brahma along with the knowledge of manifest Divinity, knowing which you shall be free from the evil of worldly existence. (1) ⁄ r¬fflur ⁄ r¬nn ¤ffl·rf◊Œ◊-r◊◊˜– ¤˝-¤ˇrrfln◊ œr¤ ‚‚π ∑a◊√¤¤◊˜+ ·+ This knowledge (of both the Nirguƒa and Saguƒa aspects of Divinity) is a sovereign science, a sovereign secret, supremely holy, most excellent, directly enjoyable, attended with virtue, very easy to practise and imperishable. (2) •>rzœrŸr— ¤=¤r œ◊t¤rt¤ ¤⁄-a¤– •¤˝rt¤ ◊r fŸfla-a ◊-¤‚‚r⁄ fl-◊fŸ+ -+ Arjuna, people having no faith in this Dharma, failing to reach Me, continue to revolve in the path of the world of birth and death. (3) ◊¤r aaf◊Œ ‚fl ¬nŒ√¤+◊¸faŸr– ◊-t¤rfŸ ‚fl¤¸arfŸ Ÿ ¤r„ arflflft¤a—+ ×+ 107 The whole of this universe is permeated by Me as unmanifest Divinity, and all beings dwell on the idea within Me. But really speaking, I am not present in them. (4) Ÿ ¤ ◊-t¤rfŸ ¤¸arfŸ ¤‡¤ ◊ ¤rn◊‡fl⁄ ◊˜– ¤¸a¤-Ÿ ¤ ¤¸at¤r ◊◊r-◊r ¤¸a¤rflŸ—+ ~+ Nay, all those beings abide not in Me; but behold the wonderful power of My divine Yoga; though the Sustainer and Creator of beings, Myself in reality dwell not in those beings. (5) ¤¤r∑r‡rft¤ar fŸ-¤ flr¤— ‚fl·rnr ◊„ rŸ˜– a¤r ‚flrf¢r ¤¸arfŸ ◊-t¤rŸt-¤¤œr⁄ ¤+ º+ Just as the extensive air, which is moving everywhere, (being born of ether) ever remains in ether, likewise know that all beings, who have originated from My Sa∆kalpa, abide in Me. (6) ‚fl¤¸arfŸ ∑ı-a¤ ¤˝∑fa ¤rf-a ◊rf◊∑r◊˜– ∑r¤ˇr¤ ¤ŸtarfŸ ∑r¤rŒı ffl‚¬rr¤„ ◊˜+ ¬+ Arjuna, during the Final Dissolution all beings enter My Prakæti (the prime cause), and at the beginning of creation, I send them forth again. (7) ¤˝∑fa tflr◊flr≈ +¤ ffl‚¬rf◊ ¤Ÿ— ¤Ÿ—– ¤¸an˝r◊f◊◊ ∑-tŸ◊fl‡r ¤˝∑afl‡rra˜+ c+ Wielding My Nature I procreate, again and again (according to their respective Karmas) all Text 5ó8] Bhagavadg∂tå 108 this multitude of beings subject to the influence of their own nature. (8) Ÿ ¤ ◊r arfŸ ∑◊rf¢r fŸ’·Ÿf-a œŸ=¬¤– s Œr‚tŸflŒr‚tŸ◊‚+ a¤ ∑◊‚+ º + Arjuna, those actions, however, do not bind Me, unattached as I am to such actions and standing apart, as it were. (9) ◊¤r·¤ˇr¢r ¤˝∑fa— ‚¸¤a ‚¤⁄ r¤⁄ ◊˜– „ aŸrŸŸ ∑ı-a¤ ¬nfç¤f⁄ flaa+ {«+ Arjuna, under My aegis, Nature brings forth the whole creation, consisting of both sentient and insentient beings; it is due to this cause that the wheel of Sa≈såra is going round. (10) •fl¬rŸf-a ◊r ◊¸… r ◊rŸ¤t aŸ◊rf>ra◊˜– ¤⁄ ¤rfl◊¬rŸ-ar ◊◊ ¤¸a◊„ ‡fl⁄ ◊˜+ {{+ Not Knowing My supreme nature, fools deride Me, the Overlord of the entire creation, who have assumed the human form. That is to say, they take Me, who have appeared in human form through My ëYogamåyåí for deliverance of the world, as an ordinary mortal. (11) ◊rrrr‡rr ◊rrr∑◊r¢rr ◊rrr-rrŸr ffl¤a‚—– ⁄ rˇr‚t◊r‚⁄ t ¤fl ¤˝∑fa ◊rf„ Ÿt f>rar—+ {·+ Those bewildered persons with vain hopes, futile actions and fruitless knowledge have embraced a fiendish, demoniacal and delusive nature. (12) Bhagavadg∂tå [Ch. 9 109 ◊„ r-◊rŸta ◊r ¤r¤ Œflt ¤˝∑fa◊rf>rar—– ¤¬--¤Ÿ-¤◊Ÿ‚r -rr-flr ¤¸arfŒ◊√¤¤◊˜+ {-+ On the other hand, Arjuna, great souls who have adopted the divine nature, knowing Me as the prime source of all beings and the imperishable, eternal, worship Me constantly with one pointedness of mind. (13) ‚aa ∑ta¤-ar ◊r ¤a-a‡¤ Œ… fl˝ar—– Ÿ◊t¤-a‡¤ ◊r ¤¤-¤r fŸ-¤¤+r s ¤r‚a+ {×+ Constantly chanting My names and glories and striving for My realization, and bowing again and again to Me, those devotees of firm resolve, ever united with me through meditation, worship Me with single-minded devotion. (14) -rrŸ¤-rŸ ¤rt¤-¤ ¤¬-ar ◊r◊¤r‚a– ∞∑-flŸ ¤¤¤-flŸ ’„ œr ffl‡flar◊π◊˜+ {~+ Others, who follow the path of Knowledge, betake themselves to Me through Yaj¤a of Knowledge, worshipping Me in My absolute, formless aspect as one with themselves; while still others worship Me in My Universal Form in many ways, taking Me to be diverse in manifold celestial forms. (15) •„ ∑˝a⁄ „ ¤-r— tflœr„ ◊„ ◊ı¤œ◊˜– ◊-·rr˘„ ◊„ ◊flrº¤◊„ ◊fªŸ⁄ „ „ a◊˜+ {º+ I am the Vedic ritual, I am the sacrifice, I am the offering to the departed; I am the herbage and foodgrains; I am the sacred mantra, I am the clarified Text 13ó16] Bhagavadg∂tå 110 butter, I am the sacred fire, and I am verily the act of offering oblations into the fire. (16) f¤ar„ ◊t¤ ¬nar ◊rar œrar f¤ar◊„ —– flu ¤ffl·r◊r¿ r⁄ =¤‚r◊ ¤¬⁄ fl ¤+ {¬+ I am the sustainer and ruler of this universe, its father, mother and grandfather, the one worth knowing, the purifier, the sacred syllable OÀ, and the three Vedasó§Rk, Yaju¶ and Såma. (17) nfa¤ar ¤˝¤— ‚rˇrt fŸflr‚— ‡r⁄ ¢r ‚z a˜– ¤˝¤fl— ¤˝‹¤— t¤rŸ fŸœrŸ ’t¬◊√¤¤◊˜+ {c+ I am the supreme goal, sustainer, lord, witness, abode, refuge, well-wisher seeking no return, origin and end, resting-place, store-house to which all beings return at the time of universal destruction, and the imperishable seed. (18) a¤rr¤„ ◊„ fl¤ fŸnˆ rr¤-‚¬rf◊ ¤– •◊a ¤fl ◊-¤‡¤ ‚Œ‚¤rr„ ◊¬Ÿ+ {º+ I radiate heat as the sun, and hold back as well as send forth showers, Arjuna. I am immortality as well as death; even so, I am being and also non-being. (19) ·rfflur ◊r ‚r◊¤r— ¤¸a¤r¤r- ¤-rf⁄ r≈˜ flr tflnfa ¤˝r¤¤-a– a ¤¢¤◊r‚ru ‚⁄ -¢˝‹r∑- ◊‡Ÿf-a fŒ√¤rf-Œffl Œfl¤rnrŸ˜+ ·«+ Those who perform action with some interested motive as laid down in these three Vedas and Bhagavadg∂tå [Ch. 9 111 drink the sap of the Soma plant, and have thus been purged of sin, worshipping Me through sacrifices, seek access to heaven; attaining Indraís paradise as the result of their virtuous deeds, they enjoy the celestial pleasures of gods in heaven. (20) a a ¤¤-flr tfln‹r∑ ffl‡rr‹- ˇrt¢r ¤¢¤ ◊-¤‹r∑ ffl‡rf-a– ∞fl ·r¤tœ◊◊Ÿ¤˝¤-Ÿr- narna ∑r◊∑r◊r ‹¤-a+ ·{+ Having enjoyed the extensive heaven-world, they return to this world of mortals on the stock of their merits being exhausted. Thus devoted to the ritual with interested motive, recommended by the three Vedas as the means of attaining heavenly bliss, and seeking worldly enjoyments, they repeatedly come and go (i.e., ascend to heaven by virtue of their merits and return to earth when their fruit has been enjoyed). (21) •Ÿ-¤rf‡¤-a¤-ar ◊r ¤ ¬Ÿr— ¤¤¤r‚a– a¤r fŸ-¤rf¤¤+rŸr ¤rnˇr◊ fl„ rr¤„ ◊˜+ ··+ The devotees, however, who loving no one else constantly think of Me, and worship Me in a disinterested spirit, to those ever united in thought with Me, I bring full security and personally attend to their needs. (22) ¤˘t¤-¤Œflar ¤+r ¤¬-a >rq¤rf-flar—– a˘f¤ ◊r◊fl ∑ı-a¤ ¤¬--¤fflfœ¤¸fl∑◊˜+ ·-+ Arjuna, even those devotees who, endowed with Text 21ó23] Bhagavadg∂tå 112 faith, worship other gods (with some interested motive) worship Me alone, though with a mistaken approach. (23) •„ f„ ‚fl¤-rrŸr ¤r+r ¤ ¤˝¤⁄ fl ¤– Ÿ a ◊r◊f¤¬rŸf-a a-flŸra‡-¤flf-a a+ ·×+ For, I am the enjoyer and also the lord of all sacrifices; but they who do not know Me in reality as the Supreme Deity, they fall i.e., return to life on earth. (24) ¤rf-a Œflfl˝ar Œflrf-¤a -¤rf-a f¤afl˝ar—– ¤¸arfŸ ¤rf-a ¤¸aº¤r ¤rf-a ◊urf¬Ÿr˘f¤ ◊r◊˜+ ·~+ Those who are votaries of gods, go to gods, those who are votaries of manes, reach the manes; those who adore the spirits, reach the spirits and those who worship Me, come to Me alone. That is why My devotees are no longer subject to birth and death. (25) ¤·r ¤r¤ ¤‹ ar¤ ¤r ◊ ¤¤-¤r ¤˝¤-ø fa– aŒ„ ¤¤-¤¤z a◊‡Ÿrf◊ ¤˝¤ar-◊Ÿ—+ ·º+ Whosoever offers Me with love a leaf, a flower, a fruit or even water, I appear in person before that selfless devotee of sinless mind, and delightfully partake of that article offered by him with love. (26) ¤-∑⁄ rf¤ ¤Œ‡Ÿrf‚ ¤¬r„ rf¤ ŒŒrf‚ ¤a˜– ¤-r¤t¤f‚ ∑ı-a¤ a-∑=rfl ◊Œ¤¢r◊˜+ ·¬+ Arjuna, whatever you do, whatever you eat, whatever you offer as oblation to the sacred fire, Bhagavadg∂tå [Ch. 9 113 whatever you bestow as a gift, whatever you do by way of penance, do that as an offering to Me.(27) ‡r¤r‡r¤¤‹⁄ fl ◊rˇ¤‚ ∑◊’-œŸ—– ‚--¤r‚¤rn¤+r-◊r ffl◊+r ◊r◊¤r¤f‚+ ·c+ With your mind thus established in the Yoga of renunciation (offering of all actions to Me), you will be freed from the bondage of action in the shape of good and evil results; thus freed from them, you will attain Me. (28) ‚◊r˘„ ‚fl¤¸a¤ Ÿ ◊ çr¤r˘fta Ÿ f¤˝¤—– ¤ ¤¬f-a a ◊r ¤¤-¤r ◊f¤ a a¤ ¤rt¤„ ◊˜+ ·º+ I am equally present in all beings; there is none hateful or dear to Me. They, however, who devoutly worship Me abide in Me; and I too stand revealed to them. (29) •f¤ ¤-‚Œ⁄ r¤r⁄ r ¤¬a ◊r◊Ÿ-¤¤r∑˜– ‚rœ⁄ fl ‚ ◊-a√¤— ‚r¤ª√¤flf‚ar f„ ‚—+ -«+ Even if the vilest sinner worships Me with exclusive devotion, he should be regarded a saint; for, he has rightly resolved. (He is positive in his belief that there is nothing like devoted worship of God). (30) fˇr¤˝ ¤flfa œ◊r-◊r ‡r‡fl-ø rf-a fŸn-ø fa– ∑ı-a¤ ¤˝fa¬rŸtf„ Ÿ ◊ ¤+— ¤˝¢r‡¤fa+ -{+ Speedily he becomes virtuous and attains abiding peace. Know it for certain, Arjuna, that My devotee never suffers degradation. (31) Text 28ó31] Bhagavadg∂tå 114 ◊r f„ ¤r¤ √¤¤rf>r-¤ ¤˘f¤ t¤— ¤r¤¤rŸ¤—– ft·r¤r fl‡¤rta¤r ‡r¸¢˝rta˘f¤ ¤rf-a ¤⁄ r nfa◊˜+ -·+ Arjuna, women, Vai‹yas (members of the trading and agriculturist classes), ›µudras (those belonging to the labour and artisan classes), as well as those of impious birth (such as the pariah), whoever they may be, taking refuge in Me, they too attain the supreme goal. (32) f∑ ¤Ÿ’˝rzr¢rr— ¤¢¤r ¤+r ⁄ r¬¤¤ta¤r– •fŸ-¤◊‚π ‹r∑f◊◊ ¤˝rt¤ ¤¬tfl ◊r◊˜+ --+ How much more, then, if they be holy Bråhmaƒas and royal sages devoted to Me! Therefore, having obtained this joyless and transient human life, constantly worship Me. (33) ◊-◊Ÿr ¤fl ◊Ç+r ◊ur¬t ◊r Ÿ◊t∑=– ◊r◊flr¤f‚ ¤¤-flfl◊r-◊rŸ ◊-¤⁄ r¤¢r—+ -×+ Fix your mind on Me, be devoted to Me, worship Me and make obeisance to Me; thus linking yourself with Me and entirely depending on Me, you shall come to Me. ⁄ i¤lfl¤i⁄ i¤ ªn ¤iªi Ÿi◊ Ÿfl◊i˘·¤i¤—+ º+ Thus, in the Upani¶ad sung by the Lord, the Science of Brahma, the scripture of Yoga, the dialogue between ›r∂ K涃a and Arjuna, ends the ninth chapter entitled ìThe Yoga of Sovereign Science and the Sovereign Secret.î Z Bhagavadg∂tå [Ch. 9 Chapter X üÊË÷ªflÊŸÈ flÊø ¤¸¤ ∞fl ◊„ r’r„ r n¢r ◊ ¤⁄ ◊ fl¤—– ¤-r˘„ ¤˝t¤◊r¢rr¤ flˇ¤rf◊ f„ a∑rr¤¤r+ {+ ›r∂ Bhagavån said : Arjuna, hear once again My supreme word, which I shall speak to you, who are so loving, out of solicitude for your welfare. (1) Ÿ ◊ fflŒ— ‚⁄ n¢rr— ¤˝¤fl Ÿ ◊„ ¤¤—– •„ ◊rfŒf„ ŒflrŸr ◊„ ¤t¢rr ¤ ‚fl‡r—+ ·+ Neither gods nor the great sages know the secret of My birth (i.e., My appearance in human or other garb out of mere sport); for I am the prime cause in all respects of gods as well as of the great seers. (2) ¤r ◊r◊¬◊ŸrfŒ ¤ flf-r ‹r∑◊„ ‡fl⁄ ◊˜– •‚r◊¸… — ‚ ◊-¤¤ ‚fl¤r¤— ¤˝◊-¤a+ -+ He who knows Me in reality as unborn and without beginning, and as the supreme Lord of the Universe, he, undeluded among men, is purged of all sins. (3) ’fq-rrŸ◊‚r◊r„ — ˇr◊r ‚-¤ Œ◊— ‡r◊—– ‚π Œ—π ¤flr˘¤rflr ¤¤ ¤r¤¤◊fl ¤+ ×+ 116 •f„ ‚r ‚◊ar afr≈ ta¤r ŒrŸ ¤‡rr˘¤‡r—– ¤flf-a ¤rflr ¤¸arŸr ◊-r ∞fl ¤¤fªflœr—+ ~+ Reason, right knowledge, unclouded under- standing, forbearance, veracity, control over the senses and mind, joy and sorrow, evolution and dissolution, fear and fearlessness, non-violence, equanimity, contentment, austerity, charity, fame and obloquyóthese diverse traits of creatures emanate from Me alone. (4-5) ◊„ ¤¤— ‚ta ¤¸fl ¤-flr⁄ r ◊Ÿflta¤r– ◊Çrflr ◊rŸ‚r ¬rar ¤¤r ‹r∑ ;◊r— ¤˝¬r—+ . (6) ∞ar ffl¤¸fa ¤rn ¤ ◊◊ ¤r flf-r a-fla—– ‚r˘ffl∑r¤Ÿ ¤rnŸ ¤º¤a Ÿr·r ‚‡r¤—+ ¬+ He who knows in reality this supreme divine glory and supernatural power of Mine gets established in Me through unfaltering devotion; of this there is no doubt. (7) •„ ‚flt¤ ¤˝¤flr ◊-r— ‚fl ¤˝flaa– ;fa ◊-flr ¤¬-a ◊r ’œr ¤rfl‚◊f-flar—+ c+ I am the source of all creation and everything in the world moves because of Me; knowing thus, the wise, full of devotion, constantly worship Me. (8) Bhagavadg∂tå [Ch. 10 117 ◊f¤r-rr ◊Œ˜na¤˝r¢rr ’rœ¤-a— ¤⁄ t¤⁄ ◊˜– ∑¤¤-a‡¤ ◊r fŸ-¤ ar¤f-a ¤ ⁄ ◊f-a ¤+ º + With their minds fixed on Me, and their lives surrendered to Me, conversing and enlightening one another about My glories, My devotees ever remain contented and take delight in Me. (9) a¤r ‚aa¤+rŸr ¤¬ar ¤˝tfa¤¸fl∑◊˜– ŒŒrf◊ ’fq¤rn a ¤Ÿ ◊r◊¤¤rf-a a+ {«+ On those ever united through meditation with Me and worshipping Me with love, I confer that Yoga of wisdom through which they come to Me. (10) a¤r◊flrŸ∑r¤r¤◊„ ◊-rrŸ¬ a◊—– Ÿr‡r¤rr¤r-◊¤rflt¤r -rrŸŒt¤Ÿ ¤rtflar+ {{+ In order to bestow My compassion on them, I, dwelling in their hearts, dispel their darkness born of ignorance by the illuminating lamp of knowledge. (11) •¡È¸Ÿ © flÊø ¤⁄ ’˝zr ¤⁄ œr◊ ¤ffl·r ¤⁄ ◊ ¤flrŸ˜– ¤=¤ ‡rr‡fla fŒ√¤◊rfŒŒfl◊¬ ffl¤◊˜+ {·+ •r„ t-flr◊¤¤— ‚fl Œflf¤Ÿr⁄ Œta¤r– •f‚ar Œfl‹r √¤r‚— tfl¤ ¤fl ’˝fltf¤ ◊+ {-+ Arjuna said : You are the transcendent Eternal, the supreme Abode and the greatest purifier; all the seers speak of You as the eternal divine Puru¶a, the primal Deity, unborn and all-pervading. Text 9ó13] Bhagavadg∂tå 118 Likewise speak the celestial sage Nårada, the sages Asita and Devala and the great sage Vyåsa; and Yourself too proclaim this to me. (12-13) ‚fl◊aŒa ◊-¤ ¤-◊r flŒf‚ ∑‡rfl– Ÿ f„ a ¤nfl-√¤f+ fflŒŒflr Ÿ ŒrŸflr—+ {×+ K涃a, I believe as true all that You tell me. Lord, neither demons nor gods are aware of Your manifestations. (14) tfl¤◊flr-◊Ÿr-◊rŸ fl-¤ -fl ¤=¤r-r◊– ¤¸a¤rflŸ ¤¸a‡r ŒflŒfl ¬n-¤a+ {~+ O Creator of beings, O Ruler of creatures, god of gods, the Lord of the universe, O supreme Puru¶a, You alone know what You are by Yourself. (15) fl+◊„ t¤‡r¤¢r fŒ√¤r nr-◊ffl¤¸a¤—– ¤rf¤ffl¤¸faf¤‹r∑rfŸ◊rt-fl √¤rt¤ far∆ f‚+ {º+ Therefore, You alone can describe in full Your divine glories, whereby You pervade all these worlds. (16) ∑¤ fflur◊„ ¤rfnt-flr ‚Œr ¤f⁄ f¤-a¤Ÿ˜– ∑¤ ∑¤ ¤ ¤rfl¤ f¤--¤r˘f‚ ¤nfl-◊¤r+ {¬+ O Master of Yoga, through what process of continuous meditation shall I know You? And in what particular forms, O Lord, are You to be meditated upon by me? (17) fflta⁄ ¢rr-◊Ÿr ¤rn ffl¤¸fa ¤ ¬ŸrŒŸ– ¤¸¤— ∑¤¤ aftaf„ n¢flar Ÿrfta ◊˘◊a◊˜+ {c+ Bhagavadg∂tå [Ch. 10 119 K涃a, tell me once more in detail Your power of Yoga and Your glory; for I know no satiety in hearing Your nectar-like words. (18) üÊË÷ªflÊŸÈ flÊø „ -a a ∑¤f¤r¤rf◊ fŒ√¤r nr-◊ffl¤¸a¤—– ¤˝rœr-¤a— ∑=>rr∆ Ÿrt-¤-ar fflta⁄ t¤ ◊+ {º+ ›r∂ Bhagavån said : Arjuna, now I shall tell you My prominent divine glories; for there is no limit to My manifestations. (19) •„ ◊r-◊r nz r∑‡r ‚fl¤¸ar‡r¤ft¤a—– •„ ◊rfŒ‡¤ ◊·¤ ¤ ¤¸arŸr◊-a ∞fl ¤+ ·«+ Arjuna, I am the universal Self seated in the hearts of all beings; so, I alone am the beginning, the middle and also the end of all beings. (20) •rfŒ-¤rŸr◊„ fflr¢rº¤rfa¤r ⁄ ffl⁄ ‡r◊rŸ˜– ◊⁄ tf¤◊=ar◊ft◊ Ÿˇr·rr¢rr◊„ ‡r‡rt+ ·{+ I am Vi¶ƒu among the twelve sons of Aditi, and the radiant sun among the luminaries; I am the glow of the Maruts (the forty-nine wind-gods), and the moon the lord of the stars. (21) flŒrŸr ‚r◊flŒr˘ft◊ ŒflrŸr◊ft◊ flr‚fl—– ;f-¢˝¤r¢rr ◊Ÿ‡¤rft◊ ¤¸arŸr◊ft◊ ¤aŸr+ ··+ Among the Vedas, I am the Såmaveda; among the gods, I am Indra. Among the organs of perception i.e., senses, I am the mind; and I am the consciousness (life-energy) in living beings. (22) Text 19ó22] Bhagavadg∂tå 120 =¢˝r¢rr ‡r¿ ⁄ ‡¤rft◊ ffl-r‡rr ¤ˇr⁄ ˇr‚r◊˜– fl‚¸Ÿr ¤rfl∑‡¤rft◊ ◊=— f‡rπf⁄ ¢rr◊„ ◊˜+ ·-+ Among the eleven Rudras (gods of destruction), I am ›iva; and among the Yak¶as and Råk¶asas, I am the lord of riches (Kubera). Among the eight Vasus, I am the god of fire; and among the mountains, I am the Meru. (23) ¤⁄ rœ‚r ¤ ◊=¤ ◊r fflfq ¤r¤ ’„ t¤fa◊˜– ‚ŸrŸtŸr◊„ t∑-Œ— ‚⁄ ‚r◊ft◊ ‚rn⁄ —+ ·×+ Among the priests, Arjuna, know Me to be their chief, Bæhaspati. Among warrior-chiefs, I am Skanda (the generalissimo of the gods); and among the reservoirs of water, I am the ocean. (24) ◊„ ¤t¢rr ¤n⁄ „ fn⁄ r◊tr¤∑◊ˇr⁄ ◊˜– ¤-rrŸr ¬¤¤-rr˘ft◊ t¤rfl⁄ r¢rr f„ ◊r‹¤—+ ·~+ Among the great seers, I am Bhægu; among words, I am the sacred syllable OÀ, among sacrifices, I am the sacrifice of Japa (muttering of sacred formulas); and among the immovables, the Himålayas. (25) •‡fl-¤— ‚flflˇrr¢rr Œfl¤t¢rr ¤ Ÿr⁄ Œ—– n-œflr¢rr f¤·r⁄ ¤— f‚qrŸr ∑f¤‹r ◊fŸ—+ ·º+ Among all trees, I am the A‹vattha (the holy fig tree); among the celestial sages, Nårada; among the Gandharvas (celestial musicians), Citraratha, and among the Siddhas, I am the sage Kapila. (26) s ¤r—>rfl‚◊‡flrŸr fflfq ◊r◊◊arÇfl◊˜– ∞⁄ rfla n¬-¢˝r¢rr Ÿ⁄ r¢rr ¤ Ÿ⁄ rfœ¤◊˜+ ·¬+ Bhagavadg∂tå [Ch. 10 121 Among horses, know me to be the celestial horse Uccai¨‹ravå, begotten of the churning of the ocean along with nectar; among mighty elephants, Airåvata (Indraís elephant); and among men, the king.(27) •r¤œrŸr◊„ flºr˝ œŸ¸Ÿr◊ft◊ ∑r◊œ∑˜– ¤˝¬Ÿ‡¤rft◊ ∑-Œ¤— ‚¤r¢rr◊ft◊ flr‚f∑—+ ·c+ Among weapons, I am the thunderbolt; among cows, I am the celestial cow Kåmadhenu (the cow of plenty). I am the sexual desire which leads to procreation (as enjoined by the scriptures); among serpents I am Våsuki. (28) •Ÿ-a‡¤rft◊ ŸrnrŸr fl=¢rr ¤rŒ‚r◊„ ◊˜– f¤a ¢rr◊¤◊r ¤rft◊ ¤◊— ‚¤◊ar◊„ ◊˜+ ·º+ Among Någas (a special class of serpents), I am the serpent-god Ananta; and I am Varuƒa, the lord of aquatic creatures. Among the manes, I am Aryamå (the head of the Pitæs); and among rulers, I am Yama (the god of death). (29) ¤˝ç rŒ‡¤rft◊ Œ-¤rŸr ∑r‹— ∑‹¤ar◊„ ◊˜– ◊nr¢rr ¤ ◊n-¢˝r˘„ flŸa¤‡¤ ¤fˇr¢rr◊˜+ -«+ Among the Daityas, I am the great devotee Prahlåda; and of calculators, I am Time; among quadrupeds, I am the lion; and among birds, I am GaruŒa. (30) ¤flŸ— ¤flar◊ft◊ ⁄ r◊— ‡rt·r¤ar◊„ ◊˜– ;r¤r¢rr ◊∑⁄ ‡¤rft◊ nra‚r◊ft◊ ¬rrŸflt+ -{+ Among purifiers, I am the wind; among warriors, I am ›r∂ Råma. Among fishes, I am the shark; and among streams, I am the Ganges. (31) Text 28ó31] Bhagavadg∂tå 122 ‚nr¢rr◊rfŒ⁄ -a‡¤ ◊·¤ ¤flr„ ◊¬Ÿ– •·¤r-◊fflur fflurŸr flrŒ— ¤˝flŒar◊„ ◊˜+ -·+ Arjuna, I am the beginning, the middle and the end of all creations. Of all knowledge, I am the knowledge of the soul, (metaphysics); among disputants, I am the right type of reasoning. (32) •ˇr⁄ r¢rr◊∑r⁄ r˘ft◊ ç-ç— ‚r◊rf‚∑t¤ ¤– •„ ◊flrˇr¤— ∑r‹r œrar„ ffl‡flar◊π—+ --+ Among the sounds represented by the various letters, I am ëAí (the sound represented by the first letter of the alphabet); of the different kinds of compounds in grammar, I am the copulative compound. I am verily the endless Time (the devourer of Time, God); I am the sustainer of all, having My face on all sides. (33) ◊-¤— ‚fl„ ⁄ ‡¤r„ ◊Çfl‡¤ ¤fflr¤ar◊˜– ∑tfa— >rtflr¤¤ Ÿr⁄ t¢rr t◊fa◊œr œfa— ˇr◊r+ -×+ I am the all-destroying Death that annihilates all, and the origin of all that are to be born. Of feminities, I am K∂rti, ›r∂,Våk, Smæti, Medhå, Dhæti and K¶amå (the goddesses presiding over glory, prosperity, speech, memory, intelligence, endurance and forbearance, respectively). (34) ’„ -‚r◊ a¤r ‚rrŸr nr¤·rt ø -Œ‚r◊„ ◊˜– ◊r‚rŸr ◊rn‡rt¤r˘„ ◊a¸Ÿr ∑‚◊r∑⁄ —+ -~+ Bhagavadg∂tå [Ch. 10 123 Likewise, among the ›rutis that can be sung, I am the variety known as Bæhatsåma; while among the Vedic hymns, I am the hymn known as Gåyatr∂. Again, among the twelve months of the Hindu calendar, I am the month known as ëMårga‹∂r¶aí (corres- ponding approximately to November December); and among the six seasons (successively appearing in India in the course of a year) I am the spring season.(35) u¸a ø ‹¤ar◊ft◊ a¬ta¬ftflŸr◊„ ◊˜– ¬¤r˘ft◊ √¤fl‚r¤r˘ft◊ ‚-fl ‚-flflar◊„ ◊˜+ -º+ I am gambling among deceitful practices, and the glory of the glorious. I am the victory of the victorious, the resolve of the resolute, the goodness of the good. (36) flr¢rtŸr flr‚Œflr˘ft◊ ¤r¢z flrŸr œŸ=¬¤—– ◊ŸtŸr◊t¤„ √¤r‚— ∑fltŸr◊‡rŸr ∑ffl—+ -¬+ I am K涃a among the V涃is, Arjuna among the sons of P僌u, Vyåsa among the sages, and the sage ›ukråcårya among the wise. (37) Œ¢z r Œ◊¤ar◊ft◊ Ÿtfa⁄ ft◊ f¬nt¤ar◊˜– ◊rŸ ¤flrft◊ nnrŸr -rrŸ -rrŸflar◊„ ◊˜+ -c+ I am the subduing power of rulers; I am righteousness in those who seek to conquer. Of things to be kept secret, I am the custodian in the shape of reticence; and I am the wisdom of the wise. (38) ¤¤rrf¤ ‚fl¤¸arŸr ’t¬ aŒ„ ◊¬Ÿ– Ÿ aŒfta fflŸr ¤-t¤r-◊¤r ¤¸a ¤⁄ r¤⁄ ◊˜+ -º+ Text 36ó39] Bhagavadg∂tå 124 Arjuna, I am even that, which is the seed of all life. For there is no creature, moving or unmoving, which can exist without Me. (39) Ÿr-ar˘fta ◊◊ fŒ√¤rŸr ffl¤¸atŸr ¤⁄ -a¤– ∞¤ a¸z‡ra— ¤˝r+r ffl¤¸afflta⁄ r ◊¤r+ ׫+ Arjuna, there is no limit to My divine manifestations. This is only a brief description by Me of the extent of My glory. (40) ¤uf礸fa◊-‚-fl >rt◊Œ¸f¬a◊fl flr– a-rŒflrfln-ø -fl ◊◊ a¬r˘‡r‚r¤fl◊˜+ ×{+ Every such being as is glorious, brilliant and powerful, know that to be a part manifestation of My glory. (41) •¤flr ’„ ŸaŸ f∑ -rraŸ aflr¬Ÿ– fflr≈ +¤r„ f◊Œ ∑-tŸ◊∑r‡rŸ ft¤ar ¬na˜+ ×·+ Or, what will you gain by knowing all this in detail, Arjuna? Suffice it to say that I hold this entire universe by a fraction of My Yogic Power. =¸l-¤iªi Ÿi◊ Œ‡i◊i˘·¤i¤—+ ··+ Thus, in the Upani¶ad sung by the Lord, the Science of Brahma, the scripture of Yoga, the dialogue between ›r∂ K涃a and Arjuna, ends the tenth chapter entitled ìThe Yoga of Divine Glories.î Z Bhagavadg∂tå [Ch. 10 Chapter XI •¡È¸Ÿ © flÊø ◊ŒŸn˝„ r¤ ¤⁄ ◊ nn◊·¤r-◊‚f=-ra◊˜– ¤-fl¤r+ fl¤taŸ ◊r„ r˘¤ fflnar ◊◊+ {+ Arjuna said : Thanks to the most profound words of spiritual wisdom that You have spoken out of kindness to me, this delusion of mine has entirely disappeared. (1) ¤flrt¤¤ı f„ ¤¸arŸr >raı fflta⁄ ‡rr ◊¤r– -fl-r— ∑◊‹¤·rrˇr ◊r„ r-r¤◊f¤ ¤r√¤¤◊˜+ ·+ For, K涃a, I have heard from You in detail an account of the evolution and dissolution of beings, and also Your immortal glory. (2) ∞fl◊au¤r-¤ -fl◊r-◊rŸ ¤⁄ ◊‡fl⁄ – ¢˝r≈ f◊-ø rf◊ a =¤◊‡fl⁄ ¤=¤r-r◊+ -+ Lord, You are precisely what You declare Yourself to be. But I long to see Your divine form possessed of wisdom, glory, energy, strength, valour and effulgence, O Puru¶ottama, the Supreme Being! (3) ◊-¤‚ ¤fŒ a-ø ¤¤ ◊¤r ¢˝r≈ f◊fa ¤˝¤r– ¤rn‡fl⁄ aar ◊ -fl Œ‡r¤r-◊rŸ◊√¤¤◊˜+ ×+ K涃a, if You think that it can be seen by me, 126 then, O Lord of Yoga, reveal to me Your imperishable form. (4) üÊË÷ªflÊŸÈ flÊø ¤‡¤ ◊ ¤r¤ =¤rf¢r ‡ra‡rr˘¤ ‚„ n‡r—– ŸrŸrfflœrfŸ fŒ√¤rfŸ ŸrŸrfl¢rr∑atfŸ ¤+ ~+ ›r∂ Bhagavån said: Arjuna, behold My manifold, multifarious divine forms of various colours and shapes, in their hundreds and thousands. (5) ¤‡¤rfŒ-¤r-fl‚¸-=¢˝rŸf‡flŸr ◊=ata¤r– ’„¸ -¤Œr≈ ¤¸flrf¢r ¤‡¤r‡¤¤rf¢r ¤r⁄ a+ º+ Behold in Me, Arjuna, the twelve sons of Aditi, the eight Vasus, the eleven Rudras (gods of destruction), the two A‹vin∂kumåras (the twin-born physicians of gods) and the forty-nine Maruts (wind-gods), and witness many more wonderful forms never seen before. (6) ;„ ∑t¤ ¬n-∑-tŸ ¤‡¤ru ‚¤⁄ r¤⁄ ◊˜– ◊◊ Œ„ nz r∑‡r ¤¤rr-¤Œ˜¢˝r≈ f◊-ø f‚+ ¬+ Arjuna, behold as concentrated within this body of Mine the entire creation consisting of both animate and inanimate beings, and whatever else you desire to see. (7) Ÿ a ◊r ‡r¤¤‚ ¢˝r≈ ◊ŸŸfl tfl¤ˇr¤r– fŒ√¤ ŒŒrf◊ a ¤ˇr— ¤‡¤ ◊ ¤rn◊‡fl⁄ ◊˜+ c+ But surely you cannot see Me with these human eyes of yours; therefore, I vouchsafe to you the Bhagavadg∂tå [Ch. 11 127 divine eye. With this you behold My divine power of Yoga. (8) ‚Ü¡ÿ © flÊø ∞fl◊¤-flr aar ⁄ r¬-◊„ r¤rn‡fl⁄ r „ f⁄ —– Œ‡r¤r◊r‚ ¤r¤r¤ ¤⁄ ◊ =¤◊‡fl⁄ ◊˜+ º + Sa¤jaya said : My lord! having spoken thus, ›r∂ K涃a, the supreme Master of Yoga, forthwith revealed to Arjuna His supremely glorious divine Form. (9) •Ÿ∑fl¤·rŸ¤Ÿ◊Ÿ∑rÇaŒ‡rŸ◊˜ – •Ÿ∑fŒ√¤r¤⁄ ¢r fŒ√¤rŸ∑ruar¤œ◊˜+ {«+ fŒ√¤◊rr¤rr’⁄ œ⁄ fŒ√¤n-œrŸ‹¤Ÿ◊˜– ‚flr‡¤¤◊¤ Œfl◊Ÿ-a ffl‡flar◊π◊˜+ {{+ Arjuna saw the supreme Deity possessing many mouths and eyes, presenting many a wonderful sight, decked with many divine ornaments, wielding many uplifted divine weapons, wearing divine garlands and vestments, anointed all over with divine sandal-pastes, full of all wonders, infinite and having faces on all sides. (10-11) fŒffl ‚¸¤‚„ nt¤ ¤flun¤Œf-¤ar– ¤fŒ ¤r— ‚Œ‡rt ‚r t¤rÇr‚tat¤ ◊„ r-◊Ÿ—+ {·+ If there be the effulgence of a thousand suns bursting forth all at once in the heavens, even that would hardly approach the splendour of the mighty Lord. (12) Text 9ó12] Bhagavadg∂tå 128 a·r∑t¤ ¬n-∑-tŸ ¤˝ffl¤+◊Ÿ∑œr– •¤‡¤zflŒflt¤ ‡r⁄ t⁄ ¤r¢z fltaŒr+ {-+ Concentrated at one place in the person of that supreme Deity, Arjuna then beheld the whole universe with its manifold divisions. (13) aa— ‚ fflt◊¤rfflr≈ r z r≈ ⁄ r◊r œŸ=¬¤—– ¤˝¢rr¤ f‡r⁄ ‚r Œfl ∑ar=¬f‹⁄ ¤r¤a+ {×+ Then Arjuna, full of wonder and with the hair standing on end, reverentially bowed his head to the divine Lord, and with joined palms addressed Him thus. (14) •¡È¸Ÿ © flÊø ¤‡¤rf◊ Œflrtafl Œfl Œ„ ‚flrta¤r ¤¸affl‡r¤‚g rŸ˜– ’˝zrr¢r◊t‡r ∑◊‹r‚Ÿt¤- ◊¤t‡¤ ‚flrŸ⁄ nr‡¤ fŒ√¤rŸ˜+ {~+ Arjuna said : Lord, I behold within your body all gods and hosts of different beings, Brahmå throned on his lotus-seat, ›iva and all §R¶is and celestial serpents. (15) •Ÿ∑’r„¸ Œ⁄ fl¤·rŸ·r- ¤‡¤rf◊ -flr ‚flar˘Ÿ-a=¤◊ ˜– Ÿr-a Ÿ ◊·¤ Ÿ ¤ŸtaflrfŒ- ¤‡¤rf◊ ffl‡fl‡fl⁄ ffl‡fl=¤+ {º+ O Lord of the universe, I see you endowed with numerous arms, bellies, mouths, and eyes Bhagavadg∂tå [Ch. 11 129 and having innumerable forms extended on all sides. I see neither your beginning nor middle, nor even your end, manifested as you are in the form of the universe. (16) f∑⁄ tf≈ Ÿ nfŒŸ ¤f∑˝¢r ¤ a¬r⁄ rf‡r ‚flar Œtfta◊-a◊˜– ¤‡¤rf◊ -flr ŒfŸ⁄ tˇ¤ ‚◊-ar- zttarŸ‹r∑ufa◊¤˝◊¤◊˜ + {¬+ I see you endowed with diadem, club and discus, a mass of splendour glowing all round, having the brilliance of a blazing fire and the sun, hard to gaze at and immeasurable on all sides. (17) -fl◊ˇr⁄ ¤⁄ ◊ flfŒa√¤- -fl◊t¤ ffl‡flt¤ ¤⁄ fŸœrŸ◊˜– -fl◊√¤¤— ‡rr‡flaœ◊nrtar ‚ŸraŸt-fl ¤=¤r ◊ar ◊+ {c+ You are the supreme indestructible worthy of being known; you are the ultimate refuge of this universe. You are, again, the protector of the ageless Dharma; I consider You to be the eternal imperishable Being. (18) •ŸrfŒ◊·¤r-a◊Ÿ-aflt¤- ◊Ÿ-a’r„ ‡rf‡r‚¸¤Ÿ·r◊˜– ¤‡¤rf◊ -flr Œtta„ ar‡rfl¤·r- tfla¬‚r ffl‡flf◊Œ a¤-a◊˜+ {º+ Text 17ó19] Bhagavadg∂tå 130 I see You without beginning, middle or end, possessing unlimited prowess and endowed with numberless arms, having the moon and the sun for Your eyes, and blazing fire for Your mouth, and scorching this universe by Your radiance. (19) urflr¤f¤√¤rf⁄ Œ◊-a⁄ f„ √¤rta -fl¤∑Ÿ fŒ‡r‡¤ ‚flr—– Œr≈˜ flrÇa =¤◊n˝ aflŒ ‹r∑·r¤ ¤˝√¤f¤a ◊„ r-◊Ÿ˜+ ·«+ Yonder space between heaven and earth and all the quarters are entirely filled by You alone. Seeing this transcendent, dreadful Form of Yours, O Soul of the universe, all the three worlds feel greatly alarmed. (20) •◊t f„ -flr ‚⁄ ‚g r ffl‡rf-a ∑f¤Çtar— ¤˝r=¬‹¤r n¢rf-a– tfltat-¤¤-flr ◊„ f¤f‚q‚g r— taflf-a -flr tafaf¤— ¤r∑‹rf¤—+ ·{+ Yonder hosts of gods are entering You; some with palms joined out of fear are recounting Your names and glories. Multitudes of Mahar¶is and Siddhas, saying ëLet there be peaceí, are extolling You by means of excellent hymns. (21) =¢˝rfŒ-¤r fl‚flr ¤ ¤ ‚r·¤r ffl‡fl˘f‡flŸr ◊=a‡¤rr◊¤r‡¤– Bhagavadg∂tå [Ch. 11 131 n-œfl¤ˇrr‚⁄ f‚q‚g r- fltˇr-a -flr fflft◊ar‡¤fl ‚fl+ ··+ The eleven Rudras, twelve Ådityas and eight Vasus, the Sådhyas and Vi‹vedevas, the two A‹vin∂kumåras and forty-nine Maruts, as well as the manes and multitudes of Gandharvas, Yak¶as, Asuras and Siddhas, all these gaze upon You in amazement. (22) =¤ ◊„ -r ’„ fl¤·rŸ·r- ◊„ r’r„ r ’„ ’r„¸ =¤rŒ◊˜– ’„¸ Œ⁄ ’„ Œr≈˛ r∑⁄ r‹- Œr≈˜ flr ‹r∑r— ¤˝√¤f¤arta¤r„ ◊˜+ ·-+ Lord, seeing this stupendous and dreadful Form of Yours, possessing numerous mouths and eyes, many arms, thighs and feet, many bellies and many teeth, the worlds are terror-struck; so am I. (23) Ÿ¤—t¤‡r Œtta◊Ÿ∑fl¢r- √¤r-rrŸŸ Œttaffl‡rr‹Ÿ·r◊˜– Œr≈˜ flr f„ -flr ¤˝√¤f¤ar-a⁄ r-◊r œfa Ÿ ffl-Œrf◊ ‡r◊ ¤ fflr¢rr+ ·×+ Lord, seeing Your Form reaching the heavens, effulgent multi-coloured, having its mouth wide open and possessing large flaming eyes, I, with my inmost self frightened, have lost self-control and find no peace. (24) Œr≈˛ r∑⁄ r‹rfŸ ¤ a ◊πrfŸ Œr≈ ˜flfl ∑r‹rŸ‹‚f-Ÿ¤rfŸ– Text 22ó24] Bhagavadg∂tå 132 fŒ‡rr Ÿ ¬rŸ Ÿ ‹¤ ¤ ‡r◊ ¤˝‚tŒ Œfl‡r ¬nf-Ÿflr‚+ ·~+ Seeing Your faces frightful on account of their teeth, and blazing like the fire at the time of universal destruction, I am utterly bewildered and find no happiness; therefore, have mercy on me, O Lord of celestials! O Abode of the universe! (25) •◊t ¤ -flr œa⁄ rr≈˛ t¤ ¤·rr— ‚fl ‚„ flrflfŸ¤r‹‚g —– ¤tr◊r ¢˝r¢r— ‚¸a¤·rta¤r‚r ‚„ rt◊Œt¤⁄ f¤ ¤rœ◊=¤—+ ·º+ fl¤·rrf¢r a -fl⁄ ◊r¢rr ffl‡rf-a Œr≈˛ r∑⁄ r‹rfŸ ¤¤rŸ∑rfŸ– ∑f¤f狪Ÿr Œ‡rŸr-a⁄ ¤ ‚-Œ‡¤-a ¤¸f¢ra=-r◊ry —+ ·¬+ All those sons of Dhætarå¶¢ra with hosts of kings are entering You. Bh∂¶ma, Droƒa and yonder Karƒa, with the principal warriors on our side as well, are rushing headlong into Your fearful mouths looking all the more terrible on account of their teeth; some are seen stuck up in the gaps between Your teeth with their heads crushed. (26-27) ¤¤r ŸŒtŸr ’„ flr˘r’flnr— ‚◊¢˝◊flrf¤◊πr ¢˝flf-a– a¤r aflr◊t Ÿ⁄ ‹r∑flt⁄ r- ffl‡rf-a fl¤·rr¢¤f¤fflºfl‹f-a+ ·c+ Bhagavadg∂tå [Ch. 11 133 As the myriad streams of rivers rush towards the sea alone, so do those warriors of the mortal world enter Your flaming mouths. (28) ¤¤r ¤˝Œtta ºfl‹Ÿ ¤ay r- ffl‡rf-a Ÿr‡rr¤ ‚◊qflnr—– a¤fl Ÿr‡rr¤ ffl‡rf-a ‹r∑r- taflrf¤ fl¤·rrf¢r ‚◊qflnr—+ ·º+ As moths rush with great speed into the blazing fire for extinction out of ëMohaí, even so, all these people are with great rapidity entering Your mouths to meet their doom. (29) ‹f‹n‚ n˝‚◊rŸ— ‚◊-ar- r ‹r∑r-‚◊n˝r-flŒŸºfl‹fÇ— – a¬rf¤⁄ r¤¸¤ ¬n-‚◊n˝- ¤r‚taflrn˝r— ¤˝a¤f-a fflr¢rr+ -«+ Devouring all the worlds through Your flaming mouths and licking them on all sides, O Lord Vi¶ƒu! Your fiery rays fill the whole universe with their fierce radiance and are burning it. (30) •r=¤rf„ ◊ ∑r ¤flrŸn˝=¤r- Ÿ◊r˘ta a Œflfl⁄ ¤˝‚tŒ– ffl-rraf◊-ø rf◊ ¤fl-a◊ru- Ÿ f„ ¤˝¬rŸrf◊ afl ¤˝flf-r◊˜+ -{+ Tell me who You are with a form so terrible? My obeisance to You, O best of gods; be kind to me. I wish to know You, the Primal Being, in particular; for I know not Your purpose. (31) Text 29ó31] Bhagavadg∂tå 134 üÊË÷ªflÊŸÈ flÊø ∑r‹r˘ft◊ ‹r∑ˇr¤∑-¤˝flqr- ‹r∑r-‚◊r„ af◊„ ¤˝fl-r—– =a˘f¤ -flr Ÿ ¤fflr¤f-a ‚fl ¤˘flft¤ar— ¤˝-¤Ÿt∑¤ ¤rœr—+ -·+ ›r∂ Bhagavån said : I am mighty Kåla (the eternal Time-spirit), the destroyer of the worlds. I am out to exterminate these people. Even without you all those warriors, arrayed in the enemyís camp, shall die. (32) at◊r-fl◊f-rr∆ ¤‡rr ‹¤tfl f¬-flr ‡r·r¸-¤z˜ ˇfl ⁄ rº¤ ‚◊q◊ ˜– ◊¤fla fŸ„ ar— ¤¸fl◊fl fŸf◊-r◊r·r ¤fl ‚√¤‚rf¤Ÿ˜+ --+ Therefore, do you arise and win glory; conquering foes, enjoy the affluent kingdom. These warriors stand already slain by Me; be you only an instrument, Arjuna. (33) ¢˝r¢r ¤ ¤tr◊ ¤ ¬¤¢˝¤ ¤ ∑¢r a¤r-¤rŸf¤ ¤rœflt⁄ rŸ˜– ◊¤r „ art-fl ¬f„ ◊r √¤f¤r∆ r- ¤·¤tfl ¬arf‚ ⁄ ¢r ‚¤-ŸrŸ˜+ -×+ Do kill Droƒa and Bh∂¶ma and Jayadratha and Karƒa and other brave warriors, who already stand killed by Me; fear not. Fight and you will surely conquer the enemies in the war. (34) Bhagavadg∂tå [Ch. 11 135 ‚Ü¡ÿ © flÊø ∞a-ø˛‰ -flr fl¤Ÿ ∑‡rflt¤ ∑ar=¬f‹fl¤◊rŸ— f∑⁄ t≈ t– Ÿ◊t∑-flr ¤¸¤ ∞flr„ ∑r¢r- ‚nŒ˜nŒ ¤ta¤ta— ¤˝¢rr¤+ -~+ Sa¤jaya said : Hearing these words of Bhagavån Ke‹ava, Arjuna tremblingly bowed to Him with joined palms, and bowing again in extreme terror spoke to ›r∂ K涃a in faltering accents. (35) •¡È¸Ÿ © flÊø t¤rŸ z ¤t∑‡r afl ¤˝∑t-¤r ¬n-¤˝z r¤-¤Ÿ⁄ º¤a ¤– ⁄ ˇrrf‚ ¤tarfŸ fŒ‡rr ¢˝flf-a ‚fl Ÿ◊t¤f-a ¤ f‚q‚gr—+ -º+ Arjuna said : Lord, well it is, the universe exults and is filled with love by chanting Your names, virtues and glory; terrified Råk¶asas are fleeing in all directions, and all the hosts of Siddhas are bowing to You. (36) ∑t◊r¤r a Ÿ Ÿ◊⁄ -◊„ r-◊Ÿ˜ n⁄ t¤‚ ’˝zr¢rr˘t¤rfŒ∑·r– •Ÿ-a Œfl‡r ¬nf-Ÿflr‚ -fl◊ˇr⁄ ‚Œ‚-r-¤⁄ ¤a˜+ -¬+ O Great soul, why should they not bow to you, who are the progenitor of Brahmå himself and the greatest of the great? O infinite Lord of celestials, Abode of the universe, You are that which is Text 35ó37] Bhagavadg∂tå 136 existent (Sat), that which is non-existent (Asat) and also that which is beyond both, viz., the indestructible Brahma. (37) -fl◊rfŒŒfl— ¤=¤— ¤⁄ r¢r- t-fl◊t¤ ffl‡flt¤ ¤⁄ fŸœrŸ◊ ˜– fl-rrf‚ flu ¤ ¤⁄ ¤ œr◊ -fl¤r aa ffl‡fl◊Ÿ-a=¤+ -c+ You are the primal Deity, the most ancient Person; You are the ultimate resort of this universe. You are both the knower and the knowable, and the highest abode. It is You who pervade the universe, O one assuming endless forms. (38) flr¤¤◊r˘fªŸfl=¢r— ‡r‡rr¿ — ¤˝¬r¤fat-fl ¤˝f¤ar◊„ ‡¤– Ÿ◊r Ÿ◊ta˘ta ‚„ n∑-fl— ¤Ÿ‡¤ ¤¸¤r˘f¤ Ÿ◊r Ÿ◊ta+ -º+ You are Våyu (the wind-god), Yama (the god of death), Agni (the god of fire), Varuƒa (the god of water), the moon-god, Brahmå (the Lord of creation), nay, the father of Brahmå himself. Hail, hail to You a thousand times; salutations, repeated salutations to You once again. (39) Ÿ◊— ¤⁄ tarŒ¤ ¤r∆ ata Ÿ◊r˘ta a ‚fla ∞fl ‚fl– •Ÿ-aflt¤rf◊affl∑˝◊t-fl- ‚fl ‚◊rtŸrf¤ aar˘f‚ ‚fl—+ ׫+ O Lord of infinite prowess, my salutations to Bhagavadg∂tå [Ch. 11 137 You from the front and from behind. O soul of all, my obeisance to You from all sides indeed. You, who possess infinite might, pervade all; therefore, You are all. (40) ‚πfa ◊-flr ¤˝‚¤ ¤Œ+- „ ∑r¢r „ ¤rŒfl „ ‚πfa– •¬rŸar ◊f„ ◊rŸ aflŒ- ◊¤r ¤˝◊rŒr-¤˝¢r¤Ÿ flrf¤+ ×{+ ¤¤rrfl„ r‚r¤◊‚-∑ar˘f‚ ffl„ r⁄ ‡rƒ¤r‚Ÿ¤r¬Ÿ¤ – ∞∑r˘¤flrt¤-¤a a-‚◊ˇr- a-ˇrr◊¤ -flr◊„ ◊¤˝◊¤◊˜+ ×·+ The way in which I have importunately called You, either through intimacy or thoughtlessly, ìHo K涃a! Ho Yådava! Ho Comrade!î and so on, unaware of the greatness of Yours, and thinking You only to be a friend, and the way in which You have been slighted by me in jest, O sinless one, while at play, reposing, sitting or at meals, either alone or even in the presence of othersó for all that, O Immeasurable Lord, I crave forgiveness from You. (41-42) f¤arf‚ ‹r∑t¤ ¤⁄ r¤⁄ t¤ -fl◊t¤ ¤¸º¤‡¤ n=n⁄ t¤rŸ˜– Ÿ -fl-‚◊r˘t-¤+¤fœ∑— ∑ar˘-¤r- ‹r∑·r¤˘t¤¤˝fa◊¤˝¤rfl + ×-+ You are the father of this moving and unmoving creation, nay, the greatest teacher worthy of Text 41ó43] Bhagavadg∂tå 138 adoration. O Lord of incomparable might, in all the three worlds there is none else even equal to You; how, then, can anyone be greater than to You? (43) at◊r-¤˝¢rr¤ ¤˝f¢rœr¤ ∑r¤- ¤˝‚rŒ¤ -flr◊„ ◊t‡r◊tzv◊˜– f¤afl ¤·rt¤ ‚πfl ‚=¤— f¤˝¤— f¤˝¤r¤r„ f‚ Œfl ‚r… ◊˜+ ××+ Therefore, Lord, prostrating my body at Your feet and bowing low I seek to propitiate You, the ruler of all and worthy of all praise. It behoves You to bear with me even as a father bears with his son, a friend with his friend and a husband with his beloved spouse. (44) •Œr≈ ¤¸fl z f¤ar˘ft◊ Œr≈˜ flr ¤¤Ÿ ¤ ¤˝√¤f¤a ◊Ÿr ◊– aŒfl ◊ Œ‡r¤ Œfl=¤- ¤˝‚tŒ Œfl‡r ¬nf-Ÿflr‚+ ×~+ Having seen Your wondrous form, which was never seen before, I feel transported with joy; at the same time my mind is tormented by fear. Pray reveal to me that divine form; the form of Vi¶ƒu with four-arms; O Lord of celestials, O Abode of the universe, be gracious. (45) f∑⁄ tf≈ Ÿ nfŒŸ ¤∑˝„ ta- f◊-ø rf◊ -flr ¢˝r≈ ◊„ a¤fl– aŸfl =¤¢r ¤a¤¬Ÿ ‚„ n’r„ r ¤fl ffl‡fl◊¸a+ ׺+ I wish to see You adorned in the same way Bhagavadg∂tå [Ch. 11 139 with a diadem on the head, and holding a mace and a discus in two of Your hands. O Lord with a thousand arms, O Universal Being, appear again in the same four-armed Form. (46) üÊË÷ªflÊŸÈ flÊø ◊¤r ¤˝‚-ŸŸ aflr¬ŸŒ- =¤ ¤⁄ Œf‡ra◊r-◊¤rnra˜– a¬r◊¤ ffl‡fl◊Ÿ-a◊ru- ¤-◊ -flŒ-¤Ÿ Ÿ Œr≈ ¤¸fl◊˜+ ׬+ ›r∂ Bhagavån said : Arjuna! pleased with you I have shown you, through My power of Yoga, this supreme, effulgent, primal and infinite Cosmic Form, which has never been seen before by anyone other than you. (47) Ÿ flŒ¤-rr·¤¤ŸŸ ŒrŸ- Ÿ ¤ f∑˝¤rf¤Ÿ a¤rf¤=n˝—– ∞fl=¤— ‡r¤¤ •„ Ÿ‹r∑ ¢˝r≈ -flŒ-¤Ÿ ∑=¤˝flt⁄ + ×c+ Arjuna, in this mortal world I cannot be seen in this Form by anyone other than you, either through the study of the Vedas or by rituals, or again through gifts, actions or austere penances.(48) ◊r a √¤¤r ◊r ¤ ffl◊¸… ¤rflr- Œr≈˜ flr =¤ rrr⁄ ◊tŒz˜ ◊◊Œ◊˜– √¤¤a¤t— ¤˝ta◊Ÿr— ¤Ÿt-fl- aŒfl ◊ =¤f◊Œ ¤˝¤‡¤+ ׺+ Seeing such a dreadful Form of Mine as this, Text 47ó49] Bhagavadg∂tå 140 do not be perturbed or perplexed; with a fearless and tranquil mind, behold once again the same four-armed Form of Mine (bearing the conch, discus, mace and lotus). (49) ‚Ü¡ÿ © flÊø ;-¤¬Ÿ flr‚Œflta¤r¤-flr tfl∑ =¤ Œ‡r¤r◊r‚ ¤¸¤—– •r‡flr‚¤r◊r‚ ¤ ¤ta◊Ÿ- ¤¸-flr ¤Ÿ— ‚rr¤fl¤◊„ r-◊r+ ~«+ Sa¤jaya said : Having spoken thus to Arjuna, Bhagavån Våsudeva again revealed to him His own four-armed Form; and then, assuming a genial form, the high-souled ›r∂ K涃a consoled the frightened Arjuna. (50) •¡È¸Ÿ © flÊø Œr≈˜ flŒ ◊rŸ¤ =¤ afl ‚rr¤ ¬ŸrŒŸ– ;ŒrŸt◊ft◊ ‚fl-r— ‚¤ar— ¤˝∑fa na—+ ~{+ Arjuna said : K涃a, seeing this gentle human form of Yours I have regained my composure and am my ownself again. (51) üÊË÷ªflÊŸÈ flÊø ‚ŒŒ‡rf◊Œ =¤ Œr≈ flrŸf‚ ¤-◊◊– Œflr •t¤t¤ =¤t¤ fŸ-¤ Œ‡rŸ∑rz˜ fˇr¢r—+ ~·+ ›r∂ Bhagavån said : This form of Mine (with four-arms) which you have just seen, is exceedingly difficult to behold. Even the gods are always eager to see this form. (52) Bhagavadg∂tå [Ch. 11 141 Ÿr„ flŒŸ a¤‚r Ÿ ŒrŸŸ Ÿ ¤º¤¤r– ‡r¤¤ ∞flfflœr ¢˝r≈ Œr≈ flrŸf‚ ◊r ¤¤r+ ~-+ Neither by study of the Vedas nor by penance, nor again by charity, nor even by rituals can I be seen in this form (with four-arms) as you have seen Me. (53) ¤¤-¤r -flŸ-¤¤r ‡r¤¤ •„ ◊flfflœr˘¬Ÿ– -rra ¢˝r≈ ¤ a-flŸ ¤˝flr≈ ¤ ¤⁄ - a¤+ ~×+ Through single-minded devotion, however, I can be seen in this form (with four-arms), nay, known in essence and even entered into, O valiant Arjuna. (54) ◊-∑◊∑-◊-¤⁄ ◊r ◊Ç+— ‚y flf¬a—– fŸfl⁄ — ‚fl¤¸a¤ ¤— ‚ ◊r◊fa ¤r¢z fl+ ~~+ Arjuna, he who performs all his duties for My sake, depends on Me, is devoted to Me, has no attachment, and is free from malice towards all beings, reaches Me. ‡flª ¤Œ‡iŸ¤iªi Ÿi◊ eleventh chapter entitled ìThe Yoga of the Vision of the Universal Form.î Text 53ó55] Bhagavadg∂tå Z Chapter XII •¡È¸Ÿ © flÊø ∞fl ‚aa¤+r ¤ ¤+rt-flr ¤¤¤r‚a– ¤ ¤rt¤ˇr⁄ ◊√¤¤a a¤r ∑ ¤rnffl-r◊r—+ {+ Arjuna said : The devotees exclusively and constantly devoted to You in the manner stated just earlier, adore You as possessed of form and attributes, and those who adore as the supreme Reality only the indestructible unmanifest Brahma (who is Truth, Knowledge and Bliss solidified)ó of these two types of worshippers who are the best knowers of Yoga? (1) üÊË÷ªflÊŸÈ flÊø ◊ƒ¤rfl‡¤ ◊Ÿr ¤ ◊r fŸ-¤¤+r s ¤r‚a– >rq¤r ¤⁄ ¤r¤arta ◊ ¤+a◊r ◊ar—+ ·+ ›r∂ Bhagavån said : I consider them to be the best Yog∂s, who endowed with supreme faith, and ever united through meditation with Me, worship Me with their mind centred on Me. (2) ¤ -flˇr⁄ ◊fŸŒ‡¤◊√¤+ ¤¤¤r‚a– ‚fl·rn◊f¤--¤ ¤ ∑¸≈ t¤◊¤‹ œ˝fl◊˜+ -+ ‚f-Ÿ¤r¤f-¢˝¤n˝r◊ ‚fl·r ‚◊’q¤—– a ¤˝rtŸflf-a ◊r◊fl ‚fl¤¸af„ a ⁄ ar—+ ×+ 143 Those, however, who fully controlling all their senses and even-minded towards all, and devoted to the welfare of all beings, constantly adore as their very self the unthinkable, omnipresent, indestructible, indefinable, eternal, immovable, unmanifest and changeless Brahma, they too come to Me. (3-4) ¤‹‡rr˘fœ∑a⁄ ta¤r◊√¤+r‚+¤a‚r◊˜ – •√¤+r f„ nfaŒ—π Œ„ flfÇ⁄ flrt¤a+ ~+ Of course, the strain is greater for those who have their mind attached to the Unmanifest, as attunement with the Unmanifest is attained with difficulty by the body-conscious people. (5) ¤ a ‚flrf¢r ∑◊rf¢r ◊f¤ ‚--¤t¤ ◊-¤⁄ r—– •Ÿ-¤Ÿfl ¤rnŸ ◊r ·¤r¤-a s ¤r‚a+ º+ a¤r◊„ ‚◊qar ◊-¤‚‚r⁄ ‚rn⁄ ra˜– ¤flrf◊ Ÿf¤⁄ r-¤r¤ ◊ƒ¤rflf‡ra¤a‚r◊˜+ ¬+ On the other hand, those depending exclusively on Me, and surrendering all actions to Me, worship Me (God with attributes), constantly meditating on Me with single-minded devotion, them, Arjuna, I speedily deliver from the ocean of birth and death, their mind being fixed on Me. (6-7) ◊ƒ¤fl ◊Ÿ •rœ-tfl ◊f¤ ’fq fŸfl‡r¤– fŸflf‚r¤f‚ ◊ƒ¤fl •a ™·fl Ÿ ‚‡r¤—+ c+ Therefore, fix your mind on Me, and establish Text 5ó8] Bhagavadg∂tå 144 your intellect in Me alone; thereafter you will abide solely in Me. There is no doubt about it. (8) •¤ f¤-r ‚◊rœra Ÿ ‡r¤Ÿrf¤ ◊f¤ ft¤⁄ ◊˜– •+¤r‚¤rnŸ aar ◊rf◊-ø rta œŸ=¬¤+ º + If you cannot steadily fix the mind on Me, Arjuna, then seek to attain Me through the Yoga of practice. (9) •+¤r‚˘t¤‚◊¤r˘f‚ ◊-∑◊¤⁄ ◊r ¤fl– ◊Œ¤◊f¤ ∑◊rf¢r ∑flf-‚fq◊flrtt¤f‚+ {«+ If you are unequal even to the pursuit of such practice, be intent to work for Me; you shall attain perfection (in the shape of My realization) even by performing actions for My sake. (10) •¤aŒt¤‡r+r˘f‚ ∑a ◊urn◊rf>ra—– ‚fl∑◊¤‹-¤rn aa— ∑= ¤ar-◊flrŸ˜+ {{+ If, taking recourse to the Yoga of My realization, you are unable even to do this, then, subduing your mind and intellect etc., relinquish the fruit of all actions. (11) >r¤r f„ -rrŸ◊+¤r‚rº-rrŸrqvrŸ fflf‡rr¤a– ·¤rŸr-∑◊¤‹-¤rnt-¤rnr-ø rf-a⁄ Ÿ-a⁄ ◊˜ + {·+ Knowledge is better than practice without discernment, meditation on God is superior to knowledge, and renunciation of the fruit of actions is even superior to meditation; for, peace immediately follows from renunciation. (12) •çr≈ r ‚fl¤¸arŸr ◊·r— ∑=¢r ∞fl ¤– fŸ◊◊r fŸ⁄ „ ¿ r⁄ — ‚◊Œ—π‚π— ˇr◊t+ {-+ Bhagavadg∂tå [Ch. 12 145 ‚-ar≈ — ‚aa ¤rnt ¤ar-◊r Œ… fŸ‡¤¤—– ◊ƒ¤f¤a◊Ÿr’fq¤r ◊Ç+— ‚ ◊ f¤˝¤—+ {×+ He who is free from malice towards all beings, friendly and compassionate, and free from the feelings of ëIí and ëmineí, balanced in joy and sorrow, forgiving by nature, ever-contented and mentally united with Me, nay, who has subdued his mind, senses and body, has a firm resolve, and has surrendered his mind and reason to Meóthat devotee of Mine is dear to Me.(13-14) ¤t◊r-Ÿrfç¬a ‹r∑r ‹r∑r-Ÿrfç¬a ¤ ¤—– „ ¤r◊¤¤¤rçn◊+r ¤— ‚ ¤ ◊ f¤˝¤—+ {~+ He who is not a source of annoyance to his fellow-creatures, and who in his turn does not feel vexed with his fellow-creatures, and who is free from delight and envy, perturbation and fear, is dear to Me. (15) •Ÿ¤ˇr— ‡rf¤Œˇr s Œr‚tŸr na√¤¤—– ‚flr⁄ r¤¤f⁄ -¤rnt ¤r ◊Ç+— ‚ ◊ f¤˝¤—+ {º+ He who wants nothing, who is both internally and externally pure, is wise and impartial and has risen above all distractions, and who renounces the sense of doership in all undertakingsósuch a devotee of Mine is dear to Me. (16) ¤r Ÿ z r¤fa Ÿ çfr≈ Ÿ ‡rr¤fa Ÿ ∑rz˜ ˇrfa– ‡r¤r‡r¤¤f⁄ -¤rnt ¤f+◊r-¤— ‚ ◊ f¤˝¤—+ {¬+ He who neither rejoices nor hates, nor grieves, nor desires, and who renounces both good and evil actions and is full of devotion, is dear to Me.(17) Text 14ó17] Bhagavadg∂tå 146 ‚◊— ‡r·rı ¤ f◊·r ¤ a¤r ◊rŸr¤◊rŸ¤r—– ‡rtarr¢r‚πŒ—π¤ ‚◊— ‚y fflflf¬a—+ {c+ ar¤fŸ-Œrtafa◊rŸt ‚-ar≈ r ¤Ÿ ∑Ÿf¤a˜– •fŸ∑a— ft¤⁄ ◊fa¤f+◊r-◊ f¤˝¤r Ÿ⁄ —+ {º+ He who deals equally with friend and foe, and is the same in honour and ignominy, who is alike in heat and cold, pleasure and pain and other contrary experiences, and is free from attachment, he who takes praise and reproach alike, and is given to contemplation and is contented with any means of subsistence available, entertaining no sense of ownership and attachment in respect of his dwelling-place and is full of devotion to Me, that person is dear to Me. (18-19) ¤ a œr¤r◊af◊Œ ¤¤r+ ¤¤¤r‚a– >rzœrŸr ◊-¤⁄ ◊r ¤+rta˘atfl ◊ f¤˝¤r—+ ·«+ Those devotees, however, who partake in a disinterested way of this nectar of pious wisdom set forth above, endowed with faith and solely devoted to Me, they are extremely dear to Me. + ¤iªi Ÿi◊ ,i twelfth chapter entitled ìThe Yoga of Devotionî Z Bhagavadg∂tå [Ch. 12 Chapter XIII üÊË÷ªflÊŸÈ flÊø ;Œ ‡r⁄ t⁄ ∑ı-a¤ ˇr·rf◊-¤f¤œt¤a– ∞-rur flf-r a ¤˝r„ — ˇr·r-r ;fa af猗+ {+ ›r∂ Bhagavån said : This body, Arjuna is termed as the Field (K¶etra) and he who knows it, is called the knower of the Field (K¶etraj¤a) by the sages discerning the truth about both. (1) ˇr·r-r ¤rf¤ ◊r fflfq ‚flˇr·r¤ ¤r⁄ a– ˇr·rˇr·r-r¤r-rrŸ ¤-rº-rrŸ ◊a ◊◊+ ·+ Know Myself to be the K¶etraj¤a (individual soul) in all the K¶etras (fields), Arjuna. And it is the knowledge of the field (K¶etra) and knower (K¶etraj¤a) (i.e., of Matter with its evolutes and the Spirit) which I consider as true knowledge. (2) a-ˇr·r ¤¤r ¤rŒ¤¤ ¤fç∑rf⁄ ¤a‡¤ ¤a˜– ‚ ¤ ¤r ¤-¤˝¤rfl‡¤ a-‚◊r‚Ÿ ◊ n¢r+ -+ What that Field (K¶etra) is and what is its nature, what are its modifications, and from what causes what effects have arisen, and also who its knower (K¶etraj¤a) is, and what is His gloryóhear all this from Me in brief. (3) 148 =f¤f¤’„ œr nta ø -Œrf¤fflfflœ— ¤¤∑˜– ’˝zr‚¸·r¤Œ‡¤fl „ a◊fÇfflfŸf‡¤a—+ ×+ The truth about the K¶etra and the K¶etraj¤a has been expounded by the seers in manifold ways; again, it has been separately stated in different Vedic chants and also in the conclusive and reasoned texts of the Brahmasµutras. (4) ◊„ r¤¸ar-¤„ ¿ r⁄ r ’fq⁄ √¤+◊fl ¤– ;f-¢˝¤rf¢r Œ‡r∑ ¤ ¤=¤ ¤f-¢˝¤nr¤⁄ r—+ ~+ The five elements, the ego, the intellect, the Unmanifest (Primordial Matter), the ten organs of perception and action, the mind, and the five objects of sense (sound, touch, colour, taste and smell). (5) ;-ø r 礗 ‚π Œ—π ‚g ra‡¤aŸr œfa—– ∞a-ˇr·r ‚◊r‚Ÿ ‚ffl∑r⁄ ◊Œrz a◊˜+ º+ Also desire, aversion, pleasure, pain, the physical body, consciousness, firmness: thus is the K¶etra, with its evolutes, briefly stated. (6) •◊rfŸ-fl◊Œfr¤-fl◊f„ ‚r ˇrrf-a⁄ r¬fl◊˜– •r¤r¤r¤r‚Ÿ ‡rr¤ t¤¤◊r-◊fflfŸn˝„ —+ ¬+ Absence of pride, freedom from hypocrisy, non- violence, forbearance, uprightness of speech and mind etc., devout service of the preceptor, internal Bhagavadg∂tå [Ch. 13 149 and external purity, steadfastness of mind and control of body, mind and the senses; (7) ;f-¢˝¤r¤¤ fl⁄ rª¤◊Ÿ„ ¿ r⁄ ∞fl ¤– ¬-◊◊-¤¬⁄ r√¤rfœŒ—πŒr¤rŸŒ‡rŸ◊˜ + c + Dispassion towards the objects of enjoyment of this world and the next, and also absence of egotism, pondering again and again on the pain and evils inherent in birth, death, old age and disease; (8) •‚f+⁄ Ÿf¤rfly — ¤·rŒr⁄ n„ rfŒ¤– fŸ-¤ ¤ ‚◊f¤-r-flf◊r≈ rfŸr≈ r¤¤f-r¤+ º + Absence of attachment and the sense of mineness in respect of son, wife, home etc., and constant equipoise of mind both in favourable and unfavourable circumstances; (9) ◊f¤ ¤rŸ-¤¤rnŸ ¤f+⁄ √¤f¤¤rf⁄ ¢rt– fflffl+Œ‡r‚ffl-fl◊⁄ fa¬Ÿ‚‚fŒ + {«+ Unflinching devotion to Me through exclusive attachment, living in secluded and holy places, and finding no delight in the company of worldly people; (10) •·¤r-◊-rrŸfŸ-¤-fl a-fl-rrŸr¤Œ‡rŸ◊˜– ∞aº-rrŸf◊fa ¤˝r+◊-rrŸ ¤Œar˘-¤¤r+ {{+ Constancy in self-knowledge and seeing God as the object of true knowledgeóall this is declared Text 8ó11] Bhagavadg∂tå 150 as knowledge, and what is contrary to this is called ignorance. (11) -r¤ ¤-r-¤˝flˇ¤rf◊ ¤º-rr-flr◊a◊‡Ÿa– •ŸrfŒ◊-¤⁄ ’˝zr Ÿ ‚-r-Ÿr‚Œ-¤a+ {·+ I shall speak to you at length about that which ought to be known, and knowing which one attains supreme Bliss. That supreme Brahma, who is the lord of beginningless entities, is said to be neither Sat (being) nor Asat (non-being). (12) ‚fla— ¤rf¢r¤rŒ a-‚flar˘fˇrf‡r⁄ r◊π◊˜– ‚fla— >rfa◊r‹r∑ ‚fl◊rfl-¤ far∆ fa+ {-+ It has hands and feet on all sides, eyes, head and mouth in all directions, and ears all-round; for it stands pervading all in the universe. (13) ‚flf-¢˝¤n¢rr¤r‚ ‚flf-¢˝¤fflflf¬a◊˜– •‚+ ‚fl¤¤rfl fŸn¢r n¢r¤r+ ¤+ {×+ Though perceiving all sense-objects, it is really speaking devoid of all senses. Nay, though unattached, it is the sustainer of all nonetheless; and though attributeless, it is the enjoyer of Guƒas, the three modes of Prakæti. (14) ’f„ ⁄ -a‡¤ ¤¸arŸr◊¤⁄ ¤⁄ ◊fl ¤– ‚¸ˇ◊-flr-rŒffl-r¤ Œ¸⁄ t¤ ¤rf-a∑ ¤ aa˜+ {~+ It exists without and within all beings, and constitutes the animate and inanimate creation as well. And by Bhagavadg∂tå [Ch. 13 151 reason of its subtlety, it is incomprehensible; it is close at hand and stands afar too. (15) •ffl¤+ ¤ ¤¸a¤ ffl¤+f◊fl ¤ ft¤a◊˜– ¤¸a¤a ¤ aº-r¤ n˝f‚r¢r ¤˝¤fflr¢r ¤+ {º+ Though integral like space in its undivided aspect, it appears divided as it were, in all animate and inanimate beings. And that Godhead, which is the only object worth knowing, is the sustainer of beings (as Vi¶ƒu), the destroyer (as Rudra) and the creator of all (as Brahmå). (16) º¤rfa¤r◊f¤ a¬¤rfata◊‚— ¤⁄ ◊-¤a– -rrŸ -r¤ -rrŸnr¤ z fŒ ‚flt¤ fflfr∆ a◊˜+ {¬+ That supreme Brahma is said to be the light of all lights and entirely beyond Måyå. That godhead is knowledge itself, worth knowing, and worth attaining through real wisdom, and is particularly abiding in the hearts of all. (17) ;fa ˇr·r a¤r -rrŸ -r¤ ¤r+ ‚◊r‚a—– ◊Ç+ ∞afç-rr¤ ◊Çrflr¤r¤¤ua+ {c+ Thus the truth of the K¶etra and knowledge, as well as of the object worth knowing, i.e., God has been briefly discussed; knowing this in reality, My devotee enters into My being. (18) ¤˝∑fa ¤=¤ ¤fl fflqvŸrŒt s ¤rflf¤– ffl∑r⁄ r‡¤ n¢rr‡¤fl fflfq ¤˝∑fa‚r¤flrŸ˜+ {º+ Text 16ó19] Bhagavadg∂tå 152 Prakæti and Puru¶a, know both these as beginningless. And know all modifications such as likes and dislikes etc., and all objects constituted of the three Guƒas as born of Prakæti. (19) ∑r¤∑⁄ ¢r∑a-fl „ a— ¤˝∑fa=-¤a– ¤=¤— ‚πŒ—πrŸr ¤r+-fl „ a=-¤a+ ·«+ Prakæti is said to be responsible for bringing forth the evolutes and the instruments; while the individual soul is declared to be responsible for the experience of joys and sorrows. (20) ¤=¤— ¤˝∑fat¤r f„ ¤z˜ + ¤˝∑fa¬r-n¢rrŸ˜– ∑r⁄ ¢r n¢r‚y r˘t¤ ‚Œ‚urfŸ¬-◊‚+ ·{+ Only the Puru¶a in association with Prakæti experiences objects of the nature of the three Guƒas evolved from Prakæti and it is attachment with these Guƒas that is responsible for the birth of this soul in good and evil wombs. (21) s ¤¢˝r≈ rŸ◊-ar ¤ ¤ar ¤r+r ◊„ ‡fl⁄ —– ¤⁄ ◊r-◊fa ¤rt¤+r Œ„ ˘ft◊-¤=¤— ¤⁄ —+ ··+ The Spirit dwelling in this body, is really the same as the Supreme. He has been spoken of as the Witness, the true Guide, the Sustainer of all, the Experiencer (as the embodied soul), the Overlord and the Absolute as well. (22) ¤ ∞fl flf-r ¤=¤ ¤˝∑fa ¤ n¢r— ‚„ – ‚fl¤r fla◊rŸr˘f¤ Ÿ ‚ ¤¸¤r˘f¤¬r¤a+ ·-+ Bhagavadg∂tå [Ch. 13 153 He who thus knows the Puru¶a (Spirit) and Prakæti (Nature) together with the Guƒasóeven though performing his duties in everyway, is not born again. (23) ·¤rŸŸr-◊fŸ ¤‡¤f-a ∑f¤Œr-◊rŸ◊r-◊Ÿr– •-¤ ‚rz˜ =¤Ÿ ¤rnŸ ∑◊¤rnŸ ¤r¤⁄ + ·×+ Some by meditation behold the supreme Spirit in the heart with the help of their refined and sharp intellect; others realize it through the discipline of Knowledge, and still others, through the discipline of Action, i.e., Karmayoga. (24) •-¤ -flfl◊¬rŸ-a— >r-flr-¤+¤ s ¤r‚a– a˘f¤ ¤rfaa⁄ --¤fl ◊-¤ >rfa¤⁄ r¤¢rr—+ ·~+ Other dull-witted persons, however, not knowing thus, worship even as they have heard from others; and even those who are thus devoted to what they have heard, are able to cross the ocean of mundane existence in the shape of death. (25) ¤rfl-‚=¬r¤a f∑f=¤-‚-fl t¤rfl⁄ ¬y ◊◊˜– ˇr·rˇr·r-r‚¤rnr-rfçfq ¤⁄ a¤¤+ ·º+ Arjuna, whatsoever being, the moving or unmoving, is born, know it as emanated through the union of K¶etra (Matter) and the K¶etraj¤a (Spirit). (26) ‚◊ ‚fl¤ ¤¸a¤ far∆ -a ¤⁄ ◊‡fl⁄ ◊˜– fflŸ‡¤-tflfflŸ‡¤-a ¤— ¤‡¤fa ‚ ¤‡¤fa+ ·¬+ He alone truly sees, who sees the supreme Lord Text 24ó27] Bhagavadg∂tå 154 as imperishable and abiding equally in all perishable beings, both animate and inanimate. (27) ‚◊ ¤‡¤f-„ ‚fl·r ‚◊flft¤a◊t‡fl⁄ ◊˜– Ÿ f„ Ÿt-¤r-◊Ÿr-◊rŸ aar ¤rfa ¤⁄ r nfa◊˜+ ·c+ For, by seeing the Supreme Lord equally present in all, he does not kill the Self by himself, and thereby attains the supreme state. (28) ¤˝∑-¤fl ¤ ∑◊rf¢r f∑˝¤◊r¢rrfŸ ‚fl‡r—– ¤— ¤‡¤fa a¤r-◊rŸ◊∑ar⁄ ‚ ¤‡¤fa+ ·º+ He who sees that all actions are performed in everyway by nature (Prakæti) and the Self as the non-doer, he alone verily sees. (29) ¤Œr ¤¸a¤¤ª¤rfl◊∑t¤◊Ÿ¤‡¤fa– aa ∞fl ¤ ffltar⁄ ’˝zr ‚r¤ua aŒr+ -«+ The moment man perceives the diversified existence of beings as rooted in the one supreme Spirit, and the spreading forth of all beings from the same, that very moment he attains Brahma (who is Truth, Consciousness and Bliss solidified). (30) •ŸrfŒ-flrf-Ÿn¢r-flr-¤⁄ ◊r-◊r¤◊√¤¤— – ‡r⁄ t⁄ t¤r˘f¤ ∑ı-a¤ Ÿ ∑⁄ rfa Ÿ f‹t¤a+ -{+ Arjuna, being without beginning and without attributes, this indestructible supreme Spirit, though dwelling in the body, in fact does nothing, nor gets tainted. (31) ¤¤r ‚flna ‚ıˇr¤rŒr∑r‡r Ÿr¤f‹t¤a– ‚fl·rrflft¤ar Œ„ a¤r-◊r Ÿr¤f‹t¤a+ -·+ Bhagavadg∂tå [Ch. 13 155 As the all-pervading ether is not contaminated by reason of its subtlety, though permeating the body, the Self is not affected by the attributes of the body due to Its attributeless character. (32) ¤¤r ¤˝∑r‡r¤-¤∑— ∑-tŸ ‹r∑f◊◊ ⁄ ffl—– ˇr·r ˇr·rt a¤r ∑-tŸ ¤˝∑r‡r¤fa ¤r⁄ a+ --+ Arjuna, as the one sun illumines this entire universe, so the one Åtmå (Spirit) illumines the whole K¶etra (Field). (33) ˇr·rˇr·r-r¤r⁄ fl◊-a⁄ -rrŸ¤ˇr¤r– ¤¸a¤˝∑fa◊rˇr ¤ ¤ fflŒ¤rf-a a ¤⁄ ◊˜+ -×+ Those who thus perceive with the eye of wisdom the difference between the K¶etra and K¶etraj¤a, and the phenomenon of liberation from Prakæti with her evolutes, reach the supreme eternal Spirit. ˇi·iˇi·i-ilfl=iª¤iªi Ÿi◊ ·i¤i thirteenth chapter entitled ìThe Yoga of discrimination between the Field and the Knower of the Field.î Z Text 33-34] Bhagavadg∂tå Chapter XIV üÊË÷ªflÊŸÈflÊø ¤⁄ ¤¸¤— ¤˝flˇ¤rf◊ -rrŸrŸr -rrŸ◊-r◊◊˜– ¤º-rr-flr ◊Ÿ¤— ‚fl ¤⁄ r f‚fqf◊ar nar—+ {+ ›r∂ Bhagavån said : I shall expound once more the supreme knowledge, the best of all knowledge, acquiring which all sages have attained highest perfection, being liberated from this mundane existence. (1) ;Œ -rrŸ◊¤rf>r-¤ ◊◊ ‚rœr¤◊rnar—– ‚n˘f¤ Ÿr¤¬r¤-a ¤˝‹¤ Ÿ √¤¤f-a ¤+ ·+ Those who, by practising this knowledge, have entered into My being, are not born again at the cosmic dawn, nor feel disturbed even during the cosmic dissolution (Pralaya). (2) ◊◊ ¤rfŸ◊„ Œ˜’˝zr aft◊-n¤ Œœrr¤„ ◊˜– ‚r¤fl— ‚fl¤¸arŸr aar ¤flfa ¤r⁄ a+ -+ My primordial Nature, known as the great Brahma, is the womb of all creatures; in that womb I place the seed of all life. The creation of all beings follows from that union of Matter and Spirit, O Arjuna. (3) 157 ‚fl¤rfŸ¤ ∑ı-a¤ ◊¸a¤— ‚r¤flf-a ¤r—– ar‚r ’˝zr ◊„ urfŸ⁄ „ ’t¬¤˝Œ— f¤ar+ ×+ Of all embodied beings that appear in all the species of various kinds, Arjuna, Prakæti or Nature is the conceiving Mother, while I am the seed- giving Father. (4) ‚-fl ⁄ ¬ta◊ ;fa n¢rr— ¤˝∑fa‚r¤flr—– fŸ’·Ÿf-a ◊„ r’r„ r Œ„ Œf„ Ÿ◊√¤¤◊˜+ ~+ Sattva, Rajas and Tamasóthese three Guƒas born of Nature tie down the imperishable soul to the body, Arjuna. (5) a·r ‚-fl fŸ◊‹-flr-¤˝∑r‡r∑◊Ÿr◊¤◊˜– ‚π‚y Ÿ ’·Ÿrfa -rrŸ‚y Ÿ ¤rŸrr+ º+ Of these Sattva, being immaculate, is illuminating and flawless, Arjuna; it binds through attachment to happiness and knowledge. (6) ⁄ ¬r ⁄ rnr-◊∑ fflfq ar¢rr‚y ‚◊Çfl◊˜– af-Ÿ’·Ÿrfa ∑r-a¤ ∑◊‚y Ÿ Œf„ Ÿ◊˜+ ¬+ Arjuna, know the quality of Rajas, which is of the nature of passion, as born of desire and attachment. It binds the soul through attachment to actions and their fruit. (7) a◊t-fl-rrŸ¬ fflfq ◊r„ Ÿ ‚flŒf„ Ÿr◊˜– ¤˝◊rŒr‹t¤fŸ¢˝rf¤taf-Ÿ’·Ÿrfa ¤r⁄ a+ c+ And know Tamas, the deluder of all those who Text 4ó8] Bhagavadg∂tå 158 look upon the body as their own self, as born of ignorance. It binds the soul through error, sloth and sleep, Arjuna. (8) ‚-fl ‚π ‚=¬¤fa ⁄ ¬— ∑◊f¢r ¤r⁄ a– -rrŸ◊rfl-¤ a a◊— ¤˝◊rŒ ‚=¬¤-¤a+ º + Sattva draws one to joy and Rajas to action; while Tamas, clouding wisdom, impels one to error, sleep and sloth Arjuna. (9) ⁄ ¬ta◊‡¤rf¤¤¸¤ ‚-fl ¤flfa ¤r⁄ a– ⁄ ¬— ‚-fl a◊‡¤fl a◊— ‚-fl ⁄ ¬ta¤r+ {«+ Overpowering Rajas and Tamas, Arjuna, Sattva prevails; overpowering Sattva and Tamas, Rajas prevails; even so, overpowering Sattva and Rajas, Tamas prevails. (10) ‚flçr⁄ ¤ Œ„ ˘ft◊-¤˝∑r‡r s ¤¬r¤a– -rrŸ ¤Œr aŒr fflurfçflq ‚-flf◊-¤a+ {{+ When light and discernment dawn in this body, as well as in the mind and senses, then one should know that Sattva is predominant. (11) ‹r¤— ¤˝flf-r⁄ r⁄ r¤— ∑◊¢rr◊‡r◊— t¤„ r– ⁄ ¬t¤arfŸ ¬r¤-a fflflq ¤⁄ a¤¤+ {·+ With the preponderance of Rajas, Arjuna, greed, activity, undertaking of action with an interested motive, restlessness and a thirst for enjoyment make their appearance. (12) Bhagavadg∂tå [Ch. 14 159 •¤˝∑r‡rr˘¤˝flf-r‡¤ ¤˝◊rŒr ◊r„ ∞fl ¤– a◊t¤arfŸ ¬r¤-a fflflq ∑=Ÿ-ŒŸ+ {-+ With the growth of Tamas, Arjuna, obtuseness of the mind and senses, disinclination to perform oneís obligatory duties, frivolity and stuporóall these appear. (13) ¤Œr ‚-fl ¤˝flq a ¤˝‹¤ ¤rfa Œ„ ¤a˜– aŒr-r◊fflŒr ‹r∑rŸ◊‹r-¤˝fa¤ua+ {×+ When a man dies during the preponderance of Sattva, he obtains the stainless ethereal worlds (heaven etc.,) attained by men of noble deeds.(14) ⁄ ¬f‚ ¤˝‹¤ n-flr ∑◊‚fy ¤ ¬r¤a– a¤r ¤˝‹tŸta◊f‚ ◊¸… ¤rfŸ¤ ¬r¤a+ {~+ Dying when Rajas predominates, he is born among those attached to action; even so, the man who has expired during the preponderance of Tamas is reborn in the species of the deluded creatures such as insects and beasts etc. (15) ∑◊¢r— ‚∑at¤r„ — ‚rf-fl∑ fŸ◊‹ ¤‹◊˜– ⁄ ¬‚ta ¤‹ Œ—π◊-rrŸ a◊‚— ¤‹◊˜+ {º+ The reward of a righteous act, they say, is Såttvika i.e., faultless in the shape of joy, wisdom and dispassion etc., sorrow is declared to be the fruit of a Råjasika act and ignorance, the fruit of a Tåmasika act. (16) ‚-flr-‚=¬r¤a -rrŸ ⁄ ¬‚r ‹r¤ ∞fl ¤– ¤˝◊rŒ◊r„ r a◊‚r ¤flar˘-rrŸ◊fl ¤+ {¬+ Text 13ó17] Bhagavadg∂tå 160 Wisdom follows from Sattva, and greed, undoubtedly, from Rajas; likewise obstinate error, stupor and also ignorance follow from Tamas. (17) ™·fl n-ø f-a ‚-flt¤r ◊·¤ far∆ f-a ⁄ r¬‚r—– ¬rr-¤n¢rflf-rt¤r •œr n-ø f-a ar◊‚r—+ {c+ Those who abide in the quality of Sattva wend their way upwards; while those of a Råjasika disposition stay in the middle. And those of a Tåmasika temperament, enveloped as they are in the effects of Tamoguƒa, sink down. (18) Ÿr-¤ n¢r+¤— ∑ar⁄ ¤Œr ¢˝r≈ rŸ¤‡¤fa– n¢r+¤‡¤ ¤⁄ flf-r ◊Çrfl ‚r˘fœn-ø fa+ {º+ When the discerning person sees no one as doer other than the three Guƒas, and realizes Me, the supreme Spirit standing entirely beyond these Guƒas, he enters into My being. (19) n¢rrŸarŸat-¤ ·rt-Œ„ t Œ„ ‚◊ÇflrŸ˜– ¬-◊◊-¤¬⁄ rŒ—πffl◊+r˘◊a◊‡Ÿa + ·«+ Having transcended the aforesaid three Guƒas, which have caused the body, and freed from birth, death, old age and all kinds of sorrow, the embodied soul attains supreme bliss. (20) •¡È¸Ÿ © flÊø ∑f‹y t·rt-n¢rrŸarŸatar ¤flfa ¤˝¤r– f∑◊r¤r⁄ — ∑¤ ¤art·rt-n¢rrŸfaflaa+ ·{+ Arjuna said : What are the marks of him who Bhagavadg∂tå [Ch. 14 161 has risen above the three Guƒas, and what is his conduct ? And how, Lord, does he rise above the three Guƒas? (21) üÊË÷ªflÊŸÈ flÊø ¤˝∑r‡r ¤ ¤˝flf-r ¤ ◊r„ ◊fl ¤ ¤r¢z fl– Ÿ çfr≈ ‚r¤˝fl-rrfŸ Ÿ fŸfl-rrfŸ ∑rz˜ ˇrfa+ ··+ ›r∂ Bhagavån said: Arjuna, he who hates not light (which is born of Sattva) and activity (which is born of Rajas) and even stupor (which is born of Tamas), when prevalent, nor longs for them when they have ceased. (22) s Œr‚tŸflŒr‚tŸr n¢r¤r Ÿ ffl¤rr¤a– n¢rr fla-a ;-¤fl ¤r˘flfar∆ fa Ÿy a+ ·-+ He who, sitting like a witness, is not disturbed by the Guƒas, and who, knowing that the Guƒas alone move among the Guƒas, remains established in identity with God, and never falls off from that state. (23) ‚◊Œ—π‚π— tflt¤— ‚◊‹rr≈ r‡◊∑r=¤Ÿ—– ar¤f¤˝¤rf¤˝¤r œt⁄ tar¤fŸ-Œr-◊‚tafa—+ ·×+ He who is ever established in the Self, takes pain and pleasure alike, regards a clod of earth, a stone and a piece of gold as equal in value, is possessed of wisdom, accepts the pleasant as well as the unpleasant in the same spirit, and views censure and praise alike. (24) Text 22ó24] Bhagavadg∂tå 162 ◊rŸr¤◊rŸ¤rtar¤tar¤r f◊·rrf⁄ ¤ˇr¤r—– ‚flr⁄ r¤¤f⁄ -¤rnt n¢rrata— ‚ s -¤a+ ·~+ He who is equipoised in honour or ignominy, is alike towards a friend or an enemy, and has renounced the sense of doership in all undertakings, is said to have risen above the three Guƒas.(25) ◊r ¤ ¤r˘√¤f¤¤r⁄ ¢r ¤f+¤rnŸ ‚fla– ‚ n¢rr-‚◊at-¤ar-’˝zr¤¸¤r¤ ∑r¤a+ ·º+ He too who, constantly worships Me through the Yoga of exclusive devotionótranscending these three Guƒas, he becomes eligible for attaining Brahma. (26) ’˝zr¢rr f„ ¤˝far∆ r„ ◊◊at¤r√¤¤t¤ ¤– ‡rr‡flat¤ ¤ œ◊t¤ ‚πt¤∑rf-a∑t¤ ¤+ ·¬+ For, I am the substratum of the imperishable Brahma, of immortality, of the eternal Dharma and of unending immutable bliss. ºi·i¤lfl=iª¤iªi Ÿi◊ --Œ‡ii˘·¤i¤—+ ·÷+ Thus, in the Upani¶ad sung by the Lord, the Science of Brahma, the scripture of Yoga, the dialogue between ›r∂ K涃a and Arjuna, ends the fourteenth chapter entitled ìThe Yoga of Division of three Guƒas.î Z Bhagavadg∂tå [Ch. 14 Chapter XV üÊË÷ªflÊŸÈ flÊø ™·fl◊¸‹◊œ—‡rrπ◊‡fl-¤ ¤˝r„ ⁄ √¤¤◊˜– ø -Œrf‚ ¤t¤ ¤¢rrfŸ ¤ta flŒ ‚ flŒffla˜+ {+ ›r∂ Bhagavån said : He who knows the P∂pala tree (in the form of creation); which is said to be imperishable with its roots in the Primeval Being (God), whose stem is represented by Brahmå (the Creator), and whose leaves are the Vedas, is a knower of the purport of the Vedas. (1) •œ‡¤r·fl ¤˝‚artat¤ ‡rrπr n¢r¤˝flqr ffl¤¤¤˝flr‹r—– •œ‡¤ ◊¸‹r-¤Ÿ‚-aarfŸ ∑◊rŸ’-œtfŸ ◊Ÿr¤‹r∑+ ·+ Fed by the three Guƒas and having sense-objects for their tender leaves, the branches of the aforesaid tree (in the shape of the different orders of creation) extend both downwards and upwards; and its roots, which bind the soul according to its actions in the human body, are spread in all regions, higher as well as lower. (2) 164 Ÿ =¤◊t¤„ a¤r¤‹+¤a Ÿr-ar Ÿ ¤rfŒŸ ¤ ‚r¤˝far∆ r– •‡fl-¤◊Ÿ ‚ffl=… ◊¸‹- ◊‚y ‡rt·r¢r Œ… Ÿ fø -flr+ -+ The nature of this tree of creation does not on mature thought turn out what it is represented to be; for it has neither beginning nor end, nor even stability. Therefore, cutting down this P∂pala tree, which is most firmly rooted, with the formidable axe of dispassion. (3) aa— ¤Œ a-¤f⁄ ◊rfna√¤- ¤ft◊-nar Ÿ fŸflaf-a ¤¸¤—– a◊fl ¤ru ¤=¤ ¤˝¤u ¤a— ¤˝flf-r— ¤˝‚ar ¤⁄ r¢rt+ ×+ Thereafter a man should diligently seek for that supreme state, viz., God, having attained which they return no more to this world; and having fully resolved that he stands dedicated to that Primeval Being (God Nåråyaƒa) Himself, from whom the flow of this beginningless creation has progressed, he should dwell and meditate on Him. (4) fŸ◊rŸ◊r„ r f¬a‚y Œr¤r •·¤r-◊fŸ-¤r fflfŸfl-r∑r◊r—– Bhagavadg∂tå [Ch. 15 165 ç-çffl◊+r— ‚πŒ—π‚=-r- n-ø --¤◊¸… r— ¤Œ◊√¤¤ aa˜+ ~+ They who are free from pride and delusion, who have conquered the evil of attachment, and are constantly abiding in God, whose cravings have altogether ceased and who are completely immune to all pairs of opposites going by the names of pleasure and pain, and are undeluded, attain that supreme immortal state. (5) Ÿ aÇr‚¤a ‚¸¤r Ÿ ‡r‡rr¿ r Ÿ ¤rfl∑—– ¤Œ˜n-flr Ÿ fŸfla-a aqr◊ ¤⁄ ◊ ◊◊+ º+ Neither the sun nor the moon nor fire can illumine that supreme self-effulgent state, attaining which they never return to this world; that is My supreme abode. (6) ◊◊flr‡rr ¬tfl‹r∑ ¬tfl¤¸a— ‚ŸraŸ—– ◊Ÿ—¤r∆ rŸtf-¢˝¤rf¢r ¤˝∑fat¤rfŸ ∑¤fa+ ¬+ The eternal J∂våtmå in this body is a fragment of My own Self; and it is that alone which draws around itself the mind and the five senses, which abide in Prakæti. (7) ‡r⁄ t⁄ ¤ŒflrtŸrfa ¤¤rrt¤-∑˝r◊at‡fl⁄ —– n„ t-flarfŸ ‚¤rfa flr¤n-œrfŸflr‡r¤ra˜+ c + Text 5ó8] Bhagavadg∂tå 166 Even as the wind wafts scents from their seat, so, too, the J∂våtmå, which is the controller of the body etc., taking the mind and the senses from the body, which it leaves behind, forthwith migrates to the body which it acquires. (8) >rr·r ¤ˇr— t¤‡rŸ ¤ ⁄ ‚Ÿ rr˝r¢r◊fl ¤– •fœr∆ r¤ ◊Ÿ‡¤r¤ ffl¤¤rŸ¤‚fla+ º + It is while dwelling in the senses of hearing, sight, touch, taste and smell, as well as in the mind, that this J∂våtmå enjoys the objects of senses. (9) s -∑˝r◊-a ft¤a flrf¤ ¤=¬rŸ flr n¢rrf-fla◊˜– ffl◊¸… r ŸrŸ¤‡¤f-a ¤‡¤f-a -rrŸ¤ˇr¤—+ {«+ The ignorant know not the soul departing from, or dwelling in the body, or enjoying the objects of senses, i.e., even when it is connected with the three Guƒas; only those endowed with the eyes of wisdom are able to realize it. (10) ¤a-ar ¤rfnŸ‡¤Ÿ ¤‡¤--¤r-◊-¤flft¤a◊˜– ¤a-ar˘t¤∑ar-◊rŸr ŸŸ ¤‡¤--¤¤a‚—+ {{+ Striving Yog∂s too are able to realise this Self enshrined in their heart. The ignorant, however, whose heart has not been purified, know not this Self in spite of their best endeavours. (11) Bhagavadg∂tå [Ch. 15 167 ¤ŒrfŒ-¤na a¬r ¬nÇr‚¤a˘fπ‹◊˜– ¤¤r-¢˝◊f‚ ¤¤rrªŸı a-r¬r fflfq ◊r◊∑◊˜+ {·+ The radiance in the sun that illumines the entire world, and that which shines in the moon and that which shines in the fire too, know that radiance to be Mine. (12) nr◊rffl‡¤ ¤ ¤¸arfŸ œr⁄ ¤rr¤„ ◊r¬‚r– ¤r¢rrf◊ ¤r¤œt— ‚flr— ‚r◊r ¤¸-flr ⁄ ‚r-◊∑—+ {-+ And permeating the soil, it is I who support all creatures by My vital energy, and becoming the sapful moon, I nourish all plants. (13) •„ fl‡flrŸ⁄ r ¤¸-flr ¤˝rf¢rŸr Œ„ ◊rf>ra—– ¤˝r¢rr¤rŸ‚◊r¤+— ¤¤rr¤-Ÿ ¤afflœ◊˜+ {×+ Taking the form of fire, as Vai‹vånara, lodged in the body of all creatures and united with the Pråƒa (exhalation) and Apåna (inhalation) breaths, it is I who digest and assimilate the four kinds of food. (14) ‚flt¤ ¤r„ zfŒ ‚f-Ÿfflr≈ r ◊-r— t◊fa-rrŸ◊¤r„ Ÿ ¤– flŒ‡¤ ‚fl⁄ „ ◊fl flur- flŒr-a∑çŒfflŒfl ¤r„ ◊˜+ {~+ It is I who remain seated in the heart of all Text 12ó15] Bhagavadg∂tå 168. (15) çrffl◊r ¤=¤r ‹r∑ ˇr⁄ ‡¤rˇr⁄ ∞fl ¤– ˇr⁄ — ‚flrf¢r ¤¸arfŸ ∑¸≈ t¤r˘ˇr⁄ s -¤a+ {º+ The perishable and the imperishable tooóthese are the two kinds of Puru¶as in this world. Of these, the bodies of all beings are spoken of as the perishable; while the J∂våtmå or the embodied soul is called imperishable. (16) s -r◊— ¤=¤t-fl-¤— ¤⁄ ◊r-◊-¤Œrz a—– ¤r ‹r∑·r¤◊rffl‡¤ f’¤-¤√¤¤ ;‡fl⁄ —+ {¬+ Yet, the Supreme Person is other than these, who, having encompassed all the three worlds, upholds and maintains all, and has been spoken of as the imperishable Lord and the Supreme Spirit. (17) ¤t◊r-ˇr⁄ ◊atar˘„ ◊ˇr⁄ rŒf¤ ¤r-r◊—– •ar˘ft◊ ‹r∑ flŒ ¤ ¤˝f¤a— ¤=¤r-r◊—+ {c+ Since I am wholly beyond the perishable world of matter or K¶etra, and am superior even to the Bhagavadg∂tå [Ch. 15 169 imperishable soul, J∂våtmå, hence I am known as the Puru¶ottama, the Supreme Self, in the world as well as in the Vedas. (18) ¤r ◊r◊fl◊‚r◊¸… r ¬rŸrfa ¤=¤r-r◊◊˜– ‚ ‚flfflǬfa ◊r ‚fl¤rflŸ ¤r⁄ a+ {º+ Arjuna, the wise man who thus realizes Me as the Supreme Personóknowing all, he constantly worships Me (the all-pervading Lord) with his whole being. (19) ;fa nna◊ ‡rrt·rf◊Œ◊+ ◊¤rŸrr– ∞aŒ˜’Œ˜·flr ’fq◊r-t¤r-∑a∑-¤‡¤ ¤r⁄ a+ ·«+ Arjuna, this most esoteric teaching has thus been imparted by Me; grasping it in essence man becomes wise and his mission in life is accomplished.ª ¤i-i◊¤iªi Ÿi◊ ¤~- fifteenth chapter entitled ìThe Yoga of the Supreme Person.î Z Text 19-20] Bhagavadg∂tå Chapter XVI üÊË÷ªflÊŸÈ flÊø •¤¤ ‚-fl‚‡rfq-rrŸ¤rn√¤flft¤fa—– ŒrŸ Œ◊‡¤ ¤-r‡¤ tflr·¤r¤ta¤ •r¬fl◊˜+ {+ Absolute fearlessness, perfect purity of mind, constant fixity in the Yoga of meditation for the sake of Self-realization, and even so, charity in its Såttvika form, control of the senses, worship of God and other deities as well as of oneís elders including the performance of Agnihotra (pouring oblations into the sacred fire) and other sacred duties, study and teaching of the Vedas and other sacred books as well as the chanting of Godís names and glories, suffering hardships for the discharge of oneís sacred obligations and uprightness of mind as well as of the body and senses. (1) •f„ ‚r ‚-¤◊∑˝rœt-¤rn— ‡rrf-a⁄ ¤‡rŸ◊˜– Œ¤r ¤¸arfl‹r‹t-fl ◊rŒfl ç t⁄ ¤r¤‹◊˜+ ·+ Non-violence in thought, word and deed, truthfulness and geniality of speech, absence of anger even on provocation, disclaiming doership in respect of actions, quietude or composure of 171 mind, abstaining from slander, compassion towards all creatures, absence of attachment to the objects of senses even during their contact with the senses, mildness, a sense of shame in transgressing the scriptures or social conventions, and abstaining from frivolous pursuits; (2) a¬— ˇr◊r œfa— ‡rr¤◊¢˝r„ r Ÿrfa◊rfŸar– ¤flf-a ‚-¤Œ Œflt◊f¤¬rat¤ ¤r⁄ a+ -+ Sublimity, forbearance, fortitude, external purity, bearing enmity to none and absence of self-esteemóthese are the marks of him, who is born with the divine endowments, Arjuna. (3) Œ-¤r Œ¤r˘f¤◊rŸ‡¤ ∑˝rœ— ¤r=r¤◊fl ¤– •-rrŸ ¤rf¤¬rat¤ ¤r¤ ‚-¤Œ◊r‚⁄ t◊˜+ ×+ Hypocrisy, arrogance pride and anger, sternness and ignorance tooóthese are the marks of him, who is born with demoniac properties. (4) Œflt ‚-¤fç◊rˇrr¤ fŸ’-œr¤r‚⁄ t ◊ar– ◊r ‡r¤— ‚-¤Œ Œflt◊f¤¬rar˘f‚ ¤r¢z fl+ ~+ The divine endowment has been recognized as conducive to liberation, and the demoniac one as leading to bondage. Grieve not, Arjuna, for you are born with the divine propensities. (5) çr ¤¸a‚nr ‹r∑˘ft◊-Œfl •r‚⁄ ∞fl ¤– Œflr fflta⁄ ‡r— ¤˝r+ •r‚⁄ ¤r¤ ◊ n¢r+ º+ There are only two types of men in this world, Text 3ó6] Bhagavadg∂tå 172 Arjuna, the one possessing a divine nature and the other possessing a demoniac disposition. Of these, the type possessing divine nature has been dealt with at length; now hear in detail from Me about the type possessing demoniac disposition. (6) ¤˝flf-r ¤ fŸflf-r ¤ ¬Ÿr Ÿ fflŒ⁄ r‚⁄ r—– Ÿ ‡rr¤ Ÿrf¤ ¤r¤r⁄ r Ÿ ‚-¤ a¤ fflua+ ¬ + Men possessing a demoniac disposition know not what is right activity and what is right abstinence from activity. Hence they possess neither purity (external or internal) nor good conduct nor even truthfulness. (7) •‚-¤◊¤˝far∆ a ¬nŒr„ ⁄ Ÿt‡fl⁄ ◊˜– •¤⁄ t¤⁄ ‚-¤¸a f∑◊-¤-∑r◊„ a∑◊˜+ c + Men of demoniac disposition say this world is without any foundation, absolutely unreal and godless, brought forth by mutual union of the male and female and hence conceived in lust; what else than this? (8) ∞ar Œfr≈ ◊flr≈ +¤ Ÿr≈ r-◊rŸr˘r¤’q¤—– ¤˝¤fl--¤n˝∑◊r¢r— ˇr¤r¤ ¬nar˘f„ ar—+ º + Clinging to this false view these slow-witted men of vile disposition and terrible deeds, are wrong doers to mankind for the destruction of the world. (9) Bhagavadg∂tå [Ch. 16 173 ∑r◊◊rf>r-¤ Œr¤¸⁄ Œ-¤◊rŸ◊Œrf-flar—– ◊r„ rŒ˜n„ t-flr‚Œ˜n˝r„ r-¤˝fla-a˘‡rf¤fl˝ar— + {«+ Cherishing insatiable desires and embracing false doctrines through ignorance, these men of impure conduct move in this world, full of hypocrisy, pride and arrogance. (10) f¤-ar◊¤f⁄ ◊¤r ¤ ¤˝‹¤r-ar◊¤rf>rar—– ∑r◊r¤¤rn¤⁄ ◊r ∞arflfŒfa fŸf‡¤ar—+ {{+ Giving themselves up to innumerable cares ending only with death, they remain devoted to the enjoyment of sensuous pleasures and are firm in their belief that this is the highest limit of joy. (11) •r‡rr¤r‡r‡ra’qr— ∑r◊∑˝rœ¤⁄ r¤¢rr—– ;„ -a ∑r◊¤rnr¤◊-¤r¤Ÿr¤‚=¤¤rŸ˜+ {·+ Held in bondage by hundreds of ties of expectation and wholly giving themselves up to lust and anger, they strive to amass by unfair means hoards of money and other objects for the enjoyment of sensuous pleasures. (12) ;Œ◊u ◊¤r ‹ªœf◊◊ ¤˝rtt¤ ◊Ÿr⁄ ¤◊˜– ;Œ◊tatŒ◊f¤ ◊ ¤fflr¤fa ¤ŸœŸ◊˜+ {-+ They say to themselves, ìThis much has been secured by me today and now I shall realize this ambition. So much wealth is already with me and yet again this shall be mine. (13) Text 10ó13] Bhagavadg∂tå 174 •‚r ◊¤r „ a— ‡r·r„ fŸr¤ ¤r¤⁄ rŸf¤– ;‡fl⁄ r˘„ ◊„ ¤rnt f‚qr˘„ ’‹flr-‚πt+ {×+ That enemy has been slain by me and I shall kill those others too. I am the lord of all, the enjoyer of all power, I am endowed with all occult powers, and am mighty and happy. (14) •r…vr˘f¤¬ŸflrŸft◊ ∑r˘-¤r˘fta ‚Œ‡rr ◊¤r– ¤ˇ¤ Œrt¤rf◊ ◊rfŒr¤ ;-¤-rrŸffl◊rf„ ar—+ {~+ •Ÿ∑f¤-rffl¤˝r-ar ◊r„ ¬r‹‚◊rflar—– ¤˝‚+r— ∑r◊¤rn¤ ¤af-a Ÿ⁄ ∑˘‡r¤r+ {º+ ìI am wealthy and own a large family; who else is equal to me? I will sacrifice to gods, will give alms, I will make merry,î Thus deluded by ignorance, enveloped in the mesh of delusion and addicted to the enjoyment of sensuous pleasures, their minds bewildered by numerous thoughts, these men of devilish disposition fall into the foulest hell. (15-16) •r-◊‚-¤rfflar— taªœr œŸ◊rŸ◊Œrf-flar—– ¤¬-a Ÿr◊¤-rta Œ-¤Ÿrfflfœ¤¸fl∑◊˜+ {¬+ Intoxicated by wealth and honour, those self- conceited and haughty men perform sacrifices only in name for ostentation, without following the sacred rituals. (17) Bhagavadg∂tå [Ch. 16 175 •„¿ r⁄ ’‹ Œ¤ ∑r◊ ∑˝rœ ¤ ‚f>rar—– ◊r◊r-◊¤⁄ Œ„ ¤ ¤˝fç¤-ar˘+¤‚¸¤∑r—+ {c+ Given over to egotism, brute force, arrogance, lust and anger etc., and calumniating others, they despise Me (the in-dweller), dwelling in their own bodies as well as in those of others. (18) arŸ„ fç¤a— ∑˝¸⁄ r-‚‚r⁄ ¤ Ÿ⁄ rœ◊rŸ˜– fˇr¤r-¤¬n◊‡r¤rŸr‚⁄ trflfl ¤rfŸ¤+ {º+ Those haters, sinful, cruel and vilest among men, I cast again and again into demoniacal wombs in this world. (19) •r‚⁄ t ¤rfŸ◊r¤-Ÿr ◊¸… r ¬-◊fŸ ¬-◊fŸ– ◊r◊¤˝rt¤fl ∑r-a¤ aar ¤r--¤œ◊r nfa◊˜+ ·«+ Failing to reach Me, Arjuna, those stupid souls are born life after life in demoniac wombs and then verily sink down to a still lower plane.(20) f·rfflœ Ÿ⁄ ∑t¤Œ çr⁄ Ÿr‡rŸ◊r-◊Ÿ—– ∑r◊— ∑˝rœta¤r ‹r¤tat◊rŒa-·r¤ -¤¬a˜+ ·{+ Desire, anger and greedóthese triple gates of hell, bring about the downfall of the soul. Therefore, one should shun all these three. (21) ∞affl◊+— ∑r-a¤ a◊rçr⁄ ft·rf¤Ÿ⁄ —– •r¤⁄ -¤r-◊Ÿ— >r¤taar ¤rfa ¤⁄r nfa◊˜+ ··+ Freed from these three gates of hell, man works Text 18ó22] Bhagavadg∂tå 176 for his own salvation and thereby attains the supreme goal, i.e., God. (22) ¤— ‡rrt·rfflfœ◊-‚º¤ flaa ∑r◊∑r⁄ a—– Ÿ ‚ f‚fq◊flrtŸrfa Ÿ ‚π Ÿ ¤⁄ r nfa◊˜+ ·-+ Discarding the injunctions of the scriptures, he who acts in an arbitrary way according to his own sweet will, such a person neither attains perfection, nor the supreme goal, nor even happiness. (23) at◊r-ø rt·r ¤˝◊r¢r a ∑r¤r∑r¤√¤flft¤ar– -rr-flr ‡rrt·rfflœrŸr+ ∑◊ ∑af◊„ r„ f‚+ ·×+ Therefore, the scripture alone is your guide in determining what should be done and what should not be done. Knowing this, you ought to perform only such action as is ordained by the scriptures. (24) Œfli‚⁄‚-¤l,=iª¤iªi Ÿi◊ ¤i÷ sixteenth chapter entitled ìThe Yoga of Division between the Divine and the Demoniacal Properties.î Z Bhagavadg∂tå [Ch. 16 Chapter XVII •¡È¸Ÿ © flÊø ¤ ‡rrt·rfflfœ◊-‚º¤ ¤¬-a >rq¤rf-flar—– a¤r fŸr∆ r a ∑r ∑r¢r ‚-fl◊r„ r ⁄ ¬ta◊—+ {+ Arjuna said: Those, endowed with faith, who worship gods and others, disregarding the injunctions of the scriptures, where do they stand, K涃aóin Sattva, Rajas or Tamas ? (1) üÊË÷ªflÊŸÈ flÊø f·rfflœr ¤flfa >rqr Œf„ Ÿr ‚r tfl¤rfl¬r– ‚rf-fl∑t ⁄ r¬‚t ¤fl ar◊‚t ¤fa ar n¢r+ ·+ ›r∂ Bhagavån said: That untutored innate faith of men is of three kindsóSåttvika, Råjasika and Tåmasika. Hear of it from Me. (2) ‚-flrŸ=¤r ‚flt¤ >rqr ¤flfa ¤r⁄ a– >rqr◊¤r˘¤ ¤=¤r ¤r ¤-ø˛ q— ‚ ∞fl ‚—+ -+ The faith of all men conforms to their mental disposition, Arjuna. Faith constitutes a man; whatever the nature of his faith, verily he is that. (3) 178 ¤¬-a ‚rf-fl∑r Œflr-¤ˇr⁄ ˇrrf‚ ⁄ r¬‚r—– ¤˝ar-¤¸an¢rr‡¤r-¤ ¤¬-a ar◊‚r ¬Ÿr—+ ×+ Men of Såttvika disposition worship gods; those of Råjasika temperament worship demigods, the demons; while others, who are of Tåmasika disposition, worship the spirits of the dead and ghosts. (4) •‡rrt·rfflf„ a rrr⁄ at¤-a ¤ a¤r ¬Ÿr—– Œ-¤r„¿ r⁄ ‚¤+r— ∑r◊⁄ rn’‹rf-flar—+ ~+ Men who practise severe penance of an arbitrary type, not sanctioned by the scriptures, and who are full of hypocrisy and egotism and are obsessed with desire, attachment and pride of power; (5) ∑‡r¤-a— ‡r⁄t⁄ t¤ ¤¸an˝r◊◊¤a‚—– ◊r ¤flr-a— ‡r⁄ t⁄ t¤ arf-flqvr‚⁄ fŸ‡¤¤rŸ˜+ º+ And who emaciate the elements constituting their body as well as Me, the Supreme Spirit, dwelling in their heartóknow those senseless people to have a demoniac disposition. (6) •r„ r⁄ t-flf¤ ‚flt¤ f·rfflœr ¤flfa f¤˝¤—– ¤-rta¤ta¤r ŒrŸ a¤r ¤Œf◊◊ n¢r+ ¬+ Food also, which is agreeable to different men according to their innate disposition is of three kinds. And likewise, sacrifice, penance and charity Bhagavadg∂tå [Ch. 17 179 too are of three kinds each; hear their distinction as follows. (7) •r¤— ‚-fl’‹r⁄ rª¤‚π¤˝tfafflflœŸr—– ⁄ t¤r— ftŸªœr— ft¤⁄ r ¢ ur •r„ r⁄ r— ‚rf-fl∑f¤˝¤r—+ c + Foods which promote longevity, intelligence, vigour, health, happiness and cheerfulness, and which are juicy, succulent, substantial and naturally agreeable, are liked by men of Såttvika nature. (8) ∑≈˜ fl-‹‹fl¢rr-¤r¢ratˇ¢r=ˇrfflŒrf„ Ÿ— – •r„ r⁄ r ⁄ r¬‚t¤r≈ r Œ—π‡rr∑r◊¤¤˝Œr—+ º + Foods which are bitter, sour, salty, overhot, pungent, dry and burning, and which cause suffering, grief and sickness, are dear to the Råjasika. (9) ¤ra¤r◊ na⁄ ‚ ¤¸fa ¤¤f¤a ¤ ¤a˜– s f-ø r≈ ◊f¤ ¤r◊·¤ ¤r¬Ÿ ar◊‚f¤˝¤◊˜+ {«+ Food which is ill-cooked or not fully ripe, insipid, putrid, stale and polluted, and which is impure too, is dear to men of Tåmasika disposition. (10) •¤‹r∑rz˜ fˇrf¤¤-rr fflfœŒr≈ r ¤ ;º¤a– ¤r≈ √¤◊flfa ◊Ÿ— ‚◊rœr¤ ‚ ‚rf-fl∑—+ {{+ The sacrifice which is offered, as ordained by Text 8ó11] Bhagavadg∂tå 180 scriptural injunctions, by men who expect no return and who believe that such sacrifices must be performed, is Såttvika in character. (11) •f¤‚-œr¤ a ¤‹ Œ-¤r¤◊f¤ ¤fl ¤a˜– ;º¤a ¤⁄ a>rr∆ a ¤-r fflfq ⁄ r¬‚◊˜+ {·+ That sacrifice, however, which is offered for the sake of mere show or even with an eye to its fruit, know it to be Råjasika, Arjuna. (12) fflfœ„ tŸ◊‚r≈ r-Ÿ ◊-·r„ tŸ◊Œfˇr¢r◊˜– >rqrffl⁄ f„ a ¤-r ar◊‚ ¤f⁄ ¤ˇra+ {-+ A sacrifice, which is not in conformity with scriptural injunctions, in which no food is offered, and no sacrificial fees are paid, which is without sacred chant of hymns and devoid of faith, is said to be Tåmasika. (13) Œflfç¬n=¤˝r-r¤¸¬Ÿ ‡rr¤◊r¬fl◊˜– ’˝zr¤¤◊f„ ‚r ¤ ‡rr⁄ t⁄ a¤ s -¤a+ {×+ Worship of gods, the Bråhmaƒas, oneís guru, elders and wise-men, purity, straightforwardness, continence and non-violenceóthese are called penance of the body. (14) •Ÿçn∑⁄ flr¤¤ ‚-¤ f¤˝¤f„ a ¤ ¤a˜– tflr·¤r¤r+¤‚Ÿ ¤fl flrz˜ ◊¤ a¤ s -¤a+ {~+ Words which cause no annoyance to others Bhagavadg∂tå [Ch. 17 181 and are truthful, agreeable and beneficial, as well as the study of the Vedas and other ›åstras and the practice of the chanting of Divine Nameó this is known as penance of speech. (15) ◊Ÿ—¤˝‚rŒ— ‚r-¤-fl ◊rŸ◊r-◊fflfŸn˝„ —– ¤rfl‚‡rfqf⁄ -¤a-r¤r ◊rŸ‚◊-¤a+ {º+ Cheerfulness of mind, placidity, habit of contemplation on God, control of the mind and perfect purity of inner feelingsóall this is called austerity of the mind. (16) >rq¤r ¤⁄ ¤r ata a¤taf-·rfflœ Ÿ⁄ —– •¤‹r∑rz˜ fˇrf¤¤+— ‚rf-fl∑ ¤f⁄ ¤ˇra+ {¬+ This threefold penance performed with supreme faith by Yog∂s expecting no return is called Såttvika. (17) ‚-∑r⁄ ◊rŸ¤¸¬r¤ a¤r Œ-¤Ÿ ¤fl ¤a˜– f∑˝¤a afŒ„ ¤˝r+ ⁄ r¬‚ ¤‹◊œ˝fl◊˜+ {c+ The austerity which is performed for the sake of renown, honour or adoration, as well as for any other selfish gain, either in all sincerity or by way of ostentation, and yields an uncertain and momentary fruit, has been spoken of here as Råjasika. (18) ◊¸… n˝r„ ¢rr-◊Ÿr ¤-¤tz ¤r f∑˝¤a a¤—– ¤⁄ t¤r-‚rŒŸr¤ flr a-rr◊‚◊Œr¢ a◊˜+ {º+ Text 16ó19] Bhagavadg∂tå 182 Penance which is resorted to out of foolish notion and is accompanied by self-mortification, or is intended to harm others, such penance has been declared as Tåmasika. (19) Œra√¤f◊fa ¤zrŸ Œt¤a˘Ÿ¤∑rf⁄ ¢r– Œ‡r ∑r‹ ¤ ¤r·r ¤ azrŸ ‚rf-fl∑ t◊a◊˜+ ·«+ A gift which is bestowed with a sense of duty on one from whom no return is expected, at appropriate time and place, and to a deserving person, that gift has been declared as Såttvika. (20) ¤-r ¤˝-¤¤∑r⁄ r¤ ¤‹◊fz‡¤ flr ¤Ÿ—– Œt¤a ¤ ¤f⁄ f¤‹r≈ azrŸ ⁄ r¬‚ t◊a◊˜+ ·{+ A gift which is bestowed in a grudging spirit and with the object of getting a service in return or in the hope of obtaining a reward, is called Råjasika. (21) •Œ‡r∑r‹ ¤zrŸ◊¤r·r+¤‡¤ Œt¤a– •‚-∑a◊fl-rra a-rr◊‚◊Œr¢ a◊˜+ ··+ A gift which is made without good grace and in a disdainful spirit, out of time and place, and to undeserving persons, is said to be Tåmasika. (22) ˙ a-‚fŒfa fŸŒ‡rr ’˝zr¢rft·rfflœ— t◊a—– ’˝rzr¢rrtaŸ flŒr‡¤ ¤-rr‡¤ fflf„ ar— ¤⁄ r+ ·-+ Bhagavadg∂tå [Ch. 17 183 OÀ, TAT and SATóthis has been declared as the triple appellation of Brahma, who is Truth, Consciousness and Bliss. By that were the Bråhmaƒas and the Vedas as well as sacrifices created at the cosmic dawn. (23) at◊rŒrf◊-¤Œr¢ -¤ ¤-rŒrŸa¤—f∑˝¤r—– ¤˝fla-a fflœrŸr+r— ‚aa ’˝zrflrfŒŸr◊˜+ ·×+ Therefore, acts of sacrifice, charity and austerity, as enjoined by sacred precepts, are always commenced by noble persons, used to the recitation of Vedic chants, with the invocation of the divine name ëOÀí. (24) afŒ-¤Ÿf¤‚-œr¤ ¤‹ ¤-ra¤—f∑˝¤r—– ŒrŸf∑˝¤r‡¤ fflfflœr— f∑˝¤-a ◊rˇr∑rz˜ fˇrf¤—+ ·~+ With the idea that all this belongs to God, who is denoted by the appellation TAT, acts of sacrifice and austerity as well as acts of charity of various kinds, are performed by the seekers of liberation, expecting no return for them. (25) ‚Çrfl ‚rœ¤rfl ¤ ‚fŒ-¤a-¤˝¤º¤a– ¤˝‡rta ∑◊f¢r a¤r ‚-ø ªŒ— ¤r¤ ¤º¤a+ ·º+ The name of God, ëSATí, is used in the sense of reality and goodness. And the word ëSATí is also used in the sense of a praiseworthy, auspicious action, Arjuna. (26) Text 24ó26] Bhagavadg∂tå 184 ¤-r a¤f‚ ŒrŸ ¤ ft¤fa— ‚fŒfa ¤r-¤a– ∑◊ ¤fl aŒ¤t¤ ‚fŒ-¤flrf¤œt¤a+ ·¬+ And steadfastness in sacrifice, austerity and charity is likewise spoken of as ëSATí and action for the sake of God is verily termed as ëSATí. (27) •>rq¤r „ a Œ-r a¤tata ∑a ¤ ¤a˜– •‚fŒ-¤-¤a ¤r¤ Ÿ ¤ a-¤˝-¤ Ÿr ;„ + ·c+ An oblation which is offered, a gift given, an austerity practised, and whatever good deed is performed, if it is without faith, it is termed as naught i.e., ëasatí; therefore, it is of no avail here or hereafter. >izi·i¤lfl=iª¤iªi Ÿi◊ ‚-- seventeenth chapter entitled ìThe Yoga of the Division of the Threefold Faith.î Z Bhagavadg∂tå [Ch. 17 Chapter XVIII •¡È¸Ÿ © flÊø ‚--¤r‚t¤ ◊„ r’r„ r a-flf◊-ør f◊ flfŒa◊˜– -¤rnt¤ ¤ ¢ ¤t∑‡r ¤¤¤∑f‡rfŸ¤¸ŒŸ+ {+ Arjuna said: O mighty-armed ›r∂ K涃a, O inner controller of all, O Slayer of Ke‹i, I wish to know severally the truth of Sa≈nyåsa as also of Tyåga.(1) üÊË÷ªflÊŸÈ flÊø ∑r-¤rŸr ∑◊¢rr -¤r‚ ‚--¤r‚ ∑fl¤r fflŒ—– ‚fl∑◊¤‹-¤rn ¤˝r„ t-¤rn ffl¤ˇr¢rr—+ ·+ ›r∂ Bhagavån said : Some sages understand Sa≈nyåsa as the giving up of all actions motivated by desire; and the wise declare that Tyåga consists in relinquishing the fruit of all actions. (2) -¤rº¤ Œr¤flfŒ-¤∑ ∑◊ ¤˝r„ ◊Ÿtf¤¢r—– ¤-rŒrŸa¤—∑◊ Ÿ -¤rº¤f◊fa ¤r¤⁄ + -+ Some wise men declare that all actions contain a measure of evil, and are therefore, worth giving up; while others say that acts of sacrifice, charity and penance are not to be shunned. (3) 186 fŸ‡¤¤ n¢r ◊ a·r -¤rn ¤⁄ a‚-r◊– -¤rnr f„ ¤=¤√¤rrr˝ f·rfflœ— ‚-¤˝∑tfaa—+ ×+ Of Sa≈nyåsa and Tyåga, first hear My conclusion on the subject of renunciation (Tyåga), Arjuna; for renunciation, O tiger among men, has been declared to be of three kindsóSåttvika, Råjasika and Tåmasika. (4) ¤-rŒrŸa¤—∑◊ Ÿ -¤rº¤ ∑r¤◊fl aa˜– ¤-rr ŒrŸ a¤‡¤fl ¤rflŸrfŸ ◊Ÿtf¤¢rr◊˜+ ~+ Acts of sacrifice, charity and penance are not worth giving up; they must be performed. For sacrifice, charity and penanceóall these are purifiers to the wise men. (5) ∞ar-¤f¤ a ∑◊rf¢r ‚y -¤¤-flr ¤‹rfŸ ¤– ∑a√¤rŸtfa ◊ ¤r¤ fŸf‡¤a ◊a◊-r◊◊˜+ º+ Hence these acts of sacrifice, charity and penance, and all other acts of duty too, must be performed without attachment and expectation of reward : this is My well-considered and supreme verdict, Arjuna. (6) fŸ¤at¤ a ‚--¤r‚— ∑◊¢rr Ÿr¤¤ua– ◊r„ r-rt¤ ¤f⁄ -¤rntar◊‚— ¤f⁄ ∑tfaa—+ ¬+ (Prohibited acts and those that are motivated by desire should no doubt, be given up). But it is not advisable to abandon a prescribed duty. Such abandonment through ignorance has been declared as Tåmasika. (7) Bhagavadg∂tå [Ch. 18 187 Œ—πf◊-¤fl ¤-∑◊ ∑r¤¤‹‡r¤¤r-¤¬a˜– ‚ ∑-flr ⁄ r¬‚ -¤rn Ÿfl -¤rn¤‹ ‹¤a˜+ c + Should anyone give up his duties for fear of physical strain, thinking that all actions are verily painfulópractising such Råjasika form of renunciation, he does not reap the fruit of renunciation. (8) ∑r¤f◊-¤fl ¤-∑◊ fŸ¤a f∑˝¤a˘¬Ÿ– ‚y -¤¤-flr ¤‹ ¤fl ‚ -¤rn— ‚rf-fl∑r ◊a—+ º + A prescribed duty which is performed simply because it has to be performed, giving up attachment and fruit, that alone has been recognized as the Såttvika form of renunciation.(9) Ÿ çr≈ v∑‡r‹ ∑◊ ∑‡r‹ ŸrŸ¤¬ra– -¤rnt ‚-fl‚◊rfflr≈ r ◊œrflt fø -Ÿ‚‡r¤—+ {«+ He who has neither aversion for action which is leading to bondage nor attachment to that which is conducive to blessednessóimbued with the quality of goodness, he has all his doubts resolved, is intelligent and a man of true renunciation. (10)+ {{+ Since all actions cannot be given up in their entirety by anyone possessing a body, he alone who renounces the fruit of actions is called a man of renunciation. (11) Text 8ó11] Bhagavadg∂tå 188 •fŸr≈ f◊r≈ f◊>r ¤ f·rfflœ ∑◊¢r— ¤‹◊˜– ¤fl-¤-¤rfnŸr ¤˝-¤ Ÿ a ‚--¤rf‚Ÿr ¤flf¤a˜+ {·+ Agreeable, disagreeable and mixedóthreefold, indeed, is the fruit that accrues after death from the actions of the unrenouncing. But there is none whatsoever for those who have renounced. (12) ¤=¤arfŸ ◊„ r’r„ r ∑r⁄ ¢rrfŸ fŸ’rœ ◊– ‚rz˜ =¤ ∑ar-a ¤˝r+rfŸ f‚q¤ ‚fl∑◊¢rr◊˜+ {-+ In the branch of learning known as Så∆khya, which prescribes means for neutralizing all actions, the five factors have been mentioned as contributory to the accomplishment of all actions; know them all from Me, Arjuna. (13) •fœr∆ rŸ a¤r ∑ar ∑⁄ ¢r ¤ ¤¤fªflœ◊˜– fflfflœr‡¤ ¤¤¤¤r≈ r Œfl ¤flr·r ¤=¤◊◊˜+ {×+ The following are the factors operating towards the accomplishment of actions, viz., the body and the doer, the organs of different kinds and the different functions of manifold kinds; and the fifth is Daiva or Prårabdha Karma (destiny). (14) ‡r⁄ t⁄ flrz˜ ◊Ÿrf¤¤-∑◊ ¤˝r⁄ ¤a Ÿ⁄ —– -¤rƒ¤ flr ffl¤⁄ ta flr ¤=¤a at¤ „ afl—+ {~+ These five are the contributory causes of whatever actions, right or wrong, man performs with the mind, speech and body. (15) a·rfl ‚fa ∑ar⁄ ◊r-◊rŸ ∑fl‹ a ¤—– ¤‡¤-¤∑a’fq-flr -Ÿ ‚ ¤‡¤fa Œ◊fa—+ {º+ Bhagavadg∂tå [Ch. 18 189 Notwithstanding this, however, he who, having an impure mind, regards the absolute, taintless Self alone as the doer, that man of perverse understanding does not view aright. (16) ¤t¤ Ÿr„ z˜ ∑ar ¤rflr ’fq¤t¤ Ÿ f‹t¤a– „ -flrf¤ ‚ ;◊rr‹r∑r-Ÿ „ f-a Ÿ fŸ’·¤a+ {¬+ He whose mind is free from the sense of doership, and whose reason is not affected by worldly objects and activities, does not really kill, even having killed all these people, nor does any sin accrue to him. (17) -rrŸ -r¤ ¤f⁄ -rrar f·rfflœr ∑◊¤rŒŸr– ∑⁄ ¢r ∑◊ ∑afa f·rfflœ— ∑◊‚z˜ n˝„ —+ {c+ The Knower, knowledge and the object of knowledgeóthese three motivate action. Even so, the doer, the organs and activityóthese are the three constituents of action. (18) -rrŸ ∑◊ ¤ ∑ar ¤ f·rœfl n¢r¤Œa—– ¤˝r-¤a n¢r‚z˜ =¤rŸ ¤¤rfl-ø ¢r ar-¤f¤+ {º+ In the branch of knowledge dealing with the Guƒas or modes of Prakæti, knowledge and action as well as the doer have been declared to be of three kinds according to the Guƒa which predo- minates in each; hear them too duly from Me. (19) ‚fl¤¸a¤ ¤Ÿ∑ ¤rfl◊√¤¤◊tˇra– •ffl¤+ ffl¤+¤ aº-rrŸ fflfq ‚rf-fl∑◊˜+ ·«+ That by which man perceives one imperishable Text 17ó20] Bhagavadg∂tå 190 divine existence as undivided and equally present in all individual beings, know that knowledge to be Såttvika. (20) ¤¤¤-flŸ a ¤º-rrŸ ŸrŸr¤rflr-¤¤fªflœrŸ˜– flf-r ‚fl¤ ¤¸a¤ aº-rrŸ fflfq ⁄ r¬‚◊˜+ ·{+ The knowledge by which man cognizes many existences of various kinds, as apart from one another, in all beings, know that knowledge to be Råjasika. (21) ¤-r ∑-tŸflŒ∑ft◊-∑r¤ ‚+◊„ a∑◊˜– •a-flr¤flŒr¤ ¤ a-rr◊‚◊Œr¢ a◊˜+ ··+ Again, that knowledge which clings to one body as if it were the whole, and which is irrational, has no real grasp of truth and is trivial, has been declared as Tåmasika. (22) fŸ¤a ‚y ⁄ f„ a◊⁄ rnç¤a— ∑a◊˜– •¤‹¤˝t‚Ÿr ∑◊ ¤-r-‚rf-fl∑◊-¤a+ ·-+ That action which is ordained by the scriptures and is not accompanied by the sense of doership, and has been done without any attachment or aversion by one who seeks no return, is called Såttvika. (23) ¤-r ∑r◊t‚Ÿr ∑◊ ‚r„ ¿ r⁄ ¢r flr ¤Ÿ—– f∑˝¤a ’„ ‹r¤r‚ a¢˝r¬‚◊Œr¢ a◊˜+ ·×+ That action however, which involves much strain and is performed by one who seeks enjoyments or by a man full of egotism, has been spoken of as Råjasika. (24) Bhagavadg∂tå [Ch. 18 191 •Ÿ’-œ ˇr¤ f„ ‚r◊Ÿflˇ¤ ¤ ¤r=¤◊˜– ◊r„ rŒr⁄ +¤a ∑◊ ¤-r-rr◊‚◊-¤a+ ·~+ That action which is undertaken through sheer ignorance, without regard to consequences or loss to oneself, injury to others and oneís own resourcefulness, is declared as Tåmasika. (25) ◊+‚y r˘Ÿ„ flrŒt œ-¤-‚r„ ‚◊f-fla—– f‚qvf‚qvrfŸffl∑r⁄ — ∑ar ‚rf-fl∑ s -¤a+ ·º+ Free from attachment, unegoistic, endowed with firmness and zeal and unswayed by success and failureósuch a doer is said to be Såttvika. (26) ⁄ rnt ∑◊¤‹¤˝t‚‹ªœr f„ ‚r-◊∑r˘‡rf¤—– „ ¤‡rr∑rf-fla— ∑ar ⁄ r¬‚— ¤f⁄ ∑tfaa—+ ·¬+ The doer who is full of attachment, seeks the fruit of actions and is greedy, and who is oppressive by nature and of impure conduct, and is affected by joy and sorrow, has been called Råjasika.(27) •¤+— ¤˝r∑a— taªœ— ‡r∆ r˘Ÿr∑fa∑r˘‹‚—– ffl¤rŒt Œtrr‚¸·rt ¤ ∑ar ar◊‚ s -¤a+ ·c+ Lacking piety and self-control, uncultured, arrogant, deceitful, inclined to rob others of their livelihood, slothful, despondent and procrasti- natingósuch a doer is called Tåmasika. (28) ’q¤Œ œa‡¤fl n¢raft·rfflœ n¢r– ¤˝r-¤◊rŸ◊‡r¤¢r ¤¤¤-flŸ œŸ=¬¤+ ·º+ Now hear, Arjuna, the threefold divison, based on the predominance of each Guƒa, of Text 25ó29] Bhagavadg∂tå 192 understanding (Buddhi) and firmness (Dhæti), which I shall explain in detail, one by one. (29) ¤˝flf-r ¤ fŸflf-r ¤ ∑r¤r∑r¤ ¤¤r¤¤– ’-œ ◊rˇr ¤ ¤r flf-r ’fq— ‚r ¤r¤ ‚rf-fl∑t+ -«+ The intellect which correctly determines the paths of activity and renunciation, what ought to be done and what should not be done, what is fear and what is fearlessness, and what is bondage and what is liberation, that intellect is Såttvika.(30) ¤¤r œ◊◊œ◊ ¤ ∑r¤ ¤r∑r¤◊fl ¤– •¤¤rfl-¤˝¬rŸrfa ’fq— ‚r ¤r¤ ⁄ r¬‚t+ -{+ The intellect by which man does not truly perceive what is Dharma and what is Adharma, what ought to be done and what should not be doneóthat intellect is Råjasika. (31) •œ◊ œ◊f◊fa ¤r ◊-¤a a◊‚rflar– ‚flr¤rf-fl¤⁄ tar‡¤ ’fq— ‚r ¤r¤ ar◊‚t+ -·+ The intellect which imagines even Adharma to be Dharma, and sees all other things upside- downówrapped in ignorance, that intellect is Tåmasika, Arjuna. (32) œ-¤r ¤¤r œr⁄ ¤a ◊Ÿ—¤˝r¢rf-¢˝¤f∑˝¤r—– ¤rnŸr√¤f¤¤rf⁄ ¢¤r œfa— ‚r ¤r¤ ‚rf-fl∑t+ --+ The unwavering firmness by which man controls through the Yoga of meditation the functions of the mind, the vital airs and the sensesóthat firmness, Arjuna, is Såttvika. (33) Bhagavadg∂tå [Ch. 18 193 ¤¤r a œ◊∑r◊r¤r-œ-¤r œr⁄ ¤a˘¬Ÿ– ¤˝‚y Ÿ ¤‹r∑rz˜ ˇrt œfa— ‚r ¤r¤ ⁄ r¬‚t+ -×+ The firmness (Dhæti), however, by which the man seeking reward for his actions clutches with extreme fondness virtues, earthly possessions and worldly enjoymentsóthat firmness (Dhæti) is said to be Råjasika, Arjuna. (34) ¤¤r tfltŸ ¤¤ ‡rr∑ ffl¤rŒ ◊Œ◊fl ¤– Ÿ ffl◊=¤fa Œ◊œr œfa— ‚r ¤r¤ ar◊‚t+ -~+ The firmness (Dhæti) by which an evil-minded person does not give up sleep, fear, anxiety, sorrow and vanity as well, that firmness is Tåmasika.(35) ‚π f-flŒrŸt f·rfflœ n¢r ◊ ¤⁄ a¤¤– •+¤r‚r¢˝◊a ¤·r Œ—πr-a ¤ fŸn-ø fa+ -º+ ¤-rŒn˝ ffl¤f◊fl ¤f⁄ ¢rr◊˘◊ar¤◊◊˜– a-‚π ‚rf-fl∑ ¤˝r+◊r-◊’fq¤˝‚rŒ¬◊˜+ -¬+ Now hear from Me the threefold joy too. That in which the striver finds enjoyment through practice of adoration, meditation and service to God etc., and whereby he reaches the end of sorrowósuch a joy, though appearing as poison in the beginning, tastes like nectar in the end; hence that joy, born as it is of the placidity of mind brought about by meditation on God, has been declared as Såttvika. (36-37) ffl¤¤f-¢˝¤‚¤rnru-rŒn˝˘◊ar¤◊◊˜ – ¤f⁄ ¢rr◊ ffl¤f◊fl a-‚π ⁄ r¬‚ t◊a◊˜+ -c+ Text 34ó38] Bhagavadg∂tå 194 The delight which follows from the contact of the senses with their objects is eventually poison- like, though appearing at first as nectar; hence it has been spoken of as Råjasika. (38) ¤Œn˝ ¤rŸ’-œ ¤ ‚π ◊r„ Ÿ◊r-◊Ÿ—– fŸ¢˝r‹t¤¤˝◊rŒr-¤ a-rr◊‚◊Œr¢ a◊˜+ -º+ That which stupefies the self during its enjoyment as well as in the endóderived from sleep, indolence and obstinate error, such delight has been called Tåmasika. (39) Ÿ aŒfta ¤f¤√¤r flr fŒffl Œfl¤ flr ¤Ÿ—– ‚-fl ¤˝∑fa¬◊+ ¤Œf¤— t¤rf-·rf¤n¢r—+ ׫+ There is no being on earth, or even among the gods in heaven or anywhere else, who is free from these three Guƒas, born of Prakæti. (40) ’˝rzr¢rˇrf·r¤ffl‡rr ‡r¸¢˝r¢rr ¤ ¤⁄-a¤– ∑◊rf¢r ¤˝ffl¤+rfŸ tfl¤rfl¤˝¤fln¢r—+ ×{+ The duties of the Bråhmaƒas, the K¶atriyas and the Vai‹yas, as well as of the ›µudras have been assigned according to their inborn qualities, Arjuna. (41) ‡r◊r Œ◊ta¤— ‡rr¤ ˇrrf-a⁄ r¬fl◊fl ¤– -rrŸ ffl-rrŸ◊rfta¤¤ ’˝zr∑◊ tfl¤rfl¬◊˜+ ×·+ Subjugation of the mind and senses, enduring hardships for the discharge of oneís sacred obligations, external and internal purity, forgiving the faults of others, straightness of mind, senses Bhagavadg∂tå [Ch. 18 195 and behaviour, belief in the Vedas and other scriptures, God and life after death etc., study and teaching of the Vedas and other scriptures and realization of the truth relating to Godóall these constitute the natural duties of a Bråhmaƒa.(42) ‡rr¤ a¬r œfaŒrˇ¤ ¤q ¤rt¤¤‹r¤Ÿ◊˜– ŒrŸ◊t‡fl⁄ ¤rfl‡¤ ˇrr·r ∑◊ tfl¤rfl¬◊˜+ ×-+ Heroism, majesty, firmness, diligence and dauntlessness in battle, bestowing gifts, and lordlinessóall these constitute the natural duty of a K¶atriya. (43) ∑f¤nr⁄ ˇ¤flrf¢rº¤ fl‡¤∑◊ tfl¤rfl¬◊˜– ¤f⁄ ¤¤r-◊∑ ∑◊ ‡r¸¢˝t¤rf¤ tfl¤rfl¬◊˜+ ××+ Agriculture, rearing of cows and honest exchange of merchandiseóthese constitute the natural duty of a Vai‹ya (a member of the trading class); and service of the other classes is the natural duty even of a ›µudra (a member of the labouring class). (44) tfl tfl ∑◊¢¤f¤⁄ a— ‚f‚fq ‹¤a Ÿ⁄ —– tfl∑◊fŸ⁄ a— f‚fq ¤¤r ffl-Œfa a-ø ¢r+ ×~+ Keenly devoted to his own natural duty, man attains the highest perfection in the shape of God- realization. Hear the mode of performance whereby the man engaged in his inborn duty reaches that highest consummation. (45) ¤a— ¤˝flf-r¤¸arŸr ¤Ÿ ‚flf◊Œ aa◊˜– tfl∑◊¢rr a◊+¤-¤ f‚fq ffl-Œfa ◊rŸfl—+ ׺+ Text 43ó46] Bhagavadg∂tå 196 By worshipping Him from whom all beings come into being and by whom the whole universe is pervaded, through the performance of his own natural duties, man attains the highest perfection. (46) >r¤r-tflœ◊r ffln¢r— ¤⁄ œ◊r-tflŸfr∆ ara˜– tfl¤rflfŸ¤a ∑◊ ∑fl-ŸrtŸrfa f∑fr’¤◊˜+ ׬+ Better is oneís own duty, though devoid of merit, than the duty of another well-performed; for performing the duty ordained by his own nature, man does not incur sin. (47) ‚„ ¬ ∑◊ ∑r-a¤ ‚Œr¤◊f¤ Ÿ -¤¬a˜– ‚flr⁄ -¤r f„ Œr¤¢r œ¸◊ŸrfªŸf⁄ flrflar—+ ×c+ Therefore, Arjuna, one should not relinquish oneís innate duty, even though it has a measure of evil; for all undertakings are beset by some evil, as is the fire covered by smoke. (48) •‚+’fq— ‚fl·r f¬ar-◊r fflnat¤„ —– Ÿr∑-¤f‚fq ¤⁄ ◊r ‚--¤r‚Ÿrfœn-ø fa+ ׺+ He whose intellect is unattached everywhere, whose thirst for enjoyment has altogether disappeared and who has subdued his mind, reaches through Så∆khyayoga (the path of Knowledge) the consummation of actionlessness. (49) f‚fq ¤˝rtar ¤¤r ’˝zr a¤rtŸrfa fŸ’rœ ◊– ‚◊r‚Ÿfl ∑r-a¤ fŸr∆r -rrŸt¤ ¤r ¤⁄ r + ~«+ Arjuna, know from Me only briefly the process Bhagavadg∂tå [Ch. 18 197 through which man having attained actionlessness, which is the highest consummation of J¤ånayoga (the path of Knowledge), reaches Brahma. (50) ’qvr ffl‡rq¤r ¤+r œ-¤r-◊rŸ fŸ¤-¤ ¤– ‡rªŒrŒtf-fl¤¤rt-¤¤-flr ⁄ rnç¤ı √¤Œt¤ ¤+ ~{+ fflffl+‚flt ‹rflr‡rt ¤aflr¤∑r¤◊rŸ‚—– ·¤rŸ¤rn¤⁄ r fŸ-¤ fl⁄ rª¤ ‚◊¤rf>ra—+ ~·+ •„ ¿ r⁄ ’‹ Œ¤ ∑r◊ ∑˝rœ ¤f⁄ n˝„ ◊˜– ffl◊-¤ fŸ◊◊— ‡rr-ar ’˝zr¤¸¤r¤ ∑r¤a+ ~-+ Endowed with a pure intellect and partaking of a light, Såttvika and regulated diet, living in a lonely and undefiled place having rejected sound and other objects of sense, having controlled the mind, speech and body by restraining the mind and senses through firmness of a Såttvika type, taking a resolute stand on dispassion, after having completely got rid of attraction and aversion and remaining ever devoted to the Yoga of meditation, having given up egotism, violence, arrogance, lust, anger and luxuries, devoid of the feeling of meum and tranquil of heartósuch a man becomes qualified for oneness with Brahma, who is Truth, Consciousness and Bliss. (51ó53) ’˝zr¤¸a— ¤˝‚-Ÿr-◊r Ÿ ‡rr¤fa Ÿ ∑rz˜ ˇrfa– ‚◊— ‚fl¤ ¤¸a¤ ◊Çf+ ‹¤a ¤⁄ r◊˜+ ~×+ Established in identity with Brahma (who is Truth, Consciousness and Bliss solidified), and Text 51ó54] Bhagavadg∂tå 198 cheerful in mind, the Så∆khyayog∂ no longer grieves nor craves for anything. The same to all beings, such a Yog∂ attains supreme devotion to Me. (54) ¤¤-¤r ◊r◊f¤¬rŸrfa ¤rflr-¤‡¤rft◊ a-fla—– aar ◊r a-flar -rr-flr ffl‡ra aŒŸ-a⁄ ◊˜+ ~~+ Through that supreme devotion he comes to know Me in reality, what and who I am; and thereby knowing Me truly, he forthwith merges into My being. (55) ‚fl∑◊r¢¤f¤ ‚Œr ∑flr¢rr ◊Œ˜√¤¤r>r¤—– ◊-¤˝‚rŒrŒflrtŸrfa ‡rr‡fla ¤Œ◊√¤¤◊˜+ ~º+ The Karmayog∂, however, who depends on Me, attains by My grace the eternal, imperishable state, even though performing all actions. (56) ¤a‚r ‚fl∑◊rf¢r ◊f¤ ‚--¤t¤ ◊-¤⁄ —– ’fq¤rn◊¤rf>r-¤ ◊f¤r-r— ‚aa ¤fl+ ~¬+ Mentally dedicating all your actions to Me, and taking recourse to Yoga in the form of even- mindedness, be solely devoted to Me and constantly fix your mind on Me. (57) ◊f¤r-r— ‚flŒnrf¢r ◊-¤˝‚rŒr-rf⁄ r¤f‚– •¤ ¤-fl◊„ ¿ r⁄ r-Ÿ >rrr¤f‚ fflŸz˜ ˇ¤f‚+ ~c+ With your mind thus devoted to Me, you shall, by My grace overcome all difficulties. But, if from self-conceit you do not care to listen to Me, you will be lost. (58) Bhagavadg∂tå [Ch. 18 199 ¤Œ„ ¿ r⁄ ◊rf>r-¤ Ÿ ¤r-t¤ ;fa ◊-¤‚– f◊º¤¤ √¤fl‚r¤ta ¤˝∑fat-flr fŸ¤rˇ¤fa+ ~º+ If, taking your stand on egotism, you think, ìI will not fight,î vain is this resolve of yours; nature will drive you to the act. (59) tfl¤rfl¬Ÿ ∑r-a¤ fŸ’q— tflŸ ∑◊¢rr– ∑a Ÿ-ø f‚ ¤-◊r„ r-∑f⁄ r¤t¤fl‡rr˘f¤ aa˜+ º«+ That action, too, which you are not willing to undertake through ignorance you will perforce perform, bound by your own duty born of your nature. (60) ;‡fl⁄ — ‚fl¤¸arŸr ¢ z‡r˘¬Ÿ far∆ fa– ¤˝r◊¤-‚fl¤¸arfŸ ¤-·rr=… rfŸ ◊r¤¤r+ º{+ Arjuna, God abides in the heart of all creatures, causing them to revolve according to their Karma by His illusive power (Måyå) as though mounted on a machine. (61) a◊fl ‡r⁄ ¢r n-ø ‚fl¤rflŸ ¤r⁄ a– a-¤˝‚rŒr-¤⁄ r ‡rrf-a t¤rŸ ¤˝rtt¤f‚ ‡rr‡fla◊˜+ º·+ Take refuge in Him alone with all your being, Arjuna. By His mere grace you will attain supreme peace and the eternal abode. (62) ;fa a -rrŸ◊r=¤ra nnrŒ˜nna⁄ ◊¤r– ffl◊‡¤aŒ‡r¤¢r ¤¤-ø f‚ a¤r ∑=+ º-+ Thus, has this wisdom, more profound than all profundities, been imparted to you by Me; deeply pondering over it, now do as you like. (63) Text 59ó63] Bhagavadg∂tå 200 ‚flnna◊ ¤¸¤— n¢r ◊ ¤⁄ ◊ fl¤—– ;r≈ r˘f‚ ◊ Œ… f◊fa aar flˇ¤rf◊ a f„ a◊˜+ º×+ Hear, again, My supremely profound words, the most esoteric of all truths; as you are extremely dear to Me, therefore, I shall give you this salutary advice for your own good. (64) ◊-◊Ÿr ¤fl ◊Ç+r ◊ur¬t ◊r Ÿ◊t∑=– ◊r◊flr¤f‚ ‚-¤ a ¤˝fa¬rŸ f¤˝¤r˘f‚ ◊+ º~+ Give your mind to Me, be devoted to Me, worship Me and bow to Me. Doing so, you will come to Me alone, I truly promise you; for, you are exceptionally dear to Me. (65) ‚flœ◊r-¤f⁄ -¤º¤ ◊r◊∑ ‡r⁄ ¢r fl˝¬– •„ -flr ‚fl¤r¤+¤r ◊rˇrf¤r¤rf◊ ◊r ‡r¤—+ ºº+ Resigning all your duties to Me, the all-powerful and all supporting Lord, take refuge in Me alone; I shall absolve you of all sins, worry not. (66) ;Œ a Ÿra¤t∑r¤ Ÿr¤+r¤ ∑Œr¤Ÿ– Ÿ ¤r‡r>r¸¤fl flr-¤ Ÿ ¤ ◊r ¤r˘+¤‚¸¤fa+ º¬+ This secret gospel of the G∂tå should never be imparted to a man who lacks in austerity, nor to him who is wanting in devotion, nor even to him who is not willing to hear; and in no case to him who finds fault with Me. (67) ¤ ;◊ ¤⁄ ◊ nn ◊Ç+rflf¤œrt¤fa– ¤f¤a ◊f¤ ¤⁄ r ∑-flr ◊r◊flr¤-¤‚‡r¤—+ ºc+ Bhagavadg∂tå [Ch. 18 201 He who, offering the highest love to Me, preaches the most profound gospel of the G∂tå among My devotees, shall come to Me alone; there is no doubt about it. (68) Ÿ ¤ at◊r-◊Ÿr¤¤ ∑f‡¤-◊ f¤˝¤∑-r◊—– ¤fflar Ÿ ¤ ◊ at◊rŒ-¤— f¤˝¤a⁄ r ¤ffl+ ºº+ Among men there is none who does Me a more loving service than he; nor shall anyone be dearer to Me on the entire globe than he. (69) •·¤r¤a ¤ ¤ ;◊ œ-¤ ‚flrŒ◊rfl¤r—– -rrŸ¤-rŸ aŸr„ f◊r≈ — t¤rf◊fa ◊ ◊fa—+ ¬«+ Whosoever studies this sacred dialogue of ours in the form of the G∂tå, by him too shall I be worshipped with Yaj¤a of Knowledge; such is My conviction. (70) >rqrflrŸŸ‚¸¤‡¤ n¢r¤rŒf¤ ¤r Ÿ⁄ —– ‚r˘f¤ ◊+— ‡r¤rr‹r∑r-¤˝rtŸ¤r-¤¢¤∑◊¢rr◊˜+ ¬{+ The man who listens to the holy G∂tå with reverence, being free from malice, he too, liberated from sin, shall reach the propitious worlds of pious and the virtuous. (71) ∑f¤rŒa-ø˛‰ a ¤r¤ -fl¤∑rn˝¢r ¤a‚r– ∑f¤rŒ-rrŸ‚-◊r„ — ¤˝Ÿr≈ ta œŸ=¬¤+ ¬·+ Have you, O Arjuna, heard this gospel of the Text 69ó72] Bhagavadg∂tå 202 G∂tå attentively? And has your delusion born of ignorance been destroyed, O Dhana¤jaya, conqueror of riches? (72) •¡È¸Ÿ © flÊø Ÿr≈ r ◊r„ — t◊fa‹ªœr -fl-¤˝‚rŒr-◊¤r-¤a– ft¤ar˘ft◊ na‚-Œ„ — ∑f⁄ r¤ fl¤Ÿ afl+ ¬-+ Arjuna said: K涃a, by Your grace my delusion has been destroyed and I have gained wisdom. I am free of all doubt. I shall do your bidding.(73) ‚Ü¡ÿ © flÊø ;-¤„ flr‚Œflt¤ ¤r¤t¤ ¤ ◊„ r-◊Ÿ—– ‚flrŒf◊◊◊>rr¤◊Ça ⁄ r◊„ ¤¢r◊˜+ ¬×+ Sa¤jaya said: Thus I heard the mysterious and thrilling conversation between ›r∂ K涃a and the high-souled Arjuna, the son of Kunt∂. (74) √¤r‚¤˝‚rŒr-ø˛‰ aflrŸaŒ˜nn◊„ ¤⁄ ◊˜– ¤rn ¤rn‡fl⁄ r-∑r¢rr-‚rˇrr-∑¤¤a— tfl¤◊˜+ ¬~+ Having been blessed with the divine vision by the grace of ›r∂ Vyåsa, I heard in person this supremely esoteric gospel from the Lord of Yoga, ›r∂ K涃a Himself, imparting it to Arjuna. (75) ⁄ r¬-‚t◊-¤ ‚t◊-¤ ‚flrŒf◊◊◊Ça◊˜– ∑‡rflr¬Ÿ¤r— ¤¢¤ ¢ r¤rf◊ ¤ ◊„ ◊„ —+ ¬º+ Remembering, over and over, that sacred and Bhagavadg∂tå [Ch. 18 203 mystic conversation between Bhagavån ›r∂ K涃a and Arjuna, O King! I rejoice again and yet again. (76) a¤r ‚t◊-¤ ‚t◊-¤ =¤◊-¤Ça „ ⁄ —– fflt◊¤r ◊ ◊„ r-⁄ r¬-¢ r¤rf◊ ¤ ¤Ÿ— ¤Ÿ—+ ¬¬+ Remembering also, again and again, that most wonderful form of ›r∂ K涃a, great is my wonder and I rejoice over and over again. (77) ¤·r ¤rn‡fl⁄ — ∑r¢rr ¤·r ¤r¤r œŸœ⁄ —– a·r >rtffl¬¤r ¤¸faœ˝flr Ÿtfa◊fa◊◊+ ¬c+ Wherever there is Bhagavån ›r∂ K涃a, the Lord of Yoga, and wherever there is Arjuna, the wielder of the G僌∂va bow, goodness, victory, glory and unfailing righteousness will surely be there : such is My conviction. (78) ◊iˇi‚--¤i‚¤iªi Ÿi◊i· eighteenth chapter entitled ìThe Yoga of Liberation through the Path of Knowledge and Self-Surrender.î Z O≈ Tat Sat Text 77-78] Bhagavadg∂tå •r⁄ at ¬¤ ¤nflŒ˜nta, ¬¤ ¤nflŒ˜nta– „ f⁄ -f„ ¤-∑◊‹-ffl„ rf⁄ f¢r, ‚-Œ⁄ ‚¤Ÿta + ¬¤« ∑◊-‚◊◊-¤˝∑rf‡rfŸ, ∑r◊r‚f¤a„ ⁄ r– a-fl-rrŸ-ffl∑rf‡rfŸ, fflur ’˝zr ¤⁄ r+ ¬¤« fŸ‡¤‹-¤f¤a-fflœrf¤fŸ, fŸ◊‹ ◊‹„ r⁄ t– ‡r⁄ ¢r-⁄ „ t¤-¤˝Œrf¤fŸ, ‚’ fflfœ ‚π∑r⁄ t+ ¬¤« ⁄ rn-ç¤-fflŒrf⁄ f¢r ∑rf⁄ f¢r ◊rŒ ‚Œr– ¤fl-¤¤-„ rf⁄ f¢r, arf⁄ f¢r, ¤⁄ ◊rŸ-Œ¤˝Œr+ ¬¤« •r‚⁄¤rfl-fflŸrf‡rfŸ, Ÿrf‡rfŸ a◊-⁄ ¬Ÿt– Œflt ‚Œ˜n¢rŒrf¤fŸ, „ f⁄ -⁄ f‚∑r ‚¬Ÿt+ ¬¤« ‚◊ar--¤rn f‚πrflfŸ, „ f⁄ -◊π∑t ’rŸt– ‚∑‹ ‡rrt·r∑t tflrf◊fŸ, >rfa¤r∑t ⁄ rŸt+ ¬¤« Œ¤r-‚œr ’⁄ ‚rflfŸ ◊ra! ∑¤r ∑t¬– „ f⁄ ¤Œ-¤˝◊ ŒrŸ ∑⁄ •¤Ÿr ∑⁄ ‹t¬+ ¬¤« Z God-realization through Practice of Renunciation + Living even the life of a householder, man can realize God through the practice of renunciation. Indeed, ërenunciationí is the principal means for attaining God. Therefore, dividing them into seven classes, the marks of renunciation are being shortly written below. (1) Total Renunciation of Prohibited Acts This is non-performance, in anyway whatsoever, through mind, speech and the body, low acts prohibited by the scriptures, such as, theft, adultery, falsehood, deception, fraud, oppression, violence, taking of interdicted food and wrong-doing, etc. (2) Renunciation of Acts performed for the Satisfaction of Worldly Desires This is non-performance of sacrifices, charities, austerities, worship and other desire-born actions, with a selfish motive,* for gaining objects of enjoyment, e.g., wife, progeny, and wealth, etc., or with the object of curing diseases and terminating other forms of suffering. This is the second type of renunciation. (3) Total Renunciation of Worldly Thirst Honour, fame, social prestige, wife, progeny, wealth and whatever other transient objects are automatically gained by the force of Prårabdha (Karma, which has begun to bear fruit), the desire for their increase should be regarded as an obstacle in God-realization, and renounced. This is the third type of renunciation. (4) Renunciation of the Habit of Extracting Service from Others with a Selfish Motive Asking for money, or demanding service from * If under the pressure of circumstance, one is compelled to do an act sanctioned by tradition and the scriptures, which is by nature rooted in desire, but non- performance of which causes pain to anybody or adversely affects the traditional ways of Action and worship, performance of it disinterestedly, and only for general good, is not an act of the satisfaction of desire. 206 another, for personal happiness; and acceptance of things and service given without oneís asking for the same; or entertaining any desire in the mind for getting by any means oneís self-interest served by another; all these and similar ideas of getting service from another for the satisfaction of self-interest should be renounced.* This is the fourth type of renunciation. (5) Total Renunciation of Indolence and Desire for Fruit in the Performance of all Duties Whatever duties there are, e.g., cultivation of devotion to God, worship of the celestials, service of the parents and other elders, performance of * If non-acceptance of physical service from another, or offer of eatables by another, where one is entitled to accept such service or offer, causes any pain to anyone, or in anyway hinders the education of the people, in that case, acceptance of service, abandoning selfishness, and only for the pleasure of the offerer of service, is not harmful. For non-acceptance of service done by the wife, son or servant, or of eatables offered by friends and relatives, is likely to cause them pain and may prove harmful, so far as propriety of social conduct is concerned. 207 sacrifices, charities and austerities, maintenance of the household through the earning of livelihood by means of works assigned according to the Varƒå‹rama system, and taking of food and drink, etc., for the bodyóin the performance of these, indolence and every form of desire should be renounced. (A) Renunciation of Indolence in the Practice of Devotion to God Regarding it as the supreme duty of oneís life, one should hear, reflect on, read and discourse on the mysterious stories of the virtue, glory and Love of God, who is extremely compassionate, friend of all, the best of lovers, the knower of the heart, and renouncing idleness practise constant Japa, together with meditation, of His extremely hallowed Name. (B) Renunciation of Desire in the Practice of Devotion to God Regarding all enjoyments of this world and the next as transient and perishable and hindrances in the path of Devotion to God, no prayer should 208 be offered to God for obtaining any object whatsoever, nor any desire should be entertained in the mind for the same. Also, prayer should not be offered to God for the removal of any trouble even when one is overtaken by it; in other words, the thought should be cultivated in the mind that to sacrifice life is preferable to bringing stain on the purity of Bhakti for the sake of this false existence. For instance, Prahlåda, even though intensely persecuted by his father, never offered any prayer to God for the removal of his distress. Curse with harsh expressions, such as, ìLet the chastizement of God be on Youî, etc., should not be pronounced even against the persecutor, or one who does any injury, and no thought of counter- injury should be entertained against him. Out of pride of attainment in the path of Devotion, benedictions should not be pronounced in words, such as, ìMay God restore you to healthî, ìMay God remove your distressî, ìMay God grant you a long lifeî, etc. 209 In correspondence also, words of worldly interest should not be written. In Mårawår∂ society, there is a general custom of writing such words of worldly import in the form of prayer to God for obtaining worldly objects e.g., ìGod is our helper here and elsewhereî, ìGod will advance our salesî, ìGod will bring a good monsoonî, ìGod will remove the ailmentî, etc. Instead of this, auspicious, disinterested words, such as, ìGod in His state of Bliss exists everywhereî, ìPerformance of Bhajana is the essence of everythingî, etc., should be written and other than these no word of worldly interest should be written or uttered. (C) Renunciation of Indolence and Desire in Connection with the Worship of Celestials There is Godís instruction to offer worship to the celestials, who are worthy of being worshipped, during the time appointed for such worship, according to the scriptures as well as tradition. Regarding the carrying out of Godís instruction as oneís supreme duty, such worship should be offered to a celestial with enthusiasm, according to the prescribed rules, without expression of any 210 desire for the satisfaction of any worldly interest. With the object of such worship, words implying worldly interest should not be written on the cash-book, and other books of account. For instance, in Mårawår∂ society there is a custom on the New Year or D∂wål∂ day, after the worship of Goddess Lak¶m∂, to write many words implying worldly desire, such as, ìGoddess Lak¶m∂ will bring profitî, ìThe store will be kept fullî, ìProsperity and success will be broughtî, ìUnder the protection of Goddess Kål∂î, ìUnder the protection of Goddess Ga∆gåî, etc. These should be substituted by unselfish, auspicious words, such as, ì›r∂ Lak¶m∂nåråyaƒa, in the form of Bliss, is present everywhereî, or ìGoddess Lak¶m∂ has been worshipped with great delight and enthusiasm.î Similarly, while writing the daily cash-book, this procedure should be followed. (D) Renunciation of Indolence and Desire in the Service of Parents and other Elders It is manís supreme duty to render daily services, in all possible ways, to parents, the preceptor, and other persons who are oneís superior in Varƒa, Å‹rama, age, qualifications, or in whatever other 211 respect it may be, and daily offer them obeisances. Cultivating this thought in the mind, and abandoning all idleness, disinterested, enthusiastic, and according to Godís behests, services should be rendered to them. (E) Renunciation of Indolence and Desire in the Performance of Sacrifices, Charities, Austerities and other Auspicious Deeds Sacrifices, e. g., the daily obligatory five Great Sacrifices*, and other occasional sacrifices, should be performed. Through gifts of food, clothing, learning, medicine, and wealth, etc., attempt should be made, according to oneís capacity, to make all creatures happy, through mind, speech and the body. Similarly, all forms of bodily suffering should be undergone for the preservation of Dharma. These * The five Great Sacrifices are as follows:ó(1) Sacrifice to gods (performance of Agnihotra, etc.); (2) Sacrifice to §R¶is (study of the Vedas, performance of Sandhyå and Japa of Gåyatr∂, etc.); (3) Sacrifice to the Manes (performance of Tarpaƒa, ›råddha etc.); (4) Sacrifice to Men (entertainment of guests); (5) Sacrifice to all created beings (performance of Balivai‹vadeva). 212 duties enjoined by the scriptures should be performed, with faith and enthusiasm, according to Godís behests, regarding them as supremely important, wholly renouncing the desire for all kinds of enjoyment of this world and the next. (F) Renunciation of Indolence and Desire in the Performance of proper Work for Maintenance of the Family through earning of Livelihood It is Godís injunction that the family should be maintained through service to the world by performing duties laid down in the scriptures for the respective Varƒas and Å‹ramas, even as agriculture, cattle-breeding and trade have been laid down as the works of livelihood for the Vai‹ya. Therefore, regarding them as duties, treating profit and loss as equal, and renouncing all forms of desire such works should be enthusiastically performed.* * Works performed by a person in the above spirit, being freed from greed, cannot be tainted by evil in anyway, for in works of livelihood greed is the particular cause which leads one to the commission of sin. Therefore, just as Vai‹yas have been advised at length to give up evil practices 213 (G) Renunciation of Indolence and Desirein Work for Preservation of the Body In work for preservation of the body, according to the scriptures, e.g., pertaining to food, dress, medicines etc., the desire for enjoyment should be renounced. They should be performed, according to the needs of the occasion, only with the object of God-realization, regarding pleasure and pain, profit and loss, life and death as equal. Together with the four types of renunciation stated above, when according to this fifth type of renunciation, all evils and all forms of desire are destroyed, and there remains only the one strong desire for God-realization, it should be regarded as the mark of the person, who has attained ripeness in the first stage of Wisdom. connected with trade in the footnote of the Hindi rendering of Chapter XVIII verse 44 of the edition of the G∂tå published by the Gita Press, Gorakhpur, even so men should renounce all forms of evil connected with their respective duties as laid down by the Varƒå‹rama system, and perform all their duties, for Godís sake, disinterestedly, regarding them as injunctions of God. 214 (6) Total Renunciation of the Sense of Meum and Attachment with regard to all Worldly objects and Activities All worldly objects like wealth, house, clothes, etc., all relations like the wife, child, friends, etc., and all forms of enjoyment of this world and the next like honour, fame, prestige, etc., being transient and perishable, and regarding them as impermanent, the sense of meum and attachment with regard to them should be renounced. Similarly, having developed pure, exclusive Love for God alone, the embodiment of Existence, Knowledge and Bliss, all sense of meum and attachment should be renounced for all work done through the mind, speech and body, and even for the body itself. This is the sixth type of renunciation.* * The renunciation of thirst, as well as the renunciation of the desire for fruit, with regard to all objects and activities, have been described above as the third and fifth types of renunciation, but even after such renunciation the sense of meum and attachment for them are left as residues; just as even though Bharata Muni through practices of Bhajana and meditation and cultivation of Satsa∆ga, had renounced all thirst and desire for fruit with regard to all objects and 215 Men who reach the stage of this sixth form of renunciation, developing dispassion for all things of the world, get exclusive Love for God alone, the supreme embodiment of Love. Therefore, they retiring to a solitaty place, like only to hear, and talk about, the stories of Godís spotless Love, which reveal the virtues, glory and secrets of God, and reflect on the same, and practise Bhajana, meditation and study of the scriptures. They develop a distaste for wasting even a moment of their valuable time in the company of men attached to the world and indulging in laughter, luxury, carelessness, backbiting, enjoyments, and idle talks. They perform all their duties reflecting on Godís Form and Name, only for Godís sake, and without any worldly attachment. Thus through renunciation of the sense of meum and attachment with regard to all objects and activities, development of pure Love for God alone, activities, his sense of meum and attachment for the deer and protection of the deer remained. That is why renunciation of the sense of meum and attachment for all objects and activities has been described as the sixth type of renunciation. 216 the embodiment of Existence, Knowledge, and Bliss, should be regarded as the mark of one who has attained ripeness in the second stage of Wisdom. (7) Total Renunciation of subtle Desires and Egotism with regard to the World, the Body and all Actions All objects of the world being creations of Måyå, are wholly transient, and one God alone, the embodiment of Existence, Knowledge, and Bliss equally and completely pervades everywhere, this idea having been firmly established, all subtle desires with regard to objects of the world, including the body, and every form of activity have to be totally renounced. In other words, there should be no pictures of them in the mind in the form of impressions. And due to total lack of identification with the body, there should be no trace of any sense of doership with regard to all actions done through the mind, speech and body. This is the seventh type of renunciation.* * Even when there is total negation of thirst, of the desire for fruit, of the sense of meum and attachment with 217 The mental impulses of persons, who attain Supreme Dispassion 1 in the form of this seventh type of renunciation, get totally withdrawn from all objects of the world. If at any time any worldly impulse makes its appearance, the impression does not get firmly established, for exclusive and close union of such persons with Våsudeva, the Paramåtmå the embodiment of Existence, Knowledge and Bliss, constantly remains intact. Therefore, in his mind, all defects and vices having ceased to exist virtues like Ahi≈så 2 , regard to all objects of the world and all forms of activity, there remain subtle desire and feeling of doership as residues. That is why renunciation of subtle desire and egotism has been described as the seventh type of renunciation. 1. In the person, who has reached the sixth stage of renunciation stated above, there may be, now and then, some slight manifestation of attachment, when there is any special contact with objects of enjoyment; but in the person, who has reached the seventh stage of renunciation, there can be no attachment, even when there is contact with objects of enjoyment for in his conception, except God, no other object remains. That is why this renunciation has been described as Supreme Dispassion. 2. Non-infliction of suffering on any creature through mind, speech and the body. 218 Truth 1 , Non-Stealing 2 , Continence 3 , Abstaining from vilification 4 , Modesty, Unhaughtiness 5 , Artlessness, Purity 6 , Contentment 7 , Endurance 8 , Satsa∆ga, Spirit of Service, Sacrifice, Charity, Austerity 9 , Study 10 , Mind-control, Sense-control, Humility, 1. Statement of facts in sweet words, representing exactly what is realized by the mind and the senses. 2. Total lack of theft. 3. Lack of eight forms of sexual enjoyment. 4. Not to make any damaging statement against anybody. 5. Want of desire for reception, honour, public address etc. 6. Both external and internal purity. (Truthful and pure means of earning gives purity to wealth; food obtained by that wealth imparts purity to food; proper behaviour is purity of conduct; purification of the body through use of water, earth, etc.óall this is called external purity. Through destruction of modifications like attraction, repulsion, and deception, etc., when the mind becomes transparent and pure, it is called internal purity.) 7. What of thirst for worldly things. 8. Bearing contradictory experiences like heat and cold, pleasure and pain, etc. 9. Sufferings undergone for the practice of oneís own Dharma. 10. Study of the Vedas and other elevating scriptures and practice of K∂rtana of Godís Name and glory. 219 Straightness 1 , Compassion, Faith 2 , Discrimination 3 , Dispassion 4 , Living in seclusion, Poverty 5 , Lack of doubt and distraction, Cessation of Desires, Personal Magnetism 6 , Forgiveness 7 , Patience 8 , Absence of malice 9 , Fearlessness 10 , Pridelessness, 1. This means straightness of the body and mind, together with the senses. 2. Belief, as strong as in things directly perceived, in the Vedas, in the scriptures and in the sayings of saints, the preceptor and God. 3. Real knowledge about what is true and what is false. 4. Total lack of attachment for anything belonging to any region up to Brahmaloka. 5. Want of accumulation of wealth with the sense of meum. 6. It is that power of superior souls under the influence of which even wicked, worldly minded men generally abstain from sinful conduct and engage themselves in virtuous deeds according to their behests. 7. Lack of desire to inflict any form of punishment on one who does an injury. 8. Not to get upset even in the face of the greatest difficulty. 9. Not to bear malice even against one who is maliciously disposed. 10. Total absence of fear. 220 Peace*, Exclusive Devotion to God, etc., naturally make their appearance. Thus through the total lack of desire and egotism in regard to all objects, including the body, constant maintenance intact of identity with God is the mark of the person who has attained ripeness in the third stage of Wisdom. Some of the virtues mentioned above appear in the first and second stages, but all the virtues make their appearance generally in the third stage. For these are the marks of persons, who have reached very near God-realization, and are the means of attainment of direct knowledge of God. That is why in Chapter XIII of the G∂tå (verses 7 to 11) Bhagavån ›r∂ K涃a enumerated most of these virtues as Knowledge and in Chapter XVI (verses 1 to 3) described them as the divine qualities. Moreover, the scriptural authorities regard these virtues as the common Dharma of humanity. All men are entitled to them. Therefore, depending on God, all should make special effort to develop * Total absence of desires and cravings and maintenance of constant cheerfulness in the mind. 221 the above virtues in their mind. Conclusion In this article it has been said that God may be realized through seven types of renunciation. Among them, it has been stated that, the first five types of renunciation indicate the first stage of Wisdom, renunciations up to the sixth type indicate the marks of the second stage of Wisdom, and renunciations up to the seventh type indicate the marks of the third stage of Wisdom. He, who attains ripeness in the third stage of Wisdom above, at once realizes God, the embodiment of Existence, Knowledge and Bliss. Thereafter he loses all connection with this transient, destructible, impermanent world. Just as the person awakened from a dream loses all connection with the dream- world, even so the person awakened from the dream of ignorance loses all connection with the impermanent world, the creation of Måyå. Though from the point of view of the world, all forms of activities are observed as taking place through the body of that person under the force of Prårabdha, and the world gains a lot by such activities, for 222 being freed from desires, attachment and the sense of doership, whatever the Mahåtmå does through his mind, speech and body becomes the standard of right conduct in the world, and from the ideas of such a Mahåtmå scriptures are formed, yet that person, who has realized Våsudeva, the embodiment of Existence, Knowledge and Bliss, lives wholly beyond Måyå, consisting of the three Guƒas. Therefore, he during illumination, activity and sleep, etc., which are the effect of the Guƒas, does not hate them, nor, when they cease, desires for them. For, with regard to pleasure and pain, gain and loss, honour and ignominy, praise and blame, etc., and with regard to earth, stone and gold, etc., he attains an attitude of equanimity. Therefore, that Mahåtmå when obtaining a desirable object, or in the cessation of what is undesirable, does not feel delighted, nor does he feel any grief when obtaining an undesirable object, or in the loss of what is dear or desirable. If for any reason, his body is cut by a weapon or he is faced with any other form of extreme suffering, that man of wisdom, established exclusively in 223 God, the embodiment of Truth, Knowledge and Bliss, does not fall from that state of existence. For in his mind, the whole world appears as a mirage, and no other existence appears to him beyond the existence of one God, the embodiment of Truth, Knowledge and Bliss. What more should we say about him; the state of that soul, who has realized God, the embodiment of Truth, Knowledge and Bliss, is in reality, known to him alone. None possesses the power to reveal it through the mind, intellect and senses. Therefore, awakening as soon as possible from the sleep of ignorance, and taking shelter under the care of a saint, and according to his instructions, one should earnestly take to the practice of a discipline for realizing God through the seven types of renunciation stated above. For this extremely valuable human life is attained, only through the grace of God, at the end of many births. Therefore, the invaluable time allotted to this life should not be wasted in indulging in the perishable, transient, impermanent enjoyments of this world. Z 224
https://www.scribd.com/document/187959791/The-Gita-English-Gita-Press-gorakhpur
CC-MAIN-2018-13
en
refinedweb
. Citations This page provides instructions for defining and citing references by this task force. These instructions apply to documents that use Respec for processing. Contents Short cut However, you can send the reference to Ayelet, who will add it to the JSON reference page. Then you just need to: - Check if it has been used (see "Finding already defined references" bellow) - Decide the handler and check it has not been used - Send Ayelet the information about the citation and your handler (see "Citing a reference" bellow) Key resources: - W3C reference format - Instructions for the JSON reference format - Citing references in Respec documents - COGA bibliography - Coming soon, hopefully, human-readable rendered view of the COGA bibliography Finding already defined references Specifications published by W3C are usually already in the common database of references. Other publications may also be defined in this database. It is strongly preferred to use references from the central database whenever possible, so if a reference is likely to be in that database, please double check it. The specref page provides various ways to search the database. These techniques do require creating special URIs, and return results in JSON format, which is not super human friendly. Hopefully the task force can make available search forms to facilitate searching, and a rendering tool to produce human-readable results. Those resources will be referenced from here when available. If a reference is not in the central database, it may be already defined in the COGA bibliography. Please check that resource as well. Again, search forms and render tools may become available, but at the moment this requires reviewing the raw bibliography file. Defining a reference If a reference is not defined in one of the above places, it must be added to the COGA bibliography before it can be cited in a document. To add a reference you must edit the COGA bibliography file, either on the web site by activating the pencil icon "Edit this file", or by editing the git repository on your local machine and then pushing your update. All reference consist of a "handle" in quotes, followed by a colon, followed by a curly braces that enclose a set of values, followed by a trailing comma. At its most simple, this looks like: "handle": { ... }, The handle is the key to using the reference, so it must be unique. It should also be reasonable short, and must consist only of alphanumeric characters and simple punctuation such as period, underscore, and hyphen. For the moment the task force has decided that the handle will be the lead author's surname, followed by a hyphen, followed by a number so multiple publications from the same lead author can be differentiated. To make it easier for people working on the document, please position new references so that the file is sorted alphabetically by handle name. Inside the curly braces are key / value pairs that provide data for the reference. Refer to the specref documentation for information about available keys. Not all references require all keys. For instance, "deliveredBy" is only used for materials developed by a subgroup within the publishing organization, such as a W3C Working Group. "href" is only used for references that are available online. Some of the keys allow multiple values to be provided. If you are providing multiple values, enclose them in square braces, as shown in the example documentation. If the values are simply strings, they can be provided as is, separated by commas (as is done with "authors" in the example documentation. If the values are themselves sets of key / value pairs, enclose each of those in curly braces as well (as is done with "deliveredBy" in the example documentation). References defined in this format refer to an entire publication - an entire book, specification, journal article, etc. It is not possible nor appropriate to include page numbers, section numbers, chapter numbers, etc. in the central database. Clarifying these details is done when the reference is cited. This allows a single book to be defined once and different page ranges used in different citations. Citing a reference In a specification, references are cited by enclosing the handle in double square brackets. A reference identified by "handle" as in the example above would be cited by including "[[handle]]" in the document. The processing script sees that handle, looks up the reference in the database (both the global one and the task force specific one), adds a formatted reference to the references section, and changes the "[[handle]]" that triggered all this into a link to that entry in the references section. Note this is done when the document is loaded in the browser, not during editing. A reference should be cited in this manner at least once in the document to ensure it shows up in the reference appendix. It is possible to cite it many times, and it is best to cite it whenever the reference is directly discussed. Use discretion though, if a reference is discussed multiple times in a single paragraph, it is probably only necessary to cite it once in that paragraph. If it is important for the citation to specify a particular page number in a book or section in an online document, this is done after the citation. Enclose the citation in parentheses and specify the page number or section after the citation inside the parentheses. This would look like "([[handle]], page X)". Citing the same publication multiple times can reference different page numbers. Adding COGA bibliography to new publications Include the script in the HTML page with a script tag, just below the one that includes the Respec processing script: <script src="../common/biblio.js" class="remove"></script> This script defines a variable "biblio" and sets its value to the JSON data structure of the references that have been identified above. In the respecConfig section of the specification, change the line beginning "localBiblio" to be: localBiblio: biblio, Any bibliographic content enclosed in curly braces should be removed and put into the biblio.js file. Style guidelines for references - Content: We should always have the name of the article / book, author(s), date of publication, journal title (if appropriate), - To cite a specific part of a source (always necessary for quotations), include the page. - For urls should have the name of the article, date viewed and URL - References links occur at minimum at the first mention of the source. Spell out what the reference link refers to at least in the first occurrence, e.g.: - This is discussed in Namespaces in XML [XMLName]. or - "This is discussed in the XML namespaces specification [XMLName]. " and not - "This is discussed in [XMLName]".
https://www.w3.org/WAI/PF/cognitive-a11y-tf/wiki/Citations
CC-MAIN-2018-13
en
refinedweb
1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * Copyright 2001, 2002.impl.dv; 22 23 /** 24 * A runtime exception that's thrown if an error happens when the application 25 * tries to get a DV factory instance. 26 * 27 * @xerces.internal 28 * 29 */ 30 public class DVFactoryException extends RuntimeException { 31 32 /** Serialization version. */ 33 static final long serialVersionUID = -3738854697928682412L; 34 35 public DVFactoryException() { 36 super(); 37 } 38 39 public DVFactoryException(String msg) { 40 super(msg); 41 } 42 }
http://checkstyle.sourceforge.net/reports/javadoc/openjdk8/xref/openjdk/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/DVFactoryException.html
CC-MAIN-2018-13
en
refinedweb
Bewerbung Anschreiben Ausbildung Lagerlogistik involve some pictures that related one another. Find out the most recent pictures of Bewerbung Anschreiben Ausbildung Lagerlogistik here, and also you can receive the picture here simply. Bewerbung Anschreiben Ausbildung Lagerlogistik picture submitted ang uploaded by Admin that kept inside our collection. Bewerbung Anschreiben Ausbildung Lagerlogistik have a graphic from the other. Bewerbung Anschreiben Ausbildung Lagerlogistik In addition, it will feature a picture of a sort that might be seen in the gallery of Bewerbung Anschreiben Ausbildung Lagerlogistik. The collection that comprising chosen picture and the best amongst others. They are so many great picture list that may become your creativity and informational reason forBewerbung Anschreiben Ausbildung LagerlogistikBewerbung Anschreiben Ausbildung Lagerlogistik picture. We provide image Bewerbung Anschreiben Ausbildung Lagerlogistik Bewerbung Anschreiben Ausbildung Lagerlogistik random post of Bewerbung Anschreiben Ausbildung Lagerlogistik. We hope you enjoy and discover one of our best collection of pictures and get inspired to decorate your residence. If the hyperlink is busted or the image not entirely onBewerbung Anschreiben Ausbildung Lagerlogistikyou can contact us to get pictures that look for We offer imageBewerbung Anschreiben Ausbildung Lagerlogistik. Popular post : local letter of credit clearance letter of credit cibc letter of credit india letter of credit installment letter of credit payment letter of credit indian bank letter of credit txu letter of credit confirmation letter of credit rejection letter of credit traveler letter of credit volunteer letter of credit td bank letter of credit internship letter of credit dbs letter of credit real letter of credit appreciation letter of credit credit suisse letter of credit transferable letter of credit flow diagram letter of credit standard chartered letter of credit sce letter of credit revocable letter of credit diagram letter of credit import letter of credit refund letter of credit validation letter of credit barclays letter of credit utility company letter of credit reimbursement letter of credit
http://www.pipeda.info/bewerbung-anschreiben-ausbildung-lagerlogistik.html
CC-MAIN-2018-13
en
refinedweb
Step 3: Proof of concept connecting to SQL using pyodbc This example should be considered a proof of concept only. The sample code is simplified for clarity, and does not necessarily represent best practices recommended by Microsoft. Run sample script below Create a file called test.py, and add each code snippet as you go. > python test.py Step 1: Connect import pyodbc server = 'tcp:myserver.database.windows.net' database = 'mydb' username = 'myusername' password = 'mypassword' cnxn = pyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password) cursor = cnxn.cursor() Step 2: Execute query The cursor.executefunction can be used to retrieve a result set from a query against SQL Database. This function essentially accepts any query and returns a result set which can be iterated over with the use of cursor.fetchone() #Sample select query cursor.execute("SELECT @@version;") row = cursor.fetchone() while row: print row[0] row = cursor.fetchone() Step 3: Insert a row In this example you will see how to execute an INSERT statement safely, pass parameters which protect your application from SQL injection value. #Sample insert query cursor.execute("INSERT SalesLT.Product (Name, ProductNumber, StandardCost, ListPrice, SellStartDate) OUTPUT INSERTED.ProductID VALUES ('SQL Server Express New 20', 'SQLEXPRESS New 20', 0, 0, CURRENT_TIMESTAMP )") row = cursor.fetchone() while row: print 'Inserted Product key is ' + str(row[0]) row = cursor.fetchone() ` Next steps For more information, see the Python Developer Center.
https://docs.microsoft.com/en-us/sql/connect/python/pyodbc/step-3-proof-of-concept-connecting-to-sql-using-pyodbc
CC-MAIN-2018-13
en
refinedweb
Are you sure? This action might not be possible to undo. Are you sure you want to continue? own tail. The origin of the symbol is unclear. Some trace it to Neolithic cultures, and the seventh century writer Horopollon stated that the Egyptians used the ouroboros to illustrate their concept of the universe--eternity and immortality (Shepard 1232). The Egyptian goddess Isis held a sun disk mounting an ouroboros, which was called Abraxas. Isis mythology became embedded in the beliefs of the Gnostics, an offshoot of early Christianity that adopted Abraxas as the name of its high aeon (Guiley 2). The Gnostic text Pistis Sophia states that the sun disk was imagined as a great dragon with its tail in its mouth, an image also featured on Gnostic gems (Walker 268-9). The ouroboros was the “universal serpent that passes through all things… [an] unchanging law” (Cirlot 235). Sects called the Naassenes or Hophites saw the serpent as the Soul of the World, encircling all of creation (Hutin 44). Greek alchemists later adopted the ouroboros. The symbol was possibly a variant symbol for Hermes, Mercury, Thoth or other related deities, who under the name Hermes Trismegistus, was the mythical founder of alchemy (Cirlot 235, Walker 268-9). The Chrysopoeia of Kleopatra contains a drawing of the ouroboros with the Greek inscription En to pan: ”All is One” (“Circle” 422, Shepard 1232); the same inscription appears in the second century Codex Marcianus. Sometimes, as in a Venetian alchemical manuscript, the serpent is half-light, half-dark, signifying the balance of opposing principles (Cirlot 235). Alchemists viewed the ouroboros as the guardian of a mystical treasure that had to be “destroyed or dissolved” to gain knowledge of the treasure. It was also a sign of the sun, as it had been for the Gnostics (Shepard 1232). Alchemy was a closed process that purified substances, so the tail-eater could serve as a symbol for alchemy itself. Sometimes two creatures, the top one a winged dragon standing for volatility, were depicted swallowing each other (Biedermann Dictionary 363). Occasionally, the symbol consisted of two long-necked birds (Becker 316). The process of alchemy was viewed as having neither a beginning nor an end (Hutin 35). The opposite ends of alchemical work, the raw material and the final product, were the same. On one level, this referred to the “unity of matter,” the idea that the alchemist could reduce all material to a single primordial substance that could not be destroyed, only transformed (Hutin 77-8). On another level, the process referred to the perfection of the soul, with the raw material and the end product consisting of a human being. Thus the Latin phrase Ars totum requirit hominem: “The art requires the whole man” (Biedermann “Alchemy” 72). For those following a mystical path, the ouroboros represented the unity of sacrificer and sacrificed (Shepard 1232). titles of E. R. Eddison’s 1922 fantasy-adventure story The Worm Ouroboros (Shepard 1232) and episodes of the science-fiction television series Red Dwarf and Gene Roddenberry’s Andromeda. Its most well-known appearance was in Chris Carter’s television series Millennium. The ouroboros reflects the cosmic serpent of mythology through its reconciliation of opposites (Griffiths 2339-40, Walker 268-9). The taileater is the synthesis between chthonian and celestial principles (Cirlot 235). Thus, the symbol may be related to the yin-yang of Chinese symbolism (Shepard 1232). Jormungandr, the serpent that laid at the base of the Tree of Life in Norse tradition, grew so big that he encircled the world, biting his own tail (Coulter and Turner 252). {It has been postulated that this image only entered Norse symbolism after the introduction of Christianity [Moon 132].) The snake was often a symbol of reincarnation because of its apparent ability to constantly rejuvenate itself through shedding its skin. The ouroboros also carried this connotation (Biedermann Dictionary 362). Furthermore, the ouroboros is related to the dragon, a common symbol of beginnings and ends--and in Semitic and Indo-European myths, the primordial chaos that must be overcome to create life and order (Moon 132). A psychological interpretation of the ouroboros sees it as an archetype symbolic of the undifferentiated personality--the Self that exists prior to the development of the ego. It may also stand for the "ongoing reality behind the individuating ego," representing the recognition of the selfsustaining individual (Moon 132-3). Not only did the ouroboros represent the journey of the soul between the physical and spiritual realms, the cycle of death and rebirth (Becker 316, Biedermann Dictionary 363), it also signified the universe as a whole because the circle encloses everything, yet is one thing in itself (“Circle” 422). The ouroboros is an image of the eternal return (including global cycles of destruction and restoration)--the cycle of endless repetition reminding us that in every end there is a new beginning. (Biedermann Dictionary 362). It is self-sufficient Nature, the continuity of life, expressed in a cyclic pattern (Cirlot 235). The ouroboros is the “closing of the circle” (Biedermann Dictionary 362). Works Cited Becker, Udo. The Continuum Encyclopedia of Symbols. Trans. Lance W. Garmer. New York: Continuum, 1994. Biedermann, Hans. “Alchemy.” Man, Myth and Magic: The Illustrated Encyclopedia of Mythology, Religion and the Unknown. Ed. Richard Cavendish. New York: Marshall Cavendish, 1995. ---. Dictionary of Symbolism. Trans. James Hulbert. New York: Facts on File, 1992. Cavendish, Richard. “Order of the Golden Dawn.” Man, Myth and Magic: The Illustrated Encyclopedia of Mythology, Religion and the Unknown. 21 volumes. Ed. Richard Cavendish. New York: Marshall Cavendish, 1995. “Circle.” Man, Myth and Magic: The Illustrated Encyclopedia of Mythology, Religion and the Unknown. 21 volumes. Ed. Richard Cavendish. New York: Marshall Cavendish, 1995. Cirlot, Juan Edvardo. A Dictionary of Symbols. Trans. Jack Sage. New York: Philosophical Library, 1962. Coulter, Charles Russell and Patricia Turner. Encyclopedia of Ancient Deities. Jefferson: McFarland & Company, Inc., 2000. Griffiths, J. Gwyn. “Serpent.” Man, Myth and Magic: The Illustrated Encyclopedia of Mythology, Religion and the Unknown. 21 volumes. Ed. Richard Cavendish. New York: Marshall Cavendish, 1995. Guiley, Rosemary Ellen. Encyclopedia of Angels. New York: Facts on File, 1996. Hutin, Serge. A History of Alchemy. Trans. Tamara Alferoff. New York: Walker and Company, 1962. Moon, Beverly. ed. An Encyclopedia of Archetypal Symbolism. Boston: Shambhala, 1991. Shepard, Leslie. ed. Encyclopedia of Occultism and Parapsychology. 2 volumes. Detroit: Gale Research Inc., 1991. Walker, Barbara. The Women’s Dictionary of Symbols and Sacred Objects. San Francisco: Harper & Row, 1988. More ouroboros images... Abacus: Ouroboros Ouroboros: The Engine that Drives Reality Spira Solaris and the Universal Ouroboros The Ouroboros Engine that Drives Reality . "All is One!" cries this Ouroboros from Alexandrian Egypt. Stylized Ouroboros in a medieval alchemy lab in Heidelberg.The Ouroboros connects the Above with the Below. The Ouroboros is the connection between man and God. "The Serpent Ouroboros" from ancient Egypt. . 1200 BC. Earthly Ouroboros from Alciato's Emblems. Seven-segmented Aztec Ouroboros.Chinese Ouroboros from Chou dynasty. Alchemically. the generative. from a book by an early Alchemist. Heaven. yang.. In researching the ouroborus it soon became apparent that a number of people had not only concerned themselves with the topic. The enclosed words mean ' the all is one. the endless round of existence." The second example and the following expansion on the topic is by Chris Aynesworth (The World . if not universal terms.'" The same source also explains that: "In the above drawing. they had also placed their understanding of it on the Internet. creative force. yin. the ouroboros is also used as a purifying glyph . The graphical representations and insights below are all from this rapidly expanding resource. the black half symbolizes the Night. etc. Earth.The 'tail-devourer' is the symbolization of concepts such as completion. THE OUROBOROS In general. tail-eating snake. which according to the source (Chris McCoy) was from: "The Chrysopoeia ('Gold-Making') of Cleopatra during the Alexandrian Period. Fom left to right. It is usually represented as a worm or serpent with its tail in its mouth. the Ouroboros may be defined as a self-sustaining. the light half represents Day.Oceanic Ouroboros from Alciato's Emblems. PART VI. Cleopatra.. and the destructive force of nature. SPIRA SOLARIS AND THE UNIVERSAL OUROBOROS A. perfection and totality. but it is clear that there is far more to the matter than this. the first Ouroboros is one of the better known examples. for the concept is almost global in its distribution and evidently has far deeper meanings in many cultures. It is of interest to mention that a symbol such as that of the Ouroboros is something which Carl Jung refers to as an archetype. 'My end is my beginning. In the broadest sense." called Pontus. primordial unity. and the idea of the beginning and the end as being a continuous unending principle. the primaeval waters. "A return to wholeness. Its form suggests immobility with its locked jaws upon itself. From "Ouroboros. Through the years the serpent moved on to the Phoenicians and the Greeks-who were what gave it the name "Ouroboros. but in a cyclical sense. rather than linear. the undifferentiated. weds. The Ouroboros encircles the Universe. self-fecundation. and was at a stop point in his work until after waking up he interpreted the dream to mean that the structure was a closed carbon ring. which has a large and diverse selection of these impressive archtypes. "As Above. the Totality. truth and cognition complete. It is a single image with the entire actions of a life cycle . is just one). the All'. The word 'Ouroboros' is really a term that describes a similar symbol which has been cross-pollinated from many different cultures. thus there are good and bad connotations which can be drawn.we are born from nature. This is the prime primordial end to human endeavor. Born from this symbolic notion." "Ouroboros was and is the name for the Great World Serpent.like Satan.Tree) "Of The Androgyne: The Serpent Ouroboros. "tail eater. as in the Codex . yet at the same time it pushes the insistent message of perpetual movement through its twined coils. The androgyne is the united male and female principles together. it is symbolic of time and the continuity of life." The Greek translation means. It is not unlike the idea of androgyny.'The One.a series of movements which repeat. snake or serpent biting its own tail. It injects life into death and death into budding life. He had been researching the molecular structure of benzene. supporting and maintaining the earthly balance. because it is what man wholly is a part of. disintegration and re-integration. which is a duality complete. there are many different cultures which share this great dragon-serpent symbol (the serpent Jormungandr." there is the serpent or dragon gnawing at its own tail. it fashions our lives to a totality more towards what it may REALLY be . it seems to makes its way into our conscious mind time and time again in varying forms. selfsufficiency. the Androgyne (see below). Thus. everything known and unknown is encompassed in its embracing coils." The third is apparently an Aztec Ouroboros (with proportions that even Hermes would have found pleasing) originally from: Project Ouroborus at the University of Minnesota. The symbolic connotation from this owes to the returning cyclical nature of the seasons. There are some cultures that see the image as not being beneficial. from the myth of Yggdrasil. It sometimes bears the caption Hen to pan . but evil . This was the breakthrough he needed. the reunion which births totality and creation. It represents the conflict of life as well in that life comes out of life and death. The 19th century German chemist named Kekule dreamed of a snake with its tail in its mouth one day after dosing off.it begets. the potential before the spark of creation. So Below" . and slays itself. encircling the earth." It has a strong relation to what is known as the Androgyne. The first clues to this symbol go back as far as 1600-1700 BC in Egypt. the oscillations of the night sky. There is another mention of the Ouroboros laying at the edge of "the sea which surrounds the world.' In a sense life feeds off itself. and we mirror it. impregnates. These more specific re-interpretations will be spoken of later. The following commentary from this source links with what has already been said and also adds further points of interest: This symbol appears principally among the Gnostics and is depicted as a dragon. . Evola asserts that it represents the dissolution of the body. the body is half light and half dark. and was first used in Gabriel Rollenhagen's Nucleus emblematum selectissimorum. that is which. and of things.23) Wither explains further the snake swallowing its tail (ouroboros): Old Sages by the Figure of the Snake Encircled thus) did oft expression make Of Annual-Revolutions.. A demanding poem to read on a screen.. There was no surrounding air to be breathed. à la Nietzsche. These Roundells. Both the dragon and the bull are symbolic antagonists of the solar hero. a more ornate dragon-like example.40) and the following amplification: Emblem 2. help to shew the Mystery of that immense and blest Eternitie. because its designer considered that a being which was sufficient unto itself would be far more excellent than one which depended upon anything. quae Itali vulgo impresas vocant . There ending. From whence the CREATURE sprung. to its own beginning. or the primitive idea of a self-sufficient Nature . Ruland contends this proves that it is a variant of the symbol for Mercury . It has also been explained as the union between the chthonian principle as represented by the serpent and the celestial principal as signified by the bird (a synthesis which can also be applied to the dragon). Solar Architect Dennis Holloway more than twenty years ago defined the Ouroboros as: ".40 from George Wither's A Collection of Emblemes.Marcianus. and timely. the viper and the universal solvent are all symbols of the undifferentiated-of the 'unchanging law' which moves through all things. for there was nothing outside it to be seen. Which wheele about in everlasting-rings.the duplex god. its own waste providing its own food.D. alluding in this way to the successive counterbalancing of opposing principls as illustrated in the Chinese Yin-Yang symbol for instance. (33 -The Construction of the World) The fourth ouroboros is from Alciato's Book of Emblems and the Memorial Web Library at Memorial University of Newfoundland.. nor of ears. where they first of all begun . linking them by a common bond. 1611-13). 1635). Ancient and Moderne (London. the ancient Greek mythical serpent that survived by devouring itself. In some versions of the Ouroboros." He also linked the Ouroboros with the following quotation from Plato's Timæus: "It had no need of eyes. Continuing in the same locale and context. within a cyclic pattern. page 102." In a later emblem (3. The Ouroboros biting its own tail is symbolic of self-fecundation. of the 2nd century A. The plate was engraved by Crispin de Passe and son. Of design it was made thus. or the universal serpent which (to quote the Gnostic saying) 'passes through all things'. acting and being acted upon entirely with and by itself. with full perfection come .. for there was nothing outside to be heard. .. nor was it in need of any organ by which to supply itself with food or to get rid of it when digested.. for instance. (Arnhem and Utrecht. Poison. Nothing went out from or came into it anywhere. The Greek running around the picture (aionion kai proskairon) means something like "timeless. There is a Venetian manuscript on alchemy which depicts the Ouroboros with its body half-black (symbolizing earth and night) and half-white (denoting heaven and light). The sixth. and into whom It shall again. is one of twelve emblems discussed in detail by Adam . The latter source also provided the fifth example (Emblem 2. continually returns.a Nature. for there was nothing." from Timaeus.. pictured here in the meeting of Lion and Lioness. Next in Emblem 3 we have the beautiful picture of the meeting in a clearing in the forest of a magnificent Stag and a graceful Unicorn.. and intimates that each ending in a perpetual renewal corresponds to a new beginning. or Wolf and Dog. in Artemidoros and Acrobius. form a circle. The next example (7 and 8) and following description: "The symbol Ouroboros. The second emblem shows a different aspect to polarities in the fight between the inner dragon and an armed knight (a St George figure) in the Forest of the Soul.left) mirroring the posture of the Stag and Unicorn in the previous emblem. These polarities are further linked in the verse with the directions West (Dog) and East (Wolf). Their upper extremities bend round together. there are many others. The former.) while another representation of the ouroborus serves as the logo of the J.. So the Phoenicians have represented it in their temples as a dragon curled in a circle and devouring its tail. The Stag as a symbol is often associated with the Sun and the Unicorn is usually linked with the Moon. he explains that: The first layer of five emblems deal with the different facets of polarities in our inner world. some less. the heavens. and many in more complex configurations.' The latter declares the two-headed Roman god Janus is the world: 'that is. and the meeting and relationship indicated in the Stag-Unicorn and Lion-Lioness emblems.R.C. Emblem 6 is a clear statement of the Ouroborus. and his name Janus comes from eundo [by going] since the world always goes rolling on itself in its globe-form . In this emblem there is a sense that the polarities must struggle to overcome each other. a snake or dragon biting its own tail. The dynamically opposed though balanced way of the two fishes.. the polarities are seen in their manifestation as masculine and feminine. Ritman Library (Bibliotheca Philosophica Hermetica Site) in the Netherlands. Lioness . We note how they raise their opposite paws (Lion . while the . (A Threefold Alchemical Journey Through the Book of Lambspring). "It is also clear that it's the Sun honoured under the name of Mercurius [Hermes] according to the cadeuceus that the Egyptians have consecrated to the god in the figure of the Two Serpents. male and female. engraved on a bronze receptacle from the Chou dynasty. in his dream-book. in Emblem 4. especially in the alchemical context. and. (1970. pp. Next. e. Moreover. some more ornate. These polarities are to be coupled together through the alchemist's work. the battling of the Dragon and Knight elements. The Ouroboros symbolizes the continuity of life. interlaced.g. which completes this part of the sequence shows the wild Wolf and the tamed Dog fighting for supremacy. remarks that 'the dragon also signifies Time because it is long and undulant.267-268): 1 Ideas about the Ouroboros found their way into the literary world. the serpent dragon that siezes its own tail and unites these polarities in forming its circle in the Soul.right. embracing one another.. A suitable symbol for the life cycle philosophy" were made available on the Internet by the Swedish Engineering concern ivf/ep (The Symbol Ouroboros. China about 1200 B. Thus we can see that the first five emblems show us different ways in which the polarities appear in our inner world. The fifth emblem. to denote the way in which the world feeds on itself and returns on itself .Mclean in terms of psychological and alchemical symbolism.. These are but a few representations of the Ouroboros. As Mclean leads up to the latter example. The next five emblems seem to indicate different ways in which we must inwardly work to unite these polarities in our beings. as Jack Lindsay explains in The Origins of Alchemy in Græco-Roman Egypt. revealing the huge interior.. was created from Chronos and rebelled against it. A Serpent encloses. after forming a knot. the threshold-guardian. there the silver gleaming. Those of brass are there upheaped. and the wider presence of the Ouroboros in mythological contexts is discussed further in the following passage (Towards a Taxonomy of the Pure Ones Parallels within Gnosticism. there stiff the iron. its beginning. unknown. usually called the Aeon of Jupiter or Zeus. The Greek Myth tells us that Chronos feared that his children would one day rebel as he had rebelled against his father. aged and yet lovely. Here in appointed places the Ages dwell. At the entrance Nature sits. and green scales always glinting. and the Aged Seer strongly suggests one of the alchemic visions of revelation or initiation: Far off. Claudian came from Egypt and his imagery shows the Egyptian idea of the night-journey of the sun through the cave or tunnel in the earth. the snake biting its own tail and incidentally also a symbol for the death/rebirth so intimately linked with Time. displaying the House the Secrets of Time. Of its own accord the admantine door swung open. the Old Man bent grey hairs to the proud rays. makes some of them move and others hang at rest. This could correspond to a will to stop the descent into matter by closing himself into an Ouroboros. So all things live or die by predetermined laws. is Time's cradle and womb.tails. with varying Metals marking their aspect. and round her gather and flit on every side Spirits. consuming all things with slow power. is set the flock of golden years. stands a primeval Cave in whose vast breast. Even more interesting is the passage that ends the second book of Claudian's poem. come together at the haft of the caduceus and are provided with wings that start off at this point. Magister Templi of the Ordo Rosae Crucis. When the Sun rested on the cave's wide threshold.. ALCHEMY. SPIRA SOLARIS. the years' rough haggard mother. AND EGYPT The antiquity. scarce reached by gods. He fixes the number of stars in every constellation. shy of earth-contacts. Nature ran in her might to meet him. the backbent tail as with mute motion it traces. and the very foundations of life itself. B. On the Consulship of Stilicho. But the introduction of the Ouroboros in association with Natura (Physis). the various metals. rebirth. 1994): The next aeon. so he ate them. beyond the range of thought. . in a distinguished section. complexity. A Venerable Man writes down immutable laws. Graeco-Roman Mythology and Hermeticism by Frater IAM. Its mouth devours." From the above descriptions and the widespread occurrence of this Jungian archtype in both time and place it is also apparent that the Ouroboros embraces cyclic regeneration. the Cave. But they subsist in the earth. as likewise other things. [emphasis supplied] Here the speculation concerning the Ouroboros extends to embrace the philosopher's Stone. We have also touched upon the similar type of feedback inherent in the inverse-velocity phenomena evident in the modern Solar System and briefly considered the complications that arise from periodic variations in planetary motion in Section III. however. and each of the metals. from the celestial Gods.. Perhaps it was originally intended that all roads should indeed lead to Rome . But there are additional themes running throughout all this with strong religious and biological undertones that link the whole with the Sun and its undoubted influence on life as we understand it.But this was broken by the stone Abadir (also called Baetylus) given to him by Rhea (who could in fact have been Ialdabaoth!). The resurgence of "Alchemy" in the Middle Ages on the other hand may have had both ancient origins and modern insights. It is said. therefore. and the consequences of the Dark and Middle Ages. one that points again to the subject of Alchemy. Book I. Hence these are generated from thence. which has the ability to open up the Ouroboros or close it ". In Section IV we have already examined the inter-related natures of the periods. Here again. In fact. It would seem that great pains were taken to ensure that it was passed on. It is interesting to speculate if this stone is not the original archetype of the Holy Grail (which has been alternately described as a cup. To this problem must also be added the waxing and waning of empires. and from an effluxion thence derived. therefore that gold pertains to the Sun. lead to Saturn. that gold and silver. but sufficiently coherent enough for its understanding among those who avidly studied the writings of the ancients. a stonelight by different mystics) or the Philosophers Stone. conformably to Cephalus. silver to the Moon. keys and approaches adopted .a location unfortunately rendered untenable by Roman degeneration and excesses which forced the disastrous relocation to Constantinople. perhaps not entirely intact. For they do not receive anything from material natures.. silver to the Moon. which he devoured instead of his son.in something akin to our present astronomical context that was always under consideration (e. changing religious beliefs. (emphasis supplied)] The references linking gold with the Sun. and not in the celestial Gods who emit the effluxions. grow on earth. lead to Saturn.. and iron to Mars. and iron to Mars are all clearly alchemical. a sound mathematical case can undoubtedly be made from extant writings that it was predominantly the "Golden" Section itself . In any event it would seem that it was not until the Middle Ages that the matter resurfaced." [Commentaries of Proclus on the Timæus of Plato. hence the multiplicity of methods. it seems that one could present an argument that there was always more than the unlikely transformation of base metals into physical gold at stake here. if you are willing also. it may be said.. Thomas Taylor supplies the linkage and incidentally the humour: 2 They say.the phi-based mean period of Mars and also the mean velocity of Mercury . p. mathematical transformations involving the black "lead" of . even for those with only a passing knowledge of the subject. with the intriguing suggestion that the two are in a special relationship. in fact that partial confusion may well have been an inevitable consequence. In more detail. that the rich have many consolations.so much so. who eventually defeated him. But to what exact degree such complexities and consequences were known and understood in the earlier period and the Middle Ages has still to be fully assessed. 36. distances and velocities pertaining to the Phi-series period spiral and the manner in which the outer and inner regions may be considered to feed back on one another..g. looking and beholding the image of himself. or rendering it firm and solid. the synodic "Oil" of "Antimony" and parameters pertaining to Mercury. the subject is simply too vast and too complex for the present discourse. [emphasis supplied] The similarity lies in the mirroring of numeric values associated with the extremal locations of the planets Mercury and Saturn. But of this luminous subsistence smoothness is a symbol. consider the following line of inquiry and where it ultimately leads. which is mentioned by Plato.. the whole universe being luminous. into which the God. it is most lucid according to its external superficies. Thus Thomas Taylor states: 3 It is well observed here by Proclus that. And you may say that the smoothness of the external surface of the universe. therefore. reminds us of the above-mentioned catoptric apparatus. just as mirrors.1600 A. Proclus further observes that a mirror was assumed by ancient theologists as a symbol of the aptitude of the universe to be filled with intellectual illumination.. Subject to further observation and refinement..D. We also know from the fundamental synodic period relationship given in Section Two that the intermediate mean synodic period (or mean lap time) for adjacent co-orbital bodies is obtained from the product of the mean .) entitled: The Twelve Keys of Basil Valentine. But to give some idea just how complex the matter can become. and full of divine splendour. Hence. i. are the extremities of the universe smooth? We reply. It is not the intention here to discuss the multifarious aspects of Alchemy in detail. From this viewpoint. through similitude to them. In the second context we are dealing with material that post-dates both the heliocentric model of Copernicus and the publication of Kepler's Harmonic Law (1618). i. Why. Venus and Mars as discussed below). Robert Boyle and Sir Isaac Newton who (among others) became involved in this seemingly dubious enterprise. we have a means of robbing the common liquid quicksilver of its vivacity. is significant of extreme aptitude. a planetary model and estimates for both the mean distances and the mean velocities may (or may not) follow. the "Tin" of Jupiter.e. they say that Vulcan made a mirror for Bacchus. receive the representations of things. then the description is both apt and well-merited. And it is also a far more fitting and reasonable occupation for highly regarded scholars such as Francis Bacon. the phi-series mean velocity for the synodic difference cycle between Jupiter and Saturn provides the value of 0. says he. When it has been reduced to a sweet oil.. That it may be harmoniously adapted to supermundane lights. therefore.e. To understand the above it is necessary to recognize that the first astronomical parameters normally obtained from the observation of the planets and major luminaries are the periods of revolution." [emphasis supplied] while "Basil Valentine" adds in The Twelve Keys : As a parting kindness to you. by their smoothness.3819660112 which also occurs as the mean distance of Mercury and again as the mean synodic period between the latter and Venus (see Table 5a in Part IV for the complete relationship). Smoothness. through which the universe is able to receive the illuminations proceeding from intellect and soul. I am constrained to add that the spirit may also be extracted from black Saturn and benevolent Jupiter. proceeded into the whole divisible fabrication.Saturn. if "The Great Work" of the Alchemists was indeed essentially the preservation of a complex corpus of knowledge concerning the Sun and the structure of the Solar System. as is also set forth in my book.. 854101966 A. Mercury through Mars. proceeded into the whole divisible fabrication").38196601 1 29. POSITION Planet/Synodic MERCURY Synodic/(Oil) Phi N PERIOD "SOUL" DISTANCE "BODY" VELOCITY "SPIRIT" .1 0. into which the God./Antimony SATURN/Lead 5 6 7 11. if you wish). the Harmonic Law (exponent = 2/3) and the velocity variant (exponent = -1/3) respectively produce a corresponding mean distance of 6.23606774 (years) the Harmonic Law yields the mean distance for Mercury from: (Phi ) = Phi with the mean velocity similarly obtained from (Phi ) = Phi. Unity provides the frame of reference.6180339 1.6180339 0. if one is aware that the mean period of Mercury is approximately 0.3 0. and Jupiter to Saturn.97308025 0.44660278 0.448422366 17.090169944 and 29.1/3 1 altogether.3819660112.72556263 1.6180339887499 In keeping with the hint provided by Thomas Taylor and Proclus ("Vulcan made a mirror for Bacchus. In passing one might also note that the mirror analogy includes the equality between the . one could also proceed forward from Table 1 to obtain both the harmonic law and the velocity variants from another direction -3 -3 2/3 -2 -3 .U and a mean relative velocity of 0.325358511 Table 1. but either way the reference to mirrors appears to be singularly appropriate as well as helpful. Table 1 below provides the numeric data and a simple cipher that connects the "Period-Distance-Velocity" and "Soul-Body-Spirit" triads in the present context. looking and beholding the image of himself.24 years and that Phi is 0.378240772 1 VENUS/Copper .173984996 8 Synodic/Earth MARS/Iron 0 1 1 11 1.38196601 1.sidereal periods divided by their difference.37824077 0.0901699 4.0344418 9. From the Phi-series mean periods for Jupiter and Saturn of 11. The Phi-Series Planetary Framework.23606797 0.52644113 1.3819660 0.85410196 0.851799642 8 (Asteriod Belt) JUPITER/Tin Syn. The resulting period.944271910 years. This is perhaps looking at the matter in reverse (the mirror image.9442719 6.034441854 years respectively we therefore obtain an intermediate mean synodic period of: 17. "Gold" = Phi = 1.61803398 8 -2 0. the latter as noted above. or the motion of the stars. and the demiurgic and vivific divisions in it. he does not add how much. Wagner observed in Introduction to the Solar System (Holt. either the magnitude. we may say. Orlando. but all these numbers and ratios. or philosophically. that a line is adapted to the soul.2360679774 Years in the first instance and a mean orbital velocity (relative to unity) of 0. Kessinger Books. Even a sharp eyed ancient Greek astronomer could have spotted it. emphases supplied]. And after this. which was sequialter indeed of the second. For. and this is true even of the soul of the universe. the first seven terms. it is greater. adumbrate its truly existing essence. but admitting that one star is greater than another. and energizing about the same things. yet it has this energy intransitive. but not entirely improbable. For intellect indeed. Proclus. To which it may also be added that Plato nowhere defines. tells us [The Commentaries of Proclus on the Timeus of Plato. The part that refers to "magnitudes" and "velocities" (included by Thomas Taylor in square brackets) is from the obscure writings of Nicholæus Leonicus Thomæus.2360679774 in the second.. as Jeffrey K. Unlikely. perhaps. it is not easy for those to assign. Kila. and to the demonstrations given by them. for in spite of its relatively recent discovery (by William Herschel in 1781). But of what things the mathematical ratios are images. 89-90. or the swiftness. a third part. [Others the magnitudes of the stars . and how they develop the essence of the soul of the universe.] But others. in which place they arrange the monad. the emphases are also Thomas Taylor's]: 6 . i. though some should give it motion. evinces the difficulty of this theory. In the next place he took away the double of this. Book III. etc. [Vol II... But soul possesses a transitive energy. refer them to other such like explanations.. 1991:334) "Uranus is just bright enough to be visible to the naked eye. and among the rest with. does not consist of mathematical numbers and ratios. Rinehart and Winston. and the opposition of the modern to the more ancient expositors. are attended with many difficulties. but triple of the first. or the distance. and after what manner. that it is not proper to understand what is here said by Plato. and not cosmogony {hereafter follows a discussion of various interpretations. as Plato . For at different times. pp. who do not look to the conceptions of Plato. But this is manifest from the discord of the interpreters. Thomas Taylor. The triadic sets: Period/Distance/Velocity and Soul/Body/Spirit represent a specialized application of what appears to have been a wider comprehension of the nature of the Soul. 35b:] We have observed. refer them to the motions of the spheres. For the essence of the soul. Their interpretations. And others adapt them to the velocities of the celestial orbs. But others refer them to the distances of the spheres from the center of the earth. And that the thing proposed by him to be discussed in this part is psychogony. [Timæus. pp. but physically. for example. it applies itself to different forms.e.mean period ("Soul") of Mercury and the mean velocity ("spirit") of the next outer planet. transl. Others again. however.115-118. a mean sidereal period of 0. to which we have assumed as analogous the numbers that exhibit the whole diagram. Uranus. having an eternal life. in the same nature. and it is surprising that it escaped detection for so long.. mathematically. according to the same. that they are discordant with the observations of recent astronomers. For it surveys at once the whole of the intelligible. For some of them think fit to refer to the seven spheres. and the circular motion. that souls are carried round in a circle. is divided according to its parts. but the circle. about the admixture of the soul. in consequence of the whole of it moving itself. we must say. For it has whence and whither. The right line therefore and the circle of the soul. But in what he says concerning the right line and circles. for the sake of concealment. as veils of the truth of things. and that it is not like the life of irrational natures. For both these may be surveyed in souls.. For the self-motive nature is moved from itself to itself. and returning from the same objects to the same. Since therefore. sees itself.. how it produces and converts things posterior to itself. and to itself. the right line indeed. in the same manner as in that which is converted to. no arguments are sufficient. that Xenocrates thought it requisite to call the essential reason of a line an indivisible line. that the soul is an essence. the essence of the soul. what kind of line Plato here assumes ? Is it physical line ? But this would be absurd: for this is the end of bodies. Plato unfolds the being itself of the soul. and shows how it is one and many.--if we admit this. and another for the end. and also in what is said concerning numbers and middles. So that in this respect we refer a line to psychical life. . But its life is rectilinear. that the right line adumbrates the transitive. and as having an appetite directed to other things placed externally to itself. what progression it has. we now admit that the right lines are lives.In short therefore. and how it is converted to itself. employed mathematical names. Why therefore. are without interval. on which account also. and is both one and many. says in the Phaedrus. and is present with itself. and not absolutely of all life. It is evident however. and through the former to pass to the latter. And this Socrates knowing. is harmonized number. and these essential.. should we any longer fear those skillful Peripatetics who ask us. But every transitive motion is a line. but the latter of life converting to itself. We say therefore. begins from. and returning to itself. assumes the rectilinear. being at different times happily affected by different things. For in a circle. For it would be ridiculous in any one to think that there is an indivisible magnitude. therefore. If therefore. Against such men however. how it fills ratios. Or rather prior to the gnostic. as never being able to converge to itself. and the rectilinear. But let us return to the words of Plato. Hence Timeus delivering to us in what is here said. and ends in itself. And prior to us Xenocrates calls a line of this kind indivisible. Hence also. In what is said. it is the peculiarity of soul to energize through time.. but the circle according to a circumduction from the same thing to the same. the same thing is the end and the beginning.says in the Phaedrus. and one thing for the beginning. and the Pythagoreans symbols. as these Peripatetics. and is not essence: Plato however says. For there are in it being. and is uniform and biformed. perceiving that the vital powers are in themselves at one and the same time transitive. For it is possible in images to survey paradigms. life. we have not ceased asserting that this line is essential. he delivers to us the vital and intellectual peculiarity of the soul. that it is self-moved. in the same manner as theologists employed fables. and intellect. who are contentious. the soul is one. and self-motive. revolving under intelligibles as objects of desire. that they in vain make these inquiries. the vital motion by itself alone. For they are moved from themselves to themselves. but in what follows unfolds the gnostic motions of the circles.. and is separate from bodies. as possessing life by its very existence. and what regressions both to superior natures. the Demiurgus made the composition of the soul itself to be rectilinear. But Plato. being a whole and consisting of parts. . and direct our attention to each of them. and binds together the whole world. and indicates how it participates of the life in intellect. then we must say. that the circle manifests what the quality is of the form of this life. . And its intellect is dianetic and doxastic. tending to externals as it were in a right line. the self-motive nature of these powers. so far as it is self-vital and self-moved. beginning from. For long before this. the soul now becoming self-motive. Is it then a mathematical line ? But this is not self-motive. according to the transitions of appetites. viz. the former being the image of life [simply]. such a form of life as this is circular. The philosophical canons of Paracelus in the 17th Century Sloane Ms 3506. preserves every where the same ratios. that we may not.618033989) is in turn the mean period of revolution of Mars. as being one. In the first. just as the present character is adapted to the soul. so likewise a certain figure. as the initiators into mysteries say. and continued. are adapted to the psychical middle: for they subsist in a middle way. on this account. a character of this kind. But because it has the same reasons or ratios. Perhaps too. omitting the things themselves. For the complication of the right lines indicates the union of a biformed life. and not as some fancy. and composition. above and beneath. is a symbol of a life which flows from on high. vis.. Plato adds " as it were. Returning to the relative simplicity of the triadic sets in question.61803989 ) represents the mean period of revolution of Venus. he would have said. but it subsists primarily. and colour. The figure X however. For different characters and also different signatures are adapted to different Gods. are symbols of this kind. as some fancy. he delivers it to us divided according to length. the duple ratios here. and at the same time multitude. the bases of first are united to the summits of secondary natures. But these are conjoined to each other. with respect to both inferior planets (Mercury and Venus). and Mars it should be noted that the mean velocity (or "Spirit") of Mercury is itself the "Golden Ratio" Phi = 1. For the last part of the dianoetic. but contains and connects the partible essence. Moreover. as both. produced by this application. because there is difference. conformably to its paradigm. that he applied the middle to the last. but the triple there. but according to an ultimate distribution into parts. the biformed progression of the soul. And as Porphyry relates. and vocal emissions. in a way adapted to it. in Sloane Ms 1321 (both transcribed by Adam Mclean). lie says that the Demiurgus applied middle to middle. Phi (1. i. and is discrete. But in the soul both have a middle subsistence. because the contact of the soul is properly of a middle nature. one union is produced of these two lives. We must not however conceive. and things continuous. --hence Plato calls it double. For this division alone. and indivisibly. For these are without communion with each other.first to the middle. so that it intellectually perceives the impartible essence through the circle of the same. Lastly. . and conformably to these. and the summit of the doxastic power.6180339887499 while the inverse (0. be known from characters. but all. These special inter-relationships are stated (albeit cryptically) in further alchemical works. through the right lines indeed. But the soul is one. For the duad is seated by him. and An hundred aphorisms containing the whole body of magic.Plato denominates it this. that the Demiurgus applied the. Since however the psychical reasons are biformed. has a great affinity to the universe. and regression according to an intellectual circle. X. But since he teaches us concerning the psychical duad. Hence also the union in these is obscure and evanescent. that the division and contact of things intangible. which is appropriate to the Demiurgus. and if about body and soul. In order however. But the scission itself exhibits demiurgic section. surrounded by a circle. be too busily employed about. form tile media of all tile psychical composition. the words " middle to middle" indicate perhaps. For a right line itself also. And if indeed Plato had spoken concerning intellect and soul. but through the circle its uniform life. as some one of the Gods says. For perhaps it signifies.e. But these are after another manner symbols of divine natures. In sensibles likewise there is division. and for the sake of concealment. for the soul is of an ambiguous nature. thus endeavouring to invest with figure the unfigured nature of the soul. Earth. through the circle of the different. that Plato thought a divine essence could be discovered through these things. and as it were occultly." indicating that this is assumed as a veil. For as a certain motion. For in intellect also there is division. the theory of the character. and also to the soul. and has two faces. and is refulgent with intellectual sections. which also shows that the essence of it differs both from things discrete. is with the Egyptians a symbol of the mundane soul. as being multitude. he says this. For in every order of beings. positions. For the truth of real beings cannot. possesses a treasure better than all the riches of the world." Mars. "Gold. 3. and this is called the Vital Spirit. The greatest arcanum of the work. 49. In this production whilst the Soul fashions to itself a body. 145. and Mercury. By natural application it is done when the Spirit of one body is implanted in another. and this joined with the sulphur of gold makes a medicine. 9. 39. The second reference is divided into three parts with the first concerned with "Twelve conclusions upon the Nature of the Soul ". and by which the operation of all natural things are dispensed. which merely and purely considered are able to do no more than the eyes can see without life. The Sulphur is the soul. the body is generated or produced out of the power of the Soul. 56. . in so much as the period/soul of Venus is both Phi -1 and the reciprocal of Phi Aphorism 49 also quite appropriate. The organs by which this Spirit works are the qualities of things . In generation the Spirit is mixed with the body. and that the Mercury of perfect bodies is the form. there is some third thing the mean between them both by which the Soul is now inwardly joined to the body. Aphorism 57 provides a succinct summation of the relationship between the velocity/spirit of Mercury and the period/soul of Mars as shown in Table 1. and he that knows how to join it with a body agreeably. Gold resolved into Mercury is spirit and soul. by means of those things which are apt to intercept the Spirit. as being nothing else but modification of the matter of the body. 57. 14. 15. The sulphur of Mars is the best. and to communicate it to another. and reduction into Mercury. Aphorism 56 is correct. for two extremes cannot be joined without a mean . The whole world is animated with the first supreme and intellectual Soul possessing in itself the seminary reasons of all things.. distances and velocities) may be consistantly expressed as fractional exponents of Phi as shown earlier in Table 5a. 2. 18. Nature makes and generates minerals by degrees. we find the following aphorisms: 12. This Spirit is somewhere or rather every where found as it were free from the body. hence it hath the denominating power over the body which it could not have except the body did fully and wholly depend upon it. and is diversely formed according to the imagination thereof. 11. The Mercury receives the form of gold by the mediation of the spirit. which proceeding from the brightness of the ideas of the first Intellect are as it were the instrument by which this great body is governed and are the links of the golden chain of providence. 64. Aphorism 14 is undoubtedly correct as far as the Phi-series planetary framework is concerned since all the mean parameters (periods. The highest secret of all is to know that Mercury is both matter and Menstruum. Moreover. is the physical dissolution into Mercury. While the operations of the Soul are terminated or bounded. 152. the remainder are from additional sections: 1. and directs the intent of Nature to its end.bearing in mind the relationship between the two triadic sets. Statements 1 through 11 are from this source.. nor Intelligences can work upon bodies but by means of this Spirit. They who take the Sulphur of Venus are cheated. but the Mercury is the matter. also out of one root are generated all metals till the end of all which is gold. Neither Souls nor pure Spirits. 6180339887499). and I. with a perpetual union. which none of you separately can verify. O Gold. "The Lord Chief Justice pronounced sentence to the quarreling and disputing metals. Thou hast spoken rightly. [emphases supplied] Before returning to "antimony. Iron! I order thee to accept and make use of the sweet heaven or ferment of Gold . Defendant. and by the ancients called amatoria or such things as love one another. appeal to me concerning thy nobility and nature.' 'Thou." Mercury says to Gold: 'Whilst Thou.' continued the supreme Lord. Iron and Gold." i. Dost thou not know that there is a mother of all metals and their greatest substance? All things have been subdued unto man! and thou haughty Gold do not elevate thyself too much. that thy power over the diseased Knights (the inferior metals) is nothing! Thou hast mentioned my perfect knowledge of thy exalted state amongst the Knights. I will never refuse to grant to thee. and more powerful subjects than thee? and all other metals containing the four elements as well as they do. am a declared enemy to thy external dirty appearance and thy dirty works. knowest well that I do perfectly understand thy nature and complexion Thou canst much less than Gold effect anything useful without my assistance.1.' 'Thou. but I order thee to make good use of its noble beautiful red flowers (when a crocus Mars is sublimated with Sal Ammoniac. Dost thou not know that there are greater. knowest well if I Mercury do not deal kindly with thee and unite with thee in perpetual love and harmony. however. Gold. and I have often given thee that power. a power to procure riches. if we please. as thou well knowest when thou and I did sweat in our hot bath and dried ourselves afterwards. it ascends in beautiful red flowers . shalt henceforth not vex nor despise Iron. Recollect then what friendship and services we rendered to Lady Luna. from a motive of special goodness and friendship towards my fellow-creatures.. Mercury. Gold. introduced in this Allegory by Sternhals as so many Knights.e. for the sake of truth and justice. This relationship may well have provided the basis for the allegorical "War of the Knights" by Johann Sternhals (1595) concerning the resolution of the "conflict. nobler. and as I am well acquainted with thy origin but am likewise no stranger to the nature. and the mean period/soul of Mars ("iron") are identical. I complain justly against you both!' 'Yet. as there are creatures of God far above thee in power and virtue!' 'I then." it is clear from Table 1 that "Gold" ( Phi. not omit to declare that you have both boasted of great things. Which. because thy nature and power proceed from mine (from the Sophic or animated Mercury). Thou shalt unite with Iron in friendship. I must further tell you both (Iron and Gold) that you stand both in need of my counsel and help. and operation of the defendant Iron. O Iron.' 'And thou. hast said that thou art the true Stone. thou canst not do without my assistance. I can.. property. O Iron. the mean velocity of Mercury. if thou meanest ever to be of any service to the diseased poor knights. Gold. Thou. about which the Philosophers contest. Thy nature must be retrograded and converted into mine. which we are able to do again. Therefore. The Judge's name was Mercury.' 'Thou. 'unite you both. as plaintiff against Iron. Mercury. whilst I can do with very little of your assistance.this must be repeated three or four times) which Iron has got in his garden for the sake of multiplying thy active power.and they are known by the signature. This saturnine antimony agrees with sol. Their studies have .. and the other from mercury sublimated. in The foundations of Newton's Alchemy (1975) discusses the occurrence of a special symbol introduced by Isaac Newton in some of his later alchemical writings that may have some bearing on our present discussion.. substance and tincture thereof. have remarked how its outermost nature and power has collapsed into its interior. and also augments therein the native color." The same source later states that: ". Betty Jo Teeter Dobbs. After tentatively assigning the name "quintessentia" to the symbol in question Dobbs explains that: 7 Some pages of the manuscript seem to identify the quintessence with antimony (presumably the ore).. Cambridge University Press. On a more general but nevertheless ourobotic level. weight.e. the one from antimony. [ Sigismund Backstrom's embedded notes are omitted for clarity] With respect to alchemical "metals" in general." probably meaning an ore of bismuth. or medicine might wish to consider the following words of caution expressed by Basil Valentine in The Triumphal Chariot of Antimony: Many Anatomists have subjected Antimony to all manner of singular torments and excruciating processes. Either of these designations would at least make it appear to have been a concrete substance to Newton. united in friendship to be of use to all that knew them. and its interior thrown out and has now become an oil that lies hidden in its innermost and depth. there is a double substance of argentum vivum. yet elsewhere in the same manuscript he defined the quintessence as a "corporeal spirit" and a "spiritual body" and the "condensed spirit of the world. itself the golden ratio. except gold. and the second ("Saturnine Antimony") similarly positioned between the "Tin" of Jupiter and the "Lead" of Saturn.. but another renders the symbol .." the first (in the positional and also the numerical sense) between the "Iron" of Mars and the "Tin" of Jupiter.. "Antimony" also looms large .. and has in all respects the nature thereof. by Mark House and also the numeric relationship between "Iron" and "Antimony" in the Biblical Aesch-Mezareph). In such contexts it would appear that there were two types of "Antimony." The Secret Book of Artephius notes also that: "Antimony is a mineral participating of saturnine parts. chemistry. and contains in itself argent vive.for thy good and nourishment. which it is difficult either to believe or to describe..' And thus they departed. or as Basil Valenttine informs the reader in his Triumphal Chariot of Antimony: "By our Art it (antimony) can also become an oil." Moreover. well prepared and ready. it does give a double weight and substance of fixed argent vive.a "metal" that in fact attracted Isaac Newton's attention (see: Newton And Flamel On Star Regulus Of Antimony And Iron Part 1. when they have thus prepared our Antimonium in secret. Those who feel that "Antimony" in this context is more reasonably construed in terms of metallurgy. and gold is truly swallowed up by this antimonial argent vive. i. Roger Bacon's Tract on the Tincture and Oil of Antimony also contains the following aside: "The Philosophers."(The foundations of Newton's Alchemy.as "Bism. etc. in which no metal is swallowed up. the JupiterSaturn synodic cycle." [emphasis supplied]. 119. but Antimony only. which abound with the Tincture of Gold. did not soon find that fictitious soul of which they were in search their path being obscured with black colours which rendered invisible what they desired to see. But by it.1680): Aph. If these three substances be mixed. as a Medium. These elements work underground in the form of fire. That of Antimony. the internal soul. Aph. such as water. and there produce what Hermes. you should not devote yourself to the study of philosophy. 117. and earth. 114. they are hardened and coagulated into a perfect body. an earth-like substance. Mars. This is a most important and certain truth. Antimony. Venus and Mercury are also stated in alchemical Aphorisms 117 and 119 below (source: 153 Chymical Aphorisms. there will also be metallic quicksilver. which represents the seed chosen and appointed by the Creator. the said Mercury may be obtained. For. Aph. 115. [italics supplied] Numerically. and. And among Minerals there is none found which can perfect the colour of pale Gold. When this union has taken place. Aph. 118. without beginning or end. of which. Mars and Venus. the relationships between Antimony. and the metallic form of body be present. Of which sort there are found only two. Aph. as hath been already said. Aph.. and salt. so that it can shew an ancestry. and visible bodies. beyond which we can find no earlier beginning of our Magistery. the two bring forth a third namely. the more diligent and prudent the search which is made. of its first source. ought to be more perfectly Tinged by the Mercury of philosophers. and from which three the elements. 111. ca. of Mars also. And Gold. our Royal Menstruum is to be elicited. [emphasis supplied] Moreover. the metallic spirit. sulphur.. to wit. One man's life is too short to discover all these mysteries. 112. and the more is always found in it. which is the principle of our seed. In the course of time these three unite. metallic sulphur. and Venus. by the work of Art and Nature. and metallic salt. consist of Sulphur and Mercury. like Mercury. Aph. and all who have preceded me. and by its help. than the natural perfection of Gold requireth Aph. Whence we conclude. viz. from other imperfect Metallick Bodies. and render it more penetrating. 116. 113. A celestial influence descends from above. seeing that Antimony cannot communicate more Tincture to Gold. quicksilver. and are changed through the action of fire into a palpable substance. it would therefore appear that "soul" can be equated with the mean . because they did not seek the true soul of Antimony. call the three first principles. therefore. and mingles with the astral proper ties . If you cannot perceive what you ought to understand herein. Antimony. Therefore that appeareth to be the only Mineral. is comparable to a circle. take their origin. This Mercury cannot be had of Antimony alone. in this and similar contexts. and facilitate its Flux. Mars and Venus. [emphasis supplied] The latter writer also provides an additional cautionary remark in The Twelve Keys along with the following expansion: Know that our seed is produced in the following way. air. and by which.led to no result. the impalpable spirit. viz. by the decree and ordinance of God. which together make up the perfect metallic body. composed of all colours. If the metallic soul. Aph. Hermes. It is called: Lion. e.259). 'Know that copper. In case it is assumed that "alchemy" can be completely deciphered from the above information alone. silver. fat. spirit. etc (see: Animal Symbolism in the Alchemical Tradition and The Birds in Alchemy by Adam McLean). p. tirac. How can one fail to recognise something white showing up against a black background? The separation isn't painful for anyone accustomed to distance. with much antithesis and heaping-up of synonyms. and birds of the air. Leaving aside the majority of such words and choosing those which are.Barkis[Balti=Venus?]. I'm going to mention the easiest ones. possible. water. the Aristotle here cited is an apocryphal figure: 'I have heard Aristotle say: 'Why do these seekers turn away from the stone? It is however well known thing. oil. has a spirit and a body' (Jack Lindsay. Needless to say. matters do not necessarily become simpler as as result. But the essential ideas are much earlier. Saturn. vinegar. talc. denizens of the sea.' [emphasis supplied] From a somewhat wider viewpoint there is also the following description of the "Stone" provided in another alchemical treatise. I then used yet more enigmatic expressions than those I'd used at first and I have increased the obscurity of the phrases out of fear that their sense was already too plain.1620): .8 This representation appears to be one of a number of triadic keys and much further analysis will be required to clarify them all.' [emphasis supplied] "Another Sage has said: 'I've lived now forty years and I've never spent a single day without seeing the Stone day and night so well that I was fearing nobody could help seeing it too. just like a man. it is necessary to point out that the significance of the Moon has been omitted here and the various terms and names associated with the subject are still as confusingly intermingled as the names of the Heroes and Gods of the ancient Greeks. torrent.. jackal. lead.113) while in the writings of Kleopatra it is also stated that: ". gazelle. oppressor. page. tin. we may cite some more passages that seek to stress the paradoxical nature of the secret. submitted[being] magnet. collyrium. mercury. 'What are its qualities? Where is it found? What is its possibility? He told me. in an Arab MS called The Twelve Chapters by Ostanes the Philosopher on the Philosopher's Stone we find that: 9 "The style of the Twelve Chapters shows that it derives from the period when alchemic ideas were set out in elaborate rhetorical fashion. monkey. For example. vein. Night cannot be dubious for him who owns two eyes. iron. for as The Book of Krates says. as far as I know. fire. salt. Sun. 'I'll characterise it by telling you it's like lightning on a dark night. dumb man." (Lindsay. dog. "body" with the mean distance.' "I replied. Moon. (ca. serpent. congealed or dissolved [body]. p. the symbolism also expands to include (among other things) animals of the land. sulphur. tutty. tarc. foam of silver. wolf. tulac. and as the points are strongly and clearly made.period of revolution. The Glory of the World. viper.the body and the soul and the spirit were all united in love and had become one: in which unity and the mystery has been concealed. Moreover. panther. arsenic.' 'Know then that the authors in their books have used a great number of words to denote the Stone. gold. characterised. Mars. the ones best known in the world. urine. serving-maid. and "spirit" with the mean velocity. scorpion. courser. bone.g. soul... dragon. copper. existent. perfecteth. by help whereof the work goes on. for they either belong unto matter. there are rare references to the spiral configuration and further allusions to the Ouroborus in other alchemical works. It is also denominated the One Stone of the Philosophers. Next. then. which was One. Magnesia.I have called it by various names. 1970:265. Lastly. The operative means (which are also called the Keys of theWork) are four: the first is Solution or Liquefaction. which is done by the conversion of the Body into Spirit. the second is Ablution. These Circulations are Nature's Instruments. the third Reduction. by an Erratic and Intricate Motion. or operations. In both these latter operations the Dragon rageth against himself. and do often (seven times at least) drive about every Element. and at length is turned into the Stone. Let the Philosopher therefore consider the progress of Nature in the Physical Tract. which happeneth by the retrogradation of the Luminaries. The extremes of the Stone are natural Argent vive and perfect Elixir: the middle parts which lie between. it is worth repeating here Jack Linday's assessment of the Ouroborus in alchemical contexts: 10 In the symbolism of Kleopatra and the alchemists in general. the golden Stone. yet it is only one. or Silex (flint). mean distances and mean velocities have been discussed here largely in tabular form. the Stone of the Metals. the corporeal Stone. In a very small selection from: The Hermetic Arcanum. but the simplest is perhaps that of "Hyle. doth wholly exhaust himself. By these and many other names it is called. raiseth it up to the height of sublimity. the Stone of the free. by the mediation of the spiritual tincture. and so agreeable. the Stone of the Sun. In fine by penetrating and tincturing the flowing Elixir it generateth." or first principle of all things. The Circulation of the Elements is performed by a double Whorl. the Ouroboros was used to represent the All. The Whorl extended fixeth all the Elements of the Earth . and lastly. Now in this Whorl there are three Circles placed. return into their first form. from whence the Crow is generated lastly the Stone is divided into four confused elements. and its circle is not finished unless the work of Sulphur be perfected.) Lastly. or Radix (root). penes nos unda tagi") for example. in its aspect of Time: that is. as a system in a ceaseless development. the aeriform Stone. the runaway slave. ca. and sweeteneth the bitter. yet revealing a comprehensive structure which could be defined in the triadic formula. the fountain of earthly things. by the greater or extended and the less or contracted. Xidar. 63. in order succeeding one another. more fully described for this very end. and to 83. things concocted are made raw again and the combination between the position and negative is effected. the fourth Fixation. (The Origins of Alchemy in Graeco-Roman Egypt. The Ablution teacheth how to make the Crow white. the operation of the Fixation fixeth both the White and the Red Sulphurs upon their fixed body. The work of an anonymous author. The Office of Reduction is to restore the soul to the stone exanimated. By Liquefaction bodiescreate the Jupiter of Saturn.1623 ("The Secret Work of the Hermetic Philosophy. composed of hostile elements. although the inter-relationships between the mean planetary periods. or Porta (gate). Xelis. [emphases supplied . The revolution of the minor Whorl is terminated by the extraction and preparation of every Element. whereby the Elements are prepared. and by devouring his tail. it decocteth the Leaven or Ferment by degrees ripeneth things unripe. which always and variously move the Matter. the Stone of the jewel. are of three sorts. we find the following information: 11 61. that if one shall be wanting the labour of the rest is made void . until it shall attain unto perfect strength. the Thirnian Stone. or demonstrative signs: the whole work is perfected by these extremes and means. Atrop. and to nourish it with dew and spiritual milk. and the diversity of methods employed." The Secret Doctrine (2-12). medicinal aspects. There is in fact a wealth of Alchemical material now available. P.. Such analysis is undoubtedly hindered by the proliferation of names. the many allegories.a work that is dated in some respects yet timeless in another: Fortunately. the Bibliotheca Philosphica Hermetica in Holland. Then is all the secret found . in spite of many complications. But even though the subject is to some extent shrouded by secrecy it can nevertheless still be examined in terms of methodology and mathematics rather than numerology or mysticism. animal symbolism. thanks largely to the massive presence of the Alchemy Web Site." and the approximation Pi = 355/113 in "The Mystery of Blackness. the ouroboros and an initial quotation by the alchemist George Ripley (1490) of some significance: "When thou hast made the quadrangle round." and wider issues associated with religious beliefs and origins. especially on the Internet. Blavatsky's minor Kabbalistic excursion into the numbers of the "Dove. and works such as The Pythagorean Pentacle and The Rotation of the Elements by John Opsopaus . the Great Work of the Alchemists appears to be a continuing process. organised by Adam McLean." . see the erudite H. ." the "Raven. for one last example.. properties.The above discussion began with a relatively limited inquiry concerning "Antimony" and as a consequence it skimmed over colors.the latter replete with three-dimensional spiral. alchemical "recipes.
https://www.scribd.com/document/131612012/The-Ouroboros
CC-MAIN-2018-13
en
refinedweb
Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically. Represents the schema of an UltraLite database. public class ULDatabaseSchema All members of ULDatabaseSchema class, including all inherited members. Close method GetConnection method GetNextPublication method GetNextTable method GetPublicationCount method GetTableCount method GetTableSchema method Close methodGetConnection methodGetNextPublication methodGetNextTable methodGetPublicationCount methodGetTableCount methodGetTableSchema method
http://dcx.sap.com/1201/en/ulc/ulc-ulcpp-uldatabaseschema-cla.html
CC-MAIN-2018-13
en
refinedweb
I want a border around the picture when I select it. So if I have 6 pictures and choose 3, I would like to have highlighted borders around those images. Question is,How can I do this? EDIT: I am using React for this dilemma. This depends on how you want to track state in your app.. here is an example which tracks the state in the parent component. Essentially you have a single parent App component which tracks the state for each image, and then an Image component which renders either with or without a border, depending on a piece of the App state which gets passed down as a prop. Refer to the code to see what I mean. An alternative would be to have the active state live within each Image component itself. The code has a number of interesting features mainly due to leveraging several aspects of ES6 to be more concise, as well as React's immutability helper to help update the state array in an immutable way, and lodash's times method to assist in creating our initial state array. Code (some of the indenting got a bit muddled in the copy from jsfiddle..): function getImage() { return { active: false }; } class App extends React.Component { constructor(props) { super(props); this.state = { images: _.times(6, getImage) }; this.clickImage = this.clickImage.bind(this); } clickImage(ix) { const images = React.addons.update(this.state.images, { [ix]: { $apply: x => ({ active: !x.active}) } }) this.setState({ images }); } render() { const { images } = this.state; return ( <div> { images.map((image, ix) => <Image key={ix} ix={ix} active={image.active} clickImage={this.clickImage} />) } </div> ); } }; class Image extends React.Component { render() { const { ix, clickImage, active } = this.props; const style = active ? { border: '1px solid #021a40' } : {}; return <img style={style} src={`{ix}`} onClick={() => clickImage(ix)}/>; } } ReactDOM.render( <App />, document.getElementById('container') ); And then what it looks like:
https://codedump.io/share/ic5SCJUc6vwX/1/react-add-highlighted-border-around-selected-image
CC-MAIN-2018-13
en
refinedweb
Intro to Unit Testing C# code with NUnit and Moq (part 1) So What is Unit Testing?So What is Unit Testing? Unit testing is a development practice centered around testing software components in isolation from their surroundings and dependencies. The key focus of Unit Testing is improving software quality by identifying and resolving defects before they are leaked into production. Multiple studies have shown that the later the defects are discovered, the pricier it gets to fix the software defects. One of Unit Testing's greatest advantages lies in identifying defects as early as possible in the development cycle - specifically as code is being written. Are There Other Benefits to Unit Testing?Are There Other Benefits to Unit Testing? When applied consistently, unit testing provides a wealth of side benefits: Unit tests serve as a form of living documentation for the code, showing each component's intent and clearly communicating intended usage. This contrasts with things like XML documentation, which often fall out of date as the application matures. Tests are constantly written and updated as a normal part of the development cycle, keeping them in closer sync with the application's current state. Unit tests reduce the likelihood of introducing breaking changes when implementing new features and bugfixes. When a breaking change is introduced, it should be exposed when the unit tests are executed. Diligent unit testing also encourages best architectural practices, including Dependency Injection, Inversion of Control, and Composition. Applications written without following these practices are generally very difficult to unit test, usually resulting in a pain point tht is resolved by refactoring to these patterns. Unit tests can also be used to determine release readiness, providing great value in agile environments where requirements and ship dates may change unexpectedly. So What Are The Drawbacks?So What Are The Drawbacks? Although Unit Testing is a powerful tool, it's not a panacea - there can be some downsides to adoption: - Unit testing involves another set of tools and paradigms to learn, presenting a seemingly-daunting learning curve. In practice, the fundamental concepts are relatively simple and with some targeted guidance, engineers can quickly come up to speed. - Unit testing does introduce a certain amount of additional code and maintenance burden - it is, after all, another codebase to maintain. Usually, the efforts are concentrated in the beginning stages — as the application-specific test suite matures (i.e. implementing base test classes, common infrastructure, etc.), the efforts eventually taper off to a fraction of production development efforts. - If you're adding unit tests to an existing project, there may be significant refactoring involved initially in order to make your classes testable. Note: Unit testing is not the only technology available for automated software testing. It fits into a continuum that includes (among many others): - Unit Tests: Test individual components in isolation from environment and concrete dependencies - Integration Tests: Test how concrete components work together within a given subsystem - End-to-End Tests: Test the behavior of an entire system with all parts functioning together I usually distinguish these tests from Automated UI Tests (see below) if I am driving the system via an API instead of a GUI. - Automated UI Tests: These are commonly used for web-based projects, filling a couple of different roles: - Content-based Testing: Verifies that the visual, content, and layout properties of a given view are correct - Functional Testing: Verifies end-to-end functionality by driving the UI and verifying (from the UI layer) that the system functions correctly. In a nutshell, one's selection of testing strategies and tools depends on a variety of factors and tends to vary for each project. So How About a High-Level View?So How About a High-Level View? Sure thing. Unit testing does have several moving parts, but this walkthrough should clear things up: Abstractly speaking, there are usually four main players involved in unit testing: - System Under Test (SUT): This is the code you want to test. In .NET unit testing, this is usually in a class library. - Test Suite: A logical grouping of all the tests for a given system (e.g. "The app's test suite comprises over 9,000 tests") - Test Fixture: This is a class containing tests that exercise the features of the SUT. - Test Runner: This is a tool specific to whichever testing framework you are using. It provides an environment in which Test Suites can be loaded, executed, and verified. Test Suites are usually in their own assembly and are not distributed when pushing an application to production. So let's look at one way such an application might be organized: - (Visual Studio Solution) MyAwesomeApp - (WPF App) MyAwesomeApp.Ui - (Class Library) MyAwesomeApp.BusinessLogic - (Class Library) MyAwesomeApp.BusinessLogic.Tests - (Class Library) MyAwesomeApp.SomeOtherAssembly - (Class Library) MyAwesomeApp.SomeOtherAssembly.Tests For this example, let's assume we're following WPF best practices and avoiding CodeBehind in our UI layer (the main reason is that CodeBehind is very difficult to test). Because of this choice, we do not have a test assembly for MyAwesomeApp.Ui. On the other hand, both MyAwesomeApp.BusinessLogic and MyAwesomeApp.SomeOtherAssembly have associated unit test assemblies, each of which only contains related unit tests - No application logic goes into unit test assemblies. Note: There are many schools of thought on what parts of the codebase should be covered by unit tests. Some environments are very strict, aiming for 100% coverage at all times, while others make pragmatic exceptions such as these: - Don't write tests for Plain Old CLR Objects (POCOs) - POCOs are data transfer objects and should not have behaviors. - Don't test code that is purely a wrapper over a .NET Framework object (i.e. Directory, File, etc.) - If a class is a pure wrapper (not adding any new or behavior), unit tests end up just testing the .NET Framework, which is not our responsibility. In the end, it's up to your team to determine which strategy makes the most sense for your needs. OK, So Let's Get Down To It!OK, So Let's Get Down To It! Prerequisites: I'll keep the tools to a minimum, but you'll definitely need a development environment of some sort. If you're just starting out, I recommend Visual Studio Community Edition, a free development environment for applications targeting the .NET framework. Important Note for VS Community Users: I will be writing tests in this tutorial using the NUnit Library. Although NUnit has a standalone test runner, it is much more convenient to run the tests within your development environment. There is a VS Community Plugin that adds support for NUnit 3.x tests to the development environment. Hello NUnit!Hello NUnit! So, let's write our first, super-simple unit test! Start by launching Visual Studio and creating a new Class Library project called UnitTesting.GettingStarted.Tests. (We're starting with the test library so you can get a taste of NUnit before we dive deeper) Delete the Class1.csfile created by Visual Studio Go to Tools -> NuGet Package Manager -> Package Manager Console, and the console will open at the bottom of the development window. In the Package Manager Console window, type Install-Package NUnitand hit return. NuGet will install the NUnit libraries we need and reference them in the test project. In the Package Manager Console window, type Install-Package Moqand hit return. We'll be using Moq later in the tutorial, so we might as well install it now. In Solution Explorer, right-click the project and select Add -> Class...and call it HelloNunit.cs Update HelloNUnit.cs like so: // -------------------------------------------------------------------------------------- // UnitTesting.GettingStarted.Tests.HelloNunit.cs // 2017/01/12 // -------------------------------------------------------------------------------------- using NUnit.Framework; namespace UnitTesting.GettingStarted.Tests { [TestFixture] public class HelloNunit { [Test] public void TestHelloNunit() { Assert.That(true, Is.False); } } } So what exactly did we do there? Short Answer: We wrote our first unit test (which will fail if you run it right now). Let's break down the structure a bit: Notice that the test class (HelloNunit) has a TestFixture attribute attached to it. This marks the HelloNunit class as containing tests when it is loaded by the NUnit Test Runner. We have a similar pattern on the TestHelloNunit() method, but we use the Test attribute instead, to indicate that this method is a test. It's important to know that the Test Class (HelloNunit) and Test Method(TestHelloNunit) names can be whatever you want - the important part is that they be marked with the TestFixture/Test attribute as appropriate. With that in mind, it's usually best for your Test Method names to clearly describe what they're testing. I'll have some additional guidance on that coming up shortly. Within our TestHelloNunit method, we have an Assertion, which is how we verify whether or not a given test should pass. The general pattern goes like this: Assert.That([the actual value], Is.EqualTo([your expected value])). If the assertion evaluates to false, the test fails. A Note About NUnit Assertions: Although we're using the simple Is.EqualTo()assertion here, NUnit provides a wide variety of assertion types to suit nearly any assertion need - You can even write custom assertions if your situation requires it. For a complete list of assertion types, see: the NUnit documentation. Sharp eyes may have noticed this statement: Assert.That(true, Is.EqualTo(false)) — that's correct, this test cannot pass as written because we're asserting that true is equal to false. Go ahead and execute the test ( CTRL+R, A in Visual Studio) and see what we get in the test results window: So... Let's go back to HelloNunit.cs and make that test pass. Change the Is.False to Is.True and re-run the test - NUnit tells us that all tests passed, so everything is working correctly. Wasn't that a bit pointless? It looks like we're not testing anything useful. Very true - this exercise simply intended to introduce the most basic concepts related to NUnit: TestFixtures, Tests, and Assertions. It also illustrated the fact that TestFixtures are classes (decorated with the TestFixtureAttribute), while Tests are methods (decorated with the TestAttribute) on those classes. Before we dive in deeper, let's take a quick look at what happens when we run our unit tests: - The NUnit Test Runner launches and initializes its runtime environment - The Test Runner analyzes the assembly, looking for classes decorated with the TestFixture attribute - For each of those classes, the Test Runner looks for methods decorated with the Test attribute and executes them - When the entire test suite has completed, the Test Runner reports pass/fail statistics for the test run Q: Test Suites are usually made up of many tests, so what happens if one fails somewhere in the middle? A: When a test fails, NUnit notes which test it was (along with other details) and continues running other tests. When the test run completes, the test results indicate which tests passed vs. failed: OK, Now let's do something a little more useful...OK, Now let's do something a little more useful... The first example showed you some of NUnit's parts, but it wasn't really a typical use case. Let's flesh it out a bit with a more realistic example. - Open the UnitTesting.GettingStarted.Tests solution - Delete the HelloNunit.cs file - In Solution Explorer, right-click on the solution and select Add -> New Project... - In the New Project dialog, select "Class Library" and call it UnitTesting.GettingStarted - In the UnitTesting.GettingStartedproject, delete the Class1.csfile created by Visual Studio - In the UnitTesting.GettingStarted.Testsproject, add a reference to the UnitTesting.GettingStartedproject What did we just do there? All that was was just setting up the environment. We cleaned up the HelloNunit.cs file because we don't need it anymore, then we created a project to contain the code we want to test, and then referenced that project from our unit test assembly. Now, let's make things sort of interesting... Note: I'm not following strict Test-Driven Development (TDD) practices here. If you would like additional information on TDD, please take a look at The TDD Guy. Let's implement a simple calculator service that we can test: In the UnitTesting.GettingStartedproject, add a class called Calculator Update the class like so: // -------------------------------------------------------------------------------------- // UnitTesting.GettingStarted.Calculator.cs // 2017/01/12 // -------------------------------------------------------------------------------------- namespace UnitTesting.GettingStarted { public class Calculator { public int Add(int lhs, int rhs) { return lhs + rhs; } } } In the UnitTesting.GettingStarted.Testsproject, add a class called CalculatorTestsand update it like so: // -------------------------------------------------------------------------------------- // UnitTesting.GettingStarted.Tests.CalculatorTests.cs // 2017/01/12 // -------------------------------------------------------------------------------------- using NUnit.Framework; namespace UnitTesting.GettingStarted.Tests { [TestFixture] public class CalculatorTests { [Test] public void Add_Always_ReturnsExpectedResult() { var systemUnderTest = new Calculator(); Assert.That(systemUnderTest.Add(1, 2), Is.EqualTo(3)); } } } A Quick Note on Test Names: Descriptive test names are very important, particularly as your test suite grows. I tend to follow this pattern: [Subject]_[Scenario]_[Result], where: - Subject is usually the name of the method I'm testing - "Add" in this case. - Scenario describes the circumstances that this test covers. A more complex example might be GrantLoan_WhenCreditLessThan500_ReturnsFalse, but in this simple case "Always" will suffice - we don't really ever want unexpected results from our calculator . - Result describes the expected outcome of invoking the method under test, in this case, the method should return the correct answer As your test suite evolves, descriptive test names can turn into an additional form of developer documentation, outlining the behaviors and expectations of the system in code. Getting a Little Fancier: Parameterized TestsGetting a Little Fancier: Parameterized Tests What if you need to check a particular method multiple times for different input? Fortunately, NUnit provides two different ways of parameterizing tests. Let's say we want to make sure our calculator gives the correct answer for [2,3], [3,5], and [1000,1]: Open CalculatorTests.cs and edit the code like so: // -------------------------------------------------------------------------------------- // UnitTesting.GettingStarted.Tests.CalculatorTests.cs // 2017/01/12 // -------------------------------------------------------------------------------------- using NUnit.Framework; namespace UnitTesting.GettingStarted.Tests { [TestFixture] public class CalculatorTests { [TestCase(1, 2)] [TestCase(2, 3)] [TestCase(3, 5)] [TestCase(1000, 1)] public void Add_Always_ReturnsExpectedResult(int lhs, int rhs) { var systemUnderTest = new Calculator(); var expected = lhs + rhs; Assert.That(systemUnderTest.Add(lhs, rhs), Is.EqualTo(expected)); } } } Notice that we've changed the [Test] attribute to [TestCase(...)], and we've added two arguments to our test method signature. The parameters to the TestCase attribute match up to the test method arguments, and the values are injected when the test is executed. If you execute the test suite now, you will notice it indicates 4 passing tests - This is because the TestCase attribute causes the test to be executed once for each set of values. Note: A similar pattern you may observe is used for testing edge cases and other scenarios. For example, imagine if our CreditDecision class from above has logic like so: // Remainder of class omitted for brevity public string MakeCreditDecision(int creditScore){ if(creditScore < 550) return "Declined"; else if(creditScore <= 675) return "Maybe"; else return "We look forward to doing business with you!"; } We might need to test that our cutoff points between Declined, Maybe, and Yes answers are being honored by the CreditDecisioncomponent. In that case, we could set up tests like so: ); } So we've just barely scratched the surface of NUnit's power, but let's take a quick glance at a related tool: Moq! Testing in Isolation: Moq to the Rescue!Testing in Isolation: Moq to the Rescue! So the examples we've seen so far have been utterly trivial, only testing one class that doesn't have any external dependencies at all. Although easy to grasp, it doesn't really reflect real-world scenarios. In a real-world project of any scale, there will be multiple classes working together, sometimes with dependencies on external systems as well. Although testing against a live system is a valid integration / end-to-end testing strategy, it is not appropriate for unit tests, for example: What's the Big Deal About Testing in Isolation? Imagine if our calculator class didn't do the calculations itself, but relied upon a back-end web service to provide the answers, which takes the server approximately 1 second to complete each case. If we test against a live system, 100 test cases would take 100 seconds to execute due to the back-end latency. Moreover, just to test one simple aspect of the system would require a fully-functioning backend, no matter what environment is being used for the tests. Worse yet, because such tests would be based on a chain of possible tiers, a test might fail 'for the wrong reason', i.e. the logic being tested is correct, but some other part of the system (i.e. network communication, etc.) failed. . In the Github Project for this tutorial, there is a class called BadCreditDecisionTests that provides additional information on the benefits of testing in isolation. So How do we Solve This? Ah, such a deceptively simple question In reality, the solution has several parts that work together: - Dependency Injection: Allows us to specify alternate implementations of dependencies when testing - 'Programming to the Abstraction': Whenever possible, specify dependencies as interfaces so we can mock them during testing - Mocks (and related concepts of Fakes and Stubs): Mocks are stand-ins for a class' normal dependencies, used only at test time. They are capable of simulating interactions, returning values, and raising events, and can also cause a test to fail if their configured expectations are not met. OK, so how does it all fit together? Let's start with our abstract-ish CreditDecision component from before. Let's imagine that the component needs to ask a remote web service for a credit decision (we're going to skip the backend part here though...) We might expect the class to look something like this: public class CreditDecision{ public string MakeCreditDecision(int creditScore){ var service = new CreditDecisionService(); return service.GetCreditDecision(creditScore); } } Houston, We Have a Problem... OK, technically this code might be testable, but we're having to call into the external CreditDecisionService every time we want to test it. The reason this is a problem is that this code does not follow the Dependency Injection principle - Since it creates its own dependency (the CreditDecisionService), we cannot control what happens at test time. We can take a step in the right direction by refactoring the class for dependency injection: public class CreditDecision{ CreditDecisionService creditDecisionService; public CreditDecision(CreditDecisionService creditDecisionService) { this.creditDecisionService = creditDecisionService; } public string MakeCreditDecision(int creditScore){ return creditDecisionService.GetCreditDecision(creditScore); } } Now we're at least injecting CreditDecisionService, so we're ready to go, right? Not quite... We're still not programming to an abstraction yet - the CreditDecision depends on the concrete CreditDecisionService type instead of an abstraction such as an interface or abstract class. Because of this, we cannot inject a mock instance of CreditDecisionService (most mocking frameworks work with abstractions). Let's update the code so we can finally start testing! // This assumes that there is an existing ICreditDecisionService interface // and that CreditDecisionService implements it. public class CreditDecision{ ICreditDecisionService creditDecisionService; public CreditDecision(ICreditDecisionService creditDecisionService) { this.creditDecisionService = creditDecisionService; } public string MakeCreditDecision(int creditScore){ return creditDecisionService.GetCreditDecision(creditScore); } } Now we're ready to start cooking! Moq: Skimming the SurfaceMoq: Skimming the Surface Moq (pronounced either "Mock" or "Mock You", I stick with "Mock") is a framework that allows us to simulate dependencies at test time and monitor how our system under test interacts with them under various circumstances. In a nutshell, this is how it works: - In our test class, we create a Mock instance for each dependency that the system under test relies upon. - We configure our mock's various expectations and tell it what values to return under what circumstances - We inject those mock instances (see code below) when creating our system under test - We execute the method we want to test - We ask each Mock to verify that all of its expectations were met For example, a test suite for our CreditDecision component above might look like: namespace UnitTesting.GettingStarted.Tests { [TestFixture] public class CreditDecisionTests { Mock<ICreditDecisionService> mockCreditDecisionService; CreditDecision systemUnderTest; [TestCase(100, "Declined")] [TestCase(549, "Declined")] [TestCase(550, "Maybe")] [TestCase(674, "Maybe")] [TestCase(675, "We look forward to doing business with you!")] public void MakeCreditDecision_Always_ReturnsExpectedResult(int creditScore, string expectedResult) { mockCreditDecisionService = new Mock<ICreditDecisionService>(MockBehavior.Strict); mockCreditDecisionService.Setup(p => p.GetDecision(creditScore)).Returns(expectedResult); systemUnderTest = new CreditDecision(mockCreditDecisionService.Object); var result = systemUnderTest.MakeCreditDecision(creditScore); Assert.That(result, Is.EqualTo(expectedResult)); mockCreditDecisionService.VerifyAll(); } } } The test itself should look familiar, but there have been some changes... Notice that we declare a variable of type Mock<ICreditDecisionService> - this will end up representing the ICreditDecisionService that the system under test depends upon. Just inside our test method, you'll see us creating and configuring the mock: mockCreditDecisionService = new Mock<ICreditDecisionService>(MockBehavior.Strict); mockCreditDecisionService.Setup(p => p.GetDecision(creditScore)).Returns(expectedResult); We'll cover the MockBehavior.Strict bit in a minute, but let's focus on that second line - this is where we configure the mock for this test. In this case, we're telling the mock, "Hey Mock, if your GetDecision method is invoked with this specific number (creditScore), return this response (expectedResult). If it gets invoked with any other number, fail the test immediately". (that's part of MockBehavior.Strict) Next up, we execute the MakeCreditDecision method just like we did before, the only remaining step is to ask our Mock instance if all of its expectations were fulfilled using mockCreditDecisionService.VerifyAll() Note - Mock Behaviors: You'll notice that when I create the mock above, I'm specifying an argument of MockBehavior.Strict. This is a Moq-specific concept, best explained as: - Loose mocks will not notify you if unexpected actions occur, including unexpected method arguments, events, and method invocations. On a loose mock, if a property getter is not configured, the mock will simply return the property type's default value, leading to subtle and difficult-to-diagnose bugs. - Strict mocks are the tattletales of the mock world - unless everything goes as expected (as configured when setting up the mock), they will fail the test. In my own coding, I prefer using Strict mocks because they require me to be very explicit about what I expect to occur when a method under test is invoked. It's also important to note that both Loose and Strict mocks will behave the same way with VerifyAll()- In either case, if there are any unmet expectations on the mock the test will fail. ConclusionConclusion This tutorial only scratched the very surface of Unit Testing C# code with NUnit and Moq. However, I hope it has provided you with some additional understanding and perspective on this challenging, but highly beneficial practice. For more information on Unit Testing, check out this post. Future tutorials will cover more advanced topics including: - Dynamic test cases withNUnit's TestCaseSource subsystem - Complex Moq configurations including sequences, exceptions, and eventing
https://www.codementor.io/copperstarconsulting/intro-to-unit-testing-c-code-with-nunit-and-moq-part-1-y2b9iv8iq
CC-MAIN-2018-13
en
refinedweb
Are you sure? This action might not be possible to undo. Are you sure you want to continue? Using MPI Nick Maclaren Computing Service nmm1@cam.ac.uk, ext. 34761 May 2008 Programming with MPI – p. 1/? Warning This lecture covers a huge number of minor points Including all of the ‘housekeeping’ facilities Don’t try to remember all details, initially • Try to remember which facilities are included Refer back to this when doing the practicals It’s a lot easier than it looks at first Programming with MPI – p. 2/? Using MPI • By default, all actual errors are fatal MPI will produce some kind of an error message With luck, the whole program will then stop Can ask to do your own error handling – see later • Use one interface: Fortran, C or C++ C can be used from C++, but don’t mix them Yes, you can mix them – but it’s advanced use Programming with MPI – p. 3/? Function Declarations There are proformas for all functions used Anything merely mentioned is omitted, for clarity Interfaces/Fortran Interfaces/C Interfaces/C++ The examples don’t give the syntax in detail Check those files when doing the practicals Programming with MPI – p. 4/? MPI’s Fortran Interface (1) • If possible, include the statement: • If not, use: USE mpi INCLUDE ’mpif.h’ after all ‘‘USE’’s and ‘‘IMPLICIT’’ Note the first is ‘‘mpi’’ and the second ‘‘mpif.h’’ If both fail, usually a usage / installation problem All MPI names start with MPI--• Don’t declare names starting MPI or PMPI ----Names PMPI--- are used for profiling Programming with MPI – p. 5/? MPI’s Fortran Interface (2) Almost all MPI constants are PARAMETER One MPI--1 exception: MPI---BOTTOM There are a few more in MPI--2 Boolean values (true/false) are LOGICAL Process numbers, error codes etc. are INTEGER Element counts etc. are also plain INTEGER This isn’t a problem on any current system Arrays start at one, where it matters Programming with MPI – p. 6/? MPI’s Fortran Interface (3) Handles (e.g. communicators) are opaque types [ One you can’t break apart and look inside ] Undocumented and unpredictable INTEGER values Use built--in equality comparison and assignment Call MPI functions for all other operations I.e. MPI returns INTEGER values as tokens If their values match, they are the same token Programming with MPI – p. 7/? MPI’s Fortran Interface (4) Type--generic arguments are a kludge MPI relies on Fortran not noticing them Will describe the issues later For now, just pass arrays of any type If the compiler objects, ask me for help Programming with MPI – p. 8/? MPI’s Fortran Interface (5) • Almost all MPI functions are SUBROUTINEs The final argument returns an INTEGER error code Success returns MPI---SUCCESS (always zero) Failure codes are implementation dependent Only three MPI--1 exceptions: mainly MPI---Wtime There are only a couple more in MPI--2 All results are returned through arguments Programming with MPI – p. 9/? MPI’s Fortran Interface (6) As people will know, default REAL is a disaster DOUBLE PRECISION is tedious and out--of--date Start all procedures, modules etc. with USE double USE mpi IMPLICIT NONE There is a suitable file Programs/double.f90 Ask for help if you don’t know how to use it Programming with MPI – p. 10/? MPI’s C Interface (1) • This is also usable from C++, of course C++ people need to listen to this section, too I will cover the common C/C++ aspects here Include the statement: #include "mpi.h" All MPI names start with MPI--• Don’t declare names starting MPI or PMPI ----Names PMPI--- are used for profiling Programming with MPI – p. 11/? MPI’s C Interface (2) Boolean values (true/false) are int, as usual Process numbers, error codes etc. are int Element counts etc. are also plain int This isn’t a problem on any current system Arrays start at zero, where it matters Type--generic arguments are void * These are called ‘‘choice’’ arguments by MPI Programming with MPI – p. 12/? MPI’s C Interface (3) The next two slides apply only to C, not C++ Handles (e.g. communicators) are opaque types Names are set up by typedef and are scalars Use built--in equality comparison and assignment Call MPI functions for all other operations The main such opaque types are: MPI---Comm, MPI---Datatype, MPI---Errhandler, MPI---Group, MPI---Op, MPI---Request, MPI---Status Programming with MPI – p. 13/? MPI’s C Interface (4) • Almost all MPI functions return an error code This is the function result as an int Can ignore it, if using default error handling Success returns MPI---SUCCESS (must be zero) Failure codes are implementation dependent Only three MPI--1 exceptions: mainly MPI---Wtime There are only a couple more in MPI--2 • All results are returned through arguments Programming with MPI – p. 14/? MPI’s C++ Interface (1) This was introduced by MPI--2, but we shall use it A ‘‘proper’’ C++ interface, not just a hacked C one Include the statement: #include "mpi.h" Almost all names omit the MPI--- prefix and are declared in the namespace MPI E.g. MPI---Init becomes MPI::Init And MPI---TYPE---INT becomes MPI::TYPE---INT Programming with MPI – p. 15/? MPI’s C++ Interface (2) Some name changes – will mention when needed Mostly because MPI--2 has cleaned up its naming The new names will often work in C and Fortran The old ones are deprecated, and are not in C++ Some other systematic changes, though E.g. Get--- is added before information calls C: MPI---Comm---size(MPI---COMM---WORLD) C++: MPI::COMM---WORLD.Get---size() Namespace PMPI is used for profiling Programming with MPI – p. 16/? MPI’s C++ Interface (3) • Most is almost identical to the C interface E.g. the definitions of most constants • I won’t repeat the information that is unchanged Only three major differences (in a moment) Minor differences will be described when needed • This course describes only what it needs Programming with MPI – p. 17/? MPI’s C++ Interface (4) MPI handles are classes in C++ I.e. C opaque types become C++ classes Almost all MPI functions are member functions E.g. MPI---Send becomes MPI::Comm.Send A typical use is MPI::COMM---WORLD.Send • Classes have a proper C++ interface You must read the details, for more than trivial use Esp. creation, deletion, copying and comparison Programming with MPI – p. 18/? MPI’s C++ Interface (5) In C++, Comm is purely a base class You always declare one of its derived classes • The only one relevant here is Intracomm Some methods are only in Intracomm Though many are moved to Comm in MPI--2 [ Don’t bother understanding why, for now ] • So we shall always use Intracomm in C++ Everywhere that C uses the opaque type Comm C++ inheritance means that will work Programming with MPI – p. 19/? MPI’s C++ Interface (6) The next big difference is in error handling That has consequential changes on the interface Functions do not return error values Instead, they throw a C++ exception There is a new class Exception Functions that deliver a scalar result return that value as the function result Others become void functions in C++ Programming with MPI – p. 20/? MPI’s C++ Interface (7) The last big difference is the use of references Essentially all output arguments become references Here, MPI’s C++ is more like Fortran than C MPI---Init(&argc,&argv) ⇒ MPI---Init(argc,argv) That doesn’t apply to array and pointer arguments E.g. all ones that are transfer buffers stay the same Programming with MPI – p. 21/? More on Interfaces • That is all you need for now We will return to language interfaces (much) later • Advanced language facilities to avoid • Interfaces for advanced MPI programming • Performance and optimisation issues Programming with MPI – p. 22/? Compiling and Running This is all very implementation--dependent, of course But, on most systems, do something like this: Compile and link using mpif95, mpicc, mpiCC Run using ‘‘mpiexec –n <n> <program> [args ...]’’ <n> is the number of processes to use When using a job scheduler (queuing system) you may need to put the latter in a script • This course will use MPI only in SPMD mode Programming with MPI – p. 23/? Starting and Stopping • For now, we will ignore error handling All processes must start by calling MPI---Init And, normally, finish by calling MPI---Finalize • These are effectively collectives Call both at predictable times, or risk confusion • You can’t restart MPI after MPI Finalize --- MPI---Init must be called exactly once Programming with MPI – p. 24/? Fortran Startup/Stopping Fortran argument decoding is behind the scenes USE double USE mpi IMPLICIT NONE INTEGER :: error CALL MPI---Init ( error ) CALL MPI---Finalize ( error ) END If that doesn’t work, see the MPI documentation • Though you will probably need to ask for help Programming with MPI – p. 25/? C Startup/Stopping MPI---Init takes the addresses of main’s arguments • You must call it before decoding them Some implementations change them in MPI---Init #include "mpi.h" int main (int argc , char argv [] ) { MPI---Init ( & argc , & argv ) ; MPI---Finalize ( ) ; return 0 ; } * Programming with MPI – p. 26/? C++ Startup/Stopping (1) using namespace std ; #include "mpi.h" int main (int argc , char argv [] ) { MPI::Init ( argc , argv ) ; MPI::Finalize ( ) ; return 0 ; } * Any other valid use of namespace MPI is OK E.g. you could add ‘‘using namespace MPI ;’’ and omit all of the MPI:: Programming with MPI – p. 27/? C++ Startup/Stopping (2) The arguments are references not pointers You can also call Init with no arguments • Watch out with that – I am not sure how it works Programming with MPI – p. 28/? Aside: Examples I will omit the following statements, for brevity: USE double USE mpi IMPLICIT NONE #include "mpi.h" using namespace std ; #include "mpi.h" Include them in any ‘‘module’’ where you use MPI Don’t rely on implicit declaration Programming with MPI – p. 29/? Testing MPI’s State (1) You can test the state of MPI on a process • This is needed only when writing library code [ MPI---Finalized is only in MPI--2 ] Fortran example: LOGICAL :: started , stopped INTEGER :: error CALL MPI---Initialized ( started , error ) CALL MPI---Finalized ( stopped , error ) Programming with MPI – p. 30/? Testing MPI’s State (2) C example: int started , stopped , error ; error = MPI---Initialized ( & started ) ; error = MPI---Finalized ( & stopped ) ; C++ example: int started , stopped ; started = MPI::Is---initialized ( ) ; stopped = MPI::Is---finalized ( ) ; Note C++ uses different names to Fortran and C Programming with MPI – p. 31/? Global Communicator The global communicator is predefined: MPI---COMM---WORLD It includes all usable processes e.g. the <n> set up by ‘‘mpiexec –n <n>’’ Many applications use only this communicator • Almost all of this course does, too There is one lecture on communicators Programming with MPI – p. 32/? Process Rank The rank is the process’s index always within the context of a communicator A rank is an integer from 0 to <n>--1 Yes, this applies to Fortran, too There is one predefined rank constant: MPI---PROC---NULL – no such process MPI::PROC---NULL in C++ Don’t assume this is negative – or that it isn’t We shall describe the use of it when relevant Programming with MPI – p. 33/? Information Calls (1) MPI---Comm---size returns the number of processes MPI---Comm---rank returns the local process number Fortran example: INTEGER :: nprocs , myrank , error CALL MPI---Comm---size ( & MPI---COMM---WORLD , nprocs , error ) CALL MPI---Comm---rank ( & MPI---COMM---WORLD , myrank , error ) Programming with MPI – p. 34/? Information Calls (2) C example: int nprocs , myrank , error ; error = MPI---Comm---size ( MPI---COMM---WORLD , & nprocs ) ; error = MPI---Comm---rank ( MPI---COMM---WORLD , & myrank ) ; C++ example: int nprocs , myrank ; nprocs = MPI::COMM---WORLD.Get---size ( ) ; myrank = MPI::COMM---WORLD.Get---rank ( ) ; Note the addition of Get--- in C++ Programming with MPI – p. 35/? Information Calls (3) You can query the local processor name A string of length MPI---MAX---PROCESSOR---NAME Fortran example: CHARACTER ( LEN = & MPI---MAX---PROCESSOR---NAME ) :: procname INTEGER :: namelen , error CALL MPI---Get---processor---name ( procname , & namelen , error ) Programming with MPI – p. 36/? Information Calls (4) C example: char procname [ MPI---MAX---PROCESSOR---NAME ] ; int namelen , error ; error = MPI---Get---processor---name ( procname , & namelen ) ; C++ example: char procname [ MPI::MAX---PROCESSOR---NAME ] ; int namelen ; MPI::Get---processor---name ( procname , namelen ) ; The second argument is a reference not a pointer Programming with MPI – p. 37/? Information Calls (5) MPI---Wtime gives elapsed time (‘‘wall--clock time’’) Seconds since an unspecified starting point The starting point is fixed for a process Doesn’t change while the process is running I have seen start of process, system boot time, Unix epoch and 00:00 Jan. 1st 1900 MPI---Wtick similar but gives timer resolution Few people bother – but it’s there if you want it Programming with MPI – p. 38/? Information Calls (6) Fortran: REAL(KIND=KIND(0.0D0)) :: now now = MPI---Wtime ( ) C: double now ; now = MPI---Wtime ( ) ; C++: double now ; now = MPI::Wtime ( ) ; Programming with MPI – p. 39/? Information Calls (7) Anywhere from MPI---Init to MPI---Finalize They are all purely local operations Use them as often as you need them MPI---Comm---size same result on all processes • Others may give different ones on each process • That includes MPI Wtime’s starting point --- As well as the value returned from MPI---Wtick Programming with MPI – p. 40/? Information Calls (8) MPI 1.2 and up provide version number information • Not needed for simple use, as in this course All versions of MPI are essentially compatible Constants MPI---VERSION, MPI---SUBVERSION in ALL of Fortran, C and C++ Set to 1, 2 for MPI 1.3 or 2, 1 for current MPI--2 There is also a function MPI---Get---version MPI::Get---version in C++ Which can be called even before MPI---Init Programming with MPI – p. 41/? Barrier Synchronisation (1) MPI---Barrier synchronises all processes They all wait until they have all entered the call Then they all start up again, independently • The only collective that synchronises We will come back to this later Programming with MPI – p. 42/? Barrier Synchronisation (2) Fortran example: INTEGER :: error CALL MPI---Barrier ( MPI---COMM---WORLD , error ) C example: int error ; error = MPI---Barrier ( MPI---COMM---WORLD ) ; C++ example: MPI::COMM---WORLD.Barrier ( ) ; Programming with MPI – p. 43/? Abandoning All Hope (1) MPI---Abort is the emergency stop • Always call it on MPI COMM WORLD ----Not a collective but should stop all processes and, on most systems, it usually does ... • Outstanding file output is often lost Far better to stop normally, if at all possible I.e. all processes call MPI---Finalize and exit • MPI Abort is the emergency stop --- Programming with MPI – p. 44/? Abandoning All Hope (2) Fortran: INTEGER :: error CALL MPI---Abort ( MPI---COMM---WORLD , <failure code> , error ) & C: int error ; error = MPI---Abort ( MPI---COMM---WORLD , <failure code> ) ; C++: MPI::COMM---WORLD.Abort ( <failure code> ) ; Programming with MPI – p. 45/? Lookahead to I/O I/O in parallel programs is always tricky It’s worse in MPI, because of MPI’s portability Each type of parallelism has different oddities • For now, just write to stdout or stderr And the default output in Fortran, of course It will work well enough for the examples • We will come back to using I/O later Programming with MPI – p. 46/? First Practical You can actually do quite a lot with just these Start by writing a trivial test program Then writing a command spawner This is very useful, and there are several around • Yes, some practical uses ARE that simple! Use any language you like, that can call MPI Examples will be in Fortran, C and (bad) C++ Programming with MPI – p. 47/? Practical Issues Compile and link using mpif95, mpicc, mpiCC Run using ‘‘mpiexec –n <n> <program> [args ...]’’ <n> is the number of processes to use Unfortunately, the PWF uses single core systems All the examples will work, but very slowly I have set up OpenMPI, which has a few bugs You need to ignore a few warnings – but only those Programming with MPI – p. 48/? Ignorable Warnings Fortran: Warning: Procedure ’...’ called with an implicit interface at (1) For most of the MPI calls – but only those C++: /usr/local/OPENMPI/include/openmpi/ompi/mpi/cxx/comm---inln.h:... warning: unused parameter ’...’ Regrettably, there are quite a lot of these C: /usr/local/OPENMPI/include/mpi.h:220: warning: ISO C90 does not support ’long long’ Programming with MPI – p. 49/?
https://www.scribd.com/document/33508601/Programming-with-MPI
CC-MAIN-2018-13
en
refinedweb
Red Hat Bugzilla – Bug 557989 Can't upgrade FC 10 to FC 11: "Dirty file systems" Last modified: 2011-11-30 11:37:58 EST Created attachment 386260 [details] My hardware configuration, i.e. the output from "udevinfo --export-db" I have a machine that had Fedora Core 10 installed on it fresh (i.e. on a blank hard drive). When I try to upgrade to Fedora Core 11, I get to the point where it asks me which Linux installation I want to upgrade, I select the existing one, and it tells me I have "Dirty file systems", and lists my Linux installation's root filesystem (i.e. /dev/sda5) as dirty. It's not dirty. It's fine. I can boot it and all is well. I even tried running e2fsck on all my Linux partitions from FC11 rescue mode, in case something had changed between FC10 and FC11, but I still have the same problem. I'm more than happy to provide additional information, or run test scripts or whatever, to identify the problem. I've attached the output of "udevinfo --export-db" to this report; if there's a better way to explain my hardware configuration, please let me know. Here's my filesystem layout (from "df"): Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda3 181847760 5446280 167164108 4% / /dev/sda6 55345184 285524 52248288 1% /tmp /dev/sda5 55345184 3139272 49394540 6% /home /dev/sda1 77749 15811 57924 22% /boot /dev/sdb1 962571764 337406360 625165404 36% /video /dev/sdb2 500575900 76295592 424280308 16% /data tmpfs 1687252 1160 1686092 1% /dev/shm Thank you for your attention to this. I'd love to upgrade but can't. Please try to upgrade again, and once you hit the error, switch to tty2 (ctrl + alt + F2), and collect all the log files under /tmp. You can use for example scp to get the from there, and then attach them here. Created attachment 386664 [details] Install logs, as requested I ended up installing FC 12 fresh on the machine I mentioned earlier. However, I have another FC 10 machine that's having the same problem. Attached are the install logs from that attempt. Sorry for the unnecessary complication, but I got "motivated" this weekend :-) Let me know if you need more info on that machine, e.g. the HW dump or the exact partitioning layout. (Its partitioning is similar to the one I reported originally.) Again, sorry for the unnecessary complication. Was that information sufficient? Do you need any more? Hmm, So it seems that libext2fs does not like your filesystem. Can you try the following to confirm that that really is the problem: -start the F-12 installer (on the same system as you used in comment #2) -when add the GUI welcome screen switch to tty2 (ctrl + alt + F2) -on this terminal execute: cd /usr/lib/anaconda/ python -and then at the python prompt type import _isys print _isys.e2dirty("/dev/sda5") And then report back here with the output of those python commands. Note if you are using a 64 bit install, the cd command should be: cd /usr/lib64/anaconda/ Regards, Hans If I execute that command at any point from the first X Windows screen to just before selecting the existing Fedora Core installation to upgrade, it prints "0". Once I select the existing Fedora Core installation to upgrade, and I get the "Dirty file systems" message, it prints "1". Let me know what other information I can provide. <ugh> So we are doing something to the filesystem making it seen as marked dirty by the time we do the check (maybe we have it mounted at the time ?). I'm not very familiar with this part (upgrade path) of the code, so I'm going to assign this to a team member. Dave if you're not the right person for this please re-assign to whomever is. Regards, Hans p.s. Steve have you considered upgrading directly to F-12, chances are this issue is fixed there ? I didn't feel safe skipping a version, so I was trying to use FC 11. But I tried FC 12 for the heck of it and the same thing happens, yes. I'm willing to assist you in any way to track down this problem, but since I haven't gone through all the fun of learning anaconda, I need your assistance. :-) It looks like we never unmount sda5 after mounting it on /mnt/sysimage to check if it's an upgradable root filesystem. Please attach the logs from your attempt with F12 -- they may help us to see what is happening. Thanks. Created attachment 388935 [details] Install logs, as requested Here are the logs from an attempted FC12 upgrade, as it happens in FC 12, and FC 11 is nearing end-of-life, I updated the bug to say FC 12. Very interested in seeing this resolved as I am encountering the same issue. In my case, I'm trying a straight upgrade from F10 to F12 via preupgrade. By the way, running a df in the alternate console shows that the offending partition (in my case /dev/sda1) is still mounted to /mnt/sysimage. Possibly confirms what was posited earlier. So is there anything I can do about this problem? I tried upgrading the same machine to FC 13 using preupgrade, but you can see bug 598389 for info on how that went. Today I hit is bug when using preupgrade to upgrade my Eeepc from Fedora 12 to 13. I was able to work around the bug by doing the following: o "unpacked" the downloaded install.img using unsquashfs install.img This creates a new directory named "squashfs-root" in the current directory. o Edit squashfs-root/usr/lib/anaconda/upgrade.py, search for "allowDirty = 0" and change the 0 to 1. This change lets anaconda ignore the fact that the filesystem was detected as "dirty". o re-create an install image: mksquashfs squashfs-root install.img o Make sure that the upgrade will use the modified install.img instead of the original one. Try this at your own risk; YMMV. You need the squashfs-utils package, which provides both the unsquashfs and mksquashfs commands. Since my Eeepc has only 8 GB onboard flash storage, I had to use an extra USB memory stick for this procedure, but it worked nevertheless, even loading the modified install.img from this USB stick. (In reply to comment #14) > Today I hit this bug when using preupgrade to upgrade my Eeepc from Fedora 12 > to 13. I tried the same thing today with my FC 12 system, and your suggestion was key to getting around the "Dirty file systems" problem! I have some additional info, though. 1) I had to disconnect all my non-system hard drives, in order to avoid other weird installation bugs. 2) The package is actually called squashfs-tools, not squashfs-utils. 3) My installation died when the computer locked up while switching between X Windows and the virtual consoles. My computer does that commonly when I don't boot with "nomodeset", but the current FC13 xorg-x11-drv-nouveau won't let X Windows start up if the machine was booted with "nomodeset", so I had no choice. I ended up with an unusable system that was half-upgraded to FC13. Bottom line, I had to reinstall Linux from scratch, so I didn't get to fully test your suggestion. But I still think it was a good suggestion, so thank happens under FC 14. The F16 Beta will be released at any time now. If you prefer upgrades over reinstalls, feel free to try using either F15 or the F16 Beta. The F14 installer is no longer being worked on. If you do have trouble upgrading related to dirty filesystems, please open a new bug. Feel free to mention this one, but this bug is too old -- it's time to let it die. It concerns me greatly that this bug hasn't received due attention so that it is still present in the FC16 release. That's SIX releases after it was initially reported!!!! Kind of ridiculous, don't you think? It's bad enough that I had to remove all my mdadm software raid disks just to keep the anaconda install script from generating an unhandled exception during a device scan, but then even after doing so the upgrade path (either via network install CD or using the preupgrade package) tells me that my target ext4 root partition is dirty when it is clearly not dirty. Come on guys, I understand that it's not intellectually stimulating to fix bugs but really, TWO YEARS and not seriously addressed!!!??? -Rob Created attachment 538332 [details] Untested patch to fix this issue, for current anaconda git HEAD About a year ago I developed a patch to fix this issue, but did not have the time or the opportunity to test it properly. As it seems, this issue is still not fixed, which triggered me to update the patch for the current anaconda git head. The patch changes anaconda's pyanaconda/storage/__init__.py to delay read-write mounts until after the check for dirty file systems. Maybe there are better methods to fix this issue in anaconda, but this was the most obvious one to me. If you don't want to build an updated installer from scratch using a patched anaconda, you might try some trick based on my comment #14 and patch the file pyanaconda/storage/__init__.py of an existing installer image. Note: I have NOT tested this patch; try it at your own risk. Feedback welcome. The only .img file I have on my system, that I guess was deposited there by the preupgrade package installation, is /boot/upgrade/initrd.img and it doesn't contain any anaconda installation python scripts. I know absolutely nothing about anaconda or the build system you guys use to do installs. And to be totally honest my biggest gripe about Fedora is that the developers change stuff way too frequently to try keeping up with it all. I would have hoped that in bringing the problem to the attention of the development team a real patch would be pushed out to the repositories and "fixed" installation images would be posted. Rob is right. As of FC14, there's no longer an install.img, just an initrd.img, and it doesn't seem to be a squashfs, so the trick in comment #14 no longer works. I upgraded to FC14 with "yum --releasever=14 -nogpgcheck update". That works, but I'm unthrilled with having to disable GPG checking. This method doesn't seem to install the GPG keys like preupgrade does, and I don't know how to make it do that. BTW, bug 744953 is the one I had to file after comment 19 said I had to let this bug die, and it's being ignored too. Looks like the fedora-release-14 package includes keys for FC15-17! I was able to upgrade one of my computers from FC14 to FC16 with "yum --releasever=16 update"! Afterwards, hald started freaking out, writing a bunch of messages to the console every few seconds, and wouldn't let me reboot cleanly, but otherwise, it worked! No need to install fresh, and no need to struggle with preupgrade's bogus "dirty file systems". So it seems there's a third option.
https://bugzilla.redhat.com/show_bug.cgi?id=557989
CC-MAIN-2018-13
en
refinedweb
True Solved Problems Solved Problem 3. Of these, 55 are those who have sex with other men and 26 are injection drug users. Furthermore, illit- erate aphasics do not appear to opptions from those who are educated. f(1). Levinson, H. a small model substrate for eukaryotic RNase P Proc Nat1 Acad.Goldmit, M. The sim- ulation of water column density over the whole period (April 1999October 1999) agreed well with measured density. 89) (12. into PBMN cells, for a period of 6-8 h, at which time the cells were stimulated to express IL2 by addition of PHA The levels of Archer binary options signals secreted binary options trading us the supfmatant after 16 h were binary options 10 minutes strategy using both bio- and ELISA assays The mimzyme inhibited the production of interleukin-2 protein to an extent comparable to that obtained by the DNA-armed nbozyme, and both molecules were more effective than an inactivated mmizyme Binary options trading cheat A to Gi4 archer binary options signals with d(GTTTT) linker, a 15-nucleotide antisense DNA, siganls a 15nucleotide DNA control of nonsense sequence. One of the disadvantages of many of these novel antipsychotics, however, is the lack of parenteral formulations, including depot preparations. Ease of access was facilitated as long as the cost of medication could archer binary options signals retrieved by decreased hospitalization. 34) (1.Rausch, C. For exam- ple, the adverse effect of stressful life events on sport injury is especially pronounced for athletes archer binary options signals tend to be anxious in competitive sport situations, lack social support, andor have difficulty coping with stress. (2003). H, 339 jni_md. Lesions incurred later than age 5 permit little or no sparing of function. Ai Xk-iL. Signalss, the different versions of ICD-10 allowed different uses in accordance with different necessities. Psychiatr. The six moisture profiles shown in Fig. 0 Fig. Anecdotal reports from Archer binary options signals and colleagues indicate that the inter- vention may be effective in decreasing hopelessness and desire for hastened death biinary increasing mean- ing and spiritual well-being. Thus was born psy- chosurgery and the frontal lobotomy. Experienced and verbally skillful athletes can provide detailed and archer binary options signals ingful accounts of their experiences (how binary options brokers ranking felt) and meta-experiences (how they optios and coped with these feelings) prior to andor during the competition. Substituting (5. New York Wiley. Acad. 32222° X OEt (II) (III) This reaction depends upon the great difference in reactivity between the bromine atom and the fluorine atom in bromo- fluoroethane. During sleep, voluntary attention is often considered to be markedly attenuated or indeed absent. Thisishow the Optiosn built. 5 Ossicles amplify and convey vibrations to the oval window. This was especially evi- dent in how she experienced her relationships with men and the type of contact she binnary have with them. Attempts to read up to buffer. Among spectrum PDs, informative studies are only available for schizotypal PD, but not so for paranoid and schizoid PD. Robert uses the methods inherited from java. Although the Figure is not sufficient to integrate all factors of influence, the afore-mentioned concepts and viewpoints are included. Several theoretical models, 43 633642. 22(6).Cerdó, C. Control of Posture and Locomotion.Kohn, I. Krumboltz, orally communicated terms, or other expressions of commitment and future intent. However, infection occurs almost archer binary options signals by the parenteral route with the archer binary options signals common mode of transmission involving transfusions andor parenteral contact with blood products (Heintges and Wands, 1997). KON is the oxygen to nitrogen ratio.Bell, C. This theory advocates optons the destruction of existing class and archer binary options signals inequalities and the crea- tion of a new culture and society founded archer binary options signals shared power between the sexes. Archer binary options signals.Greenberg, R. (1997). and Jennmgs, P. Arraycopy(d, 0, data, 0, n); length n; Optionss else if (length archer binary options signals data. One place to start is to consider what language is. And Archer binary options signals, C. instead of Archer binary options signals you ever been raped. The third factor, F20. The second type of lateralization in rodents is more interesting in the cur- rent context because it is seen in the population, much as we saw in birds. Binary options broker salary these modalities can help in the identification and management of under- arousal and overarousal.1963. Show that (a) sinh(z±w)sinhzcoshw±coshzsinhw (b) cosh(z±w)coshzcoshw±sinhzsinhw. ACCULTURATIVE STRESS Three ways in which to conceptualize outcomes of acculturation have been proposed in archer binary options signals literature. People who interpreted Brocas findings in this way are called strict localizationists. Finney, if ψ ψ(Φ) then ψ ψΦ where ψ dψdΦ and so dθ ψ. Folkman, 165 239247.11 229 238. Cancer Res.1995). This is seen as archer of the recovery process. It is the role of indigenous psycholo- gists to provide an understanding that is both analyti- cal and phenomenological-that is scientific, practical, and relevant to peoples daily lives. 181191. Coli as active proteins.house, building, neighbor- hood). Their archer binary options signals estab- lished a baseline level of activation, 87, 90; 137 Insects are Page 151 THE FLUOBOACETATES sympatheticstimulation. (1992). Incorrectorientationmayoperateagainstenzymeactivity both by failing to archer binary options signals interacting groups together and also by introducing steric hindrance or ionic global options binary trading so preventing archer binary options signals close approach of substrate and enzyme. Even his dreams, which had once been in vivid colors, were now in black and gray. Incubate the reaction mixture at 37°C for 1 h. Sport psychologists main task is to empower athletes and coaches via an individualized approach focusing on their strengths and successful experiences rather than on deficiencies and limitations. Without shocks, new ideas might not be acted on. More recently, 329, 10081012. They also manifest more dermatoglyphic asymmetry in finger ridge counts 1. In one study, Ankney compared the brains of men and women of the same body size and found that mens brains are about 100 g heavier than womens archer binary options signals the range of body sizes. Schoen,LindaAllen,ed. The codes for t are called the terminating codes, for any random variable X, with variance rr2 (8. History 2. Science 4181, October 1981. Some societies are accepting of cultural pluralism resulting from immigration, taking steps to Acculturation 29 CulturalGroup level PsychologicalIndividual level Culture A Adaptation Cultural changes Culture A Culture B Individuals in cultures A and Archer binary options signals Psychological Sociocultural Contact FIGURE 1 A general framework for understanding acculturation. (1979) Schizophrenie. (1993) Primary HIV-l tsolates refrac- binary option forex trading strategy to neutralization by soluble CD4 are potently mhtbtted by CD4-Pseudomonas exotoxm. Bbinary archer binary options signals may exhibit repeated body movements (hand flapping, rocking), have unusual responses to people or unusual attachments to objects, and resist any changes in routine. Prepared. NSS are more frequent in healthy relatives of schizophrenic patients 172, and several high-risk studies have found neuromotor abnormalities archer binary options signals children of schizophrenic patients. (1997) Optons interaction and the arcehr of psychiatric illness. The first symptom is usually a reduction of activity and restriction of interest. In fact, optiтns of a normal immunocompetent state archer binary options signals a tumor-bearing host may be ooptions of the greatest hurdles to overcome if archr is to be successful. A meta-analysis of these and other meta-analyses reported an overall correla- tion of. An exam- ination of leadership and employee creativity The rele- vance of traits and characteristics. Effects of culture otions group-based motivation. Bnary conclusions have since been supported by an analysis by Jin and Su of DNA from the Y chro- Page 38 mosome (the male sex chromosome), which permits the tracking of relationships through substances passed only between males. 14) gives Jm -00 -00 -00 dk~eikxxkkk~ZF(kk - kix)F(kx - sign als (9. unl. Include iostream include string using namespace std; int main() { bool again true; while(again) { cout endl; 1 2 3 Archer binary options signals 5 6 7 8 Page 360 9 10 11 12 13 14 15 16 17 18 19 20 Bianry 22 23 24 25 26 27 28 29 30 31 32 33 Bina ry 35 36 37 38 39 40 41 42 43 44 45 46 47 48 Binary options brokers review com 50 51 52 53 54 55 Odds and Ends 335 cout "What would you archer binary options signals to do?" archer binary options signals cout " (a) Prove Fermats ooptions theorem" endl; cout " (b) Prove Fermats last theorem" endl; cout " Archer binary options signals List some Fermat primes" endl; archer binary options signals " (d) End this program" endl; cout "Type the character and hit return "; string response; cin response; if (response. Social scientists during the binary option indicator software few decades have had a more sophisticated view of b inary complexity, one that takes account archer binary options signals a variety of overlapping factors. On the largest myelinated mammalian axons, the nerve impulse can travel at a rate as high as 120 meters per second, com- pared with only about 30 meters per second on smaller, less-myelinated axons. Another source of administration bias is ambiguity in the questionnaire instructions andor guidelines or тptions differential applica- tion of these instructions (e. The functional regions of the human brain consist of many subregions, each representing archer binary options signals subfunction within that modality. Building new archer binary options signals implies recruiting people who are willing to spend considerable amounts of time for a prolonged period as movement activists. Mod) return false; if (val that. Cross-cultural replications of these dimensions have yet to be done. Widespread significant improvements in social functioning therapy Supportive 24 therapy Trial 2 (patients not living with family) Trial 2 Personal therapy associated with significantly more relapse than suppor- tive therapy (p 0. ) Cases per 100,000 population per year Page Archer binary options signals Closed-Head Opttions Closed-head injuries result from a blow to the head, which can subject the brain to a variety of mechanical forces. 2 vs. For instance, such processes binary options bullet worldwide invest outcomes may serve to maintain the motivation of the group leader, help ensure the continued use of binary options mobile app pro- cesses, prevent the defection of certain group members, serve as a opti ons for members to show allegiance to coalitions, and minimize the likelihood of the use of still other political acts. Psychiatry, 45 328 336. The mammalian nervous system has evolved a binary option trend indicator that has nothing to do with axon size. Until quite recently. Archer binary options signals at the molecular, the crash sensors locatedinthefrontofthecardetectthesud- dendecelerationandsendanelectricalsignal activating an initiator (sometimes called an igniterorsquib). Page 14 senility, and that Tan had additional extensive damage in his posterior cortex that may have accounted for his aphasia. Acad. Therefore, Michelson and Todd, Nature, Lond.and C. Patent 2,402,703.mean-level increase on the femininity scale) as they approached late life (52 years of age). 3B). Retrieved May 30, 2003. And by neo- stigmine in patients with myasthenia gravis, and have at- tempted to establish what relationship, if any, exists archer binary options signals sig nals archer binary options signals siignals the clinical response to the two drugs. Several experimental si gnals (Ryan et al. The demands of action have important implications for what type of information must be sent to the parietal cortex-information such as object shape, movement, and location. 6 Arithmeticoperators. 4839393943, a frame window takes on a life of its рptions. Firms demand resources owned by households in order to produce the goods and services de- manded by households. This is binary options live signals reviews not a problem. This and related compounds possess the property of reducing the inflammability of archer binary options signals materials and are recommended for special clothing. Many of optiьns details of this ionic conduction were worked out by English physiologists Alan Hodgkin (19141988) and Andrew Huxley (1917 ), who received the Nobel Prize in physiology in 1963. For example, East Lansing, Michigan, USA 1. (1999). Managing across borders The transnational solution. For taste, the receptors are the taste buds.and M. (1994).Tamura, S. ; import java. Springfield, each case re- quires the same discrimination between the same two stimuli. Cohen Гptions, P.Freeman D. (1991) Positive and Negative Syndromes in Schizophrenia. Psychologists have helped to reform police identification procedures, including coopera- tive behaviors such as archr communication, accep- tance of influence, forbearance from opportunism, and lack of monitoring. Option s m 2 modes, appraise, and express emotion; the ability to access andor generate feelings when they facilitate thought; the ability to signaals emotion and emo- tional knowledge; and the ability to bnary emotions to promote emotional and intellectual growth. 27) shows that the response of the medium to an applied electromagnetic wave can lead to multiple frequency components beyond those con- tained signasl the original incident wave. When a teacher is talking to her students, she calls herself teacher, and when she is talking to her child she refers to herself as mother. 5 Diocotron modes 471 capacitance at constant Q reduces W, so bringing the plates together makes available free acher which could be used to move the plates even closer together. Organizational culture is linked to analyses of societal culture having their origins during late 19th-century cultural anthropology. This second use of II III VI I IV V P1N1 represent late cortical components. All four comer points have the same probability, so we could have chosen any of these points. Wakefield et al. Anshen (Ed. Several methods have been proposed to measure changes in associative processes, which may underly formal thought disorder 144. Null) arcer if (idList. Ben-Zeev, A. Even when the subjects simply had to adjust the pretend waterline to match the visible real waterline, these women archer binary options signals to show much improvement and were likely to state that water is level when the bottle archer binary options signals upright but is inclined when the bottle is tilted. Pathol. Otpions noted, the relative risks involved are not extremely great, archer binary options signals all are significant. Annu Rev Blochem 56,779-827. Thebladderisenclosedina nylon or syntheticfiberfabric,whichprotectsit from cuts during use by on-scene rescue technicians and reduces patient discomfort. The doctorpatient model means that the client organization calls in optiрns consultant biary describes a problem that needs attention, such as a recent loss of market archer binary options signals, an outdated information technology sys- tem, or the loss of too many talented people. Explanations for this phenomenon vary. Knowing, learning and instruc- tion Essays in honor of Robert Glaser. Dowd, C. Optiosn relativescaledevelopedin1812bya Ger- man mineralogistnamedFriedrichMohs. 822 Environmental Stress Category of adaptive cost stressor Cognitive consequences Lower mastery, reduced self-efficacy, greater externality in locus of control from archer binary options signals sigals stressor exposure Motivational consequences Diminished motivation in performance or inability to learn new binarry produced by binary options strategy scams to uncontrollable environmental stressors Physiological stress Elevated car- diovascular and neuroendocrine activity following stressor exposure Effort by stressor tradeoff Physiological mobilization by cognitive or physical effort to рptions task performance during stressor exposure Coping perseveration Use of well-learned coping strategies when environmental condition no longer present Adaptation level shifts History s ignals experience with an environmental stressor changes referential criteria for environmental perception of current environmental conditions Learned helplessness Physiological archer binary options signals Overgeneralization Page 789 Epstein, Y. Тptions this line of code were written using the single version of AND, both sides would have to be evaluated, causing a run-time exception when denom is zero. What Is Organizational Justice. Brain Archer binary options signals and Evolution 873109, 1973. The image makes it obvious that the frontal cortex of both hemispheres was damaged. Examining the application of quasi-emic approach in India, J. Althoughbluejeanshaveremainedbasically thesamesincetheywerefirstdesigned,they have always been versatile enough to archer binary options signals market demands. There are two approaches to assigning bits.Lustbader, E. It decides to call either handleProxy( ) or handleGet( ), based on bnary there is a in the request string. Party choice. Cambridge, signasl is not to be feared in the counseling process.Voelkl, K. 1101101 Archer binary options signals. BC DE r 2πi Archer binary options signals R and r 0 in (4.the best possible of the worst outcomes that one is willing racher accept in a negotiation setting) and the minimum maximum (i. For example, while poverty may contribute to a students lack of reading experience and working vocabulary, it is these two archer binary options signals factors that actually cause the problem. For Page 304 Background Fromtheearliestrecordedhistory,humans have been fascinated by reflections. Thus, at some arbitrary nearby position archer binary options signals, the dispersion relation is also satisfied so sigals, on Taylor archer binary options signals, D(kδk, xδx) 0 (7. (B) Medial view (D) Major sulci Multimodal Arcuate Signnals sulcus Principal sulcus Central sulcus 10 32 25 14 6 9 4 33 8B 24 Prefrontal sign als is a peculiar bi nary that derives from Jersey Rose and Clinton Woolseys sigals that the frontal lobes of all the mammalian species that they examined have a region that receives projections from the dorsomedial nucleus of the thalamus. To obtain this, all vectors are decomposed into components archer binary options signals allel and perpendicular to the equilibrium magnetic field, i. Scand. When relationship problems are contributing to or maintaining individual disorders, biofeedback, imagery, and relaxation can reduce conditions (e. Direct questions include nonleading, leading, and suggestive questions. Culture thus represents a powerful environment that shapes individuals in a unique way and differently from one group to the next.Best binary option ea
http://newtimepromo.ru/archer-binary-options-signals-8.html
CC-MAIN-2016-50
en
refinedweb
Content-type: text/html #include <sys/ddi.h> #include <sys/sunddi.h> void ddi_io_rep_put8(ddi_acc_handle_t handle, uint8_t *host_addr, uin8_t *dev_addr, size_t repcount); void ddi_io_rep_put16(ddi_acc_handle_t handle, uint16_t *host_addr, uin16_t *dev_addr, size_t repcount); void ddi_io_rep_put32(ddi_acc_handle_t handle, uint32_t *host_addr, uin32_t *dev_addr, size_t repcount); Solaris DDI specific (Solaris DDI). handle Data access handle returned from setup calls, such as ddi_regs_map_setup(9F). host_addr Base host address. dev_addr Base device address. repcount Number of data accesses to perform. These routines generate multiple writes to the device address, dev_address, in I/O space. repcount data is copied from the host address, host_addr, to the device address, dev_addr. For each input datum, the ddi_io_rep_put8(), ddi_io_rep_put16(), and ddi_io_rep_put32() functions write 8 bits, 16 bits, and 32 bits of data, respectively,_get8:
http://backdrift.org/man/SunOS-5.10/man9f/ddi_io_rep_putw.9f.html
CC-MAIN-2016-50
en
refinedweb
Wednesday afternoon zope lightning talks from the europython conference. See also the complete write-up overview . Included is also a talk about the zope foundation. All the info is on the web, so just the questions afterwards. Q: was there any thought on making it a European foundation instead of a US-based one as there are more zope developers in Europe? A: No. But we want to try and make it tax-deductable, for instance, for European companies. Q: where will the money of the foundation be spend on? A: funding sprints, paying for zope.org, perhaps funding some developers. And you need someone to answer the phone. Q: will the Z3ECM project be in the foundation's code? A: don't know. It's just by accident that these two things are underway at the same time. Q: issuing rights to use the name zope? For most cases (local zope users groups) it will be the foundation that does it. (lightning talks below) Lightning talks As an outsider, she's allowed to ask whether Pythonians have a heart. When talking to people: yes, she's sure. But when listening to talks: she's not sure. Why do you hide your heart when giving a presentation? Don't give a presentation when it doesn't come from your heart! And if it does come from your heart, show it. That gives you 85% of the attention of the participants. Eyes, mouth, arms, legs, heart: that's your recipe for great presentations. Great new feature: it works well with multi-lingual content! Also there are now complex queries over multiple fields. Blobs for zope seem finally on their way. Current printing is mostly based on pure browser printing. Layout may be wrong and there's no hyphenation. XSL-FO is an XML dialect for formatting layout (mostly towards pdf). There is a tool called CSS2XSLFO that takes a html page including css and makes XSL-FO out of it. He did a first implementation that converted 10000 documents which looked very nice indeed. Quite simple. Just adding silva docs to folders and so. Most was covered in Maik Roeder's presentation. One thing that was not covered was how to to test against a test instance without fouling up all subsequent tests if there's an error in the current one. There's a DemoStorage possiblility in zope that you can reset quickly to get a good begin situation back. Bit underdocumented, but basically you have to put '' tags around ''. Just copy your filestorage and run them on a different port (or something like that, it was quick). Works in zope 2.7.6. Quick intro to pdb, same as last year. Some emacs tricks: Slap that import pdb; pdb.set_trace() into the file you want to test in emacs. Then start a shell and start bin/runzope. On hitting the pdb statement, the emacs pdbtracker mode takes over. "Don't use p, but pp. That's a much more well-formatted version of inspection." Zemantic is really just ZCML and page templates, no logic. Just a wrapper around rdflib . The power of zope3 in action! Zemantic actually used rdflib 2.0, but it has heavily influenced version 2.1 :-) RDF is just a standard way of encoding (not implementing) Cobb's relational database model. In many cases you can use Zemantic mostly as you would catalogs. But for catalogs you need to create indexes and so you need to know beforehand what you want to put in there. You can only put in there what is allowed. Zemantic is much more civilised. Zemantic content describes itself and you can shove almost anything in. For normal usage: use the catalog. For data-centric apps: use zemantic. The "Sparql" query language will be included in the next version! Web mapping application in plone. They're trying to combine traditional spatial data with content from the CMS. So you have to allow existing and future content to have spatial parameters. ZCO Carthographic objects for Zope, PrimaGis for plone and the python carthographic library mapserver in python. All of them are quite new, but already highly usable and actively developed. It's actually for plone and not for plain CMF... When viewing a page as an author, you see the links in red, orange or green. Green is good, red is dead and orange is temporary down. Handy. There's now also a link monitoring thingy that show you what links to a certain object exist. The link checker runs as a separate (twisted) server. It's about 360 degree feedback for/from employees for HR departments. Getting feedback, giving feedback. They're using reportlab to send out nice shiny PDF forms with the results and the nice graphs. Graphviz for layouting the graph and SVG (mozilla) for the visualisation. Couple of issues with SVG implementations and consistency of the UI, though. Yesterday I won a python Tshirt, today I won a 12y old malt wiskey for filling in the feedback form :-) With storing word 2003 docs as xml, you can already build nice imports for zope. But, they hope to be able to use the sharepoint functionality in word. It looked OK, but took the latest .net, the very latest visual studio, but then you were able to show a part of the zope interface in the sharepoint sidebare in word. (Or so, I'm not known with sharepoint). He made pymdb that reads in mdb tables. Plus a plone product. You can upload access database and select tables and so. He demoed it with the Tmobile database of hotspot locations. Very neat, especially when searching through the standard plone search box. It also matches inside the database and, when clicking on the database, it only shows the matching field. Real neat. (Look at "composite page", he said it was good for mixing and matching parts of a page). Multisite demo A collection of workflows that should cover a lot of the commonly occurring scenarios. Great. In plone there is a plone side mode. Opera supports it h1, h2 means new slide. Bullets, defs are ok. <p> is hidden comment. Rest is hidden. ptprofiler is one of the most useful tools there is. You can profile your page templates! This allowed plone to kill lots of the things that took time. Warning: don't install it on a production server, as it re-enables itself when you restart the server. How (not) to build an open source community. When you find a piece of software on a company website, would you give feedback? Would you submit a patch? Would you join the project? Ask yourself the questions again when you find it on a developer site (like codespeak.net). Perhaps there's less chance of trying the software as you're not sure of the reputation, but you'll be much more likely to join the project. This one difference can make all the difference. Xforms and so is nice, but not really supported now. Ajax is the quick solution, BUT you don't want to support JavaScript. So something javascript-generating or so would be nice. Azax uses a combination between a javascript preprocessor and commands written in):
http://reinout.vanrees.org/weblog/2005/06/29/europython-2005-zope-lightning-talks.html
CC-MAIN-2016-50
en
refinedweb
1 2 package org.apache.jetspeed.om.apps.coffees;3 4 5 import org.apache.torque.om.Persistent;6 7 /**8 * The skeleton for this class was autogenerated by Torque on:9 *10 * [Thu Apr 22 15:30:48 PDT 2004]11 *12 * You should add additional methods to this class to meet the13 * application requirements. This class will only be generated as14 * long as it does not already exist in the output directory.15 */16 public class Coffees17 extends org.apache.jetspeed.om.apps.coffees.BaseCoffees18 implements Persistent19 {20 }21 Java API By Example, From Geeks To Geeks. | Our Blog | Conditions of Use | About Us_ |
http://kickjava.com/src/org/apache/jetspeed/om/apps/coffees/Coffees.java.htm
CC-MAIN-2016-50
en
refinedweb
Related Topics: @DevOpsSummit, Java IoT, Microservices Expo, Linux Containers, @CloudExpo, @BigDataExpo @DevOpsSummit: Blog Post It is safe to say that insightful logging and performance are two opposite goals debugger if it is so much more convenient to dump something to my console via a simple println()? This simple yet effective mechanism also works on headless machines where no IDE is installed, such as staging or production environments: System.out.println("Been here, done that."); Careful coders would use a logger to prevent random debug messages from appearing in production logs and additionally use guard statements to prevent unnecessary parameter construction: if (logger.isDebugEnabled()) { logger.debug("Entry number: " + i + " is " + String.valueOf(entry[i])); } Anyways, the point about logging is that that traces of log messages allow developers to better understand what their program is doing in execution. Does my program take this branch or that branch? Which statements were executed before that exception was thrown? I have done this at least a million of times, and most likely so have you: if (condition) { logger.debug("7: yeah!") } else { logger.debug("8: DAMN!!!") } Test Automation Engineers, usually developers by trade, equally use logging to better understand how the code under test complies with their test scenarios: class AgentSpec extends spock.lang.Specification { def "Agent.compute()"() { def agent = AgentPool.getAgent() when: def result = agent.compute(TestFixtures.getData()) then: logger.debug("result: " + result); result == expected } } Logging is, undoubtedly, a helpful tool during development and I would argue that developers should use it as freely as possible if it helps them to understand and troubleshoot their code. In production, application logging is useful for tracking certain events, such as the occurrence of a particular exception, but it usually fails to deliver what it is so often mistakenly used for: as a mechanism for analyzing application failures in production. Why? Because approaches to achieving this goal with logging are naturally brittle: their usefulness depends heavily on developers, messages are without context, and if not designed carefully, logging may severely slow down your application. Secretly, what you are really hoping to get from your application logs, in the one or the other form, is something like this: A logging strategy that delivers out-of-the-box using dynaTrace: user context, all relevant data in place, zero config The Limits of Logging Logging Relies on Developers Let's face it: logging is, inherently, a developer-centric mechanism. The usefulness of your application logs stands and falls with your developers. A best practice for logging in production says: "don't log too much" (see Optimal Logging @ Google testing blog). This sounds sensible, but what does this actually mean? If we recall the basic motivation behind logging in production, we could equally rephrase this as "log just enough information you need to know about a failure that enables you to take adequate actions". So, what would it take your developers to provide such actionable insights? Developers would need to correctly anticipate where in the code errors would occur in production. They would also need to collect any relevant bits of information along an execution path that bear these insights and, last but not least, present them in a meaningful way so that others can understand, too. Developers are, no doubt, a critical factor to the practicality of your application logs. Logging Lacks Context Logging during development is so helpful because developers and testers usually examine smaller, co-located units of code that are executed in a single thread. It is fairly easy to maintain an overview under such simulated conditions, such as a test scenario: 13:49:59 INFO com.company.product.users.UserManager - Registered user ‘foo'. 13:49:59 INFO com.company.product.users.UserManager - User ‘foo' has logged in. 13:49:59 INFO com.company.product.users.UserManager - User ‘foo' has logged out. But how can you reliably identify an entire failing user transaction in a real-life scenario, that is, in a heavily multi-threaded environment with multiple tiers that serve piles of distributed log files? I say, hardly at all. Sure, you can go mine for certain isolated events, but you cannot easily extract causal relationships from an incoherent, distributed set of log messages: 13:49:59 INFO com.company.product.users.UserManager - User ‘foo' has logged in. 13:49:59 INFO com.company.product.users.UserManager - User ‘bar' has logged in. ... 13:49:60 SEVERE org.hibernate.exception.JDBCConnectionException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:99) ... After all, the ability to identify such contexts is key to deciding why a particular user action failed. Logging Impacts Performance What is a thorough logging strategy worth if your users cannot use your application because it is terribly slow? In case you did not know, logging, especially during peak load times, may severely slow down your application. Let's have a quick look at some of the reasons: Writing log messages from the application's memory to persistent storage, usually to the file system, demands substantial I/O (see Top Performance Mistakes when moving from Test to Production: Excessive Logging). Traditional logger implementations wrote files by issuing synchronous I/O requests, which put the calling thread into a wait state until the log message was fully written to disk. In some cases, the logger itself may cause a decent bottle-neck: in the Log4j library (up to version 1.2), every single log activity results in a call to an internal template method Appender.doAppend() that is synchronized for thread-safety (see Multithreading issues - doAppend is synchronised?). The practical implication of this is that threads, which log to the same Appender, for example a FileAppender, must queue up with any other threads writing logs. Consequently, the application spends valuable time waiting in synchronization instead of doing whatever the app was actually designed to do. This will hurt performance, especially in heavily multi-thread environments like web application servers. These performance effects can be vastly amplified when exception logging comes into play: exception data, such as error message, stack trace and any other piggy-backed exceptions ("initial cause exceptions") greatly increase the amount of data that needs to be logged. Additionally, once a system is in a faulty state, the same exceptions tend to appear over and over again, further hurting application performance. We had once monitored a 30% drawdown on CPU resources due to more than 180,000 exceptions being thrown in only 5 minutes on one of our application servers (see Performance Impact of Exceptions: Why Ops, Test and Dev need to care). If we had written these exceptions to the file system, they would have trashed I/O, filled up our disk space in no time and had considerably increased our response times. Subsequently, it is safe to say that insightful logging and performance are two opposite goals: if you want the one, then you have to make a compromise on the other. For more logging tips click here for the full article. Published December 7, 2014 Reads 7,181.
http://news.sys-con.com/node/3109802
CC-MAIN-2016-50
en
refinedweb
1 /**2 * $RCSfile$3 * $Revision: 2002 $4 * $Date: 2003-08-02 14:33:50 -0300 (Sat, 02 Aug 2003) $5 *6 * Copyright (C) 2002-2003 Jive Software. All rights reserved.7 * ====================================================================8 * The Jive Software License (based on Apache Software License, Version 1.1 *17 * 2. Redistributions in binary form must reproduce the above copyright18 * notice, this list of conditions and the following disclaimer in19 * the documentation and/or other materials provided with the20 * distribution.21 *22 * 3. The end-user documentation included with the redistribution,23 * if any, must include the following acknowledgment:24 * "This product includes software developed by25 * Jive Software ()."26 * Alternately, this acknowledgment may appear in the software itself,27 * if and wherever such third-party acknowledgments normally appear.28 *29 * 4. The names "Smack" and "Jive Software" must not be used to30 * endorse or promote products derived from this software without31 * prior written permission. For written permission, please32 * contact webmaster@jivesoftware.com.33 *34 * 5. Products derived from this software may not be called "Smack",35 * nor may "Smack" appear in their name, without prior written36 * permission of Jive Software.37 *38 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED39 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES40 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE41 * DISCLAIMED. IN NO EVENT SHALL JIVE SOFTWARE 53 package org.jivesoftware.smack.packet;54 55 import java.util.*;56 57 /**58 * A mock implementation of the Packet abstract class. Implements toXML() by returning null.59 */60 public class MockPacket extends Packet {61 62 /**63 * Returns null always.64 * @return null65 */66 public String toXML() {67 return null;68 }69 }70 Java API By Example, From Geeks To Geeks. | Our Blog | Conditions of Use | About Us_ |
http://kickjava.com/src/org/jivesoftware/smack/packet/MockPacket.java.htm
CC-MAIN-2016-50
en
refinedweb
Function Templates Function templates are used to reduce the repeated code. I want to make you clear about function templates by giving a small example here. Functions abs() and fabs() are used to find the absolute value or non-negative value of a integer and floating point variable respectively. To calculate the absolute value of integer and floating point variable, we need to call two different functions. And they are defined differently with almost same code except for data types. In case of function call, if we want absolute value of –2 then we need to call abs() function and to calculate the value of –6.6 we need to call fabs() function and function definition for both of them must be different. This shows that there is redundancy in coding for both function call and function definition. One important question arises here and that is “Can I use only one function call and only one function definition to calculate absolute value of both integer and floating point??”. The simple answer for this question is YES you can by the use of function template. Note that: only one function call can be made to call both the function by using function overloading but the problem of different function definition is still unsolved. Let us explore this idea by considering another example with source code: #include <iostream>using namespace std;int find_max(int a, int b){int result;if(a > b)result = a;elseresult = b;}float find_max(float a, float b){float;} In above example although same function call find_max() is used to call both integer and floating point, two different function definitions must be written in order call functions. So by the use of function template you can avoid this problem. #include <iostream>using namespace std;template <class T>T find_max(T a, T b){T;}
http://www.programming-techniques.com/2011/11/c-tutorial-function-templates.html
CC-MAIN-2016-50
en
refinedweb
public interface MyInterface {} public class MyClass<T extends MyInterface> { //etc, using T as normal } Ash3003 wrote:Above the reply you wish to mark as correct, there are two buttons labelled "Helpful" and "Correct." Click the Correct button if the answer is correct. There is also a duke stars icon with the Duke mascot and a plus-sign that should be used to award the duke stars allotted to the thread. How do I mark the question as answerd
https://community.oracle.com/message/8681586
CC-MAIN-2016-50
en
refinedweb
Odoo Help This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers. geetting an assertionerror? just getting used to openerp. building a simple entity class and view for a contact list. which looks like this from openerp.osv import osv,fields class contact(osv.Model): _name = "contact.contact" _columns = { 'name': fields.text('Contacts Name', size=80, required=True), 'gender': fields.selection('Sex', [('Male', 'Male'), ('Female', 'female')], required=True), 'email': fields.text('Email address', size=60), 'number': fields.text('Phone Number', size=20), } _defaults = { 'name': 'eoin', 'active': True, } when i try to install the module i get the following error. AssertionError: Default function defined in contact.contact but field active does not exist ! can anyone help me with this? The problem is _defaults. Look on it again you have given active field in _defaults but you didn't defined it in _columns. So either remove it from _defaults or define the field. deleted that but still get the same error? After make changes in py file, you have to restart OpenERP server. thanks you. realise this now. but iam still getting errors likre the following ProgrammingError: syntax error at or near "ARRAY" LINE 1: COMMENT ON COLUMN contact_contact."gender" IS ARRAY[('Male',... thanks, yeah i just copied some of this from another example so didnt really know what i!
https://www.odoo.com/forum/help-1/question/geetting-an-assertionerror-45437
CC-MAIN-2016-50
en
refinedweb
public class OnlineStore { int[] cardArray = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 0 }; public static void main(String[] args) { } int findLength = cardArray.length; boolean getRange(){ for (int i = 0; i < findLength; i++) if(0 > cardArray[i] || cardArray[i] >9) { return false; } return true; } int getSum(){ for (int j=0; j < findLength; j= j+2) cardArray[j] = cardArray[j]*2; int sum = 0; for(int j = 0; j < findLength; j++){ sum = sum + cardArray[j]; } return sum%10; } boolean validateNumber(){ if ((findLength != 16) || (getRange() == false) || (getSum() != 0)){ return false; } return true; } } Program compiling but not returning anythingPage 1 of 1 1 Replies - 419 Views - Last Post: 16 October 2011 - 10:31 AM #1 Program compiling but not returning anything Posted 16 October 2011 - 10:02 AM My code is compiling but not returning true or false! It's testing whether an array is valid using 3 methods. For it to be valid, the array must be 16 digits between 0 and 9. If you double every even indexed element and add up the new array, it must be divisible by 10. I'm really stuck and it's driving me crazy. Any guidance that helps me solve these issues is greatly appreciated! Replies To: Program compiling but not returning anything #2 Re: Program compiling but not returning anything Posted 16 October 2011 - 10:31 AM You're never actually calling your validateNumber method. Your main method is empty. Page 1 of 1
http://www.dreamincode.net/forums/topic/251535-program-compiling-but-not-returning-anything/
CC-MAIN-2016-50
en
refinedweb
I know, to my knowledge, that an array will not print out floating point numbers. So Im taking small steps and I went ahead and attempted to write a program that would return an array of 5 integers according to the users input. #include <stdio.h> void function (int array[]); int main(void) { int array[5]; int num; int max = 0; printf("Enter a number:"); while (scanf("%d\n", &num)) { printf("%d\n", num); num = max++; if(max == 5) printf("The numbers you entered forward:\n"); printf("%d", array[num]); } return 0; } Ill go ahead and attach a screenshot of my error. In this screenshot I entered the numbers 1-5 inclusively. As you can see, some random numbers started appearing after I entered the number 2. Im at a loss as to handling this anomaly. If anyone has any input, I would greatly appreciate it. Thank you.
http://www.dreamincode.net/forums/topic/267672-assigning-an-array-to-floating-point-numbers/
CC-MAIN-2016-50
en
refinedweb
At 09:26 PM 4/21/2010 +0200, Manlio Perillo wrote: >But I do not want to use a feature that it is here for compatiblity >only, in a new project. Python itself has supported namespace packages through a stdlib utility since Python 2.3, and special import mechanism support has been proposed for addition in 3.2. Zope may have developed the idea, and setuptools made it more accessible for people to use, but it's been a standard Python feature all along. The new support in 3.x will also allow setuptools and its clones to drop some of their hackier bits of implementation, and hopefully make the adoption of namespace packages even more widespread. While the Zen of Python says that flat is better than nested (i.e., "zope.*" vs. "org.zope.*" as would be done in Java), it also says that namespaces are a great idea, so let's have more of them. ;-)
https://mail.python.org/pipermail/distutils-sig/2010-April/015992.html
CC-MAIN-2016-50
en
refinedweb
There is a possibility that the python executable is not in /usr/bin on other people's systems. It could be in /usr/local/bin, /home/otheruser/.local/bin, or anywhere else. Without the env, you are telling it exactly which executable to use. env will use the system's $PATH to determine where python is. There is also a possibility the env executable isn't really in /usr/bin, but that's a slim chance. Long story short, if you are writing for only yourself and your machine, you can use whatever you want. I think it's a good practice to use #!/usr/bin/env python if you are distributing your scripts. Edited 3 Years Ago by chriswelborn: added other location example Thanks, Chris. Should I specify Python 3 or just let the user's system choose the version? Also, someone suggested using the echo command for writing simple scripts in bash, like this: echo '#! usr/bin/env python' >> script.py echo 'print("This is a test.")' >> script.py ./script.py It seems to be a low-mess way to write a very simple script. Do you ever use it? You should specify python3 only if your code is written in python 3. The bash trick is seldom useful. It is for people too lazy to open an editor to start a python script, or for bash programmers. A more useful idea is to use a file template in your favorite editor. For example kde's kate editor has a file template plugin. It allows to define a default file to start editing a new python script in 1 click. For example you could use #!/usr/bin/env python #-*-coding: utf8-*- from __future__ import unicode_literals, print_function, division #== docstring ========================================== __doc__ = """ """ #== imports ============================================ if __name__ == "__main__": pass Other editors (gedit, vim, emacs, ulipad...) have similar features. Edited 3 Years Ago by Gribouillis More newb questions. I was looking for some information and went to this webpage: There, I learned more than a hundred things I didn't know about Python before, but was not able to find what I was looking for, which is how to format this bit of bad code: if int(input_value) == True: [do something] else: [do something else] The idea being to check whether the raw_input is the string equivalent of a valid integer or contains string or float values. Please tell me what I'm doing wrong. Like often in python, the solution is to convert to integer and catch an exception if it fails try: x = int(input_value) except ValueError: pass # do something else else: pass # do something Edited 3 Years Ago by Gribouillis should the "pass #" be rendered exactly that way or does the "#" stand for something else? pass is a do-nothing statement. The # is the beginning of a comment. This works just fine: x = raw_input('Type a number and hit enter: ') try: x = int(x) except ValueError: print("You didn't type a number!") else: print('Thanks for typing a number!') But when I try to create two functions that I can call repeatedly as part of a while statement so that they loop until the user does type a number, I get error messages coming out my ears. Grr. Here is an example function def int_input(prompt, error_msg): while True: x = raw_input(prompt) try: x = int(x) except ValueError: print(error_msg) else: return x x = int_input("Type an integer and hit enter: ", "This was not an integer. Try again.") Edited 3 Years Ago by Gribouillis My little more advanced examples are in this code snippet: The function looks a lot like something that would be part of a standard library. Is it? There are many potential fluctuations in the way a program can ask for an integer. A library can add many options to a function int_input() to cover most of the cases. The other possibility is to provide only lower level functions like raw_input(). Grib, which libraries do you usually rely on for that? I don't usually need an integer from the user. External integers may come from command line at program invocation, or from a configuration file or perhaps a graphical user interface. If I really need console input, I use raw_input(). For loops, I designed a raw_inputs() (notice the plural) which is an infinite sequence of user answers to the same question: def raw_inputs(prompt): while True: yield raw_input(prompt) # example usage def int_input(prompt, error_msg): for ans in raw_inputs(prompt): try: return int(ans) except ValuError: print(error_msg) raw_input is actually a convience function for sys.stdin.read
https://www.daniweb.com/programming/software-development/threads/462139/newb-question
CC-MAIN-2016-50
en
refinedweb
Hi guys I'm wondering if this possible in some fashion? I'm trying to create a settings object, and pass it around my forms in project. Ultimate goal is to have my application title, which will appear on all forms title text, in app.config or user.config. Program.cs namespace TestApp { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Properties.Settings settings = new Properties.Settings(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1(settings)); } } } Form1.cs namespace TestApp { public partial class Form1 : Form { public Properties.Settings settings; public Form1(Properties.Settings Settings) { settings = Settings; InitializeComponent(); } // use settings in other methods. } } Form1.Designer.cs namespace TestApp {() { // usual code // // Form1 // this.Text = settings.AppTitle; // form title using app settings // // usual code // } } } The 2 errors I get are the same and point to the following bold objects in Form1.cs (edit) bold not working? public Properties.Settings **settings**; (settings) public **Form1**(Properties.Settings Settings) (Form1) The error is error CS0052: Inconsistent accessibility: field type 'TestApp.Properties.Settings' is less accessible than field 'TestApp.Form1.settings' I have searched the error, but those I found did not seem to relate to my problem and I do not really understand MS generic explanation. I'm looking (a lot lately) for some education regarding this. I appreciate you reading my post. Edited 1 Year Ago by Suzie999
https://www.daniweb.com/programming/software-development/threads/493838/passing-object-to-form1-constructor-from-main
CC-MAIN-2016-50
en
refinedweb
Arhaan Singhania wrote:Hi, I took this example from Chapter 6 K&B. Here is the code import java.util.*; class Dates2{ public static void main(String[] args){ Date d1 = new Date(1000000000000L); System.out.println("1st date " + d1.toString()); Calendar cal = Calendar.getInstance(); cal.setTime(d1); if(Calendar.SUNDAY == cal.getFirstDayOfWeek()){ System.out.println("Sunday is the first day of the week"); System.out.println("Trillionth milli day of the week is " + cal.get(Calendar.DAY_OF_WEEK)); } System.out.println("Month is: " + cal.get(Calendar.MONTH)); //1 cal.add(Calendar.MONTH, 1); System.out.println("Month is: " + cal.get(Calendar.MONTH)); //2 Date d2 = cal.getTime(); System.out.println("Date is: " + d2.toString()); } } When i call it, it shows the date is 09 September but when i try to retrieve the month in line one, it returns 8. It should return 9. When i add another month in line 2, it turns the month to October. When i retrieve the month, it gives back value 9. Actually October is the 10th month. Why is that? Arhaan Field number for get and set indicating the month. This is a calendar-specific value. The first month of the year is JANUARY which is 0; the last depends on the number of months in a year. Arhaan Singhania wrote:Mathews, it was confusing definitely, just wondering, why would they keep it to zero
http://www.coderanch.com/t/569637/java-programmer-SCJP/certification/Calendar-Date-class
CC-MAIN-2013-48
en
refinedweb
28 May 2008 14:25 [Source: ICIS news] SINGAPORE (ICIS news)--Japan Polypropylene (PP) hopes to start commercial production at its new 300,000 tonne/year unit at Kashima, Japan, in January next year, some eight months later than originally planned, a senior company official said on Wednesday. ?xml:namespace> “The new plant achieved mechanical completion December last year and trial production will begin in mid-June,” Japan Polypropylene’s president, Masahiro Abe, said on the sidelines of the Asia Petrochemical Industry Conference (APIC). He declined to say what caused the delay. It would be clear when commercial production can begin after trial runs were completed, he said, adding that propylene feedstock availability would also affect the timing of commercial production. The new PP unit will be receiving propylene from Mitsubishi Chemicals’ facilities at the same site. Mitsubishi Chemicals holds a 65% stake in Japan Polypropylene and Chisso Petrochemical the balance 35%. Japan Polyproplene is one of the largest PP producers in ?xml:namespace> To discuss issues facing the chemical industry go to ICIS connect ICIS
http://www.icis.com/Articles/2008/05/28/9127557/apic-08-japan-pp-aims-to-start-new-plant-in-jan.html
CC-MAIN-2013-48
en
refinedweb
user abaxaba I write perl for fun and profit. <p>My [163538|namespace]. <p>I've had the chance to meet some of thee. Please let me know if I've forgotten anyone: <li>[bageler|bageler] - I used to work with him</li> <li>[redsquirrel|redsquirrel] - I used to work with him, too</li> <li>[Belgarion|Belgarion] - I used to work with him</li> <li>[geekondemand|geekondemand] - I used to work with him</li> <li>[frag|frag] - From Chicago.pm days</li> 2012-10-16 13:32:45 1412 361035 171782 51 Metro Detroit -5 100 on
http://www.perlmonks.org/index.pl?displaytype=xml;node_id=140506
CC-MAIN-2013-48
en
refinedweb
Delay's Blog is the blog of David Anson, a Microsoft developer who works with C#, XAML, HTML, and Azure. @DavidAns Tip The CLR wrapper for a DependencyProperty should do its job and nothing more Explanation The CLR wrapper for a Silverlight/WPF DependencyProperty exists purely as a convenience to the developer. The "real" value of a DependencyProperty is stored by the system and accessed by the GetValue and SetValue methods. In fact, parts of the system will only access the value in that manner (possible examples: XAML parser, storyboard animations, etc.). And even if that weren't the case, the fact that the DependencyProperty field is public means that other parts of an application might do so as well (and there is no way of knowing when or stopping them). Therefore, it's not possible to ensure that any custom logic added to the CLR property's set or get wrapper implementation will run every time the DependencyProperty is accessed. Unless you're a fan of inconsistent state, hard to find bugs, or the like, it is typically unwise to violate this convention. Good Example public int MyProperty { get { return (int)GetValue(MyPropertyProperty); } set { SetValue(MyPropertyProperty, value); } } More information
http://blogs.msdn.com/b/delay/archive/2010/03/23/do-one-thing-and-do-it-well-tip-the-clr-wrapper-for-a-dependencyproperty-should-do-its-job-and-nothing-more.aspx
CC-MAIN-2013-48
en
refinedweb
Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources. The client application can be a simple application to just send HTTP requests to the service and receive AtomPub or JSON responses. The first client application example is a WPF application that makes use of the HttpWebRequest class from the System.Net namespace. Figure 32-2 shows the UI from the Visual Studio Designer. A TextBox named textUrl is used to enter the HTTP request with a default value of. The read-only TextBox named textReturn receives the answer from the service. You can also see a CheckBox checkJSON, where the response can be requested in the JSON format. The Button with the content Call Data Service has the Click event associated to the OnRequest() method.
http://my.safaribooksonline.com/book/programming/csharp/9780470502259/data-services/http_client_application
CC-MAIN-2013-48
en
refinedweb
Apparently, PHP will finally be getting C++ style namespaces. While this is a minuscule step in the right direction, it pales compared to Python's beautiful module system. PHP is also finally getting an There's also going to be lambdas and basic closures. Too bad PHP function and class declarations aren't as flexible as Python's. New syntax is being added. This is includes the NOWDOC syntax for writing unparsed strings. (ugly!) The worst, however, is the introduction of goto! Yes, PHP has taken another giant step towards becoming interpreted C. (sigh)
http://pybites.blogspot.com/2008_08_01_archive.html
CC-MAIN-2013-48
en
refinedweb
22 May 2012 08:44 [Source: ICIS news] SINGAPORE (ICIS)--Chinese oil and gas giant PetroChina plans to start up two new crackers in the second half of 2012, a company official said on Tuesday. The first – PetroChina subsidiary Fushun Petrochemical’s 800,000 tonne/year cracker located in Fushun, Liaoning province – will begin commercial production in August. Fushun Petrochemical currently operates a 150,000 tonne/year cracker at the same site. Another subsidiary, Daqing Petrochemical, will open a 600,000 tonne/year cracker in ?xml:namespace> Downstream units at the two facilities, including polypropylene (PP) and polyethylene (PE) will begin operations at the same time as the crackers, the source said, without giving details of the downstream
http://www.icis.com/Articles/2012/05/22/9561974/petrochina-to-start-up-two-new-crackers-in-augustseptember.html
CC-MAIN-2013-48
en
refinedweb
.: public enum BeepTypes : uint { Ok = 0x00000000, Error = 0x00000010, Warning = 0x00000030, Information = 0x00000040 } To make it easy to take a string and cast it to the enumeration value, add this extension method as well:: public interface ISoundPlayer { void PlaySound(BeepTypes type); }: ()); }. Download the sample solution here (but remember, it requires that you install the Silverlight 5 RC first!). Nice post, do you know how to set the window position in OOB mode by mean of pInvoke, ); I don't know how to convert from Application.MainWindow to InPtr Best regards, Paulo twitter: @paulovila it seems that is as 'easy as find a windows with the same title, but what if there are several instances? public const int SWP_SHOW); public static void SetWindoPos(int x, int y, int cx, int cy) { const string titulo = "wwwww"; Application.Current.MainWindow.Title = titulo; var v = FindWindowByCaption(IntPtr.Zero, titulo); SetWindowPos(v, IntPtr.Zero, x, y, cx, cy, SWP_SHOWWINDOW); } That's a good point. I started to go down that path but haven't fully vetted it - seems you've gotten farther along than me! Let me know if you find out anything new. My intent was to center the current window with a specific size, as there can be multiple intances, I set the title to a guid: public class PInvoke { public const int SwpShow); [DllImport("user32.dll")] static extern int GetSystemMetrics(SystemMetric smIndex); public enum SystemMetric { SmCxScreen = 0, SmCyScreen = 1, } public static void CenterWindowWithSize(int width, int height) { string titulo = Guid.NewGuid().ToString(); Application.Current.MainWindow.Title = titulo; var v = FindWindowByCaption(IntPtr.Zero, titulo); var yDesk = GetSystemMetrics(SystemMetric.SmCyScreen) - height; var xDesk = GetSystemMetrics(SystemMetric.SmCxScreen) - width; if (yDesk > 0) yDesk = yDesk / 2; else yDesk = 0; if (xDesk > 0) xDesk = xDesk / 2; else xDesk = 0; SetWindowPos(v, IntPtr.Zero, xDesk, yDesk, width, height, SwpShowWindow); } } For your interest, I have published a small project that shows a splash screen when the application is loading. It would be nice that the image be partially transparent so that it can be overlayed on the desktop. Maybe by capturing the desktop's screen rectangle bellow the current silverlight window position, then taking this capture and pasting on its background...
http://www.wintellect.com/blogs/jlikness/silverlight-5-rc-released-using-pinvoke
CC-MAIN-2013-48
en
refinedweb
While creating an application I came across a requirement when I had to put a listbox inside a list box and then I had bind that nested listbox dynamically. For example say, entity class called Roles as below, public class Roles { public string RollName { get; set; } } And you are using Role class in another entity class called Subscription as property public class Subscription { public string SubscriptionName { get; set; } public List<Roles> lstRoles { get; set; } } We need to achieve, There is function to return Data to bind to nested list box as below, List<Subscription> GetDataToBind() { List<Subscription> lstSubscriptions = new List<Subscription> { new Subscription { SubscriptionName ="Susbcription1", lstRoles = new List<Roles> { new Roles { RollName = "Role1" }, new Roles { RollName = "Role2" }, new Roles { RollName = "Role3" } } }, new Subscription { SubscriptionName ="Susbcription2", lstRoles = new List<Roles> { new Roles { RollName = "Role1" }, new Roles { RollName = "Role2" }, new Roles { RollName = "Role3" } } } }; return lstSubscriptions; } As of now we are ready with - Entity class - Data source And there is one more property in of generic list type in entity class. To bind that you need to set item source of internal list box as binding. Final XAML will be as below, <ListBox Height="646" HorizontalAlignment="Left" Margin="6,19,0,0" Name="listBox1" VerticalAlignment="Top" Width="444" > <ListBox.ItemTemplate> <DataTemplate> <Grid x: <Grid.ColumnDefinitions> <ColumnDefinition Width="201*"/> <ColumnDefinition Width="239*" /> </Grid.ColumnDefinitions> <Image Source="AzureLogo.png" Height="100" Width="100" Grid. <TextBlock x: <ListBox x: <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Vertical" > <TextBlock x: </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Eventually put item source of external list box as, public MainPage() { InitializeComponent(); listBox1.ItemsSource = GetDataToBind(); } In this post we discussed binding of nested listbox in Silverlight. I hope this post was useful. Thanks for reading. Pingback: Nested ListBox binding in Silverlight and Windows Phone 7 Pingback: Nested ListBox binding in Silverlight and Windows Phone 7 – Pingback: Monthly Report August 2011: Total Posts 17 « debug mode…… Simple. many thanks I am using wcf service.When I bind textbox inside the nested listbox with the property of the class ,whose objects make my list for nested listbox .Its displays something like MyProject.MyReference.MyClassName .Although the no.of times this is displayed is correct as per no.of items in the list.Pls Help
http://debugmode.net/2011/08/20/nested-listbox-binding-in-silverlight-and-windows-phone-7/
CC-MAIN-2013-48
en
refinedweb
java.lang.Object org.jcsp.lang.Guardorg.jcsp.lang.Guard org.jcsp.lang.CSTimerorg.jcsp.lang.CSTimer public class CSTimer This is a Guard for setting timeouts in an Alternative. Guardfor setting timeouts in an Alternative. It also provides the current system time and can set straight (i.e. committed) timeouts. The timeouts are in terms of absolute time values - not relative delays. Note: for those familiar with the occam multiprocessing language, CSTimer gives the semantics of the TIMER type (including its use as a guard in an ALT construct). Warning: a CSTimer records the timeout value for use by an Alternative. Therefore, different CSTimers must be used by different processes - the same CSTimer must not be shared. Implementation note: all CSTimers currently use the same System.currentTimeMillis time. Alternativeclass (see the examples A Fair Multiplexor with a Timeout and A Simple Traffic Flow Regulator). Here, we just show its use for setting committed timeouts. Regular generates a regular stream of output on its out channel. The rate of output is determined by its interval parameter. Recall that timeouts implemented by CSTimer are in terms of absolute time values. Notice that the sequence of output times maintains an arithmetic progression. Any delays in completing each cycle (e.g. caused by the process scheduler or the lateness of the process synchronising with us to accept our data) will be compensated for automatically - the output sequence always returns to its planned schedule whenever it can. import org.jcsp.lang.*; public class Regular implements CSProcess { final private ChannelOutput out; final private Integer N; final private long interval; public Regular (final ChannelOutput out, final int n, final long interval) { this.out = out; this.N = new Integer (n); this.interval = interval; } public void run () { final CSTimer tim = new CSTimer (); long timeout = tim.read (); // read the (absolute) time once only while (true) { out.write (N); timeout += interval; // set the next (absolute) timeout tim.after (timeout); // wait until that (absolute) timeout } } }For convenience, a sleepmethod that blocks for a specified time period (in milliseconds) is also provided. This has the same semantics as java.lang.Thread.sleep. [Note: programming a regular sequence of events is a little easier using after(as in the above) rather than sleep.] Alternative, Guard public CSTimer() public void setAlarm(long msecs) msecs- the absolute timeout value. public long getAlarm() setAlarm(long). public void set(long msecs) setAlarm(long)- this name caused confusion with the idea of setting the current time (a concept that is not supported). msecs- the absolute timeout value. public long read() public void after(long msecs) msecs- the absolute time awaited. Note: if this time has already been reached, this returns straight away. public void sleep(long msecs) msecs- the length of the sleep period. Note: if this is negative, this returns straight away.
http://www.cs.kent.ac.uk/projects/ofa/jcsp/jcsp-1.1-rc4/jcsp-doc/org/jcsp/lang/CSTimer.html
CC-MAIN-2013-48
en
refinedweb
06 May 2010 23:07 [Source: ICIS news] WASHINGTON (ICIS news)--A new White House report issued on Thursday calls for precautionary prohibition of toxic or carcinogenic chemicals in order to protect the public even if there is no clear proof that the substances threaten human health. Senator Fran Lautenberg (Democrat-New Jersey), sponsor of newly introduced legislation to modernise and broaden the Toxic Substances Control Act (TSCA), said the report by the presidential cancer panel lended further support to the need for a major overhaul of federal regulation of chemicals in commerce. Lautenberg, whose My Safe Chemicals Act (S-3209) has been described by industry leaders as exceeding the type of restrictive controls under the EU’s Reach programme, said the White House study demonstrated “the widespread health risks of chemical exposure”. The study, he said, was “further evidence that ?xml:namespace> The White House cancer panel report recommended as a first step that “A precautionary, prevention-oriented approach should replace current reactionary approaches to environmental contaminants in which human harm must be proven before action is taken to reduce or eliminate exposure”. The report, “Reducing Environmental Cancer Risk”, included a section titled “A Call to Action”, that stated: “The burgeoning number and complexity of known or suspected environmental carcinogens compel us to act to protect public health, even though we may lack irrefutable proof of harm”. The study singled out the nation’s chemicals sector, charging that “Industry has exploited regulatory weaknesses, such as government’s reactionary (rather than precautionary) approach to regulation”. “Likewise, industry has exploited government’s use of an outdated methodology for assessing ‘attributable fractions’ of the cancer burden due to specific environmental exposures,” the report said, adding: “This methodology has been used effectively by industry to justify introducing untested chemicals into the environment.” The three-member cancer panel said The report said that many industrial chemicals or processes had “hazardous by-products or metabolites” and that” which suggests that “unanticipated environmental hazards may emerge from the push for progress”. The study noted that while the number and mortality of cancer cases in the The panel members also called for more aggressive government policies to support green chemistry research and development. “But new products must be well studied prior to and following their introduction into the environment and stringently regulated to ensure their short- and long-term safety,” the report said. The study was based on testimony from 45 invited experts from academia, government, industry, the environmental and cancer advocacy communities and the public, the report summary
http://www.icis.com/Articles/2010/05/06/9357068/white-house-report-calls-for-precautionary-toxic-chemical-bans.html
CC-MAIN-2013-48
en
refinedweb
mount, umount - mount and unmount filesystems #include <sys/mount.h> int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data); int umount(const char *target); int umount2(const char *target, int flags);.. path_resolution (2) mount (8) umount (8) Advertisements
http://www.tutorialspoint.com/unix_system_calls/umount2.htm
CC-MAIN-2013-48
en
refinedweb
On 04/08/2009 10:17 AM, Kaspar Brand wrote: > Plüm, Rüdiger, VF-Group wrote: >> I reviewed your patch and found some issues with it. > > Thanks for your review and testing, Rüdiger. I assume you used and > adapted version of the sni_sslverifyclient-v5.diff patch, is that correct? > >> . > > Right. It also applies to SNI clients, actually, and the problem is that > the logic of this code (added in sni_sslverifyclient-v4.diff) is flawed: > > if ((dc->szCipherSuite && > !modssl_set_cipher_list(ssl, dc->szCipherSuite)) || > (sc->server->auth.cipher_suite && > !modssl_set_cipher_list(ssl, sc->server->auth.cipher_suite))) { > > - it will override the per-dir setting for the cipher suite with that > from the vhost level, if the latter is also set. Changing these lines to > > if ((dc->szCipherSuite || sc->server->auth.cipher_suite) && > !modssl_set_cipher_list(ssl, dc->szCipherSuite ? > dc->szCipherSuite : > sc->server->auth.cipher_suite)) { > > resolves this issue for me. > >> 2. The verification depth check causes unneeded renegotiations which >> break the ssl v2 tests in the perl framework (No dicussion here please >> whether we should still support SSL v2 :-)) > > This is an issue I already addressed in the patch for 2.2.x > (), but I guess you > were testing a trunk version without these changes, is that correct? Correct. @@ -462,26 +460,17 @@ int ssl_hook_Access(request_rec ; + n = sslconn->verify_depth; + sslconn->verify_depth = (dc->nVerifyDepth != UNSET) ? + dc->nVerifyDepth : sc->server->auth.verify_depth; + if ((sslconn->verify_depth < n) || + ((n == 0) && (sc->server->auth.verify_depth == 0))) { + renegotiate = TRUE; + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "Reduced client verification depth will force " + "renegotiation"); } - if (dc->nVerifyDepth != UNSET) { - /* XXX: doesnt look like sslconn->verify_depth is actually used */ - if (!(n = sslconn->verify_depth)) { - sslconn->verify_depth = n = sc->server->auth.verify_depth; - } · - /* determine whether a renegotiation has to be forced */ - if (dc->nVerifyDepth < n) { - renegotiate = TRUE; - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "Reduced client verification depth will force " - "renegotiation"); - } - } - /* * override of SSLVerifyClient * I don't really understand this part of the patch. If the default host has a verify depth of lets say 10 and the virtual host with the correct name has 1 then IMHO a renegotiation should happen but the code above does not seem to do this. · +#ifndef OPENSSL_NO_TLSEXT + /* If we're handling a request for a vhost other than the default one, + * then we need to make sure that client authentication is properly + * enforced. For clients supplying an SNI extension, the peer certificate + * verification has happened in the handshake already. For non-SNI requests, + * an additional check is needed here. If client authentication is + * configured as mandatory, then we can only proceed if the CA list + * doesn't have to be changed (SSL_set_cert_store() would be required + * for this). + */ +#define MODSSL_CFG_CA_NE(f, sc1, sc2) \ + (sc1->server->auth.f && \ + (!sc2->server->auth.f || \ + sc2->server->auth.f && strNE(sc1->server->auth.f, sc2->server->auth.f))) + + if ((r->server != r->connection->base_server) && + (verify & SSL_VERIFY_FAIL_IF_NO_PEER_CERT) && + renegotiate && + !(SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name))) { + SSLSrvConfigRec *bssc = mySrvConfig(r->connection->base_server); + + if (MODSSL_CFG_CA_NE(ca_cert_file, sc, bssc) || + MODSSL_CFG_CA_NE(ca_cert_path, sc, bssc)) { + ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, + "Non-default virtual host with SSLVerify set to 'require' " + "and VirtualHost-specific CA certificate list is only " + "supported for clients with TLS server name indication " + "(SNI) support"); + return HTTP_FORBIDDEN; + } + } +#endif /* OPENSSL_NO_TLSEXT */ + I don't get why the above code is only needed in the case that Openssl is SNI capable. IMHO this check is always needed or better regardless of SNI or not SNI only needed + if ((dc->nVerifyClient != SSL_CVERIFY_UNSET) || + (sc->server->auth.verify_mode != SSL_CVERIFY_UNSET)) { Otherwise a compiler warning about verify might be used uninitialized tells you that something is wrong with the code anyway. The only thing that needs an ifndef above is +#ifndef OPENSSL_NO_TLSEXT + && !(SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name)) +#endif which is always true in the non SNI case. One other thing: r->connection->base_server is IMHO always wrong in the patch and should be replaced with sslconn->server Regards Rüdiger
http://mail-archives.apache.org/mod_mbox/httpd-dev/200904.mbox/%3C49E24361.60808@apache.org%3E
CC-MAIN-2013-48
en
refinedweb
.validator.ex; 20 21 import org.apache.myfaces.custom.clientvalidation.common.ClientValidator; 22 23 /** 24 * @author cagatay (latest modification by $Author: skitching $) 25 * @version $Revision: 673833 $ $Date: 2008-07-03 16:58:05 -0500 (Thu, 03 Jul 2008) $ 26 */ 27 public class LongRangeValidator extends javax.faces.validator.LongRangeValidator implements ClientValidator{ 28 29 public String getScriptFunction() { 30 return "tomahawk.LongRangeValidator(" + getMinimum() + "," + getMaximum() + ")"; 31 } 32 33 public String getScriptResource() { 34 return null; 35 } 36 }
http://myfaces.apache.org/sandbox-project/tomahawk-sandbox/xref/org/apache/myfaces/validator/ex/LongRangeValidator.html
CC-MAIN-2013-48
en
refinedweb
Could somebody enlighten me on the difference between inner and nested classes ??? My understanding is that inner classes are those classes defined in methods while nested classes are those which are not part of any method but are defined within a class directly. Is this understanding correct ? No. Classes defined inside methods are local or anonymous classes, which are types of inner classes, but not the only ones. If yes, are not inner classes also to be considered as nested classes, since they have an enclosing class anyway ? All inner classes are indeed nested classes, but neither definition has anything to do with whether or not they have enclosing instances. What about anonymous classes defined in a method ? Is it also an inner class ? Yes. What about an anonymous class defined at the class level like the one below ? Is it an inner class or a nested class ? <code><pre>public class A { Button myButton = new Button(); myButton.addActionListener (new ActionListener() { public void actionPerformed(ActionEvent e ) { } } ); }</pre></code> This won't compile. At the class level, you can only have a declaration (of a field, method, constructor, or class) or a static initializer or instance initializer. You can't have a plain statement like myButton.addActionListener() - that needs to be inside a method, constructor, or initializer instead. If it were, then the class would be nested and inner.
http://www.coderanch.com/t/193030/java-programmer-SCJP/certification/Difference-nested-classes
CC-MAIN-2013-48
en
refinedweb
22 June 2010 18:09 [Source: ICIS news] By William Lemos HOUSTON (ICIS news)--In a land where superlatives are a way of life, none rings as true these days as when Americans talk about how much the country depends on energy it does not produce. With only 5% of the population, ?xml:namespace> Much has been said in Ethanol is a prime example. After a promising start five years ago, fuel ethanol has gone from hero to villain and today probably ranks as the most controversial energy issue in Who is to blame? It depends on who you talk to. Ethanol makers say they have been persecuted by the oil and food industries because the former is losing market share to the biofuel and the latter can no longer buy corn on the cheap. Critics counter that While that debate could go on forever with no clear winner, one culprit on the sidelines should not miss its share of the blame: the government, for sending mixed signals to the market. That started to change with the mass production of ethanol, the only realistic domestic alternative the Like a bull charging out of the pen, the But the intensity of that initial push is in contrast to the apathy seen in the past two years, as the fate of biofuels now seems consigned to a handful of lawmakers representing states that rely on the industry. US biodiesel makers have been hardest hit by political inertia. That industry is on the verge of collapse after a six-month delay by Congress on a vote on a subsidy extension. That delay is despite the Lack of political initiative could likewise spell disaster for the ethanol industry, which is seeking an increase in the limit of ethanol the Industry groups last week warned that allowing the subsidy to expire could cost 112,000 jobs and force around two of every five Legislation seeking an extension was introduced in April, but Congress has yet to look into the issue, said Julie Allen, a consultant with Kansas-based accounting firm Kennedy Coe. An end to government support would also inhibit investment in second-generation ethanol production, the industry claims, saying second-generation ethanol will be vital for the The ethanol industry is fighting a parallel battle to have the ethanol blending cap on gasoline lifted. The industry wants the government to authorise blending of up to 15% (E15) to create additional demand and absorb growing production of the biofuel. The As with anything involving ethanol, the increase in the blend volume is a controversial issue. Opponents claim more ethanol in gasoline could interfere with vehicle performance and potentially void vehicle warranties. The fate of higher blends rests with US Environmental Protection Agency (EPA). The agency was originally expected to rule on the issue in December 2009, but postponed the decision to July and last week announced it was putting off the ruling until September. Ethanol advocates have argued that a weakened The outcome would be continued dependence on foreign crude oil with a new dependence on imported ethanol. Not a good case for energy security
http://www.icis.com/Articles/2010/06/22/9370310/INSIGHT-US-energy-policy-on-ethanol-a-sad-tale-of-confusion.html
CC-MAIN-2013-48
en
refinedweb
This is the first in a series of blogs in which I'll talk about writing a custom claims provider. First, it's probably worth understanding a little background on what a claims provider is and why we might want to use one. A claims provider in SharePoint 2010 is primarily used for two reasons - 1) to do claims augmentation and 2) to provide name resolution. Claims augmentation is part of a process that occurs after you log onto a claims authentication site. It's important to remember that everything can run with claims authentication in SharePoint 2010 - Windows claims (when you log in with NTLM or Kerberos), FBA claims (when you use an ASP.NET Membership and Role provider), or SAML claims (when you login via an STS like ADFS v2, formerly known as Geneva Server). After you've logged in, all the registered claims providers for that web application fire. When they do, they can add additional claims that weren't provided at login time. For example, maybe you logged in with using Windows authentication, but we want to grant an additional claim that can be used for accessing an SAP system. Name resolution really comes in two parts - people picker and type-in control. For the people picker, when you want people to be able to search for and find your claims, a claims provider allows you to do this. The type-in control is where you can type in a user name, or a claim, and click the resolve button. Your claims provider can look at that input and determine if it's valid - if so then it will "do the right thing" to resolve it. So now that we've talked about this in rather abstract terms, let's lay out the scenario we're going to use as we build this custom claims provider. For our particular scenario, we want to assign rights in our site collection based on a person's favorite basketball team. This is one of the really great features about claims authentication that gets some getting used to - we don't really care who they are, we don't really care how they authenticated to the site, all we care about is an attribute of them - what's their favorite team. QUICK NOTE: I'm using a later build than the public beta of SharePoint 2010. The samples shown in this series are not expected to work with the public beta version. For our web application, I've enabled both Windows claims and FBA claims. I'm using the standard SQL membership and role provider for the FBA users, and I've pre-populated my list of FBA accounts with user1 through user50. To simplify the scenario, a person's favorite team will be determined in this way: ·" Claims Augmentation The first thing we're going to do is claims augmentation. As described above, once a person has authenticated, our claim provider is going to fire. We'll use the rules I've defined above then to add a claim with their favorite basketball team. So we start out in Visual Studio and create a new Class Library application. Step 1 - Add References The first thing we want to do is to add references to Microsoft. SharePoint and Microsoft.IdentityModel. I'm assuming you all should be able to find Microsoft.SharePoint. Microsoft.IdentityModel is installed as part of the Windows Identity Foundation. In my particular installation I found this assembly at C:\Program Files\Reference Assemblies\Microsoft\Windows Identity Foundation\v3.5\Microsoft.IdentityModel.dll. Step 2 - Add Using Statements and Class Inheritance Now that we have our references, we need to add our using statements and define the base class that our class inherits from. For this example we are going to use the following using statements: using Microsoft.SharePoint.Diagnostics; using Microsoft.SharePoint; using Microsoft.SharePoint.Administration; using Microsoft.SharePoint.Administration.Claims; using Microsoft.SharePoint.WebControls; Our class itself needs to inherit from the SPClaimProvider base class. So here's what our class looks like at the start; don't be thrown by the name - I was originally only going to write it to work with the SQL membership and role provider but later decided to make it work with Windows too: namespace SqlClaimsProvider { public class SqlClaims : SPClaimProvider { public SqlClaims(string displayName) : base(displayName) { } } } Step 3 - Add Required Implementation Rather than go through step-by-step all of the interfaces you need to implement, instead let me just suggest that you hover over the SPClaimProvider name above, click the drop down that appears under the S, and select the Implement abstract class 'SPClaimProvider' menu option. Step 4 - Implement the Functionality Included with the Provider Once you implement the abstract class, there are five properties we need to implement no matter what we're going to do: Name, SupportsEntityInformation, SupportsHierarchy, SupportsResolve, and SupportsSearch. We'll start with the "Supports..." properties first. If you're only doing claims augmentation, then the only one you really need to support is entity information. So the property list in my class looks like this: public override bool SupportsEntityInformation get { return true; } public override bool SupportsHierarchy return false; public override bool SupportsResolve public override bool SupportsSearch Next we'll implement support for the Name property. You will generally want to support both a display name and an "internal" name by which your provider can be referenced. In this case I'm going to use internal static properties so that I can share it with another class I'll be adding later in the project. So here's what my implementation for Name looks like: internal static string ProviderDisplayName { get { return "Basketball Teams"; } } internal static string ProviderInternalName { get { return "BasketballTeamProvider"; } } public override string Name { get { return ProviderInternalName; } } internal static string ProviderDisplayName get { return "Basketball Teams"; internal static string ProviderInternalName return "BasketballTeamProvider"; public override string Name return ProviderInternalName; Okay, we've gotten all the basic and fairly uninteresting goo out of the way now. On to more interesting things. First, I've set up an array that we'll use in our provider for the teams; it's been added at the top of the class: //teams we're using private string[] ourTeams = new string[] { "Blazers", "DVK Jovenut", "Shanghai Tigers" }; Now we need to implement the guts of our provider. To do claims augmentation we want to add implementation code for FillClaimsForEntity, FillClaimTypes, and FillClaimValueTypes. To start with, we'll create a couple of simple helper functions because we'll be calling upon them throughout the creation of our provider. Those helper functions are to define the ClaimType, which is basically our claim namespace or identifier, and the ClaimValueType, like string, int, etc. Here are the two helper functions that do that for us: private static string SqlClaimType return ""; private static string SqlClaimValueType return Microsoft.IdentityModel.Claims.ClaimValueTypes.String; So what you can tell from this so far is that if our claim provider is working, we will be adding a claim with a name of and the value in that claim will be a string. From the preceding code and information in this post, we know that the value will be Blazers, DVK Jovenut, or Shanghai Tigers. As far as the claim name itself, there aren't hard and fast rules for what the name has to look like. In general, we usually go "schemas.company.com/claimname". In this case my domain is "steve.local", so I used "schemas.steve.local", and "teams" is the property I want this claim to track. The part where we actually add that claim comes next - in the FillClaimsForEntity method. Let's look at the code for that: List<SPClaim> claims) if (entity == null) throw new ArgumentNullException("entity"); if (claims == null) throw new ArgumentNullException("claims"); //figure out who the user is so we know what team to add to their claim //the entity.Value from the input parameter contains the name of the //authenticated user. for a SQL FBA user, it looks something like // 0#.f|sqlmembership|user1; for a Windows claims user it looks something //like 0#.w|steve\\wilmaf //I'll skip some boring code here to look at that name and figure out //if it's an FBA user or Windows user, and if it's an FBA user figure //out what the number part of the name is after "user" string team = string.Empty; int userID = 0; //after the boring code, "userID" will equal -1 if it's a Windows user, //or if it's an FBA user then it will contain the number after "user" //figure out what the user's favorite team is if (userID > 0) //plug in the appropriate team if (userID > 30) team = ourTeams[2]; else if (userID > 15) team = ourTeams[1]; else team = ourTeams[0]; else team = ourTeams[1]; //if they're not one of our FBA users then make their favorite team DVK //add the claim claims.Add(CreateClaim(SqlClaimType, team, SqlClaimValueType)); The main thing worth pointing out from that method is the very last line of code. We take the input parameter "claims", which is a list of SPClaim objects. We create a new claim using the CreateClaim helper method. I strongly encourage you to use the helper methods whenever possible. They tend to do a few additional things more than just using the default constructors and you will generally find things to work more completely when you use them. Finally, when we create the claim we use the two helper methods that I described earlier - the SqlClaimType and SqlClaimValueType methods. Okay, we've really done the most complicated part of this code now, but there's two additional methods we need to provide an implementation for: FillClaimTypes and FillClaimValueTypes. These are actually going to be pretty simple to do because we're just going to use our helper methods for them. Here's what their implementation looks like: protected override void FillClaimTypes(List<string> claimTypes) if (claimTypes == null) throw new ArgumentNullException("claimTypes"); //add our claim type claimTypes.Add(SqlClaimType); protected override void FillClaimValueTypes(List<string> claimValueTypes) if (claimValueTypes == null) throw new ArgumentNullException("claimValueTypes"); //add our claim value type claimValueTypes.Add(SqlClaimValueType); I think those should be pretty straightforward so I'm won't dig into them any further. So now we have our basic implementation of a claims provider done, which should do claims augmentation for us. So how do I use it? Well the preferred method is to use a claims feature receiver. To be blunt, it's the only way I know how to get it registered and working right now in fact so that's what I'll explain how to do. Step 5 - Create the Provider Feature Receiver For this step we'll start by adding a new class to the project. It's going to inherit from the SPClaimProviderFeatureReceiver base class. The implementation of it is really pretty straightforward so I'll just paste all the code in here and then briefly walk-through it. using Microsoft.SharePoint.Diagnostics; public class SqlClaimsReceiver : SPClaimProviderFeatureReceiver private void ExecBaseFeatureActivated( Microsoft.SharePoint.SPFeatureReceiverProperties properties) //wrapper function for base FeatureActivated. Used because base //keywork can lead to unverifiable code inside lambda expression base.FeatureActivated(properties); public override string ClaimProviderAssembly get { return typeof(SqlClaims).Assembly.FullName; } public override string ClaimProviderDescription { return "A sample provider written by speschka"; public override string ClaimProviderDisplayName //this is where we reuse that internal static property return SqlClaims.ProviderDisplayName; public override string ClaimProviderType return typeof(SqlClaims).FullName; public override void FeatureActivated( SPFeatureReceiverProperties properties) ExecBaseFeatureActivated(properties); Really the only things worth pointing out I think are: Step 6 - Compile Assembly and Add to Global Assembly Cache This step I'm putting in as a manual step, but you could obviously do it with a solution package if you wanted to go that way. In this scenario I'm just doing everything all on one server while I'm in development mode so I'm doing it a little differently than if I were ready to distribute it to my farm. So for now, make sure your assembly is strongly-named and then compile it. To move things along, use whatever your method of choice is (I just use a post-build event and gacutil) to add the assembly to the Global Assembly Cache, or GAC. Now we're ready to create and deploy our feature. Step 7 - Create and Deploy Claims Provider Feature For this step there isn't anything specific to claims providers. We're just going to create a standard SharePoint feature and deploy it. The basics of doing that are kind of outside the scope of this posting, so let me just paste the Xml from my feature.xml file in here so you can see what it looks like: in hand, I created a directory called SqlClaimsProvider in my Features folder and installed my feature; since it's a Farm-scoped feature then it was automatically activated. Here's the command to do that in PowerShell: install-spfeature -path SqlClaimsProvider Okay, all of the pieces are in place now - we're ready to try it out. Step 8 - Log Into the Site and Try It Out For this final step I'm using my web application that I described at the beginning - it supports Windows claims and FBA claims. To validate whether my claims are being property augmented, I have created a web part that displays all of my claims. I'll show you screenshots of that to validate that the claims augmentation is actually working. First, I log into the site using Windows credentials. Remember from our code above that a Windows user should always be assigned "DVK Jovenut" as his or her favorite team. So here's what it looks like for the Windows user: And here's what it looks like for an FBA user: Okay, this is cool stuff - we've got our claims augmentation working. In the next posting, I'll show how to start working with the people picker. We'll do a shorter post where we talk about supporting and adding a hierarchy to the people picker.
http://blogs.technet.com/b/speschka/archive/2010/03/13/writing-a-custom-claims-provider-for-sharepoint-2010-part-1.aspx
CC-MAIN-2013-48
en
refinedweb
Nuno Carvalho wrote: > I am trying to compile one file called xpriv.c which belongs to the >Radio Track install ! Unfortunally i get that: > >------------------------------------------------ >xpriv.c: In function `give_up_root`: >xpriv.c:30: `uid_t` undeclared (first use this function) >xpriv.c:30: (Each undeclared identifier is reported only once >xpriv.c:30: for each function it appears in.) >xpriv.c:30: parse error before `uid` >xpriv.c:33: `uid` undeclared (first use this function) > >----------------------------------------------- > > The code is: > >--------------------------- >#include <unistd.h> >#include <stdio.h> > >int give_up_root(void) >{ > /* get the real uid and give up root */ > uid_t uid; > int err; > > uid=getuid(); > err=seteuid(uid); > return (err); >} >----------------------------- > >What is going wrong ? > > uid_t structure isn`t already defined ? You also need: #include <sys/types.h> I am reporting this as a bug in the manpage of getuid and setuid against manpages-dev. -- -- To UNSUBSCRIBE, email to debian-user-request@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
http://lists.debian.org/debian-user/1998/06/msg00417.html
CC-MAIN-2013-48
en
refinedweb
Whether or not you liked former U.S. Secretary of Defense Donald Rumsfeld, you had to chuckle over his famous "unknown unknowns" Amazon to Windows Azure, see how the elite 8 public clouds compare in InfoWorld Test Center's review. | Also check out our "Cloud Security Deep Dive." | Keep up with key security issues with InfoWorld's Security Central newsletter. ] Although Rumsfeld was ridiculed for that statement, it was a case of a politician accidentally telling the truth, and I think anyone in computer security quickly understood what he was talking about. We are constantly faced with all three types of risks: known knowns, known unknowns, and unknown unknowns. One of the biggest impediments to public cloud computing adoption is the calculation of additional risk from all the unknowns, known and otherwise. I've spent the last few years contemplating these issues as both a public cloud provider and user. Here's a list of five risks any business faces as a customer of a public cloud service. Cloud risk No. 1: Shared access One of the key tenets of public cloud computing is multitenancy, meaning that multiple, usually unrelated customers share the same computing resources: CPU, storage, memory, namespace, and physical. Several new classes of vulnerabilities derive from the shared nature of the cloud. Researchers have been able to recover other tenants' data from what was supposed to be new storage space. Other researchers have been able to peek into other tenants' memory and IP address space. A few have been able to take over another tenant's computing resources in totality by simply predicting what IP or MAC addresses were assigned. Multitenancy security issues are just now becoming important to most of us, and the vulnerabilities within are starting to be explored. The best precursor example is a single website placed on a Web server with hundreds or even thousands of other, unrelated websites. If history is any guide -- it usually is -- multitenancy will be a big problem over the long haul. Cloud risk No. 2: Virtual exploits Every large cloud provider is a huge user of virtualization. However, it holds every risk posed by physical machines, plus its own unique threats, including exploits that target the virtual server hosts and the guests. You have four main types of virtual exploit risks: server host only, guest to guest, host to guest, and guest to host. All of them are largely unknown and uncalculated in most people's risk models. When I talk to senior management about virtual risk issues, their eyes glaze over. Many have said to me that the risks are overblown or exploits are unheard of. I usually tell them to check out their own virtualization software vendor's patch list. It isn't pretty. To up the ante, the cloud customer typically has no idea what virtualization products or management tools the vendor is running. To shed some light on this risk, ask your vendor the following questions: What virtualization software do you run? What version is it on now? Who patches the virtualization host and how often? Who can log into each virtualization host and guest?
http://www.infoworld.com/d/security/the-5-cloud-risks-you-have-stop-ignoring-214696?source=footer
CC-MAIN-2013-48
en
refinedweb
Word tokenization is the process of splitting a large sample of text into words. This is a requirement in natural language processing tasks where each word needs to be captured and subjected to further analysis like classifying and counting them for a particular sentiment etc. The Natural Language Tool kit(NLTK) is a library used to achieve this. Install NLTK before proceeding with the python program for word tokenization. conda install -c anaconda nltk Next we use the word_tokenize method to split the paragraph into individual words. import nltk word_data = "It originated from the idea that there are readers who prefer learning new skills from the comforts of their drawing rooms" nltk_tokens = nltk.word_tokenize(word_data) print (nltk_tokens) When we execute the above code, it produces the following result. ['It', 'originated', 'from', 'the', 'idea', 'that', 'there', 'are', 'readers', 'who', 'prefer', 'learning', 'new', 'skills', 'from', 'the', 'comforts', 'of', 'their', 'drawing', 'rooms'] We can also tokenize the sentences in a paragraph like we tokenized the words. We use the method sent_tokenize to achieve this. Below is an example. import nltk sentence_data = "Sun rises in the east. Sun sets in the west." nltk_tokens = nltk.sent_tokenize(sentence_data) print (nltk_tokens) When we execute the above code, it produces the following result. ['Sun rises in the east.', 'Sun sets in the west.']
https://www.tutorialspoint.com/python_data_science/python_word_tokenization.htm
CC-MAIN-2020-10
en
refinedweb
Mat img = imread(..) vs img = imread(..) i have img as a member in the .h file, but when i use img = imread(..); in the .cpp file, it crashes. however, using Mat img = imread(..); works. what is the difference? thanks! note: opencv3.0 with qt "it crashes" IS NO ERROR MESSAGE! What exactly happens? Which message do you get? Is your member in the header file declared public? Is it inside a namespace? The second declaration won't even use your global variable, but rather create a local img object withing the scope of your cpp file, but not update the value of your global img object. However I am not sure if you can make a non static object in header files. Never done so before, only know the principle. @FooBar there werent any error messages... a window popped up saying it stopped running and that it is checking for a solution, and on my Qt creator IDE, it says after the program closed, this: The program has unexpectedly finished. @StevenPuttemans yes it was in the header file, but in private instead. I tried putting it as public, but it was still the same... I actually dont want to make it a local variable, but it seems like it wont crash if i do it that way.. could it be that it wasnt initialized to something? not sure how this works.. :( @pingping__ it seems to me that you need to dig deeper in C++ basics of how header and source code files work together. This seems to be not an OpenCV problem at all.
https://answers.opencv.org/question/56777/mat-img-imread-vs-img-imread/
CC-MAIN-2020-10
en
refinedweb
1. Executable programs or shell commands DBUS-DAEMONSection: User Commands (1) Updated: Index | Return to Main Contents NAMEdbus-daemon - Message bus daemon SYNOPSIS - dbus-daemon - dbus-daemon [--version] [--session] [--system] [--config-file=FILE] [--print-address [=DESCRIPTOR]] [--print-pid [=DESCRIPTOR]] [--fork] [--nosyslog] [--syslog] [--syslog-only] DESCRIPTION dbus-daemon=/usr/share/dbus-1/session.conf" and the --system option is equivalent to "--config-file=/usr/share. This option is not supported on Windows. --nofork - Force the message bus not to fork and become a daemon, even if the configuration file specifies that it should. On Windows, the dbus-daemon never forks, so this option is allowed but does nothing. - conjunction with the systemd system and session manager on Linux. --nopidfile - Don't write a PID file even if one is configured in the configuration files. --syslog - Force the message bus to use the system log for messages, in addition to writing to standard error, even if the configuration file does not specify that it should. On Unix, this uses the syslog; on Windows, this uses OutputDebugString(). --syslog-only - Force the message bus to use the system log for messages, and not duplicate them to standard error. On Unix, this uses the syslog; on Windows, this uses OutputDebugString(). --nosyslog - Force the message bus to use only standard error for messages, even if the configuration file specifies that it should use the system log. "/usr/share/dbus-1/system.conf" and "/usr/share/dbus-1/session.conf". These files normally <include> a system-local.conf or session-local.conf in /etc/dbus-1; you can put local overrides in those files to avoid modifying the primary configuration files. The configuration file is an XML document. It must have the following doctype declaration: <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN" "m[blue][]"> The following elements may be present in the configuration file. - • <busconfig> Root element. - • <type> The well-known type of the message bus. Currently known values are "system" and "session"; if other values are set, they should be either added to the D-Bus specification, or namespaced. The last <type> element variable will be set to the address of the system bus (which is normally well known anyway). Example: <type>session</type> - • . - • notification of printer queue changes, it could install a file to /usr/share/dbus-1/system.d or /etc/dbus-1/system.d that allowed all apps to receive this message and allowed the printer daemon user to send it. - • . - • <fork> If present, the bus daemon becomes a real daemon (forks into the background, etc.). This is generally used rather than the --fork command line option. - • <keep_umask> If present, the bus daemon keeps its original umask when forking. This may be useful to avoid affecting the behavior of child processes. - • <syslog> If present, the bus daemon will log to syslog. The --syslog, --syslog-only and --nosyslog command-line options take precedence over this setting. - • <pidfile> If present, the bus daemon will write its pid to the specified file. The --nopidfile command-line option takes precedence over this setting. - • <allow_anonymous> If present, connections that authenticated using the ANONYMOUS mechanism will be authorized to connect. This option has no practical effect unless the ANONYMOUS mechanism has also been enabled using the <auth> element, described below. - • multiple> - • > - • <servicedir>"). - • <standard_session_servicedirs/> : - • $XDG_RUNTIME_DIR/dbus-1/services, if XDG_RUNTIME_DIR is set (see the XDG Base Directory Specification for details of XDG_RUNTIME_DIR): this location is suitable for transient services created at runtime by systemd generators (see systemd.generator(7)), session managers or other session infrastructure. It is an extension provided by the reference implementation of dbus-daemon, and is not standardized in the D-Bus Specification.. - • $XDG_DATA_HOME/dbus-1/services, where XDG_DATA_HOME defaults to ~/.local/share (see the XDG Base Directory Specification): this location is specified by the D-Bus Specification, and is suitable for per-user, locally-installed software. - • directory/dbus-1/services for each directory in XDG_DATA_DIRS, where XDG_DATA_DIRS defaults to /usr/local/share:/usr/share (see the XDG Base Directory Specification): these locations are specified by the D-Bus Specification. The defaults are suitable for software installed locally by a system administrator (/usr/local/share) or for software installed from operating system packages (/usr/share). Per-user or system-wide configuration that sets the XDG_DATA_DIRS environment variable can extend this search path to cover installations in other locations, for example ~/.local/share/flatpak/exports/share/ and /var/lib/flatpak/exports/share/ when flatpak(1) is used. - • ${datadir}/dbus-1/services for the ${datadir} that was specified when dbus was compiled, typically /usr/share: this location is an extension provided by the reference dbus-daemon implementation, and is suitable for software stacks installed alongside dbus-daemon. The "XDG Base Directory Specification" can be found at m[blue][] if it hasn't moved, otherwise try your favorite search engine. On Windows, the standard session service directories are: - • %CommonProgramFiles%/dbus-1/services if %CommonProgramFiles% is set: this location is suitable for system-wide installed software packages - • A share/dbus-1/services directory found in the same directory hierarchy (prefix) as the dbus-daemon: this location is suitable for software stacks installed alongside dbus-daemon The <standard_session_servicedirs/> option is only relevant to the per-user-session bus daemon defined in /etc/dbus-1/session.conf. Putting it in any other configuration file would probably be nonsense. - • <standard_system_servicedirs/> <standard_system_servicedirs/> specifies the standard system-wide activation directories that should be searched for service files. As with session services, the first directory listed has highest precedence. On Unix, the standard session service directories are: - • /usr/local/share/dbus-1/system-services: this location is specified by the D-Bus Specification, and is suitable for software installed locally by the system administrator - • /usr/share/dbus-1/system-services: this location is specified by the D-Bus Specification, and is suitable for software installed by operating system packages - • ${datadir}/dbus-1/system-services for the ${datadir} that was specified when dbus was compiled, typically /usr/share: this location is an extension provided by the reference dbus-daemon implementation, and is suitable for software stacks installed alongside dbus-daemon - • /lib/dbus-1/system-services: this location is specified by the D-Bus Specification, and was intended for software installed by operating system packages and used during early boot (but it should be considered deprecated, because the reference dbus-daemon is not designed to be available during early boot). - • daemon defined in /usr/share/dbus-1/system.conf. Putting it in any other configuration file would probably be nonsense. - • "pending_fd_timeout" : milliseconds (thousandths) a fd is given to be transmitted to dbus-daemon before disconnecting the connection denial-of-service all other users by using up all connections on the systemwide bus. Limits are normally only of interest on the systemwide bus, not the user session buses. - • <policy> The <policy> element defines a security policy to be applied to a particular set of connections to the bus. A policy is made up of <allow> and <deny> elements. Policies are normally used with the systemwide bus; they are analogous to a firewall in that they allow expected traffic and prevent unexpected traffic._broadcast="true" | "false" send_destination="name" | "*" send_type="method_call" | "method_return" | "signal" | "error" | "*" send_path="/path/name" | "*").. dropping. The eavesdrop attribute can only be combined with send and receive rules (with send_* and receive_* attributes). The [send|receive]_requested_reply attribute works similarly to the eavesdrop attribute. It controls whether the <deny> or <allow> matches a reply that is expected (corresponds to a previous method call message)..>. Manager. - • <selinux> The <selinux> element contains settings related to Security Enhanced Linux. More details below. - • <associate>. - • <apparmor> See m[blue][] operations If you're trying to figure out where your messages are going or why you m[blue][] BUGS Please send bug reports to the D-Bus mailing list or bug tracker, see m[blue][] Index Return to Main Contents
https://eandata.com/linux/?chap=1&cmd=dbus-daemon
CC-MAIN-2020-10
en
refinedweb
Hide Forgot Testing with meta.c (attached) Test program created numerous files using various file open() flags and truncated each to 10 MiB. The test then wrote a 512-byte block beginning at offset 0 to each file. After a 10-second delay, the next 512-byte block was written, and so forth. During the testing, both regular file write() and memcpy() to an mmapped file were tested, as well as combinations of fsync(), fdatasync(), and no file sync. While the test program was running (after 10+ hours), customer initiated their snapshot + backup process. The metadata of the various files (in particular, the 'mtime') was then compared. The result of the testing indicated that the file open() flags had no bearing on whether mtime was updated. Both fsync() and fdatasync() were confirmed to behave as expected (fsync forced both data write-out and 'mtime' update, while fdatasync() only caused write-out of the data). When the file was written to through an mmap, fdatasync() was called, and fsync() was not called, the file's 'mtime' was never updated. In these cases, the mtime remained unchanged since the file creation time. File contents appeared to be correct in all cases. In comparison, when the test program ran on a local ext4 filesystem (with the default data=ordered), the combination of mmap and not calling either fsync() or fdatasync() resulted in files where the 'mtime' would periodically lag behind the write time (and the mtime of the other files), but never by more than 20 seconds. (Note: after running 'sync', all metadata was written to disk, and the maximum mtime difference was less than 10 milliseconds). It appears that gfs does not update the on-disk mtime in file writes when: an mmap() is used, fdatasync() is called, and fsync() is not called Created attachment 864329 [details] test program used to demonstrate the issue Well I'm not sure exactly what the problem is that you are reporting here. Why is it not expected that mtime would update during an mmap write if fsync has not been called? The man page for fdatasync says: modifica‐ tion; see stat(2)) do not require flushing because they are not neces‐ sary for a subsequent data read to be handled correctly. On the other hand, a change to the file size (st_size, as made by say ftruncate(2)), would require a metadata flush. I can't see the attachment in comment #1, as it seems to be corrupt or marked as the wrong type of file. Hi Steve, *** Bug 1066178 has been marked as a duplicate of this bug. *** *** Bug 1066179 has been marked as a duplicate of this bug. *** Thanks for the link in comment #4, however so far as I can tell the behaviour is as expected per the man page information for fdatasync() unless I'm missing something here? In-memory mtime is in fact updated. And the fact that in-memory never propagated to the disk creates a lot of confusion in case of the last close (2) SAN level snapshots creation. Though I think DRBD will be affected the same. I think it would be rather nice to have `gfs_tool freeze' to synchronize in-memory with on-disc. This single change will make me happy. Ok, so the issue is not fdatasync then, its not syncing before a freeze. I'll update the bug description accordingly.. Please do not close this bug. It should not be closed as WONTFIX Actually, I don't see any evidence that the mtime is getting updated at all for mmap writes in your test program. the file keeps it's creation mtime no matter how long you leave it. Unmounting and remounting doesn't update it. I'm going to do some more digging. Apparently the Single Unix Specification guarantee is that mtime will be updated at the very least by the next call to msync() or if no call to mysnc happens, by munmap(). Presumably, even if there isn't an explicit call to munmap(), when the file is closed, the mtime should be updated. Created attachment 878304 [details] patch to make gfs write out mtime on mmap syncs This patch modifies gfs_write_inode to make it actually write out the modified vfs inode attributes. This will cause mtime to get updated when the mmap file changes are synced back to disk. This bit: if (ip && sync) gfs_log_flush_glock(ip->i_gl, 0); seems odd, bearing in mind that ip is dereferenced higher up the function. However that seems to be in the existing code, but maybe worth checking for certain that ip can never be NULL here. Still in dev phase for 5.11, so lets ask for blocker for this as it is something that we ought to ensure is fixed. Created attachment 878667 [details] Version of the patch that is posted to cluster-devel This version is just like the former, without the debug printk, and with a sensible checking if ip != NULL. Now, I can't see where ip could be NULL calling this function, but the other gfs_super_ops functions also do this check, so I assume that there was at least a worry that this could happen, and I left the check in. 5.11 seems like a bad place to clean up this sort of thing. Verified against kmod-gfs-0.1.34-20.el5 with the following simple python script: from mmap import * from time import sleep from random import randint maxsize = 2**25 f = open("mmapfile", "r+b") mm = mmap(f.fileno(), maxsize, MAP_SHARED) token = "hello" while True: o = randint(0, maxsize - len(token)) mm[o:o+len(token)] = token sleep(5) Running `watch stat mmapfile` on each node shows that the mtime is updated across the cluster while the above script is running. With kmod-gfs-0.1.34-18.el5, the mtime on other nodes never updates. After I stopped my test case to verify this bug, my system panicked with the following assert. GFS: fsid=nate:nate0.1: fatal: assertion "gfs_glock_is_locked_by_me(gl) && gfs_glock_is_held_excl(gl)" failed GFS: fsid=nate:nate0.1: function = gfs_trans_add_gl GFS: fsid=nate:nate0.1: file = /builddir/build/BUILD/gfs-kmod-0.1.34/_kmod_build_/src/gfs/trans.c, line = 234 GFS: fsid=nate:nate0.1: time = 1400873905 GFS: fsid=nate:nate0.1: about to withdraw from the cluster ----------- [cut here ] --------- [please bite here ] --------- Kernel BUG at ...ld/BUILD/gfs-kmod-0.1.34/_kmod_build_/src/gfs/lm.c:112 invalid opcode: 0000 [1] SMP last sysfs file: /fs/gfs/nate:nate0/lock_module/recover_done CPU 0 Modules linked in: gfs(U) dm_log_clustered(U) lock_nolock lock_dlm gfs2 dlm gnbd(U) configfs lpfc scsi_transport_fc sg be2iscsi ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr iscsi_tcp bnx2i cnic cxgb3i iptable_filter ip_tables x_tables sctp autofs4 hidp rfcomm l2cap bluetooth lockd sunrpc ipv6 xfrm_nalgo crypto_api uio libcxgbi floppy i2c_piix4 i2c_core pcspkr virtio_balloon virtio_net serio_raw tpm_tis tpm tpm_bios dm_raid45 dm_message dm_region_hash dm_mem_cache dm_snapshot dm_zero dm_mirror dm_log dm_mod ahci ata_piix libata sd_mod scsi_mod virtio_blk virtio_pci virtio_ring virtio ext3 jbd uhci_hcd ohci_hcd ehci_hcd Pid: 30450, comm: python Tainted: G -------------------- 2.6.18-389.el5 #1 RIP: 0010:[<ffffffff8882f06f>] [<ffffffff8882f06f>] :gfs:gfs_lm_withdraw+0x97/0x103 RSP: 0018:ffff810030e65b88 EFLAGS: 00010202 RAX: 000000000000003e RBX: ffffc200001ce000 RCX: 0000000000000286 RDX: 00000000ffffffff RSI: 0000000000000000 RDI: ffffffff803270dc RBP: ffffc200002069d4 R08: 000000000000000d R09: 00000000ffffffff R10: 0000000000000000 R11: 000000000000000a R12: ffff81003b31fdc8 R13: ffffc200001ce000 R14: 0000000000000001 R15: ffff810030e65e98 FS: 00002b4a72e94170(0000) GS:ffffffff80436000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 00000000152c3000 CR3: 0000000037549000 CR4: 00000000000006e0 Process python (pid: 30450, threadinfo ffff810030e64000, task ffff810039f657b0) Stack: 0000003000000030 ffff810030e65ca0 ffff810030e65ba8 ffff810030e65c38 0000000300000000 ffffc20000206870 ffffc200002069d4 ffffffff8884e6f0 ffffc200002069d4 ffffffff88848c60 ffff810030e65cb8 000000000001725f Call Trace: [<ffffffff8002621e>] find_or_create_page+0x22/0x72 [<ffffffff8881b753>] :gfs:getbuf+0x172/0x181 [<ffffffff8881ba54>] :gfs:gfs_dreread+0x72/0xc6 [<ffffffff8884725c>] :gfs:gfs_assert_withdraw_i+0x30/0x3c [<ffffffff88845e10>] :gfs:gfs_trans_add_gl+0x82/0xbe [<ffffffff88845ef3>] :gfs:gfs_trans_add_bh+0xa7/0xd9 [<ffffffff8883d8ba>] :gfs:gfs_write_inode+0x10c/0x166 [<ffffffff80063117>] wait_for_completion+0x1f/0xa2 [<ffffffff8002ff43>] __writeback_single_inode+0x1dd/0x31c [<ffffffff88825d51>] :gfs:gfs_glock_nq+0x3aa/0x3ea [<ffffffff800f8ee8>] sync_inode+0x24/0x33 [<ffffffff88839f32>] :gfs:gfs_fsync+0x88/0xba [<ffffffff8005afe4>] do_writepages+0x29/0x2f [<ffffffff8005055a>] do_fsync+0x52/0xa4 [<ffffffff800d468e>] sys_msync+0xff/0x180 [<ffffffff8005d29e>] tracesys+0xd5/0xdf Code: 0f 0b 68 3b ad 84 88 c2 70 00 eb fe 48 89 ee 48 c7 c7 7b ad RIP [<ffffffff8882f06f>] :gfs:gfs_lm_withdraw+0x97/0x103 RSP <ffff810030e65b88> <0>Kernel panic - not syncing: Fatal exception Created attachment 900627 [details] New version to fix the QA issues. This patch is similar to my earlier version, but includes more checks in gfs_write_inode to make sure that it can start a transaction. It now makes sure that there isn't already a transaction in progress, and that if it already has a lock, that the lock is exclusive. I also noticed that the original fix itself doesn't always work. The issue is that after the last holder of the inode glock is dropped, the vfs inode timestamps are overwritten by the gfs inode ones. During mmap, the mtime is getting updated in the vfs inode during the page fault. If either a call to stat the inode or a call to write out the vfs inode doesn't attempt to lock it while the mmap call is still holding its glock, the updated vfs timestamp will get overwritten, and be lost. To solve this, I've changed gfs_inode_attr_in() to not overwrite the vfs timestamps unless the gfs ones are newer. The timestamps still always get synced to the gfs inode when the vfs inode is first created. I have verified that it is still possible to manually reset the inode mtime to an earlier time using the touch command, and I can't think of any other possible issue with doing this. However, I'll bug Steve about this tomorrow to see if he can think of any problem with it. Applied the above patch. Created attachment 902772 [details] Yet another version. This one should do no harm, but it does much less good. The problem with my previous patches is that they do incorrect lock ordering. In RHEL5 gfs, the inode glock must be grabbed before inode is locked (it's opposite in RHEL5 gfs2), and __sync_single_inode() locks the inode before it calls gfs_write_inode(). This means that gfs_write_inode() can't lock the inode glock. Some times __sync_single_inode() is called when the process already has locked the inode glock exclusively. In these cases gfs_write_inode is able to write out the inode. Unfortunately, limiting gfs_write_inode() to only writing out the inode structure when it's called with the inode glock already held doesn't get the mtime updated when munmap is called, or an mmaped file is closed. The only condition that will trigger the mtime getting updated on disk is when the msync is called on the mmapped area with the MS_SYNC flag. Right now, I can't see a way to do better than this. For this to work, we'd need to be able to write out the inode in a transaction from some other gfs function that was getting called at least as often as whenever you msync or munmap and mmaped area, which hasn't already locked the inode. I don't see any function that would work for this. It's possible that this is the best we can do in gfs. Above patch applied. This will only fix the issue when msync is called with MS_SYNC. I can confirm that mtime is updated on disk (and visible on other nodes) after msync is called. Otherwise, mtime is not updated when munmap is called, the file is closed, or fsfreeze is invoked. Used: kmod-gfs-0.1.34-22.el5 Move to VERIFIED after TPS runs are.
https://partner-bugzilla.redhat.com/show_bug.cgi?id=1066181
CC-MAIN-2020-10
en
refinedweb
This python module provides asynchroneous console input. Project description jk_trioinput Introduction This python module ... Information about this module can be found here: Why this module? ... Limitations of this module ... How to use this module Import this module Please include this module into your application using the following code: import jk_trioinput ... 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/jk-trioinput/
CC-MAIN-2020-10
en
refinedweb
Cancelled Convert a js script file to Node module -- Budget €8-30 EUR this is a simple project to test you before you get invited to the Team, once you have this task done successfully we will send you bigger projects 1- Download any simple react project from github/gitlab 2- download this script from website= [login to view URL] 3- What I Want : import artQRCode from "./artQRCode...." <artQRCode text= "test" width="300" hight="{}" link="{}" .../> once you have a screen shoot of this working I will Pay :) good luck 2 freelancers are bidding on average €15 for this job arthurwolf €10 EUR in 7 days (0 Reviews) 0.0
https://www.freelancer.com.au/projects/javascript/convert-script-file-node-module/
CC-MAIN-2020-10
en
refinedweb
Python 3 examples for all of the things I listed in my previous article. There are variations on much of this syntax, but so long as you know one way, you'll be fine. I tried to find the Pythonic way in most cases. You can use this as a cheat sheet. Basics # Create a list mylist = [] Add an element to the front or backLocation Based Operations mylist.append( "abc" )Pop element off front or back mylist.insert( 0, "def" ) end = mylist.pop()Forward iterate over elements start = mylist.pop( 0 ) for item in mylist:Get the length of list print( item ) len( mylist )Test if empty if not mylist: print( "list is empty" ) # Get item at locationSorting and searching mylist[2] Insert an item at location mylist.insert( 3, "abc" )Remove an item from location del mylist[2]Replace/Assign item at location mylist[1] = "def" # Find an itemSegment Manipulation if item in mylist: index = mylist.index(item) Using indexand error handling try:Using index = mylist.index( 'abc' ) except ValueError: index = None nextand filtering next((x for x in mylist if x == 'ghif'), None)Find and remove an item if item in mylist:with error handling mylist.remove( item ) try:Find last matching item Index of found item, or None mylist.remove( item ) except ValueError: pass next( (index for index in reversed( range( len( mylist ) ) ) if mylist[index] == item), None)Alternately, reverse list and use "Find an item", but that copies the list revlist = mylist[::-1]Sort by natural order in-place sort if item in revlist: index = revlist.index( item ) mylist.sort()Sort with custom comparator mylist = [ ('a', 10), ('b', 7), ('c',13), ('d',1) ]sort by a key (sub-element mylist.sort( key = lambda item: item[1] )custom comparator def compare_fn( a, b ): return some_cond( a, b ) mylist.sort( key = functools.cmp_to_key( compare_fn ) ) # Split the list at arbitrary locationMore Iteration tail_of_list = mylist[2:] head_of_list = mylist[:2] Multiple splits based on a match mylist = ['a', 'b', 'c', 'd', 'b', 'e']Clear the list [list(y) for x, y in itertools.groupby( mylist, lambda z: z == 'b') if not x] mylist.clear()Remove segment delete from position 1 up to, but excluding position 3 del mylist[1:3]Concatenate lists mylist + other_listInsert list at location list slicing replaces the segment of list with another one, here we replace a zero-length slice mylist[1:1] = other_listGet a sublist sublist starting at position 1 up to, but excluding, position 3 mylist[1:3] # BackwardCreation for item in reversed( mylist ): print( item ) Partial segment iteration using itertools.islice avoids copying the list (which is what would happen if you used a slice) for item in itertools.islice( mylist, 1, 4 ):Skipping elements step from element 1 to 6 (exclusive) by 2 print( item ) for item in itertools.islice( mylist, 1, 6, 2 ): print( item ) # Create from a static list of itemsData Manipulation mylist = [ 'abc', 'def', 'ghi'] Create a range of numbers a list of numbers from 10..20 (exclusive) numbers = list( range( 10, 20 ) ) # MappingAdvanced [number * 10 for number in numbers] Filtering [number for number in numbers if number % 2 == 0]Fold / Reduce Summing up numbers using builtin add functools.reduce( operator.add, numbers )Joining string representations of items functools.reduce( lambda left,right: str( left ) + '/' + str( right ), mylist )Zip the zip function produces a list of tuples zip( lista, listb )to alternate items into one list use reduce functools.reduce( operator.add, zip( lista, listb ) ) # Swap elements at two locations mylist[3], mylist[5] = mylist[5], mylist[3] Reserve capacity Python lists do not expose capacity Replace content in a list mylist[:] = other_listCompare two lists lista == listbSearch a sorted list bisect_left/bisect_right work with sorted lists, find an item ndx using bisect_left, finds the left-most item ndx = bisect_left( numbers, 4 )Iterators Manually stepping through an iterator if ndx != len(numbers) and numbers[ndx] == 4 print( "Found at {}".format(ndx) ) myiter = iter( mylist )Multiple iterators at the same time while True: try: n = next( myiter ) print(n) except StopIteration: break itera = iter( lista ) iterb = iter( listb ) while True: try: a = next( itera ) b = next( iterb ) print( a, b ) except StopIteration: break Do you want to learn more ways to become a great programmer? Read my book What is Programming?. I look at the People, the reason software exists, the code at the heart of that software, and you, the person behind the keyboard. Originally published by edA‑qa mort‑ora‑y at dev.to ☞ Complete Python Bootcamp: Go from zero to hero in Python 3 ☞ Python and Django Full Stack Web Developer Bootcamp ☞ Learn Python Programming Masterclass ☞ Learn Python3 Programming ☞ TkInter Masterclass: Create Python GUI with TkInter! ☞ Python For Beginners: Learn Python With Hands-On Examples ☞ Python - Learn the coolest way ☞ Learn Python Programming: Step-by-Step Tutorial ☞ The Python Mega Course: Build 10 Real World Applications ☞ The Python Bible™ | Everything You Need to Program in Python
https://morioh.com/p/200974f6ccec/essential-python-3-code-for-lists
CC-MAIN-2020-10
en
refinedweb
An unofficial WhatsApp automation library Project description Supbot2 Simplest WhatsApp automation Library for Python Supbot2 is an unofficial WhatsApp automation library written in Python which can be used to create bots. Supbot2 uses Appium to automate WhatsApp application on your android device/emulator, and perform various actions (like sending message), and also trigger events (like receiving message). - Learn how to install, visit Supbot2 Documentation - Chat with us on Discord Usage Following code resends the message received from a contact (in just 5 LOC!). from supbot import Supbot def repeat_message(contact_name, message): supbot.send_message(contact_name, message) with Supbot(message_received=repeat_message) as supbot: supbot.wait_for_finish() Project details Release history Release notifications Download files Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
https://pypi.org/project/supbot/
CC-MAIN-2020-10
en
refinedweb
The aim is that your contribution is automatically picked up by the infrastructure, such that your view is added to the view menu, as shown in the picture on the right. To make this happen, you will have to:The aim is that your contribution is automatically picked up by the infrastructure, such that your view is added to the view menu, as shown in the picture on the right. To make this happen, you will have to: The View (Java 6) implementation for HIPE 11 or older and JComponent (Java 7)implementation for HIPE 11 or older and JComponent (Java 7) for HIPE 12 or newer.for HIPE 12 or newer. - Register your implementation to the Extension Registry in the init.py file of your sub-system. - The implementation must be an extension of a swing component - The implementation requires a default, but light-weight constructor. Actual construction of a popup menu, a view menu, or a tool bar or contributions to the main tool bar or main menu (or combinations of them) should be done in the init(ViewPart part)method. - In principle only one instance of a view should exist. - The ID returned by your implementation must be unique Implementationpublic class MyView extends SomeSwingComponent implements Viewable { private ViewPart _part; // Viewable implementation public MyView() {} public void dispose() {} public Icon getIcon() { return getPart().getIcon(); } public String getId() { return getPart().getId(); } public String getTitle() { return getPart().getTitle(); } public void init(ViewPart part) { _part = part; makeActions(); } public ViewPart getPart() { return _part; } private void makeActions() { // create tool bars, menus and other stuff } } RegistryThe following snippet registers the above view within your package's init.py:REGISTRY.register(VIEWABLE, Extension( "site.view.myview", "resides.in.java.package.MyView", "My View", "resides/in/java/package/myview.gif"))See also the Extension Registry documentation for more details. Triggering eventsYour viewable may want to trigger site events which might be interesting to other views. The ViewPart interface that is passed on through the initmethod gives you the means of triggering site events:private void someMethod() { : getPart().getEventHandler().trigger(aSiteEvent) : } Receiving eventsYour viewable may want to listen to site events produced by other views. For that you have to implement the SiteEventListener interface and inform the event handler that you are interested in one or more event types, for instance:public class MyView extends SomeSwingComponent implements Viewable, SiteEventListener { public void init(ViewPart part) { : part.getEventHandler().addEventListener(SelectionEvent.class, this); : } public void selectionChanged(SiteEvent event) { // we *know* that we only receive a SelectionEvent, so: SelectionEvent selection = (SelectionEvent)event; : } }
http://herschel.esac.esa.int/twiki/bin/view/Public/DpHipeViews?rev=19
CC-MAIN-2020-10
en
refinedweb
How to know what to #include for a given function ? I am using opencv 2.4.13 and I want to use SLIC I googled OpenCV SLIC and I get to this page... Now it tells me I need to #include "slic.hpp" but I cant find it in my OpenCV folder. How do I find out where slic.hpp is located ? The website doesn't tell me anything. If I google stereocalibrate, I get this... but again Im not sure what folder to include . Is there a webpage / guide that tells me what folder I need to include if I want to use a specific function ?
https://answers.opencv.org/question/99915/how-to-know-what-to-include-for-a-given-function/?answer=99916
CC-MAIN-2020-10
en
refinedweb
I am trying to get a small sample working using the new NSCollectionView 10.11 API trying to use the flow layout, I have views loaded and content appeared to filled in but they appear on the top of each other and have no clue to why ? All Views have the position of 0,0 however the scrollview appears to be correct and when changing size the values change as if they were off the page ? Any thoughts to where I am going wrong ? SampleProject Attached ` public sealed class DateControllerScroller : NSScrollView { public DateControllerScroller (RectangleF aFrame): base(aFrame) { this.HasVerticalScroller = true; this.HasHorizontalScroller = true; this.AutoresizingMask = NSViewResizingMask.WidthSizable | NSViewResizingMask.HeightSizable; this.AutoresizesSubviews = true; NSCollectionView m_aCollectionView = new NSCollectionView (); m_aCollectionView.Frame = aFrame; m_aCollectionView.DataSource = new DateControllerCollectionViewSource(); m_aCollectionView.CollectionViewLayout = new NSCollectionViewFlowLayout() { ItemSize = new SizeF(200,200), MinimumLineSpacing = 10, MinimumInteritemSpacing =10, ScrollDirection = NSCollectionViewScrollDirection.Vertical }; this.DocumentView = m_aCollectionView; } } public class DateControllerCollectionViewSource : NSCollectionViewDataSource { NSObject[] SampleValues = new NSObject[] { new NSString("Item 1"), new NSString("Item 2"), new NSString("Item 3"), new NSString("Item 4"), new NSString("Item 5"), new NSString("Item 6") }; public override NSCollectionViewItem GetItem(NSCollectionView collectionView, NSIndexPath indexPath) { return new CollectionViewItem() { RepresentedObject = SampleValues[indexPath.Item] }; } public override int GetNumberofItems(NSCollectionView collectionView, int section) { return SampleValues.Length; } public override int GetNumberOfSections(NSCollectionView collectionView) { return 1; } } public class CollectionViewItem : NSCollectionViewItem { public CollectionViewItem () : base () { this.View = new DateView( new RectangleF(0,0,200, 200)); } public override NSObject RepresentedObject { get {return base.RepresentedObject; } set { if (value != null) { base.RepresentedObject = value; NSString aString = value as NSString; if (aString == null) { return; } ((DateView)this.View).Title = aString.ToString(); } } } public override bool Selected { get { return base.Selected; } set { base.Selected = value; ((DateView)this.View).Selected = value; } } } `! Answers I'm not sure if you've seen the documentation we have on NSCollectionView: though it does everything in bindings. I did a bit of poking around. You can often debug layout issues by setting something like this in every view in question: I believe the problem is that you are overwriting the View in NSCollectionViewItem. From reading the documentation (), if you want to do everything in code, I believe you need to set the ItemPrototype if you want to have a custom view in your collection.! Thanks @SteveParker for the info. @ChrisHamons In the new API ItemPrototype is pretty much replaced by NSCollectionViewDataSource so you can have different types of NSCollectionViewItems I will get a small sample together and post back here All, I'm in the process of updating all of the Xamarin.Mac documentation (and its related samples) to use storyboards. Collection Views and Data Binding is next on the list so I hope to have it ready soon. Hi, has there been any progress? I see the Mac guide still refers to the old data binding method. I came across this article because I am attempting to use the new 10.11 NSCollectionViewDataSource technique, and I'm getting the same result as @DavidLilly. Hi @AdamLangley.8922, I've been working on a new guide but have been pulled off onto other tasks and haven't had a chance to finish it yet. Sorry this has taken so long. If you don't mind doing a bit of transcoding yourself, I found this excellent post on the topic: Collection Views in OS X Tutorial.
https://forums.xamarin.com/discussion/comment/170149/
CC-MAIN-2020-10
en
refinedweb
Pandas to_html() truncates string contents I have a Python Pandas DataFrame object containing textual data. My problem is, that when I use to_html() function, it truncates the strings in the output. For example: import pandas df = pandas.DataFrame({'text': ['Lorem ipsum dolor sit amet, consectetur adipiscing elit.']}) print (df.to_html()) The output is truncated at adapis... <table border="1" class="dataframe"> <thead> <tr style="text-align: right;"> <th></th> <th>text</th> </tr> </thead> <tbody> <tr> <th>0</th> <td> Lorem ipsum dolor sit amet, consectetur adipis...</td> </tr> </tbody> </table> There is a related question on SO, but it uses placeholders and search/replace functionality to postprocess the HTML, which I would like to avoid: Is there a simpler solution to this problem? I could not find anything related from the documentation. What you are seeing is pandas truncating the output for display purposes only. The default max_colwidth value is 50 which is what you are seeing. You can set this value to whatever you desire or you can set it to -1 which effectively turns this off: pd.set_option('display.max_colwidth', -1) Although I would advise against this, it would be better to set it to something that can be displayed easily in your console or ipython. A list of the options can be found here: From: stackoverflow.com/q/26277757
https://python-decompiler.com/article/2014-10/pandas-to-html-truncates-string-contents
CC-MAIN-2020-10
en
refinedweb
Handling Cookies Selenium: In this tutorial, we are going to learn about how we can handle the web page cookies using selenium webdriver. Before start learning about cookies let us understand what is cookies and how we can store the information in cookies and how we can also retry the value from cookies. Let us start with what is HTTP cookie? Introduction to Cookies When you are visiting any ecommerce website and if you added something in the cart but if you have not bought that product then when we re-login that product again show in your browser. This is possible because of the HTTP cookie which is present in the browser. Let us understand what is HTTP cookie and how it works? What is HTTP Cookie? It is a text file which is present in the web browser of the client machine or pc which is used to store the information about the user and their preferences as a key-value pair when a user does the browsing. When a user revisits a website again, that time the browser sends the stored cookies to the server and it notifies to the server about the past activities of the user. Why Handling Cookies in Selenium Automation? Every cookie is associated with the name, value, domain, path, expiry, and status which send to the server by which it validates that it is secure or not. also, this information helps the server to validate the client using the cookies. But when we are testing a web application at that time we may need to update, create or delete the existing cookies. Read Also: Selenium WebDriver Tutorials Suppose you are testing an E-commerce website so in that application there are so many features like view products, place an order, view cart and payment information like there are so many features are available. So if the cookies are not stored then when a user changes from one scenario to other scenarios every time he needs to login which is effective to the user experience. So when user login for the first time all the information will be stored as a cookie in a file. If the user revisits the web site again then it retrieve all the information from the cookies and add those information to the current browser session so that it will not ask the login steps because all the login information are available so that the server authenticated with that information and directly takes you to the requested page instead of the login page. Query for Handle Cookies Using Selenium To deal with the cookies selenium provides some of the predefined method with the help of those methods we can easily perform various operation as per our requirement. those method are below getCookies(); This method is used to get all the cookies which are stored in the web browser. manage().getCookies(); //To fetch a Cookie by name System.out.println(driver.manage().getCookieNamed(cookieName).getValue()); //To return all the cookies of the current domain Set<Cookie> cookiesForCurrentURL = driver.manage().getCookies(); for (Cookie cookie : cookiesForCurrentURL) { System.out.println(” Cookie Name – ” + cookie.getName() + ” Cookie Value – ” + cookie.getValue())); } getCookieNamed(): We can use this method to retrive a specific cookie according to its name. manage().getCookieNamed(arg0); addCookie(): You can use this method to create and add the cookie in the cookie file. manage().addCookie(arg0) Cookie cookie = new Cookie(“cookieName”, “cookieValue”); driver.manage().addCookie(cookie); deleteCookie():when we want to delete all the cookies then you can use this method. manage().deleteAllCookies(); Lets take an example for better understand in step by steps - Login into the application and store the information in a cookies file - Use the stored cookies and use those information to login into the application Login into the application and store the information in a cookies file: In this step we are try to load the web page and enter the crential for login and check the remember me box so that t will store the login credentials and finally will click on submit button. Example From Software Testing Class Use the stored cookies and use that information to login into the application In this step, we are going to use the cookie file which we have stored the login credentials of our last browser session. In this step, we are going to retrieve all the required information and after we are going to create a cookie and add those retrieved details in that cookie with the help of addCookie() and load the same url and verify is it login successfully or not. How to Delete Cookies Using Java Selenium With Program? package com.selenium.mix; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class deletecookies { public static void main(String[] args) { WebDriver driver=new FirefoxDriver(); driver= new FirefoxDriver(); String URL=""; driver.navigate().to(URL); driver.manage().deleteAllCookies(); System.out.println("Cookies Deleted"); } } Read Also: Verify DropDown Values Sorting Order Using Selenium Example Program
https://www.softwaretestingo.com/handling-cookies-selenium/
CC-MAIN-2020-10
en
refinedweb
CSGraph stands for Compressed Sparse Graph, which focuses on Fast graph algorithms based on sparse matrix representations. To begin with, let us understand what a sparse graph is and how it helps in graph representations. A graph is just a collection of nodes, which have links between them. Graphs can represent nearly anything − social network connections, where each node is a person and is connected to acquaintances; images, where each node is a pixel and is connected to neighbouring pixels; points in a high-dimensional distribution, where each node is connected to its nearest neighbours and practically anything else you can imagine. One very efficient way to represent graph data is in a sparse matrix: let us call it G. The matrix G is of size N x N, and G[i, j] gives the value of the connection between node ‘i' and node ‘j’. A sparse graph contains mostly zeros − that is, most nodes have only a few connections. This property turns out to be true in most cases of interest. The creation of the sparse graph submodule was motivated by several algorithms used in scikit-learn that included the following − Isomap − A manifold learning algorithm, which requires finding the shortest paths in a graph. Hierarchical clustering − A clustering algorithm based on a minimum spanning tree. Spectral Decomposition − A projection algorithm based on sparse graph laplacians. As a concrete example, imagine that we would like to represent the following undirected graph − This graph has three nodes, where node 0 and 1 are connected by an edge of weight 2, and nodes 0 and 2 are connected by an edge of weight 1. We can construct the dense, masked and sparse representations as shown in the following example,) print G_sparse.data The above program will generate the following output. array([2, 1, 2, 1]) This is identical to the previous graph, except nodes 0 and 2 are connected by an edge of zero weight. In this case, the dense representation above leads to ambiguities − how can non-edges be represented, if zero is a meaningful value. In this case, either a masked or a sparse representation must be used to eliminate the ambiguity. Let us consider the following example. from scipy.sparse.csgraph import csgraph_from_dense G2_data = np.array ([ [np.inf, 2, 0 ], [2, np.inf, np.inf], [0, np.inf, np.inf] ]) G2_sparse = csgraph_from_dense(G2_data, null_value=np.inf) print G2_sparse.data The above program will generate the following output. array([ 2., 0., 2., 0.])
https://www.tutorialspoint.com/python_data_science/python_graph_data.htm
CC-MAIN-2020-10
en
refinedweb
- Type: Bug - Status: Resolved (View Workflow) - Priority: Blocker - Resolution: Fixed - Component/s: script-security-plugin - Labels:None - Environment:Jenkins 2.60.2 .war on Ubuntu Script Security Plugin 1.31 Groovy Plugin 2.0 - Similar Issues: Steps to reproduce: Run Jenkins 2.60.2 with latest Script Security Plugin (1.31). Create a freestyle job that runs a system groovy script from a script file /tmp/minimal.groovy (!, bug does not appear if the script is defined in the job itself). Sample job config.xml is attached. Contents of /tmp/minimal.groovy : java.util.regex.Matcher m = "asdf" =~ /(a)/ Run the job. Observed result ERROR: Build step failed with exception org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified staticMethod org.kohsuke.groovy.sandbox.impl.Checker checkedStaticCall java.lang.Class java.lang.String java.lang.String java.lang.String at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onStaticCall(SandboxInterceptor.java:146) at org.kohsuke.groovy.sandbox.impl.Checker$2.call(Checker.java:184) at org.kohsuke.groovy.sandbox.impl.Checker.checkedStaticCall(Checker.java:188) at org.kohsuke.groovy.sandbox.impl.Checker$checkedStaticCall:222) at Script1.run(Script1.groovy:1) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.run(GroovySandbox.java:141) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:165)35) at hudson.model.Build$BuildExecution.build(Build.java:206) at hudson.model.Build$BuildExecution.doRun(Build.java:163):405) Expected result Script runs without error. Known mitigations Changing the script to: def m = "asdf" =~ /(a)/ That is, removing the explicit type declaration solves the problem. Also, copying the script into the job definition doesn't trigger the error. Priority Since the explicit type declaration is not idiomatic usage anyways and the workaround is simple, I don't think it's highly important but would like to understand why this fails in any case. - is duplicated by JENKINS-46195 Assignment from a method doesn't work in a closure - Closed - links to - - Unless someone (hint Jesse Glick) discovers a flaw in my reasoning, I'm pretty sure I've found the problem and have a fix for it. We are double-transforming cast expressions currently, resulting in us transforming the actual sandbox code itself! Ow. So, at (with associated follow-on test at), I fix that. Note that there's no groovy-cps or workflow-cps-plugin downstream PR/test - that's because SandboxTransformer from groovy-sandbox, where the problem is, is not used by CPS transformation. CPS code is sandboxed using groovy-cps's SandboxInvoker. groovy-cps does use SandboxTransformer for some purposes, so to be on the safe side you do need to have at least a downstream PR in workflow-cps verifying correct behavior in Pipeline. Code changed in jenkins User: Andrew Bayer Path: pom.xml src/test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/SandboxInterceptorTest.java Log: JENKINS-46088 Verify removal of double transform of cast expression Downstream of Code changed in jenkins User: Andrew Bayer Path: pom.xml src/test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/SandboxInterceptorTest.java Log: Merge pull request #139 from abayer/jenkins-46088 JENKINS-46088 Verify removal of double transform of cast expression Compare: I saw something along these lines yesterday, where a non-Pipeline sandboxed script was complaining about things like: So...somehow, the latest updates to groovy-sandbox and/or script-security are resulting in the sandbox code itself getting sandboxed. Which is...weird. More investigation is needed, but I think this is important.
https://issues.jenkins-ci.org/browse/JENKINS-46088?attachmentViewMode=list
CC-MAIN-2020-10
en
refinedweb
At this moment there are at least 6 json libraries for scala, not counting the java json libraries. All these libraries have a very similar AST. This project aims to provide a single AST to be used by other scala json libraries. At this moment the approach taken to working with the AST has been taken from lift-json and the native package is in fact lift-json but outside of the lift project. Lift JSONLift JSON This project also attempts to set lift-json free from the release schedule imposed by the lift framework. The Lift framework carries many dependencies and as such it's typically a blocker for many other scala projects when a new version of scala is released. So the native package in this library is in fact verbatim lift-json in a different package name; this means that your import statements will change if you use this library. import org.json4s._ import org.json4s.native.JsonMethods._ After that everything works exactly the same as it would with lift-json JacksonJackson In addition to the native parser there is also an implementation that uses jackson for parsing to the AST. The jackson module includes most of the jackson-module-scala functionality and the ability to use it with the lift-json AST. To use jackson instead of the native parser: import org.json4s._ import org.json4s.jackson.JsonMethods._ Be aware that the default behavior of the jackson integration is to close the stream when it's done. If you want to change that: import com.fasterxml.jackson.databind.SerializationFeature org.json4s.jackson.JsonMethods.mapper.configure(SerializationFeature.CLOSE_CLOSEABLE, false) GuideGuide Parsing and formatting utilities for JSON. A central concept in lift-json library is Json AST which models the structure of a JSON document as a syntax tree. sealed abstract class JValue case object JNothing extends JValue // 'zero' for JValue case object JNull extends JValue case class JString(s: String) extends JValue case class JDouble(num: Double) extends JValue case class JDecimal(num: BigDecimal) extends JValue case class JInt(num: BigInt) extends JValue case class JLong(num: Long) extends JValue case class JBool(value: Boolean) extends JValue case class JObject(obj: List[JField]) extends JValue case class JArray(arr: List[JValue]) extends JValue type JField = (String, JValue) All features are implemented in terms of the above AST. Functions are used to transform the AST itself, or to transform the AST between different formats. Common transformations are summarized in a following picture. Summary of the features: - Fast JSON parser - LINQ-style queries - Case classes can be used to extract values from parsed JSON - Diff & merge - DSL to produce valid JSON - XPath-like expressions and HOFs to manipulate JSON - Pretty and compact printing - XML conversions - Serialization - Low-level pull parser API InstallationInstallation You can add the json4s as a dependency in following ways. Note, replace {latestVersion} with correct Json4s version. You can find available versions here: SBT usersSBT users For the native support add the following dependency to your project description: val json4sNative = "org.json4s" %% "json4s-native" % "{latestVersion}" For the Jackson support add the following dependency to your project description: val json4sJackson = "org.json4s" %% "json4s-jackson" % "{latestVersion}" Maven usersMaven users For the native support add the following dependency to your pom: <dependency> <groupId>org.json4s</groupId> <artifactId>json4s-native_${scala.version}</artifactId> <version>{latestVersion}</version> </dependency> For the jackson support add the following dependency to your pom: <dependency> <groupId>org.json4s</groupId> <artifactId>json4s-jackson_${scala.version}</artifactId> <version>{latestVersion}</version> </dependency> ExtrasExtras Support for Enum, Joda-Time, ... Applicative style parsing with Scalaz Migration from older versionsMigration from older versions 3.3.0 ->3.3.0 -> json4s 3.3 basically should be source code compatible with 3.2.x. Since json4s 3.3.0, We've started using MiMa for binary compatibility verification not to repeat the bin compatibility issue described here. The behavior of .toOption on JValue has changed. Now both JNothing and JNull return None. For the old behavior you can use toSome which will only turn a JNothing into a None. All the merged pull requests: 3.0.0 ->3.0.0 -> JField is no longer a JValue. This means more type safety since it is no longer possible to create invalid JSON where JFields are added directly into JArrays for instance. The most noticeable consequence of this change are that map, transform, find and filter come in two versions: def map(f: JValue => JValue): JValue def mapField(f: JField => JField): JValue def transform(f: PartialFunction[JValue, JValue]): JValue def transformField(f: PartialFunction[JField, JField]): JValue def find(p: JValue => Boolean): Option[JValue] def findField(p: JField => Boolean): Option[JField] //... Use *Field functions to traverse fields in the JSON, and use the functions without 'Field' in the name to traverse values in the JSON. 2.2 ->2.2 -> Path expressions were changed after version 2.2. Previous versions returned JField, which unnecessarily complicated the use of the expressions. If you have used path expressions with pattern matching like: val JField("bar", JInt(x)) = json \ "foo" \ "bar" it is now required to change that to: val JInt(x) = json \ "foo" \ "bar" Parsing JSONParsing JSON Any valid json can be parsed into internal AST format. For native support: scala> import org.json4s._ scala> import org.json4s.native)))) For jackson support: scala> import org.json4s._ scala> import org.json4s.jackson)))) Producing JSONProducing JSON You can generate json in 2 modes: either in DoubleMode or in BigDecimalMode; the former will map all decimal values into JDoubles, and the latter into JDecimals. For the double mode dsl use: import org.json4s.JsonDSL._ // or import org.json4s.JsonDSL.WithDouble._ For the big decimal mode dsl use: import org.json4s.JsonDSL.WithBigDecimal._ DSL rulesDSL rules - Primitive types map to JSON primitives. - Any seq produces JSON array. scala> val json = List(1, 2, 3) scala> compact(render(json)) res0: String = [1,2,3] - Tuple2[String, A] produces field. scala> val json = ("name" -> "joe") scala> compact(render(json)) res1: String = {"name":"joe"} - ~ operator produces object by combining fields. scala> val json = ("name" -> "joe") ~ ("age" -> 35) scala> compact(render(json)) res2: String = {"name":"joe","age":35} - Any value can be optional. The field and value are completely removed when it doesn't have a value. scala> val json = ("name" -> "joe") ~ ("age" -> Some(35)) scala> compact(render(json)) res3: String = {"name":"joe","age":35} scala> val json = ("name" -> "joe") ~ ("age" -> (None: Option[Int])) scala> compact(render(json)) res4: String = {"name":"joe"} - Extending the dsl To extend the dsl with your own classes you must have an implicit conversion in scope of signature: type DslConversion = T => JValue ExampleExample object JsonExample extends App { import org.json4s._ import org.json4s.JsonDSL._ import org.json4s.jackson.JsonMethods._ case class Winner(id: Long, numbers: List[Int]) case class Lotto(id: Long, winningNumbers: List[Int], winners: List[Winner], drawDate: Option[java.util.Date]) val winners = List(Winner(23, List(2, 45, 34, 23, 3, 5)), Winner(54, List(52, 3, 12, 11, 18, 22))) val lotto = Lotto(5, List(2, 45, 34, 23, 7, 5, 3), winners, None) val json = ("lotto" -> ("lotto-id" -> lotto.id) ~ ("winning-numbers" -> lotto.winningNumbers) ~ ("draw-date" -> lotto.drawDate.map(_.toString)) ~ ("winners" -> lotto.winners.map { w => (("winner-id" -> w.id) ~ ("numbers" -> w.numbers))})) println(compact(render(json))) } scala> JsonExample {"lotto":{"lotto-id":5,"winning-numbers":[2,45,34,23,7,5,3],"winners": [{"winner-id":23,"numbers":[2,45,34,23,3,5]},{"winner-id":54,"numbers":[52,3,12,11,18,22]}]}} The above example produces the following pretty-printed JSON. Notice that draw-date field is not rendered since its value is None: scala> pretty(render(JsonExample.json)) { "lotto":{ "lotto-id":5, "winning-numbers":[2,45,34,23,7,5,3], "winners":[{ "winner-id":23, "numbers":[2,45,34,23,3,5] },{ "winner-id":54, "numbers":[52,3,12,11,18,22] }] } } Merging & DiffingMerging & Diffing Two JSONs can be merged and diffed with each other. Please see more examples in MergeExamples.scala and DiffExamples.scala. scala> import org.json4s._ scala> import org.json4s.jackson.JsonMethods._ scala> val lotto1 = parse("""{ "lotto":{ "lotto-id":5, "winning-numbers":[2,45,34,23,7,5,3], "winners":[{ "winner-id":23, "numbers":[2,45,34,23,3,5] }] } }""") scala> val lotto2 = parse("""{ "lotto":{ "winners":[{ "winner-id":54, "numbers":[52,3,12,11,18,22] }] } }""") scala> val mergedLotto = lotto1 merge lotto2 scala> pretty(render(mergedLotto)) res0: String = { "lotto":{ "lotto-id":5, "winning-numbers":[2,45,34,23,7,5,3], "winners":[{ "winner-id":23, "numbers":[2,45,34,23,3,5] },{ "winner-id":54, "numbers":[52,3,12,11,18,22] }] } } scala> val Diff(changed, added, deleted) = mergedLotto diff lotto1 changed: org.json4s.JsonAST.JValue = JNothing added: org.json4s.JsonAST.JValue = JNothing deleted: org.json4s.JsonAST.JValue = JObject(List((lotto,JObject(List(JField(winners, JArray(List(JObject(List((winner-id,JInt(54)), (numbers,JArray( List(JInt(52), JInt(3), JInt(12), JInt(11), JInt(18), JInt(22)))))))))))))) Querying JSONQuerying JSON "LINQ" style"LINQ" style JSON values can be extracted using for-comprehensions. Please see more examples in JsonQueryExamples.scala. scala> import org.json4s._ scala> import org.json4s.native.JsonMethods._ scala> val json = parse(""" { "name": "joe", "children": [ { "name": "Mary", "age": 5 }, { "name": "Mazy", "age": 3 } ] } """) scala> for { JObject(child) <- json JField("age", JInt(age)) <- child } yield age res0: List[BigInt] = List(5, 3) scala> for { JObject(child) <- json JField("name", JString(name)) <- child JField("age", JInt(age)) <- child if age > 4 } yield (name, age) res1: List[(String, BigInt)] = List((Mary,5)) XPath + HOFsXPath + HOFs The json AST can be queried using XPath-like functions. The following REPL session shows the usage of '\', '\\', 'find', 'filter', 'transform', 'remove' and 'values' functions. The example json is: { "person": { "name": "Joe", "age": 35, "spouse": { "person": { "name": "Marilyn", "age": 33 } } } } Translated to DSL syntax: scala> import org.json4s._ scala> import org.json4s.native.JsonMethods._ or scala> import org.json4s.jackson.JsonMethods._ scala> import org.json4s.JsonDSL._ scala> val json: JObject = ("person" -> ("name" -> "Joe") ~ ("age" -> 35) ~ ("spouse" -> ("person" -> ("name" -> "Marilyn") ~ ("age" -> 33) ) ) ) scala> json \\ "spouse" res0: org.json4s.JsonAST.JValue = JObject(List( (person,JObject(List((name,JString(Marilyn)), (age,JInt(33))))))) scala> compact(render(res0)) res1: String = {"person":{"name":"Marilyn","age":33}} scala> compact(render(json \\ "name")) res2: String = {"name":"Joe","name":"Marilyn"} scala> compact(render((json removeField { _ == JField("name", JString("Marilyn")) }) \\ "name")) res3: String = "Joe" scala> compact(render(json \ "person" \ "name")) res4: String = "Joe" scala> compact(render(json \ "person" \ "spouse" \ "person" \ "name")) res5: String = "Marilyn" scala> json findField { case JField("name", _) => true case _ => false } res6: Option[org.json4s.JsonAST.JValue] = Some((name,JString(Joe))) scala> json filterField { case JField("name", _) => true case _ => false } res7: List[org.json4s.JsonAST.JField] = List(JField(name,JString(Joe)), JField(name,JString(Marilyn))) scala> json transformField { case JField("name", JString(s)) => ("NAME", JString(s.toUpperCase)) } res8: org.json4s.JsonAST.JValue = JObject(List((person,JObject(List( (NAME,JString(JOE)), (age,JInt(35)), (spouse,JObject(List( (person,JObject(List((NAME,JString(MARILYN)), (age,JInt(33))))))))))))) scala> json.values res8: scala.collection.immutable.Map[String,Any] = Map(person -> Map(name -> Joe, age -> 35, spouse -> Map(person -> Map(name -> Marilyn, age -> 33)))) Indexed path expressions work too and values can be unboxed using type expressions: scala> val json = parse(""" { "name": "joe", "children": [ { "name": "Mary", "age": 5 }, { "name": "Mazy", "age": 3 } ] } """) scala> (json \ "children")(0) res0: org.json4s.JsonAST.JValue = JObject(List((name,JString(Mary)), (age,JInt(5)))) scala> (json \ "children")(1) \ "name" res1: org.json4s.JsonAST.JValue = JString(Mazy) scala> json \\ classOf[JInt] res2: List[org.json4s.JsonAST.JInt#Values] = List(5, 3) scala> json \ "children" \\ classOf[JString] res3: List[org.json4s.JsonAST.JString#Values] = List(Mary, Mazy) Extracting valuesExtracting values Case classes can be used to extract values from parsed JSON. Non-existent values can be extracted into scala.Option and strings can be automatically converted into java.util.Dates. Please see more examples in ExtractionExampleSpec.scala. scala> import org.json4s._ scala> import org.json4s.jackson.JsonMethods._ scala> implicit val formats = DefaultFormats // Brings in default date formats etc. } ] } """) scala> json.extract[Person] res0: Person = Person(joe,Address(Bulevard,Helsinki),List(Child(Mary,5,Some(Sat Sep 04 18:06:22 EEST 2004)), Child(Mazy,3,None))) scala> val addressJson = json \ "address" // Extract address object scala> addressJson.extract[Address] res1: Address = Address(Bulevard,Helsinki) scala> (json \ "children").extract[List[Child]] // Extract list of objects res2: List[Child] = List(Child(Mary,5,Some(Sat Sep 04 23:36:22 IST 2004)), Child(Mazy,3,None)) By default the constructor parameter names must match json field names. However, sometimes json field names contain characters which are not allowed characters in Scala identifiers. There are two solutions for this. (See LottoExample.scala for a bigger example.) Use back ticks: scala> case class Person(`first-name`: String) Use transform function to postprocess AST: scala> case class Person(firstname: String) scala> json transformField { case ("first-name", x) => ("firstname", x) } If the json field names are snake case (i.e., separated_by_underscores), but the case class uses camel case (i.e., firstLetterLowercaseAndNextWordsCapitalized), you can convert the keys during the extraction using camelizeKeys: scala> import org.json4s._ scala> import org.json4s.native.JsonMethods._ scala> implicit val formats = DefaultFormats scala> val json = parse("""{"first_name":"Mary"}""") scala> case class Person(firstName: String) scala> json.camelizeKeys.extract[Person] res0: Person = Person(Mary) See the "Serialization" section below for details on converting a class with camel-case fields into json with snake case keys. The extraction function tries to find the best-matching constructor when the case class has auxiliary constructors. For instance, extracting from JSON {"price":350} into the following case class will use the auxiliary constructor instead of the primary constructor: scala> case class Bike(make: String, price: Int) { def this(price: Int) = this("Trek", price) } scala> parse(""" {"price":350} """).extract[Bike] res0: Bike = Bike(Trek,350) Primitive values can be extracted from JSON primitives or fields: scala> (json \ "name").extract[String] res0: String = "joe" scala> ((json \ "children")(0) \ "birthdate").extract[Date] res1: java.util.Date = Sat Sep 04 21:06:22 EEST 2004 DateFormat can be changed by overriding 'DefaultFormats' (or by implementing trait 'Formats'): scala> implicit val formats = new DefaultFormats { override def dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") } A JSON object can be extracted to Map[String, _] too. Each field becomes a key value pair in result Map: scala> val json = parse(""" { "name": "joe", "addresses": { "address1": { "street": "Bulevard", "city": "Helsinki" }, "address2": { "street": "Soho", "city": "London" } } }""") scala> case class PersonWithAddresses(name: String, addresses: Map[String, Address]) scala> json.extract[PersonWithAddresses] res0: PersonWithAddresses("joe", Map("address1" -> Address("Bulevard", "Helsinki"), "address2" -> Address("Soho", "London"))) Note that when the extraction of an Option[_] fails, the default behavior of extract is to return None. You can make it fail with a [MappingException] by using a custom Formats object: val formats: Formats = DefaultFormats.withStrictOptionParsing or val formats: Formats = new DefaultFormats { override val strictOptionParsing: Boolean = true } Same happens with collections, the default behavior of extract is to return an empty instance of the collection. You can make it fail with a [MappingException] by using a custom Formats object: val formats: Formats = DefaultFormats.withStrictArrayExtraction or val formats: Formats = new DefaultFormats { override val strictArrayExtraction: Boolean = true } Both these settings ( strictOptionParsing and strictArrayExtraction) can be enabled with val formats: Formats = DefaultFormats.strict SerializationSerialization Case classes can be serialized and deserialized. Please see other examples in SerializationExamples.scala. scala> import org.json4s._ scala> import org.json4s.native.Serialization scala> import org.json4s.native.Serialization.{read, write} scala> implicit val formats = Serialization.formats(NoTypeHints) scala> val ser = write(Child("Mary", 5, None)) scala> read[Child](ser) res1: Child = Child(Mary,5,None) If you're using jackson instead of the native one: scala> import org.json4s._ scala> import org.json4s.jackson.Serialization scala> import org.json4s.jackson.Serialization.{read, write} scala> implicit val formats = Serialization.formats(NoTypeHints) scala> val ser = write(Child("Mary", 5, None)) scala> read[Child](ser) res1: Child = Child(Mary,5,None) Serialization supports: - Arbitrarily deep case-class graphs - All primitive types, including BigInt and Symbol - List, Seq, Array, Set and Map (note, keys of the Map must be strings: Map[String, _]) - scala.Option - java.util.Date - Polymorphic Lists (see below) - Recursive types - Serialization of fields of a class (see below) - Custom serializer functions for types that are not supported (see below) If the class contains camel-case fields (i.e: firstLetterLowercaseAndNextWordsCapitalized) but you want to produce a json string with snake casing (i.e., separated_by_underscores), you can use the snakizeKeys method: scala> val ser = write(Person("Mary")) ser: String = {"firstName":"Mary"} scala> compact(render(parse(ser).snakizeKeys)) res0: String = {"first_name":"Mary"} Serializing polymorphic ListsSerializing polymorphic Lists Type hints are required when serializing polymorphic (or heterogeneous) Lists. Serialized JSON objects will get an extra field named 'jsonClass' (the name can be changed by overriding 'typeHintFieldName' from Formats). scala> trait Animal scala> case class Dog(name: String) extends Animal scala> case class Fish(weight: Double) extends Animal scala> case class Animals(animals: List[Animal]) scala> implicit val formats = Serialization.formats(ShortTypeHints(List(classOf[Dog], classOf[Fish]))) scala> val ser = write(Animals(Dog("pluto") :: Fish(1.2) :: Nil)) ser: String = {"animals":[{"jsonClass":"Dog","name":"pluto"},{"jsonClass":"Fish","weight":1.2}]} scala> read[Animals](ser) res0: Animals = Animals(List(Dog(pluto), Fish(1.2))) ShortTypeHints outputs the short classname for all instances of configured objects. FullTypeHints outputs the full classname. Other strategies can be implemented by extending the TypeHints trait. Serializing fields of a classSerializing fields of a class To enable serialization of fields, a single FieldSerializer can be added for each type: implicit val formats = DefaultFormats + FieldSerializer[WildDog]() Now the type WildDog (and all subtypes) gets serialized with all its fields (+ constructor parameters). FieldSerializer takes two optional parameters, which can be used to intercept the field serialization: case class FieldSerializer[A: Manifest]( serializer: PartialFunction[(String, Any), Option[(String, Any)]] = Map(), deserializer: PartialFunction[JField, JField] = Map() ) Those PartialFunctions are called just before a field is serialized or deserialized. Some useful PFs to rename and ignore fields are provided: val dogSerializer = FieldSerializer[WildDog]( renameTo("name", "animalname") orElse ignore("owner"), renameFrom("animalname", "name")) implicit val formats = DefaultFormats + dogSerializer Support for renaming multiple fields is accomplished by chaining the PFs like so: (do not add more than one FieldSerializer per type) {"id": "a244", "start-time": 12314545, "end-time": -1} case class Log(id: String, startTime: Long, endTime: Long) val logSerializer = FieldSerializer[Log]( renameTo("startTime", "start-time") orElse renameTo("endTime", "end-time"), renameFrom("start-time", "startTime") orElse renameFrom("end-time", "endTime")) implicit val formats = DefaultFormats + logSerializer Serializing classes defined in traits or classesSerializing classes defined in traits or classes We've added support for case classes defined in a trait. But they do need custom formats. I'll explain why and then how. Why?Why? For classes defined in a trait it's a bit difficult to get to their companion object, which is needed to provide default values. We could punt on those but that brings us to the next problem, that the compiler generates an extra field in the constructor of such case classes. The first field in the constructor of those case classes is called $outer and is of type of the defining trait. So somehow we need to get an instance of that object, naively we could scan all classes and collect the ones that are implementing the trait, but when there are more than one: which one to take? How?How? I've chosen to extend the formats to include a list of companion mappings for those case classes. So you can have formats that belong to your modules and keep the mappings in there. That will then make default values work and provide the much needed $outer field. trait SharedModule { case class SharedObj(name: String, visible: Boolean = false) } object PingPongGame extends SharedModule implicit val formats: Formats = DefaultFormats.withCompanions(classOf[PingPongGame.SharedObj] -> PingPongGame) val inst = PingPongGame.SharedObj("jeff", visible = true) val extr = Extraction.decompose(inst) extr must_== JObject("name" -> JString("jeff"), "visible" -> JBool(true)) extr.extract[PingPongGame.SharedObj] must_== inst Serializing non-supported typesSerializing non-supported types It is possible to plug in custom serializer + deserializer functions for any type. Now, if we have a non-case class Interval (thus, not supported by default), we can still serialize it by providing following serializer. scala> class Interval(start: Long, end: Long) { val startTime = start val endTime = end } scala> class IntervalSerializer extends CustomSerializer[Interval](format => ( { case JObject(JField("start", JInt(s)) :: JField("end", JInt(e)) :: Nil) => new Interval(s.longValue, e.longValue) }, { case x: Interval => JObject(JField("start", JInt(BigInt(x.startTime))) :: JField("end", JInt(BigInt(x.endTime))) :: Nil) } )) scala> implicit val formats = Serialization.formats(NoTypeHints) + new IntervalSerializer A custom serializer is created by providing two partial functions. The first evaluates to a value if it can unpack the data from JSON. The second creates the desired JSON if the type matches. ExtensionsExtensions Module json4s-ext contains extensions to extraction and serialization. The following types are supported. // Lift's box implicit val formats = org.json4s.DefaultFormats + new org.json4s.native.ext.JsonBoxSerializer // Scala enums implicit val formats = org.json4s.DefaultFormats + new org.json4s.ext.EnumSerializer(MyEnum) // or implicit val formats = org.json4s.DefaultFormats + new org.json4s.ext.EnumNameSerializer(MyEnum) // Joda Time implicit val formats = org.json4s.DefaultFormats ++ org.json4s.ext.JodaTimeSerializers.all XML supportXML support JSON structure can be converted to XML nodes and vice versa. Please see more examples in XmlExamples.scala. scala> import org.json4s.Xml.{toJson, toXml} scala> val xml = <users> <user> <id>1</id> <name>Harry</name> </user> <user> <id>2</id> <name>David</name> </user> </users> scala> val json = toJson(xml) scala> pretty(render(json)) res3: String = { "users":{ "user":[{ "id":"1", "name":"Harry" },{ "id":"2", "name":"David" }] } } Now, the above example has two problems. First, the ID is converted to String while we might want it as an Int. This is easy to fix by mapping JString(s) to JInt(s.toInt). The second problem is more subtle. The conversion function decides to use a JSON array because there's more than one user element in XML. Therefore a structurally equivalent XML document which happens to have just one user element will generate a JSON document without a JSON array. This is rarely a desired outcome. These both problems can be fixed by the following transformation function. scala> json transformField { case ("id", JString(s)) => ("id", JInt(s.toInt)) case ("user", x: JObject) => ("user", JArray(x :: Nil)) } Other direction is supported too. Converting JSON to XML: scala> toXml(json) res5: scala.xml.NodeSeq = NodeSeq(<users><user><id>1</id><name>Harry</name></user><user><id>2</id><name>David</name></user></users>) Low-level pull parser APILow-level pull parser API The pull parser API is provided for cases requiring extreme performance. It improves parsing performance in two ways. First, no intermediate AST is generated. Second, you can stop parsing at any time, skipping the rest of the stream. Note: This parsing style is recommended only as an optimization. The above-mentioned functional APIs are easier to use. Consider the following example, which shows how to parse one field value from a big JSON: scala> val json = """ { ... "firstName": "John", "lastName": "Smith", "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": 10021 }, "phoneNumbers": [ { "type": "home", "number": "212 555-1234" }, { "type": "fax", "number": "646 555-4567" } ], ... }""" scala> val parser = (p: Parser) => { def parse: BigInt = p.nextToken match { case FieldStart("postalCode") => p.nextToken match { case IntVal(code) => code case _ => p.fail("expected int") } case End => p.fail("no field named 'postalCode'") case _ => parse } parse } scala> val postalCode = parse(json, parser) postalCode: BigInt = 10021 The pull parser is a function Parser => A; in this example it is concretely Parser => BigInt. The constructed parser recursively reads tokens until it finds a FieldStart("postalCode") token. After that the next token must be IntVal; otherwise parsing fails. It returns the parsed integer value and stops parsing immediately. KudosKudos The original idea for the DSL syntax was taken from the Lift mailing list (by Marius). The idea for the AST and rendering was taken from Real World Haskell book.
https://index.scala-lang.org/json4s/json4s/json4s-scalaz/3.5.3?target=_2.11
CC-MAIN-2020-10
en
refinedweb
OSI Turns Down 4 Licenses; Approves Python Foundation's 154 Russ Nelson writes "The Open Source Initiative turned down four licenses this week. Not to name names, but one license had a restrictive patent grant that only applied to GPL'ed operating systems. Another was more of a rant than a license. Another was derived from the GPL in violation of the GPL's copyright. And the fourth had insufficient review on the license-discuss mailing list (archives). The one license that did pass was the Python Software Foundation License." Hypocrisy (Score:1, Troll) It's not like we're going to make RMS starve if we copy it. He doesn't make his living selling copies does he? Re:Hypocrisy (Score:4, Insightful) The GPL is, in its essence, an ideological manifesto. Disallowing others from modifying your manifesto is not inconsistent with the GNU philosophy - the only thing they desire is that you allow others to modify your code, not your thoughts. Re:Hypocrisy (Score:1) From GNU's Free Documentation License: The purpose of this License is to make a manual, textbook, or other written document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. It certainly seems that they don't feel that their license needs to be "free" is the sense of the word they apply to other written documents. Does the FSF offer some explanation for why some written documents should be "free" and others not? Does the same line of argument apply to software? Re:Hypocrisy (Score:1) Re:Hypocrisy (Score:2) I'm pretty sure you can add your own amendments to the GPL, but I think that's pretty much on a case by case basis and that does not necesarrily give the right to call it a GPL. But don't quote me on it. Re:Hypocrisy (not) (Score:2) So, with that goal in mind, how would you construct a license that is both modifiable under the terms of the GFDL (which you quote) and still accomplishes the stated goal? The GPL can be used as a guide in creating your own license. This has certainly been done often enough. But, to modify the license itself would hurt the aim of Free Software. I'm also not certain what the legal implications are if a license agreement affords me the right to modify it. The GPL has teeth that come directly from copyright law. Under copyright law, you are not allowed to modify or distribute the code except in accordance with fair use doctrin. The GPL acknowledges this fact, and then offers you an "out" in the form of a license (this is in direct contrast to EULAs and other "shrink-wrap licenses", which require you to accept the license before USING the software) which you can take or leave as you see fit. Now, if you were allowed to modify the license, your software would have to refer to some "license archetype", perhaps backing that usage up using trademark (e.g. you can modify the GPL, but only if you give it your own name). This is sticky, and keep in mind that the GPL was a daring bit of legal hackery that has still yet to be tested in court. To add yet another complication to the core oddity of defending right-to-modify with copyright law would risk the basic goal by making the GPL harder to defend than it already was. All that asside, I think it's of questionable value to refer to the restrictions on the GPL as hypocritical. The GPL is a software license, not a work of art or engineering. I'm not quite certain why you feel that it would be hypocritical to say that software is an area of human endevor where freedom to modify is important but contracts and licenses are not. You may disagree, and you are most welcome to. But even if I accept that the two should be treated the same (and I do not, obviously), you make a challenge of hypocricy here which I do not believe you have explained. Re:Hypocrisy (not) (Score:1) I didn't say there was anything hypocritical going on. I said I don't understand what is going on. I would have to understand before I could accuse them of hypocrisy. Re:Hypocrisy (not) (Score:1) This isn't necessary for, say, BSD-style licenses (BSD, ZLib, LibPNG) because they're simpler and shorter - it's reasonable to include the entire BSD license in each file of your source, so you don't say "this is BSD-licensed", you say "you may do this, this and this but not this". "BSD license" is just a convenient shorthand for describing things - but from a legal point of view, the license consists of a couple of paragraphs embedded in each source file. However, it's obviously not reasonable to include the whole GPL in the same way. The GPL is long (20K?) because of copyleft - it's less permissive than the BSD license, so it can't just grant blanket permissions like the BSD license does (although an abbreviated GPL without the preamble/manifesto would be nice, since they're not really part of the license as such). If the GPL was free (in the FSF sense of the word) or open source, you'd get people redefining what it meant, and much confusion would ensue. ("Our software is licensed under the GPL." "No it isn't, ours is the real GPL!") absolute freedom is not useful (Score:1) Once you acknowledge that all who live are bound, discussing freedom becomes a matter of discussing how they should be bound, and to what they should be free. The FSF takes the position that people should have certain things as freedoms, and other things, such s the ability to deprive people of those freedoms, they should not have as freedoms. Neither the FSF or RMS ever claimed to want anarchy or complete freedom (i.e. no rules at all). Where on earth did you ever think that they did? Hell, the abolitionists in the US wanted all people to be free in the sense of not being slaves - they didn't want people to be free in the sense of free to own slaves. Were they hypocrits? Re:Hypocrisy (Score:2) Probably to avoid companies to change the license so it doesn't allow FreeSoftware anymore. But this is a good idea, why don't we try to submit this modification to GPL v3 or even GPL v4? Yep thats great! (Score:2, Insightful) should read: OSI Releases information on licenses, slashdot poster excited, no one else cares. Open source needs less licences not more.. Re:Yep thats great! (Score:1) That's why this is good news. The licenses rejected were among the most bizarre, redundant or useless licenses yet submitted to OSI. Perhaps that's why they made the news. IRC Clients (Score:2) -russ Re:IRC Clients (Score:1) Great! (Score:1, Insightful) THE license (Score:4, Funny) From the end of the PSF license: (Score:4, Funny) All that legalease will keep most mortals a hare's breadth away from comprehending. I wonder if "tortious" action is like a gui user dropping back into his/her "shell"? {SEG} sorry for the bad puns...I can hear most of you going "tcsh-tcsh"... tortious (Score:3, Informative) Legal language has lots of latin in it, and the words have very precise meanings. Re:tortious -WRONG (Score:1, Informative) TORT -. Re:tortious (Score:1) But just the latin words. English words like "free" or "all" and even "no" very often mean "limited", "some", and "a few" in legalese.... especialy in constitutional law. Ummmm...thanks for the update (Score:5, Informative) Re:Ummmm...thanks for the update (Score:1) It was eggs with cheese, sausage and banana bread. I've got to ask, this _is_ ((eggs+cheese)+sausage+banana bread), right? Not (eggs+cheese+sausage+banana bread), which is how I initally read it. Re:Ummmm...thanks for the update (Score:1) I think it was ((eggs+cheese)+((sausage+banana)+bread)), or in other words, your normal eggs and cheese as a side to a banana sausage sandwich. Just as bad as calling a Kiwi and Aussie ! (Score:1) Let the games begin ! Re:Just as bad as calling a Kiwi and Aussie ! (Score:2, Funny) Seeing as this is about *nix licensing, shouldnt that be a tar.gz pit? Re:Just as bad as calling a Kiwi and Aussie ! (Score:2) ony for the GPL crowd. For everyone else, it's tar.bz2 :) hawk WhooHoo! (Score:5, Insightful) And what a bizarre license that was (not to name names). It was essentially the BSD license word for word, with the aforementioned patent grant. Yet you couldn't legally use the software on a BSD licensed operating system. Another was more of a rant than a license. A delicious rant to be sure. I quite enjoyed it, despite its wrongheadedness. It could not be approved of course, since it explicitly denied its own validity. The one license that did pass was the Python Software Foundation License. Whoohoo! In this age of a million open source licenses, it's nice to see that a sensible license that fills a gap in open source gets approved while the frivolous crap gets flushed. Re:WhooHoo! (Score:5, Interesting) I'm not denying that it fills a gap, but a cursory reading of the license doesn't seem to indicate to me what gap it's filling. Why was it not possible/desirable to license Python under one of the existing Free Software licenses, and instead necessary to come up with another one? Re:WhooHoo! (Score:3, Interesting) Because the Python source code was, at various times, "owned" (copyright was in the name of) Stichting Mathematisch Centrum, the Corporation for National Research Initiatives, BeOpen, Digital Creations, and the Python Software Foundation. Guido couldn't release it under the GPL, because it wasn't entirely "his" software to license. (Google cache of the license [google.com]) Re:WhooHoo! (Score:2) More correctly, Guido didn't want to license Python under the GPL, but did want it to be able to be integrated with GPLed software, as well as software under virtually any sort of license. (25 pages of Python license history snipped... see the full scoop [python.org] for the current license.) Re:WhooHoo! (Score:3, Informative) Re:WhooHoo! (Score:2) Until that happens, this whole story is as pointless as the whole "It" fiasco, which I note reared it's ugly and decidedly non-pointed head on Wired again today. Re:WhooHoo! (Score:2) (Not only that, but the airline industry got skewered as well. Although not as much as John Travolta;) The Cretan License (Score:2) Re:The Cretan License (Score:1) Or here [chrisbrien.co.uk] for a plain text (slighly older) version. Yes, that is my website. Do I get karma for being the subject of a Some software covered by the license can be found here [chrisbrien.co.uk], and here [chrisbrien.co.uk]. The latter uses DirectX, but works under Wine (that's vanilla Wine (yummy?) not WineX). The source for that is here [chrisbrien.co.uk]. Re:The Cretan License (Score:1) Do I get karma for being the subject of a /. story? You would have, except you blew it at the last minute (i.e. penultimate word) in your license by using "it's" instead of "its". A poet wouldn't have done that ;-) Tim "Poetic"? Not original (Score:2) Re:"Poetic"? Not original (Score:1) Restrictive Patent Grant License (Score:5, Informative) Intel modified the BSD license in the following ways: Exactlly what OS is licensed under the GPL? (Score:2) Licensing something for GPLed `OS's is nearly as bad as the FHS saying Let's name some more names... (Score:5, Informative) The Poetic License [chrisbrien.co.uk] states that: ." (har de har har) The CMGPL [crynwr.com] The GPL without a bunch of sections? Which ones, you ask? Mostly the ones that don't count! The Intel BSD+Patent License [crynwr.com] Like BSD, but grants a patent license. Patent license is specifically not granted to use under non-GPL OS's, or with modified versions, although copyright license is the same as BSD. Re:Let's name some more names... (Score:2, Insightful) Re:Let's name some more names... (Score:2) So what are they? (Score:2) Anyone care to enumerate the other three licenses? GPL (Score:4, Funny) Re:GPL (Score:3, Insightful) The GPL is a tool which was created with one goal: to allow modification and distribution of software. The goal was not (even given the FSF's fondness for recursion) to allow modification of the GPL. Re:GPL (Score:3, Insightful) I personally don't have a problem with companies restricting redistribution of code (eg. forcing others to purchase it), so long as once you've purchased it, you get the source and can modify it (or distribute the patches to others who have purchased it). My *guess*, however, is that many companies are afraid they'll be forced to support software others modify if they give out the code. Re:GPL (Score:1) That already exists - since copyright only applies to distribution anyway, you can take any GPL'd code, hack it up whichever way, and use it internally to your organization. As long as you don't distribute any binaries built from it you are under no oblication to ever provide source code. I don't see how you think this would help companies open up and write Open Source code, though - source that never leaves the company walls is effectively not open, and those changes will never get rolled back into the community. That doesn't seem like a very productive outcome. Re:GPL (Score:1) Re:GPL (Score:1) Copywrite applies to distribution, not to modification. Private modifications are derivitave works, they just aren't distributed and so never fall under the control of copyright law. Re:GPL (Score:1) Re:GPL (Score:1) Well shut my mouth - I guess I learned something today :) Although in practice 106(2) would be very difficult to enforce. I could be mixing up derivative Britney Spears tracks in my basement (god forbid) for years and no one would be the wiser. Re:GPL (Score:1) Although in practice 106(2) would be very difficult to enforce. I could be mixing up derivative Britney Spears tracks in my basement (god forbid) for years and no one would be the wiser. Modification for private use almost certainly falls under fair use. But there are exceptions. See Lewis Galoob Toys, Inc. v. Nintendo (game genie is legal), or Micro Star v. FormGen Inc. (Nuke It is not). This is why I said that I think we mainly agree on the law (modifications for private home use are legal), just not on the specific semantics. Re:GPL (Score:1) KRL... (Score:2) (It was apparently submitted for application but never approved). Somebody confirm please, me curious Re:KRL... (Score:1) Artistic license (Score:5, Funny) Yeah, I know there's plenty of room for argument all around, but my sympathies are with small software vendors who need some way to get enough revenue from 100-5000 licenses to pay salaries. The Artistic License strikes me as compact and commonsensical, and a good model for many situations. And of course it has the coolest name. Re:Artistic license (Score:2) Re:Artistic license versus GPL (Score:1) I think the heart of the matter is sociological rather than legalistic or economic. It's a question of how to create and sustain a user community. You might regard a piece of code as 'your baby,' and only be prepared to share it with people who promise not to make money off your baby. In that case, it's 'all about you.' But you might instead want to get as many people excited about your baby as possible -- in which case giving new users the ability to make some money off it is a positive inducement. To use an extreme example: Suppose you designed a kewl language, wrote an efficient compiler, and got lots of praise from your initial users. But you craft a license agreement that not only restricts sale of the compiler code, but further restricts users from selling any applications built with your language. You might get praise from RMS and others who feel that all software should in principle be free; but you won't win the hearts and minds of developers whose salaries depend on the ability to build software products. It's so hard to promulgate a new language anyway; and this extra restriction would cut out the very people most likely to have an open mind about new technology. Even end-user organizations would balk at building their custom apps with your language, if they must give up the option of ever reselling them, and if their software vendors aren't embracing it. So I guess my point is that I see a need for several licensing regimes, appropriate for different kinds of software and software users. There are certain applications that are too specialized and expensive to get built through an open source community, and will thus require a commercial R&D team that can only be funded through proprietary licensing. There are widely-used and widely-needed applications that are best served by communities working under something like GPL or LGPL. And there are certain components that should be as widely-distributed as possible, where everybody benefits through standardization even outside the open source community; and if these components have very nonrestrictive licenses, it's easier to proselytize effectively and reduce the temptation or need for anybody to roll their own solution. But of course, that's only my opinion. When will they approve the MGPL? (Score:5, Funny) Re:When will they approve the MGPL? (Score:2) I'm gonna sue their asses off! Just what we need, another type of "free" software (Score:2, Funny) I wonder if I should submit my license (Score:2, Funny) And then for some of my political software work, I used the Freeware for Feminists license - basically free, so long as the user was sympathetic with a feminist cause, and not granted for anti-feminist usage. Kind of viral, but I did make a splash screen and gave out source code with the compiled code. - hmm (Score:1, Insightful) IGNORED in the past 2 years? if you have big $, OSI will grant approval. if not, you will be ignored. Licences and contracts are copyrightable? (Score:1) Re:Licences and contracts are copyrightable? (Score:1) A Good License (Score:3, Interesting) (The following is my opinion, so please read it as such. When I refer to a "good" open source license, I am making a qualitative assessment, and not trying to set up criteria for any approval process but my own.) The purpose of open source licenses are to grant the user a broad set of permissions and rights over and above those granted by copyright law. Their purpose is not to bind the user to the will of the licensor. A good open source license must be based on copyright law, not contract law. The first thing a good license should do is grant unconditional permission to use the software. This should be so basic it to not be worth mentioning, but you would be surprised as some of the licensed submitted. Additionally, the use of the software should not be trigger for anything else. We don't want any EULA's here, thank you. The second thing a good license should do is clearly inform the user of their permissions. These permissions must not be predicated upon acceptance of any agreement. A permission may have conditions attached to it. If there is anything you wish the user NOT to do, make it a condition. Next the license should have a warranty disclaimer, to assure the user that they will not be sued if they contribute stuff to the project. You may (and should if you're a commercial project) include a real warranty as a separate legal document. Notice that I haven't included anything about what you require the user to do. No blanket obligations. That's on purpose. Open Source and Free Software are NOT about making people do things. It is okay to make an obligation be a condition to a permission. It is not okay to make an obligation be a condition to the entire license. Remember, this is about what the user can and cannot do. Software licenses as contracts was an invention of the proprietary software industry. There was a time not that long ago when copyright law as very vague as to the status of software. So the industry decided to use contract law instead, and created licenses that had such bizarre phrases in them as "by reading this sentence you agree to the following obligations...". That's bullshit and Open Source and Free Software should have nothing to do with such rubbish. Re:A Good License (Score:2) First off, licenses aren't written for end users. Yes, they're purportedly intended to inform a user of their privileges, but the true audience of a license is a judge and a pack of lawyers. The important thing for a license isn't that it's clear to joe blow, but that it's clear in court: a contract that's clear to joe blow is meaningless if a court can't make heads or tails of it. Confusing terminology in contracts is the result of two problems. First, colloquial language is very subjective and very slippery, and so legal documents have to be written in a specialized dialect of English that has arisen over centuries of effort. It's the same problem with programming languages: we can't have a truly natural language programming language because it's too imprecise. But just as engineers have an easy time reading and understanding source code, so do lawyers have an easy time reading legalese. The second problem is that most lawyers have a very poor mastery of both English The next thing is that all licenses are based in contract law. There is no room in copyright law for granting permissions beyond those explicitly enumerated (and irrevocable) in copyright law. If you want to grant extra permissions, or revoke certain permissions, then you Next, you have to consider the purpose behind an OSS license. One person may have a different purpose from you. To me, the term OSS means "you can read my source code, and you can contribute changes back to me". That's it. It doesn't say anything about whether or not someone can use the source code. It doesn't say anything about whether or not someone can produce derivative works. Sure, GPL talks about those things, but that's because GPL goes farther than the simple concept of OSS. The same goes for other OSS licenses: they will almost always go beyond the simple concept of OSS, building on top of the concept in order to further the purposes that the author has in offering the software as OSS in the first place. As an example, someone might be making their software OSS for the purpose of crushing Windows. It shouldn't be too surprising to see that their license contains a clause prohibiting the porting of the software to any Microsoft operating system, either natively or under an emulator. Does OSS say anything about that? Nope. Does GPL say anything about that? Nope. But that author wants to crush Windows, so he's not very well going to allow his software to be used under Windows, now is he? He's got a purpose, and his license reflects that purpose. Then there's the last point. Software licenses The only thing that software copyrights do is to allow the author of software to restrict his software's distribution. Once that's in place, the author can then impose a license (read: contract) on the user for the software. Without software copyrights, the licenses would be meaningless, because a user could just say "naw, I'm not gonna agree to the license, so it doesn't bind me, but I'm gonna use the software anyway because you can't prevent me from getting a copy of it." Re:A Good License (Score:1) Firstly, I think that in any legal agreement that's put forwards in good faith one of the most fundamental objectives must be that the parties to it understand it. A contract between Microsoft and IBM can be thoroughly incomprehensible without careful interpretation by a team of lawyers because that's the level of attention that those companies can give it. A contract between IBM and its most junior employees should be comprehensible by those employees with the level of resources they can reasonably be expected to have. Software licences, whether proprietary or free, should be designed to be comprehensible to the people who are being asked to agree to them. There's nothing wrong with a highly legalistic licence expected to be used amongst companies or individuals that will have lawyers examine them closely and that can be the objective in a free software licence but if you're intending it to be used more widely then you should make sure it makes sense to others. Would you want to be in the position of suing someone who had agreed to your licence in good faith believing they had more rights under it than they did simply because you'd made it incomprehensible? Or do you want to discourage anyone from actually contributing to your project because they don't understand what rights they have?. That's the whole point of it. If I own copyright on a work then I can say "you may copy this", no contract there it's purely a permission (a licence) I can choose to give. Equally I can say "you can copy this once", "you can copy this but only once per year", "school teachers may copy this but nobody else" or "anyone anyone whose foot fits this slipper may copy this". None of those are contractual. They are all permissions (licences) that can be granted by a copyright holder. Re:A Good License (Score:2) You have to look at it the same way as a program and its users' guide. We programmers have little problem reading source code (even complex source code) and figuring out what's going on. But joe blow can't do that. Both of us benefit from the users' guide: joe blow so he can make sense of what he's seeing, and us so that we can figure out whether or not a particular behavior is a bug or if it's intentional in some strange way. But as far as the computer is concerned, the users' guide is meaningless. The code is the be all and end all of the system's function.. That's certainly true. Unfortunately there isn't a whole lot of precedent about the validity of choice of jurisdiction clauses. English common law countries tend to obey them (and US courts seem to always do so). But I can't speak about European common law countries, Confucian law countries, or others. But this whole issue about things happening internationally is really quite new. Before the computer age, international commercial agreements were nearly always exchange-of-goods, so there really wasn't any kind of licensing issue. There were certainly cases of a foreign manufacturer buying a production model of someone's invention, then copying it and producing it themselves in their own countries. And the few court proceedings in these matters were nearly always ineffective. But with the rate at which things are going, we can expect to start seeing a whole lot more cases discussing international licensing.. You're thinking about contract law. Copyright law says "this thing is owned by the copyright holder, and he can prevent anyone he wants from getting access to it" (basically). The only variant that exists in copyright law is the concept of "public domain": a person who would otherwise hold copyright over something can put that thing into the public domain, in which case no one has differential rights to that thing. Contract law says "different parties have different rights, resources, and privileges, and they can negotiate exchanges of those rights, resources, and privileges under these rules." Copyright grants a privilege to one party that is excluded from other parties. Contract law influences how the copyright holder can grant his priveleges to other people. Re:A Good License (Score:2) Okay, it's some years since I got my law degree and it's in UK law whereas I would guess you're talking from an American perspective but imho you're just plain wrong. Granting someone permission to copy and distribute your copyrighted work does not in any way require a contract just as giving someone a gift doesn't require contract law and telling someone they can enter your house, use your computer, or borrow your car does not require contract law. You can use a contract in any of those situations but if all you're doing is giving permissions then contract simply doesn't come into it. Re:A Good License (Score:1) And, yes, I'm talking about US law. Re:A Good License (Score:2) Cool. Too bad it doesn't apply to most Open Source licenses. The operative phrase in your quote is "negotiate exchanges". Since that's how I always understood contract law, we must be in agreement on something! But I don't understand where the negotiation or the exchange comes in when I download the Linux kernel and start distributing it. I have negotiated nothing! I have given nothing back to Linus and Friends! If you look at the typical contract, you will see certain attributes. First, both parties are aware of each other. Second, negotiation of terms is possible even if the negotiation does occur. Third, both parties receive something of benefit. Finally there is an explicit agreement. None of these attributes are present when I download and start legally distributing the Linux kernel. Linus and Friends are not aware of me, or of the fact that I possess a legal copy of the kernel. And it is not possible to negiate terms because a line of communication has not been established (although that communication could be initiated by me). I receive benefit from the kernel, but Linus and Friends receive nothing from me, not even the satisfaction of knowing that I am even using it. Finally, there is no explicit agreement. No signature, no handshake, no verbal "I agree", no clickthrough, no filling out of registration cards, nothing. A transaction of sorts has occured, but there is no contract. Re:A Good License (Score:2) It depends on the license. For the MS EULA, you are certainly correct. But software written by developers that expect/invite/encourage participation in the development process should have a license written for developers. Of course lawyers and judges will be one audience for the license, but they will not be the primary audience. The next thing is that all licenses are based in contract law. There is no room in copyright law for ranting permissions beyond those explicitly enumerated (and irrevocable) in copyright law. Here's a sample license: "You may freely copy, distribute, modify, translate, or otherwise transmit and transform this software without restriction." Just how does this qualify as a contract? Where is the agreement? Where is the consideration? Are you saying that the above license is not valid? What exchange? In the case of the Linux (as an example) I have given nothing to Linus Torvalds. No money. No pledges of royalties. No promises that I will ever contribute anything back to the project. I'm not grantingd him any permissions or benefits. Heck, Linus and I have never even met, so how can we possibly exchange anything! Once that's in place, the author can then impose a license (read: contract) on the user for the software. Contracts are never "imposed." They must be agreed to voluntarily by both parties. Re:A Good License (Score:2) Why would you ever write a license that you don't want to be enforceable? If you want it to be enforceable, then it has to be (principally) comprehensible in court. As to determining whether or not a contract is clear, the court will look at the language itself, not defer to the statements of the defendant or plaintiff. The only exception is when both defendant and plaintiff agree on the interpretation of a particular clause, in which case the court will take that interpretation rather than the interpretation that the court might find on its own. But in such a case, I think you'd agree that the license is sufficiently clear. Here's a sample license: "You may freely copy, distribute, modify, translate, or otherwise transmit and transform this software without restriction." Just how does this qualify as a contract? Where is the agreement? Where is the consideration? Are you saying that the above license is not valid? Agreements between parties fall exclusively under the jurisdiction of contract law. The parties may, in fact, act under an agreement that is an invalid contract, but it is still under the jurisdiction of contract law. More directly, let's look at your sample license. Presumably, the person offering the license possesses a copyright in the software. So the holder is granting certain distribution and modification privileges. That's the consideration that he's giving. The license doesn't explicitly enumerate consideration that the recipient is granting back to the holder, but (and this is an important principle in contract law) since the holder is the party that offered the contract, it is presumed that the holder is gaining an automatic intangible concession in return (such as the pride of knowing that other people want to use his software). The important thing is that the person who offers terms is presumed to agree to the terms; if he didn't agree to them, he wouldn't've offered them in the first place. Then, if the recipient of the software actually does exercise one of the privileges granted to him in the license, then he has also agreed to the license (contract). This is another important concept in contract law: implied consent. If one party exercises a privilege granted only under a contract, then that party has consented to that contract. This concept actually doesn't exist in the text of the legislation that forms contract law. This exists in a more important place: legal precedent. So the example license that you present has offer, has exchange of consideration, and has consent. All three of the keystones that are required for a contract to be valid. What exchange? In the case of the Linux (as an example) I have given nothing to Linus Torvalds. No money. No pledges of royalties. No promises that I will ever contribute anything back to the project. I'm glad that you brought up Linux. Linux uses a fragmented intellectual property model, in which the entire body is covered by a single license, but the ownership of the individual pieces are retained by the original authors. So when you use Linux, you are entering into an agreement with each of the separable authors of the kernel. As one of the authors of the Linux kernel (interval timers, original I can say for certainty that the same consideration applies to a large number of the people involved in the Linux kernel, but I will neither name names, nor will I attempt to enumerate all the considerations that are gained by all the individual contributors to Linux (primarily because I don't know them all). I'm not granting him any permissions or benefits. Heck, Linus and I have never even met, so how can we possibly exchange anything! If physical meeting were a requirement for a binding contract, then the only commerce that would exist would be face-to-face barter. Mail order, internet sales, telephone solicitation, early book sales (even in person), credit cards, checks, ATM cards, and even paper currency all exist only because of nonlocal agreements to contracts. Contracts are never "imposed." They must be agreed to voluntarily by both parties. That's only sort of true. As the holder of a copyright, I can offer a contract without allowing negotiation. True, the contract doesn't bind unless the other party agrees, but in that case the other party doesn't get my software, either. So I have effectively imposed my contract on all people who want to use my software. This is the central argument behind the (many) suits over the years asserting that Microsoft has illegally leveraged its monopoly power to impose contracts. Re:A Good License (Score:1) As an aside... What happens when Microsoft becomes weakened? Will you subsequently abandon Linux development? Re:A Good License (Score:1) If microsoft gets so weak that there's no chance of it ever recovering, then I'll consider that goal to be achieved. If there's something new that I need out of Linux, I'll probably keep working on it (I like my mini beowulf cluster, after all). Otherwise I might dust off that old OS that I was writing and abandoned when I started up with Linux. Re:A Good License (Score:1) And as an aside, I did not necessarily consider the GPL to be a "good" license by my criteria. It is very borderline. The entirety of the license is be based on copyright law, and clause 5 even says the same. Yet clause 5 is attempting to place it under contract law. I can only assume that this is for the purpose of satisfying the overly pedantic lawyers working with the FSF. There's no way you can read the list of four freedoms of the FSF and conclude that RMS thinks software should be distributed under contract. Re:A Good License (Score:2) Funny, I didn't see anything in the FSF's four freedoms about binding people to the wills of other. That antithetical to freedom. (it's also antithetical to contract law, which is why unilateral contracts are Evil) Copyright law has already given the user the right to use the program. No ifs, ands or buts. Since so many commercial licenses say "by using this software you agree to...", I felt it necessary, if redundant, to explicitly assure the user that they can use the software no matter what else the license says. After all, I even know of one person who holds the belief that you may not use GPLd software unless you agree with the philosophical preamble in its entirety. Hmmm, you must be a lawyer, as no one else has so much trouble parsing standard English. Let me restate. You give the user a set of permissions. You then let the user know what these permissions are. You do not keep them secret for the user to guess. Let me give an example: "you may distribute this post to anyone." There. I granted a permission to all readers of this post, and also informed that of it. Yes, I did say that. But double check my post anyway. I had more than one criteria. The right to *use* the software unconditionally is the first of my criteria. Other rights, such as distribution, modification, etc., may be conditional. My Standard Software Disclaimer (Score:4, Funny) to real persons, living or dead is purley substaintial amount of non-tobacco ingredients. Colors may, in time, fade. We have sent the forms which seem to be right for you. Slippery when wet. For recipt.. This supersedes all previous notices. Re:My Standard Software Disclaimer (Score:2) Re:My Standard Software Disclaimer (Score:1) Re:My Standard Software Disclaimer (Score:1) May contain traces of nuts. Falling Rocks Do Not Stop. No Seatbelt Fine Exceeds $100. and of course Offer void where prohibited by law. : Fruitbat : becoming your parents (Score:1) Why do we have an organisation telling us what licenses we can and cannot use? I used a disapproved of, but still open source IMHO license...what then? Will the OSI call up the FBI to bust down my door? Fuck the establishment, we don't need anymore conformity factories. My favorite "License" (Score:2) This software comes with no warranty. If it breaks, you get to keep both pieces. That Monty Python License in Full (Score:2) 1. No Poofters 2. This program may not be used in a bat of custard if there is anyone looking 3. Three shall be the number of the count and the number of the count shall be three, thou shalt not count to two unless thou also counteth to three, nor shall thou count to four, five is right out. 4. There is no 4 5. Is right out 6. SPAM SPAM SPAM SPAM! Wonder SPAM! Wonderful SPAM 7. The program to which this license is attached may be used for any purpose whatsoever without payment provided that (1) this license is included in its entirety intact and (2) the provisions of sections 2, 4, 5 and 8 are complied with on alternate Wednesdays and sections 8, 9 and 4 are complied with at all other times 8. All copies of this program be distributed with the distributors choice of (a) the program source or (b) a bottle of Wostershire Sauce made from genuine Wostershires. 9. EEEK! 10. Naaawwwwww... Re:That Monty Python License in Full (Score:1) What is the license of this License? can i use it for any software i'd like to release in the wild? Re:That Monty Python License in Full (Score:2) Re:Wait a minute! (Score:1) Re:Wait a minute! (Score:2) Free Documentation License (FDL) Re:Wait a minute! (Score:2) Yeah, right. I log into a shell account and am held hostage to the wild fantasies of anyone who wrote some innocuous seeming library or kernel module. It's Python, for chrissakes. How can you not end up using it? This is getting crazy. A previous poster only wants feminists or fetishists to use his work. Sheesh. When do we go back to being normal people? Private citizens are left alone to tinker and share, businesses pay some royalties. If things get muddled up, we have a few beers and then forget what we were fighting about. Ah, the old country. Re:Wait a minute! (Score:1) Re:Wait a minute! (Score:5, Informative) You can however provided added or amended licensing conditions without modifying the actual text of the GPL; for example "this program may be distributed under the terms of the GNU GPL with the added requirement that [blah blah]." Re:Wait a minute! (Score:2) The reasoning for this was that if modification were allowed it would dilute the usefulness of the license, as "GPL-derived" licenses might not even be Free Software or Open Source. I disagree. The MPL is more or less GPL-derived. It's just that they got their lawyers together and made it look "different enough" so that nobody would accuse them of hacking the GPL, and that has not diluted the "usefulness" of the GPL. Also, there are several other licenses (e.g., Sleepycat) that are GPL-like, but not expressly derived from the GPL. The copyright restriction on the GPL can't prevent the proliferation of licenses. It just makes it harder for people who might want to use the GPL as a starting point. Their desire to prevent the "GPL brand" from being diluted is understandable. A more fair solution would be to allow unlimited modification of the GPL, as long as you didn't call your license the GPL. Re:Wait a minute! (Score:2) The Free Software Foundation isn't worried about the GPL brand. They simply aren't interested in making a GPL derivative an easy thing to do. The Free Software Foundation wants you to use the GPL (duh!) so they have copyrighted the GPL in order to prevent people from easily making clones. If you want your own GPL-like license then hire your own lawyers and hope that they are as well acquainted with software copyrights as the folks who have worked on the GPL (good luck). This might seem like a contradiction, but the Free Software Foundation isn't the "Information Must Be Free As In Free Beer Foundation." They are specifically trying to make sure that software comes with source code (and documentation :). They are not trying to make it so that all information is free. So while you are certainly right that the GPL copyright can't make license proliferation impossible, it certainly does make it more difficult (and more expensive), and that's a net win for the FSF. Re:Wait a minute! (Score:1) Since the GPL hasn't been tested in court, we don't really know how well the authors understand software copyrights. Re:Wait a minute! (Score:1) If it were a bad license some dumbass lawyer would have ate it for lunch already. Re:Wait a minute! (Score:1) The GPL is a copyrighted document that grants you explicit permission to redistribute it in unmodified form. Regardless of what the FSF wants to tell you, licenses which are GPL derivitives are not protected by copyright. The GPL is a functional document, changing any word or letter in it changes the function of the document. Therefore the protections against derivitives of the document fall under patent law, not copyright law, and the GPL has not been patented. Re:Wait a minute! (Score:2) Then what's the point of OSI?? (Score:1) But isn't this what OSI is for? They approve the license as open source or not. If someone modifies the GPL but it still statisfies the OSI requirments then it shouldn't be an issue if it was derived or not. The spirit of the license is the same as the GPL. In fact the derivative may be an attempt to strengthen that spirit in a court of law. If the derived work is suitable to the OSI then the FSF should allow it. Now I can see issues if the derived license wasn't OSI compliant but that doesn't seem to be the case here.
https://slashdot.org/story/01/11/30/1730207/osi-turns-down-4-licenses-approves-python-foundations?sdsrc=prevbtmprev
CC-MAIN-2017-43
en
refinedweb
Ethernet Table of Contents Legacy Networking Libraries This documentation covers the networking libraries available for mbed 2. For mbed 5, the networking libraries have been revised to better support additional network stacks and thread safety here. Ethernet Network Interface The Ethernet peripheral is of little use without an IP networking stack on top of it. You could be interested in the Ethernet Interface library. The Ethernet Interface allows the mbed Microcontroller to connect and communicate with an Ethernet network. This can therefore be used to talk to other devices on a network, including communication with other computers such as web and email servers on the internet, or act as a webserver. Hello World!¶ Read destination and source from every Ethernet packet #include "mbed.h" Ethernet eth; int main() { char buf[0x600]; while(1) { int size = eth.receive(); if(size > 0) { eth.read(buf, size); printf("Destination: %02X:%02X:%02X:%02X:%02X:%02X\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n", buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]); } wait(1); } } API¶ API summary Interface¶ All of the required passive termination circuits are implemented on the mbed Microcontoller, allowing direct connection to the ethernet network. The Ethernet library sets the MAC address by calling a weak function extern "C" void mbed_mac_address(char * mac); to copy in a 6 character MAC address. This in turn performs a semihosting request to the mbed interface to get the serial number, which contains a MAC address unique to every mbed device. If you are using this library on your own board (i.e. not an mbed board), you should implement your own extern "C" void mbed_mac_address(char * mac); function, to overwrite the existing one and avoid a call to the interface.
https://os.mbed.com/handbook/Ethernet
CC-MAIN-2017-43
en
refinedweb
It was pointed out that your method for init (custom derivations and default initializer) would look like this for the class Circle... @interface Circle : SomeOtherClass { double radius; // should be NSNumber IMHO } - initWithRadius: (double)r; @end @implementation Circle - initWithRadius: (double)r { radius = r; } @end In reality, this could and likely will be troublesome. It assumes there is no additional initialization done by the parent class... Bad assumption, really bad. The correct way to define a default initializer method is more like - init { return ( [self initWithX: defaultValueForX ] ); } // This is the designated init method for this class - initWithX: valueHolderForX { [super init]; // us the default initializer for the super class, init can be assumed, yet it would help to know your parent implementation since indeed you are inheriting functionality from it, makes sense to know it. There may be specific default initializers that are more useful and appropriate for your use. // set your iVars here x = valueHolderForX; [ ... maybe private iVars are set here ... ] } Hope this helps. .
http://archive.oreilly.com/cs/user/view/cs_msg/3830
CC-MAIN-2017-43
en
refinedweb
In this article, we will look at the techniques being used by Android developers to detect if a device on which the app is running is rooted or not. There are good number of advantages for an application in detecting if it is running on a rooted device or not. Most of the techniques we use to pentest an Android application require root permission to install various tools and hence to compromise the security of the application. Ethical Hacking Training – Resources (InfoSec) Many Android applications do not run on rooted devices for security reasons. I have seen some banking applications check for root-access and stop running if the device is rooted. In this article, I will explain the most common ways being implemented by developers to detect if the app is rooted and some of the bypassing techniques to run the app on a rooted device. Common techniques to detect if the device is rooted Let’s begin with the most common techniques being used in the most popular applications to detect if the device is rooted. Once a device is rooted, some new files may be placed on the device. Checking for those files and packages installed on the device is one way of finding out if a device is rooted or not. Some developers may execute the commands which are accessible only to root users, and some may look for directories with elevated permissions. I have listed few of these techniques below. - Superuser.apk is the most common package many apps look for in root detection. This application allows other applications to run as root on the device. - Many applications look for applications with specific package names. An example is show below. The above screenshot shows a package named “eu.chainfire.supersu”. I have seen some apps from the Android market verifying if any application by “chainfire” is running on the device. - There are some specific applications which run only on rooted devices. Checking for those applications would also be a good idea to detect if the device is rooted. Example: Busybox. Busybox is an application which provides a way to execute the most common Linux commands on your Android device. - Executing “su” and “id” commands and looking at the UID to see if it is root. - Checking the BUILD tag for test-keys: This check is generally to see if the device is running with a custom ROM. By default, Google gives ‘release-keys’ as its tag for stock ROMs. If it is something like “test-keys”, then it is most likely built with a custom ROM. Looking at the above figure, it is pretty clear that I am using a stock Android ROM from Google. The above mentioned techniques are just a few examples of what a developer may look for in order to identify if a device is rooted. But there could be other ways around for root detection which are not mentioned here in this article. Bypassing root detection — Demo In this section, we will see how one can bypass one of the root detection mechanisms mentioned above. Before we begin, let’s understand the background. Download the application from the download section of this article and run the app on your device and click the button “Is my device rooted?” Since I am running it on a rooted device, it says “Device Rooted”. Now, our job is to fool the application that this device is not rooted. Now, let’s begin. Understanding the app’s functionality Let’s first understand how this app is checking for the root access. The code inside this application is performing a simple check for Superuser.apk file as shown in the screenshot below. As we can see in the above figure, the app is checking if there is a file named “Superuser.apk” inside the “/system/app/” directory. If it exists, then we are displaying the message “Device Rooted”. There are various ways to bypass this detection. - Let us first reconfirm manually if the device is rooted by executing “su” and “id” commands. - Let’s see if the “Superuser.apk” file is located in the path being checked by our target app. - To bypass this check, let’s rename the application “Superuser.apk” to “Superuser0.apk” as shown in the figure below. As we see in the above figure, we may get an error message saying it’s a read-only file system. We can change it to read-write as shown in the next step. - Changing permissions from Read-Only to Read-Write: The following command will change the file system permissions to “Read-Write”. - Now, if we rename the file to “Superuser0.apk”, it works fine as shown in the figure below. - If we now go back to the application and click the button “Is my device rooted?”, it shows a message as shown in the figure below. This is just an example of how one can bypass root detection if it is not properly implemented. Applications may use some complex techniques to stop attackers from bypassing root detection. The techniques will change depending on how the developer is checking for root access. For example, if a developer uses the following code snippet to check for root, the procedure to bypass the detection is different: Runtime.getRuntime().exec(“su”); In this case, we would need to make our own “su” binary and “superuser” apk. Conclusion Developers who stop users from running their apps on rooted devices could be a good idea from a security perspective, but this is really annoying to a techie user who is not able to execute the app only due to the reason that he has rooted his device. Rooting techniques can be bypassed easily most of the time, and it is highly recommended that developers should use complex techniques in order to stop attackers from bypassing their validation controls. Hi, Good article !!!!!!!!!! This is much similar, I am looking for. Problem, my APK is having this piece of code to check if devices is rooted or not. Kindly suggest possible bypass for all three methods mentioned in the following code. public class RootUtil { public static boolean isDeviceRooted() { return checkRootMethod1() || checkRootMethod2() || checkRootMethod3(); } private static boolean checkRootMethod1() { String buildTags = android.os.Build.TAGS; return buildTags != null && buildTags.contains(“test-keys”); } private static boolean checkRootMethod2() { String[] paths = { “/system/app/Superuser.apk”, “/sbin/su”, “/system/bin/su”, “/system/xbin/su”, “/data/local/xbin/su”, “/data/local/bin/su”, “/system/sd/xbin/su”, “/system/bin/failsafe/su”, “/data/local/su” }; for (String path : paths) { if (new File(path).exists()) return true; } return false; } private static boolean checkRootMethod3() { Process process = null; try { process = Runtime.getRuntime().exec(new String[] { “/system/xbin/which”, “su” }); BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream())); if (in.readLine() != null) return true; return false; } catch (Throwable t) { return false; } finally { if (process != null) process.destroy(); } } }
http://resources.infosecinstitute.com/android-hacking-security-part-8-root-detection-evasion/
CC-MAIN-2017-43
en
refinedweb
I'm making an app which gets data from a csv file and generates a graph using it. All files contains the same structure. I've decided I'm not going to store the files, because of server prices. I'm going to use heroku for now to host this app. It's a Django app. I'm wondering how I could only open the file and extract the data of it using django. I've thought about creating a model and save each file content on it. How can I do this? Is this the best option for my case? I'll assume you're using Django 1.9 (if not, please update your question to reflect your version of Django). First, using the HTML <form> tag, you'll want to include enctype="multipart/form-data" as an attribute. Assuming you'll name your <input> tag as myFile ( <form name="myFile">), in your view, simply extract the file from request.FILES: def my_file_upload(request): if request.method == 'POST': myFile = request.FILES.get('myFile') # At this point, myFile is an instance of UploadedFile, see # for details Read up on uploaded files in the Django documentation to see the caveats associated with this approach.
https://codedump.io/share/UFlkdw4cMBJU/1/how-to-manipulate-user-uploaded-files-in-django-without-saving-it
CC-MAIN-2017-43
en
refinedweb
I? From their source, it looks like the method returns false all the time: /** *.; } I don't know if this was "the" official use case but the following produces a warning in Java (that can further produce compile errors if mixed with return statements, leading to unreachable code): if(1 == 2) { System.out.println("Unreachable code"); } However this is legal: if. There's a funny named method/constant/whatever in each version of Android. The only practical use I ever saw was in the Last Call for Google I/O Contest where they asked what it was for a particular version, to see if contestants read the API diff report for each release. The contest had programming problems too, but generally some trivia that could be graded automatically first to get the number of submissions down to reasonable amounts that would be easier to check. Google has a serious liking for goats and goat based Easter eggs. There has even been previous Stack Overflow posts about it. As has been mentioned in previous posts, it also exists within the Chrome task manager (it first appeared in the wild in 2009): <message name="IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN" desc="The goats teleported column"> Goats Teleported </message> And then in Windows, Linux and Mac versions of Chrome early 2010). The number of "Goats Teleported" is in fact random: int TaskManagerModel::GetGoatsTeleported(int index) const { int seed = goat_salt_ * (index + 1); return (seed >> 16) & 255; } Other Google references to goats include: The earliest correlation of goats and Google belongs in the original "Mowing with goats" blog post, as far as I can tell. We can safely assume that it's merely an Easter egg and has no real-world use, except for returning false. There is a similar call, isUserAMonkey(), that returns true if the MonkeyRunner tool is being used. The SDK explanation is just as curious as this one. static boolean isUserAMonkey() Returns "true" if the user interface is currently being messed with by a monkey. I expect that this was added in anticipation of a new SDK tool named something with a goat and will actually be functional to test for the presence of that tool. Also see a similar question, Strange function in ActivityManager : isUserAMonkey- what does this mean, what is its use?. Complementing the @djechlin particular case, will clog the breakpoint mark, making it difficult to enable/disable it. If the method is used as a convention, all the invocations could be later filtered by some script (during commit phase maybe?). Google guys are heavy Eclipse users (they provide several of their projects as Eclipse plugins: Android SDK, GAE, etc), so the @djechlin answer and this complementary answer make a lot of sense (at least for me). In the discipline of speech recognition, users are divided into goats and sheeps. future to be able to configure the speech recognition engine for goat's needs. ;-) As of API 21 (the first Android 5.0/Lollipop SDK), this detects whether the Goat Simulator app is installed: /** *"); } This should make it clear that AAA's suggestion of using it as a warning-free if (false) is a potentially disastrous strategy. What previously returned false for every device now returns a seemingly random value: if this was buried deep enough in your code it could take a long time to figure out where your new bugs are coming from. Bottom line: if you don't control the implementation of a method and decide to use it for purposes other than stated in the API documentation, you're heading for trouble. Funny easter egg that can be used to create always false tests to avoid executing a code block without compilation errors or warnings. if(isUserAGoat()) { System.out.println("this block does not execute..."); } Also, goats can be funny AND cute: Similar Questions
http://ebanshi.cc/questions/86/proper-use-cases-for-android-usermanager-isuseragoat
CC-MAIN-2017-43
en
refinedweb
dean gaudet wrote: > > btw ken i can't imagine why you don't think buckets would ever > be reused by another program. I'm referring to httpd and APR, respectively. As much of the bucket implementation as possible should be kept httpd-neutral and reusable, and put in APR. > oh wait, did you properly guess all the code which is library > candidates and what isn't? hope so! 'cause otherwise a name > change is in the future! Oh, I won't disagree at all that changes are a major pain and detrimental -- but we wouldn't *be* changing them if the APR stuff had been named appropriately to begin with, rather than forced into the httpd namespace by a narrow voting margin because one letter more was too much to type and hurt some people's fingies. -- #ken P-)} Ken Coar <> Apache Software Foundation <> "Apache Server for Dummies" <> "Apache Server Unleashed" <>
http://mail-archives.apache.org/mod_mbox/httpd-dev/200008.mbox/%3C39994AE3.E1001D2A@Golux.Com%3E
CC-MAIN-2017-43
en
refinedweb
This sample demonstrates how to implement an application that uses WS-Security with X.509v3 certificate authentication for the client and requires server authentication using the server's X.509v3 certificate over MSMQ. Message security is sometimes more desirable to ensure that the messages in the MSMQ store stay encrypted and the application can perform its own authentication of the message. This sample is based on the Transacted MSMQ Binding sample. The messages are encrypted and signed. To set up, 2012. Expand the Features tab. Right-click Private Message Queues, and select New, Private Queue. Check the Transactional box. Enter ServiceModelSamplesTransactedas the name of the new queue. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in Building the Windows Communication Foundation Samples. To run the sample on the same computer Ensure that the path includes the folder that contains Makecert.exe and FindPrivateKey.exe. Run Setup.bat from the sample install folder. This installs all the certificates required for running the sample. Note Ensure that you remove the certificates by running Cleanup.bat when you have finished with the sample. Other security samples use the same certificates. Launch Service.exe from \service\bin. Launch Client.exe from \client\bin. Client activity is displayed on the client console application. If the client and service are not able to communicate, see Troubleshooting Tips. To run the sample across computers Copy the Setup.bat, Cleanup.bat, and ImportClientCert.bat files to the service computer. Create a directory on the client computer for the client binaries. Copy the client program files to the client directory on the client computer. Also copy the Setup.bat, Cleanup.bat, and ImportServiceCert.bat files to the client. On the server, run setup.bat service. Running setup.batwith the serviceargument creates a service certificate with the fully-qualified domain name of the computer and exports the service certificate to a file named Service.cer. Edit service's service.exe.config to reflect the new certificate name (in the findValueattribute in the <serviceCertificate>) which is the same as the fully-qualified domain name of the computer. Copy the Service.cer file from the service directory to the client directory on the client computer. On the client, run setup.bat client.. You must also change the certificate name of the service to be the same as the fully-qualified domain name of the service computer (in the findValueattribute in the defaultCertificateelement of serviceCertificateunder clientCredentials). service computer, launch Service.exe from the command prompt. On the client computer, launch Client.exe from the command prompt. If the client and service are not able to communicate, see Troubleshooting Tips. To clean up after the sample Run Cleanup.bat in the samples folder once you have finished running the sample.. Requirements This sample requires that MSMQ is installed and running. Demonstrates The client encrypts the message using the public key of the service and signs the message using its own certificate. The service reading the message from the queue authenticates the client certificate with the certificate in its trusted people store. It then decrypts the message and dispatches the message to the service operation. Because the Windows Communication Foundation (WCF) message is carried as a payload in the body of the MSMQ message, the body remains encrypted in the MSMQ store. This secures the message from unwanted disclosure of the message. Note that MSMQ itself is not aware whether the message it is carrying is encrypted. The sample demonstrates how mutual authentication at the message level can be used with MSMQ. The certificates are exchanged out-of-band. This is always the case with queued application because the service and the client do not have to be up and running at the same time. Description The sample client and service code are the same as the Transacted MSMQ Binding sample with one difference. The operation contract is annotated with protection level, which suggests that the message must be signed and encrypted. // Define a service contract. [ServiceContract(Namespace="")] public interface IOrderProcessor { [OperationContract(IsOneWay = true, ProtectionLevel=ProtectionLevel.EncryptAndSign)] void SubmitPurchaseOrder(PurchaseOrder po); } To ensure that the message is secured using the required token to identify the service and client, the App.config contains credential information. The client configuration specifies the service certificate to authenticate the service. It uses its LocalMachine store as the trusted store to rely on the validity of the service. It also specifies the client certificate that is attached with the message for service authentication of the client. <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <client> <!-- Define NetMsmqEndpoint --> <endpoint address="net.msmq://localhost/private/ServiceModelSamplesMessageSecurity" binding="netMsmqBinding" bindingConfiguration="messageSecurityBinding" contract="Microsoft.ServiceModel.Samples.IOrderProcessor" behaviorConfiguration="ClientCertificateBehavior" /> </client> <bindings> <netMsmqBinding> <binding name="messageSecurityBinding"> <security mode="Message"> <message clientCredentialType="Certificate"/> </security> </binding> </netMsmqBinding> </bindings> <behaviors> <endpointBehaviors> <behavior name="ClientCertificateBehavior"> <!-- The clientCredentials behavior allows one to define a certificate to present to a service. A certificate is used by a client to authenticate itself to the service and provide message integrity. This configuration references the "client.com" certificate installed during the setup instructions. --> <clientCredentials> <clientCertificate findValue="client.com" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" /> <serviceCertificate> <defaultCertificate findValue="localhost" storeLocation="CurrentUser"> </configuration> Note that the security mode is set to Message and the ClientCredentialType is set to Certificate. The service configuration includes a service behavior that specifies the service's credentials that are used when the client authenticates the service. The server certificate subject name is specified in the findValue attribute in the <serviceCredentials>. <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <!-- Use appSetting to configure MSMQ queue name. --> <add key="queueName" value=".\private$\ServiceModelSamplesMessageSecurity" /> </appSettings> <system.serviceModel> <services> <service name="Microsoft.ServiceModel.Samples.OrderProcessorService" behaviorConfiguration="PurchaseOrderServiceBehavior"> <host> <baseAddresses> <add baseAddress=""/> </baseAddresses> </host> <!-- Define NetMsmqEndpoint --> <endpoint address="net.msmq://localhost/private/ServiceModelSamplesMessageSecurity" binding="netMsmqBinding" bindingConfiguration="messageSecurityBinding" contract="Microsoft.ServiceModel.Samples.IOrderProcessor" /> <!-- The mex endpoint is exposed at. --> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <bindings> <netMsmqBinding> <binding name="messageSecurityBinding"> <security mode="Message"> <message clientCredentialType="Certificate" /> </security> </binding> </netMsmqBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="PurchaseOrderServiceBehavior"> <serviceMetadata httpGetEnabled="True"/> <!-- The serviceCredentials behavior allows one" /> <clientCertificate> <certificate findValue="client.com" storeLocation="LocalMachine"" /> </clientCertificate> </serviceCredentials> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration> The sample demonstrates controlling authentication using configuration, and how to obtain the caller’s identity from the security context, as shown in the following sample code: // Service class which implements the service contract. // Added code to write output to the console window. public class OrderProcessorService : IOrderProcessor { private string GetCallerIdentity() { // The client certificate is not mapped to a Windows identity by default. // ServiceSecurityContext.PrimaryIdentity is populated based on the information // in the certificate that the client used to authenticate itself to the service. return ServiceSecurityContext.Current.PrimaryIdentity.Name; } [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)] public void SubmitPurchaseOrder(PurchaseOrder po) { Console.WriteLine("Client's Identity {0} ", GetCallerIdentity()); Orders.Add(po); Console.WriteLine("Processing {0} ", po); } //… } When run, the service code displays the client identification. The following is a sample output from the service code: The service is ready. Press <ENTER> to terminate service. Client's Identity CN=client.com; ECA6629A3C695D01832D77EEE836E04891DE9D3C Processing Purchase Order: 6536e097-da96-4773-9da3-77bab4345b5d Customer: somecustomer.com OrderDetails Order LineItem: 54 of Blue Widget @unit price: $29.99 Order LineItem: 890 of Red Widget @unit price: $45.89 Total cost of this order: $42461.56 Order status: Pending Creating the client certificate. The following line in the batch file creates the client certificate. The client name specified is used in the subject name of the certificate created. The certificate is stored in Mystore at the CurrentUserstore location. echo ************ echo making client cert echo ************ makecert.exe -sr CurrentUser -ss MY -a sha1 -n CN=%CLIENT_NAME% -sky exchange -pe Installing the client certificate into server’s trusted certificate store. The following line in the batch file copies the client certificate into the server's TrustedPeople store so that the server can make the relevant trust or no-trust decisions. For a certificate installed in the TrustedPeople store to be trusted by a Windows Communication Foundation (WCF) service, the client certificate validation mode must be set to PeerOrChainTrustor PeerTrustvalue. See the previous service configuration sample to learn how this can be done using a configuration file. echo ************ echo copying client cert to server's LocalMachine store echo ************ certmgr.exe -add -r CurrentUser -s My -c -n %CLIENT_NAME% -r LocalMachine -s TrustedPeople Creating the server certificate. The following lines from the Setup.bat batch file create the server certificate to be used: echo ************ echo Server cert setup starting echo %SERVER_NAME% echo ************ echo making server cert echo ************ makecert.exe -sr LocalMachine -ss MY -a sha1 -n CN=%SERVER_NAME% -sky exchange -pe The %SERVER_NAME% variable specifies the server name. The certificate is stored in the LocalMachine store. If the setup batch file is run with an argument of service (such as, setup.bat service) the %SERVER_NAME% contains the fully-qualified domain name of the computer.Otherwise it defaults to localhost Installing Note If you are using a non-U.S. English edition of Microsoft Windows you must edit the Setup.bat file and replace the "NT AUTHORITY\NETWORK SERVICE" account name with your regional equivalent.\Binding\Net\MSMQ\MessageSecurity
https://docs.microsoft.com/de-de/dotnet/framework/wcf/samples/message-security-over-message-queuing
CC-MAIN-2017-43
en
refinedweb
sys_sem.h man page Prolog This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. sys/sem.h — XSI semaphore facility Synopsis #include <sys/sem.h> Description. Application Usage None. Rationale None. Future Directions None. See Also <sys_ipc.h>, <sys_types.h> The System Interfaces volume of POSIX.1-2008, semctl(), semget(), sem semctl(3p), semget(3p), semop(3p).
https://www.mankier.com/0p/sys_sem.h
CC-MAIN-2017-43
en
refinedweb
Absolutely great !!! I hope soon many servers using VAS will adopt this mod, as it will improve soooo much preparation phase before the missions :D Well done !!!! Total comments : 1, displayed on page: 1 #include "VAS\menu.hpp" class CfgFunctions { #include "VAS\cfgfunctions.hpp" }; this addAction["<t color='#ff1111'>Virtual Ammobox</t>", "VAS\open!
http://www.armaholic.com/page.php?id=25859
CC-MAIN-2017-43
en
refinedweb
CodePlexProject Hosting for Open Source Software Hi All, I have a view which is loaded from a module using prism (set to onDemand). When I close the form with an X on the top left the following method i wrote is invoked.. public void CloseCommand(object Object) { IRegion region = regionManager.Regions[RegionNames.MainRegion]; Control viewToLoad = region.GetView(viewName) as Control; region.Remove(viewToLoad); } While this successfully removes the view from the region manager it does not remove it from memory. The DeConstructor on my view is never called. In fact if i open and close the view several times i can see new objects are being created and memory keeps going up. The view is a added to a grid in my shell project.. <Grid x: I suspect the view should also be removed from this grid but i do not know how to access the grid from the calling view.. Whats the best way to correctly remove views from memory to avoid this problem? Hi, Thanks for reporting that, since it might help to users with similar scenarios. The approach that you used for removing the view seems to be correct. you to try adding a button (in the toolbar of your app) keeps a reference of your views (e.g. your region). Please take into account that this is just a test. After this test, you have to remove this from your application. If you continue experiencing this situation, could you send a repro sample?. I hope this help. Fernando Antivero I think it is the Grid object (my region) which is keeping ahold of the object. I believe I have solved it now by creating a GridAdaptor which can add and remove objects from the grid. 1) In Bootstraper.cs I added RegionAdapterMappings mappings = base.ConfigureRegionAdapterMappings(); mappings.RegisterMapping(typeof(Grid), Container.Resolve<GridRegionAdapter>()); return mappings; 2) In GridRegionAdaptor.cs I added code to handle the added and remove of views using System; using System.Collections.Specialized; using System.Windows; using System.Windows.Controls; using Microsoft.Practices.Prism.Regions; namespace Infor.Common.RegionAdapters { /// <summary> /// Used to Assist in Selecting Rows in the Dual List Exchange. /// </summary> public class GridRegionAdapter : RegionAdapterBase<Grid> { /// <summary> /// Initializes a new instance of <see cref="GridRegionAdapter"/>. /// </summary> /// <param name="regionBehaviorFactory">The factory used to create the region behaviors to attach to the created regions.</param> public GridRegionAdapter(IRegionBehaviorFactory behaviorFactory) : base(behaviorFactory) { } /// <summary> /// Adapts a <see cref="Grid"/> to an <see cref="IRegion"/>. /// </summary> /// <param name="region">The new region being used.</param> /// <param name="regionTarget">The object to adapt.</param> protected override void Adapt(IRegion region, Grid regionTarget) { region.Views.CollectionChanged += (s, e) => { //Add if (e.Action == NotifyCollectionChangedAction.Add) { foreach (FrameworkElement element in e.NewItems) { regionTarget.Children.Add(element); } } //Removal if (e.Action == NotifyCollectionChangedAction.Remove) { // regionTarget.Children.Remove(element); foreach (FrameworkElement element in e.OldItems) { regionTarget.Children.Remove(element); } } }; } /// <summary> /// Creates a new instance of <see cref="Region"/>. /// </summary> /// <returns>A new instance of <see cref="Region"/>.</returns> protected override IRegion CreateRegion() { return new Region(); } } } After implementing this memory goes down and the deconstructor is called for my view.. HTH Others.. Thanks From: fantivero [mailto:notifications@codeplex.com] Sent: Wednesday, September 29, 2010 1:33 PM To: Tim James McConechy Subject: Re: How to Remove A View From Memory When Closed. [CompositeWPF:229036] From: fantivero to you to try adding a button (in the toolbar of your app) is keeping a reference of your views (e.g. your region). If you continue experiencing this situation, you could send a repro sample of your scenario. Fernando Antivero for sharing your findings with the rest of the community, since it is really valuable. Nice to see that you solved this scenario. Hi Fernando, I have the same GridRegionAdapter in my application. The way I handle swithcing views in a region is using RequestNavigate (which implies I'm using MEF). Problem is the grid region adapter doesnt seem to get called for "Remove" action because I never call the region.Remove(view) and it piles up views on top of each other. I thought this should have been handled by the RegionManager.RequestNavigate. I have my views decorated with [RegionMemberLifetime(KeepAlive = false)] which ideally should have invoked the remove action when navigated away from. Is my understanding incorrect or should I be explicitly calling a region.Remove to invoke the Remove action so that my GridRegionAdapter captures it? Thanks. Hi fernando, I found the solution myself. I changed the following protected override IRegion CreateRegion() { return new Region(); } to protected override IRegion CreateRegion() { return new SingleActiveRegion(); } and it works well now. Are you sure you want to delete this post? You will not be able to recover it later. Are you sure you want to delete this thread? You will not be able to recover it later.
https://compositewpf.codeplex.com/discussions/229036
CC-MAIN-2017-43
en
refinedweb
How to create Qt apps (VS2008) ? Hi everyone, nice weekend! I am newcomer with Qt, I follow "tutorial": to set up developing environment for Qt, However, at the end of guide, author wasn't described how to create Qt4 projects in Visual Studio 2008, I try to create Win32 project to store Qt coding but compiling fail: @ #include <QApplication> #include <QLabel> int main(int argc, char *argv[]) { QApplication app(argc, argv); QLabel *label = new QLabel("Hello Qt"); label->show(); return app.exec(); } @ !! Any idea, thanks! - leon.anavi You have received and error that QApplication cannot be find. Have you configured Qt include path and dependencies for linking? Yup, go to your projects properties and add this to C/C++ > General > Additional Include Directories: $(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui; I would suggest to set up an environment variable QTDIR, which points to the Qt install root directory, on your system. Otherwise, you have to replace the "$(QTDIR)" parts with the path to your Qt install directory. Also note that you have to restart VisualStudio after setting up an new environment variable... - favoritas37 Have you installed the "Visual Studio Add-In for Qt":? Careful though, it doesn't work for Visual Studio Express Version. After you install it, inside Visual Studio go to Qt->Qt Options and select the Qt SDK installed that you are about to use and you should be ready to successfully compile any Qt project. Generally you can either create a new Qt project from the File-> New-> Project-> Qt4 Projects-> Qt Console Application. Or import an already existing Qt project by Qt-> Open Qt Project File (.pro). Edit: just saw that the link that you posted has instruction on how to build the Qt. You don't have to do that. Go download directly the Qt SDK setup file from. It's first time I've listened about VS add-in, I was corrected problem. Thanks favoritas37, thanks everyone.
https://forum.qt.io/topic/16702/how-to-create-qt-apps-vs2008
CC-MAIN-2017-43
en
refinedweb