view release on metacpan or search on metacpan
lib/Graphics/Penplotter/GcodeXY.pm view on Meta::CPAN
}
else {
$d = ( ( $x2 - $x1 ) * $dx + ( $y2 - $y1 ) * $dy ) / $da;
if ( $d > 0 && $d < 1 ) {
# Simple collinear case, 1---2---3
# We can leave just two endpoints
return;
}
if ( $d <= 0 ) { $d = _calc_sq_distance( $x2, $y2, $x1, $y1 ) }
elsif ( $d >= 1 ) { $d = _calc_sq_distance( $x2, $y2, $x3, $y3 ) }
else {
lib/Graphics/Penplotter/GcodeXY.pm view on Meta::CPAN
$da1 = $x3 - $x1;
$da2 = $y3 - $y1;
$d3 = $k * ( $da1 * $dx + $da2 * $dy );
if ( $d2 > 0 && $d2 < 1 && $d3 > 0 && $d3 < 1 ) {
# Simple collinear case, 1---2---3---4
# We can leave just two endpoints
return;
}
if ( $d2 <= 0 ) { $d2 = _calc_sq_distance( $x2, $y2, $x1, $y1 ) }
elsif ( $d2 >= 1 ) { $d2 = _calc_sq_distance( $x2, $y2, $x4, $y4 ) }
else {
lib/Graphics/Penplotter/GcodeXY.pm view on Meta::CPAN
# optimize the plotting of hatch lines
# a good strategy will significantly reduce the plotter's work
sub _hoptimize { # TODO
my $self = shift;
# See vecsort.c for a general procedure:
# - compare start and end points of all remaining L segments to endpoint of current segment
# and locate the nearest one
# - if it's the endpoint that's closest, reverse the nearest segment
# - first add M segment to new list, then nearest segment, remove from the normal list
# - flush the sorted list, empty the normal list
return 1;
}
lib/Graphics/Penplotter/GcodeXY.pm view on Meta::CPAN
#
sub _warn {
my ( $self, $x, $y ) = @_;
my ( $x0clip, $y0clip, $x1clip, $y1clip, $info );
if ( !$self->{warn} ) { return 0 }
# we check only the endpoint for now.
# just assume the line started at (0.1, 0.1)
if ( ( $x < 0 ) || ( $y < 0 ) ) {
print STDOUT "Out of bound: ($x,$y)" . $EOL;
return 0;
}
lib/Graphics/Penplotter/GcodeXY.pm view on Meta::CPAN
# top right corners of the rectangle.
# The last four parameters are the coordinates of the start and end of the line segment.
# Meaning of the 'info' return value:
# 1 entire line segment is inside boundary
# 2 line segment is completely outside boundary
# 3 starting point inside, but not endpoint
# 4 endpoint inside, but not starting point
# 5 neither startpoint nor endpoint inside, but other parts are
# The function returns the clipped line segment in the other variables, unless info
# is 2, in which case -1 is returned.
# This code is self contained, so suitable for inclusion elsewhere, and well tested
# (remove $self if necessary).
sub _LiangBarsky {
lib/Graphics/Penplotter/GcodeXY.pm view on Meta::CPAN
# converted from a javascript module found on github ('svgpath')
# Convert an arc to a sequence of cubic bézier curves
# the call was: new_segments = _a2c(x, y, nextX, nextY, s[4], s[5], s[1], s[2], s[3]);
# s = array of path values, 7 elements, s[0] = 'a' or 'A'
# everything converted to absolute
# (x,y) is current point, (nextx,nexty) is endpoint.
# Calculate an angle between two unit vectors.
# Since we measure angle between radii of circular arcs,
# we can use simplified math (without length normalization)
#
lib/Graphics/Penplotter/GcodeXY.pm view on Meta::CPAN
if ( $dot > 1.0 ) { $dot = 1.0; }
if ( $dot < -1.0 ) { $dot = -1.0; }
return $sign * acos($dot);
}
# Convert from endpoint to center parameterization,
# see http:#www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
# Return [cx, cy, theta1, delta_theta]
sub _get_arc_center {
my ( $x1, $y1, $x2, $y2, $fa, $fs, $rx, $ry, $sin_phi, $cos_phi ) = @_;
# Step 1.
view all matches for this distribution
view release on metacpan or search on metacpan
unsigned int i;
int tag;
potrace_dpoint_t *c = NULL;
HV *segment = NULL;
HV *first_segment = NULL;
SV *last_endpoint = NULL;
hv_store(retval, "area", 4, newSViv(node->area), FALSE);
hv_store(retval, "sign", 4, newSVpvn((node->sign == '-' ? "-" : "+"), 1), FALSE);
hv_store(retval, "curve", 5, newRV_noinc((SV *)curve), FALSE);
segment = newHV();
if (first_segment == NULL)
first_segment = segment;
if (last_endpoint) {
hv_store(segment, "begin", 5, last_endpoint, FALSE);
last_endpoint = NULL;
}
hv_store(segment, "end", 3, _make_point(c+2), FALSE);
last_endpoint = _make_point(c+2); /* "begin" of the next segment */
if (tag == POTRACE_CORNER) {
hv_store(segment, "type", 4, newSVpvn("corner", 6), FALSE);
hv_store(segment, "corner", 6, _make_point(c+1), FALSE);
}
hv_store(segment, "p1", 2, _make_point(c), FALSE);
hv_store(segment, "p2", 2, _make_point(c+1), FALSE);
}
av_push(curve, newRV_noinc((SV *)segment));
}
if (last_endpoint)
hv_store(first_segment, "begin", 5, last_endpoint, FALSE);
return newRV_noinc((SV *)retval);
}
SV *_make_listpath(potrace_path_t *plist) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/GrowthForecast/Aggregator/Callback.pm view on Meta::CPAN
sub run {
my $self = shift;
my %args = @_;
my $service = $args{service} // die "Missing mandatory parameter: service";
my $endpoint = $args{endpoint} // die "Missing mandatory parameter: endpoint";
my $ua = $args{ua} // die "Missing mandatory parameter: ua";
$endpoint =~ s!/$!!;
my $url = "$endpoint/$service/$self->{section}/$self->{name}";
my ($number) = $self->code->();
my $req = POST $url, [
number => $number,
description => encode_utf8($self->description),
lib/GrowthForecast/Aggregator/Callback.pm view on Meta::CPAN
Service name.
This module send request to "/api/$service/$section/$name"
=item endpoint
Endpoint URL, contains '/api'.
E.g. http://example.com/api/
view all matches for this distribution
view release on metacpan or search on metacpan
public/js/site.js view on Meta::CPAN
setTimeout(function(){ preview_complex_graph($('#complex-form')) },10);
});
var service_tree;
$.ajax({
url: $('#service_tree').data('endpoint'),
cache: false,
async: false,
dataType: 'json'
}).done(function(data){ service_tree = data })
.fail(function(){
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Grpc/Client/AbstractCall.pm view on Meta::CPAN
sub getMetadata {
my $self = shift;
return $self->{_metadata};
}
## @return string The URI of the endpoint.
sub getPeer {
my $self = shift;
return $self->{_call}->getPeer();
}
view all matches for this distribution
view release on metacpan or search on metacpan
share/public/guaclite.js view on Meta::CPAN
/**
* Add the specified line to the current path.
*
* @param {Guacamole.Layer} layer The layer to draw upon.
* @param {Number} x The X coordinate of the endpoint of the line to draw.
* @param {Number} y The Y coordinate of the endpoint of the line to draw.
*/
this.lineTo = function(layer, x, y) {
scheduleTask(function __display_lineTo() {
layer.lineTo(x, y);
});
share/public/guaclite.js view on Meta::CPAN
* @param {Guacamole.Layer} layer The layer to draw upon.
* @param {Number} cp1x The X coordinate of the first control point.
* @param {Number} cp1y The Y coordinate of the first control point.
* @param {Number} cp2x The X coordinate of the second control point.
* @param {Number} cp2y The Y coordinate of the second control point.
* @param {Number} x The X coordinate of the endpoint of the curve.
* @param {Number} y The Y coordinate of the endpoint of the curve.
*/
this.curveTo = function(layer, cp1x, cp1y, cp2x, cp2y, x, y) {
scheduleTask(function __display_curveTo() {
layer.curveTo(cp1x, cp1y, cp2x, cp2y, x, y);
});
share/public/guaclite.js view on Meta::CPAN
};
/**
* Add the specified line to the current path.
*
* @param {Number} x The X coordinate of the endpoint of the line to draw.
* @param {Number} y The Y coordinate of the endpoint of the line to draw.
*/
this.lineTo = function(x, y) {
// Start a new path if current path is closed
if (pathClosed) {
share/public/guaclite.js view on Meta::CPAN
*
* @param {Number} cp1x The X coordinate of the first control point.
* @param {Number} cp1y The Y coordinate of the first control point.
* @param {Number} cp2x The X coordinate of the second control point.
* @param {Number} cp2y The Y coordinate of the second control point.
* @param {Number} x The X coordinate of the endpoint of the curve.
* @param {Number} y The Y coordinate of the endpoint of the curve.
*/
this.curveTo = function(cp1x, cp1y, cp2x, cp2y, x, y) {
// Start a new path if current path is closed
if (pathClosed) {
share/public/guaclite.js view on Meta::CPAN
tunnel.setUUID(connect_xmlhttprequest.responseText);
// Mark as open
tunnel.setState(Guacamole.Tunnel.State.OPEN);
// Ping tunnel endpoint regularly to test connection stability
pingInterval = setInterval(function sendPing() {
tunnel.sendMessage("nop");
}, PING_FREQUENCY);
// Start reading data
share/public/guaclite.js view on Meta::CPAN
socket = new WebSocket(tunnelURL + "?" + data, "guacamole");
socket.onopen = function(event) {
reset_timeout();
// Ping tunnel endpoint regularly to test connection stability
pingInterval = setInterval(function sendPing() {
tunnel.sendMessage(Guacamole.Tunnel.INTERNAL_DATA_OPCODE,
"ping", new Date().getTime());
}, PING_FREQUENCY);
view all matches for this distribution
view release on metacpan or search on metacpan
- Downgraded to use Moo.
- Added standard load test script (t/00-load.t).
- Removed '+x' attributes from some of the test scripts.
0.06 2016-04-12 MANWAR
* Updated endpoint for API.
* Updated param name for api key i.e. 'api-key'.
* Tidied up pod document.
* Updated github repository details.
* Removed '+x' attrbutes from Build.PL, MANIFEST and README.
* Tidied up Changes file.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTML/Dojo/editions.pm view on Meta::CPAN
dojo.debug("your JSON wasn't comment filtered!");
return "";
}
return _143.substring(_144+2,_145);
}
dojo.debug("please consider using a mimetype of text/json-comment-filtered to avoid potential security issues with JSON endpoints");
return _143;
},load:function(type,data,_148,_149){
},error:function(type,_14b,_14c,_14d){
},timeout:function(type,_14f,_150,_151){
},handle:function(type,data,_154,_155){
lib/HTML/Dojo/editions.pm view on Meta::CPAN
dojo.debug("your JSON wasn't comment filtered!");
return "";
}
return _735.substring(_736+2,_737);
}
dojo.debug("please consider using a mimetype of text/json-comment-filtered to avoid potential security issues with JSON endpoints");
return _735;
},load:function(type,data,_73a,_73b){
},error:function(type,_73d,_73e,_73f){
},timeout:function(type,_741,_742,_743){
},handle:function(type,data,_746,_747){
lib/HTML/Dojo/editions.pm view on Meta::CPAN
dojo.debug("your JSON wasn't comment filtered!");
return "";
}
return _143.substring(_144+2,_145);
}
dojo.debug("please consider using a mimetype of text/json-comment-filtered to avoid potential security issues with JSON endpoints");
return _143;
},load:function(type,data,_148,_149){
},error:function(type,_14b,_14c,_14d){
},timeout:function(type,_14f,_150,_151){
},handle:function(type,data,_154,_155){
lib/HTML/Dojo/editions.pm view on Meta::CPAN
dojo.debug("your JSON wasn't comment filtered!");
return "";
}
return _5a2.substring(_5a3+2,_5a4);
}
dojo.debug("please consider using a mimetype of text/json-comment-filtered to avoid potential security issues with JSON endpoints");
return _5a2;
},load:function(type,data,_5a7,_5a8){
},error:function(type,_5aa,_5ab,_5ac){
},timeout:function(type,_5ae,_5af,_5b0){
},handle:function(type,data,_5b3,_5b4){
lib/HTML/Dojo/editions.pm view on Meta::CPAN
dojo.debug("your JSON wasn't comment filtered!");
return "";
}
return _735.substring(_736+2,_737);
}
dojo.debug("please consider using a mimetype of text/json-comment-filtered to avoid potential security issues with JSON endpoints");
return _735;
},load:function(type,data,_73a,_73b){
},error:function(type,_73d,_73e,_73f){
},timeout:function(type,_741,_742,_743){
},handle:function(type,data,_746,_747){
lib/HTML/Dojo/editions.pm view on Meta::CPAN
dojo.debug("your JSON wasn't comment filtered!");
return "";
}
return _19e.substring(_19f+2,_1a0);
}
dojo.debug("please consider using a mimetype of text/json-comment-filtered to avoid potential security issues with JSON endpoints");
return _19e;
},load:function(type,data,_1a3,_1a4){
},error:function(type,_1a6,_1a7,_1a8){
},timeout:function(type,_1aa,_1ab,_1ac){
},handle:function(type,data,_1af,_1b0){
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTML/FormHandlerX/JQueryRemoteValidator.pm view on Meta::CPAN
use JSON ();
has_field _validation_scripts => (type => 'JavaScript', set_js_code => '_js_code_for_validation_scripts');
has validation_endpoint => (is => 'rw', isa => 'Str', default => '/ajax/formvalidator');
has jquery_validator_link => (is => 'rw', isa => 'Str', default => 'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js');
has skip_remote_validation_types => (is => 'rw', isa => 'ArrayRef', default => sub { [ qw(Submit Hidden noCAPTCHA Display JSON JavaScript) ] });
lib/HTML/FormHandlerX/JQueryRemoteValidator.pm view on Meta::CPAN
return $js_profile;
}
method _build_remote_rule ($field) {
my $remote_rule = {
url => sprintf("%s/%s/%s", $self->validation_endpoint, $self->name, $field->id),
type => 'POST',
data => $self->name . "_data_collector",
};
return $remote_rule;
lib/HTML/FormHandlerX/JQueryRemoteValidator.pm view on Meta::CPAN
=head1 CONFIGURATION AND SETUP
The purpose of this package is to build a set of JQuery scripts and inject them
into your forms. The scripts send user input to your server where you must
provide an endpoint that can validate the fields. Since you already have an
HTML::FormHandler form, you can use that.
The package uses the remote validation feature of the JQuery Validator
framework. This also takes care of updating your form to notify the user of
errors and successes while they fill in the form. You will most likely want
lib/HTML/FormHandlerX/JQueryRemoteValidator.pm view on Meta::CPAN
=item JQuery validator
See the C<jquery_validator_link> attribute.
=item Server-side validation endpoint
See the C<validation_endpoint> attribute.
=item Some JS fragments to update the form
=item CSS to prettify it all
lib/HTML/FormHandlerX/JQueryRemoteValidator.pm view on Meta::CPAN
has '+jqr_validate_options' => (default => sub {$jqr_validate_options});
=head2 Class (form) attributes
=head3 C<validation_endpoint>
Default: /ajax/formvalidator
The form data will be POSTed to C<[validation_endpoint]/[form_name]/[field_name]>.
Note that *all* fields are submitted, not just the field being validated.
You must write the code to handle this submission. The response should be a JSON
string, either C<true> if the field passed its tests, or a message describing
view all matches for this distribution
view release on metacpan or search on metacpan
azure-pipelines.yml view on Meta::CPAN
resources:
repositories:
- repository: ci-perl-helpers
type: github
name: houseabsolute/ci-perl-helpers
endpoint: houseabsolute
stages:
- template: templates/helpers/build.yml@ci-perl-helpers
parameters:
debug: true
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTML/OSM.pm view on Meta::CPAN
An object to use for HTTP requests.
If not provided, a default user agent is created.
=item * C<host>
The API host endpoint.
Defaults to L<https://nominatim.openstreetmap.org/search>.
=item * C<width>
Width (in pixels or using your own unit), the default is 600px.
view all matches for this distribution
view release on metacpan or search on metacpan
"Gisle Aas <gisle@aas.no>",
"Graham Knop <haarg@haarg.org>",
"Jacques Germishuys <jacquesg@striata.com>",
"James Raspass <jraspass@gmail.com>",
"Jess Robinson <castaway@desert-island.me.uk>",
"Jon Jensen <jon@endpoint.com>",
"Lukas Mai <lukasmai.403@gmail.com>",
"Michal Josef \u0160pa\u010dek <mspacek@redhat.com>",
"Mike South <msouth@gmail.com>",
"Nicholas Clark <nick@ccl4.org>",
"Nicolas R <nicolas@atoomic.org>",
view all matches for this distribution
view release on metacpan or search on metacpan
lib/HTML/TableContent/Template/Base.pm view on Meta::CPAN
cell all => ( alternate_classes => qw['one', 'two'] );
sub _render_header {
my ($self, $header) = @_;
return ['<a href="some/endpoint?sort=%s">%s</a>', 'template_attr', 'text'];
}
sub _even_rows {
return ['<div>%s</div>', '_render_element'];
}
view all matches for this distribution