Tutorial by Examples: ti

If you'd like to start implementing best practices, for yourself or your team, then Perl::Critic is the best place to start. The module is based on the Perl Best Practices book by Damien Conway and does a fairly good job implementing the suggestions made therein. Note: I should mention (and Conwa...
Install DateTime on your PC and then use it in perl script: use DateTime; Create new current datetime $dt = DateTime->now( time_zone => 'Asia/Ho_Chi_Minh'); Then you can access elements's values of date and time: $year = $dt->year; $month = $dt->month; $day = $dt->day; $...
Set single element: $dt->set( year => 2016 ); Set many elements: $dt->set( year => 2016, 'month' => 8); Add duration to datetime $dt->add( hour => 1, month => 2) Datetime subtraction: my $dt1 = DateTime->new( year => 2016, month => 8, ...
#!/usr/bin/perl use Term::ANSIColor; print color("cyan"), "Hello", color("red"), "\tWorld", color("green"), "\tIt's Me!\n", color("reset");
Time::Piece is available in perl 5 after version 10 use Time::Piece; my $date = localtime->strftime('%m/%d/%Y'); print $date; Output 07/26/2016
use strict; use warnings; use Gtk2 -init; my $window = Gtk2::Window->new(); $window->show(); Gtk2->main(); 0;
Pig provides an engine for executing data flows in parallel on Hadoop. It includes a language, Pig Latin, for expressing these data flows. Pig Latin includes operators for many of the traditional data operations (join, sort, filter, etc.), as well as the ability for users to develop their own fun...
Modal dialog components can be instantiated via jQuery with the function $('#myModal').modal(options), where $('#myModal') is a top-level reference to the specific modal dialog and options is a Javascript object specifying the modal dialog's default attributes. The options object allows for multipl...
A literal inside a enumeration is a discrete type so we can use attribute Image to find out which literal it is as text form. Notice that this prints out the same word as in the code (but in upper case). with Ada.Text_IO; use Ada.Text_IO; procedure Main is type Fruit is (Banana, Pear, Orang...
Instead of attribute Image and Ada.Text_IO.Put on enumeration literals we can only use the generic package Ada.Text_IO.Enumeration_IO to print out the literals. with Ada.Text_IO; use Ada.Text_IO; procedure Main is type Fruit is (Banana, Pear, Orange, Melon); package Fruit_IO is new Enume...
You can set the desired UI widget's stylesheet using any valid CSS. The example below will set a QLabel's text color a border around it. #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::Mai...
If your code is running behind a proxy and you know the end point, you can set this information in your code. requests accepts a proxies parameter. This should be a dictionary that maps protocol to the proxy URL. proxies = { 'http': 'http://proxy.example.com:8080', 'https': 'http://securepro...
The whole ES6 spec is not yet implemented in its entirety so you will only be able to use some of the new features. You can see a list of the current supported ES6 features at http://node.green/ Since NodeJS v6 there has been pretty good support. So if you using NodeJS v6 or above you can enjoy usi...
Annotations are means of attaching metadata to code. To declare an annotation, put the annotation modifier in front of a class: annotation class Strippable Annotations can have meta-anotations: @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, A...
The concept of timing is related more to the physics of flip flops than VHDL, but is an important concept that any designer using VHDL to create hardware should know. When designing digital hardware, we are typically creating synchronous logic. This means our data travels from flip-flop to flip-flo...
// get existing collections $orders = Mage::getModel('sales/order')->getCollection(); $products = Mage::getModel('catalog/product')->getCollection(); $customers = Mage::getModel('customer/customer')->getCollection();
// $orders is collection $orders->addAttributeToSelect('status'); // get status attribute $orders->addAttributeToSelect('*'); // get all attributes
// sort by creation date $orders->setOrder('created_at', 'asc'); $orders->setOrder('created_at', 'desc'); $orders->setOrder('created_at'); // default direction is 'desc'
Let's say you've got a table of loans, and another related table of parcels, where each loan can have one or more parcels associated with it. If you want a query to show each loan and a list of all its associated parcels, but you only want each loan to show up once, then you could use something lik...
You might have realized that $emit is scoped to the component that is emitting the event. That's a problem when you want to communicate between components far from one another in the component tree. Note: In Vue1 you coud use $dispatch or $broadcast, but not in Vue2. The reason being that it doesn'...

Page 309 of 505