TABLE OF CONTENT
A. GS1 Related Art and Culture 1. India to celebrate Falun Gong B. GS2 Related Polity 1. SC stays cattle sale rules across nation 2. Ministry forms panel for cruise tourism 3. Minimum qualifications for coop. societies’ polls International Relations 1. U.S. may tighten rules for foreign students C. GS3 Related Economics 1. 5 States, a UT sign pact with Centre on e-Marketplace 2. Sugar import duty increased to 50% to support domestic prices 3. Railways to promote small entrepreneurs in big way Environment and Ecology 1. Sensor network to map and predict pollution, effluents in Godavari D. GS4 Related E. Concepts-in-News: Related Concepts to Revise/Learn F. Bills/Acts/Schemes/Orgs in News G. Practice Questions for UPSC Prelims Exam
UPSC Current Affairs 2017: News Analysis
A. GS1 Related
1. India to celebrate Falun Gong
In news:
- Falun Gong, the ancient Chinese holistic system that is banned in China, will be celebrated in India on July 15 with a parade and Human Word Formation in New Delhi
Basic Information:
Falun Gong:
- Falun Gong (literally, “Dharma Wheel Practice” or “Law Wheel Practice”) is a Chinese spiritual practice that combines meditation and qigong exercises with a moral philosophy centered on the tenets of truthfulness, compassion, and forbearance
- The practice emphasizes morality and the cultivation of virtue, and identifies as a qigong practice of the Buddhist school, though its teachings also incorporate elements drawn from Taoist traditions. Through moral rectitude and the practice of meditation, practitioners of Falun Gong aspire to eliminate attachments, and ultimately to achieve spiritual enlightenment.
- Qigong is a holistic system of coordinated body posture and movement, breathing, and meditation used for health, spirituality, and martial arts training
C. GS2 Related
1. SC stays cattle sale rules across nation
Context:
- Union Government’s May 26 notification: banned cattle sale in livestock markets for slaughter and religious sacrifices.
- The rules banned trading in cattle for slaughter at animal markets. The rules included buffaloes in their definition of cattle, raising concerns that they would jeopardize the buffalo meat export business as the supply chain of spent buffaloes will be disrupted.
- The Central rules drew criticism from various quarters, including opposition parties, who argued that they virtually ban the sale of cattle in the country.
In news:
- The Supreme Court stayed the Centre’s May 26 notification.
- Government’s stance: the government acquiesced that public outcry and objections from the States about the law’s impact on livelihoods made it realise that the rules need “tweaking”.
- Additional Solicitor- General P. Narasimha response: the government had received a “large number of representations” that “certain aspects” of the Prevention of Cruelty to Animals (Regulation of Livestock Markets) Rules, 2017 and the Prevention of Cruelty to Animals (Maintenance of Case Property Animals) Act, 2017 were “troubling” and threw up some “sensitive” questions about the Central rules.
2. Ministry forms panel for cruise tourism
In News
- The Shipping Ministry is setting up a committee to examine cruise tourism reforms
Objectives of the Committee
The committee will consider a single window system for
- cruise requirements
- dedicated approach road for cruise terminals
- reducing security layer for passengers and other measures
Other efforts by the Government
- The Ministry had hired a global consultant to firm up an action plan aimed at facilitating customer-friendly and hassle-free logistics process for the cruise tourism industry
Current Scenario of the cruise tourism in India
- India’s cruise passengers stood at 1.76 lakh in 2016-17, which was merely 0.5% of the global share
- Domestic cruise passengers are estimated to grow to 1.5 million by 2031-32
- Of the 12 major ports Mumbai, Goa, Cochin, New Mangalore and Chennai have facilities to berth international cruise ships
3. Minimum qualifications for coop. societies’ polls
In news:
- Rajasthan has become the country’s first State to lay down the minimum educational qualifications for contesting elections to village cooperative societies and various other cooperative bodies.
- The State Cooperative Societies Rules, 2003, were amended for the purpose and notified on Monday.
-
Qualification:
- The educational qualifications will range from Class V to Class VIII for election as members of governing boards of dairy societies, farming societies, consumer societies, weavers’ societies, housing construction societies, urban banks, primary land development banks, credit societies, salary earners’ societies and cooperative unions.
Category: INTERNATIONAL RELATIONS
1. U.S. may tighten rules for foreign students
Present System:
- International students can stay in the U.S. as long as they are enrolled for a programme.
- Students who enter the U.S on F-1 visas are issued an entry document with an end date that states “duration of stay”, which is theoretically open-ended. They can stay as long as they have a valid I-20 document, which is issued by the university, with all details regarding the student’s programme of study, financing, etc. They can also move from one programme to another and from one institution to another, by a notification, based on a new I-20 document that the institution issues.
Key fact:
- Indians are the fastest growing group among the international student population in the U.S.
- There are 1,66,000 students from India pursuing higher education in the U.S. now, up from about 1,00,000 two years earlier. A large majority of them pursue science, technology, engineering and math courses.
- Around 1.4 million international students are currently present in the U.S.
New proposed Changes: Foreign students in the United States may be required to reapply every year for permission to stay in the country.
Impacts: The proposed measures could increase costs and paper work for students and universities.
Why such a move?
The proposal is part of an ongoing review of the immigration policy to ensure that it “promotes the national interest, enhances national security and public safety and ensures the integrity of our immigration system.”
C. GS3 Related
1. 5 States, a UT sign pact with Centre on e-Marketplace
In news:
- In a spirit of cooperative federalism, 5 States and a Union Territory (UT) on Tuesday formally adopted the Centre’s initiative called the Government e-Marketplace (GeM)
- Aim : GeM ensures that public procurement of goods and services in India worth more than Rs. 5 lakh crore annually is carried out through the online platform for transparency and to eliminate corruption.
- The States and the UT that signed an MoU with the Centre include Andhra Pradesh, Assam, Gujarat, Telangana, Puducherry and Arunachal Pradesh.
- GeM can enhance transparency, efficiency and speed in public procurement.
2. Sugar import duty increased to 50% to support domestic prices
In News:
- The government on Monday raised the import duty on sugar to 50 per cent from 40 per cent to discourage dumping of cheaper supplies from abroad and as local prices stabilise after a spike earlier this marketing year
- The move will improve the ability of sugar mills to pay farmers for their supplies of cane, according to the sugar industry
Relief for producers:
- The hike in the duty comes as a relief for mills amid slowing domestic demand, especially after demonetisation
- Cost of production is also increased due to high cane prices
- This will help the sugar industry pay the cane price (fair and remunerative price), which has been raised by 11 per cent for the marketing year starting October 2017
Sugar import:
- In April this year, the government had allowed duty-free imports of raw sugar up to five lakh tonnes to improve domestic availability
- It was due to fear that a drop in domestic output in 2016-17 could trigger a spiral in prices to irrational levels
- This was for the first time since 2012 that imports of sugar under the open general license (OGL) was allowed at zero duty, albeit in limited quantity
3. Railways to promote small entrepreneurs in big way
In News:
- Indian Railways has taken a big step in a plan to promote micro and small enterprises
- It has reserved 358 items including cleaning apparatus, stationery and leather items exclusively for procurement from the MSE sector
- Besides, the sector has been exempted from paying tender cost and earnest money deposit for participating in the railway tender
Other changes:
- MSEs will be now encouraged to participate in the business of maintenance and operation of rolling stock and also in procurement of cables, linen, paints, coupler body, wall panelling, cutting and drilling machines
Taking up advice:
- Recently the national transporter has organised a meeting to increase the participation of micro and small enterprises in railway procurement
- The meeting was attended by Railway Minister and senior officials from the ministry and the Small Industries Development Bank of India (SIDBI) besides MSE vendors
- The Research Designs and Standards Organisation (RDSO), the research wing of the Railways, was advised to extend its support to MSE vendors on technical issues and SIDBI was advised to provide financial support to MSEs
Category: ENVIRONMENT AND ECOLOGY
1. Sensor network to map and predict pollution, effluents in Godavari
In news:
- A group of U.S. researchers is working on a system to map undulating pollution trends in the Godavari.
New approach:
- Using a mix of methods, including satellite-monitoring, traversing stretches of the river to collect water samples and using special sensors to measure bacterial and chemical pollution, the researchers are trying to develop a cost-effective forecast system.
- The team’s long-term objective is to be able to inform State officials and citizens of a probable spike in, say, levels of dangerous microbes or effluents, similar to weather and air pollution forecasts
- It is to be able to access “raw data” that could be used to inform the efficacy of a proposed faecal sludge treatment plant and whether behavioural interventions — including incentives or punishments — to restrict activities that pollute the river could actually work.
- The project measures parameters such as total dissolved salts, nitrate, pH, temperature, turbidity and electrical conductivity. These are relayed to a website called Thoreau, a wireless sensing network maintained at the University of Chicago to map environmental parameters, for analysis. Some river attributes such as microbial levels require to be measured in laboratories, though the team hopes eventually to be able to use low-cost sensors that measure them, too, in real time.
D. GS4 Related
Nothing here for Today!!!
PIB Articles Editorials Roundup
E. Concepts-in-News: Related Concepts to Revise/Learn
Nothing here for Today!!!
F. Bills/Acts/Schemes/Orgs in News


How to use Controllers?
It's simple. We will have to import the class located in Core/Controller.php
and extend it in the controller class as in the example on the side.
The class name, together with the method name, will be the name of the access
route to the controller. In the case of the example, it would be something like:
https://noobframework.com/user/signin
Note: If the method name is 'index', just call the class name to access it.
In the class, we import we have the view() method. This method is responsible
for calling the informed view and passing the parameters that have been entered.
The view() method takes two parameters:
<?php namespace App\Controllers; use Core\Controller; class UserController extends Controller { public function signin() { $params = [ 'user' => [ 'name' => 'Stephan George', 'email' =><EMAIL_ADDRESS>] ]; $this->view('home', $params); } }
 <?php echo $user["name"] ?> <?php echo $user["email"] ?> <\body>
Stephan George stephan.george@domain.com


It was the spring break of my senior year in high school. Our Jazz Band, in which I played the less-than-important auxillary percussion parts (Remember the corrugated fish in grade school music class?) went on a trip. Recently, I'd experienced a stress-induced insomnia and resulting psychosis. After a visit to a local psychiatrist, I went to K-Mart with my grandmother to get my prescription filled: Lorazepam, 1mg dosage.
I had taken three of the capsules with me in case I had trouble sleeping. The first night passed without incident. On the second evening, three friends and myself were hanging out in our hotel room watching the Simpsons. We were supposed to leave to watch another Jazz performance. I'd had enough of Jazz for one lifetime already, so one of my buddies said he'd stay behind with me. Good enough.
After the Simpsons concluded, I felt an impending sense of boredom.  I asked my friend if it was cool if I just crashed for the evening (It was only 5:30 at the time). He had no objections, so I dropped the pills and waited patiently for my well-deserved escape from the day. Funny how plans can change...
Right before I slipped into my placid escape, a knock came at the door--It was our band teacher.
'Everybody downstairs; We're leaving in ten minutes.' My eyes widened.
'Wait, can't we stay here?' I asked, unsuccessfully trying to hide the panic in my voice. He simply shook his head and dissapeared into the hallway. Uh oh...
It doesn't take a genius to figure out that taking three times the recommended dose of a sedative and then venturing out into a public place against your will can have some unwelcome effects. This, in combination with the fact that I was emotionally depressed to begin with made for one deplorable evening.
The most noticable effects took place about a half-hour later when we arrived at the festival. When trying to step off the bus I nearly fell. My balance was so off that I couldn't walk without stumbling. I'd once drank seven ounces of scotch on an empty stomach in school and still been able to walk a straight line, so this was a very frustrated development. My vision was distorted; It looked like I was watching the world through an ancient home video, only getting every third frame. I felt drunk and disoriented, a unique feeling for which I can provide no comparison.
We arrived inside the concert hall. The up-beat music echoed from the stage, pounding in my ears and only adding to my confusion. When I felt I couldn't take anymore, I got up from my seat to take a walk and collect my thoughts. This, too, did not go as planned, since I just ended up getting lost on the wrong floor. After walking circles and getting nowhere, I finally sat down on the steps. I felt so overwhelmed that I began to sob openly and uncontrollably.  She walked over and sat down right next to me. Not what I needed.
'Are you okay?' She cooed. I made no response. Just a little side-note: If you see a teenage male crying like an infant with diaper rash, chances are he's not okay.
'Is it about a girl?' I shook my head slowly.
'Do you want to talk about it?'
'No,' was all I could muster.
She finally got the hint and returned to her group of friends, who were staring hard at me by this time. How utterly humiliating.
After several more lost minutes (as well as odd glances from security), I finally made it back to my seat. I spent the rest of the evening wallowing in suicidal thoughts and despair. All in all one of the worst evenings I've ever had.
Upon reading this, do not assume that Lorazepam has no value as a recreational drug. I once took four mg in my house and had a great trip, with lasting euphoria and excellent visuals. As with any drug, stay in a controlled environment, take your current frame of mind into account and be careful.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


General Information
We collect the e-mail addresses of those who communicate with us via e-mail, aggregate information on what pages consumers access or visit, and information volunteered by the consumer (such as survey information and/or site registrations). The information we collect is used to improve the content of our Web pages and the quality of our service, and is not shared with or sold to other organizations for commercial purposes, except to provide products or services you’ve requested, when we have your permission, or under the following circumstances:
- It is necessary to share information in order to investigate, prevent, or take action regarding illegal activities, suspected fraud, situations involving potential threats to the physical safety of any person, violations of Terms of Service, or as otherwise required by law.
- We transfer information about you if TheSaaS is acquired by or merged with another company. In this event, TheSaaS will notify you before information about you is transferred and becomes subject to a different privacy policy.
Information Gathering and Usage
- When you register for TheSaaS we ask for information such as your name, email address, billing address, credit card information. Members who sign up for the free account are not required to enter a credit card.
- TheSaaS uses collected information for the following general purposes: products and services provision, billing, identification and authentication, services improvement, contact, and research.
Cookies
- A cookie is a small amount of data, which often includes an anonymous unique identifier, that is sent to your browser from a web site’s computers and stored on your computer’s hard drive.
- Cookies are required to use the TheSaaS service.
- We use cookies to record current session information, but do not use permanent cookies. You are required to re-login to your TheSaaS account after a certain period of time has elapsed to protect you against others accidentally accessing your account contents.
Data Storage
TheSaaS uses third party vendors and hosting partners to provide the necessary hardware, software, networking, storage, and related technology required to run TheSaaS. Although TheSaaS owns the code, databases, and all rights to the TheSaaS application, you retain all rights to your data.
Disclosure
TheSaaS may disclose personally identifiable information under special circumstances, such as to comply with subpoenas or when your actions violate the Terms of Service.
Changes
TheSaaS may periodically update this policy. We will notify you about significant changes in the way we treat personal information by sending a notice to the primary email address specified in your TheSaaS primary account holder account or by placing a prominent notice on our site. Such notice will be given at least 3 days in advance of the date the new policy will be applied.
Question
Any questions about this Privacy Policy should be addressed to privacy@domain.com.


{include file="public/meta"/}
{include file="public/header"/}
{foreach $banner as $item}
{$item.name}
{/foreach}
Previous
Next
微信
小程序
{foreach $program as $title}
{$title.name}
{/foreach}
{foreach $program as $items}
{foreach $items.element as $item} {foreach $item as $view}
{$view.name}
{$view.sketch}
了解更多
{/foreach} {/foreach}
{/foreach}
{include file="public/footer"/}


Gradie
Beautiful gradients in seconds.
Login
Email
Password
By creating an account you agree with the
Terms & Conditions.
Create an Account


Function to handle commands. Have a function called "handleCommand in your service class to use this."
Data sent in the command
IPC functions
Function to report a service being ready
Function to report error during service launch
Graceful shotdown of the service. Have a function within your bot class called "shutdown" to use this.
Call this function when your shutdown function is complete.
ID of the worker
Generated using TypeDoc
Function to handle commands. Have a function called "handleCommand in your service class to use this."
Data sent in the command


Web3 Provider to use for transactions. For example:
const provider = new Web3.providers.HttpProvider('https://mainnet.infura.io')
configuration options, including networkName
logger, optional, a function that will be called with debugging information
Instead of signing an off-chain order, you can approve an order with on on-chain transaction using this method
Order to approve
Transaction hash of the approval transaction
Compute the gas price for sending a txn, in wei Will be slightly above the mean to make it faster
Compute the gas amount for sending a txn Will be slightly above the result of estimateGas to make it more reliable
The result of estimateGas for a transaction
Estimate the gas needed to transfer assets in bulk Used for tests
An array of objects with the tokenId and tokenAddress of each of the assets to transfer.
The owner's wallet address
The Wyvern schema name corresponding to the asset type
The recipient's wallet address
For a fungible token to use in trades (like W-ETH), get the amount approved for use by the Wyvern transfer proxy. Internal method exposed for dev flexibility.
Address for the user's wallet
Address for the token's contract
Get the proxy address for a user's wallet. Internal method exposed for dev flexibility.
The user's wallet address
Optional number of retries to do
Initialize the proxy for a user's wallet. Proxies are used to make trades on behalf of the order's maker so that trades can happen when the maker isn't online. Internal method exposed for dev flexibility.
The user's wallet address
Validate against Wyvern that a buy and sell order can match
How many times to retry if validation fails
Add a listener to a marketplace event
An event to listen for
A callback that will accept an object with event data
Whether the listener should only be called once
Approve a fungible token (e.g. W-ETH) for use in trades. Called internally, but exposed for dev flexibility. Checks to see if the minimum amount is already approved, first.
The user's wallet address
The minimum amount needed to skip a transaction. Defaults to the max-integer.
The contract address of the token being approved
Transaction hash if a new transaction occurred, otherwise null
Approve a non-fungible token for use in trades. Requires an account to be initialized first. Called internally, but exposed for dev flexibility. Checks to see if already approved, first. Then tries different approval methods from best to worst.
The user's wallet address
Address of the user's proxy contract. If not provided, will attempt to fetch it from Wyvern.
The Wyvern schema name corresponding to the asset type
an optional list of token addresses that, if a token is approve-all type, will skip approval
ABI of the token's contract. Defaults to a flexible ERC-721 contract.
The contract address of the token being approved
Token id to approve, but only used if approve-all isn't supported by the token contract
Transaction hash if a new transaction was created, otherwise null
Cancel an order on-chain, preventing it from ever being fulfilled.
The order maker's wallet address
The order to cancel
Compute the fees for an order
Optional prefetched asset contract (including fees) to use instead of assets
Array of addresses and ids that will be in the order
The basis points to add for the bounty. Will throw if it exceeds the assets' contract's OpenSea fee.
Whether the order is private or not (known taker)
The side of the order (buy or sell)
Create a buy order to make an offer on a bundle or group of assets.
Will throw an 'Insufficient balance' error if the maker doesn't have enough W-ETH to make the offer.
If the user hasn't approved W-ETH access yet, this will emit ApproveCurrency
before asking for approval.
Address of the maker's wallet
Expiration time for the order, in seconds. An expiration time of 0 means "never expire"
Optional address for using an ERC-20 token in the order. If unspecified, defaults to W-ETH
The Wyvern schema name corresponding to the asset type
Optional sell order (like an English auction) to ensure fee compatibility
Value of the offer, in units of the payment token (or wrapped ETH if no payment token address specified)
Addresses of the tokens' contracts. Must be the same length as tokenIds
. Each address corresponds with its respective token ID in the tokenIds
array.
Token IDs of the assets.
Create a sell order to auction a bundle of assets.
Will throw a 'You do not own this asset' error if the maker doesn't have one of the assets.
If the user hasn't approved access to any of the assets yet, this will emit ApproveAllAssets
(or ApproveAsset
if the contract doesn't support approve-all) before asking for approval for each asset.
The address of the maker of the bundle and the owner of all the assets.
An array of objects with the tokenId and tokenAddress of each of the assets to bundle together.
Optional description of the bundle. Markdown is allowed.
Optional link to a page that adds context to the bundle.
Name of the bundle
Optional address that's allowed to purchase this bundle. If specified, no other address will be able to take the order, unless it's the null address.
Optional price of the asset at the end of its expiration time. If not specified, will be set to startAmount
.
Expiration time for the order, in seconds. An expiration time of 0 means "never expire."
Optional basis points (1/100th of a percent) to reward someone for referring the fulfillment of this order
Address of the ERC-20 token to accept in return. If undefined or null, uses Ether.
The Wyvern schema name corresponding to the asset type
Price of the asset at the start of the auction, or minimum acceptable bid if it's an English auction.
If set to true, this becomes an English auction that increases in price for every bid. The highest bid wins when the auction expires, as long as it's at least startAmount
. expirationTime
must be > 0.
Create a buy order to make an offer on an asset.
Will throw an 'Insufficient balance' error if the maker doesn't have enough W-ETH to make the offer.
If the user hasn't approved W-ETH access yet, this will emit ApproveCurrency
before asking for approval.
Address of the maker's wallet
Expiration time for the order, in seconds. An expiration time of 0 means "never expire"
Optional address for using an ERC-20 token in the order. If unspecified, defaults to W-ETH
The Wyvern schema name corresponding to the asset type
Optional sell order (like an English auction) to ensure fee compatibility
Value of the offer, in units of the payment token (or wrapped ETH if no payment token address specified)
Address of the token's contract
Token ID
Create multiple sell orders in bulk to auction assets out of an asset factory.
Will throw a 'You do not own this asset' error if the maker doesn't own the factory.
Items will mint to users' wallets only when they buy them. See https://docs.opensea.io/docs/opensea-initial-item-sale-tutorial for more info.
If the user hasn't approved access to the token yet, this will emit ApproveAllAssets
(or ApproveAsset
if the contract doesn't support approve-all) before asking for approval.
Address of the factory owner's wallet
Identifier for the asset, if you just want to post orders for one asset.
Identifiers for the assets, if you want to post orders for many assets at once.
Optional address that's allowed to purchase each item. If specified, no other address will be able to take each order.
Optional price of the asset at the end of its expiration time. If not specified, will be set to startAmount
. Units are in the amount of a token above the token's decimal places (integer part). For example, for ether, expected units are in ETH, not wei.
Expiration time for the order, in seconds. An expiration time of 0 means "never expire."
Optional basis points (1/100th of a percent) to reward someone for referring the fulfillment of each order
Address of the factory contract
Number of times to repeat creating the same order for each asset. If greater than 5, creates them in batches of 5. Requires an apiKey
to be set during seaport initialization in order to not be throttled by the API.
Address of the ERC-20 token to accept in return. If undefined or null, uses Ether.
Price of the asset at the start of the auction, or minimum acceptable bid if it's an English auction. Units are in the amount of a token above the token's decimal places (integer part). For example, for ether, expected units are in ETH, not wei.
If set to true, this becomes an English auction that increases in price for every bid. The highest bid wins when the auction expires, as long as it's at least startAmount
. expirationTime
must be > 0.
Create a sell order to auction an asset.
Will throw a 'You do not own this asset' error if the maker doesn't have the asset.
If the user hasn't approved access to the token yet, this will emit ApproveAllAssets
(or ApproveAsset
if the contract doesn't support approve-all) before asking for approval.
Address of the maker's wallet
Optional address that's allowed to purchase this item. If specified, no other address will be able to take the order, unless its value is the null address.
Optional price of the asset at the end of its expiration time. Units are in the amount of a token above the token's decimal places (integer part). For example, for ether, expected units are in ETH, not wei.
Expiration time for the order, in seconds. An expiration time of 0 means "never expire."
Optional basis points (1/100th of a percent) to reward someone for referring the fulfillment of this order
Address of the ERC-20 token to accept in return. If undefined or null, uses Ether.
The Wyvern schema name corresponding to the asset type
Price of the asset at the start of the auction. Units are in the amount of a token above the token's decimal places (integer part). For example, for ether, expected units are in ETH, not wei.
Address of the token's contract
Token ID
If set to true, this becomes an English auction that increases in price for every bid. The highest bid wins when the auction expires, as long as it's at least startAmount
. expirationTime
must be > 0.
Fullfill or "take" an order for an asset, either a buy or sell order
The taker's wallet address
The order to fulfill, a.k.a. "take"
The optional address that referred the order
Gets the price for the order using the contract
The order to calculate the price for
Get known fungible tokens (ERC-20) that match your filters.
Filter by the ERC-20 contract address for the token, e.g. "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359" for Dai
Filter by the name of the ERC-20 contract. Not guaranteed to exist or be unique for each token type. e.g. '' for Dai and 'Decentraland' for MANA FUTURE: officiallySupported: Filter for tokens that are officially supported and shown on opensea.io
Filter by the ERC-20 symbol for the token, e.g. "DAI" for Dai stablecoin
Get the balance of a fungible token.
User's account address
ABI for the token's contract. Defaults to ERC20
Optional address of the token's contract. Defaults to W-ETH
Returns whether an asset is transferrable. An asset may not be transferrable if its transfer function is locked for some reason, e.g. an item is being rented within a game or trading has been locked for an item type.
If the owner and fromAddress has already approved the asset for sale. Required if checking an ERC-721 v1 asset (like CryptoKitties) that doesn't check if the transferFrom caller is the owner of the asset (only allowing it if it's an approved address).
The account address that currently owns the asset
The Wyvern schema name corresponding to the asset type
The account address that will be acquiring the asset
Address of the token's contract
ID of the token to check
How many times to retry if false
Returns whether an order is fulfillable. An order may not be fulfillable if a target item's transfer function is locked for some reason, e.g. an item is being rented within a game or trading has been locked for an item type.
The account address that will be fulfilling the order
Order to check
The optional address that referred the order
How many times to retry if false
Remove all event listeners. Good idea to call this when you're unmounting a component that listens to events to make UI updates
Optional EventType to remove listeners for
Remove an event listener, included here for completeness.
Simply calls .remove()
on a subscription
The event subscription returned from addListener
Transfer one or more assets to another address. ERC-721 and ERC-1155 assets are supported
An array of objects with the tokenId and tokenAddress of each of the assets to transfer.
The owner's wallet address
The Wyvern schema name corresponding to the asset type
The recipient's wallet address
Transaction hash
Transfer an NFT asset or any Wyvern asset to another address
The asset to transfer
The owner's wallet address
Whether the passed asset is a generic WyvernAsset, for backwards compatibility
The Wyvern schema name corresponding to the asset type
The recipient's wallet address
Transaction hash
Unwrap W-ETH into ETH.
Emits the UnwrapWeth
event when the transaction is prompted.
Address of the user's wallet containing the W-ETH
How much W-ETH to unwrap
Validate and post an order to the OpenSea orderbook.
The order to post. Can either be signed by the maker or pre-approved on the Wyvern contract using approveOrder. See https://github.com/ProjectWyvern/wyvern-ethereum/blob/master/contracts/exchange/Exchange.sol#L178
The order as stored by the orderbook
Wrap ETH into W-ETH.
W-ETH is needed for placing buy orders (making offers).
Emits the WrapEth
event when the transaction is prompted.
Address of the user's wallet containing the ether
How much ether to wrap
Generated using TypeDoc
Your very own seaport. Create a new instance of OpenSeaJS.


Before Change
for line in in_stream:
if not line.strip():
continue
info = json.loads(line.strip().decode("utf-8"))
writer.write(info)
writer.close()
After Change
if "surfaceText" in info and info["surfaceText"] is None:
del info["surfaceText"]
solr_struct = {"doc": info, "boost": boost}
solr_fragment = "\t"add": %s," % json.dumps(solr_struct)
print(solr_fragment, file=out)
print("\t"commit": {}", file=out)
print("}", file=out)


Interpreters
XLS provides a several interpreters to assist in design validation across our functional stack, from input DSLX down to the netlist level.
DSLX
The DSLX interpreter (//xls/dslx:interpreter_main
) operates on
DSLX .x
files that contain both the design and unit tests to execute (present
as #![test]
annotated functions).
The adler32 example
demonstrates this: the design is encapsulated in the main
, adler32_seq
, and
mod
functions, and the samples are present in the test adler32_one_char
(note that unit-style tests/interpretations of adler32_seq
and mod
could
also be present).
Interpreter targets are automatically generated for dslx_test()
targets, so no
special declarations are necessary to wrap DSLX code.
To invoke these samples, execute the following:
bazel build -c opt //xls/examples:adler32_dslx_test
./bazel-bin/xls/examples/adler32_dslx_test
To execute directly via the interpreter, you can instead run:
$ bazel build -c opt //xls/dslx/interpreter_main
$ ./bazel-bin/xls/dslx/interpreter_main \
./xls/examples/adler32.x
These two methods are equivalent.
Execution comparison
The DSL interpreter provides a flag, --compare
, to implicitly compare its run
results to those of the IR-converted DSL functions. This helps "spot check"
consistency between IR and DSL execution (in addition to other methods used in
more generally in XLS, like the fuzzer).
The user may compare DSL execution to IR interpreter execution, IR JIT execution, or not perform IR comparison at all.
$ ./bazel-bin/xls/dslx/interpreter_main \
./xls/examples/adler32.x --compare=jit
$ ./bazel-bin/xls/dslx/interpreter_main \
./xls/examples/adler32.x --compare=interpreter
$ ./bazel-bin/xls/dslx/interpreter_main \
./xls/examples/adler32.x --compare=none
IR
XLS provides two means of evaluating IR - interpretation and native host
compilation (the
JIT). Both are
invoked in nearly the same way, via the
eval_ir_main
tool.
eval_ir_main
supports a wide number of use cases, but the most common end-user
case will be to run a sample through a design. To evaluate a sample (1.0 + 2.5)
on the
floating-point adder,
one would run the following:
bazel build -c opt //xls/tools:eval_ir_main
./bazel-bin/xls/tools/eval_ir_main \
--input '(bits[1]: 0x0, bits[8]:0x7F, bits[23]:0x0); (bits[1]: 0x0, bits[8]:0x80, bits[23]:0x200000)' \
./xls/modules/fpadd_2x32.x
By default, this runs via the JIT. To use the interpreter, add the
--use_llvm_jit=false
flag to the invocation.
eval_ir_main
supports a broad set of options and modes of execution. Refer to
its [very thorough] --help
documentation for full details.
Netlists
Finally, compiled netlists can also be interpreted against input samples via the
aptly-named
netlist_interpreter_main
tool. This tool currently only supports single sample evaluation (as illustrated
in the IR section above):
bazel build -c opt //xls/tools:netlist_interpreter_main
./bazel-bin/xls/tools/netlist_interpreter_main \
--netlist <path to netlist>
--module <module to evaluate>
--cell_library[_proto] <path to the module's cell library [proto]>
--inputs <input sample, as above>
As XLS does not currently provide an sample/example netlist (TODO(rspringer)),
concrete values can't [yet] be provided here. The --cell_library
flag merits
extra discussion, though.
During netlist compilation, a cell library is provided to indicate the
individual logic cells available for the design, and these cells are referenced
in the output netlist. The interpreter needs a description of these cells'
behaviors/functions, so the cell library must be provided here, as well. Many
cell libraries are very large (> 1GB), and can thus incur significant processing
overhead at startup, so we also accept pre-processed cell libraries, as
CellLibraryProto
messages, that contain much-abridged cell descriptions. The
function_extractor_main
tool can automatically perform this extraction for
Liberty-formatted
cell library descriptions.


Bundles are special Lasso.js modules that bundle together a collection of related Skin components.
The @ebay/skin/core module bundles together Skin's core dependencies.
The @ebay/skin/combo module bundles together Skin's most common modules, as identified across key eBay experiences.
Note: The combo bundle itself contains two other bundles. Lasso will take care of de-duping modules where necessary.
The @ebay/skin/form module bundles together all form controls and field layout.


For The Caffeine Of Heart
Menu - New & Noteworthy Items
| Item | Description | Price |
|---|---|---|
| King Of Clubs! | Ham, turkey, bacon, swiss, provolone, onion, tomato, lettuce, avocado, sundried tomato and pesto aiolis, sourdough. | 14.95 |
| Little Chippy | Crispy seasoned chicken, swiss cheese, house pickles, house chips, romaine and TRUFF aioli | 11.95 |
| Organic Acai Bowl | Organic acai, house almond butter, coconut, banana, blue berry, house granola Vegan, gluten free, no modifications. Please choose plain acai, dragon fruit acai or peanut butter acai. | 9.50 |
| Muffaletta | Mortadella, salami, provolone, red onion, roasted tomato, hard boiled egg, green olive, pickled jalepeno, basil, mayo. | 10.00 |
Who We Are Kalissa Krejcik
Kalissa Krejcik is the owner and executive chef of C&M Cafe in Los Angeles. Her original menu items are the talk of the town, and her vibrant eccentricity makes for a consistently thrilling food experience.
Established In 2013.
Chicken & monkey are always hungry for adventure, so no ordinary sandwich will do! Just like our owner's 2 boys nicknamed “The Chicken” & “Monkey”, we’re always searching for fun eats and sweet treats. Welcome to our family!
Organic, Natural, Homemade
100% of our eggs are organic!
100% of our meat is all natural!
Our food is hormone, nitrate and nitrite free.
We support our local farmers.
Everything is homemade, because we believe that clean food is healthy food.


|
Perl Weekly
Issue #113 - 2013-09-23 - Object Oriented Perl
latest | archive | by Gabor Szabo
|
|
Hi,
It seems the development of p5-mop (a subset of Moose in core Perl) has inspired a few people. This is despite the expectation that it is at least 1-2 years till it becomes ready for production code. This week we have 3 related articles.
I have also started to experiment adding a few more links in the comment section of the newsletter. What do you think about those?
|
|
|
|
Sponsors
|
We're Hiring Telecommuters - Grant Street Group
We are a growing software company using open source software/modern Perl practices to build innovative e-payment, auction, and tax collection web applications. We're looking for talented, motivated professionals committed to flawless work and customer service. Email resume<EMAIL_ADDRESS>|
|
Announcements
|
|
|
Articles
|
|
|
Hacking Hiveminder
Hiveminder is a collaborative todo list 'in the cloud', that can be used even if you only collaborate with yourself. It offers and API wrapped in Net::Hiveminder. Yanick Champoux has started to build a new, Perl based client. First for the command line, with later plans to create his own web interface. See the explanation about how the command line interface was built.
|
|
Testing
|
Underappreciated Perl Code - Test::More::subtest()
Maintaining the number of tests can be a real pain, and running tests in parallel can confuse the parser. Timm Murray from the Wumpus Cave shows how the subtest feature of Test::More can solve the former, and has an example how the latter might be solved.
|
|
|
|
Code
|
Breaking users of old versions of a module
An interesting article by Steven Haryanto discussing how to handle backward incompatible changes. One of the approach is to keep the old behavior in a separated module and allow the user to specify which behavior they want to have at the use-time of the module.
|
|
|
|
Fun
|
Perl objects round up
Tim Heaney (oylenshpeegul) has implemented a simple class with 2 attributes, and a subclass inheriting from it in 7 different ways: vanilla Perl, using Object::Tiny, Moo, Moose, MooseX::Declare, Moops and the current version of p5-mop, called p5-mop-redux. In such a small example it is quite easy to see the differences among these approaches. (Discuss it on reddit.)
|
|
Web
|
Poor Mans Jobqueue for Catalyst Apps
What would happen, if you need to run a long process in a web app? There are plenty of established solutions for this, but David Schmidt decided to use his database to manage the queue.
|
|
Perl Catalyst - Hamburg Status and the Future
John Napiorkowski explains why he changed the release policy of Catalyst to have a development release after each quest has been completed: 'it would help inspire contributors since there's nothing better than to see you code live on CPAN'. So far 3 out of 7 quests for the Hamburg release have been completed.
|
|
Perl 5 mop
|
p5-mop: a gentle introduction
Damien Krotkine provides a little background for p5-mop and explains why it is important to try it now, while it is still in development. He also gives examples about how to try it. (There is also a copy of this post on blogs.perl.org with some further comments.)
|
|
On porting a Moose module
Stevan Little, the author of Moose and main force behind p5-mop further discusses how he has been porting Bread::Board to use the new, and still under development p5-mop.
|
|
Perl 6
|
|
|
The MAIN subroutine in Perl 6
Konrad Borowski, who you might know from the weekly report about Perl 6, started a new series of articles about Perl 6. In a style, the first one is about the MAIN subroutine which adds command line handle handling to your script.
|
|
Past events
|
YAPC::Asia Tokyo 2013 is over
Daisuke Maki (lestrrat) who ran the biggest Perl events in the world decided to retire from this volunteer position. YAPC::Asia is looking for a leader and an organizer!
|
|
Talks from Kiev
Dave Cross has posted a collection of the videos covering his own talks at YAPC::EU in Kiev.
|
|
Weekly collections
|
|
|
|
|
Perl Maven Tutorials
|
|
|
|
|
Events
I usually list the next 3-4 events here. The list of all the events can be found on the web site. If your Perl event is not listed there, please let me know.
|
OSDC.fr
October 4-5, 2013, Paris, France
|
|
|
|
|
|
OSDC NZ
October 21-23, 2013, Auckland, New Zealand
|
|
You know, you could get the Perl Weekly right in your mailbox. Every Week. Free of charge!
|


HCI Portfolio- Mikel Matticoli
Design For...
Collaboration
Others
Understanding
Tension
Wellbeing
VR
Design Manifesto


Isar735.github.io
Creative Writing from Wesleyan University. This Specialization covers elements of three major creative writing genres: short story, narrative essay Essay zeitform - mphotonics.mit.edu.
Topic: Creative Writing Zeitform – 740286.
Creative writing in the classroom: What is Creative Writing? - Definition, Types Examples. Vokabeltrainer: Download Englisch - Vokabeln. Kostenlose englische Download - Vokabeln zum Langenscheidt Vokabeltrainer. Vorschau der Vokabeldatei 'Englisch - umfangreich' (Englisch - Deutsch);. CWS – школа литературного мастерства. В основу Литературной Школы положены программы Creative writing, популярные в европейских. English teacher, Alan Gillespie, shares his advice and resources on how to teach creative writing.
The world’s most complete listing of entrepreneurship contests, elevator pitch events, and business plan competitions. The latest Tweets from Creative Writing (@NewSchoolWrites). Founded in 1931, Creative Writing at @TheNewSchool continues to promote, engender, and shape innovative. CTR III (2010-Present) Documents CTR III Documents Scaling Energy 2010 Scaling Copper 2011 Digest- On Board Optical Interconnection, July 2013 Full Document - On Board.
Creative Writing 101 - Daily Writing. Also known as the art of making things up, creative writing is a vital part of modern society. This lesson will explore what makes writing. What is Creative Writing? Creative writing is anything where the purpose is to express thoughts, feelings and emotions rather than to simply convey. Creative Writing (@NewSchoolWrites) Twitter. A creative writing forum dedicated to all writing, where writers can discuss publishing, plot, character development, word mechanics, and may use our Writing Workshop.
Creative Writing Forums - Writing Help, Writing Workshops.


Taivan Tiisurenkhuu's Web Developer Examples and Resources
Accessibility
Accessibility is a big part of web design and development. Developing just a working website is not enough. There are different features and attributes to a website that makes it better quality compared to other websites, and a major one of them is accessibility. Each year web design standards get stricter and more inclusive of the disabled, and more countries are adopting those standards. Instead of being optional, website accessibility is mandatory, because access to information and communications technologies, including the Web, is defined as a basic human right in the United Nations Convention on the Rights of Persons with Disabilities (UN CRPD).(w3.org) Also, it is a deciding factor of a successful website!
Unfortunately, there are still a lot of websites that don't have or have enough accessibility features. Those are usually smaller websites, because big corporations or government websites must have decent accessibility or they might even get fined! For example, recent changes to laws in Canada mean that a corporation without an accessible website could face daily fines of $100,000 with company directors also being fined to the tune of $50,000 per day.(Digital Design Standards) Moreover, Section 508 is the governing principle and it requires that all government information be accessible to disabled users. (usability.gov)
Although most internet users are healthy and not disabled, according to Web AIM, some 20% of the world’s population suffers from a disability, websites that aren’t accessible could exclude millions of people from getting the information they need. (Digital Design Standards) Further, disability can happen to anyone and there are cases that even non-disbaled people need accessibility features, such as people using mobile phones, smart watches, smart TVs, and other devices with small screens, different input modes, etc., older people with changing abilities due to ageing, people with “temporary disabilities'' such as a broken arm or lost glasses, people with “situational limitations'' such as in bright sunlight or in an environment where they cannot listen to audio, people using a slow Internet connection, or who have limited or expensive bandwidth.(w3.org) Making your website accessible is not only a good business practice, but it also shows people you care!


I had acquired a salvia extract and tried it twice before, but even at a 'strong' dose I only felt mild effects. That didn't strike me as too odd, because every now & then, acid and mushrooms don't do much for me. When that happens, I can 'jump-start' a trip by smoking cannabis. So I decided to try salvia again after smoking.
At first I thought I was just really stoned, but when the physical dimensions of my bedroom closed in on me and disappeared, I knew salvia had kicked in. I could still see the floor and the walls, but they were 'enchanted' somehow. I opened the window to get some fresh air, turned off the lights, and enjoyed a dim color show.
Then I felt like I wasn't alone... I stood up and saw this presence facing me. It was evil. It wanted to fight. I threw my shirt off and started taunting it. The next thing I knew, I was being pummeled with punches, knocked to the floor. To a sober observer, it would have looked like Jim Carrey in the movie Liar Liar-- 'I'm kicking my ass!!!' I didn't feel any physical pain... the physical world had long since disappeared, but the fight was still very real.
I didn't fight back. This presence was every personal demon that had been bothering me the past few years, so different tactics were needed. It threw me to the ground one last time, and I started coughing, gagging, going through all the motions of trying to puke the bugger out from inside me. I could feel it in the back of my throat, struggling to stay in, so I reached in with two fingers, grabbed it by the head, and yanked it out. I grabbed it between my hands and shrank it down into nothing.
The journey was ending and I could feel the physical world dissolving back into reality. I lit a candle and reflected upon what happened until I was only stoned. Now that it was over, I felt empty. Not empty like I had lost everything, but like a vessel waiting to be filled.
Was it a bad trip? No, I didn't feel any sense of fear or terror. A trial or a test is a better way to put it. It was one I was ready for, and I knew I would succeed. I've had peace of mind ever since. Thank you, Salvia.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


7. Smallk API (C++)¶
7.1. Examples of API Usage¶
In the examples folder you will find a file called smallk_example.cpp
. This file contains several examples of how to use the SmallK library. Also included in the examples folder is a makefile that you can customize for your use. Note that the SmallK library must first be installed before the example project can be built.
As an example of how to use the sample project, assume the smallk software has been installed into /usr/local/smallk
. Also assume that the user chose to create the recommended environment variable SMALLK_INSTALL_DIR
that stores the location of the top-level install folder, i.e. the user’s .bashrc
file contains this statement:
export SMALLK_INSTALL_DIR=/usr/local/smallk
To build the smallk example project, open a terminal window and cd to the smallk/examples folder and run this command:
make
To run the example project, run this command:
./bin/example ../../smallk_data
Note: the output will be similar to the following not identical since some problems are randomly initialized:
Smallk major version: 1
Smallk minor version: 0
Smallk patch level: 0
Smallk version string: 1.0.0
Loading matrix...
************************************************************
* *
* Running NMF-BPP using k=32 *
* *
************************************************************
Initializing matrix W...

Elapsed wall clock time: 4.354 sec.
Writing output files...
************************************************************
* *
* Running NMF-HALS using k=16 *
* *
************************************************************
Initializing matrix W...

Elapsed wall clock time: 1.560 sec.
Writing output files...
************************************************************
* *
* Running NMF-RANK2 with W and H initializers *
* *
************************************************************
Initializing matrix W...

Elapsed wall clock time: 0.028 sec.
Writing output files...
************************************************************
* *
* Repeating the previous run with tol = 1.0e-5 *
* *
************************************************************
Initializing matrix W...

Elapsed wall clock time: 0.061 sec.
Writing output files...
Minimum value in W matrix: 0.
Maximum value in W matrix: 0.397027.
************************************************************
* *
* Running HierNMF2 with 5 clusters, JSON format *
* *
************************************************************
loading dictionary...
creating random W initializers...
creating random H initializers...
parameters:
height: 12411
width: 7984
matrixfile: ../data/reuters.mtx
dictfile: ../data/reuters_dictionary.txt
tol: 0.0001
miniter: 5
maxiter: 5000
maxterms: 5
maxthreads: 8
[1] [2] [3] [4]
Elapsed wall clock time: 391 ms.
9/9 factorizations converged.
Writing output files...
************************************************************
* *
* Running HierNMF2 with 10 clusters, 12 terms, XML format *
* *
************************************************************
creating random W initializers...
creating random H initializers...
parameters:
height: 12411
width: 7984
matrixfile: ../data/reuters.mtx
dictfile: ../data/reuters_dictionary.txt
tol: 0.0001
miniter: 5
maxiter: 5000
maxterms: 12
maxthreads: 8
[1] [2] [3] [4] [5] [6] dropping 20 items ...
[7] [8] [9]
Elapsed wall clock time: 837 ms.
21/21 factorizations converged.
Writing output files...
************************************************************
* *
* Running HierNmf2 with 18 clusters, 8 terms, with flat *
* *
************************************************************
creating random W initializers...
creating random H initializers...
parameters:
height: 12411
width: 7984
matrixfile: ../data/reuters.mtx
dictfile: ../data/reuters_dictionary.txt
tol: 0.0001
miniter: 5
maxiter: 5000
maxterms: 8
maxthreads: 8
[1] [2] [3] [4] [5] [6] dropping 20 items ...
[7] [8] [9] dropping 25 items ...

Writing output files...
The output files are written to the default directory or the directory specified on the command line.
7.2. SmallK API¶
The SmallK API is an extremely simplistic API for basic NMF and clustering. Users who require more control over the factorization or clustering algorithms can instead run one of the command-line applications in the SmallK distribution.
The SmallK API is exposed by the file smallk.hpp, which can be found in this location:
SMALLK_INSTALL_DIR/include/smallk.hpp.
All API functions are contained within the smallk namespace.
An example of how to use the API can be found in the file examples/smallk_example.cpp
.
The smallk library maintains a set of state variables that are used to control the Nmf and clustering routines. Once set, the state variables maintain their values until changed by an API function. For instance, one state variable represents the matrix to be factored (or used for clustering). The API provides a function to load this matrix; once loaded, it can be repeatedly factored without the need for reloading. The state variables and their default values are documented below.
All computations with the smallk library are performed in double precision.
7.2.1. Enumerations¶
The SmallK API provides two enumerated types, one for the supported NMF algorithms and one for the clustering file output format. These are:
enum Algorithm
{
MU, // Multiplicative Updating, Lee & Seung
BPP, // Block Principal Pivoting, Kim and Park
HALS, // Hierarchical Alternating Least Squares, Cichocki & Pan
RANK2 // Rank2, Kuang and Park
};
The default NMF algorithm is BPP. The Rank2 algorithm is optimized for two-column or two-row matrices and is the underlying factorization routine for the clustering code.
enum OutputFormat
{
XML, // Extensible Markup Language
JSON // JavaScript Object Notation
};
7.2.2. API functions¶
<IP_ADDRESS>. Initialization and cleanup¶
void Initialize(int& argc, char**& argv)
Call this function first, before all others in the API; initializes Elemental and the smallk library.
bool IsInitialized()
Returns true if the library has been initialized via a call to Initialize(), false otherwise.
Call this function last, after all others in the API; performs cleanup for Elemental and the smallk library:
void Finalize()
<IP_ADDRESS>. Versioning¶
unsigned int GetMajorVersion()
Returns the major release version number of the library as an unsigned integer.
unsigned int GetMinorVersion()
Returns the minor release version number of the library as an unsigned integer.
unsigned int GetPatchLevel()
Returns the patch version number of the library as an unsigned integer.
std::string GetVersionString()
Returns the version of the library as a string, formatted as major.minor.patch.
<IP_ADDRESS>. Common functions¶
unsigned int GetOutputPrecision()
Returns the floating point precision with which numerical output will be written (i.e., the computed W and H matrix factors from the Nmf routine). The default precision is six digits.
void SetOutputPrecision(const unsigned int num_digits)
Sets the floating point precision with which numerical output will be written. Input values should be within the range [1, precision(double)]. Any inputs outside of this range will be adjusted.
unsigned int GetMaxIter()
Returns the maximum number of iterations allowed for NMF computations. The default value is 5000.
void SetMaxIter(const unsigned int max_iterations = 5000)
Sets the maximum number of iterations allowed for NMF computations. The default of 5000 should be more than sufficient for most computations.
unsigned int GetMinIter()
Returns the minimum number of NMF iterations. The default value is 5.
void SetMinIter(const unsigned int min_iterations = 5)
Sets the minimum number of NMF iterations to perform before checking for convergence. The convergence and progress estimation routines are non-trivial calculations, so increasing this value may result in faster performance.
unsigned int GetMaxThreads()
Returns the maximum number of threads used for NMF or clustering computations. The default value is hardware-dependent, but is generally the maximum number allowed by the hardware.
void SetMaxThreads(const unsigned int max_threads);
Sets an upper limit to the number of threads used for NMF and clustering computations. Inputs that exceed the capabilities of the hardware will be adjusted. This function is provided for scaling and performance studies.
void Reset()
Resets all state variables to their default values.
void SeedRNG(const int seed)
Seeds the random number generator (RNG) within the smallk library. Normally this RNG is seeded from the system time whenever the library is initialized. The RNG is the 19937
Mersenne Twister implementation provided by the C++ standard library.
void LoadMatrix(const std::string& filepath)
Loads a matrix contained in the given file. The file must either be a comma-separated value (.CSV) file for a dense matrix, or a MatrixMarket-format file (.MTX) for a sparse matrix. If the matrix cannot be loaded the library throws a std::runtime_error exception.
bool IsMatrixLoaded()
Returns true if a matrix is currently loaded, false if not.
std::string GetOuputDir()
Returns a string indicating the directory into which output files will be written. The default is the current directory.
void SetOutputDir(const std::string& outdir)
Sets the directory into which output files should be written. The outdir
argument can either be an absolute or relative path. The default is the current directory.
<IP_ADDRESS>. NMF functions¶
void Nmf(const unsigned int k,
const Algorithm algorithm = Algorithm::BPP,
const std::string& initfile_w = std::string(""),
const std::string& initfile_h = std::string(""))
This function factors the input matrix A of nonnegative elements into nonnegative factors such that: \matr{A} \cong \matr{W} \matr{H}. If a matrix is not currently loaded a std::logic_error exception will be thrown. The default algorithm is NMF-BPP; provide one of the enumerated algorithm values to use a different algorithm.
Where A is mxn, W is mxk, and H is kxn. The value of k a user defined argument, e.g., for clustering applications, k is the number of clusters.
Optional initializer matrices can be provided for the W and H factors via the initfile_w
and initfile_h
arguments. These files must contain fully dense matrices in .CSV format. The W matrix initializer must have dimension mxk, and the H matrix initializer must have dimension kxn. If the initializer matrices do not match these dimensions exactly a std::logic_error exception is thrown. If initializers are not provided, matrices W and H will be randomly initialized.
The computed factors W and H will be written to the output directory in the files w.csv
and h.csv
.
Exceptions will be thrown (either from Elemental or smallk) in case of error.
const double* LockedBufferW(unsigned int& ldim, unsigned int& height, unsigned int& width)
This function returns a READONLY pointer to the buffer containing the W factor computed by the Nmf routine, along with buffer and matrix dimensions. The ldim
, height
, and width
arguments are all out parameters. The buffer has a height of ldim
and a width of width
. The matrix W has the same width but a height of height
, which may differ from ldim. The W matrix is stored in the buffer in column-major order. See the examples/smallk_example.cpp file for an illustration of how to use this function.
const double* LockedBufferH(unsigned int& ldim, unsigned int& height, unsigned int& width)
Same as LockedBufferW, but for the H matrix.
double GetNmfTolerance()
Returns the tolerance value used to determine NMF convergence. The default value is 0.005.
void SetNmfTolerance(const double tol=0.005)
Sets the tolerance value used to determine NMF convergence. The NMF algorithms are iterative, and at each iteration a progress metric is computed and compared with the tolerance value. When the metric falls below the tolerance value the iterations stop and convergence is declared. The tolerance value should satisfy 0.0 < tolerance < 1.0. Any inputs outside this range will cause a std::logic_error exception to be thrown. Clustering Functions
void LoadDictionary(const std::string& filepath)
Loads the dictionary used for clustering. The dictionary is an ASCII file of text strings as described in the preprocessor input files section below. If the dictionary file cannot be loaded a std::runtime_error exception is thrown.
unsigned int GetMaxTerms()
Returns the number of highest-probability dictionary terms to store per cluster. The default value is 5.
void SetMaxTerms(const unsigned int max_terms = 5)
Sets the number of highest-probability dictionary terms to store per cluster.
OutputFormat GetOutputFormat()
Returns a member of the OutputFormat enumerated type; this is the file format for the clustering results. The default output format is JSON.
void SetOutputFormat(const OutputFormat = OutputFormat::JSON)
Sets the output format for the clustering result file. The argument must be one of the values in the OutputFormat enumerated type.
double GetHierNmf2Tolerance()
Returns the tolerance value used by the NMF-RANK2 algorithm for hierarchical clustering. The default value is 1.0e-4.
void SetHierNmf2Tolerance(const double tol=1.0e-4)
Sets the tolerance value used by the NMF-RANK2 algorithm for hierarchical clustering. The tolerance value should satisfy 0.0 < tolerance < 1.0. Any inputs outside this range will cause a std::logic_error
exception to be thrown.
void HierNmf2(const unsigned int num_clusters)
This function performs hierarchical clustering on the loaded matrix, generating the number of clusters specified by the num_clusters
argument. For an overview of the hierarchical clustering process, see the description below for the hierclust command line application.
This function generates two output files in the output directory: assignments_N.csv and tree_N.{json, xml}. Here N is the number of clusters specified as an argument, and the tree file can be in either JSON XML format.
The content of the files is described below in the section on the hierclust command line application.
void HierNmf2WithFlat(const unsigned int num_clusters)
This function performs hierarchical clustering on the loaded matrix, exactly as described for HierNmf2. In addition, it also computes a flat clustering result. Thus four output files are generated. The flat clustering result files are assignments_flat_N.csv
and clusters_N.{json, xml}
. The cluster file contents are documented below in the section on the flatclust command line application.


--- title: Grain Neighbors sidebar: documentation_sidebar permalink: GrainNeighbours.html folder: documentation toc: false ---
In this section we discuss how to analyze the neighbouring relationships between grains. While most of this can be done also on the level of grain boundaries an local misorientations it is for large data sets sometimes useful to consider misorientations between the meanorienations of grains. We shall use the following Magnesium data set of our explainations.
{% highlight matlab %} % load sample EBSD data set mtexdata twins silent CS = ebsd('indexed').CS; % reconstruct grains [grains, ebsd.grainId] = calcGrains(ebsd('indexed'),'angle',5*degree); grains = smooth(grains,5); % plot the grains plot(grains,grains.meanOrientation) {% endhighlight %}Central for the analysis of grain to grain relationships is the function grains.neighbours
. It return a list of pairs of neighbouring grain ids. Each row of the list containes the ids of two neighbouring grains. In the following lines choose the row number 170 and outline the corresponding grains
In order to compute the misorentation between these two grains we can do
{% highlight matlab %} mori = inv(grains(pairs(170,1)).meanOrientation) * grains(pairs(170,2)).meanOrientation {% endhighlight %} {% highlight plaintext %} mori = misorientation (Magnesium → Magnesium) Bunge Euler angles in degree phi1 Phi phi2 107.142 58.9469 309.49 {% endhighlight %}This can be generalized to compute the misorientations between neighbouring grains using
{% highlight matlab %} mori = inv(grains(pairs(:,1)).meanOrientation) .* grains(pairs(:,2)).meanOrientation close all histogram(mori.angle./degree) xlabel('misorientation angle') {% endhighlight %} {% highlight plaintext %} mori = misorientation (Magnesium → Magnesium) size: 251 x 1 {% endhighlight %}We observe a high peak at about 85 degree. This angle corresponds to twinning. In Magnesium the twinning orientation relationship is given by
{% highlight matlab %} twinning = orientation.map(Miller(0,1,-1,-2,CS),Miller(0,-1,1,-2,CS),... Miller(2,-1,-1,0,CS),Miller(2,-1,-1,0,CS)) {% endhighlight %} {% highlight plaintext %} twinning = misorientation (Magnesium → Magnesium) (1-101) || (10-11) [01-11] || [01-1-1] {% endhighlight %}In order to determine the percentage of twinnig pairs we do
{% highlight matlab %} % which of the pairs are twinning isTwinning = angle(mori,twinning) < 3*degree; % percentage of twinning pairs 100 * sum(isTwinning) / length(isTwinning) {% endhighlight %} {% highlight plaintext %} ans = 37.0518 {% endhighlight %}It is important to understand that the list returned by grains.neighbours
containes only pairs such that both grains are contained in grains
. This allows the syntax grains('phaseName')
to extract only neighbour relation ships within one phase.
In some case, e.g. if we ask for all neighbouring grains to a given grains, it is useful to replace this constraint by the condition that at least one grain should by part of grains
. This can be accomplished by the option 'full'
.


Last updated: 2019-12-18
Checks: 5 2
Knit directory: Heart/
This reproducible R Markdown analysis was created with workflowr (version 1.5.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
The R Markdown file has unstaged changes. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish
to commit the R Markdown file and build the HTML.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(1701)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .DS_Store
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: analysis/.DS_Store
Ignored: analysis/cache/
Ignored: code/.DS_Store
Ignored: data/
Ignored: shiny/
Untracked files:
Untracked: analysis/03-analysis.Rmd
Unstaged changes:
Modified: analysis/04-analysis.Rmd
Modified: analysis/05-analysis.Rmd
Modified: analysis/06-analysis.Rmd
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view them.
| File | Version | Author | Date | Message |
|---|---|---|---|---|
| html | eea09c3 | James Ashmore | 2019-12-16 | Build site. |
| Rmd | 1628e19 | James Ashmore | 2019-12-16 | wflow_publish(files = c("analysis/_site.yml“,”analysis/index.Rmd“,”analysis/01-analysis.Rmd“,”analysis/02-analysis.Rmd“,”analysis/04-analysis.Rmd“,”analysis/05-analysis.Rmd“,”analysis/06-analysis.Rmd"), dry_run = TRUE) |
Set knitr chunk options:
knitr::opts_chunk$set(
autodep = TRUE,
cache = TRUE,
cache.path = "cache/06-analysis/",
dev = "png",
error = FALSE,
message = FALSE,
warning = FALSE
)
Load required analysis packages:
pacman::p_load(batchelor, gam, here, readr, scater, scran, slingshot, RColorBrewer, pheatmap, igraph, EnsDb.Mmusculus.v79)
Load the merged dataset:
mnn <- read_rds(here("data/04-analysis.rds"))
Annotate gene identifiers:
rowData(mnn)$ENSEMBL <- rownames(mnn)
rowData(mnn)$SYMBOL <- mapIds(EnsDb.Mmusculus.v79, keys = rownames(mnn), column = "SYMBOL", keytype = "GENEID")
rownames(mnn) <- uniquifyFeatureNames(rowData(mnn)$ENSEMBL, rowData(mnn)$SYMBOL)
Plot UMAP showing neighbour, batch, and genotype annotation:
plt <- plotUMAP(mnn)
plt$data$fill_by <- mnn$neighbor
plt$data$colour_by <- mnn$batch
plt$data$facet_by <- mnn$genotype
col <- c(
"Allantois" = "#4cb08d",
"Blood" = "#c04fb4",
"Cardiac" = "#67b54e",
"Cardiomyocytes" = "#7b62d0",
"Endothelial" = "#bcaf46",
"Endothelium" = "#6479c3",
"ExE mesoderm" = "#ce5137",
"Extraembryonic ectoderm" = "#54acd8",
"Extraembryonic mesoderm" = "#d34379",
"Gut" = "#667934",
"Haematoendothelial progenitors" = "#c07ebe",
"Mesenchyme" = "#c38041",
"Mesothelium" = "#bd606e"
)
pch <- c("Marioni" = "transparent", "Wilson" = "#000000")
ggplot(plt$data, aes(X, Y)) +
geom_point(data = plt$data[, 1:4], mapping = aes(X, Y), colour = "grey") +
geom_point(aes(fill = fill_by, colour = colour_by), shape = 21) +
facet_wrap(~ facet_by, scales = "fixed") +
scale_fill_manual(name = "Neighbor", values = col) +
scale_colour_manual(name = "Batch", values = pch, limits = "Wilson") +
theme_void() +
theme(aspect.ratio = 1)
| Version | Author | Date |
|---|---|---|
| eea09c3 | James Ashmore | 2019-12-16 |
snn <- buildSNNGraph(mnn, assay.type = "reconstructed", use.dimred = "MNN")
cls <- igraph::cluster_walktrap(snn)$membership
mnn$cluster_full <- factor(cls)
plt <- plotUMAP(mnn)
plt$data$fill_by <- mnn$cluster_full
plt$data$colour_by <- mnn$batch
plt$data$facet_by <- mnn$genotype
pch <- c("Marioni" = "transparent", "Wilson" = "#000000")
ggplot(plt$data, aes(X, Y)) +
geom_point(data = plt$data[, 1:4], mapping = aes(X, Y), colour = "grey") +
geom_point(aes(fill = fill_by, colour = colour_by), shape = 21) +
facet_wrap(~ facet_by, scales = "fixed") +
scale_fill_brewer(name = "Cluster", palette = "Set1") +
scale_colour_manual(name = "Batch", values = pch, limits = "Wilson") +
theme_void() +
theme(aspect.ratio = 1)
| Version | Author | Date |
|---|---|---|
| eea09c3 | James Ashmore | 2019-12-16 |
sclust <- function(obj) {
ref <- mnn[, mnn$batch == "Marioni"]
sce <- mnn[, mnn$batch == "Wilson"]
mod <- model.matrix(~ pool + sample, data = colData(ref))
dec <- combineVar(modelGeneVar(ref, design = mod), modelGeneVar(sce, block = sce$phase))
hvg <- rownames(dec)[dec$bio > 0]
snn <- buildSNNGraph(obj, assay.type = "reconstructed", use.dimred = "MNN", subset.row = hvg)
cls <- igraph::cluster_walktrap(snn)$membership
obj$cluster_walktrap <- factor(cls)
return(obj)
}
tbl <- table(mnn$cluster_full)
lvl <- names(tbl)
lvl <- lvl[tbl > 1]
mnn <- lapply(lvl, function(x) {
obj <- mnn[, mnn$cluster_full == x]
obj <- sclust(obj)
obj
})
names(mnn) <- lvl
sig <- lapply(mnn, function(x) {
m <- findMarkers(x, x$cluster_walktrap, block = x$batch, assay.type = "logcounts")
m <- lapply(m, subset, FDR < 0.1)
m <- lapply(m, head, n = 25)
m <- lapply(m, rownames)
m <- unique(sort(unlist(m)))
})
sig <- Filter(length, sig)
Create dimensionality reduction plots coloured by the top 5 marker genes:
for (n in names(sig)) {
obj <- mnn[[n]]
plt <- plotUMAP(obj, colour_by = "cluster_walktrap", shape_by = "genotype")
cat("#### Cluster", n, "\n")
print(plt)
cat("\n\n")
}
Create a heatmap of expression values for the top 5 marker genes:
for (n in names(sig)) {
obj <- mnn[[n]]
ids <- sig[[n]]
cat("#### Cluster", n, "\n")
plotHeatmap(obj, ids, exprs_values = "reconstructed", center = TRUE, symmetric = TRUE, colour_columns_by = c("batch", "genotype"), order_columns_by = "cluster_walktrap", show_colnames = FALSE, cluster_rows = ifelse(length(ids) >= 2, TRUE, FALSE))
cat("\n\n")
}
saveRDS(mnn, file = here("data/06-analysis.rds"))


{% extends "base.html" %} {% load staticfiles %} {% load bootstrap3 %} {% block content %}
Copy and paste desired image links into post test field.