Class ElementActions
public class ElementActions
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ElementActions.TextDetectionStrategy
-
Constructor Summary
Constructors Constructor Description ElementActions(org.openqa.selenium.WebDriver driver)
-
Method Summary
Modifier and Type Method Description static java.lang.Boolean
attemptToFindElementUsingAI(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
ElementActions
click(org.openqa.selenium.By elementLocator)
Clicks on a certain element using Selenium WebDriver, or JavaScriptstatic void
click(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Clicks on a certain element using Selenium WebDriver, or JavaScriptstatic void
clickAndHold(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Waits for the element to be clickable, and then clicks and holds it.static void
clipboardActions(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String action)
Attempts to perform a native clipboard action on the text from a certain web element, like copy/cut/pastestatic void
doubleClick(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Double-clicks on an element using Selenium WebDriver's Actions LibraryElementActions
dragAndDrop(org.openqa.selenium.By sourceElementLocator, org.openqa.selenium.By destinationElementLocator)
Drags the source element and drops it onto the destination element using javascriptstatic void
dragAndDrop(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By sourceElementLocator, org.openqa.selenium.By destinationElementLocator)
Drags the source element and drops it onto the destination element using javascriptElementActions
dragAndDropByOffset(org.openqa.selenium.By sourceElementLocator, int xOffset, int yOffset)
Drags the source element and drops it onto the determined offsetstatic void
dragAndDropByOffset(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By sourceElementLocator, int xOffset, int yOffset)
Drags the source element and drops it onto the determined offsetstatic void
executeNativeMobileCommand(org.openqa.selenium.WebDriver driver, java.lang.String command, java.util.Map<java.lang.String,java.lang.String> parameters)
This is a generic method to enable the execution of any of the native mobile commands found herein: http://appium.io/docs/en/commands/mobile-command/static org.openqa.selenium.By
getAiGeneratedElementLocator()
static java.lang.String
getAiReferenceFileName()
java.lang.String
getAttribute(org.openqa.selenium.By elementLocator, java.lang.String attributeName)
Get the value of the given attribute of the element.static java.lang.String
getAttribute(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String attributeName)
Get the value of the given attribute of the element.static java.lang.String
getContext(org.openqa.selenium.WebDriver driver)
Returns the handle for currently active context.static java.util.List<java.lang.String>
getContextHandles(org.openqa.selenium.WebDriver driver)
Returns a list of unique handles for all the currently open contexts.java.lang.String
getCSSProperty(org.openqa.selenium.By elementLocator, java.lang.String propertyName)
Get the value of a given CSS property.static java.lang.String
getCSSProperty(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String propertyName)
Get the value of a given CSS property.static int
getElementsCount(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Returns the number of elements that match a certain elementLocatorstatic int
getElementsCount(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, int numberOfAttempts)
Returns the number of elements that match a certain elementLocatorstatic int
getElementsCount(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, int numberOfAttempts, boolean waitForLazyLoading)
Returns the number of elements that match a certain elementLocatorstatic java.lang.String
getSelectedText(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Retrieves the selected text from the target drop-down list element and returns it as a string value.static java.lang.String
getSize(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Retrieves element size from the target element and returns it as a string value.static java.lang.String
getTagName(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Retrieves tag name from the target element and returns it as a string value.java.lang.String
getText(org.openqa.selenium.By elementLocator)
Retrieves text from the target element and returns it as a string value.static java.lang.String
getText(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Retrieves text from the target element and returns it as a string value.static java.lang.String
getWindowHandle(org.openqa.selenium.WebDriver driver)
Returns the unique handle for currently active window.static java.util.List<java.lang.String>
getWindowHandles(org.openqa.selenium.WebDriver driver)
Returns a list of unique handles for all the currently open windows.ElementActions
hover(org.openqa.selenium.By elementLocator)
Hovers over target element.static void
hover(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Hovers over target element.ElementActions
hoverAndClick(java.util.List<org.openqa.selenium.By> hoverElementLocators, org.openqa.selenium.By clickableElementLocator)
Hovers over the hoverElements in sequence then clicks the clickableElementstatic void
hoverAndClick(org.openqa.selenium.WebDriver driver, java.util.List<org.openqa.selenium.By> hoverElementLocators, org.openqa.selenium.By clickableElementLocator)
Hovers over the hoverElements in sequence then clicks the clickableElementstatic void
hoverAndClick(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By hoverElementLocator, org.openqa.selenium.By clickableElementLocator)
Hovers over the hoverElement then clicks the clickableElementstatic boolean
isElementClickable(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Checks to see if an element is clickablestatic boolean
isElementDisplayed(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Checks to see if an element is displayedElementActions
keyPress(org.openqa.selenium.By elementLocator, org.openqa.selenium.Keys keys)
Sends a keypress to the target element.static void
keyPress(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String key)
Sends a keypress to the target element.static void
keyPress(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, org.openqa.selenium.Keys keys)
Sends a keypress to the target element.static SikuliActions
performSikuliAction()
static SikuliActions
performSikuliAction(org.sikuli.script.App applicationWindow)
static TouchActions
performTouchAction(org.openqa.selenium.WebDriver driver)
This is a convenience method to be able to call TouchActions Actions for touch-enabled devices from within the regular Element Actions Class.ElementActions
select(org.openqa.selenium.By elementLocator, java.lang.String text)
Selects an element from a dropdown list using its displayed textstatic void
select(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String text)
Selects an element from a dropdown list using its displayed textstatic void
setContext(org.openqa.selenium.WebDriver driver, java.lang.String context)
Switches focus to another contextstatic void
setLastUsedDriver(org.openqa.selenium.WebDriver driver)
static void
setValueUsingJavaScript(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String value)
Used to set value for an element (hidden or visible) using javascriptstatic void
submitFormUsingJavaScript(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Used to submit a form using javascriptstatic void
switchToDefaultContent()
static void
switchToDefaultContent(org.openqa.selenium.WebDriver driver)
Switches focus to default content, is mainly used in coordination withswitchToIframe(WebDriver, By)
to exit any iFrame layer and go back to the main pagestatic void
switchToIframe(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)
Switches focus to a certain iFrame, is mainly used in coordination withswitchToDefaultContent(WebDriver)
to navigate inside any iFrame layer and go back to the main pagestatic void
switchToWindow(org.openqa.selenium.WebDriver driver, java.lang.String nameOrHandle)
Switches focus to another windowElementActions
type(org.openqa.selenium.By elementLocator, java.lang.String text)
Checks if there is any text in an element, clears it, then types the required string into the target element.static void
type(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String text)
Checks if there is any text in an element, clears it, then types the required string into the target element.ElementActions
typeAppend(org.openqa.selenium.By elementLocator, java.lang.String text)
Appends the required string into the target element, regardless of the current text value.static void
typeAppend(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String text)
Appends the required string into the target element, regardless of the current text value.ElementActions
typeFileLocationForUpload(org.openqa.selenium.By elementLocator, java.lang.String absoluteFilePath)
Types the required file path into an input[type='file'] button, to successfully upload the target file.static void
typeFileLocationForUpload(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String absoluteFilePath)
Types the required file path into an input[type='file'] button, to successfully upload the target file.ElementActions
typeSecure(org.openqa.selenium.By elementLocator, java.lang.String text)
Checks if there is any text in an element, clears it, then types the required string into the target element.static void
typeSecure(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String text)
Checks if there is any text in an element, clears it, then types the required string into the target element.static void
waitForElementToBePresent(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, int numberOfTries, boolean stateOfPresence)
Waits dynamically for a specific element to achieve the desired stateOfPresence on the current page.static void
waitForTextToChange(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String initialValue, int numberOfTries)
Waits dynamically for a specific element's text to change from the initial value to a new unknown value.
-
Constructor Details
-
ElementActions
public ElementActions(org.openqa.selenium.WebDriver driver)
-
-
Method Details
-
setLastUsedDriver
public static void setLastUsedDriver(org.openqa.selenium.WebDriver driver) -
getAiReferenceFileName
public static java.lang.String getAiReferenceFileName() -
getAiGeneratedElementLocator
public static org.openqa.selenium.By getAiGeneratedElementLocator() -
attemptToFindElementUsingAI
public static java.lang.Boolean attemptToFindElementUsingAI(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator) -
getElementsCount
public static int getElementsCount(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Returns the number of elements that match a certain elementLocator- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)- Returns:
- integer value that represents the number of elements that match the desired elementLocator
-
getElementsCount
public static int getElementsCount(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, int numberOfAttempts)Returns the number of elements that match a certain elementLocator- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)numberOfAttempts
- the number of retries before returning a count [returns zero if no elements were found after all the retries]- Returns:
- integer value that represents the number of elements that match the desired elementLocator
-
getElementsCount
public static int getElementsCount(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, int numberOfAttempts, boolean waitForLazyLoading)Returns the number of elements that match a certain elementLocator- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)numberOfAttempts
- the number of retries before returning a count [returns zero if no elements were found after all the retries]waitForLazyLoading
- if true, will wait before lazy loading, else if false skips this wait- Returns:
- integer value that represents the number of elements that match the desired elementLocator
-
switchToWindow
public static void switchToWindow(org.openqa.selenium.WebDriver driver, java.lang.String nameOrHandle)Switches focus to another window- Parameters:
driver
- the current instance of Selenium webdrivernameOrHandle
- The name of the window or the handle as returned by ElementActions.getWindowHandle(WebDriver driver)
-
getWindowHandle
public static java.lang.String getWindowHandle(org.openqa.selenium.WebDriver driver)Returns the unique handle for currently active window. This can be used to switch to this window at a later time.- Parameters:
driver
- the current instance of Selenium webdriver- Returns:
- window handle
-
getWindowHandles
public static java.util.List<java.lang.String> getWindowHandles(org.openqa.selenium.WebDriver driver)Returns a list of unique handles for all the currently open windows. This can be used to switch to any of these windows at a later time.- Parameters:
driver
- the current instance of Selenium webdriver- Returns:
- list of window handles
-
getContext
public static java.lang.String getContext(org.openqa.selenium.WebDriver driver)Returns the handle for currently active context. This can be used to switch to this context at a later time.- Parameters:
driver
- the current instance of Appium Driver- Returns:
- The current context handle
-
getContextHandles
public static java.util.List<java.lang.String> getContextHandles(org.openqa.selenium.WebDriver driver)Returns a list of unique handles for all the currently open contexts. This can be used to switch to any of these contexts at a later time.- Parameters:
driver
- the current instance of Appium Driver- Returns:
- list of context handles
-
setContext
public static void setContext(org.openqa.selenium.WebDriver driver, java.lang.String context)Switches focus to another context- Parameters:
driver
- the current instance of Appium Drivercontext
- The name of the context or the handle as returned by ElementActions.getContext(WebDriver driver)
-
switchToIframe
public static void switchToIframe(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Switches focus to a certain iFrame, is mainly used in coordination withswitchToDefaultContent(WebDriver)
to navigate inside any iFrame layer and go back to the main page- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the iFrame webElement under test (By xpath, id, selector, name ...etc)
-
switchToDefaultContent
public static void switchToDefaultContent(org.openqa.selenium.WebDriver driver)Switches focus to default content, is mainly used in coordination withswitchToIframe(WebDriver, By)
to exit any iFrame layer and go back to the main page- Parameters:
driver
- the current instance of Selenium webdriver
-
switchToDefaultContent
public static void switchToDefaultContent() -
doubleClick
public static void doubleClick(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Double-clicks on an element using Selenium WebDriver's Actions Library- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)
-
click
public static void click(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Clicks on a certain element using Selenium WebDriver, or JavaScript- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)
-
clickAndHold
public static void clickAndHold(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Waits for the element to be clickable, and then clicks and holds it.- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)
-
type
public static void type(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String text)Checks if there is any text in an element, clears it, then types the required string into the target element.- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)text
- the target text that needs to be typed into the target webElement
-
typeSecure
public static void typeSecure(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String text)Checks if there is any text in an element, clears it, then types the required string into the target element. Obfuscates the written text in the output report. This action should be used for writing passwords and secure text.- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)text
- the target text that needs to be typed into the target webElement
-
typeFileLocationForUpload
public static void typeFileLocationForUpload(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String absoluteFilePath)Types the required file path into an input[type='file'] button, to successfully upload the target file.- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)absoluteFilePath
- the full path to the file that needs to be uploaded
-
typeAppend
public static void typeAppend(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String text)Appends the required string into the target element, regardless of the current text value.- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)text
- the target text that needs to be appended into the target webElement
-
select
public static void select(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String text)Selects an element from a dropdown list using its displayed text- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)text
- the text of the choice that you need to select from the target dropDown menu
-
keyPress
public static void keyPress(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String key)Sends a keypress to the target element. Supported keys are: ENTER, RETURN, TAB- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)key
- the key that should be pressed
-
keyPress
public static void keyPress(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, org.openqa.selenium.Keys keys)Sends a keypress to the target element.- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)keys
- the key that should be pressed
-
hover
public static void hover(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Hovers over target element. If you want to hover on a webElement to expose another webElement and click on it, use hoverAndClick instead for a more reliable result.- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)
-
hoverAndClick
public static void hoverAndClick(org.openqa.selenium.WebDriver driver, java.util.List<org.openqa.selenium.By> hoverElementLocators, org.openqa.selenium.By clickableElementLocator)Hovers over the hoverElements in sequence then clicks the clickableElement- Parameters:
driver
- the current instance of Selenium webdriverhoverElementLocators
- the list of locators of the webElements under test upon which the hover action will be performed in sequence (By xpath, id, selector, name ...etc)clickableElementLocator
- the locator of the webElement under test upon which the click action will be performed (By xpath, id, selector, name ...etc)
-
hoverAndClick
public static void hoverAndClick(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By hoverElementLocator, org.openqa.selenium.By clickableElementLocator)Hovers over the hoverElement then clicks the clickableElement- Parameters:
driver
- the current instance of Selenium webdriverhoverElementLocator
- he locator of the webElement under test upon which the hover action will be performed (By xpath, id, selector, name ...etc)clickableElementLocator
- the locator of the webElement under test upon which the click action will be performed (By xpath, id, selector, name ...etc)
-
dragAndDrop
public static void dragAndDrop(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By sourceElementLocator, org.openqa.selenium.By destinationElementLocator)Drags the source element and drops it onto the destination element using javascript- Parameters:
driver
- the current instance of Selenium webdriversourceElementLocator
- the locator of the source webElement that should be dragged under test (By xpath, id, selector, name ...etc)destinationElementLocator
- the locator of the target webElement that should receive the dropped source element under test (By xpath, id, selector, name ...etc)
-
dragAndDropByOffset
public static void dragAndDropByOffset(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By sourceElementLocator, int xOffset, int yOffset)Drags the source element and drops it onto the determined offset- Parameters:
driver
- the current instance of Selenium webdriversourceElementLocator
- the locator of the source webElement that should be dragged under test (By xpath, id, selector, name ...etc)xOffset
- the horizontal offset by which the element should be movedyOffset
- the vertical offset by which the element should be moved
-
getText
public static java.lang.String getText(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Retrieves text from the target element and returns it as a string value.- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)- Returns:
- the text value of the target webElement
-
getTagName
public static java.lang.String getTagName(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Retrieves tag name from the target element and returns it as a string value.- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)- Returns:
- the tag name of the webElement under test
-
getSize
public static java.lang.String getSize(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Retrieves element size from the target element and returns it as a string value.- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)- Returns:
- the size of the webElement under test
-
getAttribute
public static java.lang.String getAttribute(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String attributeName)Get the value of the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded.More exactly, this method will return the value of the property with the given name, if it exists. If it does not, then the value of the attribute with the given name is returned. If neither exists, null is returned.
The "style" attribute is converted as best can be to a text representation with a trailing semi-colon.
The following are deemed to be "boolean" attributes, and will return either "true" or null:
async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked, defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable, ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate, readonly, required, reversed, scoped, seamless, seeking, selected, truespeed, willvalidate
Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:
If the given name is "class", the "className" property is returned. If the given name is "readonly", the "readOnly" property is returned. Note: The reason for this behavior is that users frequently confuse attributes and properties. If you need to do something more precise, e.g., refer to an attribute even when a property of the same name exists, then you should evaluate Javascript to obtain the result you desire.
- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)attributeName
- the target attribute of the webElement under test- Returns:
- the value of the target attribute of the webElement under test
-
getCSSProperty
public static java.lang.String getCSSProperty(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String propertyName)Get the value of a given CSS property. Color values should be returned as RGBA strings, so, for example if the "background-color" property is set as "green" in the HTML source, the returned value will be "RGBA(0, 255, 0, 1)". Note that shorthand CSS properties (e.g. background, font, border, border-top, margin, margin-top, padding, padding-top, list-style, outline, pause, cue) are not returned, in accordance with the DOM CSS2 specification - you should directly access the longhand properties (e.g. background-color) to access the desired values.- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)propertyName
- the target CSS property of the webElement under test- Returns:
- the value of the target CSS property of the webElement under test
-
getSelectedText
public static java.lang.String getSelectedText(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Retrieves the selected text from the target drop-down list element and returns it as a string value.- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)- Returns:
- the selected text of the target webElement
-
waitForTextToChange
public static void waitForTextToChange(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String initialValue, int numberOfTries)Waits dynamically for a specific element's text to change from the initial value to a new unknown value. Waits for a specific number of retries multiplied by the default element identification timeout (in the POM.xml file)- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)initialValue
- the initial text value of the target webElementnumberOfTries
- the number of times to try and wait for the element text to change (default is 1)
-
waitForElementToBePresent
public static void waitForElementToBePresent(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, int numberOfTries, boolean stateOfPresence)Waits dynamically for a specific element to achieve the desired stateOfPresence on the current page. Waits for a specific number of retries multiplied by the default element identification timeout (in the POM.xml file)- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)numberOfTries
- the number of times to try and wait for the element to achieve the desired stateOfPresence (default is 1)stateOfPresence
- the expected state of presence of the element; false is not present, and true is present
-
isElementDisplayed
public static boolean isElementDisplayed(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Checks to see if an element is displayed- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)- Returns:
- boolean value, true if the element is displayed, and false if the element is not displayed
-
isElementClickable
public static boolean isElementClickable(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Checks to see if an element is clickable- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)- Returns:
- boolean value, true if the element is clickable, and false if the element is not clickable
-
clipboardActions
public static void clipboardActions(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String action)Attempts to perform a native clipboard action on the text from a certain web element, like copy/cut/paste- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)action
- supports the following actions "copy", "paste", "cut", "select all", "unselect"
-
setValueUsingJavaScript
public static void setValueUsingJavaScript(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator, java.lang.String value)Used to set value for an element (hidden or visible) using javascript- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)value
- the desired value that should be set for the target element
-
submitFormUsingJavaScript
public static void submitFormUsingJavaScript(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By elementLocator)Used to submit a form using javascript- Parameters:
driver
- the current instance of Selenium webdriverelementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)
-
executeNativeMobileCommand
public static void executeNativeMobileCommand(org.openqa.selenium.WebDriver driver, java.lang.String command, java.util.Map<java.lang.String,java.lang.String> parameters)This is a generic method to enable the execution of any of the native mobile commands found herein: http://appium.io/docs/en/commands/mobile-command/Note: This method does no validation on the output of the executed JavaScript
- Parameters:
driver
- the current instance of Selenium webdriver, which should wrap around a native mobile objectcommand
- the desired mobile command to be executed. e.g., "mobile: scroll"parameters
- a map of the key, value parameters for this command. e.g., ImmutableMap.of("direction", "down")
-
performTouchAction
This is a convenience method to be able to call TouchActions Actions for touch-enabled devices from within the regular Element Actions Class.Sample use would look like this: ElementActions.performTouchAction().tap(driver, loginButton);
- Parameters:
driver
- the current instance of Selenium webdriver, which should wrap around a native mobile object- Returns:
- a TouchActions object capable of performing actions on touch-enabled devices
-
performSikuliAction
-
performSikuliAction
-
typeFileLocationForUpload
public ElementActions typeFileLocationForUpload(org.openqa.selenium.By elementLocator, java.lang.String absoluteFilePath)Types the required file path into an input[type='file'] button, to successfully upload the target file.- Parameters:
elementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)absoluteFilePath
- the full path to the file that needs to be uploaded- Returns:
- a self-reference to be used to chain actions
-
typeAppend
Appends the required string into the target element, regardless of the current text value.- Parameters:
elementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)text
- the target text that needs to be appended into the target webElement- Returns:
- a self-reference to be used to chain actions
-
select
Selects an element from a dropdown list using its displayed text- Parameters:
elementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)text
- the text of the choice that you need to select from the target dropDown menu- Returns:
- a self-reference to be used to chain actions
-
keyPress
public ElementActions keyPress(org.openqa.selenium.By elementLocator, org.openqa.selenium.Keys keys)Sends a keypress to the target element.- Parameters:
elementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)keys
- the key that should be pressed- Returns:
- a self-reference to be used to chain actions
-
hover
Hovers over target element. If you want to hover on a webElement to expose another webElement and click on it, use hoverAndClick instead for a more reliable result.- Parameters:
elementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)- Returns:
- a self-reference to be used to chain actions
-
hoverAndClick
public ElementActions hoverAndClick(java.util.List<org.openqa.selenium.By> hoverElementLocators, org.openqa.selenium.By clickableElementLocator)Hovers over the hoverElements in sequence then clicks the clickableElement- Parameters:
hoverElementLocators
- the list of locators of the webElements under test upon which the hover action will be performed in sequence (By xpath, id, selector, name ...etc)clickableElementLocator
- the locator of the webElement under test upon which the click action will be performed (By xpath, id, selector, name ...etc)- Returns:
- a self-reference to be used to chain actions
-
dragAndDrop
public ElementActions dragAndDrop(org.openqa.selenium.By sourceElementLocator, org.openqa.selenium.By destinationElementLocator)Drags the source element and drops it onto the destination element using javascript- Parameters:
sourceElementLocator
- the locator of the source webElement that should be dragged under test (By xpath, id, selector, name ...etc)destinationElementLocator
- the locator of the target webElement that should receive the dropped source element under test (By xpath, id, selector, name ...etc)- Returns:
- a self-reference to be used to chain actions
-
dragAndDropByOffset
public ElementActions dragAndDropByOffset(org.openqa.selenium.By sourceElementLocator, int xOffset, int yOffset)Drags the source element and drops it onto the determined offset- Parameters:
sourceElementLocator
- the locator of the source webElement that should be dragged under test (By xpath, id, selector, name ...etc)xOffset
- the horizontal offset by which the element should be movedyOffset
- the vertical offset by which the element should be moved- Returns:
- a self-reference to be used to chain actions
-
getText
public java.lang.String getText(org.openqa.selenium.By elementLocator)Retrieves text from the target element and returns it as a string value.- Parameters:
elementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)- Returns:
- the text value of the target webElement
-
getAttribute
public java.lang.String getAttribute(org.openqa.selenium.By elementLocator, java.lang.String attributeName)Get the value of the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded.More exactly, this method will return the value of the property with the given name, if it exists. If it does not, then the value of the attribute with the given name is returned. If neither exists, null is returned.
The "style" attribute is converted as best can be to a text representation with a trailing semi-colon.
The following are deemed to be "boolean" attributes, and will return either "true" or null:
async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked, defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable, ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate, readonly, required, reversed, scoped, seamless, seeking, selected, truespeed, willvalidate
Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:
If the given name is "class", the "className" property is returned. If the given name is "readonly", the "readOnly" property is returned. Note: The reason for this behavior is that users frequently confuse attributes and properties. If you need to do something more precise, e.g., refer to an attribute even when a property of the same name exists, then you should evaluate Javascript to obtain the result you desire.
- Parameters:
elementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)attributeName
- the target attribute of the webElement under test- Returns:
- the value of the target attribute of the webElement under test
-
getCSSProperty
public java.lang.String getCSSProperty(org.openqa.selenium.By elementLocator, java.lang.String propertyName)Get the value of a given CSS property. Color values should be returned as RGBA strings, so, for example if the "background-color" property is set as "green" in the HTML source, the returned value will be "RGBA(0, 255, 0, 1)". Note that shorthand CSS properties (e.g. background, font, border, border-top, margin, margin-top, padding, padding-top, list-style, outline, pause, cue) are not returned, in accordance with the DOM CSS2 specification - you should directly access the longhand properties (e.g. background-color) to access the desired values.- Parameters:
elementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)propertyName
- the target CSS property of the webElement under test- Returns:
- the value of the target CSS property of the webElement under test
-
click
Clicks on a certain element using Selenium WebDriver, or JavaScript- Parameters:
elementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)- Returns:
- a self-reference to be used to chain actions
-
type
Checks if there is any text in an element, clears it, then types the required string into the target element.- Parameters:
elementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)text
- the target text that needs to be typed into the target webElement- Returns:
- a self-reference to be used to chain actions
-
typeSecure
Checks if there is any text in an element, clears it, then types the required string into the target element. Obfuscates the written text in the output report. This action should be used for writing passwords and secure text.- Parameters:
elementLocator
- the locator of the webElement under test (By xpath, id, selector, name ...etc)text
- the target text that needs to be typed into the target webElement- Returns:
- a self-reference to be used to chain actions
-


If you are distributing an appliance, operating system or other kind of software using the NTP Pool, you need to setup a "vendor zone".
For internal use on systems you manage you do not need a vendor zone. For initial development or small-scale testing of an appliance or software, you don't either. However, you must setup a vendor zone before production deployments or distribution start.
For open source projects this is free; for commercial products, including commercial open source, we ask for a nomimal annual fee (based on the number of clients) to support the NTP Pool Project infrastructure.
If you have any questions, please email [% "vendors" | email %].


Represents one or more services associated with a host.
The services model allows falcon to manage one more more service associated with a given host. Some examples of services include:
- Rack applications wrapped by
class Falcon::Service::Application
. - Host supervisor implemented in
class Falcon::Service::Supervisor
. - Proxy services wrapped by
class Falcon::Service::Proxy
.
The list of services is typically generated from the user supplied falcon.rb
configuration file, which is loaded into an immutable class Falcon::Configuration
instance, which is mapped into a list of services.
Definitions
def initialize(configuration)
Initialize the services from the given configuration.
Signature
-
parameter
configuration
Falcon::Configuration
Implementation
def initialize(configuration)
@named = {}
configuration.each(:service) do |environment|
service = Service::Generic.wrap(environment)
add(service)
end
end
def each(&block)
Enumerate all named services.
Implementation
def each(&block)
@named.each_value(&block)
end
def add(service)
Add a named service.
Signature
-
parameter
service
Falcon::Service
Implementation
def add(service)
@named[service.name] = service
end
def start
Start all named services.
Implementation
def start
@named.each do |name, service|
Async.logger.debug(self) {"Starting #{name}..."}
service.start
end
end
def setup(container)
Setup all named services into the given container.
Signature
-
parameter
container
Async::Container::Generic
Implementation
def setup(container)
@named.each do |name, service|
Async.logger.debug(self) {"Setup #{name} into #{container}..."}
service.setup(container)
end
return container
end
def stop
Stop all named services.
Implementation
def stop
failed = false
@named.each do |name, service|
Async.logger.debug(self) {"Stopping #{name}..."}
begin
service.stop
rescue
failed = true
Async.logger.error(self, $!)
end
end
return failed
end


Contents
-
Index
Serial Communications
CodeSharkFC uses the TLazSerial component for serial communication. The component can be found here: https://github.com/JurassicPork/TLazSerial


{{> head}}
{{> menu}}$ npm install seneca --save
Seneca is a microservices toolkit for Node.js. It provides plugins that look after the foundations of your app. This leaves you free to focus on the real, business code. No need to worry about which database to use, how to structure your components, or how to manage dependencies. Just start coding.
You write everything as a command. Your commands get called whenever they match a set of properties. Your calling code doesn't know, or care, which command gets the work done. One JavaScript object goes in, and another comes out, asynchronously.
Do you use Seneca too? Let us know.


Using John Resig's Micro-Templating
Variables can be uesd: relative_path, absolute_path, x, y, w, h, name
name for fileName without ext
Download
Export and save the file, then you can recover your workspace by drop it on the canvas next time!
Export
View On GitHub
 Get some help


About Me - who,what,where...
My name is Ron. I was born and raised in the Kansas City area. I'm passionate about my family and friends, soccer, new technology and Kansas City beer.
After graduating from Truman State University in 2005, I started my career working at a financial services firm here in Kansas City and have been at the same place since then. The company is great and has offered me some awesome opportunities to learn and grow. I started as a customer service rep and transitioned to be a SAS developer, Salesforce Administrator and now in IT as a Java Developer helping to lead our DevOps and Agile transformations.


Lettering.js, a jQuery plugin for radical Web Typography
We developed a lightweight, easy to use Javascript span
injector for radical Web Typography, we're calling it "Lettering Dot JS", and we're releasing it today for free over on Github. Let me demo it for you: </stevejobs>
Individual Letter Control with Lettering.js
We'll start with some really basic markup:

Some Title

After including jQuery, download and include the minified version of Lettering.js, then a script block with the magical .lettering()
method:

The resulting code will churn your .fancy_title
and output the following:

S
o
m
e

T
i
t
l
e

Magical. Now the text is easy to manipulate in your CSS using an ordinal .char#
pattern. This plugin assumes basic counting skills, but it's a pretty fast and easy way to get control over every letter.
 If the client came by the next day and said that the SEO Expert demands that you have to change the title to "Cool Title", it'd just be a matter of changing the original clean markup to:

Cool Title

It also plays nicely with CMSs like WordPress or Expression Engine and art direction plugins.
Wrap Words with Lettering.js
Once we developed this e-solution and played with it, we found it useful enough to broaden the scope so that we could break apart and wrap words in a sentence in a span tag.
Here's an example of the .lettering('words')
method:

Don't break my heart.

Which will generate:

Don't
break
my
heart.

You can then style each word using the .word#
class.
Wrap Lines with Lettering.js
Once word wrapping was complete, we noticed the need for yet another method, one that would break lines up mid-sentence. We struggled for a semantic way to do this, but then remembered

tag which a semantic way to say "break this line". Similar to the above examples where lines of text are broken up by either non-breaking spaces or individual letters, the lettering('lines')
method will create breakpoints at

tags:

Are you
 ready to
 RUMmMmMMBBLE!

Resulting code:

Are you
ready to
RUMmMmMMBBLE!

As expected it uses the .line#
ordinal pattern. You'll also notice the

's have been destructively ripped out. In your CSS, you'll want to declare something like .line_split span { display:block; }
if you need them to behave as a

element.
Best Practices & Kerning
We've found this to be a pretty quick and elegant solution to create typographical CSS3 posters. It's also a great solution for really custom type headings, while keeping the text selectable.
Best Practices
Be smart and use sparingly. You'll probably break your browser if you try to wrap every letter on your page in a span
tag, so don't do that. Look to use this in your Headings, Blockquotes, Asides, etc.
Kern Well
If you're going through the trouble to load a fancy font and that word or phrase is the largest on the site, then it's important for it to be kerned well. With Lettering.js, kerning is a breeze. You can simply use $("#id-of-what-i-want-to-kern").lettering();
and then on each .char#
, you can set relative position or left/right margin. Works like a charm.
Non-Javascript Fallback
As with any kind of Javascript, have a fall back plan in case the user doesn't have javascript enabled. The bottom line is up to you, my bottom line would be "legible and on the screen". Also, use lettering.min.js
Download the Minified Version of Lettering.js here
Performance Anti-Pattern
Web performance patterns advise that you put Javascripts at the bottom of your page before your
tag. There is an unfortunate side effect where you may experiences a FOUT (Flash of Unstyled Text) when you're manipulating your text after the DOM has loaded. Unfortunately, we found the best solution to avoid/minimize the FOUT caused by this plugin is to put your scripts (jQuery, Lettering.js) in the document
. On the one hand, your page will load slower. On the other hand, a flash/restyling makes your site feel slow. Users might ultimately feel the site is faster if they don't see the FOUT.
Download, Fork, Commit, Please.
We really want Lettering.js to be a quality helper for web typography. If you have any feedback or suggestions, please leave those over on the Github. We're excited about typography on the web and want to help make it print quality.


Discover One of our most amazing and wonderful places the view and the services are something to die for :D.
{{emplacement.description}}


line 1
line 2
line 3
line 4
line 5
line 6
line 4
line 5
line 6
line 4 ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
line 5
line 6
line 4
line 5
line 6
line 4
line 5
line 6
line 4
line 5
line 6
line 4
line 5
line 6
line 4
line 5
line 6
line 4
line 5
line 6


Skip navigation
Toggle navigation
Getting started
CSS
Components
JavaScript
TM add-ons
Pages
404 page
Under Construction
Porfolio
Slider
Social and media
Expo
Blog
Our Website is
Under Construction
We'll be here soon with a new website.
Days
Hours
Minutes
Seconds
Tweet


JQuery Practice1
Where do you want to go?
Travel Destinations
Plan your next adventure.
Rome
London
Paris
Take the Tour
Book Tickets Now


--- layout: default title: "Layer5 - Partners" permalink: /partners redirect_from: partners/ excerpt: "Layer5 - Partners" image: /assets/images/layer5/layer5-tag-linkedin.png ---


The base class that defines how images taken by two heads of a stereo camera are positioned in the same frame.
More...
#include <frame_layout.h>
|
| virtual cv::Size | frameSize () const =0 |
| | Gets the frame size. More...
|
| |
| virtual cv::Size | imageSize () const =0 |
| | Gets the image size. The Stereo UGV package assumes that images taken by two heads of a stereo camera have the same size. More...
|
| |
| virtual void | extractImages (const cv::Mat &frame, cv::Mat *left, cv::Mat *right) const =0 |
| | Extracts images from the given frame. The Stereo UGV package assumes that two heads of a stereo camera are aligned horizontally. More...
|
| |
The base class that defines how images taken by two heads of a stereo camera are positioned in the same frame.
◆ create()
Creates a FrameLayout.
The function determines the concrete subclass of the layout to be created by looking up the "type" key, and calls the corresponding initialization function. Currently, only "HPS-3D160" is supported.
- Parameters
-
| context | The context containing initialization parameters. |
- Returns
- A unique pointer to the created layout.
◆ extractImages()
| virtual void stereo_ugv::FrameLayout::extractImages |
( |
const cv::Mat & |
frame, |
|
|
cv::Mat * |
left, |
|
|
cv::Mat * |
right |
|
) |
| const |
|
pure virtual |
Extracts images from the given frame. The Stereo UGV package assumes that two heads of a stereo camera are aligned horizontally.
- Parameters
-
| frame | The frame. |
| left | The left image to be extracted. |
| right | The right image to be extracted. |
Implemented in stereo_ugv::HPS3D160FrameLayout.
◆ frameSize()
| virtual cv::Size stereo_ugv::FrameLayout::frameSize |
( |
| ) |
const |
|
pure virtual |
◆ imageSize()
| virtual cv::Size stereo_ugv::FrameLayout::imageSize |
( |
| ) |
const |
|
pure virtual |
Gets the image size. The Stereo UGV package assumes that images taken by two heads of a stereo camera have the same size.
- Returns
- The image size.
Implemented in stereo_ugv::HPS3D160FrameLayout.
The documentation for this class was generated from the following files:
- /home/yunhao/stereo_ugv/src/stereo_ugv/include/stereo_ugv/frame_layout.h
- /home/yunhao/stereo_ugv/src/stereo_ugv/src/stereo_ugv/frame_layout.cpp


Constructor
# new Hole(player, board, id, numSeeds, prevHole, nextHole)
Constructor
Parameters:
| Name | Type | Description |
|---|---|---|
player |
Player | The player to whom this hole is being assigned to |
board |
Board | The board on which the hole is placed |
id |
number | Unique hole ID (Ranging 0-16) -1 is used for the dummy pointer to the first hole. |
numSeeds |
number | Number of seeds to be initially added to the hole. |
prevHole |
Hole | The hole that is before this hole. |
nextHole |
Hole | The hole that comes up next in clockwise fashion |
Methods
# adjacencyDirection(targetHole) → {MoveDirection}
Calculates the move direction that corresponds to a users drag and drop action.
Seeds are dragged from an origin hole into the target hole. The direction is only returned if
the target hole is adjacent to the origin.
Parameters:
| Name | Type | Description |
|---|---|---|
targetHole |
Hole | the hole into which the seeds are being dragged into |
the direction that corresponds to the users drag and drop action.
# availableMovesForCurrentPlayer() → {Array.<Move>}
Gets the moves that are available for the current player
moves that can be played
Array.<Move>
# isEmpty() → {boolean}
Checks to see if the hole contains any seeds
true if seeds are present
boolean
# isInFrontRow() → {boolean}
Check if this hole is in the front row (Front rows are allowed to capture
seeds from enemy side).
true is the hole is in the front row for the owning player.
boolean
# transferAllSeedsToCurrPlayer() → {number}
Moves all seeds from the hole into players hand - clearing it to a count of 0.
The number of seeds that were moved from hole into players hand.
number
# transferSeedsFromCurrPlayer(numSeeds) → {number}
Removes seeds from players hand
Parameters:
| Name | Type | Description |
|---|---|---|
numSeeds |
number | Number of seeds to be removed from players hand |
Number of seeds removed from the player hand
number
# validateFinalSeedCount(numSeeds)
Checks if the the total number of seeds in players hand is valid
Parameters:
| Name | Type | Description |
|---|---|---|
numSeeds |
number | Number of seeds in players hand after adding or removing |
# validateNumSeeds(numSeeds)
Checks if the number of seeds to be added or removed from players hand is valid
Parameters:
| Name | Type | Description |
|---|---|---|
numSeeds |
number | Number of seeds to be added or removed from players hand |


This application is an example of how to integrate into the Blockchain Transparent Supply user interface. Use this to learn:
auth.service.ts
)data.service.ts
)
frame-location-strategy.ts
)
product-details.component.ts
)
The extension communicates with the parent UI through the use of postMessage
.
Open your browser's developer console to see the messages going back and forth.
View products to continue the demo.
You are authenticated in the extension as a member of: {{ name }}.
Loading your details...


Draggable div with plain text data
Draggable div with file
Draggable Image
Drag Stuff Into Me
Copy / Paste data from me
Try dragging files from Finder / Windows Explorer / Nautlius above ^


Phone: 645.2954 Fax: 645.2674
Phone: 645.2954 Fax: 645.2674 Web: subboard.com/accounting
Phone: 829.2584 Fax: 829.3641 Web: HealthEducation.buffalo.edu
Phone: 645.3056 Emergency:<PHONE_NUMBER> Web: legalassistance.buffalo.edu
Phone: 645.2959 Fax: 645.2674
Phone: 829.2224 Fax: 829.2232 Email<EMAIL_ADDRESS>Web: OffCampusHousing.buffalo.edu
Phone: 829.2368 Fax: 829.2531 Web: subboard.com/pharmacy
Phone: 645.3044 Fax: 645.3465 Web: HealthInsurance.buffalo.edu
Phone: 645.2353 Fax: 645.6296Email<EMAIL_ADDRESS>Web: sbiticket.buffalo.edu
Phone: 645.3370 Fax: 645.2674 Web: wrub.org


sparknlp.annotator.ContextSpellCheckerApproach¶
- class sparknlp.annotator.ContextSpellCheckerApproach[source]¶
Bases:
sparknlp.common.AnnotatorApproach
Trains a deep-learning based Noisy Channel Model Spell Algorithm.
Correction candidates are extracted combining context information and word information.
For instantiated/pretrained models, see
ContextSpellCheckerModel
.Spell Checking is a sequence to sequence mapping problem. Given an input sequence, potentially containing a certain number of errors,
ContextSpellChecker
will rank correction sequences according to three things:Different correction candidates for each word — word level.
The surrounding text of each word, i.e. it’s context — sentence level.
The relative cost of different correction candidates according to the edit operations at the character level it requires — subword level.
For extended examples of usage, see the article Training a Contextual Spell Checker for Italian Language, the Spark NLP Workshop.
Input Annotation types
Output Annotation type
TOKEN
TOKEN
- Parameters
- languageModelClasses
Number of classes to use during factorization of the softmax output in the LM.
- wordMaxDistance
Maximum distance for the generated candidates for every word.
- maxCandidates
Maximum number of candidates for every word.
- caseStrategy
What case combinations to try when generating candidates, by default 2. Possible values are:
0: All uppercase letters
1: First letter capitalized
2: All letters
- errorThreshold
Threshold perplexity for a word to be considered as an error.
- epochs
Number of epochs to train the language model.
- batchSize
Batch size for the training in NLM.
- initialRate
Initial learning rate for the LM.
- finalRate
Final learning rate for the LM.
- validationFraction
Percentage of datapoints to use for validation.
- minCount
Min number of times a token should appear to be included in vocab.
- compoundCount
Min number of times a compound word should appear to be included in vocab.
- classCount
Min number of times the word need to appear in corpus to not be considered of a special class.
- tradeoff
Tradeoff between the cost of a word error and a transition in the language model.
- weightedDistPath
The path to the file containing the weights for the levenshtein distance.
- maxWindowLen
Maximum size for the window used to remember history prior to every correction.
- configProtoBytes
ConfigProto from tensorflow, serialized into byte array.
See also
NorvigSweetingApproach
,SymmetricDeleteApproach
For alternative approaches to spell checking
References
For an in-depth explanation of the module see the article Applying Context Aware Spell Checking in Spark NLP.
Examples
>>> import sparknlp >>> from sparknlp.base import * >>> from sparknlp.annotator import * >>> from pyspark.ml import Pipeline
For this example, we use the first Sherlock Holmes book as the training dataset.
>>> documentAssembler = DocumentAssembler() \ ... .setInputCol("text") \ ... .setOutputCol("document") >>> tokenizer = Tokenizer() \ ... .setInputCols("document") \ ... .setOutputCol("token") >>> spellChecker = ContextSpellCheckerApproach() \ ... .setInputCols("token") \ ... .setOutputCol("corrected") \ ... .setWordMaxDistance(3) \ ... .setBatchSize(24) \ ... .setEpochs(8) \ ... .setLanguageModelClasses(1650) # dependant on vocabulary size ... # .addVocabClass("_NAME_", names) # Extra classes for correction could be added like this >>> pipeline = Pipeline().setStages([ ... documentAssembler, ... tokenizer, ... spellChecker ... ]) >>> path = "sherlockholmes.txt" >>> dataset = spark.read.text(path) \ ... .toDF("text") >>> pipelineModel = pipeline.fit(dataset)
Methods
__init__
()addRegexClass
(label, regex[, userdist])Adds a new class of words to correct, based on regex.
addVocabClass
(label, vocab[, userdist])Adds a new class of words to correct, based on a vocabulary.
clear
(param)Clears a param from the param map if it has been explicitly set.
copy
([extra])Creates a copy of this instance with the same uid and some extra params.
explainParam
(param)Explains a single param and returns its name, doc, and optional default value and user-supplied value in a string.
Returns the documentation of all params with their optionally default values and user-supplied values.
extractParamMap
([extra])Extracts the embedded default param values and user-supplied values, and then merges them with extra values from input into a flat param map, where the latter value is used if there exist conflicts, i.e., with ordering: default param values < user-supplied values < extra.
fit
(dataset[, params])Fits a model to the input dataset with optional parameters.
fitMultiple
(dataset, paramMaps)Fits a model to the input dataset for each param map in paramMaps.
Gets current column names of input annotations.
Gets whether Annotator should be evaluated lazily in a RecursivePipeline.
getOrDefault
(param)Gets the value of a param in the user-supplied param map or its default value.
Gets output column name of annotations.
getParam
(paramName)Gets a param by its name.
getParamValue
(paramName)Gets the value of a parameter.
hasDefault
(param)Checks whether a param has a default value.
hasParam
(paramName)Tests whether this instance contains a param with a given (string) name.
isDefined
(param)Checks whether a param is explicitly set by user or has a default value.
isSet
(param)Checks whether a param is explicitly set by user.
load
(path)Reads an ML instance from the input path, a shortcut of read().load(path).
read
()Returns an MLReader instance for this class.
save
(path)Save this ML instance to the given path, a shortcut of 'write().save(path)'.
set
(param, value)Sets a parameter in the embedded param map.
setBatchSize
(size)Sets batch size.
setCaseStrategy
(strategy)Sets what case combinations to try when generating candidates.
setClassCount
(count)Sets min number of times the word need to appear in corpus to not be considered of a special class.
setCompoundCount
(count)Sets min number of times a compound word should appear to be included in vocab.
Sets configProto from tensorflow, serialized into byte array.
setEpochs
(count)Sets number of epochs to train the language model.
setErrorThreshold
(threshold)Sets threshold perplexity for a word to be considered as an error.
setFinalRate
(rate)Sets final learning rate for the LM.
setInitialRate
(rate)Sets initial learning rate for the LM.
setInputCols
(*value)Sets column names of input annotations.
setLanguageModelClasses
(count)Sets number of classes to use during factorization of the softmax output in the Language Model.
setLazyAnnotator
(value)Sets whether Annotator should be evaluated lazily in a RecursivePipeline.
setMaxCandidates
(candidates)Sets maximum number of candidates for every word.
setMaxWindowLen
(length)Sets the maximum size for the window used to remember history prior to every correction.
setMinCount
(count)Sets min number of times a token should appear to be included in vocab.
setOutputCol
(value)Sets output column name of annotations.
setParamValue
(paramName)Sets the value of a parameter.
setTradeoff
(alpha)Sets tradeoff between the cost of a word error and a transition in the language model.
setValidationFraction
(fraction)Sets percentage of datapoints to use for validation.
setWeightedDistPath
(path)Sets the path to the file containing the weights for the levenshtein distance.
setWordMaxDistance
(dist)Sets maximum distance for the generated candidates for every word.
write
()Returns an MLWriter instance for this ML instance.
Attributes
batchSize
caseStrategy
classCount
compoundCount
configProtoBytes
epochs
errorThreshold
finalRate
getter_attrs
initialRate
inputCols
languageModelClasses
lazyAnnotator
maxCandidates
maxWindowLen
minCount
name
outputCol
Returns all params ordered by name.
tradeoff
validationFraction
weightedDistPath
wordMaxDistance
- addRegexClass(label, regex, userdist=3)[source]¶
Adds a new class of words to correct, based on regex.
- Parameters
- labelstr
Name of the class
- regexstr
Regex to add
- userdistint, optional
Maximal distance to the word, by default 3
- addVocabClass(label, vocab, userdist=3)[source]¶
Adds a new class of words to correct, based on a vocabulary.
- Parameters
- labelstr
Name of the class
- vocabList[str]
Vocabulary as a list
- userdistint, optional
Maximal distance to the word, by default 3
- clear(param)¶
Clears a param from the param map if it has been explicitly set.
- copy(extra=None)¶
Creates a copy of this instance with the same uid and some extra params. This implementation first calls Params.copy and then make a copy of the companion Java pipeline component with extra params. So both the Python wrapper and the Java pipeline component get copied.
- Parameters
extra – Extra parameters to copy to the new instance
- Returns
Copy of this instance
- explainParam(param)¶
Explains a single param and returns its name, doc, and optional default value and user-supplied value in a string.
- explainParams()¶
Returns the documentation of all params with their optionally default values and user-supplied values.
- extractParamMap(extra=None)¶
Extracts the embedded default param values and user-supplied values, and then merges them with extra values from input into a flat param map, where the latter value is used if there exist conflicts, i.e., with ordering: default param values < user-supplied values < extra.
- Parameters
extra – extra param values
- Returns
merged param map
- fit(dataset, params=None)¶
Fits a model to the input dataset with optional parameters.
- Parameters
dataset – input dataset, which is an instance of
pyspark.sql.DataFrame
params – an optional param map that overrides embedded params. If a list/tuple of param maps is given, this calls fit on each param map and returns a list of models.
- Returns
fitted model(s)
New in version 1.3.0.
- fitMultiple(dataset, paramMaps)¶
Fits a model to the input dataset for each param map in paramMaps.
- Parameters
dataset – input dataset, which is an instance of
pyspark.sql.DataFrame
.paramMaps – A Sequence of param maps.
- Returns
A thread safe iterable which contains one model for each param map. Each call to next(modelIterator) will return (index, model) where model was fit using paramMaps[index]. index values may not be sequential.
New in version 2.3.0.
- getInputCols()¶
Gets current column names of input annotations.
- getLazyAnnotator()¶
Gets whether Annotator should be evaluated lazily in a RecursivePipeline.
- getOrDefault(param)¶
Gets the value of a param in the user-supplied param map or its default value. Raises an error if neither is set.
- getOutputCol()¶
Gets output column name of annotations.
- getParam(paramName)¶
Gets a param by its name.
- getParamValue(paramName)¶
Gets the value of a parameter.
- Parameters
- paramNamestr
Name of the parameter
- hasDefault(param)¶
Checks whether a param has a default value.
- hasParam(paramName)¶
Tests whether this instance contains a param with a given (string) name.
- isDefined(param)¶
Checks whether a param is explicitly set by user or has a default value.
- isSet(param)¶
Checks whether a param is explicitly set by user.
- classmethod load(path)¶
Reads an ML instance from the input path, a shortcut of read().load(path).
- property params¶
Returns all params ordered by name. The default implementation uses
dir()
to get all attributes of typeParam
.
- classmethod read()¶
Returns an MLReader instance for this class.
- save(path)¶
Save this ML instance to the given path, a shortcut of ‘write().save(path)’.
- set(param, value)¶
Sets a parameter in the embedded param map.
- setCaseStrategy(strategy)[source]¶
Sets what case combinations to try when generating candidates.
Possible values are:
0: All uppercase letters
1: First letter capitalized
2: All letters
- Parameters
- strategyint
Case combinations to try when generating candidates
- setClassCount(count)[source]¶
Sets min number of times the word need to appear in corpus to not be considered of a special class.
- Parameters
- countfloat
Min number of times the word need to appear in corpus to not be considered of a special class.
- setCompoundCount(count)[source]¶
Sets min number of times a compound word should appear to be included in vocab.
- Parameters
- countint
Min number of times a compound word should appear to be included in vocab.
- setConfigProtoBytes(b)[source]¶
Sets configProto from tensorflow, serialized into byte array.
- Parameters
- bList[int]
ConfigProto from tensorflow, serialized into byte array
- setEpochs(count)[source]¶
Sets number of epochs to train the language model.
- Parameters
- countint
Number of epochs
- setErrorThreshold(threshold)[source]¶
Sets threshold perplexity for a word to be considered as an error.
- Parameters
- thresholdfloat
Threshold perplexity for a word to be considered as an error
- setFinalRate(rate)[source]¶
Sets final learning rate for the LM.
- Parameters
- ratefloat
Final learning rate for the LM
- setInitialRate(rate)[source]¶
Sets initial learning rate for the LM.
- Parameters
- ratefloat
Initial learning rate for the LM
- setInputCols(*value)¶
Sets column names of input annotations.
- Parameters
- *valuestr
Input columns for the annotator
- setLanguageModelClasses(count)[source]¶
Sets number of classes to use during factorization of the softmax output in the Language Model.
- Parameters
- countint
Number of classes
- setLazyAnnotator(value)¶
Sets whether Annotator should be evaluated lazily in a RecursivePipeline.
- Parameters
- valuebool
Whether Annotator should be evaluated lazily in a RecursivePipeline
- setMaxCandidates(candidates)[source]¶
Sets maximum number of candidates for every word.
- Parameters
- candidatesint
Maximum number of candidates for every word.
- setMaxWindowLen(length)[source]¶
Sets the maximum size for the window used to remember history prior to every correction.
- Parameters
- lengthint
Maximum size for the window used to remember history prior to every correction
- setMinCount(count)[source]¶
Sets min number of times a token should appear to be included in vocab.
- Parameters
- countfloat
Min number of times a token should appear to be included in vocab
- setOutputCol(value)¶
Sets output column name of annotations.
- Parameters
- valuestr
Name of output column
- setParamValue(paramName)¶
Sets the value of a parameter.
- Parameters
- paramNamestr
Name of the parameter
- setTradeoff(alpha)[source]¶
Sets tradeoff between the cost of a word error and a transition in the language model.
- Parameters
- alphafloat
Tradeoff between the cost of a word error and a transition in the language model
- setValidationFraction(fraction)[source]¶
Sets percentage of datapoints to use for validation.
- Parameters
- fractionfloat
Percentage of datapoints to use for validation
- setWeightedDistPath(path)[source]¶
Sets the path to the file containing the weights for the levenshtein distance.
- Parameters
- pathstr
Path to the file containing the weights for the levenshtein distance.
- setWordMaxDistance(dist)[source]¶
Sets maximum distance for the generated candidates for every word.
- Parameters
- distint
Maximum distance for the generated candidates for every word
- uid¶
A unique id for the object.
- write()¶
Returns an MLWriter instance for this ML instance.


My Profile
FirstName
1 new message/s
1 new task/s
Edit Profile
Assign tasks
Send a Message
How-to video
To-do list
No tasks for this day
No tasks for this day
No tasks for this day
No tasks for this day
No tasks for this day
No tasks for this day
No tasks for this day


ppmmake(1) ppmmake(1) NAME ppmmake - create a pixmap of a specified size and color SYNOPSIS ppmmake color width height DESCRIPTION Produces a portable pixmap of the specified color, width, and height. The color can be specified in five ways: o A name, assuming that a pointer to an X11-style color names file was compiled in. o An X11-style hexadecimal specifier: rgb:r/g/b, where r g and b are each 1- to 4-digit hexadecimal numbers. o An X11-style decimal specifier: rgbi:r/g/b, where r g and b are floating point numbers between 0 and 1. o For backwards compatibility, an old-X11-style hexadecimal number: #rgb, #rrggbb, #rrrgggbbb, or #rrrrggggbbbb. o For backwards compatibility, a triplet of numbers separated by commas: r,g,b, where r g and b are floating point numbers between 0 and 1. (This style was added before MIT came up with the simi‐ lar rgbi style.) SEE ALSO ppm(5), pbmmake(1) AUTHOR Copyright (C) 1991 by Jef Poskanzer. 24 September 1991 ppmmake(1)


I am an enthusiastic and creative professional photographer with a strong passion for capturing the fleeting beauty of people and everyday life.


15.5 Description of RSA
RSA
(Rivest-Shamir-Adleman) is one of the most popular asymmetric,
or public-key, ciphers. RSA is
asymmetric because the key used to encipher data is not the
same key used to decipher it. Like DES, RSA is a block cipher,
but the block size varies depending on the size of the keys.
If the amount of data to be encrypted is not an even multiple
of this size, it is padded in some application-specific
way.
One important implication of RSA being an
asymmetric cipher is that when transmitting data across a
network, the key used to encipher the data does not have to be
transmitted with the data itself. Thus, there is less chance
of having the key compromised. RSA is also useful when parties
enciphering data are not allowed to decipher the data of
others. Parties who wish to encipher data use one key, which
is considered public, while parties allowed to decipher the
data use a second key, which they keep private.
RSA is considered very secure, but it runs
considerably slower than DES. As with DES, the security of RSA
has never been proven, but it is related to the difficult
problem of factoring large numbers (numbers containing at
least 200 decimal digits). Since no efficient solutions are
known for this problem, it is conjectured that there are no
efficient ways to crack RSA.
RSA is based on principles that are less
obtuse than the numerous permutations and substitutions
performed in DES. Fundamentally, enciphering and deciphering
data revolves around modular
exponentiation, an operation
in modular arithmetic. Modular
arithmetic is integer arithmetic as usual except that when we
work modulo n, every result
x is replaced with a member of
{0, 1, . . . , n - 1} so that
x mod n is the remainder of x /n.
For example, 40 mod 11 = 7 because 40/11 = 3 with a remainder
of 7. Modular exponentiation is the process of computing ab mod n.
15.5.1 Computing Public and Private
Keys
In RSA, the public key and private key work
together as a pair. The public key is used to encipher a block
of data, after which only the corresponding private key can be
used to decipher it. When generating keys, we follow a few
steps to ensure that this marriage works. These steps also
ensure that there is no practical way to determine one key
from the other.
To begin, we select two large prime numbers,
which are called p and q (see the related topics at the end
of the chapter). Considering today's factoring technology,
these each should be at least 200 decimal digits to be
considered secure in practice. We then compute n, the product of these numbers:
n = pq
Next, we choose a small odd integer e, which will become part of the
public key. The most important consideration in choosing e is that it should have no factors
in common with (p - 1)(q - 1). In other words, e is relatively prime with (p - 1) (q - 1). For example, if p = 11 and q = 19, then n = (11)(19) = 209. Here we might
choose e = 17 because (p - 1)(q - 1) = (10)(18) = 180, and 17 and
180 have no common factors. Common choices for e are 3, 17, and 65,537. Using one of
these values does not jeopardize the security of RSA because
deciphering data is a function of the private key.
Once we have chosen a value for e, we compute a corresponding value
d, which will become part of
the private key. To do this, we compute the multiplicative
inverse of e, modulo (p - 1)(q - 1), as follows:
d =
e-1 mod (p-1)(q-1)
The way to think of this is: what value of
d satisfies ed mod (p - 1)(q - 1) = 1? For example, in the
equation 17d mod 180 = 1, one
possible value for d is 53.
Other possibilities are 233, 413, 593, and so forth. An
extension of Euclid's algorithm is used to compute
multiplicative modular inverses in practice (see the related
topics at the end of the chapter). In this book, code is
provided for using d and e but not for deriving them.
Now that we have values for both e and d, we publish (e, n)
as the public key P and keep
(d, n) secret as the private key S, as shown:
p = (e, n)
S = (d,n)
Parties who encipher data use P. Those who decipher data use S. To ensure that even someone who
knows P cannot compute S, the values used for p and q must never be revealed.
The security offered by P and S together comes from the fact that
multiplication is a good one-way
function. One-way functions are fundamental to
cryptography. Simply stated, a one-way function is a function
that is relatively easy to compute in one direction but
impractical to reverse. For example, in RSA, multiplying p and q is a one-way function because
although multiplying p and
q is easy, factoring n back into p and q is extremely time-consuming,
provided the values chosen for p and q are large enough.
The steps performed to compute P and S have their origin in some
interesting properties of Euler's
function (pronounced
"oiler"). In particular, these properties allow us to do
useful things with modular exponentiation. Euler's function,
denoted f (n), defines how many numbers less
than n are relatively prime with n. Two numbers are said to be
relatively prime if their only common factor is 1. As an
example of Euler's function, f (8) = 4 because there are four
numbers less than 8 that are relatively prime with 8, namely
1, 3, 5, and 7.
Euler's function has two properties that are
particularly relevant to RSA. First, when n is prime, f (n) = n
- 1. This is because the only factors of n are 1 and n; thus, n is relatively prime with all of the
n - 1 numbers before it.
Another interesting property is that f (n) is the exponential period modulo n for numbers relatively prime with
n. This means that for any
number a < n relatively prime with n, a
f (n) mod n = 1. For example, 14 mod
8 = 1, 34 mod 8 = 1, 54 mod 8 = 1, and
74 mod 8 = 1. Multiplying both sides of this
equation by a yields:
Hence, 15 mod 8 = 1, 35
mod 8 = 3, 55 mod 8 = 5, and 75 mod 8 =
7. This algebraic adjustment is powerful because for some
equation c = me mod n, it lets us find a value d so that c
d mod n = m. This is the identity that allows
us to encipher data in RSA and then decipher the data back as
shown below:
The relationship of Euler's function with
exponential periods guarantees that any block of data we
encipher will decipher again uniquely. To find d, we solve the equation d = e
- 1f (n)
+ 1. Unfortunately, there is not always an integer solution to
d = e - 1f (n) + 1. For example, consider if
e = 5 and n = 13. In this case, d = (1/5)((13 - 1) + 1) = (1/5)(13).
To deal with this, we compute d
modulo f (n). In other words, d = (e - 1f (n) + 1) mod f (n), which can be simplified to:
We can make this simplification because
(f
(n) + 1) mod f (n) = (f (n)
+ 1) - f (n)
= 1. We can verify this by inserting any number in place of
f
(n). Notice the similarity
between this equation and the one used for d earlier in the steps for computing
keys. This provides a way to compute d from e and n. Of course, since e and n are public and potentially known to
an adversary, one might ask: doesn't this give an adversary
the same opportunity to compute the private key? At this point
it is worth examining where RSA's security comes from.
RSA gets its security from the critical fact
that Euler's function is multiplicative. This means that if
p and q are relatively prime (which they
are if we choose them both to be prime), then f (pq) = f (p)f (q). Thus, if we have two primes p and q, and n = pq, then f (n) = (p - 1)(q - 1), and most importantly:
d =
e-1 mod (p-1)(q-1)
Therefore, even though an adversary might
know both e and n, in order to compute d, she would have to know f (n), which can only be determined in a
practical manner by knowing both p and q. Since these are not known, the
adversary is left to factor n,
an extremely time-consuming process, provided the values
chosen for p and q are large enough.
15.5.2 Enciphering and Deciphering
Data Blocks
To encipher and decipher data with RSA, we
first need to choose a block size. To do this, we must ensure
that the largest value that the block can store, considering
its total number of bits, is less than n. For example, if p and q are primes containing 200 decimal
digits, n will be just under
400 decimal digits. Therefore, we should choose a block size
small enough to store only those numbers with less than this
many decimal digits. In practice, we often choose the block
size in bits to be the largest power of 2 less than n. For example, if n were 209, we would choose a block
size of 7 bits because 27 = 128 is less than 209,
but 28 = 256 is greater.
To encipher a block of plaintext Mi, the i th block of data from a buffer
M, we use the public key (e, n)
to take the numerical value of Mi, raise it to the power of e, and take the result modulo n. This yields a block of ciphertext
Ci. The modulo n operation ensures that Ci will fit into the same size block
as the plaintext. Thus, to encipher a block of plaintext:
It was mentioned earlier that Euler's
function is the basis for using modular exponentiation to
encipher data using this equation and, in the equation that
follows, for being able to get the original plaintext back. To
decipher a block of ciphertext Ci, the i th block of ciphertext from a
buffer C, we use the private
key (d, n) to take the numeric value of Ci , raise it to the power of d, and take the result modulo n. This yields the original block of
plaintext Mi. Thus, to decipher
a block of ciphertext:
|


Your Contacts
| Name | Phone No | Created On | ||
|---|---|---|---|---|
| {{ first_name }} {{ last_name }} | {{ email }} | {{ phno }} | {{ createdOn }} | |
| No contacts yet. Import your contacs by selecting CSV file. |
{{> header }}
| Name | Phone No | Created On | ||
|---|---|---|---|---|
| {{ first_name }} {{ last_name }} | {{ email }} | {{ phno }} | {{ createdOn }} | |
| No contacts yet. Import your contacs by selecting CSV file. |


Far and Away
Far and Away is a movie starring Tom Cruise, Nicole Kidman, and Thomas Gibson. A young Irish couple flee to the States, but subsequently struggle to obtain land and prosper freely.


Navan RFC games off this weekend following HSE advice
by Conall CollierNavan RFC men's games scheduled for this weekend have been postponed following HSE advice.
THis has arisen following a mumps outbreak in Navan RFC within senior men's squad
On Medical advice the club has decided to cancel all men's senior team matches - first Team, J1's, 3rds and Under - 20's until the outbreak has run its course.
"Any player who feels at risk of catching mumps should go to their GP and get vaccinated, free of charge, regardless of whether they have been vaccinated before or not," stated a club official.
"Any player who has not been vaccinated would be strongly encouraged to get vaccinated.
"The vaccination takes two weeks to work, approximately.
"The club will resume playing when it receives medical advice to do so," added the club official.
The Ladies game Navan v Gorey on goes ahead.


Hammad Ahmed Khan
Shankar Das
Maze Solving Robot
Introduction
Our robot works on two steps:The first is to drive through the maze and find the end of it. The second is to optimize that path so our robot can travel back through the maze, but do it perfectly without going towards any dead ends.
How does the robot find the end of the maze?
We have chosen a technique,i.e Left hand preferrence.When our robot finds multiple paths, it will go towards its left.
there are various possibilities of paths that our robot will face. If it faces a straight and left, it will chose left. If it faces a left and right, it will go the same. But if it will face a right and straight, it will go straight. A dead end will make our robot to turn around from its position and go backward to the turn.
L = left turn
R= right turn
S= going straight past a turn
B= turning around
So let us apply this method on the simple maze. View the photos to see this method in action.
The yellowish green will be the robot.
Look at the photos for the correct path means shortest path.
LBL=S;
LBS=R;
Final correct path=SRR;
After solving the path it will follow this shortest path
Our robot optimizes the path as it travels. The path is stored in an array and every time it goes to store a new move, it checks to see if the previous move was a "B", if it was then it optimizes the path. :
Machenical Design
High Level Design
Following is our high level block diagram which is self defined about how our machine's internal operations are being done.Description of Principle of Operations
I would like to start from IR-sensors which senses the black line through an array of six,horizontally alligned sensors. That signal is transmitted to our core-controlling body,the micro-controller which conveys orders to gear motors for either left or right turn or going straight,depends upon the path and the algorithym that we have burned in our micro-controller. Motors will go accordingly,for making a turn,one of the motors will stop moving and the machine will turn towards the side where motor is off.- The Micro-controller (ATmega 32u4)
- Motor Driver IC (L293D)
- 2 Micro Metal Gearmotors
- Analog Reflectance Sensor Array
- Pair of Wheels
- Ball Caster
- 7.4V Battery (Rechargeable)
- Complies fully with Universal Serial Bus Specification Rev 2.0
- Supports data transfer rates up to 12Mbit/s and 1.5Mbit/s
- Endpoint 0 for Control Transfers: up to 64-bytes
- Six Programmable Endpoints with IN or Out Directions and with Bulk, Interrupt or Isochronous Transfers
- Configurable Endpoints size up to 256 bytes in double bank mode
- Fully independent 832 bytes USB DPRAM for endpoint memory allocation
-
Program Memory Size 32 KB
-
SRAM 2,560 KB
-
Data EEPROM/HEF 1024 (bytes)
- We have added motor driver IC(L293D) which drives the two motors of the robot.
- Since we are using 7.4v battery for motor driver IC but the requirement of micro-controller is 5v that's why we have used 5v regulator IC which convert the 7.4v to 5v.
- We have given direct inputs in Motor driver IC from micro-controller by using 3,8,9,12 digital pins.
Choice of Components
Brief Description of Major Components
The Micro-controller (ATmega 32u4)
It has 44 I/O pins, following are the specifications.
L293D is a typical Motor driver or Motor Driver IC which allows DC motor to drive on either direction. L293D is a 16-pin IC which can control a set of two DC motors simultaneously in any direction. It means that you can control two DC motor with a single L293D IC
Analog Reflectance Sensor Array
This sensor module has 8 IR LED/phototransistor pairs mounted on a 0.375" pitch, making it a great detector for a line-following robot. Pairs of LEDs are arranged in series to halve current consumption, and a MOSFET allows the LEDs to be turned off for additional sensing or power-savings options. Each sensor provides a separate analog voltage output.
Connectivity to components (Protocol)
We have two gear motors, each have two connections,one of them is forward and the other one is reverse. That is why we are using four pins of Motor driver IC to connect with motors and four digital pins of micro-controller to connect with motor controller IC. According to our programming, we have declared variables(leftMotor1& rightMotor1) for forward pins of left motor and right motor respectively. Same is the case for backward pins. We have used four analog pins of micro-controller to recieve signals through IR-sensors. This is all we learnt throughout the making of this project.Blue wires is the forward pins of motors.
Design
Electrical Schmetic
Brief Description of Schematic
We have taken simple leonardo board from Sir Nadir Ali and we have did some amendments as per the requirement of our project.
PCB Layout
Challenges you faced in routing how you got around them
In the beginning we separately designed the pcb of motor controller IC(L293d) and leonardo board, but after concerning with our instructor and as our project need provokes us, we redesigned a single pcb having both traits(L293D and leonardo one). But in doing this, we faced the trouble of overlapping of routes which were solved by using zero ohm resistors.
We have also faced problem regarding making of the longer routes as in our project, our digital pins have a prolong connection with motor-controller IC which was solved by re-orienting the pins very nearest to the IC.
Bill of Material on taped on a Paper
Picture of Clean Printed Circuit Board
Picture of Populated Circuited Board
Procedure adopted to burn Bootloader
Following are the steps that one should follow when he/she is boot-loading their board.
Step #1
First connect both AVR-ISP and USB mini data cables with board.
Step #2
Open the arduino IDE and do as per the instruction given in the following pictures.
Step #3
Step #4
Finally the thing that we longed for was in our hands...A successfully bootloaded board.
Challenges you faced in Bootup and how you got around them
We did not face any challenge during boot-loading of our board.
Picture of successfully operating circuit
The Flow Code of our Software Design
Diagram outlining main Functions
Challenges we have faced in coding and how we got around them
First of all we have faced the declaration of variables that which variables is specific for forward and reverse pins of motors.
After that we have faced some issues in turning of the robot, we have controlled a smooth turning by changing the leap time(mentioned in the coding).
After troubleshooting and testing again and again finally we got the output.
CAD Design of Enclosure (Your design considerations)
CAD Design with Dimensions
Picture of the final design
Business model you can make with this product
Although our project is not going to help the community as this is a small prototype
of the bigger concept which is "obtaining the shortest path to the destination after passing
through several tangled and longer paths and returning through the simplest and the shortest one after acknowledgement".
Application of this concept is in the rescuing department which includes the ambulances and the fire extinguishers.
As discussed, ambulance will take several puzzled and long paths but after
fetching the patient it will take the most simple and shortest path to get them to hospitals.
Deligation of Tasks
Shankar Das
Hammad Ahmed
review of literature/datasheets
60%
40%
Selection of components
50%
50%
design of electrical circuit
and PCB Layout
60%
40%
Writing firmware
60%
40%
testing/debugging of
Hardware and Software
50%
50%
Design of Chasis
20%
80%
Intellectual Properties and Ethics Considerations
First of all we have Referred several sites but Instructables was most helpful in comparison to all. In that site they have discussed every minute aspect regarding the machine.
All those which were pre-requisites of our project,we have taken those from Instructables except the Printed Ciruit Board.
Cost of Project
Components
Cost (PKR)
2 Micro Metal Gearmotors
1000
QTR IR_Sensors
1550
Ball Causter
400
Chassis
700
Pair of Wheel
600
7.4V Lipo Battery
400
The Micro-controller (ATmega 32u4))
300
PCB bill of materials
400
Results
Firstly our robort solved the whole maze and after that it has follow the shortest path.
It is left path preference robot.
Procedure adopted to burn Bootloader
Following are the steps that one should follow when he/she is boot-loading their board.
Step #1
First connect both AVR-ISP and USB mini data cables with board.
Step #2
Open the arduino IDE and do as per the instruction given in the following pictures.
Step #3
Step #4
Finally the thing that we longed for was in our hands...A successfully bootloaded board.
Challenges you faced in Bootup and how you got around them
We did not face any challenge during boot-loading of our board.
Picture of successfully operating circuit
The Flow Code of our Software Design
Diagram outlining main Functions
Challenges we have faced in coding and how we got around them
First of all we have faced the declaration of variables that which variables is specific for forward and reverse pins of motors. After that we have faced some issues in turning of the robot, we have controlled a smooth turning by changing the leap time(mentioned in the coding). After troubleshooting and testing again and again finally we got the output.
CAD Design of Enclosure (Your design considerations)
CAD Design with Dimensions
Picture of the final design
Business model you can make with this product
Although our project is not going to help the community as this is a small prototype of the bigger concept which is "obtaining the shortest path to the destination after passing through several tangled and longer paths and returning through the simplest and the shortest one after acknowledgement".Application of this concept is in the rescuing department which includes the ambulances and the fire extinguishers. As discussed, ambulance will take several puzzled and long paths but after fetching the patient it will take the most simple and shortest path to get them to hospitals.
Deligation of Tasks
| Shankar Das | Hammad Ahmed | |
| review of literature/datasheets | 60% | 40% |
| Selection of components | 50% | 50% |
| design of electrical circuit and PCB Layout |
60% | 40% |
| Writing firmware | 60% | 40% |
| testing/debugging of Hardware and Software |
50% | 50% |
| Design of Chasis | 20% | 80% |
Intellectual Properties and Ethics Considerations
First of all we have Referred several sites but Instructables was most helpful in comparison to all. In that site they have discussed every minute aspect regarding the machine. All those which were pre-requisites of our project,we have taken those from Instructables except the Printed Ciruit Board.
Cost of Project
| Components | Cost (PKR) |
| 2 Micro Metal Gearmotors | 1000 |
| QTR IR_Sensors | 1550 |
| Ball Causter | 400 |
| Chassis | 700 |
| Pair of Wheel | 600 |
| 7.4V Lipo Battery | 400 |
| The Micro-controller (ATmega 32u4)) | 300 |
| PCB bill of materials | 400 |
Results
Firstly our robort solved the whole maze and after that it has follow the shortest path.
It is left path preference robot.
Reference you have used in to implement the project
https://www.instructables.com/id/Maze-Solving-Robot/
https://www.mouser.com/datasheet/2/268/7766s-1065155.pdf
https://www.elprocus.com/infrared-ir-sensor-circuit-and-working/
https://www.pololu.com/product/960
Appendix
Zip file containing source code
click here to download Arduino code
Zip file containing sch and brd files
click here to download Eagle file
Zip file containing cad files
click here to download Solid work file of Chassis


At least S$1.2 million lost in Facebook impersonation scams
SINGAPORE: Scammers using hacked or spoofed Facebook accounts have cheated victims at least S$1.2 million this year, said the Singapore Police Force (SPF) in a news release on Monday (Nov 25).
At least 45 reports of these Facebook impersonation scams were made between January and September 2019.
The victims of such scams tend to be older people aged 60 years and above, the police added, "likely because they are not aware that Facebook accounts could be hacked or spoofed" and "they tend to be more trusting".
READ: S$6 million lost to phone scammers impersonating technical support staff and police
READ: 192 scams with fake Lazada and Shopee lucky draws reported this year - police
Scammers would contact their victims using compromised Facebook accounts belonging to friends or family members.
After introducing the victims to various types of grants, the scammers would tell the victims to provide their personal details, and transfer money to bank accounts or remit funds overseas supposedly in order to receive the grant.
READ: Police warn about online ticket scams for Universal Studios Singapore, other attractions
READ: Deceived by fake Changi Airport lucky draw, scam victims lose S$40,000
Police highlighted several red flags that the public can take cues from to guard themselves from such scams:
- Unusual requests on social media or text messages, even if they were sent by your contacts
- Get-rich-quick offers that ask you to transfer money in return for more money
- Requests for personal information, bank account, credit or debit card details, or one-time passwords (OTP)
"If in doubt, verify the authenticity of the request or text message by contacting your friend, but do not do so through the social media platform as the account might have been taken over by scammers," added SPF.
More information can be found at www.scamalert.sg.


Perform competing risks analysis under bivariate Pareto models. See Shih et al. (2018) <doi:10.1080/03610926.2018.1425450> for details.
| Version: | 1.0.2 |
| Depends: | compound.Cox |
| Published: | 2018-04-02 |
| Author: | Jia-Han Shih, Wei Lee |
| Maintainer: | Jia-Han Shih <tommy355097 at gmail.com> |
| License: | GPL-2 |
| NeedsCompilation: | no |
| In views: | Distributions |
| CRAN checks: | Bivariate.Pareto results |
| Reference manual: | Bivariate.Pareto.pdf |
| Package source: | Bivariate.Pareto_1.0.2.tar.gz |
| Windows binaries: | r-devel: Bivariate.Pareto_1.0.2.zip, r-release: Bivariate.Pareto_1.0.2.zip, r-oldrel: Bivariate.Pareto_1.0.2.zip |
| OS X binaries: | r-release: Bivariate.Pareto_1.0.2.tgz, r-oldrel: Bivariate.Pareto_1.0.2.tgz |
| Old sources: | Bivariate.Pareto archive |
Please use the canonical form https://CRAN.R-project.org/package=Bivariate.Pareto to link to this page.


{% extends "base.html" %} {% load bootstrap4 %} {% block content %} Home Applications {{ application.name }} Delete
Are you sure you want to delete this application?