Building Microservices
Designing fine-grained systems
by Sam Newman
This is my personal review of the book.
Microservices
chapter 1
This chapter is an introduction in what Microservices are. It does not contain any surprises compared to other
definition of Microservices. Like the definition of Markus
Eisele and others, Sam Newman tells the reader that
understanding Bounded Context and
Eric Evans book Domain-Driven Design is really important to
create Microservices, in particular to split the services.
A Microservice is small and focused on doing one thing well. Sam Newman mention the Single Responsibility
Principle
like I did in my post about Microservices. Another important characteristic of Microservices is that
they
are autonomous. Therefore it is really important that the services are loosely coupled.
Sam Newman then explains some key benefits of Microservices, like:
Important to understand is, that this benefits do not come for free. It requires a lot of work.
So you should instead think of microservices as a specific approach for SOA in the same way that XP or Scrum
are specific approaches for Agile software development.
I really like this definition, it reminds me of this definition.
Microservices = pragmatic SOA
The underlying concepts of Microservices are not new, but I think it is a lot easier to implement them
now.
Sam Newman give us some other decompositional techniques: Shared libraries and modules.
The Evolutionary Architect
chapter 2
What is a good architect if you implement Microservices? This chapter covers this question.
With Microservices the teams and each software engineer has more power. They can choose the language they like the
most, the architecture inside the service that fits their needs best and so on. But some parts of each service have
to
follow specific rules. The communication between the services should always use the same technology and follow the
same guidelines.
... think of our role more as town planners than architects for the built environment. The role of the town
planner should be familiar to any of you who have played SimCity before. A town planner's role is to look at
a multitude of sources for information, and then attempt to optimize the layout of a city to best suit the
needs of the citizens today, taking into account future use. The way he influences how the city evolves,
though, is interesting. He does not say, "build this specific building there"; instead, he zones a city. So
as in SimCity, you might designate part of your city as an industrial zone, and another part as a
residential zone. It is then up to other people to decide what exact building get created, but there are
restrictions: if you want to build a factory, it will need to be in an industrial zone. Rather than worrying
too much about what happens in one zone, the town planner will instead spend far more time working out how
people and utilities move from one zone to another.
I go one step further and think we need Programmer
Anarachy. The direction is the same.
The decisions are made on three layers.
Strategic goals
Architectural principles
Design and delivery practices
The architectual principles have the goal to fulfill the strategic goals and the design and delivery practices have
the goal to fulfill the architectual principles.
Sam Newman points out the pros and cons of shared libraries multiple times. If you share code in different services
your services are coupled tighter. But if you do not use shared code you have to implement the same functionality in
every service that violates the DRY principle. He also explains the importance of examples. Documentation is good, a
real example that is running in production is better.
How to Model Services
chapter 3
A good service is loosely coupled and has high
cohesion.
There are shared and hidden models. The business have a use case and expect an answer from the system. If you split
up you services there are always models that are hidden in this service. These
models do not have to be published by the system. It is important that you do not make CRUD only services, you
have to target the business use case and distinct between hidden and shared models.
Integration
chapter 4
It is really important to keep the options open. Therefore keep your APIs technology-agnostic. Avoid breaking changes. If you add a field to to an existing data object. The consumers
should not have to change. Avoid database integration at all costs. Make your service simple for consumers. Like I have mentioned in The first Java EE Microservice a good guideline for creating
REST services is this
document. REST is not the only suitable technology. Sam Newman compared REST with RPC and both have pros and
cons, but he strongly consider REST as a good starting point. Hide internal implementation detail.
The differentiation between Orchestration and Choreography was new for me.
With orchestration, we rely on a central brain to guide and drive the process, much like the conductor in a
orchestra. With choreography, we inform each part of the system of its job, and let it work out the details,
like dancers all finding their way and reacting to others around them in a ballet.
Therefore choreography is most of the time a better fit for Microservices. It is more complex than the orchestration
approach but with this additional complexity it is really easy to register a new service to another service. We do
not have to explicit model the connections between the services, it is more like: Please tell me if there is a new
product in our shop that I can publish this product on our website. Otherwise the first service have to know the web
service what lead to tighter coupling.
Choreography fits perfectly with a asynchronous event-based system. This and the previous discussed properties of
Microservices reminds me of the Reactive
Manifesto.
When it comes to versioning Sam Newman mentioned two links:
With semantic versioning, each version number is in the form MAJOR.MINOR.PATCH. When the
MAJOR
number increments, it means that backward incompatible changes have been made. When MINOR
increments, new functionality has been added that should be backward compatible. Finally, a change to PATCH
states that bug fixes have been made to existing functionality.
Sam Newman describes UI Fragment Composition.
The straight forward approach for a frontend would be to call service APIs to get the content of the UI. The
frontend then creates the controls. This can result in tight coupling. For every change always both services have to
be changed and deployed.
UI Fragment Composition means that the service returns parts of the UI directly. This part can
then be directly assembled in the frontend. This could result in dedicated backends for frontends:
Sam Newman gives this good advice for the question: Should I build, or should I buy?
Build if it is unique to what you do, and can be considered a strategic asset; buy if your use of the tool
isn't that special.
I did not use an existing blog framework to make my blog because the creation of this blog with AngularJS,
Bootstrap, Java and so on is a strategic asset for me. :-)
Sam Newman gives an example where he integrated a CRM without loosing the control of the system. He masked the CRM
with own facades.
He also mentioned the Strangler
Pattern.
Splitting the Monolith
chapter 5
The first step to split up a monolith is to identify seams. The term seam comes from the book Working
Effectively with Legacy Code by Michael Feathers. It defines a part of the code that can be changed without
affecting the rest of the code. Therefore bounded contexts are perfect seams.
If you have found some seams you have to check how entangled they are with the rest of the system. Often there is a
single database that is used from everywhere inside the system. The first step that Sam Newman does is to create
separate repository layers for each seam.
The next step is to map the db tables to the corresponding seams. In most cases this table is used by more than just
one seam. That can be solved over an API for each seam. The table get just written by one seam and if another seam
need data from this table it calls the API of this seam and not the db table directly.
Some table are used by nearly all seams. If the content of this table is pretty static you have three options:
duplicate the table for each service
transform the date of this table into a property file and share it
extract this part in its own service
If the content is not static the third option seems to be the only possibility. Another way is to analyze the
shared content. Sometimes an object that is used by many services are too general and each service just needs one
part of this object and another service needs just another part of this object. Then you can split up this table
representation into smaller tables.
Now we have split up the monolith in different services with its own repositories and each repository just
uses its own tables. Therefore we can make an own schema for each repository.
The question is now, how do we release this refactoring? Sam Newman recommends to split up the schemas first and in
a next step to split up the services.
The consequences are when we talk about transactions. In a monolith with one schema you can easily use transactions.
If you split everything up you have to do a lot more to archive a similar behaviour. Most of the time you can life
with eventual consistency.
Rather than using a transactional boundary to ensure that the system is a consistent state when the
transaction completes, instead we accept that the system will get itself into a consistent state at some
point in the future.
Adam Bien often refers to the CAP theorem and
explains that you can have two out of these three, but never all three. What often results in the decision: Would I
have the possibility to scale my system or does the system always have to be consistent. One goal of Microservices
are the saleability therefore I think if you decide to implement Microservices you should life with eventual
consistency the most of your time.
There is the possibility of distributed transactions but they are really hard to implement
correctly and they can limit scalability.
Reporting is always a special field. In a monolithic application it is pretty simple to generate reports. You can
create one query that gives you all your information back from the database. If you have split up your services it
isn't that simple anymore. If you have to call the data form the APIs that can be very slow and makes the service
for the daily business slow too. Sam Newman describes data pumps as a first solution. The services
pushes periodically its data to a central reporting database. The reports can then be produced the same way like
with a monolith. You have one big db with all the needed data.
This system can be extended to event data pumps. If you have an event based system (choreography
over orchestration) then you can send the data that have changed to the reporting database just after the change
happened.
A third approach that is used by Netflix are backup data pumps. If you make backups of your data
anyway you can use this backups for your reporting system. Netflix has open sourced this project too. It is called
Aegisthus.
Deployment
chapter 6
From my point of view automation is the most important aspect of Microservices and software engineering at all. A
good source for further reading and watching is all about continuous integration, continous
deployment, continuous delivery, lean... especially the books from Jez
Humble
Continuous Delivery or Lean Enterprise. There are also some good Youtube videos from Jez
Humble as well. Jez Humble ask the following three questions about CI, to check if you really do CI:
Do you check in to mainline once per day?
Do you have a suite of tests to validate your changes?
When the build is broken, is it the #1 priority of the team to fix it?
If you answer one of these questions with no, you are not doing CI.
The goal of CI is that every change in the source code repository triggers a build of the corresponding service and
its unit tests. It triggers just the pipeline of this service. Therefore you need the possibility to release your
service independently from each other.
When the build and the tests are successful an artifact is created. Then the next stages of the CI
system are triggered, like static code analysis, integration and acceptance tests, manually usability tests, ... I
really like the Pipeline
Plugin from Jenkins. This is a interview and demonstration of the plugin from Thomas
Qvarnstrom and it is really worth to watch.
Sam Newman shows a standard release process model for a build pipeline:
Compile & fast test -> Slow tests -> user acceptance testing -> performance testing -> production
The goal is that we can automate everything and that your deployment environment is as similar to the production
environment as possible but with fast feedback to the developer. Therefore you need some type of virtualization. Sam
Newman mentioned technologies like Chef, Puppet, Vagrant, VMWare, VirtualBox and my favorite Docker. That you can
automate you have to avoid a configuration drift. A configuration drift arises if a dev
or ops is making changes to the environment directly in the program and not in the scripts for the automated set up.
If you avoid a configuration drift you get immutable servers. Immutable servers can easily and fast
be set up with a singe click and no further configuration.
If it comes to the different environments the question arises how to handle environment specific settings like
usernames and passwords or database connections. It is not a good idea to check them into your source system, but it
is also not a good idea to always enter them manually every time. A good approach is to create a property file per
environment or to create a dedicated system for providing configuration. It is important to keep this configuration
to an absolute minimum.
Every service should run in its own host to avoid side effects from the other services. Even better is to divide
your single service further and for example extract the db out in an own host. If you have hundreds of services it
is nearly impossible to do that without virtualization. I think the best solution at the moment is Docker it is amazing fast and easy compared to other virtualization tools.
Testing
chapter 7
Sam Newman introduces this chapter with the definition of the different test scopes. He distinguish between:
A Unit Test tests an isolated small part of the service. These tests are pretty straight forward
with no magic involved.
A Service Test tests the service API. It tests the service isolated of the rest of the system,
without the UI. For the Service Tests we need to stub or mock the other services that get called by this
service.
A End-to-End Test tests a user interaction. What happens when the user fill out this form and then
submits it? Because these tests involve that many moving parts these are very flaky and brittle. It can happen that
these tests are so flaky that sometimes they are green and sometimes they fail. You should limit these tests to a
minimum. Just test general journeys and not every story or every boundary condition. Instead of End-to-End Tests try
to replace them with Consumer-Driven
Tests.
With Consumer-Driven Tests you test other services if they return the expected value for your
service. You define a consumer-driven contract (CDC) and test against this contract. The benefit of these tests
compared with End-to-End Tests are that you have a package of tests. With End-to-End Tests many people and teams are
involved and if a test fails nobody think he is responsible for this failure. An other advantage is that your can
reduce the complexity and therefore the moving parts of the test as well. The tests are less flaky and brittle.
Sam Newman mentioned Pact and Pacto as a testing tool for Consumer-Driven
Tests.
The more you can test with lower complex tests the better. You can archive that when you write a lower complex
test when a high complex test fails. For example an End-to-End Test fails, you found the solution for the problem
and then you write a Service Test for this special case. If a Service Test fails and you have found the solution
write a Unit Test for this special case. If a Unit Test fails you know exactly where the failure happened and you
just have to understand a small amount of lines instead of tracking down the whole system or service. Another
important benefit of low complex test is the fast feedback. The faster you get feedback the more present is the
changed code and you can solve the problem easier.
At the end of the build pipeline there a special kinds of tests, the Performance Tests. You should
pay attention to the same properties for performance tests as to the other kind of tests. Try to test
small parts for performance. If you found a performance issue in a more complex test try to test the cause of the
problem in a smaller test. It is also important to define boundaries for the performance tests, a performance test
that never fail has no value.
Testing after production is as important as pre production tests. Sam Newman mentioned the Mean Time To
Repair (MTTR) and the Mean Time Between Failures (MTBF).
And that reducing the MTTR can be significantly more beneficial than to try to lower MTBF with adding more automated
tests.
If we can spot a problem in production early, and roll back early, we reduce the impact to our costumers. We
can also use techniques like blue/green deployment, where we deploy a new version of our software and test
it in situ prior to directing our users to the new version.
Blue/green deployment labeled a deployment that implies that when we deploy our new service
additionally to the
current running service. Then we can test our new service in our production environment while the production request
still use our current service. If our tests on the new service pass we can redirect the production requests to our
new service and if everything works great terminate the old service.
A really cool release technique is Canary Releasing. Canary Releasing goes a step further than
blue/green deployment. You can deploy the new service and redirect a specific amount of production requests to the
new service. If the the new service runs as expected you can increase the amount of requests for the new service and
at some point redirect all requests to the new service and terminate the old service. This also allows you to make
business tests on the services. With the old service 5% of our customers bought something, with the new service 15%
of our customers bought something. If the result is not satisfying you can redirect the requests to the other
service.
Monitoring
chapter 8
When it comes to monitoring Sam Newman differs between: Single Service, Single Server, this is the simplest starting point. We have one machine to monitor
(CPU, RAM, storage, network) and one service with one log file to monitor. Single Service, Multiple Servers, in this case we let our service run behind a load balancer. We
now have multiple machines and multiple services with multiples log files to monitor. But we still can restrict some
problems, for example if the same failure happens on all services and machines, the possibility is really high that
the error is in the service and not on the machine. If the failure happened on one machine the probability is
high that it is just a problem with this single machine and not with the service implementation.
The hardest scenario to monitor is Multiple Services, Multiple Servers. In this case it is really
hard to find the cause of a problem, it can be anything.
This chapter contains a lot of tool references that help you to consolidate all the log files and allow you to track
metrics across multiple servers.
If you have an event based system and a failure happens, it is really hard to find the root of the problem. Sam
Newman describes the Correlation IDs as possible assistance. A Correlation ID is created for every
new call that is made. This ID get passed to every subsequent call. If now an error happens we can filter our log
files for the Correlation ID and can step upwards the call history.
It is important to consider the audience for the monitoring. Sam Newman gives you three questions you should
consider for your monitoring decision:
What they need to know right now?
What they might want later?
How they like to consume data?
Like mentioned in the testing chapter, monitoring is extremely powerful if you have the right focus. Fred George
mentioned in his talks that he omit acceptance tests, because monitoring with business scope is the best acceptance
test ever. The company does not care if the response time in the new version is some milliseconds worse than before
when the profit increased by 25%.


Prefix for URLs for authentication with GitHub.
Stores the expiry date of the cookie set.
Exported as cookieExpiry
.
Stores the domain name for callback url after successful authentication.
Exported as hostUrl
for callback after GitHub sends code
.
Stores the type of environment of project. It is either development
or
production
.
Exported as nodeEnv
to differentiate behaviour of app on development and
production server.
Stores the pagination size of displaying gists.
Exported as paginationSize
.
Secret used to sign the session ID cookie.
Exported as sessionSecret
to configure cookie creation.
Stores the different types of URLs required for authentication.
Exported as authUrl
for configuring endpoints of authentication.
The URL redirected to after successful authentication with GitHub.
Endpoint to verify if the user is authenticated.
Endpoint for signing out of the back-end service.
Endpoint for signing in with GitHub.
Stores the client ID and client secret of GitHub OAuth application created here.
Exported as githubOauth
for configuring GitHub passport strategy.
Client ID of OAuth application.
Client secret of OAuth application.
Stores redirection URL for successful and failed authentication.
Exported as redirectUrl
for redirections.
The URL redirected to if the user is not logged in.
The URL redirected by this back-end service to homepage.
Generated using TypeDoc
OAuth strategy to authenticate with GitHub. Reference: http://www.passportjs.org/packages/passport-github2/


JGroups is a toolkit for reliable group communication. Processes
can join a group, send messages to all members or single members, and
receive messages from members in the group. The system keeps track of
the members in every group, and notifies group members when a new
member joins, or an existing member leaves or crashes. A group is
identified by its name. Groups do not have to be created explicitly;
when a process joins a non-existing group, that group will be created
automatically. Member processes of a group can be located on the same
host, within the same LAN, or across a WAN. A member can be part of
multiple groups.


--- layout: page title: About --- Electrical Engineer → Web Developer.
Kelly Ripple is a Software Engineer living and working in Northern Virginia. Originally from Maryland, she pursued her passion for technology by getting a degree in Electrical Engineering in from The University of Maryland. After a few years in the workforce she decided to wholeheartedly pursue a career in web development by attending Dev Bootcamp in NYC. There she designed and developed a bunch of projects individually and on agile development teams. Check out her current and past projects here.
In her free time she enjoys hot yoga at her favorite studio and Netflix marathons. She occasionally codes for her dinner at local Hackathons. She most recently attended Technica 2015 where her team's hack MoodRing won "Most Innovative Use of Web Technologies."
Follow her on Twitter, or check her out on Github or Linkedin. Her resume can be found here.


Trustbloc Bank
Menu
CONGRATULATIONS
Your credit card application is successfully approved.
Your will receive your new credit card in your mail in 5-7 business days.


Our mission is to provide the most high quality, delicious, and healthy products
while showing the individual love and care that each animal deserves.
Quality is paramount and we personally stand behind our products.
We are committed to growing a relationship with our customers and educating the next generation in
responsible agriculture.
Our hearts are set on sustainability and creative green innovation that eliminates waste.
Pickup Wednesdays 3PM - 8PM and Sunday 1PM-4PM.
12502 Maverick Court, Tampa, FL, 33626
NOTE: Please follow our social distancing guidelines!
Pickup by preorders only Saturday 10AM - 12PM.
532 3rd Street North, St. Pete, FL 33701
NOTE: There are multiple locations associated with Tampa Bay Markets:
Fresh Market at Hyde Park Village on the first Sunday of each month from 10am-3pm
Seminole Heights Sunday Morning Market October through April, 2nd Sunday of the Month from 10am-2pm
NOTE: Currently closed due to COVID-19. We will be returning once we are able to do so.
See our Dairy & Egg and Soaps & Shampoos product lists
We are excited to announce that we have launched our online soap store. Get the same soaps you know and love delivered right to your door.
Visit our online store to order our hand made soap anywhere in the contiguous US!
Dancing Goat SoapsOur preferred method of communication is by email. If you have any questions or would like to place orders, please email us!


{% extends "base.html" %} {% block content %} {% if validlink %}
Please enter (and confirm) your new password.
{% else %}The password reset link was invalid, possibly because it has already been used. Please request a new password reset.
{% endif %} {% endblock %}


Love Mud Do: McCartney to headline 50th Glastonbury Festival
LONDON, Nov 19 — Former Beatle Paul McCartney will headline Glastonbury Festival, the pinnacle of Britain’s pop music calendar, for its 50th anniversary next year, organisers said yesterday.
The 77-year-old last played the festival’s famous Pyramid Stage in 2004.
“Having Paul McCartney coming back to headline the Pyramid next year is an absolute dream come true. There really was no one that we wanted more for the 50th anniversary,” said Glastonbury co-organiser Emily Eavis.
McCartney, who will play the Saturday night slot on June 27, said he was excited to be part of the anniversary celebrations.
“See ya next summer!” he tweeted.
Famed for its left-wing ethos and often mud-soaked surroundings, Glastonbury Festival started in 1970, the same year the Beatles split up.
Founder Michael Eavis has said one of his biggest regrets was turning down another ex-Beatle, guitarist George Harrison, when he had the chance to book him for Glastonbury a few years before he died in 2001.
Tickets for the 2020 event went on sale in October and were sold out in just over half an hour, according to the festival’s website.
Glastonbury Festival was founded by dairy farmer Eavis, 83, and his late wife Jean in 1970, after they were inspired by the Bath Festival of Blues.
Marc Bolan played the first event, which had an entry charge of 1 pound with free milk included. — Reuters


Radio Group With Radio Buttons Passed as Content Projection
Radio group is created from platform radio buttons. which is passed as content projection
Radio Group Creates Radio Buttons With List of String Values
Creating platform radio buttons with list of string values
Radio Button Group Creates Platform Radio Buttons With List of Objects
Creating platform radio buttons with list of Object. This object can be of type SelectItem or any other class
object.
For any unknown object, we have to assign lookupKey and displayKey to work as radio value and label respectively
Creating Disabled Radio Buttons in Radio Group.
Creating disabled radio buttons is possible when radio buttons are passed as content or created with a list of
values.One or more radio buttons can either be in a disabled or enabled state


Web Client 1.2 by 3Dip.es.tl
warning
LED
Messager
Crane
This client needs a key to use
Loading Target..
error_outline


I love yoga, cats, writing snail-mail letters and puzzles. I like to keep myself busy; usually I am always doing some sort of volunteer work on the side whether it is teaching computer science to kids, trying to inspire other women in STEM or organizing hackathons. Recently I made an extensive resume guide for new grads.
I also do hardware and IoT projects on the side. My favourite project was rigging up an old rotary phone to call on my cell phone. Most recently I was very honoured to be a Hardware Track Reviewer for the Grace Hopper Celebration. I am looking forward to impacting companies with my various technical, mentorship and organizational qualities.


Heading
Scenester meggings forage narwhal YOLO intelligentsia. Organic try-hard scenester put a bird on it vinyl. Post-ironic sriracha viral, synth raw denim bicycle rights odd future.
Literally occupy cliche echo park. 90's art party mcsweeney's truffaut, twee literally keffiyeh tonx trust fund gentrify irony bicycle rights semiotics intelligentsia keytar. Meggings put a bird on it semiotics selvage, bushwick blog tofu intelligentsia 90's ethnic. Tattooed small batch street art fixie pop-up mixtape, pug jean shorts plaid wolf try-hard chillwave aesthetic. Pug street art whatever jean shorts salvia farm-to-table, seitan trust fund PBR kale chips leggings master cleanse flexitarian thundercats. Fanny pack chambray forage, echo park pinterest jean shorts salvia four loko 8-bit street art. Blog leggings mixtape, readymade hoodie VHS yr pinterest organic.
Heading
Butcher cliche odd future, flexitarian salvia bushwick occupy flannel cray semiotics. DIY pinterest american apparel, try-hard kale chips readymade twee butcher.
Literally occupy cliche echo park. 90's art party mcsweeney's truffaut, twee literally keffiyeh tonx trust fund gentrify irony bicycle rights semiotics intelligentsia keytar. Meggings put a bird on it semiotics selvage, bushwick blog tofu intelligentsia 90's ethnic. Tattooed small batch street art fixie pop-up mixtape, pug jean shorts plaid wolf try-hard chillwave aesthetic. Pug street art whatever jean shorts salvia farm-to-table, seitan trust fund PBR kale chips leggings master cleanse flexitarian thundercats. Fanny pack chambray forage, echo park pinterest jean shorts salvia four loko 8-bit street art. Blog leggings mixtape, readymade hoodie VHS yr pinterest organic.
Heading
Cliche letterpress raw denim tousled stumptown, single-origin coffee art party salvia pinterest shoreditch aesthetic. Letterpress keytar flannel, kogi meh literally american apparel high life.
Literally occupy cliche echo park. 90's art party mcsweeney's truffaut, twee literally keffiyeh tonx trust fund gentrify irony bicycle rights semiotics intelligentsia keytar. Meggings put a bird on it semiotics selvage, bushwick blog tofu intelligentsia 90's ethnic. Tattooed small batch street art fixie pop-up mixtape, pug jean shorts plaid wolf try-hard chillwave aesthetic. Pug street art whatever jean shorts salvia farm-to-table, seitan trust fund PBR kale chips leggings master cleanse flexitarian thundercats. Fanny pack chambray forage, echo park pinterest jean shorts salvia four loko 8-bit street art. Blog leggings mixtape, readymade hoodie VHS yr pinterest organic.
Literally occupy cliche echo park. 90's art party mcsweeney's truffaut, twee literally keffiyeh tonx trust fund gentrify irony bicycle rights semiotics intelligentsia keytar. Meggings put a bird on it semiotics selvage, bushwick blog tofu intelligentsia 90's ethnic. Tattooed small batch street art fixie pop-up mixtape, pug jean shorts plaid wolf try-hard chillwave aesthetic. Pug street art whatever jean shorts salvia farm-to-table, seitan trust fund PBR kale chips leggings master cleanse flexitarian thundercats. Fanny pack chambray forage, echo park pinterest jean shorts salvia four loko 8-bit street art. Blog leggings mixtape, readymade hoodie VHS yr pinterest organic.


Lunch Menu
change
Apps
Roasted Garlic Hummus
$9.00
Feta, Charred peppers, Olives, Roasted garlic, Carmalized onions
Meatloaf Bites
$10.99
Chipotle ketchup, Piped potatoes
Spinach Artichoke Dip
$11.99
Tortilla Chips
Grilled Wings
$9.99
House-made Brooklyn BBQ or Buffalo sauce
Hand-Cut Truffle Fries
$8.99
Truffle salt, Parmesan, Garlic aioli
Stuffed Jalepeño Peppers
$8.99
House-made Brooklyn BBQ or Buffalo sauce
Salads
Crowned Wedge
$9.99
Bibb lettuce, Tomatoes, Bleu cheese crumbles, Sugar cured bacon, Fried egg, Bleu cheese dressing
Cobb
$13.99
Artisan greens, Rotisserie turkey, Bleu cheese crumbles, Avocado, Tomatoes, Sugar cured bacon, Hard boiled egg, Ranch
Steak Salad
$14.99
Grilled sirloin, Artisan greens, Bleu cheese, Pickled baby beets, Tabasco shoestring onions, Mustard vinaigrette
Spinach & Kale Salad
$14.99
Spinach, Kale, White cheddar, Red onions, Granny smith apples, Dried cranberries, Candied walnuts, Apple cider vinaigrette


| Lesson 3 |
| In the last tutorial I taught you
how to display Triangles and Quads on the screen. In this tutorial I will
teach you how to add 2 different types of coloring to the triangle and
quad. Flat coloring will make the quad one solid color. Smooth coloring
will blend the 3 colors specified at each point (vertex) of the triangle
together, creating a nice blend of colors. Using the code from the last tutorial, we will be adding to the DrawGLScene procedure. I will rewrite the entire procedure below, so if you plan to modify the last lesson, you can replace the DrawGLScene procedure with the code below, or just add code to the DrawGLScene procedure that is not already in the last tutorial. |
||
int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer glLoadIdentity(); // Reset The Current Modelview Matrix glTranslatef(-1.5f,0.0f,-6.0f); // Left 1.5 Then Into Screen Six Units glBegin(GL_TRIANGLES); // Begin Drawing Triangles
| If you remember from the last
tutorial, this is the section of code to draw the triangle on the left
half of the screen. The next line of code will be the first time we use
the command glColor3f(r,g,b). The three parameters in the brackets are
red, green and blue intensity values. The values can be from 0.0f to 1.0f.
It works the same way as the color values we use to clear the background
of the screen. We are setting the color to red (full red intensity, no green, no blue). The line of code right after that is the first vertex (the top of the triangle), and will be drawn using the current color which is red. Anything we draw from now on will be red until we change the color to something other than red. |
||
glColor3f(1.0f,0.0f,0.0f); // Set The Color To Red glVertex3f( 0.0f, 1.0f, 0.0f); // Move Up One Unit From Center (Top Point)
| We've placed the first vertex on the screen, setting it's color to red. Now before we set the second vertex we'll change the color to green. That way the second vertex which is the left corner of the triangle will be set to green. | ||
glColor3f(0.0f,1.0f,0.0f); // Set The Color To Green glVertex3f(-1.0f,-1.0f, 0.0f); // Left And Down One Unit (Bottom Left)
| Now we're on the third and final vertex. Just before we draw it, we set the color to blue. This will be the right corner of the triangle. As soon as the glEnd() command is issued, the polygon will be filled in. But because it has a different color at each vertex, rather than one solid color throughout, the color will spread out from each corner, eventually meeting in the middle, where the colors will blend together. This is smooth coloring. | ||
glColor3f(0.0f,0.0f,1.0f); // Set The Color To Blue glVertex3f( 1.0f,-1.0f, 0.0f); // Right And Down One Unit (Bottom Right) glEnd(); // Done Drawing A Triangle glTranslatef(3.0f,0.0f,0.0f); // From Right Point Move 3 Units Right
| Now we will draw a solid blue
colored square. It's important to remember that anything drawn after the
color has been set will be drawn in that color. Every project you create
down the road will use coloring in one way or another. Even in scenes
where everything is texture mapped, glColor3f can still be used to tint
the color of textures, etc. More on that later. So to draw our square all one color, all we have to do is set the color once to a color we like (blue in this example), then draw the square. The color blue will be used for each vertex because we're not telling OpenGL to change the color at each vertex. The final result... a solid blue square. Again, the square (quad) is drawn in a clockwise order meaning we start off looking at the back of the quad. |
||
glColor3f(0.5f,0.5f,1.0f); // Set The Color To Blue One Time Only glBegin(GL_QUADS); // Start Drawing Quads glVertex3f(-1.0f, 1.0f, 0.0f); // Left And Up 1 Unit (Top Left) glVertex3f( 1.0f, 1.0f, 0.0f); // Right And Up 1 Unit (Top Right) glVertex3f( 1.0f,-1.0f, 0.0f); // Right And Down One Unit (Bottom Right) glVertex3f(-1.0f,-1.0f, 0.0f); // Left And Down One Unit (Bottom Left) glEnd(); // Done Drawing A Quad return TRUE; // Keep Going }
| Finally change the code to toggle window / fullscreen mode so that the title at the top of the window is proper. | ||
if (keys[VK_F1]) // Is F1 Being Pressed? { keys[VK_F1]=FALSE; // If So Make Key FALSE KillGLWindow(); // Kill Our Current Window fullscreen=!fullscreen; // Toggle Fullscreen / Windowed Mode // Recreate Our OpenGL Window ( Modified ) if (!CreateGLWindow("NeHe's Color Tutorial",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } }
| In this tutorial I have tried to
explain in as much detail, how to add flat and smooth coloring to your
OpenGL polygons. Play around with the code, try changing the red, green
and blue values to different numbers. See what colors you can come up
with. If you have comments or questions please email me. If you feel I
have incorrectly commented something or that the code could be done better
in some sections, please let me know. I want to make the best OpenGL
tutorials I can. I'm interested in hearing your feedback. Jeff Molofee (NeHe) * DOWNLOAD Visual C++ Code For This Lesson. * DOWNLOAD Visual Basic Code For This Lesson. ( Conversion by Ross Dawson ) * DOWNLOAD GLUT Code For This Lesson. ( Conversion by Andy Restad ) * DOWNLOAD Cygwin (FREE Language) Code For This Lesson. ( Conversion by Stephan Ferraro ) * DOWNLOAD Delphi Code For This Lesson. ( Conversion by Peter De Jaegher ) * DOWNLOAD MacOS X/GLUT Code For This Lesson. ( Conversion by Raal Goff ) * DOWNLOAD Linux/GLX Code For This Lesson. ( Conversion by Mihael Vrbanec ) * DOWNLOAD Code Warrior 5 Code For This Lesson. ( Conversion by Scott Lupton ) * DOWNLOAD MASM Code For This Lesson. ( Conversion by Nico (Scalp) ) * DOWNLOAD ASM Code For This Lesson. ( Conversion by Foolman ) * DOWNLOAD Visual Fortran Code For This Lesson. ( Conversion by Jean-Philippe Perois ) * DOWNLOAD Linux Code For This Lesson. ( Conversion by Richard Campbell ) * DOWNLOAD Irix Code For This Lesson. ( Conversion by Lakmal Gunasekara ) * DOWNLOAD Solaris Code For This Lesson. ( Conversion by Lakmal Gunasekara ) * DOWNLOAD Mac OS Code For This Lesson. ( Conversion by Anthony Parker ) * DOWNLOAD Power Basic Code For This Lesson. ( Conversion by Angus Law ) * DOWNLOAD BeOS Code For This Lesson. ( Conversion by Chris Herborth ) * DOWNLOAD Java Code For This Lesson. ( Conversion by Darren Hodges ) * DOWNLOAD Borland C++ Builder 4.0 Code For This Lesson. ( Conversion by Patrick Salmons ) * DOWNLOAD MingW32 & Allegro Code For This Lesson. ( Conversion by Peter Puck ) * DOWNLOAD Python Code For This Lesson. ( Conversion by John ) |
||


(.) .(.–.) HIV HCV PWID infection use {border-style HIV, drug HBV px;} study #ffffff;} condom hepatitis prevalence associated status inject drugs injection people Tanzania using viruses infections information virus .–. Muhimbili []. education evidence px; risk used viral {font-family HBV, HCV, Hepatitis data font-size injecting low multivariable odds participants recruited sharing test times (.%) (Table (last CI) Dar conducted double; hotspot reported services studies variables months) Health Public Salaam, Table access analysis border-color border-width characteristics day findings income infections. level logistic model model. overall p-value population regression sample serologic significant solid; systematic {font-style {font-weight (.%), AOR Allied COR Frequency IDU Marital National Sciences Tanzania.


SlothPI - The math sloth
SlothPI
Excercises
Clock (Excercise 1)
Complex Numbers (Excercise 2)
Binary/Hex Converter (Excercise 3)
Factorial (Excercise 4)
Sloth-Quiz (Excercise 5)
Age Converter (Excercise 6)
Canvas
Who made what (in ILIAS)?
About Sloths
General
Habitat
Food
About
What Time is it for SlothPI?
Home
Excercises
Clock (Excercise 1)


Home Page
Post
Sign out
Sign in
Sign up
Leave Current Session
Sign Out
We're sorry but this site doesn't work properly without JavaScript enabled. Please enable it to continue.


Click here to add new "random" widget to beginning of dashboard. This demonstrates the prependWidget function.


A Little Bit About Me
My name is Tereza. I have lived in the Netherlands since 2014 and for most of that time I worked for an accommodation search tech company in various positions in their Workfoce Management Department. At one point I realized however that I didn't see myself in this field of work longterm and I didn't feel passionate about the job. I started to learn how to code and eventually quit my job to attend a coding bootcamp in Amsterdam called Le Wagon which I recently graduated from. I took me a while to figure out what I want to do but now I belive coding is the right thing for me. It is something I feel passionate about and I am excited for the future.
Things I have built so far
VayCar
A group project that I worked on at Le Wagon with three other students. We had a week to build a market place web app with Ruby on Rails, and we created a platform for airport car parking and hire. We developed both car owner and car renter journeys - a user could list their car for rent at an airport or look for cars to rent, send a request to the owner, and leave a review after they used the car.
Check it outBetaVision
A final two-week Ruby on Rails project I worked on with three other students at Le Wagon. It is a platform where companies can sign up and upload a beta version of their website/ app, select what their target market through multiple filters and get feedback from users who registered as testers. Companies pay per test. After the feedback is received, they can give a review to the tester based on how useful their feedback was.
Check it outBoozy Town
My first solo Ruby on Rails project created at Le Wagon. It is a cocktail recipe manager app where a user can add a cocktail with photo to the collectionn, view specifics of other cocktails: ingredients and their amounts, reviews, or they can add or remove ingredients and leave a review to already existing cocktails.
Check it out


Malaysia's Flying car WON'T be flying tomorrow according to CAAM
Based on a statement by the Civil Aviation Authority of Malaysia, it seems that Malaysia’s first flying car won't be tested on 21 November 2019. This is due to the fact, that the EH216 Flying Car was not given the clearance to conduct tests at UniKL MIAT.
However, CAAM has mentioned that they are open to having the flying vehicle tested in Malaysia as long as it has all the necessary paperwork and it is conducted in an approved area to ensure safety. With all that said, some netizen has noted that the flying vehicle was only able to ascend and descend in place and was not able to fly around.
Many have also mentioned that the vehicle seemed unstable, which sparked the question of whether the minister should be in the cockpit fearing that they might need to re-elect a new minister if the worse were to happen. Jokes aside, what do you think of the EH216 Flying Car so far? Let us know on our Facebook page, and for more updates like this stay tuned to TechNave.com.


Arsenal's Stance On Mourinho Revealed?
by Kurt BuckerfieldWith Portuguese tactician Jose Mourinho believed to be interested in taking over at Arsenal, a football expert has now claimed to have an idea as to how the Gunners might feel about the manager.
Mourinho Waiting On Man Utd's EPL Rivals?
With many believing that Unai Emery's job at the London club is unstable, former Manchester United boss Mourinho is reportedly open to replacing the Spaniard, who has come in for a lot of criticism in recent weeks.
French football expert Julien Laurens, however, thinks that Arsenal might not want Mourinho as much as he might want them.
Post Selfies On Soccer Laduma's Social Media App & Earn Airtime and more! Download Now
"At the moment, Emery is safe and well safe as well," he said, according to the Daily Express.
"There's not even a question about 'who could come next now because he's going to be sacked soon?'.
"And I don't think Mourinho, if he wants to apply for the job and the job becomes available then so be it, but I don't think that for people at the top of the club, on the board, the Kroenke family and Raul Sanllehi and people like that, would really have someone like Mourinho with that kind of profile in their mind to take over Emery when that will happen."
9 Players Who Left Barca Because Of Messi
Mourinho, 56, has also been linked with Tottenham Hotspur and Real Madrid in recent months.


There's a chance that this is a temporary error. Please try
re-loading this page.
If things are not back to normal in a few moments, feel free to contact Narrative supportl.
Please make sure you provide the URL for this page, as well, so that we can help identify the problem!


The plants on this list are invasive; they threaten the health and vitality of native habitats, humans, and cause economic harm to public and to private landowners. Planting of these plants should be avoided and removal encouraged.
Some were intentionally introduced, while others arrived incidentally. Non-native or ornamental plants can be planted in gardens; vehicles can track plant seeds on tires; humans can track seeds on their shoes, and livestock and pets can transport seed on their fur or feet or through their excrement; many plant seeds or plant parts (e.g. knotweed rhizomes or shoots) are dispersed by wind and water.
Knowing how plants reproduce and spread is very helpful in preventing the vector distribution and controlling populations once established. While many non-native plants introduced into this region have reproduced rapidly, not all non-native plants become invasive. When plants are no longer in their native environment, they enter new relationships within the ecological communities they occupy. Sometimes, they cause very little disruption to the systems they enter, while at other times they cause great disturbance.


THE RELIC
A film review by Walter Frith
Copyright 1997 Walter Frith
Director Peter Hyams whose films include 'Hanover Street' (1979) 'The Star Chamber' (1983) and the protracted sequel to '2001: A Space Odyssey' entitled '2010: The Year We Make Contact' (1984) and many other films, most of them mediocre at best has emerged with his latest offering entitled 'The Relic.' A museum in Chicago is subjected to being terrorized by a South American monster that is part insect, part amphibian and part human. After setting up the story it then turns into a cheap slasher film with little or no imagination and is an embarassment to the film industry at large. An evolutionary biologist (Penelope Ann Miller) works at solving the origins of this creepy beast and a homicide detective (Tom Sizemore) is along for the ride. The biologist, detective and even the film's portrayal of the mayor are all stereotypes we've seen over and over again. I was even further appalled at the claustrophobic nature of this film which muddles its way down dark tunnels and long corridors in an attempt to find the chilling effect of any horror film we've seen before. After a while the film becomes even more boring and silly. It's downright trivial the further and further it goes on. Director Hyams acts as his own director of photography like he has in the past and his liking of lens flare for moody effects is hard on the eyes before too long. Academy award winning actress Linda Hunt and veteran actor James Whitmore round out notable members of the cast and their talents are way above this turkey of a movie.
OUT OF 5> zero
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Nike
160.00
Black/Pink Pow/Tour Yellow/White
38-42
The Nike Air Max Tavas SD Men's Shoe recalls the profile of the iconic running original with a Max Air unit in the heel and multi-surface Waffle outsole. A lightweight upper and gradient detail offer a comfortable fit and dynamic look.
Nike's revolutionary Air-Sole unit made its way into Nike footwear in the late '70s. In 1987, the Nike Air Max 1 debuted with visible air in its heel, allowing fans more than just the feel of Air-Sole comfort


Question 5 / x
Players Answered: 0 / x
5. Today we are participating of a hackathon.
a. Compound Predicate
b. Compound Subject
c. Compound Verb
d. None of these are correct.
Next Question
Top 5 Players
1.
2.
3.
4.
5.


A typical web application has various types of state
https://github.com/gothinkster/realworld“Yeah, that was a tricky slide [the one with multiple models and views and bidirectional data flow], partly because there's not a lot of consensus for what MVC is exactly - lots of people have different ideas about what it is. What we're really arguing against is bi-directional data flow, where one change can loop back and have cascading effects.”
@Injectable()
export class Store extends BehaviorSubject {
constructor(private dispatcher, private reducer, private initialState) {
super(initialState);
this.dispatcher.pipe(
tap(val => console.log('ACTION: ', val)),
scan((state, action) => this.reducer(state, action), initialState),
tap(val => console.log('STATE: ', val)),
).subscribe(state => super.next(state));
}
dispatch(action: any) {
this.dispatcher.dispatch(action);
}
select(key: string) {
return this.pipe(map(state => state[key]));
}
}
export class Dispatcher extends Subject {
dispatch(action: Action): void {
this.next(action);
}
}
Stream(loadMagazineEveryMonth$).pipe(
filter(magazine => magazine.month === 'April')
).subscribe(magazine => console.log(magazine.news));
// What: I want to retrieve only the April edition.
// How: I don't care..
Observable {
producer => events
push values => consumer(observer)
unsubscribe();
}
Subject {
producer => events
push values => list of consumers(observers)
unsubscribe();
next(); complete(); error(); // can be both Observable and Observer
}
Must read: Learning Observable By Building Observable / On The Subject Of Subjects (Ben Lesh)
imports: [
...
...
StoreModule.forRoot({ router: routerReducer },
{ metaReducers: !environment.production ? [storeFreeze] : [] }),
EffectsModule.forRoot([]),
!environment.production ? StoreDevtoolsModule.instrument() : [],
StoreRouterConnectingModule,
],
providers: [{ provide: RouterStateSerializer, useClass: CustomSerializer }],
export function freeze(reducer: ActionReducer): ActionReducer {
return function(state, action) {
const nextState = reducer(state, action);
Object.freeze(nextState);
return nextState;
}
}
@NgModule({
imports: [
StoreModule.forRoot(freeze(reducer))
]
})
export class AppModule {}
// running this in console we get
// 'Uncaught TypeError: Cannot assign to read only property 'test1''
(function()
{
'use strict';
console.log("FUN_1:");
let test = {test1: 'aha'};
test.test1 = 2;
Object.freeze(test);
test.test1 = 1;
}());
export interface SerializedRouterStateSnapshot {
root: ActivatedRouteSnapshot;
url: string;
}
export interface RouterStateUrl {
url: string;
params: Params;
queryParams: Params;
}
export interface State {
router: RouterReducerState;
}
export class CustomSerializer implements RouterStateSerializer {
serialize(routerState: RouterStateSnapshot): RouterStateUrl {
let route = routerState.root;
while (route.firstChild) {
route = route.firstChild;
}
const { url, root: { queryParams } } = routerState;
const { params } = route;
return { url, params, queryParams };
}
}
We can conrtol time in our store by replaying dispatched actions.
Here are our goals:
Let's see some examples of these requirements in the demo
export interface Auth {
loggedIn: boolean;
user: User;
status: Status;
}
export interface AuthState {
readonly auth: Auth;
}
export interface User {
email: string;
token: string;
username: string;
bio: string;
image: string;
}
export type Status = 'INIT' | 'IN_PROGRESS';
export const authInitialState: Auth = {
loggedIn: false,
status: 'INIT',
user: {
email: '',
token: '',
username: '',
bio: '',
image: ''
}
};
3. Next we create the reducer and register it to the module (libs/src/+state/auth.reducer.ts).
// (libs/src/+state/auth.reducer.ts)
export function authReducer(state: Auth, action: AuthAction): Auth {
switch (action.type) {
default: {
return state;
}
}
// (libs/src/auth.module.ts)
imports: [
...
StoreModule.forFeature('auth', authReducer, { initialState: authInitialState })
]
Our world until now was synchronous.
Generally, NgRx promotes functional programming. Reducers, selectors, RxJS operators are pure functions. This means that they produce no side effects.
But, side effects are impossible to avoid. We can isolate side effects (http calls, read from a file, write to localStorage) through ngrx/effects so that the rest of our ngrx implementation be composed of pure functions.
4. Next we create the effects class and register it to the module (libs/src/+state/auth.effects.ts).
// (libs/src/+state/auth.effects.ts)
@Injectable()
export class AuthEffects {
@Effect()
getUser ...
}
// (libs/src/auth.module.ts)
imports: [
...
StoreModule.forFeature('auth', authReducer, { initialState: authInitialState }),
EffectsModule.forFeature([AuthEffects])
]
lazy modules with ngrx v2
// (libs/auth/src/login/login.component.ts)
submit() {
this.store.dispatch(new fromActions.Login());
}
// (libs/auth/src/+state/auth.actions.ts)
import { Action } from '@ngrx/store';
export const enum AuthActionTypes {
LOGIN = '[auth] LOGIN',
LOGIN_SUCCESS = '[auth] LOGIN_SUCCESS',
LOGIN_FAIL = '[auth] LOGIN_FAIL'
...
}
// (libs/auth/src/+state/auth.effects.ts)
@Effect()
login = this.actions.ofType(AuthActionTypes.LOGIN).pipe(
withLatestFrom(this.store.select(fromNgrxForms.getData)),
exhaustMap(([action, data]) =>
this.authService.authUser('LOGIN', data).pipe(
map(result => new fromActions.LoginSuccess(result.user)),
catchError(result => of(new fromNgrxForms.SetErrors(result.error.errors)))
)
)
);
// (libs/auth/src/+state/auth.reducers.ts)
export function authReducer(state: Auth, action: AuthAction): Auth {
switch (action.type) {case AuthActionTypes.LOGIN:
...
case AuthActionTypes.REGISTER: {
return { ...state, status: 'IN_PROGRESS' };
}
case AuthActionTypes.REGISTER_SUCCESS:
case AuthActionTypes.LOGIN_SUCCESS: {
return {
...state,
loggedIn: true,
status: 'INIT',
user: action.payload
};
}
case AuthActionTypes.LOGIN_FAIL:
case AuthActionTypes.REGISTER_FAIL: {
return { ...state, status: 'INIT' };
}
...
@Effect({ dispatch: false })
loginRegisterSuccess =
this.actions.ofType(AuthActionTypes.LOGIN_SUCCESS, AuthActionTypes.REGISTER_SUCCESS).pipe(
tap(action => {
this.localStorageJwtService.setItem(action.payload.token);
this.router.navigateByUrl('/');
})
);
Selectors are just functions, that allow us, to get only the part of the application state, that we are interested in.Because selectors are pure functions, the last result can be returned when the arguments match without reinvoking your selector function. This can provide performance benefits.
export const getAuth = createFeatureSelector('auth');
export const getLoggedIn = createSelector(getAuth, (auth: Auth) => auth.loggedIn);
export const getUser = createSelector(getAuth, (auth: Auth) => auth.user);
A mnemonic from Mike Ryan and Brandon Robert @ ng-conf
and also...


Those people who have built an LFS system may be aware of the general principles of downloading and unpacking software. Some of that information is repeated here for those new to building their own software.
Each set of installation instructions contains a URL from which you can download the package. The patches; however, are stored on the LFS servers and are available via HTTP. These are referenced as needed in the installation instructions.
While you can keep the source files anywhere you like, we assume that you have unpacked the package and changed into the directory created by the unpacking process (the 'build' directory). We also assume you have uncompressed any required patches and they are in the directory immediately above the 'build' directory.
We can not emphasize strongly enough that you should start from a
clean source tree each time.
This means that if you have had an error during configuration or
compilation, it's usually best to delete the source tree and
re-unpack it before trying
again. This obviously doesn't apply if you're an advanced user used
to hacking Makefile
s and C code, but if
in doubt, start from a clean tree.
The golden rule of Unix System Administration is to use your
superpowers only when necessary. Hence, BLFS recommends that you
build software as an unprivileged user and only become the
root
user when installing the
software. This philosophy is followed in all the packages in this
book. Unless otherwise specified, all instructions should be
executed as an unprivileged user. The book will advise you on
instructions that need root
privileges.
If a file is in .tar
format and
compressed, it is unpacked by running one of the following
commands:
tar -xvf filename.tar.gz tar -xvf filename.tgz tar -xvf filename.tar.Z tar -xvf filename.tar.bz2
You may omit using the v
parameter in
the commands shown above and below if you wish to suppress the
verbose listing of all the files in the archive as they are
extracted. This can help speed up the extraction as well as make
any errors produced during the extraction more obvious to you.
You can also use a slightly different method:
bzcat filename.tar.bz2 | tar -xv
Finally, you sometimes need to be able to unpack patches which are
generally not in .tar
format. The
best way to do this is to copy the patch file to the parent of the
'build' directory and then run one of the following commands
depending on whether the file is a .gz
or .bz2
file:
gunzip -v patchname.gz bunzip2 -v patchname.bz2
Generally, to verify that the downloaded file is genuine and
complete, many package maintainers also distribute md5sums of the
files. To verify the md5sum of the downloaded files, download both
the file and the corresponding md5sum file to the same directory
(preferably from different on-line locations), and (assuming
file.md5sum
is the md5sum file
downloaded) run the following command:
md5sum -c file.md5sum
If there are any errors, they will be reported. Note that the BLFS
book includes md5sums for all the source files also. To use the
BLFS supplied md5sums, you can create a file.md5sum
(place the md5sum data and the exact
name of the downloaded file on the same line of a file, separated
by white space) and run the command shown above. Alternately,
simply run the command shown below and compare the output to the
md5sum data shown in the BLFS book.
md5sum <name_of_downloaded_file>
For larger packages, it is convenient to create log files instead
of staring at the screen hoping to catch a particular error or
warning. Log files are also useful for debugging and keeping
records. The following command allows you to create an installation
log. Replace <command>
with the command
you intend to execute.
( <command>
2>&1 | tee compile.log && exit $PIPESTATUS )
2>&1
redirects error messages to
the same location as standard output. The tee command allows viewing of the
output while logging the results to a file. The parentheses around
the command run the entire command in a subshell and finally the
exit $PIPESTATUS
command ensures the result of the <command>
is returned as the
result and not the result of the tee command.
For many modern systems with multiple processors (or cores) the compilation time for a package can be reduced by performing a "parallel make" by either setting an environment variable or telling the make program how many processors are available. For instance, a Core2Duo can support two simultaneous processes with:
export MAKEFLAGS='-j2'
or just building with:
make -j2
Generally the number of processes should not exceed the number of
cores supported by the CPU. To list the processors on your system,
issue: grep processor
/proc/cpuinfo
.
In some cases, using multiple processors may result in a 'race' condition where the success of the build depends on the order of the commands run by the make program. For instance, if an executable needs File A and File B, attempting to link the program before one of the dependent components is available will result in a failure. This condition usually arises because the upstream developer has not properly designated all the prerequisites needed to accomplish a step in the Makefile.
If this occurs, the best way to proceed is to drop back to a single processor build. Adding '-j1' to a make command will override the similar setting in the MAKEFLAGS environment variable.
When running the package tests or the install portion of the package build process, we do not recommend using an option greater than '-j1' unless specified otherwise. The installation procedures or checks have not been validated using parallel procedures and may fail with issues that are difficult to debug.
There are times when automating the building of a package can come
in handy. Everyone has their own reasons for wanting to automate
building, and everyone goes about it in their own way. Creating
Makefile
s, Bash scripts, Perl scripts or simply a list of commands used
to cut and paste are just some of the methods you can use to
automate building BLFS packages. Detailing how and providing
examples of the many ways you can automate the building of packages
is beyond the scope of this section. This section will expose you
to using file redirection and the yes command to help provide ideas
on how to automate your builds.
You will find times throughout your BLFS journey when you will come across a package that has a command prompting you for information. This information might be configuration details, a directory path, or a response to a license agreement. This can present a challenge to automate the building of that package. Occasionally, you will be prompted for different information in a series of questions. One method to automate this type of scenario requires putting the desired responses in a file and using redirection so that the program uses the data in the file as the answers to the questions.
Building the CUPS package is a good example of how redirecting a file as input to prompts can help you automate the build. If you run the test suite, you are asked to respond to a series of questions regarding the type of test to run and if you have any auxiliary programs the test can use. You can create a file with your responses, one response per line, and use a command similar to the one shown below to automate running the test suite:
make check < ../cups-1.1.23-testsuite_parms
This effectively makes the test suite use the responses in the file as the input to the questions. Occasionally you may end up doing a bit of trial and error determining the exact format of your input file for some things, but once figured out and documented you can use this to automate building the package.
Sometimes you will only need to provide one response, or provide the same response to many prompts. For these instances, the yes command works really well. The yes command can be used to provide a response (the same one) to one or more instances of questions. It can be used to simulate pressing just the Enter key, entering the Y key or entering a string of text. Perhaps the easiest way to show its use is in an example.
First, create a short Bash script by entering the following commands:
cat > blfs-yes-test1 << "EOF"
#!/bin/bash
echo -n -e "\n\nPlease type something (or nothing) and press Enter ---> "
read A_STRING
if test "$A_STRING" = ""; then A_STRING="Just the Enter key was pressed"
else A_STRING="You entered '$A_STRING'"
fi
echo -e "\n\n$A_STRING\n\n"
EOF
chmod 755 blfs-yes-test1
Now run the script by issuing ./blfs-yes-test1 from the command line. It will wait for a response, which can be anything (or nothing) followed by the Enter key. After entering something, the result will be echoed to the screen. Now use the yes command to automate the entering of a response:
yes | ./blfs-yes-test1
Notice that piping yes by itself to the script results in y being passed to the script. Now try it with a string of text:
yes 'This is some text' | ./blfs-yes-test1
The exact string was used as the response to the script. Finally, try it using an empty (null) string:
yes '' | ./blfs-yes-test1
Notice this results in passing just the press of the Enter key to the script. This is useful for times when the default answer to the prompt is sufficient. This syntax is used in the Net-tools instructions to accept all the defaults to the many prompts during the configuration step. You may now remove the test script, if desired.
In order to automate the building of some packages, especially those that require you to read a license agreement one page at a time, requires using a method that avoids having to press a key to display each page. Redirecting the output to a file can be used in these instances to assist with the automation. The previous section on this page touched on creating log files of the build output. The redirection method shown there used the tee command to redirect output to a file while also displaying the output to the screen. Here, the output will only be sent to a file.
Again, the easiest way to demonstrate the technique is to show an example. First, issue the command:
ls -l /usr/bin | more
Of course, you'll be required to view the output one page at a time
because the more
filter was used. Now try the same command, but this time redirect
the output to a file. The special file /dev/null
can be used instead of the filename
shown, but you will have no log file to examine:
ls -l /usr/bin | more > redirect_test.log 2>&1
Notice that this time the command immediately returned to the shell prompt without having to page through the output. You may now remove the log file.
The last example will use the yes command in combination with output redirection to bypass having to page through the output and then provide a y to a prompt. This technique could be used in instances when otherwise you would have to page through the output of a file (such as a license agreement) and then answer the question of “do you accept the above?”. For this example, another short Bash script is required:
cat > blfs-yes-test2 << "EOF"
#!/bin/bash
ls -l /usr/bin | more
echo -n -e "\n\nDid you enjoy reading this? (y,n) "
read A_STRING
if test "$A_STRING" = "y"; then A_STRING="You entered the 'y' key"
else A_STRING="You did NOT enter the 'y' key"
fi
echo -e "\n\n$A_STRING\n\n"
EOF
chmod 755 blfs-yes-test2
This script can be used to simulate a program that requires you to read a license agreement, then respond appropriately to accept the agreement before the program will install anything. First, run the script without any automation techniques by issuing ./blfs-yes-test2.
Now issue the following command which uses two automation techniques, making it suitable for use in an automated build script:
yes | ./blfs-yes-test2 > blfs-yes-test2.log 2>&1
If desired, issue tail blfs-yes-test2.log to see the end of the paged output, and confirmation that y was passed through to the script. Once satisfied that it works as it should, you may remove the script and log file.
Finally, keep in mind that there are many ways to automate and/or script the build commands. There is not a single “correct” way to do it. Your imagination is the only limit.
For each package described, BLFS lists the known dependencies. These are listed under several headings, whose meaning is as follows:
Required means that the target package cannot be correctly built without the dependency having first been installed.
Recommended means that BLFS strongly suggests this package is installed first for a clean and trouble-free build, that won't have issues either during the build process, or at run-time. The instructions in the book assume these packages are installed. Some changes or workarounds may be required if these packages are not installed.
Optional means that this package might be installed for added functionality. Often BLFS will describe the dependency to explain the added functionality that will result.
On occasion you may run into a situation in the book when a package will not build or work properly. Though the Editors attempt to ensure that every package in the book builds and works properly, sometimes a package has been overlooked or was not tested with this particular version of BLFS.
If you discover that a package will not build or work properly, you should see if there is a more current version of the package. Typically this means you go to the maintainer's web site and download the most current tarball and attempt to build the package. If you cannot determine the maintainer's web site by looking at the download URLs, use Google and query the package's name. For example, in the Google search bar type: 'package_name download' (omit the quotes) or something similar. Sometimes typing: 'package_name home page' will result in you finding the maintainer's web site.
In LFS, stripping of debugging symbols was discussed a couple of times. When building BLFS packages, there are generally no special instructions that discuss stripping again. It is probably not a good idea to strip an executable or a library while it is in use, so exiting any windowing environment is a good idea. Then you can do:
find /{,usr/}{bin,lib,sbin} \ -type f \( -name \*.so* -a ! -name \*dbg \) \ -exec strip --strip-unneeded {} \;
If you install programs in other directories such as /opt
or /usr/local
,
you may want to strip the files there too.
For more information on stripping, see http://www.technovelty.org/linux/stripping-shared-libraries.html.
There are now three different build systems in common use for converting C or C++ source code into compiled programs or libraries and their details (particularly, finding out about available options and their default values) differ. It may be easiest to understand the issues caused by some choices (typically slow execution or unexpected use of, or omission of, optimizatons) by starting with the CFLAGS and CXXFLAGS environment variables. There are also some programs which use rust.
Most LFS and BLFS builders are probably aware of the basics of CFLAGS and CXXFLAGS for altering how a program is compiled. Typically, some form of optimization is used by upstream developers (-O2 or -O3), sometimes with the creation of debug symbols (-g), as defaults.
If there are contradictory flags (e.g. multiple different -O values), the last value will be used. Sometimes this means that flags specified in environment variables will be picked up before values hardcoded in the Makefile, and therefore ignored. For example, where a user specifies '-O2' and that is followed by '-O3' the build will use '-O3'.
There are various other things which can be passed in CFLAGS or CXXFLAGS, such as forcing compilation for a specific microarchitecture (e.g. -march=amdfam10, -march=native) or specifying a specific standard for C or C++ (-std=c++17 for example). But one thing which has now come to light is that programmers might include debug assertions in their code, expecting them to be disabled in releases by using -DNDEBUG. Specifically, if Mesa-20.0.2 is built with these assertions enabled, some activities such as loading levels of games can take extremely long times, even on high-class video cards.
This combination is often described as 'CMMI' (configure, make, make install) and is used here to also cover the few packages which have a configure script that is not generated by autotools.
Sometimes running ./configure --help will produce useful options about switches which might be used. At other times, after looking at the output from configure you may need to look at the details of the script to find out what it was actually searching for.
Many configure scripts will pick up any CFLAGS or CXXFLAGS from the environment, but CMMI packages vary about how these will be mixed with any flags which would otherwise be used (variously: ignored, used to replace the programmer's suggestion, used before the programmer's suggestion, or used after the programmer's suggestion).
In most CMMI packages, running 'make' will list each command and run it, interspersed with any warnings. But some packages try to be 'silent' and only show which file they are compiling or linking instead of showing the command line. If you need to inspect the command, either because of an error, or just to see what options and flags are being used, adding 'V=1' to the make invocation may help.
CMake works in a very different way, and it has two backends which can be used on BLFS: 'make' and 'ninja'. The default backend is make, but ninja can be faster on large packages with multiple processors. To use ninja, specify '-G Ninja' in the cmake command. However, there are some packages which create fatal errors in their ninja files but build successfully using the default of Unix Makefiles.
The hardest part of using CMake is knowing what options you might wish to specify. The only way to get a list of what the package knows about is to run cmake -LAH and look at the output for that default configuration.
Perhaps the most-important thing about CMake is that it has a variety of CMAKE_BUILD_TYPE values, and these affect the flags. The default is that this is not set and no flags are generated. Any CFLAGS or CXXFLAGS in the environment will be used. If the programmer has coded any debug assertions, those will be enabled unless -DNDEBUG is used. The following CMAKE_BUILD_TYPE values will generate the flags shown, and these will come after any flags in the environment and therefore take precedence.
Debug : '-g'
Release : '-O3 -DNDEBUG'
RelWithDebInfo : '-O2 -g -DNDEBUG'
MinSizeRel : '-Os -DNDEBUG'
CMake tries to produce quiet builds. To see the details of the commands which are being run, use 'make VERBOSE=1' or 'ninja -v'.
Meson has some similarities to CMake, but many differences. To get
details of the defines that you may wish to change you can look at
meson_options.txt
which is usually in
the top-level directory.
If you have already configured the package by running meson and now wish to change one or more settings, you can either remove the build directory, recreate it, and use the altered options, or within the build directory run meson configure, e.g. to set an option:
meson configure -D<some_option>=true
If you do that, the file meson-private/cmd_line.txt
will show the
last commands which were
used.
Meson provides the following buildtype values, and the flags they enable come after any flags supplied in the environment and therefore take precedence.
plain : no added flags. This is for distributors to supply their own CLFAGS, CXXFLAGS and LDFLAGS. There is no obvious reason to use this in BLFS.
debug : '-g'
debugoptimized : '-O2 -g' - this is the default if nothing is specified, it leaves assertions enabled.
release : '-O3 -DNDEBUG' (but occasionally a package will force -O2 here)
Although the 'release' buildtype is described as enabling -DNDEBUG, and all CMake Release builds pass that, it has so far only been observed (in verbose builds) for Mesa-20.0.2. That suggests that it might only be used when there are debug assertions present.
The -DNDEBUG flag can also be provided by passing -Db_ndebug=true.
To see the details of the commands which are being run in a package using meson, use 'ninja -v'.
Most released rustc programs are provided as crates (source
tarballs) which will query a server to check current versions of
dependencies and then download them as necessary. These packages
are built using cargo
--release. In theory, you can manipulate the
RUSTFLAGS to change the optimize-level (default is 3, like -O3,
e.g. -Copt-level=3
) or to force it to
build for the machine it is being compiled on, using -Ctarget-cpu=native
but in practice this seems to
make no significant difference.
If you find an interesting rustc program which is only provided as
unpackaged source, you should at least specify RUSTFLAGS=-Copt-level=2
otherwise it will do an
unoptimized compile with debug info and run much slower.
Many people will prefer to optimize compiles as they see fit, by providing CFLAGS or CXXFLAGS. For an introduction to the options available with gcc and g++ see https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html and https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html and info gcc.
Some packages default to '-O2 -g', others to '-O3 -g', and if CFLAGS or CXXFLAGS are supplied they might be added to the package's defaults, replace the package's defaults, or even be ignored. There are details on some desktop packages which were mostly current in April 2019 at http://www.linuxfromscratch.org/~ken/tuning/ - in particular, README.txt, tuning-1-packages-and-notes.txt, and tuning-notes-2B.txt. The particular thing to remember is that if you want to try some of the more interesting flags you may need to force verbose builds to confirm what is being used.
Clearly, if you are optimizing your own program you can spend time to profile it and perhaps recode some of it if it is too slow. But for building a whole system that approach is impractical. In general, -O3 usually produces faster programs than -O2. Specifying -march=native is also beneficial, but means that you cannot move the binaries to an incompatible machine - this can also apply to newer machines, not just to older machines. For example programs compiled for 'amdfam10' run on old Phenoms, Kaveris, and Ryzens : but programs compiled for a Kaveri will not run on a Ryzen because certain op-codes are not present. Similarly, if you build for a Haswell not everything will run on a SandyBridge.
There are also various other options which some people claim are beneficial. At worst, you get to recompile and test, and then discover that in your usage the options do not provide a benefit.
If building Perl or Python modules, or Qt packages which use qmake, in general the CFLAGS and CXXFLAGS used are those which were used by those 'parent' packages.
Even on desktop systems, there are still a lot of exploitable vulnerabilities. For many of these, the attack comes via javascript in a browser. Often, a series of vulnerabilities are used to gain access to data (or sometimes to pwn, i.e. own, the machine and install rootkits). Most commercial distros will apply various hardening measures.
For hardening options which are reasonably cheap, there is some discussion in the 'tuning' link above (occasionally, one or more of these options might be inappropriate for a package). These options are -D_FORTIFY_SOURCE=2, -fstack-protector=strong, and (for C++) -D_GLIBCXX_ASSERTIONS. On modern machines these should only have a little impact on how fast things run, and often they will not be noticeable.
In the past, there was Hardened LFS where gcc (a much older version) was forced to use hardening (with options to turn some of it off on a per-package basis. What is being covered here is different - first you have to make sure that the package is indeed using your added flags and not over-riding them.
The main distros use much more, such as RELRO (Relocation Read Only) and perhaps -fstack-clash-protection. You may also encounter the so-called 'userspace retpoline' (-mindirect-branch=thunk etc.) which is the equivalent of the spectre mitigations applied to the linux kernel in late 2018). The kernel mitigations caused a lot of complaints about lost performance, if you have a production server you might wish to consider testing that, along with the other available options, to see if performance is still sufficient.
Whilst gcc has many hardening options, clang/LLVM's strengths lie elsewhere. Some options which gcc provides are said to be less effective in clang/LLVM, others are not available.
Last updated on 2020-02-22 21:55:40 -0600


Contrast
Print
By Hand
Accepts PDFs and images (JPG and PNG).
Multi-page PDFs: only converts first page.
Read image
Download
Convert PDFs and Images to Text


This build tool uses a new node app I've developed. The app takes a query string and builds you a custom version of popcorn based on it.
You can get the source for the node app
here.
The app uses Uglify.js to minify code, and caches requests for up to 5 days, so that similar requests can be served faster (This demo doesn't have the cache ability enabled - no mongodb available on nodejitsu).
To use this tool, select the bits of popcorn you'd like, and also select if you want minified( Production ) code, or unminified ( Development ) code.
When you're ready, click the get URL button near the bottom to generate your link. The sample response area will be populated with the actual respose the app will give you ( and caches it, as a bonus :P ). You can now copy that link and use it in a script tag to always
* get your desired build.
* This is just a TEST page, please do not use the generated links for anything, demo or production, as the endpoint for the app is not permanent.


Two sisters aged 1 and 2 die after being left inside hot car on 30C day
The girls' devastated mother carried their bodies into the family home near Brisbane, Australia, in a desperate attempt to cool their bodies, it was reported
by Chris Kitching, https://www.mirror.co.uk/authors/chris-kitching/Two sisters aged just one and two are dead after they were left inside a hot car as the outside temperature soared to 31C.
The girls' devastated mum discovered them inside the vehicle and carried them into the family home in a desperate attempt to cool their bodies, according to witnesses.
A neighbour said her granddaughters later saw the sisters' bodies being carried out of the home, near Brisbane, Australia, and they were "soaking wet".
The inside of the car would have been like an oven - experts say the temperature inside a parked car on a warm day can be more than 30C hotter than that outside the car.
Police and paramedics were called to the home in Logan at about 1.35pm local time on Saturday.
The sisters were unresponsive when they were discovered and paramedics desperately tried to revive them.
Police told 9News that the girls died after being left inside the car on a hot spring day.
The sisters' mother found them and rushed them inside in an attempt to cool their bodies, the report added.
A neighbour told the Courier Mail: "My granddaughters saw the babies being carried out of the house soaking wet.
"It is a tragic accident, she was a good mum."
Describing the scene as "tragic" and "distressing", Detective Inspector Mark White said: "Two young children were located at that particular location.
"QAs (paramedics) made attempts to revive those children, unfortunately they were both declared deceased at the scene.
"The two children showed evidence of being exposed to extreme heat."
Police have spoken to the girls' parents.
No-one has been arrested.
Officers cordoned off the home with crime scene tape and forensics officers were brought in to examine the car.
The temperature inside a hot car can be more than 30C hotter than outside the car on a typical Australian summer day, said Australia's National Roads and Motorists' Association.
Within minutes, a child left in a parked car in that kind of extreme heat can become dehydrated and can die from organ failure, it said.


Create backup
Source project
Bucket storage class for data
Bucket storage region
After X days change object storage class to archive. Default is 0.
Backup type
Cloud Storage Bucket*
BigQuery dataset
When empty will take all tables. Comma separated.
When present will ignore given tables. Comma separated.
Snapshot: one or many shots. Mirror: hourly sync.
After X days data will be deleted. Default is 0.
After X days data will be deleted. Default is 0.
After X days data will be deleted. Default is 0.
Snapshot will be created every X hours at full hour


As the leader of this project. He also works as UI/UX designer. His passion is to deliver high quality UI/UX design as good as leading the project. His hobby is playing football. Recently, he likes to travel, capture the moment and share it to social media.
As the head of market research. WuTao is very interested with marketing strategy. He has many experiences in marketing strategy. In this project he has a important role to research the market and promote the app. He also has a hobby which is playing game. He is funny and very kind.
As the head of developer. Udin has passion in Internet Technology such as cloud computing, parallel computing and big data. In this project, he has an important role to develope the app and to deliver high quality app and services to the customer. He also has a hobby which is traveling.


Welcome to Vicky's little Vikings
Vicky's little Vikings is an Ofsted registered childminders run by Vicky Thirkettle in Hornsey, London N8.
My lovely family (from left to right), Elliot, Will, Harrison and Me!
My lovely family (from left to right), Elliot, Will, Harrison and Me!


4.8. Dynamic Array-Based Stacks¶
4.8.1. Stack Terminology and Implementation¶
The stack is a list-like structure in which elements may be inserted or removed from only one end. While this restriction makes stacks less flexible than lists, it also makes stacks both efficient (for those operations they can do) and easy to implement. Many applications require only the limited form of insert and remove operations that stacks provide. In such cases, it is more efficient to use the simpler stack data structure rather than the generic list.
Despite their restrictions, stacks have many uses. Thus, a special vocabulary for stacks has developed. Accountants used stacks long before the invention of the computer. They called the stack a “LIFO” list, which stands for “Last-In, First-Out.” Note that one implication of the LIFO policy is that stacks remove elements in reverse order of their arrival.
The accessible element of the stack is called the top
element.
Elements are not said to be inserted, they are pushed
onto the stack.
When removed, an element is said to be popped from the
stack.
Here is our ADT for stacks:
interface Stack(E) extends Collection(E)
push(x:E) // Pushes x on top of the stack.
pop() : E // Pops the top of the stack and returns it.
peek() : E // Returns the top element of the stack, without removing it.
// Note: iterator() should yield the elements starting from the top of the stack.
// Note: This is an interface, while java.util.Stack is a class!
interface Stack<E> extends Collection<E> {
void push(E x); // Pushes x on top of the stack.
E pop(); // Pops the top of the stack and returns it.
E peek(); // Returns the top element of the stack, without removing it.
// Note: iterator() should yield the elements starting from the top of the stack.
}
class Stack(Collection):
def push(self, x): """Pushes x on top of the stack."""
def pop(self): """Pops the top of the stack and returns it."""
def peek(self): """Returns the top element of the stack, without removing it."""
# Note: __iter__() should yield the elements starting from the top of the stack.
As with lists, there are many variations on stack implementation. The two main approaches are the array-based stack and the linked stack, which are analogous to array-based and linked lists, respectively.
4.8.2. Dynamic Array-Based Stacks¶
The dynamic array-based stack contains an internal array (which will grow and shrink dynamically), and the index of the top of the stack. Or actually, the index is for the next free slot in the array, which at the same time is the size of the stack.
class DynamicArrayStack(E) implements Stack(E)
private internalArray : E[] // Internal array containing the stack elements
private stackSize : int // Size of stack, and index of the next free slot
DynamicArrayStack()
internalArray = new array of size 1
stackSize = 0
class DynamicArrayStack<E> implements Stack<E> {
private E[] internalArray; // Internal array containing the stack elements
private int stackSize; // Size of stack, and index of the next free slot
@SuppressWarnings("unchecked")
public DynamicArrayStack() {
internalArray = (E[]) new Object[1];
stackSize = 0;
}
class DynamicArrayStack(Stack):
def __init__(self):
self._internalArray = [None] # Internal array containing the stack elements
self._stackSize = 0 # Size of stack, and index of the next free slot
The array-based stack implementation is essentially a simplified version of the array-based list. The only important design decision to be made is which end of the array should represent the top of the stack.
4.8.3. Pushing to the Stack¶
push(x:E)
if stackSize >= size of internalArray
resizeArray(2 * size of internalArray)
internalArray[stackSize] = x
stackSize += 1
public void push(E x) {
if (stackSize >= internalArray.length) {
resizeArray(2 * internalArray.length);
}
internalArray[stackSize] = x;
stackSize++;
}
def push(self, x):
if self._stackSize >= len(self._internalArray):
self._resizeArray(2 * len(self._internalArray))
self._internalArray[self._stackSize] = x
self._stackSize += 1
4.8.4. Popping from the Stack¶
pop() : E
// Precondition: stackSize > 0
stackSize -= 1
x : E = internalArray[stackSize]
internalArray[stackSize] = null // For garbage collection
if stackSize < size of internalArray / 3
resizeArray(size of internalArray / 2)
return x
public E pop() {
if (!(stackSize > 0)) throw new IndexOutOfBoundsException("pop from empty stack");
stackSize--;
E x = internalArray[stackSize];
internalArray[stackSize] = null; // For garbage collection
if (stackSize <= internalArray.length / 3) {
resizeArray(internalArray.length / 2);
}
return x;
}
def pop(self):
if not (self._stackSize > 0): raise IndexError("pop from empty stack")
self._stackSize -= 1
x = self._internalArray[self._stackSize]
self._internalArray[self._stackSize] = None # For garbage collection
if self._stackSize <= len(self._internalArray) // 3:
self._resizeArray(len(self._internalArray) // 2)
return x
4.8.5. Array-based stacks: Full implementation¶
As you hopefully have noticed, the code for stacks is very similar to the code for lists. E.g., the internal variables are exactly the same, and the resizing method doesn’t change at all. The main difference is that stacks are even simpler to implement than their list counterparts.
Here is a complete implementation for the (dynamic) array-based stack class.
class DynamicArrayStack(E) implements Stack(E)
private internalArray : E[] // Internal array containing the stack elements
private stackSize : int // Size of stack, and index of the next free slot
DynamicArrayStack()
internalArray = new array of size 1
stackSize = 0
push(x:E)
if stackSize >= size of internalArray
resizeArray(2 * size of internalArray)
internalArray[stackSize] = x
stackSize += 1
peek() : E
// Precondition: stackSize > 0
return internalArray[stackSize-1]
pop() : E
// Precondition: stackSize > 0
stackSize -= 1
x : E = internalArray[stackSize]
internalArray[stackSize] = null // For garbage collection
if stackSize < size of internalArray / 3
resizeArray(size of internalArray / 2)
return x
private resizeArray(newCapacity:int)
newArray : E[] = new array of size newCapacity
for i in 0, 1, ..., stackSize-1
newArray[i] = internalArray[i]
internalArray = newArray
isEmpty() : boolean
return stackSize == 0
size() : int
return stackSize
iterator() : Iterator(E)
return an iterator over the elements in internalArray, starting from the top element
class DynamicArrayStack<E> implements Stack<E> {
private E[] internalArray; // Internal array containing the stack elements
private int stackSize; // Size of stack, and index of the next free slot
@SuppressWarnings("unchecked")
public DynamicArrayStack() {
internalArray = (E[]) new Object[1];
stackSize = 0;
}
public void push(E x) {
if (stackSize >= internalArray.length) {
resizeArray(2 * internalArray.length);
}
internalArray[stackSize] = x;
stackSize++;
}
public E peek() {
if (!(stackSize > 0)) throw new IndexOutOfBoundsException("peek from empty stack");
return internalArray[stackSize-1];
}
public E pop() {
if (!(stackSize > 0)) throw new IndexOutOfBoundsException("pop from empty stack");
stackSize--;
E x = internalArray[stackSize];
internalArray[stackSize] = null; // For garbage collection
if (stackSize <= internalArray.length / 3) {
resizeArray(internalArray.length / 2);
}
return x;
}
private void resizeArray(int newCapacity) {
@SuppressWarnings("unchecked")
E[] newArray = (E[]) new Object[newCapacity];
for (int i = 0; i < stackSize; i++) {
newArray[i] = internalArray[i];
}
internalArray = newArray;
}
public boolean isEmpty() {
return stackSize == 0;
}
public int size() {
return stackSize;
}
public Iterator<E> iterator() {
return new DynamicArrayStackIterator();
}
private class DynamicArrayStackIterator implements Iterator<E> {
private int index;
DynamicArrayStackIterator() {
index = stackSize;
}
public boolean hasNext() {
return index > 0;
}
public E next() {
index--;
return internalArray[index];
}
}
}
class DynamicArrayStack(Stack):
def __init__(self):
self._internalArray = [None] # Internal array containing the stack elements
self._stackSize = 0 # Size of stack, and index of the next free slot
def push(self, x):
if self._stackSize >= len(self._internalArray):
self._resizeArray(2 * len(self._internalArray))
self._internalArray[self._stackSize] = x
self._stackSize += 1
def peek(self):
if not (self._stackSize > 0): raise IndexError("peek from empty stack")
return self._internalArray[self._stackSize-1]
def pop(self):
if not (self._stackSize > 0): raise IndexError("pop from empty stack")
self._stackSize -= 1
x = self._internalArray[self._stackSize]
self._internalArray[self._stackSize] = None # For garbage collection
if self._stackSize <= len(self._internalArray) // 3:
self._resizeArray(len(self._internalArray) // 2)
return x
def _resizeArray(self, newCapacity):
newArray = [None] * newCapacity
for i in range(self._stackSize):
newArray[i] = self._internalArray[i]
self._internalArray = newArray
def isEmpty(self):
return self._stackSize == 0
def size(self):
return self._stackSize
def __iter__(self):
return DynamicArrayStackIterator(self._internalArray, self._stackSize)
# Python does not have internal classes, so we have to make the iterator standalone.
class DynamicArrayStackIterator(Iterator):
def __init__(self, array, size):
self._array = array
self._size = size
self._index = size
def __iter__(self):
return self
def __next__(self):
self._index -= 1
if self._index < 0:
raise StopIteration
return self._array[self._index]


{% if page.extras %} Stuff that came into being during the making of this post {% assign extras = page.extras | first %}


This map displays a slightly synthetic subset of the emergency calls recorded at KFD. The 2017 summer edition of ArcUser has a detailed tutorial on how this dataset was obtained and processed. Visualization inspired by Building permits map - Warren Davison


From here, you can set an alert message that will appear at the top of the window. The alert can contain HTML content. Use the preview button to see how the alert will appear before setting it. Click here to return to the admin page.
{{#if error}}The current alert will end at {{alertTimeout}}
{{/if}}


Dear {% for r in recipients %} {% block r %} {{ escape(r.first_name) }} {{ escape(r.last_name) }}, {% end %} {% end %}
You have recently requested a {{ entity }} in the {{ name }} portal.
We are pleased to inform you that your slice request on the {{name}} portal has neen validated.
You can now add resources and start experimenting.
We wish you a fruitful user experience with the {{ name }} portal.
Yours sincerely,
The {{ name }} team


{% extends 'layouts/layout.html' %} {% block head %} {{ super() }} {% endblock %} {% block body %}
You are being redirected back to the HIT window, which should refresh. If you do not see the HIT submission form when you return, try refreshing the page.
{% endblock %}


EDUCATION
  Add your latest degrees and other qualifications you deem relevant.
EMPLOYMENT
  Show the depth of your expertise through various places you have worked at!