Pizza is great because it is food. Food is necessary to survive, in most cases. Pizza is a combination of dough, tomato sauce, and cheese, at its core. The dough is stretched and flattened into a disc. These ingredients are then stacked upon each other and cooked into an oven. Often times, other ingredients may be placed on top while cooking in the oven, to modify the flavor to someone's particular desires.
Available to order usually from 11am to 1am
Can be delivered directly to you from some providers
The term pizza was first recorded in the 10th century.
It is impossible for there to be too much pizza.
When you have pizza on a bagel, you can have pizza anytime.
Pizza is very much sought after by turtles before reaching adulthood.
Size
Diameter
Feeds ___ People
Small
8"
1
Medium
12"
2
Large
14"
4
BIG BOY
32'
9001
This website was put together by Joshua Roberts for the "The Complete Web Developer Course 2.0" by Rob Percival, found on udemy.com. It is very pointless, but I made it.


Avabranch Mobile
Last year I made a game called Avabranch for the github gameoff (http://www.zolmeister.com/2012/11/avabranch.html). I decided to take a few hours and port it to mobile, so without further ado, here it is: http://avabranch.zolmeister.com/m/
It's listening for touch events, so if you want to use it on the desktop, you're going to need to enable touch events in the chrome dev tools settings.
I also decided to use phone gap to make it an android app: https://play.google.com/store/apps/details?id=com.Zolmeister.Avabranch
However the android app has a few known bugs (and some mobile browsers like google-chrome may not play the game properly). My advice is to use the firefox mobile browser, as it worked flawlessly for me the first time. There are currently no plans to fix the issues, mostly because its not my fault (it works in FF mobile, and the desktop flawlessly) and I don't feel like debugging the app, especially because the android app works perfectly on my phone (if there is enough interest I may fix the issues, but at the moment it was just an excuse to play with phone gap). Anyways, hope it works for you.


Blake's Backend Test
This is a Rails app for my job application with Blake E-Learning. The brief is as follows:
PROBLEM
-------
Company X is developing a new app for student education. Students complete
lessons and their progress is recorded. Each lesson has 3 parts - 1, 2 and 3.
There are 100 lessons in total.
PART 1
------
Generate an app that persists students and their progress.
Define routes for:
a) setting a student's progress - progress should consist of a lesson and part number.
b) returning a JSON representation of a student and their associated progress.
PART 2
------
Teachers have classes containing number of students.
a) Add a teacher model that is related to students
b) Create a reports page for a teacher to view the progress of all of their students.
PART 3
------
Calculating progress
a) add a method for updating student progress - this should verify that the
student is only able to complete the next part number in sequence e.g.
L1 P1, L1 P2, L1 P3, L2 P1, L2 P2 etc
PART 4 (optional)
-----------------
a) the first 50 lessons now have 5 parts. Ensure the system will still work as
expected and no students progress will be lost
All parts have been implemented.
Environments
The app is tested with Travis CI, and is expected to run on either Linux or Mac OSX. I have developed the app on Linux.
System Dependencies & Configuration
The basic requirements are MRI 2.6 and Bundler >= 2.0.2 in order to be able to run bundle install
. I haven't used any fancy 2.6 features, so the app will probably work on other Rubies, but to save myself time, I haven't bothered to test any others.
This app uses Rails 5.2, and should not require any system libraries beyond those required by rails. SQLite3 is used for the database in all environments, so no other database engine is required.1 Although other gems are pulled in, I am not aware of any that introduce any additional system dependencies.
Application Installation Instructions
As you might expect, the installation steps are:
-
clone the git repo:
git clone https://github.com/asppsa/blake-test.git cd blake-test
-
install Ruby gems using Bundler:
bundle install
-
create and seed the database:
bundle exec rails db:create bundle exec rails db:migrate bundle exec rails db:seed
In place of (3), you can alternatively run the db:setup
task, but this will skip applying foreign keys (because these are not recorded in db/schema.rb
). The db:seed
stage will add 100 lessons with 3 parts each into the database. There's no human interface for adding these otherwise.
Launching
Whilst it is possible to run the app in production mode, there's really no reason to do so. As such, you can launch Rails simply by typing:
rails s
This will start the server on localhost:3000/. Once you have the app open, you will be redirected straight to a basic homepage.
Testing
Tests have been written in RSpec (and using rspec-rails). You can run the test suite via the following incantation:
bundle exec rspec
Usage
The student and teacher interfaces are based on the standard Rails scaffold. So, you can pretty easily add, edit and delete students and teachers by following the links on the homepage or the navbar.
Part 1A: Route for setting a student's progress
In order to implement Part 1A of the brief, the “new/edit student” pages have a drop-down that allows you to set the student's current lesson and lesson part (after clicking “Update Student”).
Part 1B: JSON representation of the student and their progress
For Part 1B of the brief, the JSON for each student can be viewed by visiting /students/:id.json
(or by making an HTTP GET request to /students/:id
with an Accept: application/json
header), where :id
is replaced with the student's ID number. This too is based on the code generated by the standard Rails scaffold.
Part 2A: A teacher model that is related to students
Every student can have one teacher. Students' teachers are assigned via the new/edit student pages via a drop-down (see above screenshot).
Part 2B: A report page to view students' progress
Report pages are linked to from the main “teachers” page. This is implemented as a simple table giving student names and their current lesson.
Parts 3 and 4: A method to progess a student to the next lesson part
This is implemented via Student#advance_lesson!
. This is just a method – there is no UI for interacting with this. Thefore, in order to test it by hand (as opposed to running the specs), you should use the Rails console:
$ rails c
Loading development environment (Rails 5.2.3)
irb(main):001:0> s = Student.create!(name: 'My Student')
(0.1ms) begin transaction
Student Create (0.5ms) INSERT INTO "students" ("name", "created_at", "updated_at") VALUES (?, ?, ?) [["name", "My Student"], ["created_at", "2019-08-20 04:43:44.661509"], ["updated_at", "2019-08-20 04:43:44.661509"]]
(64.9ms) commit transaction
=> #<Student id: 6, name: "My Student", created_at: "2019-08-20 04:43:44", updated_at: "2019-08-20 04:43:44", lesson_part_id: nil, teacher_id: nil>
irb(main):002:0> s.advance_lesson!
(0.2ms) begin transaction
Student Load (2.6ms) SELECT "students".* FROM "students" WHERE "students"."id" = ? LIMIT ? [["id", 6], ["LIMIT", 1]]
LessonPart Load (0.3ms) SELECT "lesson_parts".* FROM "lesson_parts" INNER JOIN "lessons" ON "lessons"."id" = "lesson_parts"."lesson_id" WHERE "lessons"."number" = ? AND "lesson_parts"."number" = ? LIMIT ? [["number", 1], ["number", 1], ["LIMIT", 1]]
Student Update (0.5ms) UPDATE "students" SET "lesson_part_id" = ?, "updated_at" = ? WHERE "students"."id" = ? [["lesson_part_id", 1], ["updated_at", "2019-08-20 04:43:54.548709"], ["id", 6]]
(71.0ms) commit transaction
=> #<LessonPart id: 1, number: 1, lesson_id: 1, created_at: "2019-08-19 02:49:57", updated_at: "2019-08-19 02:49:57">
irb(main):003:0> s.advance_lesson!
<snip>
=> #<LessonPart id: 2, number: 2, lesson_id: 1, created_at: "2019-08-19 02:49:57", updated_at: "2019-08-19 02:49:57">
irb(main):003:0> 99.times { s.advance_lesson! }
<watch it go ...>
Note that the database definitely needs to be seeded for this to work. There is more information about #advance_lesson!
below.
If you want to hand-test that things still work when there are extra lesson parts (as in part 4 of the brief), you can run a rake task to add the extra lesson parts:
bundle exec rails blake:part4
After this, you can again test the behaviour of using #advance_lesson!
using the Rails console.
Further documentation
Most of the Ruby code has been documented using YARD. You will find the generated files in the docs
folder. You can open these in a browser by visiting file:///path/to/the/blake-test/docs/index.html
. They are also hosted via GitHub pages.
Also, the JSON API implemented in Part 1B is documented using APIPie. This isn't super, but it gives an indication of what the various data in the JSON are. This gets launched when you run rails, so you can view it by going to localhost:3000/apipie. Static files are also in the docs
folder (as they are for YARD), so you can also view this by going to file:///path/to/the/blake-test/docs/apidoc.html
or GitHub pages.
Discussion
In this section I outline the decisions I made in putting this app together.
Basic Setup
Using Rails
The first and most basic choice I had to make was what to use to build the app. I picked Rails for a number of reasons:
-
to demonstrate that I know my way around Rails;
-
because it is very well supported;
-
because I perceived that Rails is well-suited to the requirements set out in the brief (managing data records and applying validation rules, viewing data as JSON as well as HTML, etc.); and
-
I hoped to leverage Rails generators to make less work for myself!
Aside from this basic decision, I made a few other choices:
-
Not to waste time setting up PostgreSQL. I suppose demonstrating my ability to use Postgres would have been a plus, but it is clearly overkill for this (toy) problem, and it would make the setup task harder for whoever it is that has to evaluate this code.
-
Not to bother with any JavaScript or other frontend work beyond the absolute bare minimum of CSS. I figured I should just focus on doing the backend work well, given that this is a "backend test". This also enabled me to take full advantage of Rails' scaffold generator in order to implement Part 1.
Overall, I hope I have demonstrated that I am able to show restraint and pragmatism when making choices about what technologies to use, and how to proceed with those. If I had built everything from scratch (e.g. no use of Rails generators), this project would probably have taken a lot longer to complete!
TDD, RSpec and continuous integration
I picked RSpec for testing because I am much more familiar with it than minitest. I used rspec-rails, which provides a number of handy generators to get boilerplate tests. This enabled me to get testing straight away once I had installed Rails.
I also set up Rubocop at the outset. I consider the kind of code linting that Rubocop provides to be an extremely useful extra check, in addition to my RSpec suite. rubocop-rails provides useful checks against some simple mistakes and antipatterns.
To the best of my ability, I have proceeded with every new feature by writing accompanying specs to go with it. I have mostly written specs for models, views and requests. I haven't written full integration tests. These would have resulted in a significantly slower test suite, and are probably not necessary for this project, given the extremely simplistic nature of the interface.
Overall in writing tests, I have tried to demonstrate that I can write a good, thorough test suite that takes account of corner cases and that is easy to understand.
I also made the decision at the outset that I wanted to demonstrate my ability to employ the kind of workflow that I gather is in place at Blake. For this reason, and I determined to map out the tasks that needed to be completed using the GitHub issue tracker, and for each new feature that was to be implemented I would open pull request. I set up Travis CI so that I could continuously test the changes in each pull request against RSpec and Rubocop. When Travis failed (as it often did), I applied additional commits and fixups until the tests passed again. You can see this in action by reviewing the closed PRs in GitHub.
Interpretting the requirements
In order to design the app, I had to make some interpretative decisions about what the brief actually called for. The basic idea that there are students progressing through lessons seemed very clear, but there were a few uncertainties.
-
In normal every-day language, when we talk about “progress”, we are usually discussing a process that evolves over time. A full-featured database representation of a student's progress would therefore probably need to keep track of progress by logging each thing that the student did, so that for instance, it would be possible to determine how long they spent on a particular module. In this model, the student's progress would be represented by the combination of all of those interactions, and in relational terms, it would mean having a many-to-many relationship between students and lessons.
However, the brief very explicitly says that “progress should consist of a lesson and part number”. I took this to mean that the above model would be overengineering for this test, and so I elected to use a simpler database design (see below).
-
I was initially uncertain what the distinction was between Part 1A (“setting a student's progress”) and Part 3 (“updating student progress”). I decided to treat Part 1A as a task to set up a human data entry interface where a student's information (specifically their progress) could be set to any valid value, without the sequence restriction described in Part 3.
Database Design
First, it is perhaps worth questioning whether this problem required a database at all. I determined that it did due to the requirement to “persist students and their progress”. I elected to use SQL because it is what I know best, and as mentioned above I chose SQLite3 to keep things simple (acknowledging that a real world app would almost certainly not use SQLite).
In designing the designing the database, I considered the requirements set out in all four parts. As mentioned above, I determined that a many-to-many relation between students and lessons was not necessary for modelling student progress in this problem because progress was to be represented simply as a lesson and part number. This still left me with various options for how to model student progress however. In order of rising complexity:
-
Each student and their progress could be recorded in a single "student" table. In this model, lessons and lesson parts could both be numerical fields.
-
Lessons and students could be modelled separately, but lesson parts could be tracked via a number (as in 1, above). In this model, a student would have a many-to-one association with a lesson, and a numrical lesson number field.
-
Lessons, lesson parts and students could all be modelled separately. In this model, lesson parts have a many-to-one relation to lessons, and students have a many-to-one relation to lessons.
I determined that (1) would require hard-coding the logic for incrementing a student's progress in Part 3, as the number of lessons and lesson parts would not be modelled in the database. This in turn would mean that we could not easily meet the requirements of Part 4 of the test, where the basic assumptions about the number of lesson parts is altered, except by altering the hard-coded logic. This seemed to go against the spirit of Part 4 where it says “ensure the system will still work” (i.e. without alterations). On this basis I decided that (1) was not sufficient for modelling the problem.
I next considered (2). In this case, each lesson in the database could have a “number of parts” field, which would give us the necessary flexibility to implement Part 3 without hard-coding in a way that breaks in Part 4. However, I decided that this model was not good database design: the part-number information recorded in every student record would be meaningful only in the context of the lesson association, and this meant that the data were not properly normalised.
For this reason, I picked option 3.
Part 1
Setting a student's progress
As discussed above, I interpretted the requirement around setting a student's progress to mean that there needed to be a web interface where students and their associated current lesson + lesson part could be set. In addition to the lesson information, I decided to add a very basic “name” field to students, just as “window dressing”.
To make this interface, I started with a Rails scaffold. This gave me a super-simple CRUD interface for viewing students and altering their details (initially just their name). I then modified this interface to include a drop-down that allowed the current lesson and llesson part of each student to be set, and I included this in the “index” page (the page that shows the list of students).
I wrote view, controller and request specs in RSpec to ensure that data were displayed correctly, and that data could be set. When these specs all passed, I considered Part 1A to be implemented.
The JSON representation of the student
The scaffold above helpfully included JSON routes also using JBuilder. In a real-world application I would put a RESTful JSON API into a completely separate route (e.g. /api/v1/...
), but as this was not called for by the brief, I determined to simply take the existing JBuilder template for viewing a student, and to simply add in the lesson and lesson part data that constitute “progress” in this model.
Although at a model level, students are associated with lesson parts, and lesson parts are associated with lessons, I somewhat flattened this in the JSON, so that the student appears to be associated with boththe lesson and the lesson part directly. This seemed to me to be easier to parse for someone consuming the data who is not familiar with the underlying database model.
Again, I wrote view and request specs to check that the right JSON was returned for different types of data, and considered the feature implemented once the tests had passed.
Part 2
Adding teachers
In order to add teachers a database modification was required, and in order to do that, I had to make some choices around how to implement the association between students and teachers. I decided against modelling students and teachers using table inheritance. This would have been the way to go if either of the following were true:
-
a person could be both a student and a teacher and their data needed to be maintained in a single place (e.g. their name or address);
-
there were any significant associations that both students and teachers had in common; or
-
there were a lot of common attributes.
I assumed (given the brief) that none of these were true, and so implemented students and teachers as two distinct (but associated) entities.
I then had decide on the kind of relation that these entities would have. I picked a one-to-many relation from teachers to students, because it was the simplest solution that fix the requirements of the brief. This required assuming that a student could only be taught by one teacher at a time, which is probably not super-realistic. A many-to-many relationship would have taken longer to implement, however.
Once the design was decided on, I again used a Rails scaffold to create pages for listing, creating and editing teachers, and I modified the student pages to display and allow editing of each student's teacher via a drop-down. I also undertook some refactoring of functionality common to both (i.e. name validation), moving the model validations into a shared module, and refactoring the forms and specs to keep things fairly DRY.
Adding the report page
For this requirement, I again determined to do things as simply as possible. In a “real world” app, one would most likely implement authentication so teachers can log in and view their students, without others on the internet getting access to student data. As authentication was not mentioned in the brief, I didn't bother with it. Instead, I added a simple link from each teacher listed in the teachers page to their report, which was implemented simply by adding a new route to the TeachersController
.
At this stage I also added a simple homepage and navbar, so that it is easy to navigate between the students listing and the teachers.
Part 3
The brief specifically requests “a method”, so this requirement has been implemented as a simple method on the Student
model called #advance_lesson!
. It depends on two methods implemented on LessonPart
: .initial
and #next
. The former returns Lesson 1, Part 1; the latter returns the “next” lesson part, defined as either:
-
the lesson part in the current lesson with the next
#number
(i.e. `number -
1
); or if that is
nil`, and there are no further lesson parts in the -
lesson …
-
the lesson part in the next lesson (where that is defined in
Lesson#next
as the lesson with the next#number
) with#number
equal to one.
Student#advance_lesson!
assigns #lesson_part
to either:
-
LessonPart.initial
, if there is no current lesson (i.e.student.lesson_part
isnil
); or -
lesson_part.next
.
If either of LessonPart.initial
or student.lesson_part.next
return nil
, then a Student::AdvanceError
is raised. This indicates one of the following:
-
that there is no initial lesson part (e.g. if lesson models have not been created, or if the numbering does not start at one);
-
that there is a “gap” between lesson parts, or betweeen lessons (e.g. if there are lessons 2 and 4, but not lesson 3); or
-
that we have attempted to advance beyond the last lesson.
Specs have been written in spec/models/student_spec.rb
to ensure that this method can progress a student from the first to the last lesson, in a scenario where there are 100 lessons with three parts each. This fulfills the verification requirement in Part 3.
It is noted that in the real world a method like this might be better placed in a separate business logic class/module (e.g. using dry-monads), because in a real-world app, storing this kind of logic in the model can result in “fat models”. However, in this case, there is clearly no risk of this occurring.
Part 4
The assumptions that were made in implementing this part are that if a student is part-way through the lessons when the number of parts is altered, those parts that are ahead of them (according to the progression rules set out in part 3 of the spec) now need to be covered by them.
A rake task called blake:part4
was added to create the additional lesson parts. This is only necessary if you want to check that things work by hand, as the specs simulate adding extra parts separately.
Specs are added to show that when the system is changed to have 5 lesson parts in the first fifty lessons,
-
student progression still works from beginning to end; and
-
a student that is part-way through first 50 lessons can continue to progress through the new lessons that are in their path.
Licence
1 It should be trivial to switch to another database engine. The `create_lesson_parts` migration currently includes some hand-written SQLite that would need to be fixed, but there are no other raw SQL statements.


We redefine methodologies!
- leverage intuitive initiatives
- syndicate mission-critical eyeballs
- e-enable open-source relationships
- streamline next-generation platforms
- leverage front-end platforms
- evolve interactive action-items
- transform B2B schemas
- iterate next-generation infrastructures
- cultivate granular initiatives
- mesh back-end methodologies
- reintermediate wireless niches
- orchestrate bleeding-edge communities
- cultivate global portals
- cultivate revolutionary bandwidth


Registration for childcare is now closed.
We are offering free childcare throughout the full SRCCON:WORK schedule (including Thursday dinner). Our providers are the wonderful KiddieCorp team, whom we welcome back for the fourth time.
Staff-to-child ratios range from 1:2 for children 6-11 months to 1:7 for children aged 6-12 years, and KiddieCorp will work with SRCCON organizers to handle registration and logistics so your kid(s) can have a great time while you’re conferencing. All caregivers act as employees of KiddieCorp (not contractors) and are recruited from local licensed daycare centers, elementary schools, preschools, and collegiate departments of early childhood education.
Two of our own staff members have had their young children happily in KiddieCorp’s care over the last three SRCCONs and we were all impressed by the thoughtfulness they brought to every aspect of their services.
Childcare will take place at the conference hotel, which is a few blocks away from the conference venue. Registration is now closed. You can learn more about KiddieCorp’s staffing and security procedures.


@* * Copyright 2021 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @import play.api.i18n._ @import views.html.helper.FieldElements @this(dateFieldsContentV: dateFieldsContent) @(formItem: Form[_], fieldName: String, label: Html, extraClass: Option[String], args: (Symbol, Any)*)(implicit messages: Messages, formPartialRetriever: uk.gov.hmrc.play.partials.FormPartialRetriever) @elements = @{ new FieldElements(formItem(fieldName).id, formItem(fieldName), null, args.toMap, messages) }


This sleepy little town hides a glorious past. Its famous Byzantine mosaics are reputed to be the best outside of Istanbul and are a legacy of its hayday as the capital of the Western Roman Empire in the 6th to 8th centry.
Its port, Porto Corsini, lies about 80nm south of Venice and 40nm NW of Rimini.
Position 44°29.4'N, 12°17'E. (Porto Corsini).
All officials are based here.
The Harbour master's office is near the fuel berth.
Yachts are not allowed to proceed up the canal to the town of Ravenna, not can they berth in the commercial part of the Port of Corsini.
There is a large marina, as well as yacht club berths here. There are plans to extend the maina, but no details are currently available.
Berth in the marina where directed.
There is reasonable shelter here.
Last updated March 2010.


We'll take this is a couple of stages..
..In each stage we will explore some concepts and then see how it looks in code.
By the end, we'll have a fully working multiplayer game!
All the code for these slides and the code used throughout the presentation is available on Github.
github.com/mrockall/codeninja“Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient...”
One waiter per table
One waiter multiple customers.
“Socket.IO aims to make realtime apps possible in every browser and mobile device, blurring the differences between the different transport mechanisms. It's care-free realtime 100% in JavaScript.”IE 5.5+, Safari 3+, Chrome 4+, Firefox 3+, Opera 10.61+
// Setup the web socket
io.socket = io.connect();
// Send an event to the server
io.socket.emit("host:create_game");
// React to an event from the server
io.socket.on('connected', game.onConnected );
It used to be that JS was used for fancy effects and embellishments. Now though, it's stuff that matters – proper application code as well as the niceties. That means we need to take more care to organise and structure our source.Introduction to Backbone.js - Ben Gourley
We will use Backbone to structure our game with proven software patterns, separating UI logic from business logic.
Maintainability, Compatibility, Testability, Reusability, DRY-ness, Consistency, Modularity
Events is a module that can be mixed in to any object, giving the object the ability to bind and trigger custom named events.
var o = {}
_.extend(o, Backbone.Events)
o.on('zap', function () {
console.log('zapped')
})
o.trigger('zap')
Models are the heart of any JavaScript application, containing the interactive data as well as a large part of the logic surrounding it.
var Person = Backbone.Model.extend({
defaults: {
name: '',
age: 0
},
canDrive: function() {
return this.get('age') > 17;
}
});
var person = new Person({ name: "Mike", age: 23});
person.canDrive(); // true
Collections are simply an ordered set of models.
var Song = Backbone.Model.extend({
defaults: {
title: '',
artist: ''
}
});
var Album = Backbone.Collection.extend({
model: Song
});
Views are used to reflect what your applications' data models look like. They are also used to listen to events and react accordingly.
var SearchView = Backbone.View.extend({
el: $('#search_container'),
events: {
"click input[type=button]": "doSearch"
},
render: function(){
var template = _.template( $("#search_template").html() );
this.$el.html( template );
},
doSearch: function( event ){}
});
var search_view = new SearchView().render();
Routers provide methods for routing client-side pages, and connecting them to actions and events.
var Workspace = Backbone.Router.extend({
routes: {
"help": "help", // #help
"search/:query": "search", // #search/ninjas
"search/:query/p:page": "search" // #search/ninjas/p7
},
help: function() {
...
},
search: function(query, page) {
...
}
});
Now we have a pretty nice codebase, we need to add the logic that will power our game...
Next we'll take a series of problems or questions and work them into our codebase until the game is completely working!
// app.Game, models/game.js
players_per_room: 2 // Set a variable in the model
playerJoinedRoom: function() {
...
if(this.Players.length == this.players_per_room){
console.log("== Room limit reached, starting game!");
io.socket.emit('host:start_countdown', this.get('game_id'));
}
...
}
// game.js
io.sockets.in(data.gameId).emit('game:start_countdown', data);
// app.Views.Home, views/home.js
countdown: function() {
var start_time = 2, $count = $countdown.find(".count");
$count.text(start_time);
// Start a 1 second timer
var timer = setInterval(_.bind(countItDown, this), 1000);
// Decrement the displayed timer value on each 'tick'
function countItDown(){
start_time -= 1
if( start_time <= 0 ){
// Stop the timer and do the callback.
clearInterval(timer);
this.$el.find('.countdown').fadeOut();
app.Game.getRound();
return;
}
$count.text(start_time);
}
}
// game.js
exports.initGame = function(sio, socket){
...
gameSocket.on('game:get_round', getRoundData);
}
function getRoundData(game_id) {
var league = teams;
league = shuffle(league);
team = league[0];
decoys = league.slice(0,4);
decoys = shuffle(decoys);
// Set up the data object
var data = {
team: team,
answers : decoys
};
io.sockets.in(game_id).emit('game:new_round_data', data);
}
// Reacting to the game:new_round_data event
app.Models.Game = Backbone.Model.extend({
initialize: function() {
...
io.socket.on('game:new_round_data', this.newRoundData );
},
...
newRoundData: function() {
console.log("== New Round Data ", data);
this.set('round_answer', data.team);
this.set('available_points', this.points_per_round);
this.set('number_of_player_answers', 0);
this.trigger('game:render_round_data', data);
}
...
});
// Rendering the round in the Game View
app.Views.Game = Backbone.View.extend({
initialize: function() {
app.Game.on('game:render_round_data', this.renderRound, this);
},
...
renderRound: function() {
if(app.Game.isHost()){
this.render_picture(data.team);
this.start_round_timer();
this.$el.find('.round .current').text(app.Game.get('current_round'));
this.$el.find('.round .total').text(app.Game.number_of_rounds);
} else {
this.$el.find(".option.tl .inner").text(data.answers[0]);
this.$el.find(".option.tr .inner").text(data.answers[1]);
this.$el.find(".option.bl .inner").text(data.answers[2]);
this.$el.find(".option.br .inner").text(data.answers[3]);
}
},
...
});
// views/game.js
// Handling the event in game screen
app.Views.Game = Backbone.View.extend({
...
events: {
"click .option": "answer_selected"
},
...
answer_selected: function(ev) {
app.Game.playerAnswer($(ev.currentTarget).find(".inner").text());
}
...
});
// Passing the answer to the Host
app.Models.Game = Backbone.Model.extend({
...
playerAnswer: function(answer) {
var data = {
gameId: this.get("game_id"),
playerId: this.get("socket_id"),
answer: answer,
round: this.get("current_round")
};
io.socket.emit('player:answer',data);
},
...
}
// Check the answer on the Host
checkAnswer: function(answer) {
if(this.isHost()){
this.set('number_of_player_answers', this.get('number_of_player_answers') + 1);
if(answer.answer == this.get('round_answer')){
// Give the Player some points
}
// If everyone has answered this round, new round!
if(this.get('number_of_player_answers') == this.Players.length){
this.getRound();
}
}
}
// Timer in Game view
start_round_timer: function() {
var $timer_el = this.$el.find('.timer');
clearInterval(this.points_counter);
this.points_counter = setInterval(_.bind(timer, this), 10);
function timer()
{
var points = app.Game.decreaseAvailablePoints();
$timer_el.text(points);
if (points <= 0) {
app.Game.forceNextRound();
clearInterval(this.points_counter);
return;
}
}
}
// The Game Model
app.Models.Game = Backbone.Model.extend({
points_per_round: 1000,
...
decreaseAvailablePoints: function() {
this.set('available_points', this.get('available_points') - 1);
return this.get('available_points');
},
...
checkAnswer: function(answer) {
...
if(answer.answer == this.get('round_answer')){
console.log("== Correct Answer: Award this many points", this.get('available_points'));
var player = this.Players.getBySocketID(answer.playerId)[0];
player.give_score(this.get('available_points'));
}
...
}
});
// Called when rendering the Host Game Screen
render_player_cards: function() {
var $score_cards = this.$el.find('.score_cards')
template = $("#player_scorecard").html();
app.Game.Players.each(_.bind(function(m, i){
var $li = $(template);
$li.addClass('sckt_' + m.get('socket'));
$li.find('.name').text(m.get('name'));
$li.find('.score').text(m.get('score'));
$score_cards.append($li);
m.on('change:score', this.update_player_score, $li);
}, this));
},
// Called any time the score in the model changes
update_player_score: function(a) {
this.find('.score').text(a.get('score'));
}
app.Models.Game = Backbone.Model.extend({
...
getRound: function() {
this.set('current_round', this.get('current_round') + 1);
if(this.get('current_round') > this.number_of_rounds){
io.socket.emit('game:over', this.get('game_id'));
} else {
io.socket.emit('game:get_round', this.get('game_id'));
}
},
endGame: function() {
console.log("== End Game");
app.Router.navigate('gameover', {trigger: true, replace: true});
}
});
Old Code: DOMContentLoaded: 180ms
RequireJS is a JavaScript file and module loader. Using a modular script loader like RequireJS will improve the speed and quality of your code.
With RequireJS: DOMContentLoaded: 94ms
The less work you have to do when performing repetitive tasks like minification, compilation, unit testing, linting, etc, the easier your job becomes
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
requirejs: {
compile: {
options: {
name : 'main',
baseUrl: "public/js/",
mainConfigFile: "public/js/main.js",
out: "public/build/game.js",
wrap: false
}
}
}
});
// Load the Grunt tasks
grunt.loadNpmTasks('grunt-contrib-requirejs');
// Default task(s).
grunt.registerTask('default', ['requirejs']);
Cloak is a library for multiplayer HTML5 games that handles client/server messaging, room/lobby management, and the fiddly edge cases that you don’t want to think about. It’s the plumbing you don’t want to fret over when you’re too busy designing your game.
Greg Smith (@_gsmith), Github
Sails.js makes it easy to build custom, enterprise-grade Node.js apps.


--- layout: post title: Winter Whimps! categories: [] tags: [] status: publish type: post published: true meta: _original_post_id: '' _original_import_author: John Duprey author: ---
jduprey
amused


|
Bullet Collision Detection & Physics Library
|
The btStridingMeshInterface is the interface class for high performance generic access to triangle meshes, used in combination with btBvhTriangleMeshShape and some other collision shapes. More...
#include <btStridingMeshInterface.h>
Public Member Functions | |
| BT_DECLARE_ALIGNED_ALLOCATOR () | |
| btStridingMeshInterface () | |
| virtual | ~btStridingMeshInterface () |
| virtual void | InternalProcessAllTriangles (btInternalTriangleIndexCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const |
| void | calculateAabbBruteForce (btVector3 &aabbMin, btVector3 &aabbMax) |
| brute force method to calculate aabb More... | |
| virtual void | getLockedVertexIndexBase (unsigned char **vertexbase, int &numverts, PHY_ScalarType &type, int &stride, unsigned char **indexbase, int &indexstride, int &numfaces, PHY_ScalarType &indicestype, int subpart=0)=0 |
| get read and write access to a subpart of a triangle mesh this subpart has a continuous array of vertices and indices in this way the mesh can be handled as chunks of memory with striding very similar to OpenGL vertexarray support make a call to unLockVertexBase when the read and write access is finished More... | |
| virtual void | getLockedReadOnlyVertexIndexBase (const unsigned char **vertexbase, int &numverts, PHY_ScalarType &type, int &stride, const unsigned char **indexbase, int &indexstride, int &numfaces, PHY_ScalarType &indicestype, int subpart=0) const =0 |
| virtual void | unLockVertexBase (int subpart)=0 |
| unLockVertexBase finishes the access to a subpart of the triangle mesh make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished More... | |
| virtual void | unLockReadOnlyVertexBase (int subpart) const =0 |
| virtual int | getNumSubParts () const =0 |
| getNumSubParts returns the number of seperate subparts each subpart has a continuous array of vertices and indices More... | |
| virtual void | preallocateVertices (int numverts)=0 |
| virtual void | preallocateIndices (int numindices)=0 |
| virtual bool | hasPremadeAabb () const |
| virtual void | setPremadeAabb (const btVector3 &aabbMin, const btVector3 &aabbMax) const |
| virtual void | getPremadeAabb (btVector3 *aabbMin, btVector3 *aabbMax) const |
| const btVector3 & | getScaling () const |
| void | setScaling (const btVector3 &scaling) |
| virtual int | calculateSerializeBufferSize () const |
| virtual const char * | serialize (void *dataBuffer, btSerializer *serializer) const |
| fills the dataBuffer and returns the struct name (and 0 on failure) More... | |
Protected Attributes | |
| btVector3 | m_scaling |
The btStridingMeshInterface is the interface class for high performance generic access to triangle meshes, used in combination with btBvhTriangleMeshShape and some other collision shapes.
Using index striding of 3*sizeof(integer) it can use triangle arrays, using index striding of 1*sizeof(integer) it can handle triangle strips. It allows for sharing graphics and collision meshes. Also it provides locking/unlocking of graphics meshes that are in gpu memory.
Definition at line 26 of file btStridingMeshInterface.h.
|
inline |
Definition at line 35 of file btStridingMeshInterface.h.
|
virtual |
Definition at line 19 of file btStridingMeshInterface.cpp.
| btStridingMeshInterface::BT_DECLARE_ALIGNED_ALLOCATOR | ( | ) |
brute force method to calculate aabb
Definition at line 173 of file btStridingMeshInterface.cpp.
|
inlinevirtual |
Definition at line 148 of file btStridingMeshInterface.h.
|
pure virtual |
Implemented in btTriangleIndexVertexArray.
|
pure virtual |
get read and write access to a subpart of a triangle mesh this subpart has a continuous array of vertices and indices in this way the mesh can be handled as chunks of memory with striding very similar to OpenGL vertexarray support make a call to unLockVertexBase when the read and write access is finished
Implemented in btTriangleIndexVertexArray.
|
pure virtual |
getNumSubParts returns the number of seperate subparts each subpart has a continuous array of vertices and indices
Implemented in btTriangleIndexVertexArray.
|
inlinevirtual |
Reimplemented in btTriangleIndexVertexArray.
Definition at line 74 of file btStridingMeshInterface.h.
|
inline |
Definition at line 80 of file btStridingMeshInterface.h.
|
inlinevirtual |
Reimplemented in btTriangleIndexVertexArray.
Definition at line 68 of file btStridingMeshInterface.h.
|
virtual |
if the number of parts is big, the performance might drop due to the innerloop switch on indextype
unlike that developers want to pass in double-precision meshes in single-precision Bullet build so disable this feature by default see patch http://code.google.com/p/bullet/issues/detail?id=213
Definition at line 23 of file btStridingMeshInterface.cpp.
|
pure virtual |
Implemented in btTriangleIndexVertexArray, and btTriangleMesh.
|
pure virtual |
Implemented in btTriangleIndexVertexArray, and btTriangleMesh.
|
virtual |
fills the dataBuffer and returns the struct name (and 0 on failure)
if the number of parts is big, the performance might drop due to the innerloop switch on indextype
Definition at line 211 of file btStridingMeshInterface.cpp.
|
inlinevirtual |
Reimplemented in btTriangleIndexVertexArray.
Definition at line 69 of file btStridingMeshInterface.h.
|
inline |
Definition at line 84 of file btStridingMeshInterface.h.
|
pure virtual |
Implemented in btTriangleIndexVertexArray.
|
pure virtual |
unLockVertexBase finishes the access to a subpart of the triangle mesh make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished
Implemented in btTriangleIndexVertexArray.
|
protected |
Definition at line 30 of file btStridingMeshInterface.h.


Join an ever growing community who rely on Trail Magic to navigate trails and share experiences.
Viewing hazards is easy, simply tap the blue marker and the hazard will appear. Tap the X to hide it again.
Adding hazards is a breeze, just tap the location of the new hazard and fill in the form, then click Add.
The whole point of the app is to share with others! Let everyone know what you've achieved and share images.
Just another short status update
Maybe one more status update, but this is a lot longer than the last ones
This is another status update
This is a status update
Click the image to navigate to the map screen or press the Select button
Lorem Ipsum
This is the description of Hazard


AC Milan 1-1 Napoli: Giacomo Bonaventura stunner earns struggling hosts a point
by FSA EditorAC Milan and Napoli played out a 1-1 draw in Saturday’s Serie A clash at San Siro, with both goals coming in the first half.
Giacomo Bonaventura scored his first goal in more than a year as AC Milan drew 1-1 with fellow out-of-form side Napoli at San Siro.
Milan had lost back-to-back matches against Lazio and Juventus heading into Saturday’s clash and fell behind to Hirving Lozano’s close-range finish after 24 minutes.
Italy international Bonaventura, making his second start of the season, instantly hit back for Stefano Pioli’s side with a goal he celebrated wildly.
Good chances went begging for Lorenzo Insigne and Ante Rebic to win the match for their respective sides, leaving Milan 13th in the table and six points behind Napoli in seventh.
Napoli soaked up plenty of early pressure and took the lead through Lozano, who reacted quickest to head in after Insigne’s long-range strike hit the crossbar.
But Milan’s response was swift and emphatic as Bonaventura fired a 20-yard shot past Alex Meret just five minutes later for his first league goal since October 2018.
Insigne failed to find a way past Gianluigi Donnarumma from a one-on-one at the end of the first half, shortly after Rebic headed wide from five yards out at the other end.
Visiting midfielder Eljif Elmas went to ground inside the opposition box with 20 minutes to play but was rightly shown a yellow card for diving.
Allan twice tested Donnarumma in the final five minutes, the second effort a half-volley from outside the box that the Milan keeper parried to ensure the points were shared.
What does it mean? Both teams in need of a lift
Napoli are now winless in six matches in all competitions for the first time since March 2013, with the pressure steadily building on boss Carlo Ancelotti, though their troubles pale in comparison to those of Milan, who are enduring a dismal campaign and have won just one of their six matches under Pioli.
Donnarumma stands firm
Milan have kept only one clean sheet in their last 10 league matches, but Donnarumma showed his quality with the save made to deny Insigne just before the interval.
The 20-year-old raced off his line to close the angle and blocked Insigne’s low shot with his legs, helping his side to claim a point from a tight match.
Rebic unable to take his chance
Rebic, a late inclusion in Milan’s starting line-up after Suso pulled out during the warm-up with a stomach bug, was unable to capitalise on his first Serie A start of the season.
He was jeered after a poor touch early on, headed wide from a good position with the match delicately poised and was replaced by Franck Kessie at half-time.
What’s next?
Napoli can book a place in the last 16 of the Champions League with victory away at Liverpool on Wednesday.
Ancelotti’s side return to Serie A action with a home match against Bologna next Sunday, the same day that Milan travel to Parma.


Hey, this is my homepage, so I
have to say something about myself. Sometimes it is hard to introduce
yourself because you know yourself so well that you do not know where to
start with. Let me give a try to see what kind of image you have about me
through my self-description. I hope that my impression about myself and your
impression about me are not so different. Here it goes.
I am a person who is positive about every aspect of life. There are many
things I like to do, to see, and to experience.  I
like to see the sunrise in the morning, I like to see the moonlight at night; I like to feel the music flowing on my face, I like to smell the wind
coming from the ocean. I like people. And, I like to laugh.
Some text..
Some text..
Some text..
Some text..


Enter your email to request an invite from your administrator.
Your account {{ ctrl.name }} ({{ ctrl.account }}) has not yet been enabled. Request an invite from your administrator to continue.


Some of you had a meeting with Stan on your calendars for Monday, October 22 from 3-5 to go over the plan presentations. This meeting has been canceled.
Thanks
Tracy Geaccone
***********
EDRM Enron Email Data Set has been produced in EML, PST and NSF format by ZL Technologies, Inc. This Data Set is licensed under a Creative Commons Attribution 3.0 United States License <http://creativecommons.org/licenses/by/3.0/us/> . To provide attribution, please cite to "ZL Technologies, Inc. (http://www.zlti.com)."
***********
California


Custom Formatter for the Donut Chart Content
Basic Steps
-
Follow the instructions from previous tutorials to get a basic dashboard up and running.
-
Create a component that will format the donut chart's content. It will take as an input the
data that's normally displayed as a raw value. In this tutorial, our formatter will do the following:
- Display the selected metric name
- Display the selected metric's value
- Convert and change the selected metric's value depending on the unit type selected
- Change the selected metric name and value depending on whether user interacts with the chart
-
Create a component that extends
DonutChartFormatterConfiguratorComponent
.
This component will serve as the custom configurator section. If you have any custom
form controls make sure to override DonutChartFormatterConfiguratorComponent
's
addCustomFormControls
method and add the custom form controls using the form group
argument. The controls in this form group will be available under the properties
input on the formatter.
-
Ensure that the following modules are included in the imports of the custom
configurator section component's parent module:
NuiFormFieldModule
,
NuiValidationMessageModule
, and NuiSelectV2Module
-
Add the custom formatter and configurator section component class names to the declarations of
the module(s) in which they're implemented. In this example, the class names are
CustomDonutContentFormatterComponent
and CustomDonutContentFormatterConfiguratorComponent
respectively.
-
Prepare the dashboard framework to use our custom components by doing the following:
-
Register the custom formatter and custom configurator section components using the
ComponentRegistryService
.
This will make them available for late load by the dashboard framework.
-
Register the formatter definitions of type
IFormatterDefinition
using the
WidgetTypesService
.
Note: In this tutorial, the above two steps are performed in the
component's constructor
. But, in a real-world app, widget type modifications
and component registrations like this might make more sense in a parent module's
constructor. Moving framework initialization procedures such as these to a higher level
in an app's hierarchy ensures that multiple dashboard instances within a common parent
module have access to the same modifications.
-
At this point you should be able to open the widget editor using the Edit button in the menu at
the top-right corner of the widget. Once the editor is open, expand the
Chart Options
section. The custom component we created should be displayed in the Custom format
select.
-
Observe how additional selects
Metrics
and Units
appeared under the formatter menu.
The Metrics
one enables users to select a specific metric to show it's info in the chart content.
The Units
one allows users to select different units to display that would format the metric's data
to a selected unit format.
 Hover over either the chart legend, or chart's segments
to see how the donut chart content data is changed dynamically.
-
In case you you use
nui-select-v2
and nui-combobox-v2
components,
it is possible that in case of large lists the component overlay may go beyond the configurator heading due to its high z-index. To fix this,
use the nui-select-v2
and nui-combobox-v2
components input popupViewportMargin
and pass the height of
the configurator heading into it. You can get the height of the configurator heading by simply injecting the
ConfiguratorHeadingService
and use its height$
observable and async pipe to instantly get the current height of the configurator heading.
For details on how to create a custom formatter, take a look at the inline comments under the
source expander of the following example.


The simulated data consist of 100 samples and 100 “transcripts” in dataset X and 200 “regulatory regions” in dataset Y. Furthermore, a continuous and binary outcome is available for prediction and visualisation.
library(gplots)
## Load simulated data
load("simulated_dataset_outcome_p100.RData")
## We attach the dataset
if (!exists("outcome_class")) attach(simulated_dataset_outcome)
cat("dimensions of X:", dim(X), "\n")
cat("dimensions of Y:", dim(Y), "\n")
## we need the gplots package
hm <- function(X) {
gplots::heatmap.2(cor(X), Rowv = FALSE, Colv = FALSE, dendrogram = "none",
col = gplots::bluered(100), trace = "none")
}
## Some descriptives
boxplot(X)
boxplot(Y)
hm(X)
hm(Y)
prcomp
. The loadings
object contain the actual loadings.princomp_fast <- function(x, nr_comp) {
x <- scale(x, scale = FALSE)
s <- svd(x, nr_comp, nr_comp)
ret <- list(sdev = s$d[1:nr_comp], loadings = structure(s$v, class = "loadings"),
center = TRUE, scale = FALSE, n.obs = nrow(x), call = "Fast princomp",
scores = s$u %*% diag(s$d[1:nr_comp], nr_comp))
class(ret) <- "princomp"
ret
}
identify
to identify pointsprincomp_fast(X, 20)
princomp_fast(X, 6)
fit_pca <- princomp_fast(X, 6)
plot(fit_pca$loadings)
# identify(fit_pca$loadings)
plot(fit_pca$scores)
outcome_class+1
as labels. Any remarkable grouping? NB we will revisit these data using O2PLS.Repeat similar analysis, but use the simulated_dataset_outcome_p1e4.RData
datasets. Note that these data are of much higher dimension, so be careful not to crash your laptop (before saving your data).
plot
. You can press tab
to find out more about the arguments of the plot function.outcome_class+1
as labels. Any remarkable grouping or pattern?Here, we will use microarray gene expression data and metabolite abundances to illustrate the O2PLS integration. - Load the data that are stored in rna_metab.RData
. Inspect the data using boxplots and a heatmap.
fit_pca_rna <- princomp_fast(rna, 2)
fit_pca_metab <- princomp_fast(metab, 2)
fit_o2m <- o2m(rna, metab, 2, 1, 10)
fit <- fit_o2m
#fit$W. <- fit_pca_rna$loadings
#fit$C. <- fit_pca_metab$loadings
fit <- fit_o2m
library(magrittr)
library(ggplot2)
library(gridExtra)
library(illuminaHumanv3.db)
# Color names
LLmodule <- c("ILMN_1690209",'ILMN_1766551', 'ILMN_1749131', 'ILMN_1688423',
'ILMN_2102670', 'ILMN_1792323', 'ILMN_1899034', 'ILMN_1806721',
'ILMN_1695530', 'ILMN_1726114', 'ILMN_1751625', 'ILMN_1726114',
'ILMN_1753648', 'ILMN_1779043')
LLnr <- which(colnames(rna) %in% LLmodule)
rna_genenames <- select(illuminaHumanv3.db,
keys = colnames(rna)[LLnr],
keytype = "PROBEID", columns = "SYMBOL")[,2]
name_col <- 1 + sapply( #First sapply loops over column names
X = colnames(metab),
FUN = function(arg){
crossprod(
c(1, 1, 3, 4, 5), # Weights to be used as categories
sapply(c("VLDL", "LDL", "IDL", "HDL","FA"), # metabolite classes
function(arg2){grepl(arg2, arg)} # compare class of metabolites
)
)
}
)
name_col <- factor(name_col,
levels = c(3,2,4:6,1),
labels = c("VLDL", "LDL", "IDL", "HDL","FA","Other"))
# alpmetab <- loadings(fit, "Yjoint", 1:2) %>% # Retreive loadings
# abs %>% # Absolute loading values for positive weights
# rowSums %>% # Sum over the components
# sqrt + (name_col!="Other") # Take square root
######### Plot loadings with OmicsPLS plot method ###
p_metab <- plot(fit, loading_name="Yj", i=1, j=2, label="c", # Plot the loadings
alpha=0) + # set points to be 100% transparant
##################### Add all layers ###
theme_bw() +
coord_fixed(ratio = 1, xlim=c(-.2,.2),ylim=c(-.2,.2)) +
geom_point( # Set color and size
aes(col=name_col, size = I(1+(name_col%in%c("VLDL","HDL"))),
shape = name_col),show.legend = T) +
theme(legend.position="right") +
scale_color_discrete(name="Metabolite\nGroup",
labels=c("VLDL", "LDL", "IDL", "HDL","FA","Other")) +
guides(size=F) + scale_shape_discrete(name="Metabolite\nGroup",
labels=c("VLDL", "LDL", "IDL", "HDL","FA","Other")) +
scale_shape_manual(name="Metabolite\nGroup", values=c(15,3,4,17,5,6)) +
labs(title = "Metabolite joint loadings",
x = "First Joint Loadings", y = "Second Joint Loadings") +
theme(plot.title = element_text(face='bold'),
legend.title=element_text(face='bold')) +
geom_hline(yintercept = 0) + geom_vline(xintercept = 0)
alprna <- loadings(fit, "Xjoint", 1:2) %>% raise_to_power(2) %>% rowSums
alprna[-(order(alprna,decreasing=T)[1:10])] = 0
alprna <- sign(alprna)
toprna <- which(alprna>0)
names_rna <- mapIds(illuminaHumanv3.db,
keys = colnames(rna)[toprna],
keytype = "PROBEID",
column = "SYMBOL",
multiVals = 'first')
names_rna[which(is.na(names_rna))] <- "?"
######### Plot loadings with OmicsPLS plot method ###
p_rna <- ggplot(data.frame(x = fit$W.[, 1], y = fit$W.[, 2]),
aes(x = x, y = y),
alpha = alprna,
aes(label = NA)) +
##################### Add all layers ###
theme_bw() +
coord_fixed(.8, c(-.15,.15),c(-.15,.15)) +
geom_point(alpha = 0.5, col = 'grey') +
geom_point(data = data.frame(x=fit$W.[LLnr,1],y=fit$W.[LLnr,2]),
shape = 2, col = 2, size = 2) +
geom_text(data = data.frame(x=fit$W.[toprna,1],y=fit$W.[toprna,2]),
hjust = rep(c(1, 0), length.out = length(toprna)),
aes(label = names_rna)) +
labs(title = "Transcript joint loadings",
x = "First Joint Loadings", y = "Second Joint Loadings") +
theme(plot.title = element_text(face='bold')) +
geom_hline(yintercept = 0) + geom_vline(xintercept = 0)
## Finally plot both plots in one figure.
grid.arrange(p_metab, p_rna, ncol=2)
# The first component is interpreted as the VLDL component. The second
# component is more or less the HDL vs VLDL component. The corresponding
# genes in the second component seem to be involved in the immune system,
# especially HLA-DRB5 and DEFA1. This indicates that HDL vs VLDL
# concentrations are linked to immunology.


#import <MFInAppPurchaseManager.h>
- Author
- Jakub Darowski
A class for the integration of in-app purchases into a TVML tvOS app. It must implement the MFInAppPurchaseManagerJavaScriptMethods protocol defined above.
| - (instancetype _Nonnull) initWithProductIDs: |
|
(nonnull NSArray*) |
productIDs |
|
- Author
- Jakub Darowski
Initialises the manager with given product IDs.
- Parameters
-
| productIDs | An array of product IDs. |
- Returns
- Initalised object.
| - (NSMutableDictionary<NSString*, SKProduct*>*) _availableProducts |
|
protected |
- Author
- Jakub Darowski
Available SKProducts, retrieved from the App Store.
| - (NSMutableArray<NSDictionary*>*) _errors |
|
protected |
- Author
- Jakub Darowski
Errors accumulated during the lifetime of the purchase manager.
| - (BOOL) _hasBoughtPremium |
|
protected |
- Author
- Jakub Darowski
States if the user has premium.
| - (NSArray<NSString*>*) _productIDs |
|
protected |
- Author
- Jakub Darowski
Product IDs defined in iTunes Connect
| - (BOOL) _productRequestWasMade |
|
protected |
- Author
- Jakub Darowski
States if the product request was already made.
| - (NSArray<SKProduct*>*) _products |
|
protected |
- Author
- Jakub Darowski
- Deprecated:
- since 1.1, use _availableProducts instead
SKProducts retrieved from the App Store.
| - (BOOL) _productsHaveBeenRestored |
|
protected |
- Author
- Jakub Darowski
States if a restore has been performed.
| - (NSMutableArray<NSString* >*) _purchasedProducts |
|
protected |
- Author
- Jakub Darowski
The products the user has already purchased.
| - (NSMutableArray<SKProductsRequest*>*) _requests |
|
protected |
- Author
- Jakub Darowski
A place to ensure the requests are being retain. This proved to be very important!
| - (BOOL) _transactionInProgress |
|
protected |
- Author
- Jakub Darowski
States if there is a transaction in progress.
The documentation for this class was generated from the following files:
- /Users/jdarowski/Developer/mf-github/MFINAppPurchaseManager/src/MFInAppPurchaseManager.h
- /Users/jdarowski/Developer/mf-github/MFINAppPurchaseManager/src/MFInAppPurchaseManager.m


Jacobi Calculator
Made by: Marco Antonio
a
11
a
21
a
31
a
12
a
22
a
32
a
13
a
23
a
33
b
1
b
2
b
3
Tolerancia


|
cocoOS
4.1.0
|
Go to the source code of this file.
Introduction
cocoOS is a free, open source, cooperative task scheduler, based on coroutines.
Task procedures scheduled by cooperative kernels are so called RTC's, run to completion tasks. They execute from the first line of the procedure to the last line. The use of coroutines enables us to implement task procedures that does not have to execute all the way down to the last line of code. Instead execution can end in the middle e.g waiting for a semaphore to be released. When execution is resumed, it continues at that line.
With coroutines, this can be done without having to save the complete task context when switching to another task. Also, task procedures can be outlined in the same style as when using a traditional preemptive RTOS.
cocoOS is extremely portable to any target which makes it a perfect choice during early phases of the development when which OS to use is still an open issue.
Getting Started
Configuration
To setup cocoOS you have to define 4 constants in os_defines.h. These are:
Allowed range for these constants is 0-254. These constants sets the maximum value for the number of used ojects of the specified types. It is allowed to use fewer but not more number of objects. To save RAM it is recommended to keep these values as low as possible.
You should also define the Mem_t to the correct size, i.e the address size of your target. For instance, on a 32 bit system: typedef uint32_t Mem_t;
System setup - application main function
As usual you have to setup your system, ports, clocks etc in the beginning of your main function. After setting up the system, you start the OS setup by calling os_init() and then create all tasks, semaphores and events. Finally you places a call to os_start() and the application starts.
This is the preferred order of initialization. It is crucial that the clock tick is not started before the tasks are created and the kernel is initialized. The os_start() calls the macro os_enable_interrupts() which can be defined to start the clock tick driving the OS.
Time
cocoOS keeps track of time by counting ticks and you must feed the counting with a call to os_tick() periodically from the clock tick ISR.
A system of one main clock and several sub clocks is used in cocoOS. The main clock is typically realized using one of the hardware timers within your target microcontroller which calls the os_tick() function that decrements the timers used for task_wait(), msg_post_in() and msg_post_every(). If your application does not need more than a single time base, the main clock fed by the os_tick() call is all you need.
In case your application has to react to events in another time resolution than what is provided by the main clock, you can use the sub clocks. The sub clocks are typically not associated with a hardware timer, but is instead "ticked" by calling os_sub_tick(id) from within your application code.
Sub clocks can also be advanced with a step greater than one using os_sub_nTick(id, nTicks). There is one task function associated with the sub clocks: task_wait_id(id,ticks). id is a value in the range 1-255 assigned by the application, and ticks is the number of ticks to wait. An example of the use of sub clocks could be a task that should be run after 64 bytes has been received on the UART. The task starts the wait by calling task_wait_id( 1, 64 ). And in the UART rx ISR os_sub_tick(1) is called for each received character.
Tasks
An application is built up by a number of tasks. Each task is a associated with a (preferably short) procedure with a well defined purpose. The execution of the tasks, is managed by the os kernel, by letting the highest priority task among all execution ready tasks to execute. All tasks have to make at least one blocking call to a sheduling kernel function. This gives lower priority tasks a chance to execute.
The task procedure must enclose its code with the task_open() and task_close() macros, as shown below.
Such a task will be executed once only. If a task is intended to be executed "for ever", an endless loop must be implemented.
Scheduling
When a task has finished it gives the CPU control to another task by calling one of the scheduling macros:
- task_wait() - event_wait() - event_wait_timeout() - event_wait_multiple() - event_signal() - sem_wait() - sem_signal() - msg_post() - msg_post_in() - msg_post_every() - msg_receive()
Normally the scheduler will give the cpu to the highest priority task ready for execution. It is possible to choose a round robin scheduling algorithm by putting the following line in os_defines.h:
#define ROUND_ROBIN
This will make the scheduler to scan the list of tasks and run the next found task in the ready state.


Select the vehicle type for the race you want to create: (Select on the menu before clicking next)
Time of the race :
Id of the race :
Select the weather you want: (select on the menu before clicking next)
Default Vehicle Hash
Adding Y at respawn : (more fore airplane,helicopter to avoid spawning under ground)
CheckpointHash:
ChekpointType(0 is wingsuit and 1 vehicle):
PoiType:
GhostPoiType:
Nitroenabled: (select on the menu before clicking next)
Is you're race multiplepath allowed ?
Go at the position you want the starting point and press the StartingPoint button or press "G"
Press "C" to add a Checkpoint


{% if game.ended %}
{% include "small/player_small.html" with id=game.player1.pk name=game.player1.name color=game.player1_badge only %}
{% else %}
{% include "small/player_small.html" with id=game.player1.pk name=game.player1.name only %}
{% endif %}
{{ game.score1 }} : {{ game.score2 }}
{% if game.ended %}
{% include "small/player_small.html" with id=game.player2.pk name=game.player2.name color=game.player2_badge only %}
{% else %}
{% include "small/player_small.html" with id=game.player2.pk name=game.player2.name only %}
{% endif %}


I’ve been practicing up on some algorithms with Go per my Resolutions for 2018 item “Write More Code, Build Patterns, Algorithms”. Here’s a few of the ones I took a quick review of, from the algorithm perspective.
The first algorithm I took a dive into is a big sum problem. Part of the reason is I wanted a refresher on how Go deals with various integer data types. Easier to set it to memory if I play around with the data types versus just simply reading up on the specifics.
Big Sum!
Imagine being given an array of integers of size N. The task is to get the sum of the elements of the array and print each sum out. The added caveat is that each of the integers may be large.
Input & Sample Input
The first line of the input consists of an integer N. The next line contains N space-seperated integers in the array. Sample input would look something like this.
3
1230983459<PHONE_NUMBER>5<PHONE_NUMBER>
or
6
982734503<PHONE_NUMBER> 100032400<PHONE_NUMBER> 701346892<PHONE_NUMBER>
Output & Sample Output
Print a single value equal to the sum of the elements in the array.
Sample output for the first example input.
93812893818
Sample output for the second example input.
16270034027
The Solution
Alright. Down to the task. The first thing I’ll need is to setup getting the input into the application, a little standard input. For that I’ll need to use the standard Go “fmt” library. In my main.go file I go ahead and create the start of the code.
package main
import (
"fmt"
)
Next I’ll write up the input for the index count, which is the first value passed in.
func main() {
var arraySizeCount int64
_, err := fmt.Scanf("%d", &arraySizeCount)
}
Now that I know the size of the array of data I’ll be scraping up, I’ll setup the array to put that data in. I’ll add the next line of code just below the previous additions.
data := make([]int64, arraySizeCount)
With data now setup as the array I’ll need, I can step through the data that is retreived from input and put values in the array.
for i := range data {
_, err = fmt.Scanf("%d", &data[i])
}
Next I’ll need a variable for the total sum of the values in the array. I’ll create that and then also step through the range of values in the array, adding them while I go.
var totalSum int64 = 0
for _, v := range data {
totalSum += v
}
The final step involves an error catch, I’ll print out the error, then display the value of the sum. That solves the algorithm in a short bit of code.
if err != nil {
fmt.Print(err)
}
fmt.Printf("%d\n", totalSum)
All of the code together only amounts to 29 lines of code. One additional thing I could do, that might make it more readable is to break out the input phase and output phase of the function. The code currently looks like this.
package main
import (
"fmt"
)
func main() {
var arraySizeCount int64
_, err := fmt.Scanf("%d", &arraySizeCount)
data := make([]int64, arraySizeCount)
for i := range data {
_, err = fmt.Scanf("%d", &data[i])
}
var totalSum int64 = 0
for _, v := range data {
totalSum += v
}
if err != nil {
fmt.Print(err)
}
fmt.Printf("%d\n", totalSum)
}
A Refactoring?
As I start to refactor this code, as I mentioned, the existing code is only 29 lines of code. But I’m going to break it out into two functions; I’ll call one SumTotal
and one DataRead
. My SumTotal
function will take a list of 64 bit integer data types and return a single total 64 bit integer.
func SumTotal(list []int64) int64 {
var totalSum int64 = 0
for _, v := range list {
totalSum += v
}
return totalSum
}
The DataRead
function will have a 64 integer paramter and an error result. The function definition will look like func DataRead() ([]int64, error) {}
. The function itself I’ll have take in and get the input and also have it build the array. I get to work on that and pull the functionality out of the existing 29 lines of code into the function, which I end up with a function that looks like this.
func DataRead() ([]int64, error) {
var length int64
_, err := fmt.Scanf("%d", &length)
if err != nil {
return nil, err
}
data := make([]int64, length)
for i := range data {
_, err := fmt.Scanf("%d", &data[i])
if err != nil {
return nil, err
}
}
return data, nil
}
Now I just go ahead and wipe out what is in the main
function of the code and replace it with the few lines to call the respective input, and lass it to the respective processor and finalize that by printing out the results.
func main() {
data, err := DataRead()
if err != nil {
fmt.Print(err)
}
fmt.Printf("%d\n", SumTotal(data))
}
Now the whole file of code looks like this, which leaves one with a few questions.
package main
import (
"fmt"
)
func main() {
data, err := DataRead()
if err != nil {
fmt.Print(err)
}
fmt.Printf("%d\n", SumTotal(data))
}
func SumTotal(list []int64) int64 {
var totalSum int64 = 0
for _, v := range list {
totalSum += v
}
return totalSum
}
func DataRead() ([]int64, error) {
var length int64
_, err := fmt.Scanf("%d", &length)
if err != nil {
return nil, err
}
data := make([]int64, length)
for i := range data {
_, err := fmt.Scanf("%d", &data[i])
if err != nil {
return nil, err
}
}
return data, nil
}
Both of the solutions work and provide the desired result. However, one is refactored into input and output functions, with the main function minimized. In this particular situation does it even matter? One might say it’s good to practice refactoring, but in the end did the refactored solution end up better in some way? I could argue that the latter is easier to read. I could say that the first solution was easier to read, since it was so much shorter. The argument could fall either way, but in the end it’s a quick, simple, introductory algorithm and some simple refactoring.
If you’ve got a quick second, ping me @Adron if you’ve got suggestions, other refactoring, or other thoughts about this algorithm. I’m always open to a critical editorialization.
In the meantime, happy hacking!
References: The repository for this code I’ve written here is available on Github @ algorithms-101-a-big-sum


The RLL User Guide section is concerned with what the application programmer has to do to make use of the RLL system. It looks at the system from the perspective of a C application programmer, but similar considerations would apply to using the RLL system from any other compiled language that has RLL support implemented for it.
The first point to make is that from the perspective of the C application programmer, no complicated tricks have to be used to make use of a RLL library that has been provided by someone else. You write your program just as you would normally. The only differences are:
#define RLL_LIBS
#include
statements to bring in system
headers, or by using the CC runtime option
-DRLL_LIBS
It is expected that most users will opt for the second of these approaches as it makes it easy to switch between static linking without using RLLs and dynamic linking using RLLs.
Having said that, many of the standard system include files need the
pre-processor symbol RLL_LIBS
defined if you want to use
RLL versions of standard library routines. This can be specified by
using the command line option
-DRLLLIBS
In practise one normally does this indirectly by passing an appropriate command line option to the CC front-end program as discussed later.
To use the RLL system you need LD v2.0 or later. The LDLD linker is supplied as part of the C68 C ompilation system for QDOS, although it is quite capable of being used independently of the C68 system.
When you are using RLL libraries the linker needs to be told that you are using such libraries. This is done vy using command line options of the form
-r???
lib
to the start, and _rll
to the
end in a manner that is analogous to use of the -l
parameter when linking without using RLLs.
Thus a command line option of-rm
LIBM_RLL
which is
the RLL equivalent of the LIBM_A
library.
In practise one normally does this indirectly by passing an appropriate command line option to the CC front-end program as discussed later.
To simplify it even further for the user,
the CC front-end program will recognise the
-DRLL_LIBS
option to the pre-processor or any
-r???
option to the linker, and automatically generate
the instructions to the LD linker that tell it to use
the LIBC_RLL library (which is the RLL equivalent to the standard
C library LIBC_A). This is very akin to the way that the LIBC_A
library is included by default for standard user programs that
are statically linked to not use RLLs.
Not all routines that are available in the standard C68 libraries have equivalents in the RLL versions of the same libraries. Therefore to play safe, you should include both the RLL and standard variants of the libraries. The RLL version should precede the standard version of any library. The LD linker will then select the RLL versions of the routines where they exist, and the standard ones where they do not.
The corollary to this is that use of the RLL system is ALWAYS optional. If you want to use RLL libraries, then you explicitly tell the system to produce a version of your program that is to make use of RLL libraries. If you do not do this, the default action will be to produce a version of the program that has all the necessary libraries routine statically linked in so that the resultant program can be run independently of the RLL system.
As an example, if you were going to build a program that needed routines from both the maths libraries and the standard C library you would used parameters of the form:
-rm -lm -rc
-rc
parameter from the above if you are
using the CC front-end and have used the _DRLL_LIBS option as
CC will then would automatically search the standard C libraries
- searching the RLL version before the non-RLL version when building
a RLL enabled program.
It is worth emphasising that once a program has been linked to use the RLL system, there are number of components that will need to be present at runtime for it to work correctly. These are:
For those who do not already have THING support via one of the above software components, the file THING_REXT that is supplied with the C68 system can be used to fulfil this purpose. If you are not sure how to load such a file, look at the sample BOOT file provided on the C68 RUNTIME 2 disk which shows a suitable example.


Kijana Wamalwa's Son Dies
by Michael MusyokaThe son to the late Vice President Michael Kijana Wamalwa has died.
According to reports, William Makali Wamalwa Senior passed on Sunday, December 8, at their Milimani home in Kitale, Trans Nzoia County.
Confirming his passing, Robert Wamalwa revealed that his nephew was diabetic and the condition was the likely cause of his demise.
"My nephew was diabetic and probably that might have led to his death but, of course, [when] the official autopsy report [is out] we will be able to know what happened," Wamalwa as quoted by the Nation.
Robert further addressed reports on social media that William had passed due to depression, alcoholism and drug abuse.
"It is far from the truth. It really very unfair and people should not capitalise on something like that. They should have a sense of decorum and respect to the family and the dead," he conveyed.
William was a second-year student at the University of Nairobi at the time of his death.


It is not uncommon for transport costs to account for 10% of the total cost of a defense products so lowering transportation costs can create a competitive advantage.
There are numerous means for Mississippi defense companies to reduce their transportations costs.
The Port of Gulfport is a Strategic Port, as designated by the DOD, and serves as one of only 17 such ports in the entire US. With a close working relationship with the Defense Logistics Agency (DLA).
Foreign-Trade Zones (FTZ) are secure areas under U.S. Customs and Border Protection (CBP) supervision that are generally considered outside US territory upon activation. They help encourage activity and value-added at U.S. facilities in competition with foreign alternatives by allowing delayed or reduced duty payments on foreign merchandise, as well as other savings. Defense contractors who utilize imported component or export, should evaluate whether they can save costs through relief from inverted tariffs, duty exemption on re-exports, duty elimination on waste, scrap, and yield loss, or duty deferral. There are 4 FTZs and 45 subzones in Mississippi.
The University of Southern Mississippi's Center for Logistics, Trade and Transportation (CLTT) provides valuable professional development and applied research for the growing transportation and supply chain industry. One of its missions is to network government, industry, and the military and is active in the Transportation Research Board (AT035) Military Transportation Committee.
Resources:
Foreign Trade Zones in MS


Class: Aws::Route53::Types::AliasTarget
| Inherits: |
Struct
|
| Defined in: |
(unknown) |
Overview
Alias resource record sets only: Information about the CloudFront distribution, ELB load balancer, Amazon S3 bucket, or Amazon Route 53 resource record set to which you are routing traffic.
If you're creating resource record sets for a private hosted zone, note the following:
- You can create alias resource record sets only for Amazon Route 53 resource record sets in the same private hosted zone. Creating alias resource record sets for CloudFront distributions, ELB load balancers, and Amazon S3 buckets is not supported.
- You can't create alias resource record sets for failover, geolocation, or latency resource record sets in a private hosted zone.
Returned by:
Note: When passingAliasTarget
as input to a Client method, you can use a vanilla Hash
:
{
hosted_zone_id: "ResourceId", # required
dns_name: "DNSName", # required
evaluate_target_health: false, # required
}
Instance Attribute Summary collapse
-
#dns_name ⇒ String
Alias resource record sets only: The external DNS name associated with the AWS Resource.
-
#evaluate_target_health ⇒ Boolean
Alias resource record sets only: If you set the value of
EvaluateTargetHealth
totrue
for the resource record set or sets in an alias, weighted alias, latency alias, or failover alias resource record set, and if you specify a value forHealthCheckId
for every resource record set that is referenced by these alias resource record sets, the alias resource record sets inherit the health of the referenced resource record sets. -
#hosted_zone_id ⇒ String
Alias resource record sets only: The value you use depends on where you want to route queries:
Instance Attribute Details
#dns_name ⇒ String
Alias resource record sets only: The external DNS name associated with the AWS Resource. The value that you specify depends on where you want to route queries:
- A CloudFront distribution: Specify the domain name that CloudFront
assigned when you created your distribution. Your CloudFront
distribution must include an alternate domain name that matches the
name of the resource record set. For example, if the name of the
resource record set is
acme.example.com
, your CloudFront distribution must includeacme.example.com
as one of the alternate domain names. For more information, see Using Alternate Domain Names (CNAMEs) in the Amazon CloudFront Developer Guide. - An ELB load balancer: Specify the DNS name associated with the
load balancer. You can get the DNS name by using the AWS Management
Console, the ELB API, or the AWS CLI. Use the same method to get
values for
HostedZoneId
andDNSName
. If you get one value from the console and the other value from the API or the CLI, creating the resource record set will fail. - An Elastic Beanstalk environment: Specify the CNAME attribute for the environment. (The environment must have a regionalized domain name.)
- An Amazon S3 bucket that is configured as a static website:
Specify the domain name of the Amazon S3 website endpoint in which you
created the bucket; for example,
s3-website-us-east-1.amazonaws.com
. For more information about valid values, see the table Amazon Simple Storage Service (S3) Website Endpoints in the Amazon Web Services General Reference. For more information about using Amazon S3 buckets for websites, see Hosting a Static Website on Amazon S3 in the Amazon Simple Storage Service Developer Guide. - Another Amazon Route 53 resource record set: Specify the value of
the
Name
element for a resource record set in the current hosted zone.
#evaluate_target_health ⇒ Boolean
Alias resource record sets only: If you set the value of
EvaluateTargetHealth
to true
for the resource record set or sets in
an alias, weighted alias, latency alias, or failover alias resource
record set, and if you specify a value for HealthCheckId
for every
resource record set that is referenced by these alias resource record
sets, the alias resource record sets inherit the health of the
referenced resource record sets.
In this configuration, when Amazon Route 53 receives a DNS query for an alias resource record set:
- Amazon Route 53 looks at the resource record sets that are referenced by the alias resource record sets to determine which health checks they\'re using.
- Amazon Route 53 checks the current status of each health check. (Amazon Route 53 periodically checks the health of the endpoint that is specified in a health check; it doesn\'t perform the health check when the DNS query arrives.)
- Based on the status of the health checks, Amazon Route 53 determines which resource record sets are healthy. Unhealthy resource record sets are immediately removed from consideration. In addition, if all of the resource record sets that are referenced by an alias resource record set are unhealthy, that alias resource record set also is immediately removed from consideration.
- Based on the configuration of the alias resource record sets (weighted alias or latency alias, for example) and the configuration of the resource record sets that they reference, Amazon Route 53 chooses a resource record set from the healthy resource record sets, and responds to the query.
Note the following:
- You cannot set
EvaluateTargetHealth
to true when the alias target is a CloudFront distribution. - If the AWS resource that you specify in
AliasTarget
is a resource record set or a group of resource record sets (for example, a group of weighted resource record sets), but it is not another alias resource record set, we recommend that you associate a health check with all of the resource record sets in the alias target. - If you specify an ELB load balancer in
AliasTarget
, Elastic Load Balancing routes queries only to the healthy Amazon EC2 instances that are registered with the load balancer. If no Amazon EC2 instances are healthy or if the load balancer itself is unhealthy, and ifEvaluateTargetHealth
istrue
for the corresponding alias resource record set, Amazon Route 53 routes queries to other resources. - When you create a load balancer, you configure settings for Elastic Load Balancing health checks; they\'re not Amazon Route 53 health checks, but they perform a similar function. Do not create Amazon Route 53 health checks for the Amazon EC2 instances that you register with an ELB load balancer. For more information, see How Health Checks Work in More Complex Amazon Route 53 Configurations in the Amazon Route 53 Developer Guide.
We recommend that you set EvaluateTargetHealth
to true
only when you
have enough idle capacity to handle the failure of one or more
endpoints.
For more information and examples, see Amazon Route 53 Health Checks and DNS Failover in the Amazon Route 53 Developer Guide.
#hosted_zone_id ⇒ String
Alias resource record sets only: The value you use depends on where you want to route queries:
- A CloudFront distribution: Specify
Z2FDTNDATAQYW2
. - An ELB load balancer: Specify the value of the hosted zone ID for the
load balancer. You can get the hosted zone ID by using the AWS
Management Console, the ELB API, or the AWS CLI. Use the same method
to get values for
HostedZoneId
andDNSName
. If you get one value from the console and the other value from the API or the CLI, creating the resource record set will fail. - An Amazon S3 bucket that is configured as a static website: Specify the hosted zone ID for the Amazon S3 website endpoint in which you created the bucket. For more information about valid values, see the table Amazon Simple Storage Service (S3) Website Endpoints in the Amazon Web Services General Reference.
- Another Amazon Route 53 resource record set in your hosted zone: Specify the hosted zone ID of your hosted zone. (An alias resource record set cannot reference a resource record set in a different hosted zone.)


@composi/core:
Lifecycle
Component Lifecycle Hooks
With Composi, functional components have three lifecycle hooks that you can access:
Lifecycle hooks let you accomplish tasks specific to the current moment in the component's life. They also let you create animations when the state of a component changes.
onmount
The onmount
lifecycle hook gets fired right after the component is mounted in the DOM. It takes a callback whose first argument is the base element of the component. This lets you do some useful things, such as accessing the child elements of the component, or setting up event listeners and delegated events.
In the documentation for props and events we saw how to create a list. Now we are going to look at how to add items to the list. To do that we need to have an input where the user can add a new item, and a button to click to add that item to the list. The onmount
hook gives is a way to access the component's input to get its value. So, let's do this. Here's how we make a dynamic list. We've updated it by wrapping the list in a div
which has two children, the list and a paragraph with a text input and a button.
Accessing the Component's DOM
In order to access the component's input, we need to add a onmount
lifecycle hook. We put it directly on the input. That way the onmount
hook gets a reference to the input element. Then we can store that reference on our refs
object for easy access in the component's code.
We're also adding onmount
hooks onto the list items with the sole purpose of animating them as they are created. Add new list items to see the animation.
See the Pen @composi/core - Lifecycle-1 by Robert Biggs (@rbiggs) on CodePen.
onupdate
Sometimes you may want to know when a component is being updated, like when its props change. You can do that with onupdate
. This hook gets three arguments passed to it: the component's base element, the old props
and the new props
. You can compare any value between the props to see what changed and then do what you need to.
onupdate
is only called when the particular element that it is registered on is being updated. The onupdate
hook is not envoked when the element is mounted or unmounted.
To be able to use onupdate
properly, you need to be aware of what the old and new props are. We pass props to a component when we pass it to the render
function:
render(<List data={fruits}/>, 'body')
We call the attribute data
a prop. However, in this case it will not persist as a prop. That's because the render
function will convert the tag into a function and its props will be pass to the function as arguments. Technically, props are only the values directly attached to the elements that the component function returns. Let's take another look at a List component:
function List({data}) {
function logUpdate(element, oldProps, newProps) {
// compare oldProps with newProps...
}
return (

{
data.map(item =>
{item.value}
)
}

)
}
render(<List data={fruits}/>, 'body')
In the above example, notice that we've place the onupdate
event directly on the component's base element. Then in our logUpdate
function we want to compare the old and new props to see what changes. You might be thinking that we will get the old and new versions of the data
prop. Now look at the element. Do you see any props on it besides onupdate
? That's the problem. The ul
has no props. The fruits data that we want to test is coming in as a parameter and we are using it separately in the script block delimited by curly braces. This means that when we try to access newProps and oldPros, these will be undefined. To enable the onupdate
lifecycle event to access the data, we need to register that data as a prop directly on the element were the lifecycle hook is. Here's the component updated:
function List({data}) {
function logUpdate(element, oldProps, newProps) {
// compare oldProps with newProps...
}
// Attach the data directly on the ul tag:
return (

{
data.map(item =>
{item.value}
)
}

)
}
This subtle change in exposing the data to the update
event means that now we have access to the previous and current state of data
. That means we could compare oldProps.data
with newProps.data
to see what changed.
Always make sure you are exposing the properties you need to on the same element where onupdate
is placed. Otherwise you're values will be undefined.
In this example we show how to use onupdate
to log out the differences between the count value as it
increases and decrease. By using oldProps and newProps, we can see how the value changes and log the difference.
See the Pen @composi/core - update-example by Robert Biggs (@rbiggs) on CodePen.
You might be wondering when you would use update. The use case for it is very limited. It's great if you want to see what props changed, as we did above to log out the changes. You would not use it to change data, as that would trigger another update and put you in an infinite loop. You might use it to add a class that causes an animation, and then remove the class. You could also use it to set focus on an input or other form element.
onunmount
Sometimes when a component is being removed from the DOM you want to be able to know so you can do something. Maybe you need to do some environmental cleanup, or trigger some other event or function. onunmount
lets you do that. In fact, onunmount
lets you intercept the unmounting process and delay it until you are done with whatever it is you need to do. This is great for situations where you want to do an animation when a list item is delete. We'll make a simple list that uses onunmout
to animate the list item before deleting it. For this, we'll leave out the part that actually deletes a list item since we already covered that in the example for event delegation above.
onunmount
expects that its callback will handle a done()
function. Specifically, onunmount
gets passed two arguments: the element being deleted, and a done
callback to invoke when you are done. If you fail to provide a done()
callback in your code or forget to invoke at the end of your code, the element will not be removed from the DOM, which could lead to really unexpected results as the list data is mutated.
In the following example we're using onunmount
to run a keyframe animation before the list item is removed. We've also got an onmount
on the list items to enable animating new list iems into view.
See the Pen @composi/core - Lifecycle-onunmount by Robert Biggs (@rbiggs) on CodePen.
Lifecycle Event Arguments
The lifecycle events get their arguments automatically, so you can just use their plain handlers in the inline event. Each lifecycle event expects different arguments, but you indicate these in the handler, on in the inline event:
function List() {
function init(base) {
// Do something with the component's base element.
base.querySelector('input').focus()
}
function logUpdate(element, oldProps, newProps) {
// Element the onupdate event is on, in this case, the ul tag.
// Compare the oldProp values with the new.
if (newProps.data.length > oldProps.data.length) {
console.log('An item was added to the list.')
} else {
console.log('An item was deleted from the list.')
}
}
function handleUnmount(element, done) {
// Do something with the component base element.
// Trigger deletion animation:
element.classList.add('deleting')
// Then let the component unmount.
// Since we've set the animation to last 3 seconds,
// we need to delay the unmounting for 3 seconds:
setTimeout(() => {
done()
}, 3000)
}
return (

)
}
The thing to be aware about onunmount
, it causes the unmounting to be asynchronous. Even though the patch algorithm has identified a condition that requires the element to be removed from the DOM, it waits to actually do so until you fire done()
in your onunmount
handler.


retro decks
go old school
I'm a paragraph. Click here to add your own text and edit me. It's easy. Just click "Edit Text" or double click me and you can start adding your own content and make changes to the font.
ABOUT US


Basic Usage Example¶
In this example you’ll grasp the basic ideas behind this framework.
We will be injecting dependencies into our BasicUsage
class’s __init__
method
using the @autowired
decorator and the
Autowired
type annotation.
We declare the classes BasicService
and StatefulRepository
as injectables with
the @injectable
decorator to then inject the
StatefulRepository
into the BasicService
which in turn will be injected to the
BasicUsage
example class.
In BasicUsage::run
we illustrate how each injected dependency is a completely
independent instance of other injections. We inject two BasicService
instances and
each one will be injected with a StatefulService
instance. Finally, we set the state
of each service’s repository to demonstrate how they are completely independent.
See also
The Singletons Example shows how to make a dependency to be shared for all injections instead of having the default behavior of independent instances.
from examples import Example
from examples.basic_usage.basic_service import BasicService
from injectable import autowired, Autowired, load_injection_container
class BasicUsage(Example):
@autowired
def __init__(
self,
basic_service: Autowired(BasicService),
another_basic_service: Autowired(BasicService),
):
self.basic_service = basic_service
self.another_basic_service = another_basic_service
def run(self):
print(self.basic_service.get_repository_state())
# None
print(self.another_basic_service.get_repository_state())
# None
self.basic_service.set_repository_state("foo")
self.another_basic_service.set_repository_state("bar")
print(self.basic_service.get_repository_state())
# foo
print(self.another_basic_service.get_repository_state())
# bar
def run_example():
load_injection_container()
example = BasicUsage()
example.run()
if __name__ == "__main__":
run_example()
from examples.basic_usage.stateful_repository import StatefulRepository
from injectable import injectable, autowired, Autowired
@injectable
class BasicService:
@autowired
def __init__(self, repository: Autowired(StatefulRepository)):
self.repository = repository
def set_repository_state(self, state):
self.repository.state = state
def get_repository_state(self):
return self.repository.state
from injectable import injectable
@injectable
class StatefulRepository:
def __init__(self):
self._state = None
@property
def state(self):
return self._state
@state.setter
def state(self, value):
self._state = value