Try out our Premium Member services: Virtual Legal Assistant, Query Alert Service and an ad-free experience. Free for one month and pay only if you like it.
THE HONOURABLE SRI JUSTICE M.SEETHARAMA MURTI WRIT PETITION No.8203 of 2011 08-02-2016 M/s. Aurobindo Pharma Limited Petitioner Hyderabad Metropolitan Water Supply and Sewerage Board and another......Respondents Counsel for the petitioner:Sri Vikram Poosarla, Advocate Counsel for the Respondents:Sri T.Sudhakar Reddy Standing Counsel for the 1st respondent. <Gist : >Head Note: ?Cases Referred: THE HONBLE SRI JUSTICE M.SEETHARAMA MURTI WRIT PETITION No.8203 of 2011 ORDER:
The relief sought for by the writ petitioner in this writ petition is to declare that the levy and the collection of the sewerage cess by the respondents in the monthly bill of the petitioners unit is illegal, arbitrary and contrary to the provisions of the Hyderabad Metropolitan Water Supply and Sewerage Act, 1989 (the Act, for brevity).
2. I have heard the submissions of the learned counsel for the writ petitioner and the learned standing counsel appearing for the 1st respondent-HMWS & SB. I have perused the material record.
3. The learned counsel for the writ petitioner would submit that since the first respondent had not laid any sewerage line to the premises of the petitioners unit and as the petitioners premises is not directly connected to any sewerage system of the first respondent, the respondents are not entitled to collect the sewerage cess from the petitioner; the petitioner is carrying the effluents from its unit by tankers to Patancheru Enviro-Tech Limited (PETL, for brevity) for further treatment and discharge of the effluents; the first respondent is collecting sewerage cess from PETL as per the terms of the Memorandum of Understanding dated 03.08.2002 between the PETL and the first respondent; under a separate agreement dated 11.10.2011 with PETL, the petitioner is paying charges that are being levied by PETL; therefore, consequential collection of sewerage cess from the petitioners unit by the respondents would amount to double taxation.
4. The learned standing counsel for the first respondent would submit that whether directly or indirectly, when the effluents are being let out into the sewerage lines of the 1st respondent Board, the Board is entitled to levy and collect the sewerage cess and that in the case on hand, the petitioner-company is carrying its effluents to PETL by tankers and that PETL is treating the effluents to certain level, and that such partly treated effluents are being let out by PETL into the sewerage system of the first respondent Board for carrying the same to the plant of the first respondent Board at Amberpet and that the PETL, before letting out the effluents into the main sewerage system of the respondent Board, would treat the effluents to bring down the contents of the effluents to some tolerable limits and that the plant of the first respondent Board at Amberpet is further treating the effluents so as to bring down the industrial effluents to the permissible limits and that the cess is being collected not only for using the sewerage lines but also for defraying the capital cost of the sewerage and sewerage treatment work being undertaken by the Board and for the operation and maintenance of the sewerage system from time to time and that therefore, the Board is justified in levying and collecting the sewerage cess on the petitioners unit. He would further submit that the subject matter of this writ petition is covered by an order dated 29.10.2003 passed by the Division Bench of this Court in W.P.No.4917 of 2000 and batch and also the order dated 25.06.2014 of a learned Single Judge of this Court passed in W.P.No.20117 of 2011 filed by the petitioner herein, wherein, the issue of non-laying of the sewerage line to the pharmaceutical units had also fallen for consideration.
5. I have gone through the pleadings, the additional and the reply pleadings of the writ petitioner and the counter affidavits of respondents 1 and 2. I have gone through the material record.
6. In W.P.No.4917 of 2000, a Division Bench of this Court, while disposing of the said writ petition by order dated 29.10.2003, observed as follows:-
The main contention of the petitioner is that there is no sewerage line of the Board connecting the petitioner premises to any sewerage system of the Board. No doubt, it is an admitted fact that there is no sewerage line of the Board working connecting the petitioners premises to the sewerage system of the Board, but the industrial effluents are being carried to J.E.T.L. and after treating the industrial effluents to certain extent, the effluents from J.E.T.L. are being carried to the sewerage treatment plant at Amberpet which is admittedly under the control of the Board. So, from J.E.T.L., to the Amberpet sewerage treatment plant, there is a 1000 diameter pipeline connecting these two treatment plants. The former is being run by the Industries in and around the Jeedimetla Industrial Estate and the latter is being under the control of the Board. Though the petitioner is not directly using the sewerage line of the Board, but after immediately treated the effluents at J.E.T.L. the sewerage line of the Board is being used to bring the effluents to the permissible limits.
The word Sewer is defined under Section 2 (o) of the Act, as meaning a closed conduct for carrying off sewage, sullage, rain water, polluted water, waste water or sub-soil water.
So, from the above definition it is clear that sewerage line between J.E.T.L. and Amberpet plant belongs to the Board is also Sewer within the meaning of the Act, because effluents of the petitioner company are being carried through this line.
It is an admitted fact that the industrial effluents of the petitioner were being carried to J.E.T.L. in closed tankers and after treatment there to some extent they are let into the Boards sewer. Therefore, the contention that the petitioner has not been provided with sewer line directly from the petitioners premises is only untenable and devoid of merits. If really the effluents of the petitioner-company are being treated at J.E.T.L. alone without further being treated at the Amberpet plant of the Board to bring the effluents within the permissible level, certainly the Board is not entitled to issue any demand notice to pay sewerage cess.
With regard to the double payment of sewerage cess if petitioner proves that he is paying sewerage cess to the J.E.T.L. and also to the Board then it can be said that it would be a double payment for the single act, which is not normally allowed under law. Therefore, it must be shown by the petitioner that he is paying sewerage cess to the J.E.T.L. as well as the Board for the industrial waste let out by the petitioner company.
A specific plea has been taken by the Board that the payments made by the petitioner-company to J.E.T.L. are for treating the effluents to being it to acceptable quality for transmission through the Boards C.O.S. system but not for sewer purpose. Further there is no material filed by the petitioner company to show that the petitioner-company is paying sewerage cess to the J.E.T.L.or that the J.E.T.L. in turn is paying sewerage cess to the Board for using the pipe line from Jeedimetla to Amberpet. Even the letter dated 06.11.1998 addressed by the petitioner to the Board would indicate that the J.E.T.L. is charging them for treatment purpose. The treatment of industrial effluents to bring down the contents to some tolerable limits is one thing and transmission of those contents through the sewerage system of the Board is another thing. Therefore, whatever J.E.T.L. is charging the industrialists is only for treating the effluents to bring them to the acceptable quality for transmission through the sewerage system. Even assuming for a moment that the petitioner-company is paying some amounts to the J.E.T.L., it cannot be said that it is towards sewerage cess..
(Reproduced verbatim)
7. In the aforementioned two decisions, this Court considered both the contentions of the writ petitioners. While distinguishing the reported cases on facts of the present case, the learned counsel for the writ petitioner would contend as follows: In the case on hand, it was shown that PETL is paying sewerage cess to the first respondent Board and that the writ petitioner is paying the charges to the PETL. However, in the aforementioned cited cases, which were earlier decided by a Division Bench and a learned Single Judge of this Court, the above-mentioned facts, which are established in the present case, were not established. Therefore, the cited decisions are distinguishable on the established facts of the present case. The payments that are being made by the petitioner to PETL, which are established, would absolve the petitioner of the liability to once again pay the sewerage cess to the first respondent Board. In the facts and circumstances of the present case, any further levy and collection of the sewerage cess by the Board would amount to double taxation. In regard to these submissions, what is to be noted is that admittedly, there is no sewerage line connecting the petitioners unit to the sewerage system of the Board and therefore, the effluents are being carried to PETL from the petitioners unit by tankers; however, after treating such effluents at PETL to a certain tolerable limits, such partly treated effluents are being let out by the PETL into the sewerage system of the Board and the same are being carried through the sewerage system of the first respondent Board to the sewerage plant of the first respondent Board at Amberpet, which is admittedly under the control of the Board. From PETL to the first respondents plant at Amberpet, there is a pipeline connecting these two treatment plants. The PETL is a central treatment plant being run by the industrialists or the industries in and around Patancheru and the plant at Amberpet is under the control of the first respondent Board. Though the petitioners unit is not directly using the sewerage line of the first respondent Board to carry the effluents of its unit, nevertheless, the effluents that are being carried to PETL from the petitioners unit by tankers are being treated partly to certain level at PETL; further, the sewerage line of the first respondent Board is being used to carry such partly treated effluents from PETL to the treatment plant of the 1st respondent Board at Amberpet. Therefore, the contention of the writ petitioner that the 1st respondent Board is not entitled to levy and collect the cess as the petitioners unit is not directly connected to any sewerage line/system of the Board appears to be untenable.
8. Further, the specific contention of the first respondent Board is that the payments that are being made by the petitioner company to PETL are for treating the effluents of the petitioners unit at PETL to bring them to acceptable quality for transmission through the first respondent Boards central sewerage system, but not for sewerage purpose. In the facts and circumstances of the case, the contention that PETL is collecting the charges towards the sewerage cess from the petitioners unit and that PETL in its turn is paying the sewerage cess to the first respondent Board is not a ground to hold that the 1st respondent Board is not entitled to levy and collect sewerage cess from the petitioners unit as there is no material on record to accept the contention that the petitioner company is paying any amount towards sewerage cess to PETL. The copies of the two agreements filed by the petitioner are on record. One agreement dated 11.10.2011 was between PETL and the petitioner company and under it the scope of service to be provided by PETL is limited to treatment of liquid waste of the petitioners unit at the central effluent treatment plant. The other is a Memorandum of Understanding dated 03.08.2002 between the 1st respondent Board and PETL for treating the effluents to an acceptable quality for transmission through the first respondent Boards sewerage system to Amberpet plant from PETL. The material record would only indicate that the PETL is charging the petitioners unit for treatment of the effluents of its unit for the purpose of bringing down the effluents to certain tolerable limits before letting out the effluents into the central sewerage system of the Board for being carried to the Amberpet Plant of the Board. Therefore, the contention of the learned counsel for the petitioner that PETL is collecting certain amounts towards sewerage charges from the petitioners unit cannot be countenanced. The contention of the learned counsel for the petitioner based on the terms of the MOU to the effect that the rate of sewerage charges is subject to increase, time to time depending upon the maintenance expenditure incurred by the HMWS & SB in transmitting, treating and disposing the sewerage and other effluents collected within the sewerage system and also added into the sewerage system of HMWS & SB and that PETL, Patancheru agrees to accept the rate as such, either increased or varied time to time, finalized and informed by HMWS & SB and to pay the sewerage charges accordingly every month regularly to HMWS & SB is not going to advance the case of the writ petitioner for the reason that the petitioner is not contributing any amount towards the sewerage charges but is only paying to the PETL, as already noted, certain charges towards the treatment of the effluents by PETL to certain level at Patancheru plaint. Further, a plain reading of the Section 55 of the Hyderabad Metropolitan Water Supply & Sewerage Act, 1989, which deals with the charges towards use of sewerage cess, would show that it contemplates that every occupier of both domestic and non domestic premises shall pay to the Board at the prescribed rate, the sewerage cess to defray the capital cost of sewerage and sewerage treatment works undertaken by the Board and the operation and maintenance of the sewerage system from time to time. The proviso to the said section also states that no such charges shall be levied on any premises situated in the areas which are not served by the sewerage system of the Board. In the case on hand, the PETL is treating the effluents of the petitioners unit to certain tolerable limits and is letting out such partly treated effluents into the sewerage system of the first respondent Board for further transmission to the Boards Amberpet plant for treating the same to permissible limits in accordance with the provisions of the Prevention and Control of Pollution Act, 1974. Therefore, it cannot be said that the petitioners unit is not being served with the sewerage system of the Board. Since the partly treated effluents of the petitioners unit are ultimately joining the sewerage system of the Board and are being eventually treated at the sewerage treatment plant of the Board, though the effluents of the petitioners unit are not being directly let into the sewerage mains of the 1st respondent Board, the fact that the petitioners unit is being served by the sewerage system of the Board is undeniable. Therefore, the fact that the 1st respondent had not laid any sewerage line directly to the premises of the petitioners unit would not disable the first respondent Board from levying sewerage cess on the petitioner.
9. In W.P.no.20117 of 2011 earlier filed by this writ petitioner, this Court having followed the ratio in the order dated 29.10.2003 passed by the Division Bench of this Court in W.P.No.4917 of 2000 and batch, had also held as follows:
It is evident, therefore, that failure to lay a sewerage line would not disable the HMWS & SB from levying the sewerage cess on the petitioner herein.
10. On careful consideration of the ratio in the order of the Division Bench of this Court in the aforementioned writ petition and the order of the learned Single Judge in the earlier writ petition filed by the petitioner herein and also the facts of the case and on an analysis of the aforesaid facts and reasons, this Court finds that the two contentions now raised by the learned counsel for the petitioner are already examined and are negatived and that there are no new vital facts brought to the notice of this Court to examine afresh the said two contentions. Hence, this Court finds that the writ petition is liable for dismissal.
11. Before parting with the case, it is necessary to deal with one more contention of the learned Standing Counsel. It is urged that though the petitioner had filed a writ petition in W.P.No.20117 of 2011 before this Court for the same relief and the said writ petition was dismissed by order dated 25.06.2014 following the ratio laid down by a Division Bench of this Court in W.P.No.4917 of 2000 and batch, that fact was not mentioned in any of the pleadings including the additional and reply pleadings of the writ petitioner and that the said vital fact was thus suppressed and that, therefore, on that ground of suppression of material facts, this writ petition is liable for dismissal.
12. In reply, the learned counsel for the writ petitioner would submit that when similar sewerage cess was levied in April 2009 on a different unit of the petitioner company, they have approached this Court by way of W.P.no.1066 of 2009 challenging the said levy and that the pendency of the said writ petition and the interim direction that was granted in a miscellaneous petition filed in the said writ petition, are stated in the present writ petition and that the other writ petition in W.P.No.20117 of 2011 was filed on 15.07.2011, i.e., after filing of the present writ petition in March 2011 and that the said writ petition was disposed of on 25.06.2014 and that by oversight or for some genuine reason, the dismissal of the other writ petition is not stated in the petitioners reply affidavit filed in February 2016 and that therefore, the same cannot be viewed as wanton suppression of a material fact. In the well considered view of this Court, no valid explanation is forthcoming from the petitioner for not mentioning about the dismissal of the W.P.no.20117 of 2011 in the reply affidavit filed in February 2016 and not bringing the said fact to the notice of this Court till the 1st respondent made a mention of the same by filing a copy of the order of this Court in the said writ petition. In the absence of valid explanation for not mentioning about the aforementioned facts, the present writ petition is liable to be dismissed as the remedy under Article 226 of the Constitution of India is an equitable one and suppression of a material fact disentitles the writ petitioner to such a relief.
13. Having regard to the reasons, this Court finds that the writ petition is liable to be dismissed. Accordingly, the writ petition is dismissed. There shall be no order as to costs.
Miscellaneous petitions pending, if any, in this writ petition shall stand closed.
_____________________ M.Seetharama Murti, J 08th February, 2016


I'm a second year at UC Berkeley studying biology and computer science, and I recently got the courage to start dipping my toes in design! I'm passionate about human health, technology, art, and all the ways that these worlds intertwine with each other.
An amateur graphic design artist on the pursuit of new and improved skills! I'm interested in learning UI/UX design and user interface. I'm still building my portfolio, but here are some of my personal projects!
Learn MoreExperienced with Java, Python, SQL, Scheme, HTML, MATLAB, and I am currently learning Swift! Check out some of my coding projects!
Learn MoreAn undergraduate researcher with experience at the Fischer Lab in the Genetics and Plant Biology department at UC Berkeley as well as the Singapore Immunology Network.
Learn More


How many integers $m$ and $n$ are there such that $m+n=mn$?
Due Wednesday, March 29 at midnight submitted to this Google form. You must be logged into your NAU gmail to submit via this form. If you are having trouble with the form, feel free to email a solution to Rachel.Neville@nau.edu


Workbench interface: Tutorial section
The tutorial content area has multiple pages.
Every page has content in the Tutorial tab, with some pages also a Code Snippets tab.
Tutorial tab
You are reading this from the Tutorial tab.
- The tutorial is split into easily digestible, page-size chunks.
- Depending on your window size, you may need to scroll down to see the whole page.
- To move from page to page:
-
Click the or icons above
-
Drag the slider for random access to any page
-
Press the ← or → keys on your keyboard
(note however that these keys are blocked when a text field has the focus)
Code Snippets tab
This tab contains code snippets for cutting-and-pasting and only appears when the current tutorial page has such content.


Loading game...
Hint: Hover square to see that name...
Hint: Hover square to see that name...
Hide purchased researches:
Save
Hard Reset
Export
Import
Liquids - made by
MrRedShark77
in
JAM summer 2021
Supported files:
Element.js by
Jacorb90
break_eternity.js
by
Patashu
You have
X
kWs
(
X
kWs/s)
Hint: Hover square to see that name...
You have
of Gemstone
Convert into
Gems
You have
unspent Gems (
total)
Distribute all Gems
Respec all Gems


Built for Code
Ace is an embeddable code editor written in JavaScript. It matches the features and performance of native editors such as Sublime, Vim and TextMate. It can be easily embedded in any web page and JavaScript application. Ace is maintained as the primary editor for Cloud9 IDE and is the successor of the Mozilla Skywriter (Bespin) project.
/** * In fact, you're looking at ACE right now. Go ahead and play with it! * * We are currently showing off the JavaScript mode. ACE has support for 45 * language modes and 24 color themes! */ function add(x, y) { var resultString = "Hello, ACE! The result of your math is: "; var result = x + y; return resultString + result; } var addResult = add(3, 2); console.log(addResult);
Learn how to embed this in your own site
Looking for a more full-featured demo? Check out the kitchen sink.
Features
- Syntax highlighting for over 110 languages (TextMate/Sublime Text.tmlanguage files can be imported)
- Over 20 themes (TextMate/Sublime Text .tmtheme files can be imported)
- Automatic indent and outdent
- An optional command line
- Handles huge documents (four million lines seems to be the limit!)
- Fully customizable key bindings including vim and Emacs modes
- Search and replace with regular expressions
- Highlight matching parentheses
- Toggle between soft tabs and real tabs
- Displays hidden characters
- Drag and drop text using the mouse
- Line wrapping
- Code folding
- Multiple cursors and selections
- Live syntax checker (currently JavaScript/CoffeeScript/CSS/XQuery)
- Cut, copy, and paste functionality
Get the Open-Source Code
Ace is a community project. We actively encourage and support contributions! The Ace source code is hosted on GitHub and released under the BSD license ‐ very simple and friendly to all kinds of projects, whether open-source or not. Take charge of your editor and add your favorite language highlighting and keybindings!
git clone git://github.com/ajaxorg/ace.git
History
Skywriter/Bespin and Ace started as two independent projects both aiming to build a no compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the <canvas> tag, while Ace is the editor component of Cloud9 IDE and uses the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace now, which supersedes Skywriter. Both Cloud9 IDE and Mozilla are actively developing and maintaining Ace.
Related Projects
Getting Help
Embedding Ace in Your Site
Ace can be easily embedded into a web page. Get prebuilt version of ace from ace-builds repository and use the code below:
<!DOCTYPE html>   <title>ACE in Action</title>
function foo(items) { var x = "All this is syntax highlighted"; return x; }

Now check out the How-To Guide for instructions on common operations, such as setting a different language mode or getting the contents from the editor.
Loading Ace from a Local URL
If you want to clone and host Ace locally you can
use one of the pre-packaged versions. Just copy
one of src*
subdirectories somewhere into your project, or use RequireJS to load the
contents of lib/ace folder as ace
:
Loading Ace from a CDN
The packaged version can also be loaded from CDN's such as jsDelivr or cdnjs.
Working with Ace
In all of these examples Ace has been invoked as shown in the embedding guide.
Configuring the editor
there are several ways to pass configuration to Ace
// pass options to ace.edit
ace.edit(element, {
mode: "ace/mode/javascript",
selectionStyle: "text"
})
// use setOptions method to set several options at once
editor.setOptions({
autoScrollEditorIntoView: true,
copyWithEmptySelection: true,
});
// use setOptions method
editor.setOption("mergeUndoDeltas", "always");
// some options are also available as methods e.g.
editor.setTheme(...)
// to get the value of the option use
editor.getOption("optionName");
See Configuring-Ace wiki page for a more detailed list of options.
Changing the size of the editor
Ace only checks for changes of the size of it's container when window is resized. If you resize the editor div in another manner, and need Ace to resize, use the following:
editor.resize()
if you want editor to change it's size based on contents, use maxLines option as shown in https://ace.c9.io/demo/autoresize.html
Setting Themes
Themes are loaded on demand; all you have to do is pass the string name:
editor.setTheme("ace/theme/twilight");
See all themes. Or use themelist extension to get the list of available themes at runtime.
Setting the Programming Language Mode
By default, the editor supports plain text mode. All other language modes are available as separate modules, loaded on demand like this:
editor.session.setMode("ace/mode/javascript");
One Editor, Multiple Sessions
Ace keeps everything about the state of the editor (selection, scroll position, etc.)
in editor.session
. This means you can grab the
session, store it in a var, and set the editor to another session (e.g. a tabbed editor).
You might accomplish this like so:
var js = ace.createEditSession("some js code");
var css = ace.createEditSession(["some", "css", "code here"]);
// and then to load document into editor, just call
editor.setSession(js);
Common Operations
Set and get content:
editor.setValue("the new text here");
editor.setValue("text2", -1); // set value and move cursor to the start of the text
editor.session.setValue("the new text here"); // set value and reset undo history
editor.getValue(); // or session.getValue
Get selected text:
editor.getSelectedText(); // or for a specific range
editor.session.getTextRange(editor.getSelectionRange());
Insert at cursor, emulating user input:
editor.insert("Something cool");
Replace text in range:
editor.session.replace(new ace.Range(0, 0, 1, 1), "new text");
Get the current cursor line and column:
editor.selection.getCursor();
Go to a line:
editor.gotoLine(lineNumber);
Get total number of lines:
editor.session.getLength();
Set the default tab size:
editor.session.setTabSize(4);
Use soft tabs:
editor.session.setUseSoftTabs(true);
Set the font size:
document.getElementById('editor').style.fontSize='12px';
Toggle word wrapping:
editor.session.setUseWrapMode(true);
Set line highlighting:
editor.setHighlightActiveLine(false);
Set the print margin visibility:
editor.setShowPrintMargin(false);
Set the editor to read-only:
editor.setReadOnly(true); // false to make it editable
Using undo manager
To group undo delta of the next edit with the previous one set `mergeUndoDeltas` to true
editor.session.mergeUndoDeltas = true;
editor.session.insert({row: 0, column:0}, Date()+"");
To start new undo group use `markUndoGroup` method
editor.insertSnippet("a$0b");
editor.session.markUndoGroup();
editor.insertSnippet("x$0y");
To disable undo of a an edit in a collaborative editor
var rev = session.$undoManager.startNewGroup(); // start new undo group
... // apply the edit
session.$undoManager.markIgnored(rev); // mark the new group as ignored
To implement undo/redo buttons see https://ace.c9.io/demo/toolbar.html
Searching
editor.find('needle',{
backwards: false,
wrap: false,
caseSensitive: false,
wholeWord: false,
regExp: false
});
editor.findNext();
editor.findPrevious();
The following options are available to you for your search parameters:
-
needle
: The string or regular expression you're looking for -
backwards
: Whether to search backwards from where cursor currently is. Defaults tofalse
. -
wrap
: Whether to wrap the search back to the beginning when it hits the end. Defaults tofalse
. -
caseSensitive
: Whether the search ought to be case-sensitive. Defaults tofalse
. -
wholeWord
: Whether the search matches only on whole words. Defaults tofalse
. -
range
: The Range to search within. Set this tonull
for the whole document -
regExp
: Whether the search is a regular expression or not. Defaults tofalse
. -
start
: The starting Range or cursor position to begin the search -
skipCurrent
: Whether or not to include the current line in the search. Default tofalse
. -
preventScroll
: Whether or not to move the cursor to the next match. Default tofalse
.
Here's how you can perform a replace:
editor.find('foo');
editor.replace('bar');
And here's a replace all:
editor.replaceAll('bar');
(editor.replaceAll
uses the needle set earlier by editor.find('needle', ...
)
Listening to Events
To listen for an onchange
:
editor.session.on('change', function(delta) {
// delta.start, delta.end, delta.lines, delta.action
});
To listen for an selection
change:
editor.session.selection.on('changeSelection', function(e) {
});
To listen for a cursor
change:
editor.session.selection.on('changeCursor', function(e) {
});
Adding New Commands and Keybindings
To assign key bindings to a custom function:
editor.commands.addCommand({
name: 'myCommand',
bindKey: {win: 'Ctrl-M', mac: 'Command-M'},
exec: function(editor) {
//...
},
readOnly: true, // false if this command should not apply in readOnly mode
// multiSelectAction: "forEach", optional way to control behavior with multiple cursors
// scrollIntoView: "cursor", control how cursor is scolled into view after the command
});
Configure dynamic loading of modes and themes
By default ace detcts the url for dynamic loading by finding the script node for ace.js. This doesn't work if ace.js is not loaded with a separate script tag, and in this case it is required to set url explicitely
ace.config.set("basePath", "https://url.to.a/folder/that/contains-ace-modes");
Path for one module alone can be configured with:
ace.config.setModuleUrl("ace/theme/textmate", "url for textmate.js");
When using ace with webpack, it is possible to configure paths for all submodules using
require("ace-builds/esm-resolver"); // for new bundlers: webpack 5, rollup, vite
For webpack 4 use
require("ace-builds/webpack-resolver");
which depends on file-loader
Creating a Syntax Highlighter for Ace
Creating a new syntax highlighter for Ace is extremely simple. You'll need to define two pieces of code: a new mode, and a new set of highlighting rules.
Where to Start
We recommend using the Ace Mode Creator when defining your highlighter. This allows you to inspect your code's tokens, as well as providing a live preview of the syntax highlighter in action.
Defining a Mode
Every language needs a mode. A mode contains the paths to a language's syntax highlighting rules, indentation rules, and code folding rules. Without defining a mode, Ace won't know anything about the finer aspects of your language.
Here is the starter template we'll use to create a new mode:
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
// defines the parent mode
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
// defines the language specific highlighters and folding rules
var MyNewHighlightRules = require("./mynew_highlight_rules").MyNewHighlightRules;
var MyNewFoldMode = require("./folding/mynew").MyNewFoldMode;
var Mode = function() {
// set everything up
this.HighlightRules = MyNewHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new MyNewFoldMode();
};
oop.inherits(Mode, TextMode);
(function() {
// configure comment start/end characters
this.lineCommentStart = "//";
this.blockComment = {start: "/*", end: "*/"};
// special logic for indent/outdent.
// By default ace keeps indentation of previous line
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
// create worker for live syntax checking
this.createWorker = function(session) {
var worker = new WorkerClient(["ace"], "ace/mode/mynew_worker", "NewWorker");
worker.attachToDocument(session.getDocument());
worker.on("errors", function(e) {
session.setAnnotations(e.data);
});
return worker;
};
}).call(Mode.prototype);
exports.Mode = Mode;
});
What's going on here? First, you're defining the path to TextMode
(more on this later). Then you're pointing the mode to your definitions for the highlighting rules, as well as your rules for code folding. Finally, you're setting everything up to find those rules, and exporting the Mode so that it can be consumed. That's it!
Regarding TextMode
, you'll notice that it's only being used once: oop.inherits(Mode, TextMode);
. If your new language depends on the rules of another language, you can choose to inherit the same rules, while expanding on it with your language's own requirements. For example, PHP inherits from HTML, since it can be embedded directly inside .html pages. You can either inherit from TextMode
, or any other existing mode, if it already relates to your language.
All Ace modes can be found in the lib/ace/mode folder.
Defining Syntax Highlighting Rules
The Ace highlighter can be considered to be a state machine. Regular expressions define the tokens for the current state, as well as the transitions into another state. Let's define mynew_highlight_rules.js, which our mode above uses.
All syntax highlighters start off looking something like this:
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var MyNewHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = {
"start" : [
{
token: token, // String, Array, or Function: the CSS token to apply
regex: regex, // String or RegExp: the regexp to match
next: next // [Optional] String: next state to enter
}
]
};
};
oop.inherits(MyNewHighlightRules, TextHighlightRules);
exports.MyNewHighlightRules = MyNewHighlightRules;
});
The token state machine operates on whatever is defined in this.$rules
. The highlighter always begins at the start
state, and progresses down the list, looking for a matching regex
. When one is found, the resulting text is wrapped within a <span class="ace_<token>">
tag, where <token>
is defined as the token
property. Note that all tokens are preceded by the ace_
prefix when they're rendered on the page.
Once again, we're inheriting from TextHighlightRules
here. We could choose to make this any other language set we want, if our new language requires previously defined syntaxes. For more information on extending languages, see "extending Highlighters" below.
Defining Tokens
The Ace highlighting system is heavily inspired by the TextMate language grammar. Most tokens will follow the conventions of TextMate when naming grammars. A thorough (albeit incomplete) list of tokens can be found on the Ace Wiki.
For the complete list of tokens, see tool/tmtheme.js. It is possible to add new token names, but the scope of that knowledge is outside of this document.
Multiple tokens can be applied to the same text by adding dots in the token, e.g. token: support.function
wraps the text in a
tag.
Defining Regular Expressions
Regular expressions can either be a RegExp or String definition
If you're using a regular expression, remember to start and end the line with the /
character, like this:
{
token : "constant.language.escape",
regex : /\$[\w\d]+/
}
A caveat of using stringed regular expressions is that any \
character must be escaped. That means that even an innocuous regular expression like this:
regex: "function\s*\(\w+\)"
Must actually be written like this:
regex: "function\\s*\(\\w+\)"
Groupings
You can also include flat regexps--(var)
--or have matching groups--((a+)(b+))
. There is a strict requirement whereby matching groups must cover the entire matched string; thus, (hel)lo
is invalid. If you want to create a non-matching group, simply start the group with the ?:
predicate; thus, (hel)(?:lo)
is okay. You can, of course, create longer non-matching groups. For example:
{
token : "constant.language.boolean",
regex : /(?:true|false)\b/
},
For flat regular expression matches, token
can be a String, or a Function that takes a single argument (the match) and returns a string token. For example, using a function might look like this:
var colors = lang.arrayToMap(
("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
"purple|red|silver|teal|white|yellow").split("|")
);
var fonts = lang.arrayToMap(
("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" +
"symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" +
"serif|monospace").split("|")
);
...
{
token: function(value) {
if (colors.hasOwnProperty(value.toLowerCase())) {
return "support.constant.color";
}
else if (fonts.hasOwnProperty(value.toLowerCase())) {
return "support.constant.fonts";
}
else {
return "text";
}
},
regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
}
If token
is a function,it should take the same number of arguments as there are groups, and return an array of tokens.
For grouped regular expressions, token
can be a String, in which case all matched groups are given that same token, like this:
{
token: "identifier",
regex: "(\\w+\\s*:)(\\w*)"
}
More commonly, though, token
is an Array (of the same length as the number of groups), whereby matches are given the token of the same alignment as in the match. For a complicated regular expression, like defining a function, that might look something like this:
{
token : ["storage.type", "text", "entity.name.function"],
regex : "(function)(\\s+)([a-zA-Z_][a-zA-Z0-9_]*\\b)"
}
Defining States
The syntax highlighting state machine stays in the start
state, until you define a next
state for it to advance to. At that point, the tokenizer stays in that new state
, until it advances to another state. Afterwards, you should return to the original start
state.
Here's an example:
this.$rules = {
"start" : [ {
token : "text",
regex : "<\\!\\[CDATA\\[",
next : "cdata"
} ],
"cdata" : [ {
token : "text",
regex : "\\]\\]>",
next : "start"
}, {
defaultToken : "text"
} ]
};
In this extremely short sample, we're defining some highlighting rules for when Ace detects a <![CDATA
tag. When one is encountered, the tokenizer moves from start
into the cdata
state. It remains there, applying the text
token to any string it encounters. Finally, when it hits a closing ]>
symbol, it returns to the start
state and continues to tokenize anything else.
Using the TMLanguage Tool
There is a tool that will take an existing tmlanguage file and do its best to convert it into Javascript for Ace to consume. Here's what you need to get started:
- In the Ace repository, navigate to the tools folder.
- Run
npm install
to install required dependencies. - Run
node tmlanguage.js <path_to_tmlanguage_file>
; for example,node <path_to_tmlanguage_file> /Users/Elrond/elven.tmLanguage
Two files are created and placed in lib/ace/mode: one for the language mode, and one for the set of highlight rules. You will still need to add the code into ace/ext/modelist.js, and add a sample file for testing.
A Note on Accuracy
Your .tmlanguage file will then be converted to the best of the converter’s ability. It is an understatement to say that the tool is imperfect. Probably, language mode creation will never be able to be fully autogenerated. There's a list of non-determinable items; for example:
- The use of regular expression lookbehinds
This is a concept that JavaScript simply does not have and needs to be faked - Deciding which state to transition to
While the tool does create new states correctly, it labels them with generic terms likestate_2
,state_10
, e.t.c. - Extending modes
Many modes say something likeinclude source.c
, to mean, “add all the rules in C highlighting.” That syntax does not make sense to Ace or this tool (though of course you can extending existing highlighters). - Rule preference order
- Gathering keywords
Most likely, you’ll need to take keywords from your language file and run them throughcreateKeywordMapper()
However, the tool is an excellent way to get a quick start, if you already possess a tmlanguage file for you language.
Extending Highlighters
Suppose you're working on a LuaPage, PHP embedded in HTML, or a Django template. You'll need to create a syntax highlighter that takes all the rules from the original language (Lua, PHP, or Python) and extends it with some additional identifiers (<?lua
, <?php
, {%
, for example). Ace allows you to easily extend a highlighter using a few helper functions.
Getting Existing Rules
To get the existing syntax highlighting rules for a particular language, use the getRules()
function. For example:
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
this.$rules = new HtmlHighlightRules().getRules();
/*
this.$rules == Same this.$rules as HTML highlighting
*/
Extending a Highlighter
The addRules
method does one thing, and it does one thing well: it adds new rules to an existing rule set, and prefixes any state with a given tag. For example, let's say you've got two sets of rules, defined like this:
this.$rules = {
"start": [ /* ... */ ]
};
var newRules = {
"start": [ /* ... */ ]
}
If you want to incorporate newRules
into this.$rules
, you'd do something like this:
this.addRules(newRules, "new-");
/*
this.$rules = {
"start": [ ... ],
"new-start": [ ... ]
};
*/
Extending Two Highlighters
The last function available to you combines both of these concepts, and it's called embedRules
. It takes three parameters:
- An existing rule set to embed with
- A prefix to apply for each state in the existing rule set
- A set of new states to add
Like addRules
, embedRules
adds on to the existing this.$rules
object.
To explain this visually, let's take a look at the syntax highlighter for Lua pages, which combines all of these concepts:
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
var LuaPageHighlightRules = function() {
this.$rules = new HtmlHighlightRules().getRules();
for (var i in this.$rules) {
this.$rules[i].unshift({
token: "keyword",
regex: "<\\%\\=?",
next: "lua-start"
}, {
token: "keyword",
regex: "<\\?lua\\=?",
next: "lua-start"
});
}
this.embedRules(LuaHighlightRules, "lua-", [
{
token: "keyword",
regex: "\\%>",
next: "start"
},
{
token: "keyword",
regex: "\\?>",
next: "start"
}
]);
};
Here, this.$rules
starts off as a set of HTML highlighting rules. To this set, we add two new checks for <%=
and <?lua=
. We also delegate that if one of these rules are matched, we should move onto the lua-start
state. Next, embedRules
takes the already existing set of LuaHighlightRules
and applies the lua-
prefix to each state there. Finally, it adds two new checks for %>
and ?>
, allowing the state machine to return to start
.
Code Folding
Adding new folding rules to your mode can be a little tricky. First, insert the following lines of code into your mode definition:
var MyFoldMode = require("./folding/newrules").FoldMode;
...
var MyMode = function() {
...
this.foldingRules = new MyFoldMode();
};
You'll be defining your code folding rules into the lib/ace/mode/folding folder. Here's a template that you can use to get started:
define(function(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Range = require("../../range").Range;
var BaseFoldMode = require("./fold_mode").FoldMode;
var FoldMode = exports.FoldMode = function() {};
oop.inherits(FoldMode, BaseFoldMode);
(function() {
// regular expressions that identify starting and stopping points
this.foldingStartMarker;
this.foldingStopMarker;
this.getFoldWidgetRange = function(session, foldStyle, row) {
var line = session.getLine(row);
// test each line, and return a range of segments to collapse
};
}).call(FoldMode.prototype);
});
Just like with TextMode
for syntax highlighting, BaseFoldMode
contains the starting point for code folding logic. foldingStartMarker
defines your opening folding point, while foldingStopMarker
defines the stopping point. For example, for a C-style folding system, these values might look like this:
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
These regular expressions identify various symbols--{
, [
, //
--to pay attention to. getFoldWidgetRange
matches on these regular expressions, and when found, returns the range of relevant folding points. For more information on the Range
object, see the Ace API documentation.
Again, for a C-style folding mechanism, a range to return for the starting fold might look like this:
var line = session.getLine(row);
var match = line.match(this.foldingStartMarker);
if (match) {
var i = match.index;
if (match[1])
return this.openingBracketBlock(session, match[1], row, i);
var range = session.getCommentFoldRange(row, i + match[0].length);
range.end.column -= 2;
return range;
}
Let's say we stumble across the code block hello_world() {
. Our range object here becomes:
{
startRow: 0,
endRow: 0,
startColumn: 0,
endColumn: 13
}
Testing Your Highlighter
The best way to test your tokenizer is to see it live, right? To do that, you'll want to modify the live Ace demo to preview your changes. You can find this file in the root Ace directory with the name kitchen-sink.html.
-
add an entry to
supportedModes
inace/ext/modelist.js
-
add a sample file to
demo/kitchen-sink/docs/
with same name as the mode file
Once you set this up, you should be able to witness a live demonstration of your new highlighter.
Adding Automated Tests
Adding automated tests for a highlighter is trivial so you are not required to do it, but it can help during development.
In lib/ace/mode/_test
create a file named
with some example code. (You can skip this if the document you have added in text_<modeName>.txt
demo/docs
both looks good and covers various edge cases in your language syntax).
Run node highlight_rules_test.js -gen
to preserve current output of your tokenizer in tokens_<modeName>.json
After this running highlight_rules_test.js optionalLanguageName
will compare output of your tokenizer with the correct output you've created.
Any files ending with the _test.js suffix are automatically run by Ace's Travis CI server.
Ace API Reference
Welcome to the Ace API Reference!
On the left, you'll find a list of all of our currently documented classes. These is not a complete set of classes, but rather, the "core" set. For more information on how to work with Ace, check out the embedding guide.
Below is an ERD diagram describing some fundamentals about how the internals of Ace works:
Projects Using Ace
Ace is used all over the web in all kinds of production applications. Here is just a small sampling:


| {{ _transaction.transactionType }} | {{_transaction.contact.label}} | {{_transaction.transactionType == 'sent' ? '- ' : '+ '}} {{ _transaction.transactionAmount + _transaction.transactionFee | coinNotation }} {{ globalService.coinUnit }} | {{ _transaction.transactionTimestamp * 1000 | date:'medium' }} |
You currently have no transactions
You currently have no staking transactions
Please note that your transaction history and balances can only show when you are completely synchronized.


Do you remember that when you added 5 + "six"
, you got an error due to a mismatch in data types? You can avoid such embarrassing situations by checking the data type of a variable beforehand. You can do this with the class()
function, as the code on the right shows.
Complete the code in the editor and also print out the classes of my_character
and my_logical
.
# Declare variables of different types
my_numeric <- 42
my_character <- "universe"
my_logical <- FALSE
# Check class of my_numeric
class(my_numeric)
# Check class of my_character
# Check class of my_logical
# Declare variables of different types:
my_numeric <- 42
my_character <- "universe"
my_logical <- FALSE
# Check class of my_numeric
class(my_numeric)
# Check class of my_character
class(my_character)
# Check class of my_logical
class(my_logical)
msg <- "Do not change the declaration of the variables!"
lapply(c("my_numeric", "my_character", "my_logical"), test_object, undefined_msg = msg, incorrect_msg = msg)
patt <- "Have you included `class(%1$s)` to print out the data type of `%1$s`?"
test_output_contains("class(my_numeric)",
incorrect_msg = "Do not remove the code that prints out the type of `my_numeric`.")
test_output_contains("class(my_character)",
incorrect_msg = sprintf(patt, "my_character"))
test_output_contains("class(my_logical)",
incorrect_msg = sprintf(patt, "my_logical"))
success_msg("Congratulations! This was the last exercise for this chapter. Head over to the next chapter to get immersed in the world of vectors!")
The code that prints the data type of my_numeric
is already included; do similar things for my_character
and my_logical
.


Chandranath Temple located on top of the 350 metres high Chandranath hill, is a famous Shakti Peeth located near Sitakunda in Bangladesh where, as per Hindu sacred texts, the right arm of Goddess Sati fell. Sitakunda Chandranath Temple is a holy place of pilgrimage. There are two idols here, one is of Devi Sati and called as Bhavani. The other idol in this temple is of Lord Shiva Known as the Chandrashekhar. This particular word is depicted for all those individuals who have got a moon at the crown or at the top of their head. As per the belief of many local people, Lord Shiva himself has committed to visit Chandrasekhar Mountain during Kali Yuga. The temple is beautifully made with marble structures and art. The name, Shakti peeth chattal is related to the location of its establishment. A famous town in Bangladesh, Chatgaon is the establishment point of Shakti peeth chattal. This town is also known as chitagaon by the local people in the particular district.


Important: sdfvfds gdsfgd sgggsgfg dfgdfgdf ASDFSDff gv fdc dfgdf gv dfgv vrgt hvr hv tvh tyhvbtyj vt jhvr bh tyvh bvhy rhvv hrfc d
Info: This is information.
Trivia: This is trivial.
Hello, this is a program, this is a /file/fgg-sfdgg/dd.sse, this is a c_symbol, this is an address:9001.


I'm {{ .Site.Params.author }}, a full-time human. At work, I'm a data scientist.
Outside of work, I like hiking, admiring trees, baking bread, and learning.
To learn about some things I've been thinking about or have worked on, check out the blog or software pages.
{{ partial "social.html" . }}


Apple Bloom Company
Waiting for Internet Connection
If you see this screen for more then 10 minutes, you may contact Greenetree LLC for help.


Sir Gustav Athebaldt:
You must hurry to
the Town of Giran
and meet with
Martien
. Do whatever he says, and go prepared!


to see bounty availabilities (this requires a private endpoint that doesn't work otherwise)
Vendor items you should check out
Grouped Bounties & Shopping List
Raid Challenge: {{rc.topic}}
{{rc.name}}
{{rc.desc}}
Lost Sectors
These will be wrong until the new rotation is learned. This message will be removed once they're complete and correct.
Nightfall
0">: {{nightfall.activities[0].desc}}
{{removeActivityPrefixes(n.name)}}
{{n.hash}}
{{n.ll}} {{n.modifiers.length}} modifiers
Strike Playlist Double ranks!
{{n.name}}
{{n.hash}}
Crucible Double ranks!
{{n.name}}
{{n.hash}}
{{today.weeklyDungeon}}
Pinnacle awards once/wk/account. Repeatedly farmable for legendaries.
{{today.weeklyRaid}}
Pinnacle awards once/wk/account. Repeatedly farmable for legendaries.
{{today.wellMode}}
{{today.wellWeapon.itemTypeDisplayName}}
{{today.wellWeapon.displayProperties.name}}
Dreaming City
Curse level rotates weekly
Ascendant Challenge
{{today.week.ascendantChallenge}}
Location
{{today.week.location}}
Curse Strength
{{today.week.curseStrength}}
{{title}}
{{b.name}}
{{v.displayName}} {{v.lastPlayed|d2cAgoHumanized}}


Dedicated professional with 10+ years of experience in Software Development process. Well prepared to undertake any management duties and responsibilities.
Developing a new module for the processing of passports for COLABEN software’s, using PHP, MySQL, HTML5, CCS3, JavaScript, Symfony as backend framework and ExtJS as UI framework all of this using LAMP technologies to get a product able to manage the process defined in the Group.
Supervising members of the Developer Team for performing and implementing properly the standards and techniques previous defined, to ensure the client’s satisfaction.
Performing Black Box and White Box testing methods for validating the products.
Developing small projects using C#.
Designing and developing Requirements.
Monitored the Web Application, Web servers for performance testing related issues in Linux and Windows.
Conducting software compatibility tests with various browsers, operating systems, and hardware.
Performed Database validation by executing PL/SQL queries to extract and validate test data.
Working in different modules such as Administration and Economy.
Analyzed the user requirements specification and scenario to participate in writing Test Plans and Test Cases.
Developing a Web Application using Joomla, PHP, CCS3, HTML, jQuery and PostgreSQL able to manage all statistic information into the company.
Server as a key member of an Engineer Team in charge of provided Informatics services to the company (Hardware and Software)
In charge of the Network Servers (Firewall, Active Directory, Proxy, Web Server, FTP services).
Creating an Informatics Security Plan.
Deploying SIGICEM Web application for provide information about all the electromedical equipment on several provinces and different hospitals of Cuba.
Identifying Users and Security Clearances for confidential information access.
Responsible for the Software Installing process (Operating Systems and required Applications)
Developing intranet Web Site with Wordpress, Bootstrap and MySQL.
Networking manager of Windows Server for GALENLAB Software.
Responsible for the Software Installing process (Operating Systems and required Applications) Windows and Linux.
Developing modules for SUMCEX system for control of passengers to provide documentation and flight reports on time.
Developing new functionalities for SUMCEX according to the customer and troubleshooting.
Users and Security Clearances for confidential information access for SUMCEX Web.
Responsible for the Software Installing process (Operating Systems and required Applications) Windows and Office Suite.
Repairing hardware devices like Laptops, All in One and Desktop Computers.
Conducts component level repair and cleaning.
Testing equipment after repair.
Upgrading hardware and update computers BIOS.
Courses: C#, HTML y CSS, Linux Servers, Advanced Linux, PHP Advanced, Photoshop Advanced, Web Developer Advanced, Bash, Computer Security, Advanced Databases Systems PostgreSQL, “Testing Program” Word, Excel and Power Point.
The project contains is a Rent Rooms Web page on Wordpress with Booking and IMG Gallery.
View ProjectThis project contains is a Monitor for Claymore. It is fully responsive, as well as comes with the Bootstrap grid system and loaded with Font Awesome. The site is not static because use a php side server file to get the data sending a JSON over TCP/IP to the miner.
View Project


Topic Modeling - 🐓¶
Alice’s Adventures in Wonderland [Carroll, 1865] via https://www.gutenberg.org/files/11/11-h/11-h.htm
To start our discussion, we should introduce what Topic Modeling is and how it can be applied.
Note
“Topic modeling is a princpled approach for discovering topics from a large corpus of text documents [Liu, 2020] (pg.159).”
Already, we have few things to unpack. What are topics? How are the defined? Do we define or does the computer? What is a large corpus? How many documents do we need?
Let’s start with a large corpus of text documents. Typically, we would have two documents 📄, five documents 📄, ten million documents 📄, can be thought of as our corpus. Yes, even 1 document 📄 can be used for topic modeling. So, defining, large corpus of text documents, can be subjective.
As specified by Liu [Liu, 2020] we can start this conversation using one of the two basic types of topic modeling. This being probablistic Latent Dirichlet Allocation or Latent Dirichlet Allocation. For our conversation, we will be using Latent Dirichlet Allocation.
Latent Dirichlet Allocation¶
Pronunciation¶
Latent¶
Dirichlet¶
Allocation¶
Our pronoucation stems from a talk by David Blei who is a professor of Statistics and Computer Science at Columbia University during David’s talk “Probabilistic Topic Models and User Behavior [Blei, 2017].” The citation provides a link to original YouTube video (which is a great resource), but specifically, helpful for the pronouciation.
What is Latent Dirichlet Allocation or LDA?¶
LDA is an unsupervised learning model.
Note
Topic Modeling with Documents 📄
supervised - Our documents 📄 are pre-labeled with the given topic(s). We can then train 🏋 and test 🧪 (and also, you can include validate). Usually this is split:
training 🏋 80%
testing 🧪 20%.
unsupervised - Data is not labeled. So, we have no idea what the topics are beforehand. That being said, we can (and will) define the number of topics.
So, coming back to our original questions:
What are topics?
The topics will X number of sets of terms (we define this X) which will (could) have a common theme.
How are they defined?
This is what we will get to in this notebook.
Do we define or does the computer?
LDA is unsupervised, so we define the number of topics. The computer provides the topics themselves.
What is a large corpus? and How many documents do we need?
A bit subjective here. There is a great discussion about this by Tang et al. [Tang et al., 2014] regarding this. If you have chance, read all the points, but to sum it up
The number of documents does matter, but at some point, increasing the number does not warrent better results. Even sampling a 1000 papers from 1000000 papers could result in the same, if not, better results than using 1000000 documents.
The size of the documents also plays a role, so documents should not be short. Larger documents can be sampled and again, receive the same desired output.
¶
from urllib.request import urlopen
from bs4 import BeautifulSoup
url = "https://www.gutenberg.org/files/11/11-h/11-h.htm"
html = urlopen(url).read()
soup = BeautifulSoup(html, features="html.parser")
# kill all script and style elements
for script in soup(["script", "style"]):
script.extract() # rip it out
# get text
text = soup.get_text()
print (type(text))
<class 'str'>
import pandas as pd
import re
import numpy as np
import random
from sklearn.feature_extraction.text import CountVectorizer
textArray = text.lower().split(" ")
print(len(textArray))
documents = []
print (random.choices(["sadf","asdf","Aewrwe"], k = 2))
for i in range(27):
documents.append(" ".join(textArray[i*1000:(i+1)*1000]))
print(documents[10][0:100])
cv = CountVectorizer()
# tokenize and build vocab
df = cv.fit_transform(documents)
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-cea6c4b74d00> in <module>
4 import random
5
----> 6 from sklearn.feature_extraction.text import CountVectorizer
7 textArray = text.lower().split(" ")
8 print(len(textArray))
ModuleNotFoundError: No module named 'sklearn'
from sklearn.decomposition import LatentDirichletAllocation
lda = LatentDirichletAllocation(n_components = 5, random_state = 42)
lda.fit(df)
LatentDirichletAllocation(n_components=5, random_state=42)
for index, topic in enumerate(lda.components_):
print(f'Top 15 words for Topic #{index}')
print([cv.get_feature_names()[i] for i in topic.argsort()[-15:]])
print('\n')
Top 15 words for Topic #0
['at', 'her', 'as', 'that', 'was', 'in', 'you', 'alice', 'said', 'of', 'she', 'it', 'to', 'and', 'the']
Top 15 words for Topic #1
['by', 'works', 'any', 'with', 'work', 'this', 'in', 'and', 'you', 'to', 'project', 'or', 'gutenberg', 'of', 'the']
Top 15 words for Topic #2
['jogged', 'leading', 'blame', 'chanced', 'doze', 'unwillingly', 'interrupt', 'brush', 'offend', 'roots', 'civil', 'personal', 'remarks', 'splashing', 'humbly']
Top 15 words for Topic #3
['jogged', 'leading', 'blame', 'chanced', 'doze', 'unwillingly', 'interrupt', 'brush', 'offend', 'roots', 'civil', 'personal', 'remarks', 'splashing', 'humbly']
Top 15 words for Topic #4
['be', 'that', 'her', 'as', 'in', 'was', 'alice', 'of', 'said', 'you', 'she', 'it', 'to', 'and', 'the']


2 weeks and we are at LABST - 2 weeks more and we will be at CUNTST
just sayin
be carefull
ComputerGenie 👴👴👴26-Jan-19 04:09 AM
kmdkrazy26-Jan-19 04:11 AM
lol - you are smart enough @ComputerGenie 👴👴👴
thats my 2 cents of the week
ComputerGenie 👴👴👴26-Jan-19 04:11 AM
my wife says that if you're "staking" one of those, then you're doing it wrong....
kmdkrazy26-Jan-19 04:11 AM
you got what you paid for
blackjok3r26-Jan-19 04:12 AM
I just stupidly tried to split my utxos
now need to rent a few mega sol to unstick the chain
kmdkrazy26-Jan-19 04:13 AM
if your wifes name is Cindy........get a new one
we have scripts to split UTXOs - get on with the real shit(edited)
UTXOs are old school anyway
love you......my advice was free
1
kmdkrazy26-Jan-19 04:37 AM
"my name is luka"....good night bros(edited)
kmdkrazy26-Jan-19 04:55 AM
KISS = keep it simple dumbass -- i just read back 1 day
if i read back 2 days ------ I will be sorry for my comentary
blackjok3r26-Jan-19 04:57 AM
Pushed fix for usign Stratum to PoW mine while staking. this solves the staking/mining on a single node. As equihash isnt really able to be daemon mined and actually find any coins.
Had to ring my ISp to get a real IP address, they put me behind NAT.... while on hold they had some massive speech about being called Aussie Broadband doesnt mean that people who work there all have an Australkian Accent and racial abuse would not be tolerated.
kmdkrazy26-Jan-19 05:05 AM
deleteted last post because of bed
1
reading back makes @kmdkrazy look dumb.... i will get on that in the AM
late
late = later FYI
blackjok3r26-Jan-19 05:13 AM
catch ya
kmdkrazy26-Jan-19 05:14 AM
stay straight brother.......forever
late
gt26-Jan-19 05:36 AM
labst stuck?
blackjok3r26-Jan-19 05:47 AM
very much so
Ive got 150K/sol on it and found like 1 block
Itr needs stakers... I fucked up... split utxos
dont think I can fix it... wasted $10 on hash
gt26-Jan-19 06:09 AM
why does splitting cause a problem? not enough weight?
blackjok3r26-Jan-19 06:34 AM
they need to be 100 blocks old... however that said., I seems to have unstuck it
it hitting the 382s block time exception every time... but its staking
and I have it mining with stratum onm the same daemon
that took a while
CrisF26-Jan-19 08:05 AM
iguana_dPoWupdate dest.KMD reorg detected 683327 vs 1199549
Wonder how long that was spamming for...
pkill -15 managed to to stop komodod.
Hopefully can restart from there.
blackjok3r26-Jan-19 08:26 AM
That is meaningless
it just emans komodo id syning
1
my notary is synced... LABSt is unstuck
ppl just got to my ghouse for a party... great timing
Pushed as new version to master... dont upgrade unless you need to.. it may have build issues from upstream... Not sure wqhats going on there.
IT built for after a few goes(edited)
NutellaLicka26-Jan-19 08:34 AM
Happy Australia Day
1
1
5
blackjok3r26-Jan-19 09:57 AM
It wouldn't be Australia if ppl didn't fight on Australia day
This has to be the shortest party I've ever been to
NutellaLicka26-Jan-19 10:21 AM
Aha, should I ask what happened
zatJUM26-Jan-19 10:25 AM
Still no LABST nota
blackjok3r26-Jan-19 10:34 AM
Yeah I unstuck the chain but there needs to be more nodes on that chain
@CrisF can u check the curl for best mask
Also check your kmd isn't stuck... If it's not matching explorer for highest block, do reconsiderblock RPC 100 blocks before the block you are on. After updating and restarting
zatJUM26-Jan-19 10:39 AM
1200929 now, seems ok
blackjok3r26-Jan-19 10:39 AM
@NutellaLicka you know when really deubk ppl demand to drive?
In their work car
Had to just let him in the end...
I've been wondering how accurate that's been lately.
Bar_F1sh_Rel26-Jan-19 11:35 AM
I gave up on re-sync and did scp from another of my nodes instead.
blackjok3r26-Jan-19 11:38 AM
Resync took an intense anoimt of time here almost 18h
CrisF26-Jan-19 11:38 AM
That's a good idea, @Bar_F1sh_Rel. Just over 2/3 done now but very slow.
Bar_F1sh_Rel26-Jan-19 11:39 AM
and it gets slower as the percentage increases
gt26-Jan-19 11:39 AM
try bootstrap ?
Bar_F1sh_Rel26-Jan-19 11:40 AM
scp = bootstrap
1
1
blackjok3r26-Jan-19 11:40 AM
Yes
Its slowest at 90% +
Like by miles
I found what the problem was.... But its zcash sapling code and we can't disable it
CrisF26-Jan-19 11:42 AM
@gt Unfortunately, NN doesn't have disk space for the blocks and bootstrap :/
gt26-Jan-19 11:43 AM
ah ha
Bar_F1sh_Rel26-Jan-19 11:47 AM
@CrisF - you have two VM running komodo (NN + other)?
blackjok3r26-Jan-19 11:57 AM
I can do like 4 VM for labs for $5 a month
I rhi k on the same server will be even faster than the same data centre
CrisF26-Jan-19 11:58 AM
Yes, NN + others
Bar_F1sh_Rel26-Jan-19 12:00 PM
With scp - you can just delete `/blocks and /chainstate` folders on the target and then scp those folders from the source (as long as komodo is stopped on both) - shouldn't take that much overhead?(edited)
as there is no uncompress step.
1
CrisF26-Jan-19 12:16 PM
Thanks!
Alright26-Jan-19 12:20 PM
is listunspent broken?
I have a balance on my NN, but listunspent is empty
ComputerGenie 👴👴👴26-Jan-19 12:22 PM
iirc balance includes 0 conf and listunspent doesn't
Bar_F1sh_Rel26-Jan-19 12:23 PM
returns utxo's on my recently re-compiled Labs NN
Alright26-Jan-19 12:23 PM
just imported my key again and it works fine now
1
CrisF26-Jan-19 12:28 PM
Have there been any LABST notarizations?
ComputerGenie 👴👴👴26-Jan-19 12:29 PM
yes
Alright26-Jan-19 12:29 PM
yep
CrisF26-Jan-19 12:29 PM
Great
Alright26-Jan-19 12:32 PM
I'll be putting on PAYME shortly
then explorers for both LABST and PAYME
1
@ComputerGenie 👴👴👴 you going to make airdrop verification scripts?
Tony claimed the 200, but I'll give another 50 KMD for another set of them
ComputerGenie 👴👴👴26-Jan-19 12:35 PM
congrats @TonyL
1
@Alright I was, literally, just about to make and start looking at it


Spark curiosity • Encourage productive struggle • Change attitudes
Book Raj
Endlessly searching for better math problems?
Helplessly watching students disengage and give up?
Frustrated that students can't remember 'the basics'?
Feeling pressured by high stakes testing?
Download Free ResourcesDr. Shah speaks at national and state conferences as well as local events to inspire teachers, educate parents and help kids love math.
Workshops to help teachers spark student curiosity, engage in productive struggle, and foster meaningful discourse that develops deeper conceptual understanding.
Video courses to help parents understand Common Core and for students to learn advanced problem solving skills.
CEO, Speaker, Author
I have always had an affinity for math. Powered by my love of math,
I earned a Ph.D. in Physics in 1999 which led to a decade in R&D at Intel.
In 2008, I quit my job and founded Math Plus Academy,
an after-school STEM enrichment program for kids from ages 5 – 14.
I'm also proud to be a I am a founding member of The Global Math Project
I also contribute to Math Teacher Circles and the Julia Robinson Math Festival
I'm on a mission to make math irresistible for all.
Dr. Shah’s full day workshop was awesome! Two days later, we are still talking Math!!! It was a wonderful PD. Thank you for your time, insight AND activities.
Your presentation was great and you are great speaker. I enjoyed so much in your presentation on Mental Math for the Common Core at OCTM.
We want to thank you for presenting to our teachers. They were very engaged and excited about your presentation and enjoyed the activities. We need everyone to hear your message!
First, I have to tell you how much my gifted teachers LOVED your presentation at the OAGC Teacher Academy! We met today and they kept going on and on about how wonderful you were, how great the presentation was, and how many ideas/concepts they were able to take away from your session!


igB
HOME
ABOUT
COURSES
FEATURES
BLOGS
CONTACT US
SIGN IN
Upcoming Events
Upcoming Events
Abstract hacks
FEB 25TH-27TH
Everywhere,worldwide
Digital only
HackNYU
FEB 25TH-27TH
Everywhere,worldwide
Digital only
TuffyHacks
FEB 25TH-26TH
Everywhere,worldwide
Hybrid,Digital Focus
VYHacks IX
FEB 25TH-27TH
Everywhere,worldwide
Digital only
Abstract hacks
FEB 25TH-27TH
Everywhere,worldwide
Digital only
HackNYU
FEB 25TH-27TH
Everywhere,worldwide
Digital only
TuffyHacks
FEB 25TH-26TH
Everywhere,worldwide
Hybrid,Digital Focus
VYHacks IX
FEB 25TH-27TH
Everywhere,worldwide
Digital only


| Package | Description |
|---|---|
| com.hazelcast.concurrent.countdownlatch.operations |
This package contains the operations on the ICountDownLatch.
|
| com.hazelcast.concurrent.lock.operations |
This package contains the operations on the ILock.
|
| com.hazelcast.concurrent.semaphore.operations |
This package contains the operations on the ISemaphore.
|
| com.hazelcast.map.impl.tx |
Contains implementation classes for
TransactionalMap |
| com.hazelcast.multimap.impl.txn |
This package contains the Transaction behavior for the Multimap.
|
| com.hazelcast.queue.impl.operations |
This package contains the IQueue operations
|
| com.hazelcast.queue.impl.tx |
This package contains the Transaction behavior for the IQueue.
|
| com.hazelcast.spi |
Provides interfaces/classes for Hazelcast SPI.
|
| Modifier and Type | Class and Description |
|---|---|
class |
CountDownOperation |
| Modifier and Type | Class and Description |
|---|---|
class |
BeforeAwaitOperation |
class |
LocalLockCleanupOperation |
class |
UnlockIfLeaseExpiredOperation |
class |
UnlockOperation |
| Modifier and Type | Class and Description |
|---|---|
class |
ReleaseOperation |
class |
SemaphoreDeadMemberOperation |
| Modifier and Type | Interface and Description |
|---|---|
interface |
MapTxnOperation
Transactional operation interface for
IMap |
| Modifier and Type | Class and Description |
|---|---|
class |
TxnDeleteOperation
Transactional delete operation
|
class |
TxnSetOperation
An operation to unlock and set (key,value) on the partition .
|
class |
TxnUnlockOperation
An operation to unlock key on the partition owner.
|
| Modifier and Type | Class and Description |
|---|---|
class |
TxnCommitOperation |
| Modifier and Type | Class and Description |
|---|---|
class |
AddAllOperation
Add collection items to the Queue.
|
class |
ClearOperation
Clears items stored by Queue.
|
class |
CompareAndRemoveOperation
This class triggers iterator and if find same item in the Queue, remove this item.
|
class |
DrainOperation
This class drain items according to drain condition.
|
class |
OfferOperation
Contains offer operation for the Queue.
|
class |
PollOperation
Pool operation for Queue.
|
class |
RemoveOperation
Remove operation for the Queue.
|
| Modifier and Type | Class and Description |
|---|---|
class |
TxnOfferOperation
Offer operation for the Transactional Queue.
|
class |
TxnPollOperation
Poll operation for the transactional queue.
|
class |
TxnRollbackOperation
Rollback operation for the transactional queue.
|
| Modifier and Type | Method and Description |
|---|---|
void |
WaitNotifyService.notify(Notifier notifier)
Notifies the waiting
WaitSupport operation to wake-up and continue executing. |
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.


{%- if jekyll.environment == 'production' and site.gtm -%}
{%- include gtm_body.html -%}
{%- endif -%}
{%- include about.html -%}
{%- include publications.html -%}
{%- if site.data.projects.size > 0 -%}
{%- include projects.html -%}
{%- endif -%}
{%- if site.data.experience.size > 0 -%}
{%- include experience.html -%}
{%- endif -%}
{%- if site.data.education.size > 0 -%}
{%- include education.html -%}
{%- endif -%}
{%- include awards.html -%}
{%- if site.more_content -%}
{%- include more.html -%}
{%- endif -%}


Invoice List
Customer Name |
Customer # |
Invoice # |
Invoice Amount |
Due Date |
Predicted Payment Date |
Notes |
|---|
Try adjusting your search to find what you're looking for


Current version: 1.1.2 (2010-08-28)
1. Simple, static menu: [Click Me With LeftMouseButton]
2. Pass dynamic parameters ( type here: ) [Click Me With RightMouseButton]
3. AJAX items [Click Me With Left or Right MouseButton]
4. Menu Effects [Fade In - Click Me With L or R MouseButton] | [Slide Down - Click Me With L or R MouseButton]
5. Other
| ID | NAME | AGE |
|---|---|---|
| 1 | Thomas | 28 |
| 2 | Jack | 23 |
| 3 | Paul | 33 |
jQuery(" -trigger element- ").jjmenu( eventType, items, userData, effects );
eventType:
items - array of objects : [ object1, object2, ... ]
object in items array (attributes): Defines the menu item object
{ title:"Some title", //title of the menu item customClass:"someClassName", //custom ClassName of menu item (for CSS formating) "action":action object { {type:"ajax", url:"/url.php?id=#myvalue1#", callback:"(function(data){ alert(data.value); })" } // for ajax action | {type:"gourl", url:"url, target:"_blank" } // for simple go url action, don't define target for simple redirection | {type:"fn", callback:"(function(userData) { alert(userData.attr2); alert(triggerElement.id); })"} // for custom user function } "type": "sub"|"default" // type of item [ "sub" - submenu, "default" - default item ] "src": array of objects : [ object1, object2, ... ] for submenu }or
{ get:"URL to server side script", //load dynamic item using ajax, server should return the same structure as above }or
{ getByFunction:JS_FUNCTION, //JS users custom function that returns the same structure as above }
userData - object Replaces content: #attr1# with value1, #attr2# with value2, etc - in URLs and menu titles. Also pass userData as parameter to user's JS callback functions
{ myvalue1:"value1", attr2:"value2"", ... }
effects - object: Determines the appearance of menu
{ show:"default"|"fadeIn"|"slideDown", //type of show effect orientation: "top"|"bottom"|"auto", //type of menu orientation - to top, to bottom, auto (to bottom, if doesn't fit on screen - to top) xposition:"left"|"right", // position of menu (left side or right side of trigger element) yposition:"top"|"bottom"|"auto" }
To get clicked element properities, special variable triggerElement is available in all callback functions.
To get clicked element properities in userData object, you need to use callback function such as:
{"url_id":function() { return triggerElement.id; } }Now you can define for example such menu item:
{"title":"Go to user portfolio", action:{type:"gourl", url:"http://mywebsite.com/user.php?id=#url_id#"} }
The MIT License Copyright (c) 2010 Jacek Jursza Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.download source code


GREAT EXPECTATIONS 1998 Reviewed by Pierce Dalton 2 stars (out of 4)
What the hell happened to Great Expectations from the way of Charles Dickenson to the Hollywood screenplay?
This was not what I was forced to read in 9th grade.
This version is about two twits falling in and out of love from their childhood in Florida, to their adult lives in New York City.
The only resemblence, aside from the young love, is the escaped convict who befriends a boy in Florida. The con is played by Robert De Niro, who, in his total of four scenes, steals the entire picture under Ethan Hawke and Gwyneth Paltrow's feets.
In the `60s, a boy is forced to do housework for an aging drama queen at her old, decaying mansion. There he meets her niece, I believe, and they fall in love, I believe.
They go in and out of lust as teens, til they both bump into each other in NYC later on, he a rising artist, her, a business women.
This film is under Paltrow's talents, while, it is basically just right for Hawke. De Niro, on the other hand, is great, but, the film is also below his surface.
A `90s, speeded up version of Dickenson, Great Expectations dashed all my expectations of the film out the window.
It is a nice fashion show, though
1999 (c) Quick Flick Pix<EMAIL_ADDRESS>The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


n_samples, duration))
t0 = time()
distances_nn, neighbors_nn = knn.kneighbors(
None, n_neighbors=k)
duration = time() - t0
if self.verbose:
n_samples, duration))
t0 = time()
distances_nn = knn.kneighbors_graph(mode="distance")
duration = time() - t0
if self.verbose:
print("[t-SNE] Computed neighbors for {} samples "
"in {:.3f}s...".format(n_samples, duration))


System Architect Picture "Subject Responsibility"
Parent Diagram:
Subject Responsibility Act
(UML Class)


Getting Started
Here you will find both basic and advanced tutorials to help you get started using Piccolo2D. All tutorials provide examples in both Java and C#. This section assumes you have read Piccolo2D Patterns and have a basic understanding of the concepts presented there.Defining User Interaction
This tutorial will show you how to design the set of event handlers that will define the user experience. It will cover how to add mouse and keyboard event handlers to the main camera and other nodes, as well as how to filter and consume events.
Download the complete code sample in Java or
C#.
1. Setup
We need to create a window with a Piccolo2D canvas, so that we can add the interface components to the canvas.
-
First you will need to reference the appropriate packages/namespaces. Add the following lines to the top of your code file:
import edu.umd.cs.piccolo.*; import edu.umd.cs.piccolo.event.*; import edu.umd.cs.piccolo.nodes.*; import edu.umd.cs.piccolo.util.*; import edu.umd.cs.piccolox.*;
using UMD.HCIL.Piccolo; using UMD.HCIL.Piccolo.Event; using UMD.HCIL.Piccolo.Nodes; using UMD.HCIL.Piccolo.Util; using UMD.HCIL.PiccoloX;
The first line adds the base Piccolo2D types, such as
PNode
. The second line includes the basic event types. The third line includes the default node types that Piccolo2D provides, all of which extendPNode
. The fourth line includes several utility classes, and the last line includes various "extras," such asPForm
in .NET andPFrame
in Java, which will be used below. -
Next we will extend the
PForm
class in .NET or thePFrame
class in Java. This is a convenience class that adds aPCanvas
to a window. When you extend this class, you should NOT add your Piccolo2D code to the constructor. Instead, you should override theinitialize
method and add all of your Piccolo2D code there. See the FAQ for more details.public class InteractionFrame extends PFrame { public void initialize() { //Add Piccolo2D code here. } }
public class InteractionForm : PForm { public override void Initialize() { //Add Piccolo2D code here. } }
2. Create a Camera Event Listener
Event listeners can be attached to any node in the hierarchy. The events that you get depend on the node that you have registered with. For example you will only get mouse moved events when the mouse is over the node that you have registered with, not when the mouse is over some other node.
As explained in Piccolo2D Patterns, events are
dispatched to the PPickPath
associated with the appropriate focus node (MouseOver,
MouseFocus or KeyboardFocus). They percolate up the pick path, giving each node along the
way a chance to handle the event if that node has a registered event handler. The
events will keep percolating up the pick path until they are consumed by a node's event handler
or they reach the originating camera node. Often you will attach event handlers directly
to the main camera, in order to receive all events that come from the canvas.
Piccolo2D comes with event listeners that let the user zoom and pan the viewpoint and drag nodes in the interface. You can use the default event listeners directly or you can define your own. Here, we will create a new kind of event listener and add it to the camera.
-
We will create a squiggle event handler, that draws squiggles as the mouse is dragged along the canvas. To do this, we will extend PBasicInputEventHandler, the standard class in Piccolo2D that is used to register for mouse and keyboard events on a PNode. Add the following internal class beneath the
initialize
method.public class SquiggleHandler extends PBasicInputEventHandler { protected PCanvas canvas; // The squiggle that is currently getting created. protected PPath squiggle; public SquiggleHandler(PCanvas aCanvas) { canvas = aCanvas; setEventFilter(new PInputEventFilter(InputEvent.BUTTON1_MASK)); } public void mousePressed(PInputEvent e) { super.mousePressed(e); Point2D p = e.getPosition(); // Create a new squiggle and add it to the canvas. squiggle = new PPath(); squiggle.moveTo((float) p.getX(), (float) p.getY()); squiggle.setStroke(new BasicStroke( (float) (1 / e.getCamera().getViewScale()))); canvas.getLayer().addChild(0, squiggle); // Reset the keydboard focus. e.getInputManager().setKeyboardFocus(null); } public void mouseDragged(PInputEvent e) { super.mouseDragged(e); // Update the squiggle while dragging. updateSquiggle(e); } public void mouseReleased(PInputEvent e) { super.mouseReleased(e); // Update the squiggle one last time. updateSquiggle(e); squiggle = null; } public void updateSquiggle(PInputEvent aEvent) { // Add a new segment to the squiggle // from the last mouse position to // the current mouse position. Point2D p = aEvent.getPosition(); squiggle.lineTo((float) p.getX(), (float) p.getY()); } }
class SquiggleHandler : PBasicInputEventHandler { protected PCanvas canvas; // The squiggle that is currently getting created. protected PPath squiggle; // The last mouse position. protected PointF lastPoint; public SquiggleHandler(PCanvas canvas) { this.canvas = canvas; } public override void OnMouseDown(object sender, PInputEventArgs e) { base.OnMouseDown (sender, e); // Create a new squiggle and add it to the canvas. squiggle = new PPath(); squiggle.Pen = new Pen(Brushes.Black, (float)(1/ e.Camera.ViewScale)); canvas.Layer.AddChild(0, squiggle); // Save the current mouse position. lastPoint = e.Position; // Reset the keyboard focus. e.InputManager.KeyboardFocus = null; } public override void OnMouseDrag(object sender, PInputEventArgs e) { base.OnMouseDrag (sender, e); // Update the squiggle while dragging. UpdateSquiggle(e); } public override void OnMouseUp(object sender, PInputEventArgs e) { base.OnMouseUp (sender, e); // Update the squiggle one last time. UpdateSquiggle(e); squiggle = null; } protected void UpdateSquiggle(PInputEventArgs e) { // Add a new segment to the squiggle // from the last mouse position to // the current mouse position. PointF p = e.Position; if (p.X != lastPoint.X || p.Y != lastPoint.Y) { squiggle.AddLine(lastPoint.X, lastPoint.Y, p.X, p.Y); } lastPoint = p; } public override bool DoesAcceptEvent(PInputEventArgs e) { // Filter out everything but left mouse button events. return (base.DoesAcceptEvent(e) && e.IsMouseEvent && e.Button == MouseButtons.Left); } }
PBasicInputEventHandler
is the top-level event handler class. It implements thePInputEventListener
interface. All event listeners must implement this interface. Typically, you will not implement it directly. Instead, you will usually create event handlers by extending the existing event handler classes.PBasicInputEventListener
provides empty methods for all of the basic input event types. You simply override the methods for the events you are interested in handling. In the above example we override the appropriate methods for handling mouse pressed, dragged and released events.When the mouse is pressed, we create a new
PPath
called squiggle and add it to the canvas's main layer. Notice that we set the path's pen width to 1 / ViewScale, so that we will always draw with a uniform width. We also save the current mouse position as thelastPoint
.When the mouse is dragged, we call
UpdateSquiggle()
. This method will add a new line segment from thelastPoint
to the current mouse position. Finally it will set thelastPoint
to be the current mouse position.When the mouse is released, we will call updateSquiggle one more time and then set our current squiggle to null.
Finally, you might notice that the C# version of this code snippet, overrides the DoesAcceptEvent method. This method is part of the PInputEventListener interface and is used to implement event filtering in Piccolo2D.NET. Any event handler class can override this method and return true if it wants to accept an event, or false otherwise. Filtered events will never be dispatched to the event handler. In this case, we only accept left mouse button events, so that the right mouse button cannot be used to draw squiggles.
-
Now that we have created our squiggle event handler, we need to register it with a node so that it can receive events. We will add the squiggle event handler to the main camera node. Add the following lines of code to the
initialize
method.// Remove the pan event handler that is installed by default so that it // does not conflict with our new squiggle handler. getCanvas().setPanEventHandler(null); // Create a squiggle handler and register it with the Canvas. PBasicInputEventHandler squiggleHandler = new SquiggleHandler(getCanvas()); getCanvas().addInputEventListener(squiggleHandler);
// Remove the pan event handler that is installed by default so that it // does not conflict with our new squiggle handler. Canvas.PanEventHandler = null; // Create a squiggle handler and register it with the Canvas. PBasicInputEventHandler squiggleHandler = new SquiggleHandler(Canvas); Canvas.AddInputEventListener(squiggleHandler);
First we remove the default pan event handler because we don't want it to conflict with our squiggle event handler. Since we are not using our right mouse button, we do not have to remove the default zoom event handler.
Next we create our squiggle event handler. Notice that the Java version of this code snippet calls the
setEventFilter()
method and passes it a new instance ofPInputEventFilter
. In Piccolo2D.Java, event filtering is accomplished by creating a new event filter object and setting various masks on that object. In particular, an event will be accepted if it contains all the modifiers listed in theandMask
, at least one of the modifiers listed in theorMask
, and none of the modifiers listed in thenotMask
. In this case, we set theandMask
to aBUTTON1_MASK
, so that it will only accept left mouse button events.Finally, we register our new squiggle event handler to receive events from the camera. Notice that we do this by calling the canvas's
AddInputEventListener()
method. This is just a convenience method that adds the given event listener to the main camera associated with the canvas. We could have also gotten the camera from the canvas and added the event listener directly.
3. Create a Node Event Listener
Now that we have added an event handler to the camera, lets try adding an event handler to another node.
-
First, we will create green rectangle node and add it to the main layer. Add the following lines of code to the
initialize
method.// Create a green rectangle node. PNode nodeGreen = PPath.createRectangle(0, 0, 100, 100); nodeGreen.setPaint(Color.GREEN); getCanvas().getLayer().addChild(nodeGreen);
// Create a green rectangle node. PNode nodeGreen = PPath.CreateRectangle(0, 0, 100, 100); nodeGreen.Brush = Brushes.Green; Canvas.Layer.AddChild(nodeGreen);
-
Next, we will create a new event handler that will change our node's color to orange when the mouse is pressed over the node and back to green, when it is released. Additionally, the event handler will move the node when the mouse is dragged. We will be careful to consume these events, since we don't want dragging the node around to draw squiggles underneath of it. Note, this is a simple example, but most of the time the best way to implement dragging is to use a PDragEventHandler. Add the following lines of code to the project. The java snippet should be added directly to the
initialize
method. The .NET snippet should be added beneathinitialize
.// Attach event handler directly to the node. nodeGreen.addInputEventListener(new PBasicInputEventHandler() { public void mousePressed(PInputEvent event) { event.getPickedNode().setPaint(Color.ORANGE); event.getInputManager().setKeyboardFocus(event.getPath()); event.setHandled(true); } public void mouseDragged(PInputEvent event) { PNode aNode = event.getPickedNode(); PDimension delta = event.getDeltaRelativeTo(aNode); aNode.translate(delta.width, delta.height); event.setHandled(true); } public void mouseReleased(PInputEvent event) { event.getPickedNode().setPaint(Color.GREEN); event.setHandled(true); } public void keyPressed(PInputEvent event) { PNode node = event.getPickedNode(); switch (event.getKeyCode()) { case KeyEvent.VK_UP: node.translate(0, -10f); break; case KeyEvent.VK_DOWN: node.translate(0, 10f); break; case KeyEvent.VK_LEFT: node.translate(-10f, 0); break; case KeyEvent.VK_RIGHT: node.translate(10f, 0); break; } } });
protected void nodeGreen_MouseDown(object sender, PInputEventArgs e) { PNode aNode = (PNode)sender; aNode.Brush = new SolidBrush(Color.Orange); e.InputManager.KeyboardFocus = e.Path; e.Handled = true; } protected void nodeGreen_MouseDrag(object sender, PInputEventArgs e) { PNode aNode = (PNode)sender; SizeF delta = e.GetDeltaRelativeTo(aNode); aNode.TranslateBy(delta.Width, delta.Height); e.Handled = true; } protected void nodeGreen_MouseUp(object sender, PInputEventArgs e) { PNode aNode = (PNode)sender; aNode.Brush = new SolidBrush(Color.Green); e.Handled = true; } protected void nodeGreen_KeyDown(object sender, PInputEventArgs e) { PNode node = (PNode)sender; switch (e.KeyCode) { case Keys.Up: node.TranslateBy(0, -10); break; case Keys.Down: node.TranslateBy(0, 10); break; case Keys.Left: node.TranslateBy(-10, 0); break; case Keys.Right: node.TranslateBy(10, 0); break; } }
The first thing you might notice is that the C# version of this code snippet does not extend
PBasicInputEventHandler
. Instead, it consists of several distinct methods. In Piccolo2D.NET there are actually two ways to create event handlers. The first is to use the standard approach of extending the event handler classes. But, you can also add event handler methods directly to a node, in the same way that you can add event handler methods directly to Control. PNode defines Events for each of the basic input events. The benefit of doing things this way is that it takes fewer lines of code. The benefit of using classes is that your event handlers will be reusable and capable of maintaining state.When the mouse is pressed, we get the pressed node and set it's fill color to be orange. Next, we get the InputManager from the event and set it's keyboard focus node to be the current pick path generated from this mouse pressed event. This ensures that all future keyboard events will be dispatched to that pick path. Otherwise, our key pressed event handler would never get called. For more information about focus nodes, picking and event dispatch, see Piccolo2D Patterns. Finally, we consume the event by marking it as handled. If we did not do this, the event would percolate up to the camera and get dispatched to our squiggle event handler.
When the mouse is dragged, we get the distance that the mouse has moved from it's last position and we translate the node by that amount. This is how dragging is implemented. Notice that we get the distance by calling
GetDeltaRelativeToNode
, ensuring that the value returned is in the local coordinate system of this node. We also mark this event as handled.When the mouse is released, we set the node's fill back to green and mark the event as handled.
When an arrow key is pressed, we will translate the node by 10 in the direction of the arrow. Note the key pressed event handler will only get called when our node has the keyboard focus. So, once we click on the node, we will be able to move it with the arrow keys . But, after we draw a squiggle, the arrow keys will no longer move the node, since the squiggle event handler resets the keyboard focus to null. We would then have to click on the node again to give it back the keyboard focus.
-
Finally, we will register the node event handler with our node. Add the following lines of code to the
initialize
method.// Attach event handler directly to the node. The Java version defines and attaches the event handler using an anonymous class. See previous code sample.
// Attach event delegates directly to the node. nodeGreen.MouseDown += new PInputEventHandler(nodeGreen_MouseDown); nodeGreen.MouseDrag += new PInputEventHandler(nodeGreen_MouseDrag); nodeGreen.MouseUp += new PInputEventHandler(nodeGreen_MouseUp); nodeGreen.KeyDown += new PInputEventHandler(nodeGreen_KeyDown);
Notice that the C# version of this code snippet adds each of the event handler methods individually, using the
PInputEventHandler
delegate. We could have also extendedPBasicInputEventHandler
and added a new event handler class to the node, as the Java code does.


Toggle navigation
coderuss
{{getCurrentUser().username}}
Profile
Queue
Currency
Notification Hooks
Fitbit
TV
Postcards
Users
She was pretty
Hello
Travel
Git Review
Logout
sign in
sign up
{{user}}


HustleCase is perfect for
- Wireframing
- Sketching
- Sitemapping
- To-dos
- Notes
- Interviews
The world`s first whiteboard laptop case. Just snap it on and whiteboard on the go.
HustleCase is a lightweight whiteboard laptop case that makes it easy to:
Don't see your question here?Email us