Ratings: 7.9 / 10
More
- by Stanley Kubrick
Ratings: 7.9 / 10
More
Ratings: 6.7 / 10
More
Ratings: 7.0 / 10
More
Ratings: 7.0 / 10
More
Ratings: 6.9 / 10
More
Ratings: 8.1 / 10
More
Ratings: 7.2 / 10
More
Ratings: 7.8 / 10
More
Ratings: 8.1 / 10
More
Ratings: 7.3 / 10
More
Ratings: 7.3 / 10
More
Ratings: 7.8 / 10
More
Ratings: 7.5 / 10
More
Ratings: 7.3 / 10
More
Ratings: 8.5 / 10
More
The Marvel Cinematic Universe (MCU) is an American media franchise and shared universe centered on a series of superhero films, independently produced by Marvel Studios and based on characters that appear in American comic books published by Marvel Comics.
The franchise also includes comic books, short films, television series, and digital series. The shared universe, much like the original Marvel Universe in comic books, was established by crossing over common plot elements, settings, cast, and characters.
Inventor Tony Stark applies his genius for high-tech solutions to problems as Iron Man, the armored Avenger.
America’s World War II Super-Soldier continues his fight in the present as an Avenger and untiring sentinel of liberty.
Thor Odinson wields the power of the ancient Asgardians to fight evil throughout the Nine Realms and beyond.


--- layout: archive title: Zulip Chat Archive permalink: /stream/113488-general/topic/github.20actions.html ---
We have recently switched to github actions instead of Travis. Now, even on my fork, all branches get built. If I understand correctly, this is because the file build.yml
got copied when I updated master.
I often push work in progress to github, to save it. Now, github tries to build this work in progress, which a crazy waste of processor time. Moreover, it tries to build it both on 3.4.2 and nightlies, which is a double waste. I tried to use commit messages with [ci skip]
, but to no avail.
Do you see a way I could improve my workflow?
If you don't want your branches to be built, you can disable github actions (for your repository) at https://github.com/sgouezel/mathlib/settings/actions
I can't comment on the "waste of resources" part. The mathlib build only takes a fraction of the time limit set by github, they clearly seem to expect this usage. Are there any downsides to building mathlib with multiple lean versions? Do you get inundated with emails?
Are there any downsides to building mathlib with multiple lean versions?
Doesn't it harm the environment or something?
It probably does. I don't think GitHub Actions is CO₂-neutral
Yes, that's my point. Thanks @Gabriel Ebner , I have desactivated actions on my fork.
Also, mathlib master is currently broken (error in \archive\cubing_a_cube.lean
). I guess the new building tools do not test archive
properly...
Ouch... that happened quickly (-;
Anyway, better discover it now instead of 3 months from now
If you go to https://github.com/leanprover-community/mathlib/runs/409812707 for instance, the test
step seems to succeed, but if you open it you will see an error.
Also:
leanpkg build 1h 16m 7s > lean --make src Run leanpkg build | python scripts/detect_errors.py WARNING: Lean version mismatch: installed version is nightly-2020-01-12, but package requires 3.4.2 configuring mathlib 0.1 WARNING: Lean version mismatch: installed version is nightly-2020-01-12, but package requires 3.4.2 > lean --make src
Re: broken archive file. See https://github.com/leanprover-community/mathlib/pull/1911
@Johan Commelin Are you worried about the warnings? Right now 3.5c should be backward compatible and we want to test with both. Once we officially bump mathlib we'll drop the 3.4.2 test (and package requirement).
#1912 to fix the archive.
Ok, if the warnings are deliberately ignored, I'm fine with that. :grinning_face_with_smiling_eyes:
More pressing is the fact that there is some authentication issue causing pushes to mathlib-nightly to fail, so that update-mathlib
is fetching a commit that's a few days out of date. I also had a question here about why each PR commit triggers 4 github actions runs.
We're working on the authentication thing.
I briefly looked around and didn't see an easy fix for the duplicated builds on a PR from a branch.
We could disable branch builds. But once we're storing build artifacts, we might want them.
We're failing later than ever before: :tada: https://github.com/leanprover-community/mathlib/runs/413414692
Now we get:
++ git push mathlib HEAD:refs/heads/lean-3.4.2 remote: Permission to leanprover-community/mathlib.git denied to leanprover-community-bot.
As well as:
++ git push nightly HEAD:mathlib-master To https://github.com/leanprover-community/mathlib-nightly.git ! [rejected] HEAD -> mathlib-master (non-fast-forward) error: failed to push some refs to '***github.com/leanprover-community/mathlib-nightly.git' hint: Updates were rejected because a pushed branch tip is behind its remote hint: counterpart. Check out this branch and integrate the remote changes hint: (e.g. 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
And:
++ git push nightly tag nightly-2020-01-28 To https://github.com/leanprover-community/mathlib-nightly.git ! [remote rejected] nightly-2020-01-28 -> nightly-2020-01-28 (shallow update not allowed)
The 3.4.2 failure is because of a branch protection rule, I just added leanprover-community-bot to the access list.
Absolutely no idea about the others. I guess we need to add a git log
to see what it's trying to push?
https://github.com/leanprover-community/mathlib/pull/1919 <-- this should fix the rest
That fixes the "branch tip is behind its remote" error?
Okay, yeah, I guess it sounds plausible.
I'm not sure either.
Well, fingers crossed once again.
Damn, almost there. Can anybody please delete the nightly-2020-01-28
tag in the nightlies repo (ideally within 60 minutes)? The script managed to create the tag but didn't upload the tarballs. @Rob Lewis @Simon Hudon
Done.
Thank you!
It looks like there's still some kind of branch protection problem though?
I've already fixed it.
Ah, cool.
Oops, forgot to click "save changes". Thanks for making me look at the settings page again.
:tada:
Thanks Gabriel!
What's the purpose of the install olean-rs
state of the build script? I don't see where it's being used.
I guess it's related to #687. It was present in the Travis script but doesn't seem to be used there either.
There was a time where it was used to check mathlib but the error messages irritated people more than it helped them so it got disabled.
Maybe turn it on again to see if it is broken?
I'll run it locally to see what it says. Probably better to remove it completely from CI for now.
Should we remove the 3.5c nightly build from CI? I think this is asking for trouble if/when breaking changes make it into 3.5c. We should be following a release schedule there and updating mathlib to be compatible with each release.
There's now an API for downloading GitHub Actions Artifacts. I think it should be possible now to use this to make cache-olean --fetch
work with PR branches. Does anyone (else) want to take a shot at it?
Oh, wow, that happened a lot sooner than I expected.
I was planning to look into external hosting for olean caches in the next few weeks. But if this works it could be easier.
Not sure how much trouble the API rate limiting will cause.
Can't we use GitHub authentication to have a higher rate?
If you want to try it out, feel free, I don't think I'll have time this week.
Patrick Massot said:
Can't we use GitHub authentication to have a higher rate?
Maybe, no idea.
Yeah, please go for it.
I'll try to find time for the bundle thing, so I'll leave cache-olean to Bryan. Note that any work on this should probably start with fixing the huge UX bug in cache-olean and update-mathlib that we talk to GitHub before trying to find a local archive.
It looks like Github authentication is required to use any of the Github actions API endpoints, so cache-olean
users who want to download artifacts will have to supply a personal access token somehow.
What about trying to do what elan does to avoid using this API?
In the case of mathlib nightlies we can even directly use the url which is predictable
As far as I can tell the github artifact URLs for each PR are not really predictable.
The alternative would be to upload all generated olean files to some server that we control. I believe this was the original plan when it was still unclear whether / when an official github artifact API would become available.
I guess cache-olean and update-mathlib could ask the user to give a token during installation? It could be optional, and if there's no token they could default to the current behavior.
It would probably be asking for trouble to generate a default PAT ourselves, right?
What is a PAT?
An acronym I made up because I didn't want to type personal access token.
This all sounds a bit silly. It may be faster to work on other hosting solutions.
Looks like a reference to Curry-Howard (Proof As Terms, Propositions As Types).
{% endraw %}Last updated: Apr 24 2020 at 19:02 UTC


operator style call of "createNewTargetElement[T <: EObject](cls : Class[T])"
operator style call of "createNewTargetElement[T <: EObject](cls : Class[T])"
the class representation of the metamodel type that should be created
the newly created element
operator style call of "createNewTargetElement(typeName: String)"
operator style call of "createNewTargetElement(typeName: String)"
the string representation of the metamodel type name that should be created
the newly created element
Creates a new object in the output model and returns its instance
Creates a new object in the output model and returns its instance
the class representation of the metamodel type that should be created
the newly created element
Creates a new object in the output model and returns its instance
Creates a new object in the output model and returns its instance
the string representation of the metamodel type name that should be created
the newly created element
this attribute stores the current executed rule, so tracing can be done in method without this context
this attribute stores the current executed rule, so tracing can be done in method without this context
Getter for objects of the input model
Getter for objects of the input model
the class object of the meta model type in the source model that should be retrieved
the set of objects in the source model that have the given type
getter of the created elements
getter of the created elements
all created elements
access method to certain created objects
access method to certain created objects
the class object of the the meta model type that should be retrieved
the set of created objects with the given type
Getter for the transformation object
Getter for the transformation object
the transformation object this helper belongs to
The logger instance for each class
The logger instance for each class
This method searches in all rules of the transformation to find one that matches the given signature (converting from sourceMM1 to targetMM2).
This method searches in all rules of the transformation to find one that matches the given signature (converting from sourceMM1 to targetMM2). If its a unique rule that it is additionally checked, if this transformation already was performed, than the already created target object is returned
The source object that should be transformed
The class to whitch the source should be transformed to
The transformed source to an instance of targetMM2, otherwise an exception is thrown
Transforming one source element to many target elements
Transforming one source element to many target elements
A class representing the wanted target type
a list of created target elements from the given source element
An object of this class is given to the execution methods of rules of a transformation. Service methods to perform actions in the transformations are given


0 %}
{% assign split_name = game.screenshots[0] | split: "." %}
style="background-image: url('{{site.stage_path}}{{game.stage_game_path}}images/{{split_name[0]}}.webp')"
{% endif %}
{% else %}
{% if game.thumbnail %}
style="background-image: url('{{site.stage_path}}{{game.stage_game_path}}images/{{game.thumbnail}}')"
{% elsif game.screenshots.size > 0 %}
style="background-image: url('{{site.stage_path}}{{game.stage_game_path}}images/{{game.screenshots[0]}}')"
{% endif %}
{% endif %}>
{% if hover_img_preload %}
{{ game.title }}
{{game.semester}} {{game.year}}
{% for member in game.project_members %}
{{member[0]}}
{% endfor %}
{{game.description | newline_to_br | strip_html | strip_newlines | strip | replace: '"', ''}}


I am a Software Engineer interested in independent consulting, and a recent graduate of Prime Digital Academy. I would like to have the opportunity to continuously learn more about programming as I work in the field. In the future I would like to work on a project or product that could make a significant difference in the world.
Worked with a remote development team across the US to deliver personalized websites
Worked with fellow classmates to create a variety of projects and applications
GPA: 3.7
Apart from being a web developer, I enjoy most of my time playing games, both board and video.
I follow a number of sci-fi and fantasy genre movies and television shows, and I spend a large amount of my free time exploring the latest technology advancements in the web development world.


Authorities: Amtrak train hits vehicle in Florida, 3 dead
by KNOEJUPITER, Fla. (AP) — Authorities say three people in Florida were killed in a vehicle that collided with an Amtrak passenger train, but no passengers aboard the train were hurt.
Palm Beach County Fire Rescue told news outlets the crash happened about 2 p.m. Saturday in Indiantown, which is north of West Palm Beach.
Amtrak spokeswoman Christina Leeds said in an email that the train was traveling from Miami to New York. She added that none of the 200 train passengers was injured.
Authorities say a vehicle was heavily damaged and the occupants were killed.
The cause of the crash was not immediately available.
Leeds says local officials are investigating.
Copyright 2019 Associated Press. All rights reserved.


Index
JsRender: Next-generation jQuery Templates
Optimized for high-performance pure string-based rendering, without DOM or jQuery dependency. (Current version - "codeless" tag syntax)
Step by Step samples
Inserting data values
Compiling templates from strings
{{= }} and {{= !}}
{{if}} and {{else}}
{{each}}
Template composition
Accessing paths
Custom tags
'Helper' tags
'Helper' functions, and comparison tests
Allowing code - program flow
Allowing code - returning content
JsRender without jQuery


rstoolbox.analysis.
sequential_frequencies
(df, seqID, query='sequence', seqType='protein', cleanExtra=True, cleanUnused=-1)¶Generates a SequenceFrame
for the frequencies of the sequences in the
DesignFrame
with seqID
identifier.
If there is a reference_sequence
for this seqID
, it will also
be attached to the SequenceFrame
.
All letters in the sequence will be capitalized. All symbols that
do not belong to string.ascii_uppercase
will be transformed to “*”
as this is the symbol recognized by the substitution matrices as gap
.
This function is directly accessible through some DesignFrame
methods.
| Parameters: |
|
|---|---|
| Returns: |
See also
DesignFrame.sequence_frequencies()
DesignFrame.sequence_bits()
DesignFrame.structure_frequencies()
DesignFrame.structure_bits()
Example
In [1]: from rstoolbox.io import parse_rosetta_file
...: from rstoolbox.analysis import sequential_frequencies
...: import pandas as pd
...: pd.set_option('display.width', 1000)
...: pd.set_option('display.max_columns', 500)
...: df = parse_rosetta_file("../rstoolbox/tests/data/input_2seq.minisilent.gz",
...: {'scores': ['score'], 'sequence': 'AB'})
...: df = sequential_frequencies(df, 'B')
...: df.head()
...:


Biography
I was born in the state of Arizona until the age of 17. Shortly after high school, I joined the United States Marine Corps. In the Marine Corps I served my first enlistment as a motor transport operator and went on one deployment to Iraq for 13 months. After returning from Iraq, I re-enlisted and changed career fields and became an imagery analyst. During my second enlistment I was deployed to Afghanistan and aboard the USS New Orleans. After the military I moved to Las Vegas, NV where I currently reside. My first career outside of the military was as an industrial hygienist. I am currently in the process of changing career fields again and hope to become a software developer.
I have one child of my own named Makenna, who will be turning 15 in November. I am currently engaged to my fiancé, Kristin who has two children of her own. Their names are Kaydin, 14, and Layla, 8. My hobbies include watching sports, playing hockey, and playing video games. I hope that one day I will be able to travel around the United States while working remotely and make trips to other countries.
Job Experience and Education History
- 2005 to 2014: United States Marine Corps, Imagery Analyst/Motor Transport Operator
- 2015 to 2016: SCS Engineers, Industrial Hygienist
- 2016 to 2017: ManTech International, Industrial Hygienist
- 2018 to 2021: MP Materials, Industrial Hygienist
- Columbia Southern University: 2018 to 2021, Bachelor of Science in Occupational Health and Safety, 4.0 GPA
Goals
- Break into the coding field
- Retire by age 50
- Watch a hockey game at every NHL arena
- Move somewhere in the mountains during retirement
- Visit Ireland
Top Ten Games I Want to Attend
- San Fransisco 49ers
- Pittsburgh Steelers
- Winnipeg Jets
- Manchester United F.C.
- Seattle Kraken
- Chicago Blackhawks
- Chicago Cubs
- Tampa Bay Lightning
- Carolina Hurricanes
- UCF Knights


..
about me
I’m a computational neuroscientist by training - I’m passionate about neuroscience, particularly electrophysiology, and I’ve done some research work in the field in the past. For a rundown of my work experience, find me on LinkedIn.
I love books, especially sci-fi (my favorite is a toss-up between Blindsight and Solaris), and horror movies. I have a lot of hobbies, which include, but are not limited to, painting (some digital work here), playing piano, learning languages (今はそれが日本語です) and extremely non-competitive running while listening to podcasts.
Education:
2016 - BSc in Neuroscience (minor in CS) - New York University
2019 - MSc in Neural Systems and Computation - ETH Zürich and the University of Zürich


# The MIT License (MIT)
# Copyright (c) 2014-2017 University of Bristol
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# # The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
# OR OTHER DEALINGS IN THE SOFTWARE.
"""
Database channel module.
"""
from mongoengine import NotUniqueError, InvalidDocumentError
from mongoengine.context_managers import switch_db
from pymongo.errors import InvalidDocument
import logging
from base_channel import BaseChannel
from hyperstream.utils.errors import StreamAlreadyExistsError, StreamNotFoundError
from ..time_interval import TimeIntervals
from ..models import StreamInstanceModel
from ..stream import StreamInstance, DatabaseStream
from ..utils import utcnow
[docs]class DatabaseChannel(BaseChannel):
"""
Database Channel. Data stored and retrieved in mongodb using mongoengine.
"""
def __init__(self, channel_id):
"""
Initialise this channel
:param channel_id: The channel identifier
"""
super(DatabaseChannel, self).__init__(channel_id=channel_id, can_calc=True, can_create=False)
# self.update_streams(utcnow())
[docs] def update_streams(self, up_to_timestamp):
"""
Update the streams
:param up_to_timestamp:
:return:
"""
raise NotImplementedError
[docs] def get_results(self, stream, time_interval):
"""
Get the results for a given stream
:param time_interval: The time interval
:param stream: The stream object
:return: A generator over stream instances
"""
query = stream.stream_id.as_raw()
query['datetime'] = {'$gt': time_interval.start, '$lte': time_interval.end}
with switch_db(StreamInstanceModel, 'hyperstream'):
for instance in StreamInstanceModel.objects(__raw__=query):
yield StreamInstance(timestamp=instance.datetime, value=instance.value)
[docs] def create_stream(self, stream_id, sandbox=None):
"""
Create the stream
:param stream_id: The stream identifier
:param sandbox: The sandbox for this stream
:return: None
:raises: NotImplementedError
"""
if sandbox is not None:
raise NotImplementedError
if stream_id in self.streams:
raise StreamAlreadyExistsError("Stream with id '{}' already exists".format(stream_id))
stream = DatabaseStream(channel=self, stream_id=stream_id, calculated_intervals=None,
last_accessed=utcnow(), last_updated=utcnow(), sandbox=sandbox)
self.streams[stream_id] = stream
return stream
[docs] def purge_stream(self, stream_id, sandbox=None):
"""
Purge the stream
:param stream_id: The stream identifier
:param sandbox: The sandbox for this stream
:return: None
:raises: NotImplementedError
"""
# TODO: Add time interval to this
if sandbox is not None:
raise NotImplementedError
if stream_id not in self.streams:
raise StreamNotFoundError("Stream with id '{}' not found".format(stream_id))
stream = self.streams[stream_id]
query = stream_id.as_raw()
with switch_db(StreamInstanceModel, 'hyperstream'):
StreamInstanceModel.objects(__raw__=query).delete()
# Also update the stream status
stream.calculated_intervals = TimeIntervals([])
logging.info("Purged stream {}".format(stream_id))
[docs] def get_stream_writer(self, stream):
"""
Gets the database channel writer
The mongoengine model checks whether a stream_id/datetime pair already exists in the DB (unique pairs)
Should be overridden by users' personal channels - allows for non-mongo outputs.
:param stream: The stream
:return: The stream writer function
"""
def writer(document_collection):
with switch_db(StreamInstanceModel, 'hyperstream'):
if isinstance(document_collection, StreamInstance):
document_collection = [document_collection]
for t, doc in document_collection:
instance = StreamInstanceModel(
stream_id=stream.stream_id.as_dict(),
datetime=t,
value=doc)
try:
instance.save()
except NotUniqueError as e:
# Implies that this has already been written to the database
# Raise an error if the value differs from that in the database
logging.warn("Found duplicate document: {}".format(e.message))
existing = StreamInstanceModel.objects(stream_id=stream.stream_id.as_dict(), datetime=t)[0]
if existing.value != doc:
raise e
except (InvalidDocumentError, InvalidDocument) as e:
# Something wrong with the document - log the error
logging.error(e)
return writer


btpermute.Rd
Permutation method to select variables for pair comparison data with
Bradley-Terry model. This procedure consists of two steps. In the first
step, btpermute
adds to the set of original predictors
an
additional set of 'fake' variables generated by randomly permuting the
original predictors
. Permuted predictors
are not expected to
have any predictive power for pairwise rankings. In the second step,
btpermute
adds predictors to the Bradley-Terry model. Each
predictors
(real and permuted) is added to a null model separately
and retained if the variable reduces the model deviance most strongly.
This process is replicated n
times with argument n.iterations
,
each time with a new random permutation that can be controlled for
replicability using argument seed
. Across the n n.iterations
the function identifies the predictor that appeared most often as the most
deviance-reducing one. When this has a real variable, it is added to the
model. Variable selection stops when a permuted variable(s) is found to be
the most frequent most deviance-reducing predictors
.
btpermute( contests = NULL, predictors = NULL, n.iterations = 15, seed = NULL, ... )
| contests | a data frame with pairwise binary contests with these variables
'id','player1','player2','win1','win2'; the id should match with those found in
|
|---|---|
| predictors | a data frame with player predictors with an id
that should match with |
| n.iterations | integer, number of iterations to compute |
| seed | integer, the seed for random number generation. If NULL (the default), gosset will set the seed randomly |
| ... | additional arguments passed to BradleyTerry2 methods |
an object of class gosset_btpermute
with the final BTm()
model,
selected variables, seeds (random numbers) used for permutations and deviances
Lysen, S. (2009) Permuted inclusion criterion: A variable selection technique. University of Pennsylvania https://repository.upenn.edu/edissertations/28/
Other model selection functions:
crossvalidation()
,
forward()
# \donttest{ require("BradleyTerry2") data("kenyachoice", package = "gosset") mod <- btpermute(contests = kenyachoice$contests, predictors = kenyachoice$predictors, n.iterations = 10, seed = 1) mod # }


Technical blog from Craig Russell.
This posts provides an example of how to configure an Amazon AWS Lambda
to send a push notification to Firebase FCM
, written with the Node.js 8.10
runtime.
This post assumes you are familiar with AWS Lambda already. If not, you can read more about it staight from the docs.
Create a new AWS lambda using the AWS Console. Configure these two options:
Runtime: Node.js 8.10
Handler: index.handler
// 'index' refers to the file you are about to create
// 'handler' refers to the function you are about to define
Create a single file called index.js
, and in it, paste the following:
// index.js
const http = require('http');
exports.handler = async(event, context) => {
return new Promise((resolve, reject) => {
const options = {
host: "fcm.googleapis.com",
path: "/fcm/send",
method: 'POST',
headers: {
'Authorization': process.env.authorization,
'Content-Type': 'application/json'
}
};
const req = http.request(options, (res) => {
resolve('success') ;
});
req.on('error', (e) => {
reject(e.message);
});
const reqBody = '{"to":"' + process.env.deviceToken + '", "priority" : "high"}'
req.write(reqBody);
req.end();
});
}
Note the two highlighted lines above: they both make use of process.env
to access environment variables.
This means you’ll need to configure the following environment variables for the lamba to be authorized to send a Firebase push notification.
authorization
This is the authorization header you receive from your Firebase account console.
It will likely have the form 'key=ABCDEFG....'
and you need to ensure you keep the key=
prefix.
deviceToken
This is the device token you receive from the device that will receive your Firebase push notification. You’ll receive this directly on the device as it registers for FCM.
That’s it. You should be able to save that and hit the test
button. When you do, your AWS Lambda will execute and send an HTTP POST request to Firebase FCM, triggering a push notification to your intended device.


This page includes the default stats pattern styles
Stats usage
Stats should be used with <dl>s to group the stat title and value. The `--big` variation can be used when the title or values are too long to sit next to each other in a row.
Default styles
- RBI
- 127
- BA
- .369
- HR
- 25
Big styles
- Total Runs Batted In
- 127
- Total Batting Average
- .369
- Total Home Runs
- 25


Covid(19)Out
Countries
Click on any country to show details.
#
Country
Cases
Death
Recovered
Recovery/Mortality
Graph
Active
Total cases
4920
Recovered
Death


The following containers are not registered in the above namespace/account and were removed:
Your server group will be in the cluster:
{{basicSettingsController.getNamePreview()}} (new cluster)
There is already a server group in this cluster. Do you want to clone it?
Cloning copies the entire configuration from the selected server group, allowing you to modify whichever fields (e.g. image) you need to change in the new server group.
To clone a server group, select "Clone" from the "Server Group Actions" menu in the details view of the server group.


Registration on {{ host }}
You are successfully registered on {{ host }}. To activate your account follow the link: {{ link }}
Our support team is here to help with anything you need. Please feel free to contact us to<EMAIL_ADDRESS>in case of questions or any required assistance.


Caching
What Is Caching?
- Caching is the term for storing reusable responses in order to make subsequent requests faster.
- There are different types of caching available.
- Application caches and memory caches are both popular for their ability to speed up certain responses.
Types of Cache
- Disk cache: The page cache in main memory is managed by the operating system kernel.
- Web cache
- Memoization
- A cache can store data that is computed on demand rather than retrieved from a backing store.
- Memoization is an optimization technique that stores the results of resource-consuming function calls within a lookup table, allowing subsequent calls to reuse the stored results and avoid repeated computation.
Web Caching
Web caching is a core design feature of the HTTP protocol * It is meant to minimize network traffic while improving perceived responsiveness of the system as a whole.
Caches are found at every level of a content’s journey from the original server to the browser.
Web caching works by caching the HTTP responses for requests according to certain rules.
Subsequent requests for cached content can then be fulfilled from a cache closer to the user instead of sending the request all the way back to the web server.
Benefits
Effective caching aids both content consumers and content providers.
Some of the benefits that caching brings to content delivery are:
Decreased network costs: Content can be cached at various points in the network path between the content consumer and content origin.
When the content is cached closer to the consumer, requests will not add network latency
Improved responsiveness: Caching enables content to be retrieved faster because an entire network round trip is not necessary.
Caches maintained close to the user, like the browser cache, can make this retrieval nearly instantaneous.
Increased performance on the same hardware
- For the server where the content originated, more performance can be squeezed from the same hardware by allowing aggressive caching.
- The content owner can leverage the powerful servers along the delivery path to take the brunt of certain content loads.
Availability of content during network interruptions
Certain caches can be used to serve content even when if unavailable for short periods of time from the origin
Terminology
Origin server: The origin server is the original location of the content.
- If you are acting as the web server administrator, this is the machine that you control.
- It is responsible for serving any content that could not be retrieved from a cache along the request route
- Setting the caching policy for all content.
Cache hit ratio: A cache’s effectiveness is measured in terms of its cache hit ratio or hit rate.
- This is a ratio of the requests able to be retrieved from a cache to the total requests made.
- A high cache hit ratio means that a high percentage of the content was able to be retrieved from the cache. * This is usually the desired outcome for most administrators.
Freshness: Term used to describe whether an item in cache is considered a candidate to serve to a client.
- Content in a cache will only be used to respond if it is within the freshness time frame specified by the caching policy.
Stale content: Items in the cache expire according to the cache freshness settings in the caching policy.
Expired content is “stale”.
- Expired content cannot be used to respond to client requests. The origin server must be re-contacted to retrieve the new content or at least verify that the cached content is still accurate.
Validation: Stale items in the cache can be validated in order to refresh their expiration time.
- Validation involves checking with the origin server to see if cached content is still up to date
Invalidation: Invalidation is the process of removing content from the cache before its expiration date.
- Triggered if the item is changed on the origin server and an outdated item in cache causes client issues
Cacheable Content
Items that don’t tend to change frequently are good candidates for caching.
Cache Friendly Content:
- Logos and brand images
- Nav Icons
- Style sheets
- Javascript files
- Downloadable Content
- Media Files
More volatile items to cache:
- HTML pages
- Rotating images
- Heavily modified JavaScript and CSS files
- Content tied to auth (Cookies, Tokens, etc)
Some items that should almost never be cached are:
- Sensitive Dat (banking info, social security numbers, credit card numbers)
- user specific information that can change
Web Content Cache Locations:
Browser cache: Web browsers themselves maintain a small cache.
- Browsers sets a policy that dictates the most important items to cache.
- This may be user-specific content or content deemed expensive to download and likely to be requested again.
- We will explore IndexDb and Local Storage
- In memory caching as well
Intermediary caching proxies: Any server in between the client and infrastructure can cache certain content.
- These caches may be maintained by ISPs or other independent parties.
Reverse Cache: Your server infrastructure can implement its own cache for backend services.
- Content can be served from the point of contact instead of hitting backend servers on each request.
- For example hitting a database for each route that has cacheable content
- Content can be served from the point of contact instead of hitting backend servers on each request.
Caching HTTP Headers
Caching policy is dependent upon two different factors:
- The caching entity itself gets to decide whether or not to cache acceptable content.
- It can decide to cache less than it is allowed to cache, but never more.
The majority of caching behavior is determined by the caching policy, which is set by the content owner.
These policies are mainly exercises through the use of specific HTTP headers.
Cache-focused HTTP Headers:
Expires: The Expires header is very straight-forward, although fairly limited in scope.
- Set a time in the future when the content will expire.
- At this point, any requests for the same content will have to go back to the origin server.
- This header is probably best used only as a fall back.
Cache-Control: This is the more modern replacement for the Expires header.
- It is well supported and implements a much more flexible design.
- In almost all cases, this is preferable to Expires, but it may not hurt to set both values.
- We will discuss the specifics of the options you can set with Cache-Control a bit later.
Etag: The Etag header is used with cache validation.
- The origin can provide a unique Etag for an item when it initially serves the content.
- When a cache needs to validate the content it has on-hand upon expiration, it can send back the Etag it has for the content.
- The origin will either tell the cache that the content is the same, or send the updated content and new Etag
Last-Modified: Specifies the last time that the item was modified.
- This may be used as part of the validation strategy to ensure fresh content.
Content-Length: This header is important to set when defining caching policies.
- Certain software will refuse to cache content if it does not know in advanced the size of the content
Vary: A cache will use the requested host and the path to the resource as the key to store the cache item.
- The Vary header can be used to tell caches to pay attention to an additional header when deciding whether a request is for the same item.
- Tells caches to key by the Accept-Encoding header as well, so that the cache will know to differentiate between compressed and uncompressed content.
Cache-Control Flags
Cache-Control options:
no-cache: Specifies that any cached content must be re-validated on each request before being served to client.
- Contents is marked as stale immediately, but uses revalidation techniques to avoid re-downloading again
no-store: This instruction indicates that the content cannot be cached in any way.
- This is appropriate to set if the response represents sensitive data.
public: This marks the content as public, meaning it can be cached by the browser and any intermediate caches.
- For requests that HTTP authentication, responses are marked private by default.
- This header overrides that setting.
More options can be found at Cache Control
Options can be used in different ways to achieve various caching behavior.
Developing a Caching Strategy
Ideally everything would be cached and your servers would only be contacted to validate content occasionally.
This doesn’t often happen in practice though, so you should try to set some sane caching policies that aim to balance between implementing long-term caching and responding to the demands of a changing site.
Common Issues with Caching
There are many situations where caching cannot or should not be implemented due to how the content is produced
- Dynamic content generated by users
- Sensitive information such as banking information, etc.
- Older versions of your content are already out even though new versions have been published.
General Recommendations
Specific directories for images, css, and shared content
- Placing content into dedicated directories will allow you to easily refer to them from any page on your site.
Use the same URL to refer to the same items
- Caches key off of both the host and the path to the content requested
- Ensure that you refer to your content in the same way on all of your pages.
- The previous recommendation makes this significantly easier.
Use CSS image sprites where possible
- Sprites for items like icons and navigation decrease the number of round trips needed to render your site
- Allowing your site to cache that single sprite for a long time.
- Use Single SVG file instead of multiple svg as well
Host scripts and external resources locally where possible
- If you utilize javascript scripts and other external resources, consider hosting those resources on your own dedicated servers if the correct headers are not being provided upstream.
- Keep up to date with downstream changes however so you can update your local copy
Fingerprint cache items
- For static content like CSS and Javascript files, it may be appropriate to fingerprint each item.
- This means adding a unique identifier to the filename (often a hash of the file) so that if the resource is modified, the new resource name can be requested, causing the requests to correctly bypass the cache.
- There are a variety of tools that can assist in creating fingerprints and modifying the references to them within HTML documents.
Allow all caches to store generic assets
- Static content and content that is not user-specific should be cached at all points in the delivery chain.
- This will allow intermediary caches to respond with the content for multiple users.
Allow browsers to cache user-specific assets
- For per-user content, it is often acceptable and useful to allow caching within the user’s browser.
- Caching in the browser will allow for instant retrieval for users during subsequent visits.
Make exceptions for essential time-sensitive content
- Sites that have a shopping cart should reflect the items in the cart immediately.
- The no-cache or no-store options can be set in the Cache-Control header to achieve this.
- Sites that have a shopping cart should reflect the items in the cart immediately.
Always provide validators
- Validators allow stale content to be refreshed without having to download the entire resource again.
- Setting the Etag and the Last-Modified headers allow caches to validate their content and re-serve it if it has not been modified at the origin, further reducing load.
Set long freshness times for supporting content
- Items like images and css that don’t change often
Set short freshness times for parent content
- The HTML itself will be downloaded frequently, allowing it to respond to changes rapidly.
- The supporting content can then be cached aggressively.
The key is to strike a balance that favors aggressive caching where possible while leaving opportunities to invalidate entries in the future when changes are made.
Each Site will likely have the following items:
- Aggressively cached items
- Cached items with a short freshness time and the ability to re-validate
- Items that should not be cached at all
The goal is to move content into the first and second category when possible while maintaining an acceptable level of accuracy.
Memoization
Memoization is an optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again.
The term “memoization” was coined by Donald Michie in 1968[5] and is derived from the Latin word “memorandum” (“to be remembered”), usually truncated as “memo” in the English language, and thus carries the meaning of “turning [the results of] a function into something to be remembered.”
A memoized function “remembers” the results corresponding to some set of specific inputs.
Subsequent Function calls with remembered inputs return the remembered result rather than recalculating the result Thus eliminating the primary cost of a call with given parameters from all but the first call made to the function.
A function can only be memoized if it is referentially transparent if calling the function has exactly the same effect as replacing that function call with its return value.
Memoization is a run-time rather than compile-time optimization.
Memoization is heavily used in compilers for functional programming languages, which often use call by name evaluation strategy.
Memoization incurs a higher memory overhead since we must store our cached results so that we can later recall them Therefore memoization only makes sense for functions that are computationally expensive.
Web SQL
Methods
There are following three core methods defined in the spec that I.m going to cover in this tutorial − * openDatabase − This method creates the database object either using existing database or creating new one. * transaction − This method give us the ability to control a transaction and performing either commit or roll-back based on the situation. * executeSql − This method is used to execute actual SQL query.
Code
function prepareDatabase(ready, error) {
return openDatabase('documents', '1.0', 'Offline document storage', 5*1024*1024, function (db) {
db.changeVersion('', '1.0', function (t) {
t.executeSql('CREATE TABLE docids (id, name)');
}, error);
});
}
function showDocCount(db, span) {
db.readTransaction(function (t) {
t.executeSql('SELECT COUNT(*) AS c FROM docids', [], function (t, r) {
span.textContent = r.rows[0].c;
}, function (t, e) {
// couldn't read database
span.textContent = '(unknown: ' + e.message + ')';
});
});
}
prepareDatabase(function(db) {
// got database
var span = document.getElementById('doc-count');
showDocCount(db, span);
}, function (e) {
// error getting database
alert(e.message);
});
Plunker Playground
https://plnkr.co/edit/znJwyXsqVvHVegqS7Vrd?p=preview
IndexDB
Higher Level Overview of IndexDB
IndexedDB is a low-level API for client-side storage of significant amounts of structured data, including files/blobs.
- This API uses indexes to enable high-performance searches of this data.
- Web Storage is useful for storing smaller amounts of data, but less useful for storing larger amounts of structured data.
- IndexedDB provides a solution for this
Accessing IndexDB
In Chrome you can inspect IndexDb
in the Application Tab in the Developer Tools
We will look at indexdb in the running UI application
Running the application
- Visit Caching and Memoization Repo
- Run
npm install
- Run
npm run dev
in order to start the application
Local Storage
Local Storage API
Methods:
- getItem
- setItem
JSFiddle Example
Redis
Redis is not a plain key-value store, it is actually a data structures server, supporting different kinds of values.
Redis Data Structures:
- Binary-safe strings.
- Lists: collections of string elements sorted according to the order of insertion. They are basically linked lists.
- Sets: collections of unique, unsorted string elements.
- Sorted sets, similar to Sets but where every string element is associated to a floating number value, called score.
- Hashes, which are maps composed of fields associated with values. Both the field and the value are strings.
- Bit arrays (or simply bitmaps): it is possible, using special commands, to handle String values like an array of bits
- HyperLogLogs: this is a probabilistic data structure which is used in order to estimate the cardinality of a set.
Redis Database
- In Redis, databases are simply identified by a number with the default database being number 0.
- If you want to change to a different database you can do so via the select command.
- In the command line interface, type select 1.
- Redis should reply with an OK message and your prompt should change to something like
redis <IP_ADDRESS>:6379[1]>.
- If you want to switch back to the default database, just enter select 0 in the command line interface
Redis Commands
Redis commands are grouped by functionality
- Sets
- Unique Elements.
- Available commands: sadd, scard, sismember
- Lists:
- collections of string elements
- Available commands: llen, lpush
- Keys
- Hashes
- consist of key and value pairs
Find all the available Redis Commands here Redis Commands
You can filter by functionality because the default is to show all the Redis Commands
Redis Clients
You can find all the available Redis Client Libraries here Redis Clients
The particular client we will be using for the workshop is Node Redis
Redis breaks out uses for data structures according to how they should be used albeit lists, hashes, scalars, and sets
This means that if you have JSON object in Redis you can’t just store like an json object
Also nested json objects should either be stringified with JSON.stringify(obj)
or used with a hash data structure
Querying Redis
Redis stores everything as a key so you can’t use it like you would think as a normal query language
For example
SELECT * from Books where Books.id = 1
A type of query such as this wouldn’t work in Redis
- Use lots of key-value pairs in Redis.
- So feel free to store each row of the table in a different row.
- Use Redis’ hash map data type
- Form key name from primary key values of the table by a separator (such as “:“)
- Store the remaining fields as a hash
- When you want to query a single row, directly form the key and retrieve its results
- When you want to query a range, use wild char “*” towards your key.
Memory and Persistence in Redis
Redis is an in-memory persistent store
Redis keeps all your data in memory so there is an associated cost for this in terms of Server RAM
Redis Data Structures
Strings
> set movies:rocky '{ "name": rocky, "characters": ["Rocky Balboa", "Paulie", "Adrien"] }'
OK
> get movies:rocky
"{ \"name\": rocky, \"characters\": [\"Rocky Balboa\", \"Paulie\", \"Adrien\"] }"
> strlen movies:rocky
(integer) 69
> append movies:rocky "Yo Adrian"
(integer) 78
> get movies:rocky
"{ \"name\": rocky, \"characters\": [\"Rocky Balboa\", \"Paulie\", \"Adrien\"] }Yo Adrian"
Notice above here that the string Yo Adrian was appended to the JSON object which doesn’t really make sense A JSON object can’t really be represented as a string
<IP_ADDRESS>:6379[1]> help incr
INCR key
summary: Increment the integer value of a key by one
since: 1.0.0
group: string
<IP_ADDRESS>:6379[1]> incr random:num
(integer) 1
<IP_ADDRESS>:6379[1]> incr random:num
(integer) 2
<IP_ADDRESS>:6379[1]> help incrby
INCRBY key increment
summary: Increment the integer value of a key by the given amount
since: 1.0.0
group: string
<IP_ADDRESS>:6379[1]> incrby num:incr 10
(integer) 10
<IP_ADDRESS>:6379[1]> incrby num2:incr 25
(integer) 25
<IP_ADDRESS>:6379[1]> incr movies:rocky
(error) ERR value is not an integer or out of range
Notice here that trying to increment movies:rocky created a Redis error which makes sense movies:rocky is a string
Exercise
- Implement redis command
incr
using node_redis client library Node Redis- open
playground/strings.js
- open
open test/unit/strings.test.js
- Write a test with your new function
- Run your test with command
npm test
Hashes
Hashes are like strings except you have a field value
<IP_ADDRESS>:6379[1]> hset users:user name bob
(integer) 1
<IP_ADDRESS>:6379[1]> hget users:user name
"bob"
<IP_ADDRESS>:6379[1]> hmset movie:fields name "Rocky" rating 5 year 1976
OK
<IP_ADDRESS>:6379[1]> HGETALL movie:fields
1) "name"
2) "Rocky"
3) "rating"
4) "5"
5) "year"
6) "1976"
<IP_ADDRESS>:6379[1]> hkeys movie:fields
1) "name"
2) "rating"
3) "year"
<IP_ADDRESS>:6379[1]> hkeys movie:fields
1) "name"
2) "rating"
3) "year"
<IP_ADDRESS>:6379[1]> hdel movie:fields rating
(integer) 1
<IP_ADDRESS>:6379[1]> hkeys movie:fields
1) "name"
2) "year"
Notice that we were able to set multiple fields with the Redis command hmset
and get all the values with hgetall
Hashes give you more control than regular strings because you can map values instead of one scalar value
Exercise
- Implement redis command
hdel
using node_redis client library Node Redis- open
playground/hashes.js
- open
open test/unit/hashes.test.js
- Write a test with your new function
- Run your test with command
npm test
Lists
<IP_ADDRESS>:6379> lpush users "soldier" "John Rambo" "123-45-5678" "Sergeant First Class"
(integer) 4
<IP_ADDRESS>:6379> lindex users 0
"Sergeant First Class"
<IP_ADDRESS>:6379> lindex users 1
"123-45-5678"
<IP_ADDRESS>:6379> lindex users 2
"John Rambo"
<IP_ADDRESS>:6379> lindex users 3
"soldier"
<IP_ADDRESS>:6379[1]> lpop users
"Sergeant First Class"
<IP_ADDRESS>:6379> llen users
(integer) 3
<IP_ADDRESS>:6379[1]> rpop users
"soldier"
<IP_ADDRESS>:6379> rpop users
"soldier"
<IP_ADDRESS>:6379> llen users
(integer) 2
Notice here that we pushed 4 strings onto the list users
lindex
takes a key and a index and returns the value if found else it returns nil
so the lookup:
lindex users 2
return “John Rambo”
Notice that rpop
removes and returns the last element of the list stored at key
so when we run llen
the list has been reduced by 1.
Conversely lpop
removes and returns the first element of the list stored at key
so when we run llen
again the list is now length of 2
- Implement redis command
llen
orrpop
using node_redis client library Node Redis- open
playground/list.js
- open
open test/unit/list.test.js
- Write a test with your new function
- Run your test with command
npm test
Sets
- Sets are great for tagging or tracking any other properties of a value for which duplicates don’t make any sense
Sets are also greate when you want to apply set operations such as intersections and unions
<IP_ADDRESS>:6379> sadd movies "Rocky" (integer) 1 <IP_ADDRESS>:6379> sadd movies "The Matrix" (integer) 1 <IP_ADDRESS>:6379> sadd movies "Chinese Connection" (integer) 1 <IP_ADDRESS>:6379> scard movies (integer) 3 <IP_ADDRESS>:6379> sadd movies2 "Rocky" (integer) 1 <IP_ADDRESS>:6379> sadd movies2 "Rambo" (integer) 1 <IP_ADDRESS>:6379> sadd movies2 "Chinese Connection" (integer) 1 <IP_ADDRESS>:6379> sdiff movies movies2 1) "The Matrix" <IP_ADDRESS>:6379> sinter movies movies2 1) "Rocky" 2) "Chinese Connection" <IP_ADDRESS>:6379> sunion movies movies2 1) "The Matrix" 2) "Chinese Connection" 3) "Rocky" 4) "Rambo" <IP_ADDRESS>:6379> sismember movies "Rocky" (integer) 1 <IP_ADDRESS>:6379> smembers movies2 1) "Rambo" 2) "Rocky" 3) "Chinese Connection"
Notice here that created 2 different sets movies
and movies2
and we were able to do set operations on them.
sinter
returns the intersection between 2 or more setssdiff
returns the set difference between 2 or more setssunion
returns the all the movies that exist in the specified sets or more plainly the union between the setsscard
returns the total number of elements orcardinality
of the setsismember
returns 1 (i.e. true) if a value exists in the setsmembers
returns all the values in the setsadd
adds one or more members to a set
Read more commands at Redis Set Commands
- Implement redis command
sismember
orsunion
using node_redis client library Node Redis- open
playground/set.js
- open
open test/unit/set.test.js
- Write a test with your new function
- Run your test with command
npm test
Sorted Sets
- Redis Sorted Sets are, similarly to Redis Sets, non repeating collections of Strings
The difference is that every member of a Sorted Set is associated with score
- The score helps order the set,
- From the smallest to the greatest score
While members are unique, scores may be repeated.
<IP_ADDRESS>:6379> zadd grades 95 britney 85 dave 93 ashley 100 zhou (integer) 4 <IP_ADDRESS>:6379> zcard grades (integer) 4 <IP_ADDRESS>:6379> zrange grades 0 -1 1) "dave" 2) "ashley" 3) "britney" 4) "zhou" <IP_ADDRESS>:6379> zrevrank grades dave (integer) 3 <IP_ADDRESS>:6379> zrevrank grades zhou (integer) 0
zadd
added 4 members to the grades sorted setzcard
returned the cardinality value of 4zrange
returned the lowest to highest members in the sorted setzrevrank
returned the index of a member in a sorted set, with scores ordered from high to lowImplement redis command
zcard
using node_redis client library Node Redis- open
playground/sortedSet.js
- open
open test/unit/sortedSet.test.js
- Write a test with your new function
Run your test with command
npm test
Github Repository
If you like this information then please star this repository on Github at Caching and Memoization


--- layout: post title: Episode 115 | K. Scott Allen - Two Lives link: http://traffic.libsyn.com/developeronfire/DeveloperOnFire-115-KScottAllen.mp3 length: 36163076 speaker: Dave Rael duration: '00:37:34' subtitle: 'Developer On Fire: K. Scott Allen' guest_name: K. Scott Allen image: /assets/images/KScottAllen.jpeg guest_blog: http://odetocode.com/ guest_twitter: OdeToCode episode_number: 115 book_recommendations: - { url: "http://www.amazon.com/dp/0471295639/?tag=devonfir-20", title: "Against the Gods: The Remarkable Story of Risk", author: "Peter L. Bernstein"} tags: - { url: "http://www.amazon.com/dp/0471295639/?tag=devonfir-20", title: "Against the Gods: The Remarkable Story of Risk", author: "Peter L. Bernstein"} redirect_from: - "/115/" - "/115/" - "/115/" - "/0115/" - "/k.-scott-allen-two-lives/" - "/K.ScottAllen/" - "/K.-Scott-Allen/" - "/Podcast/Episodes/115/" - "/Podcast/Episodes/115/" - "/Podcast/Episodes/115/" - "/Podcast/Episodes/0115/" - "/Podcast/Episodes/k.-scott-allen-two-lives/" - "/Podcast/Episodes/K.ScottAllen/" - "/Podcast/Episodes/K.-Scott-Allen/" ---
Scott Allen has worked on everything from 8-bit embedded devices to large scale web sites during his 15+ years in commercial software development. Since 2001, Scott has focused on server-side and web technologies, like ASP.NET, ASP.NET AJAX, Windows Workflow, Silverlight, and LINQ. Scott is also a speaker at national conferences like VSLive!, as well as code camps and user groups near his hometown of Hagerstown, MD. Scott has been recognized as a Microsoft MVP since 2005, and has written or co-authored several books on Microsoft technologies. Scott founded the site OdeToCode.com in 2004, and joined Pluralsight in 2007.


Contact
Address
Phone
Contact
Title:
First Name:
Last Name:
Email:
Phone
Home:
Mobile:
Fax:
PIN:
Address
Address 1:
City:
Province:
Country:
Postal Code:


"Hello World!"
Web Design for Everybody: Basics of Web Development and Coding
Learn to Design and Create Websites. Build a responsive and accessible web portfolio using HTML5, CSS3, and JavaScript.
2021.07.21(TUE) ~ 22(THU)
Main Program
-
Lecture
Start the course and speech about web design.
-
First Stage
Start HTML-CSS course using semantic rules.
-
Forum
Share your doubts about what you are learning.
-
Second Stage
Start the course of JavaScript and Responsive Design
-
Closing Party
Closing the course and exchange of opinions.


I am sorry that there is no detailed documentation yet. Below you can find a brief explanation of how to train a multilayer perceptron with the program mlpt, how to execute a trained network on new data with the program mlpx, and how to do a sensitivity analysis of a trained network with the program mlps. For a list of options, call the programs without any arguments.
In the directory mlp/ex in the source package you can find training pattern sets for two simple logical functions (and / exclusive or) and for the well-known iris data (measurements of the sepal length / width and the petal length / width of three types of iris flowers). How to train neural networks for these examples is discussed below.
Enjoy,
Christian Borgelt
| back to the top |
As a first example let us take a look at the very simple problem of training a perceptron so that it computes the logical and. The training patterns for the mlpt program are stored in the file and.pat, which looks like this:
0 0 0 1 0 0 0 1 0 1 1 1
The first two columns state the input values, the third column states the corresponding output value. To train a multilayer perceptron for the logical and, type
mlpt -M and.pat and.net
This will train a perceptron with two input neurons, one output neuron and no hidden neurons for 1000 epochs. The option -M tells the program that the input is a pure numerical matrix and not a real data table with column names (see below). You need not specify the number of inputs/outputs, because by default the program assumes that there is only one output, which is in the last column, while all other columns are inputs. The program also assumes by default that there is no hidden layer.
The trained network will be written to the file and.net, which looks like this:
units = 2, 1; scales = [0.5, 2], [0.5, 2]; weights = {{ 2.83695, 2.83693, -2.83692 }}; ranges = [0, 1];
The line starting with units lists the number of neurons in the different layers, starting with the input layer and ending with the output layer. As you can see, there is no hidden layer in this network.
The next lines specifies linear transformations to be applied to the input values to normalize them to expected value 0 and standard deviation 1 (computed as the square root of the maximum likelihood estimate for the variance). There is one pair of values for each input neuron. The first value is an offset that is subtracted from the input value, the second a factor by which the result (input minus offset) is multiplied.
After the keyword weights the weights of the neurons are listed. Since in this network we only have one neuron having weights (namely the output neuron; the input neurons do not do any real work), we have only three weights: the weights of the two connection from the input neurons and the bias value (in this order).
The last line specifies the range of values of the output neuron. This range was computed from the training patterns and it is [0, 1], because we are dealing with a logical function. Note that if the range(s) of values of the output(s) column in the training data differ(s) from [0, 1] (the range of values of the logistic function), a linear transformation is applied to the output of each output neuron to map the interval [0, 1] to the range of values that was found in the training pattern set.
The perceptron trained above actually computes the logical and, as you can verify by typing
mlpx and.net and.pat and.out
This will compute the sum of squared errors (sse), the mean squared error (mse, mean over training patterns), and the root of the mean squared error (rmse) for the training patterns, which are (for the network above)
sse : 0.00919446 mse : 0.00229861 rmse: 0.0479439
In addition, since an output file was specified, an extended pattern file will be written to the file and.out. It looks like this:
0 0 0 0.000201242 1 0 0 0.0553624 0 1 0 0.0553603 1 1 1 0.944641
That is, the set of training patterns has been extended by a fourth column, which contains the output of the perceptron for the input patterns specified by the values in the first two columns. Of course, due to the sigmoid function, the result is not perfect (the values produced are not exactly 0 and 1), but the approximation is good enough.
| back to the top |
An equally simple approach as studied above for the logical and does not work for the exclusive or, i.e., for the input file xor.pat, which looks like this
0 0 0 1 0 1 0 1 1 1 1 0
Training a multilayer perceptron for this problem with
mlpt -M xor.pat xor.net
yields a network looking like this
units = 2, 1; scales = [0.5, 2], [0.5, 2]; weights = {{ 0.000318987, -0.00412534, 0.00176216 }}; ranges = [0, 1];
This network does not solve the problem, as can be seen from the fact that the error measures are
sse : 1.00001 mse : 0.250001 rmse: 0.500001
as well as from the output, produced, for instance, with
mlpx xor.net xor.pat xor.out
which looks like this
0 0 0 0.501392 1 0 1 0.501552 0 1 1 0.499329 1 1 0 0.499489
That is, no distinction is made between the training patterns. Of course, this is due to the fact that a simple perceptron can solve only linearly separable problems and the exclusive or is, obviously, not linearly separable. To solve this problem, we need a network with a hidden layer.
One or more hidden layers can be added to the network with the option -c followed by a colon-separated list of integer numbers. Each of these numbers specifies the number of neurons in a hidden layer. That is, -c2 adds a single hidden layer with 2 neurons, -c5:3 adds two hidden layers, one with 5 neurons and one with 3 neurons. The layers are assumed to be ordered from the input layer towards the output layer.
For the exclusive or problem, a hidden layer with 2 neurons is needed, hence you should type
mlpt -M -c2 -e5000 xor.pat xor.net
The option -e5000 increases the number of training epochs from 1000 (the default) to 5000, because it is often the case that the exclusive or problem is not solved in 1000 epochs. Note that you may combine the two options into -c2e5000.
The result is a network like this:
units = 2, 2, 1; scales = [0.5, 2], [0.5, 2]; weights = {{ 3.44362, -3.44365, 3.21714 }, { 3.52177, -3.52182, -3.55384 }}, {{ -6.89205, 7.1604, 3.19169 }}; ranges = [0, 1];
Here we have three numbers in the list of units, since we added a hidden layer with two neurons. The list of weights is expanded accordingly. We have two layers of neurons (outer curly braces), the first of which contains two neurons having three weights each (the inner curly braces group the weights per neuron), the second having only one neuron (the output neuron), also with three weights. As above, the first numbers in each group are the weights of the connection to the predecessor neurons, whereas the last number is the bias value.
The performance of this network, measured with
mlpx xor.net xor.pat xor.out
is
sse : 0.00642475 mse : 0.00160619 rmse: 0.0400773
and the output file looks like this:
0 0 0 0.0378462 1 0 1 0.962613 0 1 1 0.953499 1 1 0 0.037846
That is, the problem was actually solved.
5000 epochs may appear to be a lot for such a simple problem. However, this is due to the fact that the mlpt program uses standard backpropagation by default. A faster solution can be achieved by adding a momentum term with
mlpt -M -c2 -m0.9 xor.pat xor.net
This sets the momentum factor to 0.9 and thus the program reaches a satisfactory solution in a few hundred epochs. (Note again that the two options may be combined into -c2m0.9.)
| back to the top |
Let us now take a look at the more complex problem of training a multilayer perceptron for the iris data. To train such a network, type
mlpt -M -c3 -U3 iris.pat iris.net
The -c3 adds a hidden layer with 3 neurons, just as described above. The -U3 states that there should be three output neurons, one neuron for each of the three classes of iris flowers. (Note that the file with the training patterns has seven columns, the first four of which state the input values, while the last three code the class with a 1-in-n code.)
The resulting network looks like this
units = 4, 3, 3; scales = [5.84333, 1.21168], [3.05733, 2.30197], [3.758, 0.568374], [1.19933, 1.31632]; weights = {{ 0.878782, -1.11655, 1.753, 1.93157, 2.34027 }, { -1.16471, 1.76549, -2.04974, -2.99973, -2.84079 }, { -0.727816, -1.62847, 6.83127, 7.75607, -10.1281 }}, {{ -3.61975, 6.45599, -3.85032, -1.43268 }, { 3.21068, -6.26839, -9.754, 1.13484 }, { -0.810291, -3.11402, 9.66869, -3.46732 }}; ranges = [0, 1], [0, 1], [0, 1];
and it solves the problem fairly well, as can be seen from the measurements computed by
mlpx iris.net iris.pat iris.out
which are
sse : 3.70898 mse : 0.0247265 rmse: 0.157247
Inspecting the output file reveals that only three training patterns are misclassified (if each input pattern is assigned to the class with the largest activation).
Although standard backpropagation training works very well for the iris data, there is a better approach, namely the more flexible resilient backpropagation method. This method can be chosen with the -a option. The list of training methods, from which you may choose with the -a option is:
bkprop standard backpropagation supersab super self-adaptive backpropagation rprop resilient backpropagation quick quick backpropagation manhattan Manhattan training
Hence, to train a multilayer perceptron with resilient backpropagation type
mlpt -M -arprop -k0c3o3 iris.pat iris.net
Note that there is also the additional option -k0. This option specifies that the weights of the network should be updated only once for each epoch, namely after a full traversal of all training patterns. This additional option is necessary, because resilient backpropagation does not work well for online training.
In general the -k option specifies the number of patterns that should be processed before the weights are updated. As already explained above a value of 0 means that the weights are updated only once per epoch (batch training). The default is to update the weights after each training pattern (online training). -k10 means that the weights are updated every 10 training patterns. Hence, with the option -k, a gradual transition between pure online training (update after each training pattern) and pure batch training (update only once per epoch) can be achieved.
Sometimes the problem arises that the initial number of training epochs was chosen too low, so that the trained network is not good enough w.r.t. the given problem. An already trained network may be improved by specifying the file it is contained in as a third argument to the program mlpt. That is, for instance,
mlpt -M -e2000 iris.pat iris.new iris.old
takes the already trained network stored in the file iris.old, trains it for 2000 epochs with the patterns in the file iris.pat, and stores the result in the file iris.new. Note that the options -c, -U, and -w are ignored if an already trained network is given. Note also that the new network file may or may not have the same name as the old one.
| back to the top |
Up to now we always used the option -M to tell the program mlpt that the input is a numerical matrix. Without this option real data tables (with column names etc.) are possible. The main differences are:
Example: The command
mlpt -c2k0 -aquick iris.dom iris.tab iris.net
trains a multilayer perceptron with two hidden neurons for the iris data using resilient backpropagation. The result looks like this:
/*-------------------------------------------------------------------- domains --------------------------------------------------------------------*/ dom(sepal_length) = IR; dom(sepal_width) = IR; dom(petal_length) = IR; dom(petal_width) = IR; dom(iris_type) = { Iris-setosa, Iris-versicolor, Iris-virginica }; /*-------------------------------------------------------------------- multilayer perceptron --------------------------------------------------------------------*/ mlp(iris_type) = { units = 4, 2, 3; scales = [5.84333, 1.21168], [3.05733, 2.30197], [3.758, 0.568374], [1.19933, 1.31632]; weights = {{ 2.14492, -14.671, 33.8793, 59.3337, 42.8929 }, { 1.02566, 0.814512, -7.29516, -3.16734, 6.34753 }}, {{ -101.809, 36.3122, 1.11674 }, { 15.3094, 19.9228, -24.0699 }, { 13.4884, -60.6794, 12.9485 }}; ranges = [0, 1], [0, 1], [0, 1]; };
This network leads to only one misclassification (0.67%), as can be verified with the command
mlpx iris.net iris.tab
| back to the top |
The program mlps do a sensitivity analysis of a trained network on a given dataset (which may or may not be the dataset the network was trained on). Both programs compute the partial derivative of the outputs w.r.t. to the inputs for each input patterns. By default the maximum of these values for the different output neurons is used to assess how sensitive the outputs react to changes in the inputs. With the option -s the sum over the output units can be used instead of the maximum. The resulting values are summed over all training patterns.
| back to the top |
By changing the makefile, you can activate a table based computation of the logistic activation function of the neurons, which can lead to much lower training times. To compile the programs in this way, activate the line
CFLAGS = $(CFBASE) -DNDEBUG -O3 -DMLP_TABFN
in the makefile. (The definition of MLP_TABFN does the trick.) The table contains the values of the logistic function for 1024 equidistant points in the range 0 to 16. You may change the argument range or the number of points by adapting the definitions of TABMAX and TABSIZE in the file mlp/src/mlp.c.
It is also possible to compile the programs so that they use the tangens hyperbolicus as the activation function of the neurons. To get this version, activate the line
CFLAGS = $(CFBASE) -DNDEBUG -O3 -DMLP_TANH
in the makefile. (The definition of MLP_TANH changes the activation function to tanh.) There is also a table based version of this, which can be activated with
CFLAGS = $(CFBASE) -DNDEBUG -O3 -DMLP_TANH -DMLP_TABFN
There is a theoretical argument in favor of the tangens hyperbolicus: the output of a neuron is much less likely to be (close to) zero, which is desirable, since an output of zero means that the connection weights to the successor neurons do not get adapted. In practice, however, the logistic function usually leads to better results. I have not completely figured out the reasons for this yet.
Note that the initial weight range and the learning rate are changed to 0.5 and 0.05, respectively, if the tangens hyperbolicus is used. These changes are made to compensate for the different properties of the tangens hyperbolicus compared to the logistic function.
| back to the top |
mlpt/mlpx/mlps - train and execute multilayer perceptrons
copyright © 1996-2016 Christian Borgelt
(MIT license, or more precisely Expat License; to be found in the file mit-license.txt in the directory mlp/doc in the source package of the program, see also opensource.org and wikipedia.org)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| back to the top |
Download page with most recent version.
| back to the top |
| E-mail: |
<EMAIL_ADDRESS>| |
| Website: |
www.borgelt.net |
| back to the top |


This website is created inorder to help people who are planning a trip to diffrent parts of the world. It is a suggester based on the answers you provide for the questions. That way it will cut time to think and search destinations blindly, gives accurate info about the destination sites regarding the food, the weather of the places and more. It will be helping you find the best place to visit based on the mood you want to have for vacation. Enjoy.
Cairo & Nile cruise suits you well. To have a better look on the exotic tourist sites, click here. It will give you all the diffrent stourist place along with their price.
Bankok, a big and luxurious city is waiting for you. To have a better look on the exotic tourist sites, click here. It will give you all the diffrent tourist places along with their price.
 To have a better look on the exotic tourist sites, click here. It will give you all the differnt tourist places along with their price.


Responsive images
Retina
Adaptiveness
Format
Cropping
Format + Cropping
Retina + Format
Adaptiveness + Format + Cropping


kpmg
Businessmodel of KPMG
Customer Segments
KPMG has a mass market business model, with no significant differentiation between customers. The company targets its offerings at firms of all industries and sizes desiring audit, tax, and advisory services.
Value Proposition
KPMG offers three primary value propositions: accessibility, performance, and brand/status.
The company creates accessibility by offering a wide variety of options. It has actively pursued acquisitions in order to expand into new areas. Acquired companies include Link Analytics, a provider of scalable business analytics applications, and Cynergy, a provider of mobility services and digital experiences. These moves have enabled it to add new capabilities to its portfolio.
The company has demonstrated strong performance through results for clients. High-profile examples of this include the following:
- Helped a global industrial manufacturing conglomerate develop a logistics target operating model to help save it $100 million in three years
- Created benchmarking and scenario models for a recently acquired HVAC manufacturer that identified opportunities for it to save 11% in operational costs
- Transformed the retail sales process for a top wireless provider, which in turn increased sales reps‘ engagement and output
- Overhauled and updated Cigna’s financial and IT instructure, facilitating easier financial reporting at a lower cost
- Developed and implemented a human capital management system for Baylor Scott & White Health that had reduced manual activity and cost of ownership The company has established a powerful brand as a result of its performance. It is one of the “Big Four” audit firms, along with Ernst & Young, Deloitte, and PwC. It generated $24.4 billion in revenues in 2015, up 8.1% from the prior year. It has over 174,000 employees operating in 700 offices in 155 countries. It serves over 80% of the Fortune Global 500 and over 75% of the Forbes Global 1000. Lastly, it has won many honors, including ranking as #2 in the “World’s Best Outsourcing Advisors“ list by IOAP (2011), induction in the Working Mother Hall of Fame (2011), International Tax Review Asia Tax Awards (2010) and ranking as #2 in Consultancy Rankings by OpRisk & Compliance (2009).
Channels
KPMG’s main channel are the direct customer relationships of their partners. The company also promotes its offerings through its social media pages; webcasts; sponsorships of athletes such as Phil Mickelson, Stacy Lewis, Magdalena Forsberg, and Alexandre Bilodeau; and attendance of conferences.
Customer Relationships
KPMG’s customer relationship is primarily of a dedicated personal assistance nature. The company has its teams work closely with clients to solve their problems. It also offers “KPMG Learning”, a program consisting of training and executive education classroom courses covering various industry topics. Most of the courses qualify participants for continuing professional education credits. KPMG also provides phone and e-mail support as well as an International Hotline for more serious concerns.
Despite this orientation, there is a self-service component. The company’s website offers online versions of its classes as well as web-based self studies. It also includes a section called “KPMG Institutes” that features self-help resources such as articles, reports, podcasts, and webcasts on emerging industry trends, risks, and opportunities. Furthermore, it includes a glossary and a feature called “TaxNewsFlash” that offers summaries of recent tax developments.
Key Activities
KPMG’s business model entails designing and providing problem-solving services for clients.
Key Partners
KPMG maintains the following partnership programs:
Strategic Alliances – The company works with top service and technology providers to develop solutions that benefit its clients in areas such as data and analytics, regulatory change, disruptive technology, cyber security, and transformation. Specific partners include Microsoft, IBM, SAP, Oracle, Dun & Bradstreet, Flexera Software, Appian, Coupa, MetricStream, Nuix, and Thomson Reuters.
KPMG Capital – The company invests in other firms in order to foster innovation and commercialize new software solutions leveraging its strengths. Specific partners include Bottlenose, Astrus, Customer Compass, Financial Microscope, and Label Insight.
Key Resources
KPMG’s main resources are its employees, who include accounting professionals, consultants, and training specialists. The company also maintains important physical resources called Global Innovation Hubs. One type of hub is its collection of “Insights Centers” that enable customers to interact directly with their data and watch solutions come to life.
These are located in London, Frankfurt, Paris, and Hong Kong, with additional locations planned for Sydney, Melbourne, and New York. Another type of hub is its set of “Insights Labs”, research and development facilities where data scientists investigate D&A applications, incubate ideas, and develop proofs of concept while creating technology for use across regions and functions. They are located in the U.S., UK, and India.
Cost Structure
KPMG has a value-driven structure, aiming to provide a premium proposition through significant personal service. Its biggest cost driver is likely cost of services, a variable expense. Other major drivers are in the areas of customer support and operations and sales/marketing, both fixed costs.
Revenue Streams
KPMG has one revenue stream, the fees charged to its clients for its range of services. These fees vary by type of client and individual project.


Help us make a difference in spreading hope by donating today. Donations not required for participation. All donations go to Spokes of Hope
Spokes of Hope mission is to empower cancer patients and this year they're working on informational video that will guide cancer patients through the post cancer diagnosis events like..pre and post surgery management and care for different kinds of cancer.


--- layout: post status: publish published: true title: Capistrano Deploy with Git and Passenger author: display_name: Geoff Lane login: admin email<EMAIL_ADDRESS>url: http://www.zorched.net author_login: admin author_email<EMAIL_ADDRESS>author_url: http://www.zorched.net date: '2008-06-17 10:47:15 -0400' date_gmt: '2008-06-17 16:47:15 -0400' categories: - Ruby tags: - ruby-on-rails - git - mod_rails - capistrano comments: - id: 13216 author: Sean Lerner author_email<EMAIL_ADDRESS>author_url: http://theworkinggroup.ca date: '2008-06-18 13:03:23 -0400' date_gmt: '2008-06-18 19:03:23 -0400' content: Thanks, this was useful to me. - id: 13224 author: Capistrano and Ferret DRB author_email: '' author_url: http://www.zorched.net/2008/06/19/capistrano-and-ferret-drb/ date: '2008-06-19 10:27:09 -0400' date_gmt: '2008-06-19 16:27:09 -0400' content: "[...] is a bit of a followup to my previous post on Capistrano with Git and Passenger. I decided to use Ferret via the acts_as_ferret (AAF) plugin. Ferret is a full-text search inspired [...]" - id: 13487 author: Matt Darby author_email<EMAIL_ADDRESS>author_url: http://blog.matt-darby.com date: '2008-07-24 18:21:47 -0400' date_gmt: '2008-07-25 00:21:47 -0400' content: Good stuff! - id: 14380 author: get with git and important list of links to help you get started | Ryan Smith author_email: '' author_url: http://ryan-smith.org/2008/get-with-git/ date: '2008-12-21 18:25:15 -0500' date_gmt: '2008-12-22 00:25:15 -0500' content: "[...] capistrano & Git [...]" - id: 14728 author: Christoph author_email<EMAIL_ADDRESS>author_url: http://www.kimbo.me date: '2009-01-26 01:40:33 -0500' date_gmt: '2009-01-26 07:40:33 -0500' content: Thanks a lot, this made deploying with passenger and capistrano work like a charme. - id: 14951 author: PabloC author_email<EMAIL_ADDRESS>author_url: http://www.pablocorral.com.ar date: '2009-02-20 19:31:12 -0500' date_gmt: '2009-02-21 01:31:12 -0500' content: thanks!! - id: 15071 author: PEZ author_email<EMAIL_ADDRESS>author_url: http://www.bagonca.com/blog/author/pez/ date: '2009-05-01 06:27:44 -0400' date_gmt: '2009-05-01 12:27:44 -0400' content: Thanks a lot! I'll try this out right now and will get back with more comments about how I fared. Keep up the sharing! - id: 15100 author: Trey author_email<EMAIL_ADDRESS>author_url: http://exsellint.crm date: '2009-05-24 22:02:48 -0400' date_gmt: '2009-05-25 04:02:48 -0400' content: 'Nice write up! However, I was wondering if the setup was the same if you have multiple repositories you are deploying. I have multiple repos and am able to deploy to one of them with no problem, however I am getting a "repository not found" when trying to deploy to another. In the error, the repo name it is trying to access is correct and I am able to push changes with no problem ( I see the commit in github). Any ideas regarding why I may be seeing this? Here is the error message, any help would be greatly appreciated! * executing `deploy:update'' ** transaction: start * executing `deploy:update_code'' updating the cached checkout on all servers executing locally: "git ls-remote git@github.com:sfolks/exsellintcrm.git master" * executing "if [ -d /home/neo/apps/exsellintcrm/shared/cached-copy ]; then cd /home/neo/apps/exsellintcrm/shared/cached-copy && git fetch -q origin && git reset -q --hard 69335a40b5f37071f6fa2436b587a48fae4629c6; else git clone -q git@github.com:sfolks/exsellintcrm.git /home/neo/apps/exsellintcrm/shared/cached-copy && cd /home/neo/apps/exsellintcrm/shared/cached-copy && git checkout -q -b deploy 69335a40b5f37071f6fa2436b587a48fae4629c6; fi" servers: ["exsellintcrm.com"] Password: [exsellintcrm.com] executing command ** [exsellintcrm.com :: out] Repository not found. If you''ve just created it, please try again in a few seconds. ** [exsellintcrm.com :: out] fatal: The remote end hung up unexpectedly command finished *** [deploy:update_code] rolling back * executing "rm -rf /home/neo/apps/exsellintcrm/releases/20090525030837; true" servers: ["exsellintcrm.com"] [exsellintcrm.com] executing command command finished failed: "sh -c \"if [ -d /home/neo/apps/exsellintcrm/shared/cached-copy ]; then cd /home/neo/apps/exsellintcrm/shared/cached-copy && git fetch -q origin && git reset -q --hard 69335a40b5f37071f6fa2436b587a48fae4629c6; else git clone -q git@github.com:sfolks/exsellintcrm.git /home/neo/apps/exsellintcrm/shared/cached-copy && cd /home/neo/apps/exsellintcrm/shared/cached-copy && git checkout -q -b deploy 69335a40b5f37071f6fa2436b587a48fae4629c6; fi\"" on exsellintcrm.com' - id: 15104 author: Geoff Lane author_email<EMAIL_ADDRESS>author_url: http://www.zorched.net date: '2009-05-25 10:47:37 -0400' date_gmt: '2009-05-25 16:47:37 -0400' content: "@Trey, I've only ever tried it with one repository, so I'm not sure if it will work in a multiple repository model." - id: 15558 author: 'ConceptSpace: Rails Deployment; Capistrano, Passenger, NGINX' author_email: '' author_url: http://conceptspace.wikidot.com/blog:43 date: '2009-07-19 16:28:09 -0400' date_gmt: '2009-07-19 22:28:09 -0400' content: "[...] the easiest deployment experience, I think, we should deploy using Capistrano with Git and Passenger. Of course, we should modify that recipe to use NGINX. While Apache uses half a gig of memory, [...]" - id: 15593 author: kenny's me2DAY author_email: '' author_url: http://me2day.net/kenny/2009/08/09#13:48:45 date: '2009-08-08 22:49:09 -0400' date_gmt: '2009-08-09 04:49:09 -0400' content: "ì¼€ë‹ˆêµ°ì\x9D˜ ìƒ\x9Dê°\x81...\n\nOne of the great things about Rails and its community is that they are very lazy. ê·¸ë‹ˆê¹Œ, ê°œë°œìž\x90ëŠ” ê²Œì\x9D„ëŸ¬ì•¼ í•œë‹¤ë‹ˆê¹Œìš”. ê·¸ê²Œ ì§„ë¦¬!..." - id: 16253 author: redconfetti author_email<EMAIL_ADDRESS>author_url: http://www.redconfetti.com date: '2010-07-20 21:34:51 -0400' date_gmt: '2010-07-21 03:34:51 -0400' content: Thanks man. That really helped having an updated Capistrano recipe for Git/Passenger. Another one I was using was giving me some error because it was trying to run script/process/reaper - id: 16254 author: Setting up Deployment for Rails using Capistrano, Apache with Passenger and Git | redconfetti author_email: '' author_url: http://www.redconfetti.com/2010/07/setting-up-deployment-for-rails-using-capistrano-apache-with-passenger-and-git/ date: '2010-07-20 21:48:26 -0400' date_gmt: '2010-07-21 03:48:26 -0400' content: "[...] http://www.zorched.net/2008/06/17/capistrano-deploy-with-git-and-passenger/ [...]" - id: 17907 author: 'Capistrano Deploy with Git and Passenger: deploy.rb | è¡—è§’å’–å•¡åº—' author_email: '' author_url: http://www.huqiushi.com/?p=658 date: '2011-07-14 09:34:16 -0400' date_gmt: '2011-07-14 15:34:16 -0400' content: "[...] http://www.zorched.net/2008/06/17/capistrano-deploy-with-git-and-passenger/ [...]" - id: 18238 author: Ruby on Rails application deployment strategies | zzzzzzzzz author_email: '' author_url: http://www.zzzzzzzzz.net/?p=1104 date: '2012-12-26 00:59:06 -0500' date_gmt: '2012-12-26 06:59:06 -0500' content: "[...] http://www.zorched.net/2008/06/17/capistrano-deploy-with-git-and-passenger/ \ This entry was posted in Uncategorized and tagged apache, capistrano, deployment, mod_rails, passenger, ruby, ruby on rails, webdev by zzz_zwp. Bookmark the permalink. [...]" ---
One of the great things about Rails and its community is that they are very lazy. Lazy in the good way of not wanting to do boring, repetitive, error prone things manually. They metaprogram and they automate. A great example of this is Capistrano. Capistrano allows you to deploy Rails applications with ease. The normal scenario is baked into Capistrano as a deployment convention and then you can customize it if you need to.
I'm also using Git as my version control system on small, personal projects because it's easy to use and I can work on multiple laptops and commit locally and worry about pushing to a central location when I have a network connection.
Seeing those things, I wanted to make them all work with Capistrano so that I could continue being lazy. To do this, I'm using Capistrano v2.4. It has Git support built in that works (some previous versions had support for Git, but seemed to have a lot of trouble).
That's pretty much it - nice and easy. {% highlight ruby %} set :scm, :git set :repository, "geoff@zorched.net:myapp.git" set :branch, "master" set :deploy_via, :remote_cache {% endhighlight %}
Doing this requires just a bit of Capistrano customization. We need to override the deploy:restart task and have it run a small shell script for us. In this case we are running run "touch #{current_path}/tmp/restart.txt" to accomplish this task.
{% highlight ruby %} namespace :deploy do desc "Restarting mod_rails with restart.txt" task :restart, :roles => :app, :except => { :no_release => true } do run "touch #{current_path}/tmp/restart.txt" end {% endhighlight %}
We can also override the start and stop tasks because those don't really do anything in the mod_rails scenario like they would with mongrel or other deployments. {% highlight ruby %} [:start, :stop].each do |t| desc "#{t} task is a no-op with mod_rails" task t, :roles => :app do ; end end end {% endhighlight %}
# If you aren't deploying to /u/apps/#{application} on the target # servers (which is the default), you can specify the actual location # via the :deploy_to variable: set :deploy_to, "/var/www/myapp"
# If you aren't using Subversion to manage your source code, specify # your SCM below: set :scm, :git set :repository, "geoff@zorched.net:myapp.git" set :branch, "master" set :deploy_via, :remote_cache
set :user, 'geoff' set :ssh_options, { :forward_agent => true }
role :app, "zorched.net" role :web, "zorched.net" role :db, "zorched.net", :primary => true
namespace :deploy do desc "Restarting mod_rails with restart.txt" task :restart, :roles => :app, :except => { :no_release => true } do run "touch #{current_path}/tmp/restart.txt" end
[:start, :stop].each do |t| desc "#{t} task is a no-op with mod_rails" task t, :roles => :app do ; end end end {% endhighlight %}


Problems and Solutions
When I encounter a frustrating computer problem for which internet help is hard to
find, I will try to put the solution here.
ThinkPad beeps The people at IBM/Lenovo, in their
infinite wisdom, decided that the ThinkPad laptop should beep loudly
at every possible moment. Not a normal windows alert, but rather some
ridiculous system beep that is always much louder than your actual
volume. We're not living in the 80s folks, it's time to phase out
this computing appendage. Anywho,
this
blog shows you how to get rid of the keyboard beep.
The Greek letter \Xi is showing up as an i in LaTeX!
Annoying but true, this happened to me recently. Didn't find anything
online. Looks like this may not be a very common problem, as it didn't
seem to occur with any other Greek letters and only occurred for the
capital \Xi, not the lowercase \xi. It turned out the problem only
occurred because my \Xi was immediately proceeded by two non-breaking
spaces, as in:
~~\Xi
To get rid of the problem I simply inserted a real space between the
non-breaking spaces and my Xi:
~~ \Xi
I was unable to find the actual reason for this problem.
Creating an Eclipse Update Site with Source Code
For the full details on this problem and its solution, please
see this
blog post.
Select/Show/Reveal Java code in the Eclipse Java Editor
This one was really frustrating! Here's what I wanted to do: I wrote
my own Eclipse plugin and it deals with IJavaElements and ASTNodes, that
is, classes from the JDT framework. I had my own tree view, and I wanted
to make it so that if a user double-clicked an item in the TreeViewer
then that Java element would show up in the Java editor. Turns out
all of this good stuff is in the org.eclipse.jdt.ui.JavaUI class. Here's
how I did it:
IJavaElement element_which_was_selected;
JavaUI.openInEditor(element_which_was_selected, true, true);
The first true means, activate the editor, and the second
true means "reveal" this element. In other words, take me
to the line where it is located an highlight it. Seems easy in
hindsight!
Cygwin/Ocaml/X11: ld: cannot find -lX11
I was attempting to use the Graphics
module in Ocaml to create some simple graphs. I am using Cygwin, and I have X11 installed, but apparently not the
X11 development package, as I found out later. I followed their instructions to build a new top-level with
the graphics dynamically linked library built in. To do this, you type,
ocamlmktop -o mytop graphics.cma
Unfortunately, this gave me the following error:
ld: cannot find -lX11
The entire message was a bit longer because it gave me the full path of my
linker. At this point, I didn't know where the error was; was this a general
unix problem? A cygwin problem? Or a problem with my Ocaml setup. As it
turned out, while I had X11, I did not have the X11 development package in
cygwin! The absence of this package was verified by examining the
/usr/X11R6/lib directory, and seeing the absence of any file like, libX11.so.
To fix the problem, all I had to do was go to the cygwin setup application,
look through the list of packages to find one named libX11-devel, which was
inside the X11 category, and installing it. After this, everything worked
perfectly.
LaTeX: Some Font Shapre Were Unavailable
During a paper I wrote, there was a section where I had curly braces
('{' and '}') inside of a the \texttt tag. Unfortunately, and
for these characters only, the curly braces were not printing in a monospace
font. Moreover, when running LaTeX, I got two errors:
LaTeX Font Warning: Font shape `OMS/cmtt/m/n' undefined
(Font) using `OMS/cmsy/m/n' instead
(Font) for symbol `textbraceleft' on input line 743.
and
LaTeX Font Warning: Some font shapes were not available, defaults substituted.
Didn't know what to do! Unfortunately, the "some fonts shapes not available"
message can occur for many reasons. In my case, adding the additional
directive,
\usepackage[T1]{fontenc}
Fixed all my problems. Hooray!
Eclipse and 64bit Linux
I have run into this problem twice now and figured I'd better
write it down before I forget again. The combination of 64 bit Linux,
64 bit Java and 64 bit Eclipse can get pretty hairy. Often times I have
had them not work together, and Eclipse with crash on start-up. This
is usually accompagnied by strange error messages in my log file, for
example,
!ENTRY org.eclipse.osgi 4 0 2007-09-26 14:29:45.075
!MESSAGE Shutdown error
!STACK 1
java.lang.InternalError
at java.util.zip.Inflater.end(Native Method)
at java.util.zip.Inflater.end(Inflater.java:310)
at java.util.zip.ZipFile.close(ZipFile.java:488)
etc., with tons of ugly other stuff. Here's what has worked for me: If you have
64 bit Linux, use 64 bit Eclipse and the 64 bit Java JRE. (Note,
the first link for downloading Eclipse is not for the 64 bit version.) Then,
play around by trying out different versions of the 64 bit Java JRE & Eclipse
until the whole thing works. This sounds strange, but almost always
having the newest one of each will fix your problem.
MikTeX Include Directory
(Thanks to Donna for
this one!) Here's how you get MikTeX to look in a
particular directory for the files:
Instead of using TEXINPUTS, MikTeX uses the command line option
"-include-directory=foo" to prepend foo to the search path.
LaTeX: Using the \Box and \Diamond Symbols
I needed the Box and Diamond symbols for use in typsetting some work
related to
modal logic. Most of
the online symbol lists that you find say to use:
\Box and \Diamond
But I was getting the following error:
LaTeX Error: Command \Diamond not provided in base LaTeX2e.
What they don't tell you, but what I finally found in the
"List of every LaTeX symbol ever, even ones you would never, ever use"
is that for some of the basic symbols (i.e. ones not in AMS or stmaryrd) you
still have to include an extra package. Put this at the top of your
document, and everything will work:
\usepackage{latexsym}
JUnit Within Ant Within Eclipse
I've been trying to run an Ant build from within Eclipse that also runs
some JUnit tests automatically. This is a common problem, but some of
the solutions that I found weren't working. Anyway,
this blogger had a solution that worked.
Emacs: Get Rid of DOS Newlines
Since UNIX and Windows both have different ways of representing a newline,
I find that sometimes my scripts edited on a Windows machine will not run
on a UNIX machine because there is an additional character on each line.
Long story short, if UNIX complains about
'^M' you are in all likelyhood
having the exact same problem. Here is how I get rid of it using emacs. I
admit, this is not the fastest way to do it:
C-x RET c unix RET C-x C-f foobar.txt
This changes emacs' mode so that when it opens up files, it will open them in
UNIX mode. Then, the sequence of commands after the second return just opens
up your file. You can then see the
'^M' characters. I usually just
delete them by hand, but you can also do a regexp replace. (To search for
this character, (after you are in search mode) you have to type
^Q ^M The first command puts you
in quote mode, meaning that the next thing you type will be exactly what it
searches for.
Unix: Add DIR to PATH
I can never remember how to do this. You have two choices depending on your
shell. (Well okay, there are more choices, but who uses those other shells?)
Bash:
PATH="$PATH:/new_path_dir"; export PATH
Tcsh:
set path = ( $path /new_path_dir )
Windows && Emacs && ISpell: I had emacs for windows,
and I wanted a spellchecker. It took me a short while to find which
files to install but I settled on Ispell, and this prepackaged Windows
version: http://www.luziusschneider.com/SpellerHome.htm. After
all that, I had to add ispell to my PATH in windows. Now I encountered
my first tricky problem. When I ran Ispell from emacs, it would tell
me that the dictionary at 'C:/usr/local/english.hash' could not be
found. No kidding, that's not where my dictionary is. However, just
selecting the 'Change Deafult Dictionary' option would not fix my
problem. For some reason, even when I typed in the full path of my
english.hash file, it would not accept my input. Finally I found a
solution: In my '.emacs' file (Which goes in whatever directory the
HOME variable points to.) I had to put the following line:
(setq ispell-extra-args '("-dC:/ispell/english/english.hash"))
This tells emacs that when it runs the ispell.exe executable, it has to run it with the given command line options. That particular option directs it towards the default dictionary file to use. Kind of bogus, but I just wanted to be able to spellcheck right away!
Update! Wow, I definitely don't do it this way
anymore. Currently I use cygwin
as my command-line. I tell the Cygwin package manager to install
aspell, the ispell replacement, and then you just have to
tell Emacs that ispell should be aspell, by putting the following
command in your .emacs:
(setq-default ispell-program-name "aspell")
ML Comments A comment in ML has the following form:
(* Here is a comment
and here is the end *)
This information was surprisingly difficult to find on the web.
|