"use strict";
const service_request_1 = require("./service-request");
(function (AudioPlayerState) {
AudioPlayerState[AudioPlayerState["PlaybackError"] = 0] = "PlaybackError";
AudioPlayerState[AudioPlayerState["PlaybackFinished"] = 1] = "PlaybackFinished";
AudioPlayerState[AudioPlayerState["PlaybackNearlyFinished"] = 2] = "PlaybackNearlyFinished";
AudioPlayerState[AudioPlayerState["PlaybackStarted"] = 3] = "PlaybackStarted";
AudioPlayerState[AudioPlayerState["PlaybackStopped"] = 4] = "PlaybackStopped";
})(exports.AudioPlayerState || (exports.AudioPlayerState = {}));
var AudioPlayerState = exports.AudioPlayerState;
class AudioPlayer {
constructor(alexa) {
this.alexa = alexa;
this._playingStartTime = 0;
this._playingOffset = 0;
this._queue = [];
this._state = null;
this._suspended = false;
this._state = AudioPlayerState.PlaybackStopped;
console.log("CREATED");
}
enqueue(audioItem, playBehavior) {
if (playBehavior === AudioPlayer.PlayBehaviorEnqueue) {
this.queueAdd(audioItem);
}
else if (playBehavior === AudioPlayer.PlayBehaviorReplaceAll) {
this.stop();
this.queueClear();
this.queueAdd(audioItem);
}
else Eif (playBehavior === AudioPlayer.PlayBehaviorReplaceEnqueued) {
this.queueReplace();
this.queueAdd(audioItem);
}
}
offsetInMilliseconds() {
return this._playingOffset;
}
state() {
return this._state;
}
token() {
let token = null;
if (this.playing() !== null) {
token = this.playing().token;
}
return token;
}
playNext() {
if (this._queue.length === 0) {
return;
}
this._playingStartTime = new Date().getTime();
this._playingOffset = 0;
this.playbackStarted();
this.playbackNearlyFinished();
}
stop() {
this._playingOffset = this._playingOffset + (new Date().getTime() - this._playingStartTime);
this.playbackStopped();
}
suspend() {
this._suspended = true;
this.stop();
}
suspended() {
return this._suspended;
}
fastForward() {
this.finish();
this.playNext();
}
finish() {
this.playbackFinished(this._playingOffset + 1000);
this.queueSlice();
}
resume() {
this._suspended = false;
this._playingStartTime = new Date().getTime();
this.playbackStarted();
this.playbackNearlyFinished();
}
playbackNearlyFinished() {
let offset = new Date().getTime() - this._playingStartTime;
let serviceRequest = new service_request_1.ServiceRequest(this.alexa.context());
serviceRequest.audioPlayerRequest(service_request_1.RequestType.AudioPlayerPlaybackNearlyFinished, this.playing().token, offset);
this.alexa.callSkill(serviceRequest);
}
playbackFinished(offset) {
this._state = AudioPlayerState.PlaybackFinished;
let serviceRequest = new service_request_1.ServiceRequest(this.alexa.context());
serviceRequest.audioPlayerRequest(service_request_1.RequestType.AudioPlayerPlaybackFinished, this.playing().token, offset);
this.alexa.callSkill(serviceRequest);
}
playbackStarted() {
this._state = AudioPlayerState.PlaybackStarted;
let serviceRequest = new service_request_1.ServiceRequest(this.alexa.context());
serviceRequest.audioPlayerRequest(service_request_1.RequestType.AudioPlayerPlaybackStarted, this.playing().token, this._playingOffset);
this.alexa.callSkill(serviceRequest);
}
playbackStopped() {
this._state = AudioPlayerState.PlaybackStopped;
let serviceRequest = new service_request_1.ServiceRequest(this.alexa.context());
serviceRequest.audioPlayerRequest(service_request_1.RequestType.AudioPlayerPlaybackStopped, this.playing().token, this._playingOffset);
this.alexa.callSkill(serviceRequest);
}
directivesReceived(request, directives) {
for (let directive of directives) {
this.handleDirective(request, directive);
}
}
handleDirective(request, directive) {
if (directive.type === AudioPlayer.DirectivePlay) {
let audioItem = new AudioItem(directive.audioItem);
let playBehavior = directive.playBehavior;
this.enqueue(audioItem, playBehavior);
}
else Eif (directive.type === AudioPlayer.DirectiveStop) {
Eif (this.suspended()) {
this._suspended = false;
}
else if (this.playing()) {
this.stop();
}
}
}
isPlaying() {
return (this._state === AudioPlayerState.PlaybackStarted || this._state === AudioPlayerState.PlaybackNearlyFinished);
}
queueAdd(audioItem) {
this._queue.push(audioItem);
if (this._queue.length === 1) {
this.playNext();
}
}
queueClear() {
this._queue = [];
}
queueReplace() {
this._queue = [this._queue[0]];
}
queueSlice() {
this._queue = this._queue.slice(1);
}
playing() {
if (this._queue.length === 0) {
return null;
}
return this._queue[0];
}
}
AudioPlayer.DirectivePlay = "AudioPlayer.Play";
AudioPlayer.DirectiveStop = "AudioPlayer.Stop";
AudioPlayer.DirectiveClearQueue = "AudioPlayer.ClearQueue";
AudioPlayer.PlayBehaviorReplaceAll = "REPLACE_ALL";
AudioPlayer.PlayBehaviorEnqueue = "ENQUEUE";
AudioPlayer.PlayBehaviorReplaceEnqueued = "REPLACE_ENQUEUED";
exports.AudioPlayer = AudioPlayer;
class AudioItem {
constructor(json) {
this.json = json;
this.url = null;
this.token = null;
this.expectedPreviousToken = null;
this.url = json.stream.url;
this.token = json.stream.token;
this.expectedPreviousToken = json.stream.expectedPreviousToken;
this.offsetInMilliseconds = json.stream.offsetInMilliseconds;
}
}
exports.AudioItem = AudioItem;
//# sourceMappingURL=audio-player.js.map |


Upload images using the panel to the left.
{{$ctrl.username}} has not uploaded anything.
Choose a gallery using the panel to the left.


{% extends '_layouts/cp' %} {% set title = 'Art Vandelay' %} {% set crumbs = [ { label: "Settings"|t, url: url('settings') }, { label: "Plugins"|t, url: url('settings/plugins') } ] %} {% includeJsResource('artvandelay/js/default.js') %} {% block content %} {% import '_includes/forms' as forms %}
Image by Luca Ohman


A vehicle data struct for an emergency event
References signal “VedsEvntType_D_Ltchd”. See EmergencyEventType.
Required
@property (nonatomic, strong) SDLEmergencyEventType _Nonnull emergencyEventType;
var emergencyEventType: SDLEmergencyEventType { get set }
References signal “RCM_FuelCutoff”. See FuelCutoffStatus.
Required
@property (nonatomic, strong) SDLFuelCutoffStatus _Nonnull fuelCutoffStatus;
var fuelCutoffStatus: SDLFuelCutoffStatus { get set }
References signal “VedsEvntRoll_D_Ltchd”. See VehicleDataEventStatus.
Required
@property (nonatomic, strong) SDLVehicleDataEventStatus _Nonnull rolloverEvent;
var rolloverEvent: SDLVehicleDataEventStatus { get set }
References signal “VedsMaxDeltaV_D_Ltchd”. Change in velocity in KPH.
Additional reserved values: 0x00 No event, 0xFE Not supported, 0xFF Fault
Required
@property (nonatomic, strong) NSNumber<SDLInt> *_Nonnull maximumChangeVelocity;
var maximumChangeVelocity: NSNumber & SDLInt { get set }
References signal “VedsMultiEvnt_D_Ltchd”. See VehicleDataEventStatus.
Required
@property (nonatomic, strong) SDLVehicleDataEventStatus _Nonnull multipleEvents;
var multipleEvents: SDLVehicleDataEventStatus { get set }


Software Engineer Intern
Capital One
In the Card Tech team, I worked with 2 interns to create natural language processing pipelines and machine learning models. Additionally, I helped develop a server-side Python application and client-side Angular application that applies OCR (optical character recognition) and 3 trained machine learning models to classify different types of documents.
June 2020 - Aug. 2020
Technology Intern
Delta Airlines
In the Crew Modernization team, I worked on the back-end of a profile management application for 15,000 pilots and 25,000 flight attendants. I developed object-oriented features in Java for a Spring Boot microservice and wrote SQL queries to interface with a relational database.
May 2019 - Aug. 2019
Web Development Intern
Octane5
In the Activation team, I developed a counterfeit detection module for a full-stack Django web application, leveraging Python, HTML, CSS, Javascript, and REST APIs. I also built a CSV exporter tool to automate the work-order process and 4 REST API endpoints to handle synchronous HTTP requests.
May 2018 - Aug. 2018
Teaching Assistant
Georgia Institute of Technology
Currently, I am working as a Teaching Assistant for CS 3600 (Introduction to Artificial Intelligence), where I assist students with their projects, focusing on A.I. agents, informed search, neural networks, and probabilistic inference.
In the past, I have worked as a Teaching Assistant for CS 2340 (Objects and Design). My responsibilities included helping students with the development of JavaFX / Android applications and leading technical demos every Agile sprint for a group of 25 students.
Jan. 2018 - Dec. 2020


Home
Tutorials
About
Information
Bui Tuan Linh
RMIT Saigon South Campus
Student ID: S3877765
Email: s3877765@rmit.edu.vn


A fast, free, and secure way to send files. No sign-up required.
Send a file
An error has occured. Please try again.
To begin the transfer, have the recipient open this URL:
Your file has been sent successfully.


Medknow Publications & Media Pvt Ltd
MAGNETIZED SOLUTIONS ALTERED THE ABSORBANCE OF TRAMADOL HCL: UV-SPECTROPHOTOMETER
STUDY
contrib:
CONT
Marwan S.M. Al-Nimer
Fezaa Sh. Neda
Zainab W. Abdul Lateef
<EMAIL_ADDRESS>[]
[]
[2010-5-15]
[Copyright 2010: ]
[Licence This is an open-access article distributed under the terms of the Creative
Commons Attribution-Noncommercial-Share Alike 3.0 Unported, which permits unrestricted
use, distribution, and reproduction in any medium, provided the original work is properly
cited.]
[]
[]
[]


Click the button below to permanently clear ALL Garland Tools settings. This will wipe out any lists you've created with Garland Data.
Click the button below to permanently clear only Garland Bell settings.


Not So Fast
How to change your PS4 region
by Jennifer LockeUnfortunately, there is no way to chance your region if you've already set up a PlayStation Network account. You're stuck with that region. This is because PSN ties the its specific regional stores to your ID. However, you can make a new account and set it to whichever region of your choice, thus granting you access to otherwise inaccessible games.
How to set up a new account
- Turn on your PS4 console.
- Set up a new account on the welcome screen by selecting New User.
-
Select Create a User on the next screen.
- Accept the User Agreement.
- Select Next.
- Select New to PlayStation Network? Create an Account.
- Fill out the information as prompted using an email address not already associated with a PlayStation Network account.
- Once prompted, select your new region of choice.
Alternatively, you can go to directly to the other region's store page before signing up for an account. Make sure you're logged out of your other account first because if the regions vary, you'll receive an error and a prompt to go back to your regional store page.
If you select a non-English region, you might need the help of trusty Google Translate to do some of the heavy lifting for you. When you're asked to fill out your zip code, any zip code from the region you chose will work.
Buying content from another region
The PlayStation Store only allows credit cards and PayPal accounts registered to your region, so you'll instead need to use PlayStation Store gift cards. Another problem: the gift card currency needs to match the currency of the region you are in, i.e. you can't use a $25 gift card on the Japanese or European digital storefronts.
However, you can purchase gift cards in other currency. For example, you can buy a 5000 yen Japanese PlayStation Store gift card for around $50.
Pick up these great PlayStation 4 accessories and gift cards
PlayStation Network Gift Card (From $10 at Amazon)
You can never go wrong with a PlayStation Network gift card. Whether you're looking to purchase a game, some DLC, or your favorite app, you'll want to have some extra funds in your PSN wallet.
PlayStation Plus 12-month ($60 at Amazon)
Picking up a PlayStation Plus membership is the best way to get the most out of your console. With a membership set up on your primary PS4, you can share its benefits with your family — from discounts, online multiplayer, and even monthly free games.
HyperX ChargePlay Duo ($18 at Amazon)
Charge up your controllers without taking up that precious USB space on your console. The HyperX ChargePlay Duo can charge two at once in two hours through an AC adapter.
We may earn a commission for purchases using our links. Learn more.


PluMA: Plugin-Based Microbiome Analysis
People
Principal Investigator: Prof. Giri Narasimhan
Pipeline Architect: Dr. Trevor Cickovski
Abstract
Our goal with PluMA is to facilitate the construction of flexible and lightweight analysis pipelines through which a developer can implement a new algorithm in their programming language of choice, and easily test and debug within a larger pipeline alongside stages in different languages that potentially use different file formats.
PluMA accomplishes this through plugins, and has a large collection available in its plugin pool, implemented in various programming languages for both the CPU and GPU. Plugins can be run sequentially to form a pipeline, and can be easily added, removed or substituted through our user interface. Since plugins are dynamically loaded, you can assemble a pipeline by downloading PluMA and only the plugins that you need from the pool.
Note: Our software should not be confused with the PluMa Plugin Management system, and we have no connections or competing interests with PluMa.
Note: PluMA is now a part of OMICTools! Visit their site for details.
Citations
Cickovski, T., Narasimhan, G. (2018) Constructing Lightweight and Flexible Pipelines Using Plugin-Based Microbiome Analysis (PluMA), Bioinformatics 34(17):2881-2888, 2018.
Cickovski, T., Aguiar-Pulido, V., Huang, W., Mahmud, S., Narasimhan, G. (2016). Lightweight Microbiome Analysis Pipelines In Proceedings of International Work Conference on Bioinformatics and Biomedical Engineering (IWBBIO'16)


| format.integer64 {bit64} | R Documentation |
Unary operators and functions for integer64 vectors.
## S3 method for class 'integer64' format(x, justify="right", ...) ## S3 method for class 'integer64' is.na(x) ## S3 method for class 'integer64' is.nan(x) ## S3 method for class 'integer64' is.finite(x) ## S3 method for class 'integer64' is.infinite(x) ## S3 method for class 'integer64' !x ## S3 method for class 'integer64' sign(x) ## S3 method for class 'integer64' abs(x) ## S3 method for class 'integer64' sqrt(x) ## S3 method for class 'integer64' log(x, base) ## S3 method for class 'integer64' log2(x) ## S3 method for class 'integer64' log10(x) ## S3 method for class 'integer64' floor(x) ## S3 method for class 'integer64' ceiling(x) ## S3 method for class 'integer64' trunc(x, ...) ## S3 method for class 'integer64' round(x, digits=0) ## S3 method for class 'integer64' signif(x, digits=6) ## S3 method for class 'integer64' scale(x, center = TRUE, scale = TRUE)
x |
an atomic vector of class 'integer64' |
base |
an atomic scalar (we save 50% log-calls by not allowing a vector base) |
digits |
integer indicating the number of decimal places (round) or significant digits (signif) to be used.
Negative values are allowed (see |
justify |
should it be right-justified (the default), left-justified, centred or left alone. |
center |
see |
scale |
see |
... |
further arguments to the |
format
returns a character vector
is.na
and !
return a logical vector
sqrt
, log
, log2
and log10
return a double vector
sign
, abs
, floor
, ceiling
, trunc
and
round
return a vector of class 'integer64'
signif
is not implemented
Jens Oehlschlägel<EMAIL_ADDRESS>sqrt(as.integer64(1:12))


I am a Software Engineer, currently living in San Jose working for Cisco as platform infrastructure DevOps and full stack web development role.
2011-2013
2007-2011
2014 - Present
2013-2014
2010-2011
Django / Flask
Python
JavaScript (JQuery)
CSS (Bootstrap / SASS)
Perl
HTML
Git
SQL
Java


Add a cookie in the cookie store or replace it if it already exists.
Name:
Domain:
Path:
Value:
Expires:
null (if null, cookie is set as a session cookie)
Set Cookie


New in opportunities, in new solutions. In the digital marketing performance area, we generate business for our customers through a continuous search for the perfect relationship between the needs of online demand and product offerings and services of our clients. On average, over the last four years, the company exported about 81% of its turnover. As a result of innovation and process improvements the company has managed to penetrate new markets and be more efficient in the processing of digital marketing campaigns.
João Cortez is a Senior Software Engineer and Team Leader at Adclick. Born in Porto and with a postgraduate degree in Informatics Engineering he has the main objective to develop solutions (mostly backend) with focus on performance and to develop a great team with focus on bad jokes.


Joe Demcher
Developer | Student | Chinchilla enthusiast
Home
About
Contact
Github
LinkedIn
© 2019 Joseph Demcher. All Rights Reserved.


Man told he can't stand as Santa in election because voters would be 'confused'
A man has slammed his ‘killjoy’ council for refusing to allow him to stand in the general election as Santa Claus.
Dave Yates, 58, has been told he can’t campaign as Father Christmas in the Newbury constituency because it would ‘confuse and mislead voters’.
He called staff at West Berkshire Council ‘Grinches’ and said that as he looks so much like Santa – with white hair and beard – it would not be confusing.
Council chief executive Nick Carter confirmed to him that ‘Santa Claus’ would not be on the ballot paper in the 12 December election.
Dave, who gained 300 votes while standing as himself for the Apolitical Party in 2017, is contesting the decision.
If successful, it could force a by-election in Newbury in February.
He said: ‘Santa was hoping to stand in this election on a message of peace and goodwill to all.’
Dave added ‘more importantly’ he wanted to warn voters to be aware when choosing their next MP of a ‘huge spike in borrowing to pay for all the “giveaways”
being promised’ and ‘the possible catastrophic effect it could have on our grandchildren’.
Advertisement Advertisement
A spokesperson for the council said: ‘Yes, David Yates did seek to stand as Santa Claus.
‘Candidates can use a name that they are commonly known by which is usually an abbreviation of their full name, eg Tom.
‘As Mr Yates is not commonly known as Santa Claus, it was deemed to be both confusing and misleading.
‘Judgements need to be made when considering all nominations and decisions taken as to whether the use of the particular name would confuse or mislead the electors within the constituency.’
Heating engineer Dave said he dresses as Father Christmas at various festive events so hopes enough people will support his appeal.
He said: ‘I first stood in a general election in 2010. I had formed my own party – Apolitical Democrats – trying to get away from the dogma of party politics, which was driving me mad.
‘I’m just trying to make a statement that we need to get away from from party politics as we have known it for the last 50 years or so.’
Dave added: ‘The fact that it was a Christmas election was just too good of an opportunity to be missed – I had already been growing the beard.
‘Lord Buckethead and Count Binface are allowed to stand, so why not Santa Claus?’
Got a story for Metro.co.uk?
Get in touch with our news team by emailing us at<EMAIL_ADDRESS>For more stories like this, check our news page.


CRUD Document Operations Using the Java SDK with Couchbase Server
You can access documents in Couchbase using methods of the couchbase.couchbase.client.java.Bucket
object.
The methods for retrieving documents are get()
and lookupIn()
and the methods for mutating documents are upsert()
, insert()
, replace()
and mutateIn()
.
Examples are shown using the synchronous API. See the section on Async Programming for other APIs.
Additional Options
Update operations also accept a TTL (expiry) value (expiry
) on the passed document which will instruct the server to delete the document after a given amount of time.
This option is useful for transient data (such as sessions).
By default documents do not expire.
See Expiration Overview for more information on expiration.
Update operations can also accept a CAS (cas
) value on the passed document to protect against concurrent updates to the same document.
See CAS for a description on how to use CAS values in your application.
Since CAS values are opaque, they are normally retreived when a Document is loaded from Couchbase and then used subsequently (without modification) on the mutation operations.
If a mutation did succeed, the returned Document will contain the new CAS value.
Document Input and Output Types
Couchbase stores documents. From an SDK point of view, those documents contain the actual value (like a JSON object) and associated metadata. Every document in the Java SDK contains the following properties, some of them optional depending on the context:
| Name | Description |
|---|---|
|
The (per bucket) unique identifier of the document. |
|
The actual content of the document. |
|
The CAS (Compare And Swap) value of the document. |
|
The expiration time of the document. |
|
The optional MutationToken after a mutation. |
There are a few different implementations of a Document
.
Here are a few noteworthy document types:
-
JsonDocument
: The default one in most methods, contains a JSON object (as aJsonObject
). -
RawJsonDocument
: Represents any JSON value, stored as aString
(useful for when you have your own JSON serializer/deserializer). -
BinaryDocument
: Used to store pure raw binary data (as aByteBuf
from Netty).The ByteBuf
comes from Netty, and when reading one from the SDK, you need to manage its memory by hand by callingrelease()
. See the section about binary documents.
Because Couchbase Server can store anything and not just JSON files, many document types exist to satisfy the general needs of an application.
You can also write your own Document
implementations, which is not covered in this introduction.
Creating and Updating Full Documents
Documents may be created and updated using the Bucket#upsert()
, Bucket#insert()
, and Bucket#replace()
family of methods.
Read more about the difference between these methods at Primitive Key-Value Operations in the Couchbase developer guide.
These methods accept a Document instance where the following values are considered if set:
-
id
(mandatory): The ID of the document to modify (String). -
content
(mandatory): The desired new content of the document, this varies per document type used. If theJsonDocument
is used, the document type is aJsonObject
. -
expiry
(optional): Specify the expiry time for the document. If specified, the document will expire and no longer exist after the given number of seconds. See Expiration Overview for more information. -
cas
(optional): The CAS value for the document. If the CAS on the server does not match the CAS supplied to the method, the operation will fail with aCASMismatchException
. See Concurrent Document Mutations for more information on the usage of CAS values.
Other optional arguments are also available for more advanced usage:
-
persistTo
,replicateTo
: Specify durability requirements for the operations. -
timeout
,timeUnit
: Specify a custom timeout which overrides the default timeout setting.
Upon success, the returned Document
instance will contain the new CAS value of the document.
If the document is not mutated successfully, an exception is raised depending on the type of error.
Inserting a document works like this:
JsonDocument doc = JsonDocument.create("document_id", JsonObject.create().put("some", "value"));
System.out.println(bucket.insert(doc));
Output: JsonDocument{id='document_id', cas=216109389250560, expiry=0, content={"some":"value"}, mutationToken=null}
If the same code is called again, a DocumentAlreadyExistsException
will be thrown.
If you don’t care that the document is overridden, you can use upsert
instead:
JsonDocument doc = JsonDocument.create("document_id", JsonObject.empty().put("some", "other value"));
System.out.println(bucket.upsert(doc));
Output: JsonDocument{id='document_id', cas=216109392920576, expiry=0, content={"some":"other value"}, mutationToken=null}
Finally, a full document can be replaced if it existed before.
If it didn’t exist, then a DocumentDoesNotExistException
will be thrown:
JsonDocument doc = JsonDocument.create("document_id", JsonObject.empty().put("more", "content"));
System.out.println(bucket.replace(doc));
Output: JsonDocument{id='document_id', cas=216109395083264, expiry=0, content={"more":"content"}, mutationToken=null}
Retrieving full documents
You can retrieve documents using the Bucket#get()
, Bucket#getAndLock()
, Bucket#getAndTouch()
and Bucket#getFromReplica()
methods.
All of those serve different distinct purposes and accept different parameters.
Most of the time you use the get()
method.
It accepts one mandatory argument:
-
id
: The document ID to retrieve
System.out.println(bucket.get("document_id"));
Output: JsonDocument{id='document_id', cas=216109395083264, expiry=0, content={"more":"content"}, mutationToken=null}
Other overloads are available for advanced purposes:
-
document
: Instead of just passing an Id a full document can be passed in. If so, the ID is extracted and used. -
target
: A custom Document type (other thanJsonDocument
) can be specified. -
timeout
,timeUnit
: Specify a custom timeout which overrides the default timeout setting.
// Use a Document where ID is extracted
JsonDocument someDoc = JsonDocument.create("document_id");
System.out.println(bucket.get(someDoc));
Output: JsonDocument{id='document_id', cas=216109395083264, expiry=0, content={"more":"content"}, mutationToken=null}
// A custom Document type, here it returns the plain raw JSON String, encoded.
RawJsonDocument doc = bucket.get("document_id", RawJsonDocument.class);
String content = doc.content();
System.out.println(content);
Output: {"more":"content"}
// Wait only 1 second instead of the default timeout
JsonDocument doc = bucket.get("document_id", 1, TimeUnit.SECONDS);
It is also possible to read from a replica if you want to explicitly trade availability for consistency during the timeframe when the active partition is not reachable (for example during a node failure or netsplit).
getFromReplica
has one mandatory argument as well:
-
id
: The document ID to retrieve
Since you can have 0 to 3 replicas (and they can change at runtime of your application) the getFromReplica
returns Lists or Iterators.
It is recommended to use the Iterator APIs since they provide more flexibility during error conditions (since only partial responses may be retreived).
Iterator<JsonDocument> docIter = bucket.getFromReplica("document_id");
while(docIter.hasNext()) {
JsonDocument replicaDoc = docIter.next();
System.out.println(replicaDoc);
}
Other overloads are available for advanced purposes:
-
replicaMode
: Allows to configure from which replicas to read from (defaults to all). -
document
: Instead of just passing an Id a full document can be passed in. If so, the ID is extracted and used. -
target
: A custom Document type (other thanJsonDocument
) can be specified. -
timeout
,timeUnit
: Specify a custom timeout which overrides the default timeout setting.
In general, always use the ReplicaMode.ALL option and not ReplicaMode.FIRST and similar to just get the first replica.
The reason is that is that ALL will also try the active node, leading to more reliable behavior during failover.
If you just need the first replica use the iterator approach and break; once you have enough data from the replicas.
|
| Since a replica is updated asynchronously and eventually consistent, reading from it may return stale and/or outdated results! |
If you need to use pessimistic write locking on a document you can use the getAndLock
which will retreive the document if it exists and also return its CAS
value.
You need to provide a time that the document is maximum locked (and the server will unlock it then) if you don’t update it with the valid cas.
Also note that this is a pure write lock, reading is still allowed.
// Get and Lock for max of 10 seconds
JsonDocument ownedDoc = bucket.getAndLock("document_id", 10);
// Do something with your document
JsonDocument modifiedDoc = modifyDocument(ownedDoc);
// Write it back with the correct CAS
bucket.replace(modifiedDoc);
If the document is locked already and you are trying to lock it again you will receive a TemporaryLockFailureException
.
It is also possible to fetch the document and reset its expiration value at the same time. See Modifying Expiration for more information.
Removing full documents
You can remove documents using the Bucket.remove()
method.
This method takes a single mandatory argument:
-
id
: The ID of the document to remove.
Some additional options:
-
persistTo
,replicateTo
: Specify durability requirements for the operations. -
timeout
,timeUnit
: Specify a custom timeout which overrides the default timeout setting.
If the cas
value is set on the Document overload, it is used to provide optimistic currency, very much like the replace
operation.
// Remove the document
JsonDocument removed = bucket.remove("document_id");
JsonDocument loaded = bucket.get("document_id");
// Remove and take the CAS into account
JsonDocument removed = bucket.remove(loaded);
Modifying expiration
Many methods support setting the expiry value as part of their other primary operations:
-
Bucket#touch
: Resets the expiry time for the given document ID to the value provided. -
Bucket#getAndTouch
: Fetches the document and resets the expiry to the given value provided. -
Bucket#insert
,Bucket#upsert
,Bucket#replace
: Stores the expiry value alongside the actual mutation when set on theDocument
instance.
The following example stores a document with an expiry, waits a bit longer and as a result no document is found on the subsequent get:
int expiry = 2; // seconds
JsonDocument stored = bucket.upsert(
JsonDocument.create("expires", expiry, JsonObject.create().put("some", "value"))
);
Thread.sleep(3000);
System.out.println(bucket.get("expires"));
null
You may also use the Bucket#touch()
method to modify expiration without fetching or modifying the document:
bucket.touch("expires", 2);
Atomic Document Modifications
Additional atomic document modifications can be performing using the Java SDK.
You can modify a counter document using the Bucket.counter()
method.
You can also use the Bucket.append()
and Bucket.prepend()
methods to perform raw byte concatenation.
Batching Operations
Since the Java SDK uses RxJava as its asynchronous foundation, all operations can be batched in the SDK using the asynchronous API via bucket.async()
(and optionally revert back to blocking).
For implicit batching use these operators: Observable.just()
or Observable.from()
to generate an observable that contains the data you want to batch on.
flatMap()
to send those events against the Couchbase Java SDK and merge the results asynchronously.
last()
if you want to wait until the last element of the batch is received.
toList()
if you care about the responses and want to aggregate them easily.
If you have more than one subscriber, use cache()
to prevent accessing the network over and over again with every subscribe.
The following example creates an observable stream of 6 keys to load in a batch, asynchronously fires off get()
requests against the SDK (notice the bucket.async().get(...)
), waits until the last result has arrived, and then converts the result into a list and blocks at the very end.
This pattern can be reused for mutations like upsert
(as shown further down):
Cluster cluster = CouchbaseCluster.create();
Bucket bucket = cluster.openBucket();
List<JsonDocument> foundDocs = Observable
.just("key1", "key2", "key3", "key4", "inexistentDoc", "key5")
.flatMap(new Func1<String, Observable<JsonDocument>>() {
@Override
public Observable<JsonDocument> call(String id) {
return bucket.async().get(id);
}
})
.toList()
.toBlocking()
.single();
for (JsonDocument doc : foundDocs) {
System.out.println(doc.id());
}
key1 key2 key3 key4 key5
Note that this always returns a list, but it may contain 0 to 6 documents (here 5) depending on how many are actually found. Also, at the very end the observable is converted into a blocking one, but everything before that, including the network calls and the aggregation, is happening completely asynchronously.
Inside the SDK, this provides much more efficient resource utilization because the requests are very quickly stored in the internal Request RingBuffer and the I/O threads are able to pick batches as large as they can. Afterward, whatever server returns a result first it is stored in the list, so there is no serialization of responses going on.
Batching mutations: The previous Java SDK only provided bulk operations for get().
With the techniques shown above, you can perform any kind of operation as a batch operation.
The following code generates a number of fake documents and inserts them in one batch.
Note that you can decide to either collect the results with toList()
as shown above or just use last()
as shown here to wait until the last document is properly inserted:
// Generate a number of dummy JSON documents
int docsToCreate = 100;
List<JsonDocument> documents = new ArrayList<JsonDocument>();
for (int i = 0; i < docsToCreate; i++) {
JsonObject content = JsonObject.create()
.put("counter", i)
.put("name", "Foo Bar");
documents.add(JsonDocument.create("doc-"+i, content));
}
// Insert them in one batch, waiting until the last one is done.
Observable
.from(documents)
.flatMap(new Func1<JsonDocument, Observable<JsonDocument>>() {
@Override
public Observable<JsonDocument> call(final JsonDocument docToInsert) {
return bucket.async().insert(docToInsert);
}
})
.last()
.toBlocking()
.single();
Operating with Sub-Documents
| Sub-Document API is available starting Couchbase Server version 4.5. See Sub-Document Operations for an overview. |
Sub-document operations save network bandwidth by allowing you to specify paths of a document to be retrieved or updated.
The document is parsed on the server and only the relevant sections (indicated by paths) are transferred between client and server.
You can execute sub-document operations in the Java SDK using the Bucket#lookupIn()
and Bucket#mutateIn()
methods.
Each of these methods accepts a key
as its mandatory first argument and give you a builder that you can use to chain several command specifications, each specifying the path to be impacted by the specified operation and a document field operand.
You may find all the operations in the LookupInBuilder
and MutateInBuilder
classes.
bucket.lookupIn("docid")
.get("path.to.get")
.exists("check.path.exists")
.execute();
boolean createParents = true;
bucket.mutateIn("docid")
.upsert("path.to.upsert", value, createParents)
.remove("path.to.del"))
.execute();
All sub-document operations return a special DocumentFragment
object rather than a Document
.
It shares the id()
, cas()
and mutationToken()
fields of a document, but in contrast with a normal Document
object, a DocumentFragment
object contains multiple results with multiple statuses, one result/status pair for every input operation.
So it exposes method to get the content()
and status()
of each spec, either by index or by path.
It also allows to check that a response for a particular spec exists()
:
DocumentFragment<Lookup> res =
bucket.lookupIn("docid")
.get("foo")
.exists("bar")
.exists("baz")
.execute();
// First result
res.content("foo");
// or
res.content(0);
Using the content(...)
methods will raise an exception if the individual spec did not complete successfully.
You can also use the status(...)
methods to return an error code (a ResponseStatus
) rather than throw an exception.
Formats and Non-JSON Documents
| See Non-JSON Documents for a general overview of using non-JSON documents with Couchbase |
The Java SDK defines several concrete implementations of a Document
to represent the various data types that it can store.
Here is the complete list of document types:
| Document Name | Description |
|---|---|
|
The default, which has a |
|
Stores any JSON value and should be used if custom JSON serializers such as Jackson or GSON are already in use. |
|
Similar to JsonDocument, but has a |
|
Stores JSON-compatible Boolean values. |
|
Stores JSON compatible long (number) values. |
|
Stores JSON compatible double (number) values. |
|
Stores JSON compatible |
|
Used with the |
| Document Name | Description |
|---|---|
|
Can be used to store arbitrary binary data. |
|
Stores objects that implement |
|
Uses the |
|
Can be used to store arbitrary strings. They will not be quoted, but stored as-is and flagged as "String". |
You can implement a custom document type and associated transcoder if none of the pre-configured options are suitable for your application.
A custom transcoder converts intputs to their serialized forms, and deserializes encoded data based on the item flags.
There is an AbstractTranscoder
that can serve as the basis for a custom implementation, and custom transcoders should be registered with a Bucket
when calling Cluster#openBucket
(a list of custom transcoders can be passed in one of the overloads).
Correctly Managing BinaryDocuments
The BinaryDocument
can be used to store and read arbitrary bytes.
It is the only default codec that directly exposes the underlying low-level Netty ByteBuf
objects.
| Because the raw data is exposed, it is important to free it after it has been properly used. Not freeing it will result in increased garbage collection and memory leaks and should be avoided by all means. See Correctly Managing Buffers. |
Because binary data is arbitrary anyway, it is backward compatible with the old SDK regarding flags so that it can be read and written back and forth. Make sure it is not compressed in the old SDK and that the same encoding and decoding process is used on the application side to avoid data corruption.
Here is some demo code that shows how to write and read raw data. The example writes binary data, reads it back, and then frees the pooled resources:
// Create buffer out of a string
ByteBuf toWrite = Unpooled.copiedBuffer("Hello World", CharsetUtil.UTF_8);
// Write it
bucket.upsert(BinaryDocument.create("binaryDoc", toWrite));
// Read it back
BinaryDocument read = bucket.get("binaryDoc", BinaryDocument.class);
// Print it
System.out.println(read.content().toString(CharsetUtil.UTF_8));
// Free the resources
ReferenceCountUtil.release(read.content());
Correctly Managing Buffers
BinaryDocument
allows users to get the rawest form of data out of Couchbase.
It exposes Netty’s ByteBuf
, byte buffers that can have various characteristics (on- or off-heap, pooled or unpooled).
In general, buffers created by the SDK are pooled and off heap.
You can disable the pooling in the CouchbaseEnvironment
if you absolutely need that.
As a consequence, the memory associated with the ByteBuf must be a little bit more managed by the developer than usual in Java.
Most notably, these byte buffers are reference counted, and you need to know three main methods associated to buffer management:
-
refCnt()
gives you the current reference count. When it hits 0, the buffer is released back to its original pool, and it cannot be used anymore. -
release()
will decrease the reference count by 1 (by default). -
retain()
is the inverse of release, allowing you to prepare for multiple consumptions by external methods that you know will each release the buffer.
You can also use ReferenceCountUtil.release(something)
if you don’t want to check if something
is actually a ByteBuf
(will do nothing if it’s not something that is ReferenceCounted
).
The SDK bundles the Netty dependency into a different package so that it doesn’t clash with a dependency to another version of Netty you may have.
As such, you need to use the classes and packages provided by the SDK (com.couchbase.client.deps.io.netty ) when interacting with the API.
For example, the ByteBuf for the content of a BinaryDocument is a com.couchbase.client.deps.io.netty.buffer.ByteBuf .
|
What happens if I don’t release?
Basically, you leak memory... Netty will by default inspect a small percentage of ByteBuf
creations and usage to try and detect leaks (in which case it will output a log, look for the "LEAK" keyword).
You can tune that to be more eagerly monitoring all buffers by calling ResourceLeakDetector.setLevel(PARANOID)
.
Note that this incurs quite an overhead and should only be activated in tests.
In production (prod), setting it to ADVANCED is not as heavy as paranoid and can be a good middle ground.
|
What happens if I release twice (or the SDK releases once more after I do)?
Netty will throw IllegalReferenceCountException
.
The buffer that has RefCnt = 0 cannot be interacted with anymore since it means it has been freed back into the pool.
When must I release?
When the SDK creates a BinaryDocument
for you, basically GET-type operations.
Mutative operations, on the other hand, will take care of the buffer you pass in for you, at the time the buffer is written on the wire.
When must I usually retain?
When you do a write, the buffer will usually be released by the SDK calling release()
.
But if you implement a kind of fallback behavior (for instance attempt to insert()
a doc, catch DocumentAlreadyExistException
and then fallback to an update()
instead), that means the SDK would attempt to release twice, which won’t work.
In this case you can retain()
the buffer before the first attempt, let the catch block do the extra release if something goes wrong.
You have to manage the extra release if the first write succeeds, and think about catching other possible exceptions (here also an extra release is needed):
byteBuffer.retain(); //prepare for potential multi usage (+1 refCnt, refCnt = 2)
try {
bucket.append(document);
// refCnt = 2 on success
byteBuffer.release(); //refCnt = 1
} catch (DocumentDoesNotExistException dneException) {
// buffer is released on errors, refCnt = 1
//second usage will also release, but we want to be at refCnt = 1 for the finally block
byteBuffer.retain(); //refCnt = 2
bucket.insert(document); //refCnt = 1
} // other uncaught errors will still cause refCnt to be released down to 1
finally {
//we made sure that at this point refCnt = 1 in any case (success, caught exception, uncaught exception)
byteBuffer.release(); //refCnt = 0, returned to the pool
}


SignUp
First Name
Last Name
Password
Confirm Password
Phone Number
Gender:
Male
Female
Signup
Already have an account?
Login


--- layout: post title: Using TaskCoach with Pomodoro tags: - GTD - LinkedIn - Open Source Software - Work Practices status: publish type: post published: true meta: _edit_last: '451289' --- As well as adopting the Pomodoro time management technique I've started using TaskCoach to manage my tasks and related lists (based on a GTD style workflow, which I have written about in a later post). TaskCoach has some really useful features, works across all the major desktop platforms, can be used for zero cost and is open source. Whilst TaskCoach has no direct support for Pomodoro it is easy to add it in by using task templates. As well as TaskCoach you may need a software Pomodoro timer, I use Pomodairo. I have created a task template which you can use as a starting point. Download and unpack the template to a file location on your PC. Open TaskCoach and from the file menu select "Add Template", browse to the location were you saved my template and select it. When you return to the main TaskCoach window you should now be able to select Task -> New Task from Template and see "Pomodoro Task" in the sub menu. Select the Pomodoro Task and you should see something like this
You can now update the title (make as descriptive as possible so you don't need to open the task to see what it's about, but be pithy) and the estimated number of Pomodoros. So it looks like this When you start your Pomodoro for this task you can open the task to:


Delta flight from Boston to L.A. made emergency landing in Syracuse
by EndPlayBOSTON - A Delta flight from Boston to Los Angeles made an emergency landing in Syracuse on Friday night.
Flight 2531, a Boeing 757, landed safely at Syracuse Hancock International Airport just after 7:30 p.m. after declaring an emergency because of an engine problem.
The plane taxied to the gate.
The FAA is now investigating.


Before Change
elif 0 < num_avail_gpu < self.num_worker:
self.logger.warning("only %d out of %d GPU(s) is available/free, but "-num_worker=%d"" %
(num_avail_gpu, num_all_gpu, self.num_worker))
self.logger.warning("multiple workers will be allocated to one GPU, "
"may not scale well and may raise out-of-memory")
run_on_gpu = True
else:
self.logger.warning("no GPU available, fall back to CPU")
After Change
elif 0 < num_avail_gpu < self.num_worker:
self.logger.warning("only %d out of %d GPU(s) is available/free, but "-num_worker=%d"" %
(num_avail_gpu, num_all_gpu, self.num_worker))
if not self.args.device_map:
self.logger.warning("multiple workers will be allocated to one GPU, "
"may not scale well and may raise out-of-memory")
else:
self.logger.warning("workers will be allocated based on "-device_map=%s", "
"may not scale well and may raise out-of-memory" % self.args.device_map)
run_on_gpu = True
else:
self.logger.warning("no GPU available, fall back to CPU")


FitRogue
steps:
activity rolls.
hours sleeping:
energy rolls.
minutes exercising:
exercise rolls.
:
meditation rolls.
Remaining rolls: Steps:
Sleep:
Exercise:
Meditation:
Current roll:
Item 1
Item 2
Item 3
Equipped items:
Weapon:
Helmet:
Chest:
Pet:


Login Page
Email address
We'll never share your email with anyone else.
Password
Customer
Business Owner
Login
Create Account


base class of the Constraint Handler plugin More...
Go to the source code of this file.
Classes | |
| class | Conshdlr |
Functions | |
| def | consfree (self) |
| def | consinit (self, constraints) |
| def | consexit (self, constraints) |
| def | consinitpre (self, constraints) |
| def | consexitpre (self, constraints) |
| def | consinitsol (self, constraints) |
| def | consexitsol (self, constraints, restart) |
| def | consdelete (self, constraint) |
| def | constrans (self, sourceconstraint) |
| def | consinitlp (self, constraints) |
| def | conssepalp (self, constraints, nusefulconss) |
| def | conssepasol (self, constraints, nusefulconss, solution) |
| def | consenfolp (self, constraints, nusefulconss, solinfeasible) |
| def | consenforelax (self, solution, constraints, nusefulconss, solinfeasible) |
| def | consenfops (self, constraints, nusefulconss, solinfeasible, objinfeasible) |
| def | conscheck (self, constraints, solution, checkintegrality, checklprows, printreason, completely) |
| def | consprop (self, constraints, nusefulconss, nmarkedconss, proptiming) |
| def | conspresol (self, constraints, nrounds, presoltiming, nnewfixedvars, nnewaggrvars, nnewchgvartypes, nnewchgbds, nnewholes, nnewdelconss, nnewaddconss, nnewupgdconss, nnewchgcoefs, nnewchgsides, result_dict) |
| def | consresprop (self) |
| def | conslock (self, constraint, locktype, nlockspos, nlocksneg) |
| def | consactive (self, constraint) |
| def | consdeactive (self, constraint) |
| def | consenable (self, constraint) |
| def | consdisable (self, constraint) |
| def | consdelvars (self, constraints) |
| def | consprint (self, constraint) |
| def | conscopy (self) |
| def | consparse (self) |
| def | consgetvars (self, constraint) |
| def | consgetnvars (self, constraint) |
| def | consgetdivebdchgs (self) |
Variables | |
| conshdlrdata = SCIPconshdlrGetData(conshdlr) | |
| consdata = SCIPconsGetData(cons) | |
| PyConshdlr = getPyConshdlr(conshdlr) | |
| constraints | |
| PyCons = getPyCons(cons) | |
| PySourceCons = getPyCons(sourcecons) | |
| def | result_dict = PyConshdlr.constrans(PySourceCons) |
| def | PyTargetCons = result_dict.get("targetcons") |
| solution = Solution() | |
| sol | |
base class of the Constraint Handler plugin
Definition in file conshdlr.pxi.
| def pyscipopt.conshdlr.consfree | ( | self | ) |
calls destructor and frees memory of constraint handler
Definition at line 8 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consinit | ( | self, | |
| constraints | |||
| ) |
calls initialization method of constraint handler
Definition at line 12 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consexit | ( | self, | |
| constraints | |||
| ) |
calls exit method of constraint handler
Definition at line 16 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consinitpre | ( | self, | |
| constraints | |||
| ) |
informs constraint handler that the presolving process is being started
Definition at line 20 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consexitpre | ( | self, | |
| constraints | |||
| ) |
informs constraint handler that the presolving is finished
Definition at line 24 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consinitsol | ( | self, | |
| constraints | |||
| ) |
informs constraint handler that the branch and bound process is being started
Definition at line 28 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consexitsol | ( | self, | |
| constraints, | |||
| restart | |||
| ) |
informs constraint handler that the branch and bound process data is being freed
Definition at line 32 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consdelete | ( | self, | |
| constraint | |||
| ) |
sets method of constraint handler to free specific constraint data
Definition at line 36 of file conshdlr.pxi.
| def pyscipopt.conshdlr.constrans | ( | self, | |
| sourceconstraint | |||
| ) |
sets method of constraint handler to transform constraint data into data belonging to the transformed problem
Definition at line 40 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consinitlp | ( | self, | |
| constraints | |||
| ) |
calls LP initialization method of constraint handler to separate all initial active constraints
Definition at line 44 of file conshdlr.pxi.
| def pyscipopt.conshdlr.conssepalp | ( | self, | |
| constraints, | |||
| nusefulconss | |||
| ) |
calls separator method of constraint handler to separate LP solution
Definition at line 48 of file conshdlr.pxi.
| def pyscipopt.conshdlr.conssepasol | ( | self, | |
| constraints, | |||
| nusefulconss, | |||
| solution | |||
| ) |
calls separator method of constraint handler to separate given primal solution
Definition at line 52 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consenfolp | ( | self, | |
| constraints, | |||
| nusefulconss, | |||
| solinfeasible | |||
| ) |
calls enforcing method of constraint handler for LP solution for all constraints added
Definition at line 56 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consenforelax | ( | self, | |
| solution, | |||
| constraints, | |||
| nusefulconss, | |||
| solinfeasible | |||
| ) |
calls enforcing method of constraint handler for a relaxation solution for all constraints added
Definition at line 61 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consenfops | ( | self, | |
| constraints, | |||
| nusefulconss, | |||
| solinfeasible, | |||
| objinfeasible | |||
| ) |
calls enforcing method of constraint handler for pseudo solution for all constraints added
Definition at line 66 of file conshdlr.pxi.
| def pyscipopt.conshdlr.conscheck | ( | self, | |
| constraints, | |||
| solution, | |||
| checkintegrality, | |||
| checklprows, | |||
| printreason, | |||
| completely | |||
| ) |
calls feasibility check method of constraint handler
Definition at line 71 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consprop | ( | self, | |
| constraints, | |||
| nusefulconss, | |||
| nmarkedconss, | |||
| proptiming | |||
| ) |
calls propagation method of constraint handler
Definition at line 76 of file conshdlr.pxi.
| def pyscipopt.conshdlr.conspresol | ( | self, | |
| constraints, | |||
| nrounds, | |||
| presoltiming, | |||
| nnewfixedvars, | |||
| nnewaggrvars, | |||
| nnewchgvartypes, | |||
| nnewchgbds, | |||
| nnewholes, | |||
| nnewdelconss, | |||
| nnewaddconss, | |||
| nnewupgdconss, | |||
| nnewchgcoefs, | |||
| nnewchgsides, | |||
| result_dict | |||
| ) |
calls presolving method of constraint handler
Definition at line 82 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consresprop | ( | self | ) |
sets propagation conflict resolving method of constraint handler
Definition at line 86 of file conshdlr.pxi.
| def pyscipopt.conshdlr.conslock | ( | self, | |
| constraint, | |||
| locktype, | |||
| nlockspos, | |||
| nlocksneg | |||
| ) |
variable rounding lock method of constraint handler
Definition at line 90 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consactive | ( | self, | |
| constraint | |||
| ) |
sets activation notification method of constraint handler
Definition at line 95 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consdeactive | ( | self, | |
| constraint | |||
| ) |
sets deactivation notification method of constraint handler
Definition at line 99 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consenable | ( | self, | |
| constraint | |||
| ) |
sets enabling notification method of constraint handler
Definition at line 103 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consdisable | ( | self, | |
| constraint | |||
| ) |
sets disabling notification method of constraint handler
Definition at line 107 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consdelvars | ( | self, | |
| constraints | |||
| ) |
calls variable deletion method of constraint handler
Definition at line 111 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consprint | ( | self, | |
| constraint | |||
| ) |
sets constraint display method of constraint handler
Definition at line 115 of file conshdlr.pxi.
| def pyscipopt.conshdlr.conscopy | ( | self | ) |
sets copy method of both the constraint handler and each associated constraint
Definition at line 119 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consparse | ( | self | ) |
sets constraint parsing method of constraint handler
Definition at line 123 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consgetvars | ( | self, | |
| constraint | |||
| ) |
sets constraint variable getter method of constraint handler
Definition at line 127 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consgetnvars | ( | self, | |
| constraint | |||
| ) |
sets constraint variable number getter method of constraint handler
Definition at line 131 of file conshdlr.pxi.
| def pyscipopt.conshdlr.consgetdivebdchgs | ( | self | ) |
calls diving solution enforcement callback of constraint handler, if it exists
Definition at line 135 of file conshdlr.pxi.


A library for handling errors with types and without exceptions - even asynchronous ones.
result-async
focuses on making a few things easier in JavaScript/TypeScript:
npm i result-async pipeout --save
# or
yarn add result-async pipeout
Then import the functions and (in TypeScript) types you need:
import { ok, okThen, okChainAsync, Result } from "result-async";
import { pipeA } from "pipeout";
result-async
is designed to work with a pipe
function. Ramda has pipe and pipeP functions, and Lodash has flow. But pipe
and flow
don't handle promise-returning functions, and pipeP
won't handle adding a non-promise function to the middle of your pipeline.
For a typesafe pipe
that handles async functions, you can use this author's pipeout. pipeout.pipeA
works like a normal pipe
, but every function you add to the pipeline is partially applied, and you use .value
to get the final result. That turns
c(await b(a(await x)));
into
pipe(x)(a)(b)(c).value;
It has a few other varients of pipe
, you can see the pipeout docs for more information.
If you want to use pipeout, you just have to install and import it.
npm i result-async pipeout --save
# or
yarn add result-async pipeout
import { pipeA } from "pipeout";
Here are some example of what working with result-async
looks like.
For more examples, and complete documentation, see
the docs.
result-async
helps you handle errors in a controlled, readable, and typesafe way,
using techniques from functional programming.
Here's an example of the sort of data-processing pipelines you can build:
async function countAllComments(postsCache: PostsCache): Promise<number> {
// prettier-ignore
return pipeA
(promiseToResult(postsCache.getCache()))
(errorDo(console.error))
(errorRescueAsync(fetchPosts))
(okDo(logPostCount))
(okDoAsync(postsCache.updateCache))
(okThen(R.map(fetchCommentsForPost)))
(okChainAsync(allOkAsync))
(okThen(R.map(comments => comments.length)))
(okThen(R.sum))
(okDo(logCommentTotal))
(okOrThrow)
.value;
}
The basic premise is functions that start with ok
will only operate on successful data,
and pass on error messages.
Functions that start with error
will only operate on error messages, and either change
or try to rescue them back into successes.
Prefixing the function names makes it easy to scan a pipeline and find the error handling code.
Other functions transform other data structures to Result
s (like promiseToResult
),
or handle collections of Result
s (like allOkAsync
).
Functions ending in async
will return a Promise
that resolves to a Result
. This helps
TypeScript track types, and helps developers differentiate between pure and impure functions.
See ./src/full-example for a full working example.
To run the example, run:
yarn ts-node -O '{"module": "commonjs"}' src/full-example.ts
import { isError } from "result-async";
const result = await tryToGetAListOfComments("my-blog-post");
const comments = isOk(result) ? result.ok : [];
import { ok, error } from "result-async";
return isAllWell() ? ok("all is well") : error("all is lost");
import { fetchUser, errorDo, errorRescueAsync } from "result-async";
import { pipeA } from "pipeout";
// prettier-ignore
pipeA
(fetchUser())
(errorDo(sendErrorToLoggingSystem))
(errorRescueAsync(logOutUser))
);
import { resultify, errorThen, okChainAsync } from "result-async";
import { pipeA } from "pipeout";
const fetchResult = resultify(fetch);
// prettier-ignore
pipeA
(someUrl)
(fetchResult)
(errorThen(transformError))
(okChainAsync(anotherAsyncFunction))
import { okChain, errorReplace } from "result-async";
import { pipeA } from "pipeout";
function doStuff(): Promise<SomeData> {
// prettier-ignore
return pipeA(
(someResultFunction)
(okChain(validateData))
(errorReplace("something went wrong"))
(okOrThrow)
}
result-async
is written in TypeScript, and it's built to help write typesafe error handling code. But it works great with vanilla JavaScript too!
One of the big benefits of ResultP
, a Promise
of a Result
, is that Promise
s don't have type information about their error case. But many promises have predictable error types. So, you can have your asynchronous functions return a ResultP
to declare those errors types in the type system.
Also ResultP
s should always resolve and never be rejected. This means no more try/catch
blocks, even when using async/await
.
The important types are:
type Result<OkData, ErrorMessage> = OkResult<Data> | ErrorResult<Message>;
type ResultP<OkData, ErrorMessage> = Promise<Result<OkData, ErrorMessage>>;
So a Result
could be either Ok or an Error - and either way, the payload is strongly typed.
isOk(result)
and
isError(result)
are both typeguards, so if isOk
returns true, typescript will know the Result is actually an OkResult:
function(result: Result<number, string>) {
// Type error: ok could be undefined.
result.ok + 1
if (isOk(result)) {
// No type error, ok is definitely defined.
result.ok + 1
}
}
If you're using a library like Jest for testing, you can generally follow your testing library's advice for testing asynchronous code.
Unlike with standard promises, you don't have to worry about errored ResultP
s throwing errors.
You'll probably want to test if your calls succeed or fail. If you want to check both the result and payload, try matching against another result
:
import { ok } from "result-async";
it("should be fine", async () => {
expect(await myResultyFunction()).toEqual(ok("all is well"));
});
If you only want to check if a call succeeded for failed, you can just check for the presence of "ok" or "error".
it("should be fine", async () => {
expect(await myResultyFunction()).toHaveProperty("ok");
});
For more complicated checks you can use okOrThrow/Error
to throw an error if the
result isn't what you expect, and otherwise extract the payload for further testing. For example:
expect(okOrThrow(await myResultyFunction())).toContain("is well");
async
/await
has been a huge win for avoiding the dreaded Pyramid of doom in JavaScript.
These bad days are behind us forever:
someFunction(data, (err, data) => {
if (err) throw err;
secondFunction(data, (err, data) => {
if (err) throw err;
thirdFunction(data, (err, data) => {
if (err) throw err;
doStuff(data);
});
});
});
When we can now use async/await
to do this:
try {
data = await someFunction(data);
data = await secondFunction(data);
data = await thirdFunction(data);
} catch (e) {
doSomethingWithError(e);
}
Much better. But still, errors are treated really differently than normal data. And in TypeScript, errors are also untyped. For a genuine exception that's fine, but there are a lot of cases where I expect a call to sometimes fail (for instance, a request to an endpoint that could 404). In those cases, having to rely on catching errors can feel a little heavyweight.
The functional programming world has an answer for this - the Result type. It's in Haskell, Ocaml, Elixir, and more. The idea is to have a function that could fail return a response that's marked as either a Success or a Failure. Then you can react to that result status, pass it along, ignore it, or whatever - just like any other data structure.
In many FP languages, we have pattern matching to make this easier:
case some_async_function() do
{:ok, data} -> do_something(data)
{:error, msg} -> do_something_else(msg)
end
We don't have that in JavaScript, but result-async
tries to make it easy to create and handle Result
s - even when they come from async functions:
import { either } from "result-async";
either(
await someAsyncFunction(),
data => doSomething(data),
msg => doSomethingElse(msg)
);
If you come from a Haskell-y background, you might be saying, "hey, Result
is just an Either
type, and okThen
is just map
".  And if you're looking for more abstract functional programming, you may be interested in libraries like Sanctuary or Folktalk, which provide a Fantasy-Land compatible Either and Result types, respectively. Fluture is also a great tool for Fantasy-Land compatible asynchronous programming.
But if your team isn't ready that all that, think of Result-Async
like a gateway drug for full ADT-style programming. It lets you write composable, functional programs, but with functions names that are trying to be friendlier to people who don't think in monands.
yarn docs
npm version patch | minor | major
npm publish
Generated using TypeDoc


|
NeuralSharp
1.0
NeuralSharp is a FOSS C# library for neural networks.
|
Represents a learner which, given the same inputs, always returns the same output. More...
Public Member Functions | |
| delegate void | LearningParametersFunction (int batchSize, int batchIndex, int batchesCount, int epoch, out float learningRate, out float momentum) |
| Represents a function which gets learning parameters at each step. More... | |
| abstract void | Feed (TIn input, TOut output, bool learning=false) |
| Feeds the learner forward. More... | |
| abstract void | BackPropagate (TOut outputError, bool learning=true) |
| Backpropagates the given error trough the learner. More... | |
| abstract void | BackPropagate (TOut outputError, TIn inputError, bool learning) |
| Backpropagates the given error trough the learner. More... | |
| abstract void | UpdateWeights (float rate, float momentum=0.0F) |
| Updates the weights of the learner. More... | |
| abstract float | GetError (TOut output, TOut expectedOutput, TOut error, TErrFunc errorFunction) |
| Gets the error of the learner, given its actual output and expected output. More... | |
| abstract float | FeedAndGetError (TIn input, TOut expectedOutput, TOut error, TErrFunc errorFunction, bool learning) |
| Feeds the learner forward and gets its error, given the expected output. More... | |
| virtual float | Learn (IEnumerable< TIn > inputs, IEnumerable< TOut > outputs, float maxError, int maxSteps, int batchSize, TErrFunc errorFunction, LearningParametersFunction learningParametersFunction=null) |
| Learns using the given input and output pairs. More... | |
Protected Member Functions | |
| abstract TOut | NewError () |
| Creates an object which can be used as output error. More... | |
| virtual void | DefaultLearningParameters (int batchSize, int batchIndex, int batchesCount, int epoch, out float learningRate, out float momentum) |
| Gets the best parameters during training. More... | |
Represents a learner which, given the same inputs, always returns the same output.
| TIn | The input type of the learner. |
| TOut | The output type of the learner. |
| TErrFunc | The error function type of the learner. |
| TIn | : | class | |
| TOut | : | class | |
| TErrFunc | : | IError<TOut> |
|
pure virtual |
Backpropagates the given error trough the learner.
| outputError | The output error to be backpropagated. |
| learning | Whether the learner is being used in a training session. |
|
pure virtual |
Backpropagates the given error trough the learner.
| outputError | The output error to be backpropagated. |
| inputError | The object to be written the input error into. |
| learning | Whether the learner is being used in a training session. |
|
protectedvirtual |
Gets the best parameters during training.
| batchSize | The batch size. |
| batchIndex | The batch index. |
| batchesCount | The amount of batches. |
| epoch | The epoch index. |
| learningRate | The learning rate. |
| momentum | The momentum. |
|
pure virtual |
Feeds the learner forward.
| input | The object to be read the input from. |
| output | The object to be written the output into. |
| learning | Whether the learner is being used in a training session. |
|
pure virtual |
Feeds the learner forward and gets its error, given the expected output.
| input | The object to be read the input from. |
| expectedOutput | The expected output of the learner. |
| error | The object to be written the error into. |
| errorFunction | The error function to be used. |
| learning | Whether the learner is being used in a training session. |
|
pure virtual |
Gets the error of the learner, given its actual output and expected output.
| output | The actual output of the learner. |
| expectedOutput | The expected output of the learner. |
| error | The object to be written the output error into. |
| errorFunction | The error function to be used. |
|
virtual |
Learns using the given input and output pairs.
| inputs | The inputs to be learned from. |
| outputs | The outputs to be learned from. |
| maxError | The maximum error to be aimed for. |
| maxSteps | The maximum amount of steps. |
| batchSize | The batch size to be used. |
| errorFunction | The error function to be used. |
| learningParametersFunction | A function getting the learning parameters at each step. |
| delegate void NeuralSharp.ForwardLearner< TIn, TOut, TErrFunc >.LearningParametersFunction | ( | int | batchSize, |
| int | batchIndex, | ||
| int | batchesCount, | ||
| int | epoch, | ||
| out float | learningRate, | ||
| out float | momentum | ||
| ) |
Represents a function which gets learning parameters at each step.
| batchSize | The batch size. |
| batchIndex | The batch index. |
| batchesCount | The batches count. |
| epoch | The epoch. |
| learningRate | The learning rate. |
| momentum | The momentum to be used. |
|
protectedpure virtual |
Creates an object which can be used as output error.
Implemented in NeuralSharp.Convolutional.ConvolutionalNN.
|
pure virtual |
Updates the weights of the learner.
| rate | The learning rate to be used. |
| momentum | The momentum to be used. |
Implemented in NeuralSharp.Convolutional.ConvolutionalNN, NeuralSharp.Sequential< TData, TLayer, TErrFunc >, and NeuralSharp.Autoencoder< TData, TErrFunc >.


The Sweat Shop
问题描述 :
Many people spend thier lives in sweat shop in China. The boss of one of the famous sweat shop, GXX, is considering about the employment plan of her company.
He already knows that in the next N days, how many worker are needed for this day’s work, a[i].  If a worker spend a day on work in his company, GXX must pay z yuan for the wages per day.
GXX has no work before the first day and he decide to fire all the workers after these N days. Now comes to the question, how much he will pay on the employment plan in minimum.
He already knows that in the next N days, how many worker are needed for this day’s work, a[i].  If a worker spend a day on work in his company, GXX must pay z yuan for the wages per day.
GXX has no work before the first day and he decide to fire all the workers after these N days. Now comes to the question, how much he will pay on the employment plan in minimum.
输入:
The first line contains only one integer T, denoting the number of test cases.
For each test cases, the first line contains only one integer N, denoting the number of days. (1 <= N <= 100000)
The next line contains three integers, x, y and z, denoting the amount of spend on recruit, fire a worker, and the daily salary of a worker. (1 <= x,y,z <= 100000)
The third line contains N integers, a[i], denoting the minimum number of workers needed for the i-th day. (1 <= a[i] <= 100000)
For each test cases, the first line contains only one integer N, denoting the number of days. (1 <= N <= 100000)
The next line contains three integers, x, y and z, denoting the amount of spend on recruit, fire a worker, and the daily salary of a worker. (1 <= x,y,z <= 100000)
The third line contains N integers, a[i], denoting the minimum number of workers needed for the i-th day. (1 <= a[i] <= 100000)
输出:
The first line contains only one integer T, denoting the number of test cases.
For each test cases, the first line contains only one integer N, denoting the number of days. (1 <= N <= 100000)
The next line contains three integers, x, y and z, denoting the amount of spend on recruit, fire a worker, and the daily salary of a worker. (1 <= x,y,z <= 100000)
The third line contains N integers, a[i], denoting the minimum number of workers needed for the i-th day. (1 <= a[i] <= 100000)
For each test cases, the first line contains only one integer N, denoting the number of days. (1 <= N <= 100000)
The next line contains three integers, x, y and z, denoting the amount of spend on recruit, fire a worker, and the daily salary of a worker. (1 <= x,y,z <= 100000)
The third line contains N integers, a[i], denoting the minimum number of workers needed for the i-th day. (1 <= a[i] <= 100000)
样例输入:
1 3 10 10 1 2 1 2
样例输出:
46
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #define N 100010 int n; __int64 a[N], x, y, z; int q[N], ed; __int64 min(__int64 a,__int64 b ) { return a<b?a:b; } void solve() { __int64 res = a[0] * x + a[n - 1] * y; for (int i = 0; i < n; ++i) { res += a[i] * z; if(i) { if (a[i - 1] > a[i]) res += (a[i - 1] - a[i]) * y; else res += (a[i] - a[i - 1]) * x; } } ed = 0; q[ed++] = 0; for (int i = 1; i < n; ++i) { if (a[q[ed - 1]] >= a[i]) q[ed++] = i; else { while (ed > 1 && a[q[ed - 1]] < a[i]) { --ed; /* t是解雇工人的数目 ， tmp---是留着这个工人省钱还是解雇这个工人省的钱 ？？ */ __int64 tmp, t = min(a[i], a[q[ed - 1]]) - a[q[ed]]; if ((tmp = (x + y - (i - q[ed - 1] - 1) * z) * t) > 0) { res -= tmp; //printf("\n........\nq[ed]=%d l=%d r=%d tmp=%d\n",q[ed],q[ed - 1],i,tmp); } } if (a[q[ed - 1]] <= a[i]) --ed; q[ed++] = i; } } printf("%I64d\n", res); } int main() { freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); int cas; scanf("%d", &cas); while (cas--) { scanf("%d", &n); scanf("%I64d%I64d%I64d", &x, &y, &z); for (int i = 0; i < n; ++i) { scanf("%I64d", &a[i]); } solve(); } return 0; }
(adsbygoogle = window.adsbygoogle || []).push({});
“有种你下来！”
最长回文子串可以使用manacher算法，将时间复杂度降到O(n)。
能告诉我为什么对于每一个m，cnt的值不用更新吗?这儿我想不通啊，谢谢
学习了。找到这题
1234百位上出现的次数应该是200吧。
看来学好代数很重要啊
我没看懂题目
2
5 6 -1 5 4 -7
7 0 6 -1 1 -6 7 -5
我觉得第一个应该是5 6 -1 5 4 输出是19 5 4
第二个是7 0 6 -1 1 -6 7输出是14 7 7
不知道题目例子是怎么得出来的
真心不错，力顶作者
整理的很好，学习了
第二个方法挺不错。NewHead代表新的头节点，通过递归找到最后一个节点之后，就把这个节点赋给NewHead，然后一直返回返回，中途这个值是没有变化的，一边返回一边把相应的指针方向颠倒，最后结束时返回新的头节点到主函数。
哎，path[0]应该是从零开始吧，为什么是赋值1呢？
有没有C++语言的代码？
说的就是无向图啊，有向图的算法也是类似的
第一题还是比较考验智商~
可以参考算法导论中的时间戳。就是结束访问时间，最后结束的顶点肯定是入度为0的顶点，因为DFS要回溯


I opened the First Door which held a GOAT. Now if you want to switch you can choose the Last Door Or you can keep your first choice and open the Second Door.


This set of examples contains short, complete applications
of twisted.web
. For subjects not covered
here, see the Twisted Web
tutorial and the API documentation.
- Serving static content from a directory
- Generating a page dynamically
- Static URL dispatch
- Dynamic URL dispatch
- Error handling
- Custom response codes
- Handling POSTs
- rpy scripts (or, how to save yourself some typing)
- Asynchronous responses
- Asynchronous responses (via Deferred)
- Interrupted responses
- Logging errors
- WSGIs
- HTTP authentication
- Session basics
- Storing objects in the session
- Session endings


Website TemplatesStep by Step
Instructions and Video Tutorials
We want to offer all of our customers brand new section named as "Web Design Help", where you can see video tutorials and step by step instrutions about all of our templates. Using this, you can guess how to work on our web templates.
Everyday we are adding new video tutorials, that you can see here: website templates step by step instructions and video tutorials
You can download free
web templatesfor your business
If you have not Flash or web design knowledge, for our customers we have free website templates section where you can download our: ( free flash templates, free html templates, free website templates and free osCommerce templates ) - and can learn how should make some customization (modification).
Any our template includes
6 month Free Web Hosting
MIND Dear Customers !!! From now on, if you buy any templates from our store www.cbmcard.com you will get FREE web hosting for 6 months. Also can check and register your domain name here too www.m9host.com


aaaaaaaaaaaa
aaaaaaaaaaaa
默认的效果
切换的效果
Copyright 2011.
All pages and graphics on this web site are the property of W3School.
1
2
3


Please grade your recall of this card.
Manabi uses the grades you give each card to determine the best time for you to review that card next in the future.
Wrong means you couldn't recall the answer, or you recalled it incorrectly. It could also mean that it's a new card you haven't learned yet. The card will be shown again very soon.
Hard means you got the answer right, but it was a struggle. Manabi learns from this that it should have shown you that card much earlier than it did, since you were very close to forgetting it.
Good means you recalled the answer without much trouble. This is the ideal response — Manabi is working effectively if this is your response most of the time.
 Manabi learns that it should have waited much longer before showing you this card.
Please grade honestly — don't be afraid to give it a low grade if you're at all unsure of yourself. Especially with brand new cards, it's normal to have to mark them Wrong several times before you start to learn them. Manabi takes your entire review history for each card into account, so it will go easy on you if it knows you're only getting a card wrong because it's still pretty new, or because you waited too long to review it.
Hint! Press 1-4 on your keyboard to grade, instead of clicking the buttons. (1=Wrong, 2=Hard, 3=Good, 4=Too Easy). Press Space to show the answer.


Analysing data holds a huge importance in the present and future world. With petabytes of data circulating, the complexity has also been gradually increasing. The objective of our project is implement cache functions. Objective and Goal: The objective of our project is to implement cache functions and thus make a faculty search portal for our university using the same.
Main Memory: Refers to physical memory that is internal to the computer. The word main is used to distinguish it from external mass storage devices such as disk drives. Another term for main memory
is RAM.
The computer can manipulate only data that is in main memory. Therefore, every program you execute and every file you access must be copied from a storage device into main memory. The amount of main memory on a computer is crucial because it determines how many programs can be executed at
one time and how much data can be readily available to a program.
Cache: Cache memory is a small-sized type of volatile computer memory that provides high-speed data access to a processor and stores frequently used computer programs, applications and data. It is the fastest memory in a computer, and is typically integrated onto the motherboard and directly embedded in the processor or main random-access memory (RAM).
Cache memory provides faster data storage and access by storing instances of programs and data routinely accessed by the processor. Thus, when a processor requests data that already has an instance in the cache memory, it does not need to go to the main memory or the hard disk to fetch the data.
Cache memory can be primary or secondary cache memory, with primary cache memory directly integrated into (or closest to) the processor. In addition to hardware-based cache, cache memory also can be a disk cache, where a reserved portion on a disk stores and provides access to frequently
accessed data/applications from the disk.
- Scrape Data:-We will scrape the data from the respective webpage using Cheerio and store the entire data as an object.
- Store Data:-We will then store the scrape data in the required format in the database (online and offline)
- Cache Implementation:-Cache contained and number of searches will keep on getting updated as and when new searches are encountered.
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', {});
});
module.exports = router;
var express = require('express');
var db = require('../config_db')
var router = express.Router();
const cacheSize = 3;
;
Stay up to date on the development of Bootstrap and reach out to the community with these helpful resources.
- Shreya Deep Anand
- Vinit Shahdeo
Thank you for visiting this!


Exit
Admin
Create Doctor
First name:
Last name:
Major:
Birth Year:
Gender:
Add
Create Nurse
First name:
Last name:
Major:
Gender:
Add
Create Patient
First name:
Last name:
Age:
Birth Year:
Gender:
Address:
Add
Create Relative
First name:
Last name:
Age:
Add


9.6. SparkSQL Functions¶
The following is a list of the spatial SparkSQL user-defined functions defined by the geomesa-spark-sql
module.
- Geometry Constructors
- st_box2DFromGeoHash
- st_geomFromGeoHash
- st_geomFromText
- st_geomFromWKB
- st_geomFromWKT
- st_geometryFromText
- st_lineFromText
- st_mLineFromText
- st_mPointFromText
- st_mPolyFromText
- st_makeBBOX
- st_makeBox2D
- st_makeLine
- st_makePoint
- st_makePointM
- st_makePolygon
- st_point
- st_pointFromGeoHash
- st_pointFromText
- st_pointFromWKB
- st_polygon
- st_polygonFromText
- Geometry Accessors
- Geometry Cast
- Geometry Editors
- Geometry Outputs
- Spatial Relationships
- Geometry Processing
9.6.1. Geometry Constructors¶
<IP_ADDRESS>. st_box2DFromGeoHash¶
Geometry st_box2DFromGeoHash(String geohash, Int prec)
Alias of st_geomFromGeoHash.
<IP_ADDRESS>. st_geomFromGeoHash¶
Geometry st_geomFromGeoHash(String geohash, Int prec)
Returns the Geometry
of the bounding box corresponding to the Geohash string geohash (base-32 encoded) with
a precision of prec bits. See Geohash for more information on GeoHashes.
<IP_ADDRESS>. st_geomFromWKB¶
Geometry st_geomFromWKB(Array[Byte] wkb)
Creates a Geometry
from the given Well-Known Binary representation (WKB).
<IP_ADDRESS>. st_geomFromWKT¶
Geometry st_geomFromWKT(String wkt)
Creates a Geometry from the given Well-Known Text representation (WKT).
<IP_ADDRESS>. st_lineFromText¶
LineString st_lineFromText(String wkt)
Creates a LineString
from the given WKT representation.
<IP_ADDRESS>. st_mLineFromText¶
MultiLineString st_mLineFromText(String wkt)
Creates a MultiLineString
corresponding to the given WKT representation.
<IP_ADDRESS>. st_mPointFromText¶
MultiPoint st_mPointFromText(String wkt)
Creates a MultiPoint
corresponding to the given WKT representation.
<IP_ADDRESS>. st_mPolyFromText¶
MultiPolygon st_mPolyFromText(String wkt)
Creates a MultiPolygon
corresponding to the given WKT representation.
<IP_ADDRESS>. st_makeBBOX¶
Geometry st_makeBBOX(Double lowerX, Double lowerY, Double upperX, Double upperY)
Creates a Geometry
representing a bounding box with the given boundaries.
<IP_ADDRESS>. st_makeBox2D¶
Geometry st_makeBox2D(Point lowerLeft, Point upperRight)
Creates a Geometry
representing a bounding box defined by the given Point
s.
<IP_ADDRESS>. st_makeLine¶
LineString st_makeLine(Seq[Point] points)
Creates a LineString
using the given sequence of vertices in points.
<IP_ADDRESS>. st_makePoint¶
Point st_makePoint(Double x, Double y)
Creates a Point
with an x and y coordinate.
<IP_ADDRESS>. st_makePointM¶
Point st_makePointM(Double x, Double y, Double m)
Creates a Point
with an x, y, and m coordinate.
<IP_ADDRESS>. st_makePolygon¶
Polygon st_makePolygon(LineString shell)
Creates a Polygon
formed by the given LineString
shell, which must be closed.
<IP_ADDRESS>. st_point¶
Point st_point(Double x, Double y)
Returns a Point
with the given coordinate values. This is an OGC alias for st_makePoint.
<IP_ADDRESS>. st_pointFromGeoHash¶
Point st_pointFromGeoHash(String geohash, Int prec)
Return the Point
at the geometric center of the bounding box defined by the Geohash string geohash
(base-32 encoded) with a precision of prec bits. See Geohash for more information on Geohashes.
<IP_ADDRESS>. st_pointFromText¶
Point st_pointFromText(String wkt)
Creates a Point
corresponding to the given WKT representation.
<IP_ADDRESS>. st_pointFromWKB¶
Point st_pointFromWKB(Array[Byte] wkb)
Creates a Point
corresponding to the given WKB representation.
<IP_ADDRESS>. st_polygon¶
Polygon st_polygon(LineString shell)
Creates a Polygon
formed by the given LineString
shell, which must be closed.
<IP_ADDRESS>. st_polygonFromText¶
Polygon st_polygonFromText(String wkt)
Creates a Polygon
corresponding to the given WKT representation.
9.6.2. Geometry Accessors¶
<IP_ADDRESS>. st_boundary¶
Geometry st_boundary(Geometry geom)
Returns the boundary, or an empty geometry of appropriate dimension, if geom is empty.
<IP_ADDRESS>. st_coordDim¶
Int st_coordDim(Geometry geom)
Returns the number of dimensions of the coordinates of Geometry
geom.
<IP_ADDRESS>. st_dimension¶
Int st_dimension(Geometry geom)
Returns the inherent number of dimensions of this Geometry
object, which must be less than or equal to the
coordinate dimension.
<IP_ADDRESS>. st_envelope¶
Geometry st_envelope(Geometry geom)
Returns a Geometry
representing the bounding box of geom.
<IP_ADDRESS>. st_exteriorRing¶
LineString st_exteriorRing(Geometry geom)
Returns a LineString
representing the exterior ring of the geometry; returns null if the Geometry
is not
a Polygon
.
<IP_ADDRESS>. st_geometryN¶
Int st_geometryN(Geometry geom, Int n)
Returns the n-th Geometry
(1-based index) of geom if the Geometry
is a GeometryCollection
, or
geom if it is not.
<IP_ADDRESS>. st_interiorRingN¶
Int st_interiorRingN(Geometry geom, Int n)
Returns the n-th interior LineString
ring of the Polygon
geom. Returns null if the geometry is not
a Polygon
or the given n is out of range.
<IP_ADDRESS>. st_isClosed¶
Boolean st_isClosed(Geometry geom)
Returns true if geom is a LineString
or MultiLineString
and its start and end points are coincident.
Returns true for all other Geometry
types.
<IP_ADDRESS>. st_isCollection¶
Boolean st_isCollection(Geometry geom)
Returns true if geom is a GeometryCollection
.
<IP_ADDRESS>. st_isRing¶
Boolean st_isRing(Geometry geom)
Returns true if geom is a LineString
or a MultiLineString
and is both closed and simple.
<IP_ADDRESS>. st_isSimple¶
Boolean st_isSimple(Geometry geom)
Returns true if geom has no anomalous geometric points, such as self intersection or self tangency.
<IP_ADDRESS>. st_isValid¶
Boolean st_isValid(Geometry geom)
Returns true if the Geometry
is topologically valid according to the OGC SFS specification.
<IP_ADDRESS>. st_numGeometries¶
Int st_numGeometries(Geometry geom)
If geom is a GeometryCollection
, returns the number of geometries. For single geometries, returns 1,
<IP_ADDRESS>. st_numPoints¶
Int st_numPoints(Geometry geom)
Returns the number of vertices in Geometry
geom.
<IP_ADDRESS>. st_pointN¶
Point st_pointN(Geometry geom, Int n)
If geom is a LineString
, returns the n-th vertex of geom as a Point. Negative values are counted
backwards from the end of the LineString
. Returns null if geom is not a LineString
.
<IP_ADDRESS>. st_x¶
Float st_X(Geometry geom)
If geom is a Point
, return the X coordinate of that point.
<IP_ADDRESS>. st_y¶
Float st_y(Geometry geom)
If geom is a Point
, return the Y coordinate of that point.
9.6.3. Geometry Cast¶
<IP_ADDRESS>. st_castToLineString¶
LineString st_castToLineString(Geometry g)
Casts Geometry
g to a LineString
.
<IP_ADDRESS>. st_byteArray¶
Array[Byte] st_byteArray(String s)
Encodes string s into an array of bytes using the UTF-8 charset.
9.6.4. Geometry Editors¶
<IP_ADDRESS>. st_translate¶
Geometry st_translate(Geometry geom, Double deltaX, Double deltaY)
Returns the Geometry
produced when geom is translated by deltaX and deltaY.
9.6.5. Geometry Outputs¶
<IP_ADDRESS>. st_asBinary¶
Array[Byte] st_asBinary(Geometry geom)
Returns Geometry
geom in WKB representation.
<IP_ADDRESS>. st_asGeoJSON¶
String st_asGeoJSON(Geometry geom)
Returns Geometry
geom in GeoJSON representation.
<IP_ADDRESS>. st_asLatLonText¶
String st_asLatLonText(Point p)
Returns a String
describing the latitude and longitude of Point
p in degrees, minutes, and seconds.
(This presumes that the units of the coordinates of p are latitude and longitude.)
<IP_ADDRESS>. st_geoHash¶
String st_geoHash(Geometry geom, Int prec)
Returns the Geohash (in base-32 representation) of an interior point of Geometry geom. See Geohash for more information on Geohashes.
9.6.6. Spatial Relationships¶
<IP_ADDRESS>. st_area¶
Double st_area(Geometry g)
If Geometry
g is areal, returns the area of its surface in square units of the coordinate reference system
(for example, degrees^2 for EPSG:4326). Returns 0.0 for non-areal geometries (e.g. Point
s, non-closed
LineString
s, etc.).
<IP_ADDRESS>. st_closestPoint¶
Point st_closestPoint(Geometry a, Geometry b)
Returns the Point
on a that is closest to b. This is the first point of the shortest line.
<IP_ADDRESS>. st_contains¶
Boolean st_contains(Geometry a, Geometry b)
Returns true if and only if no points of b lie in the exterior of a, and at least one point of the interior of b lies in the interior of a.
<IP_ADDRESS>. st_covers¶
Boolean st_covers(Geometry a, Geometry b)
Returns true if no point in Geometry
b is outside Geometry
a.
<IP_ADDRESS>. st_crosses¶
Boolean st_crosses(Geometry a, Geometry b)
Returns true if the supplied geometries have some, but not all, interior points in common.
<IP_ADDRESS>. st_disjoint¶
Boolean st_disjoint(Geometry a, Geometry b)
Returns true if the geometries do not “spatially intersect”; i.e., they do not share any space together. Equivalent
to NOT st_intersects(a, b)
.
<IP_ADDRESS>. st_distance¶
Double st_distance(Geometry a, Geometry b)
Returns the 2D Cartesian distance between the two geometries in units of the coordinate reference system (e.g. degrees for EPSG:4236).
<IP_ADDRESS>. st_distanceSphere¶
Double st_distanceSphere(Geometry a, Geometry b)
Approximates the minimum distance between two longitude/latitude geometries assuming a spherical earth.
<IP_ADDRESS>. st_distanceSpheroid¶
Double st_distanceSpheroid(Geometry a, Geometry b)
Returns the minimum distance between two longitude/latitude geometries assuming the WGS84 spheroid.
<IP_ADDRESS>. st_equals¶
Boolean st_equals(Geometry a, Geometry b)
Returns true if the given Geometries represent the same logical Geometry. Directionality is ignored.
<IP_ADDRESS>. st_intersects¶
Boolean st_intersects(Geometry a, Geometry b)
Returns true if the geometries spatially intersect in 2D (i.e. share any portion of space). Equivalent to
NOT st_disjoint(a, b)
.
<IP_ADDRESS>. st_length¶
Double st_length(Geometry geom)
Returns the 2D path length of linear geometries, or perimeter of areal geometries, in units of the the coordinate reference system (e.g. degrees for EPSG:4236). Returns 0.0 for other geometry types (e.g. Point).
<IP_ADDRESS>. st_lengthSphere¶
Double st_lengthSphere(LineString line)
Approximates the 2D path length of a LineString
geometry using a spherical earth model. The returned length is
in units of meters. The approximation is within 0.3% of st_lengthSpheroid and is computationally more efficient.
<IP_ADDRESS>. st_lengthSpheroid¶
Double st_lengthSpheroid(LineString line)
Calculates the 2D path length of a LineString
geometry defined with longitude/latitude coordinates on the WGS84
spheroid. The returned length is in units of meters.
<IP_ADDRESS>. st_overlaps¶
Boolean st_overlaps(Geometry a, Geometry b)
Returns true if the geometries have some but not all points in common, are of the same dimension, and the intersection of the interiors of the two geometries has the same dimension as the geometries themselves.
<IP_ADDRESS>. st_relate¶
String st_relate(Geometry a, Geometry b)
Returns the DE-9IM 3x3 interaction matrix pattern describing the dimensionality of the intersections between the interior, boundary and exterior of the two geometries.
<IP_ADDRESS>. st_relateBool¶
Boolean st_relateBool(Geometry a, Geometry b, String mask)
Returns true if the DE-9IM interaction matrix mask mask matches the interaction matrix pattern obtained from
st_relate(a, b)
.
<IP_ADDRESS>. st_touches¶
Boolean st_touches(Geometry a, Geometry b)
Returns true if the geometries have at least one point in common, but their interiors do not intersect.
<IP_ADDRESS>. st_within¶
Boolean st_within(Geometry a, Geometry b)
Returns true if geometry a is completely inside geometry b.
9.6.7. Geometry Processing¶
<IP_ADDRESS>. st_antimeridianSafeGeom¶
Geometry st_antimeridianSafeGeom(Geometry geom)
If geom spans the antimeridian, attempt to convert the geometry into an equivalent form that is
“antimeridian-safe” (i.e. the output geometry is covered by BOX(-180 -90, 180 90)
). In certain circumstances,
this method may fail, in which case the input geometry will be returned and an error will be logged.
<IP_ADDRESS>. st_bufferPoint¶
Geometry st_bufferPoint(Point p, Double buffer)
Returns a Geometry
covering all points within a given radius of Point
p, where radius is given in meters.
<IP_ADDRESS>. st_convexHull¶
Geometry st_convexHull(Geometry geom)
Aggregate function. The convex hull of a geometry represents the minimum convex geometry that encloses all geometries geom in the aggregated rows.


| DOSE: |
10 mg |
smoked |
5-MeO-DMT |
(powder / crystals) |
As I pause to reflect on what I experienced nearly 30 hours ago, the most profound moments of my life, I am filled with utter disbelief. My first true experience with 5-meo-dmt was nothing short of amazing, although such a word is painfully lacking.
I have experimented with various other hallucinogens, but that is irrelevant. None of them compare to the state of being that is 5-meo-dmt. Nothing could have prepared me, even when I thought I was ready. Previous hallucinogen experience was only a fake security blanket.
My friend, and fellow psychonaut - 'B', took it upon himself to order 200mg of this fruity-smelling tryptamine. Previous to this experience we had tried it once, with maybe 3mg. Although the effects were very present, they were not particularly convincing or unique. We knew we had to go further; the spirit of the tryptamine was calling us. We set a date a week later, to divulge in the so-called 'void'.
When the day came, B backed out. He had tried it alone two days earlier, in his room, and didn't wish to trip again so soon. I didn't blame him. I declared that if I was going to trip, I didn't want it to be in a house around insignificant material possessions. It had to be outdoors. We agreed to journey into a nearby forest.
I have always enjoyed forests, especially during the spring when life first emerges. They seem to be the only place untouched by humans. As we trekked deeper and deeper into the green abyss, we discovered that we couldn't escape human presence. Power lines plowed through a clearing and old cars dating back to the first half of the century were strewn about. We knew that tripping near those would only 'freak me out'. We went further and eventually found a nice big tree. It would be happy cradling me as I journeyed into unforeseen worlds. I sat down.
The weather was nice and the time was right. B eyed 7-13mg of 5meo into his well-built freebasing lightbulb - roughly the same dose he tried previously. The active dose is disturbingly small, around 1/100th of a gram. It still baffles me how these tiny crystals can so completely destroy everything I thought I knew about reality.
There was some residue left from previous trips, so there was a maximum of 20mg left inside the lightbulb. Anxiously, I applied the flame and vapor slowly crawled up the sides of the glass. Thinking I had vaporized everything, I took a hit. Immediately I was in a place reminiscent of my 'trip' a week earlier. My nervousness immediately disappeared. This wasn't so bad. I was content with this, but B saw a problem - I was still speaking.
'We're going for round two.' he announced as he applied the flame to the bottom of the lightbulb. Although skeptical that we would get any more vapor, I agreed that I had to go further. I was soon surprised as the glass was once again filling with whitish smoke.
I was not prepared for what was about to happen. Mere seconds after I took that second hit, I felt my brain accept this not-so-foreign substance. I was climbing, quickly! After four seconds, my breath got caught in my throat. My first reaction was something along the lines of 'hoooooly shit'.  The change of realities is like the flick of a primordial lightswitch.
And then, I was. I felt my face relax and go into an expression of awe. My body flooded itself with adreniline. My heart rate jumped but I could do nothing but sit and stare. I looked upwards and my vision fixated on the countless tree limbs that were gently blowing in the wind, gesturing to me. Immediately I was presented with the choice: to follow my bodily adreniline, fight this and freak out, or to accept this amazing state of being. I'll always lose the fight. I chose to relax and was comfortably projected into a reality of somewhat innate familiarity. I had only the moving trees, B, and my breathing for comfort.
After reading so much about the Void, I would have thought that I could recognize it. I couldn't. It was so alien that language cannot even bear to come to terms with it. Society makes up words like 'tripping' to try to standardize what its like to feel this, but language always falls short, especially among those who have never felt it themselves. You have to experience it yourself for that word to have meaning. This was not a visual trip; I saw relativly little movement. Applying a negative tone, one could describe it as being effectively brain-dead. Seeing it positively, one could describe it as being in heaven. Much like an analogy for life itself, it all depends on how you look at it.
I had no thoughts. Time lost any meaning. There was no 'me', I was simply an observer. Everything that I knew to be 'me' vanished in a split second, and I was left with nothing but the movement of the trees. Imagine perceiving non-existance. Was I on Earth? Was I dead? I feel as though I stumbled onto a divine truth - the meaning of life. This is what 'life' is about, this is what humans have been striving for since their very beginnings. This was humanity praying to the heavens; this was humanity performing sacred rituals. I could see the earliest human beings smoking toad venom. This is it, this is why humans do drugs. Beautiful.
A couple minutes later, as the trip subsided, 'I' re-entered myself and felt a sense of relief. 'What...just...happened?' I realized I could look elsewhere than the treetops. Looking down, I saw the forest's green stretch into infinity. I was still feeling a very nice 'afterglow' - everything was divine and I was happy. I felt a new reason to live. Sitting there for another half-hour was in order but B suggested we get up. My heart was still racing and my arms were so pins-and-needlely I could barely move them. Although I was still intoxicated, I agreed that moving might be a good idea to reduce the tension.
My coordination was impaired and walking was somewhat difficult. No sense of direction existed, so I just aimlessly wondered about. My senses needed to be recalibrated.
As we started heading back home, I tried to share with B what just happened to me. My emotions were rampant and I started getting choked up. It was too much to bear. Everything was mystical - life, the forest, that experience. We saw a large tree that had fallen down and new limbs were growing out of the stump - like an adult that had given its life for the children.
Looking back, I have no idea what to make of that experience. How should I live life knowing what I know? How did it make me a better person? How can I share this experience with others who have no idea how powerful 5-meo-dmt is? These are difficult questions that I will be reflecting on.
5-Methoxy-N,N-Dimethyltryptamine provided the most altered state of consciousness I have ever experienced. Its intensity completely overtook me and I let myself go. For some, I can easily see this drug being too overwhelming. Exercise caution.
This is a most sacred drug I have the utmost respect for. That said, I won't turn it into something recreational. For anything to be gained, I believe that my experiences should be far and few between.
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.