Basic Commands
Command Line Interface
This section aims to provide a solid foundation for the basic commands required to use Git. To understand the applicability of the basic commands, this tutorial will follow a scenario.
Note the arrow(s) in the bottom-right corner that controls navigation through the lesson. You may also navigate by pressing ESC and using the arrow keys.
Types of Repository Storage
There are two ways a Git repository can be stored and managed: locally on a personal computer or remotely on a server. Storing remotely permits distributed teamwork. It is worth noting that a locally stored repository can be moved to a server if desired.
Let's first consider local storage.
git init
Here we create a new directory called droid aimed at software for battle droid development. After making the directory, we navigate into it. Using the ls command, we see the directory is empty. Since we already have Git installed, we can run the command git init to start a local repository in the current directory. We see this present the message: Initialized empty Git repository in current directory If we examine the directories contents now, showing all hidden files using ls -a, we see that a .git directory has been added. This is a directory added by Git to allow for version control. The details of this directory are NOT covered in this tutorial set.
git init
Next we add an empty .gitignore file using the
touch command.
The .gitignore file essentially tells Git what files to ignore in the repository.
The .gitignore file will be covered later in this lesson.
It is always good practice to add a .gitignore file at the beginning of a repository.
We then add the .gitignore file to the repository and commit it with a detailed message.
git init
Git's response to this particular commit shows us that:
- This is the root commit of the repository - (root-commit)
- This commit was made on the master branch with a identifier (SHA) of 3b946c4
- 1 file was changed (added), in this case it was .gitignore
- The creation mode of the added file was 100644. The create mode is an octal representation of the file mode. (Click the down arrow to understand the various types of creation modes.)
Git Create Modes
| Octal Value | Mode |
| 040000 | Directory |
| 100644 | Regular, non-executable file |
| 100664 | Regular, non-executable, group-writeable file |
| 100755 | Regular executable file |
| 120000 | Symlink |
| 160000 | Gitlink |
git log
Now that we made an initial commitment to the Git repository, we can view a log history of the repository.
This repository only has one commit so far, so we only see one. Above we can see the complete,
40-character SHA-1 checksum hash. You can see the author of the commit (assuming they have properly
set up their .gitconfig file in their home directory), the datetime at which the commit was made,
and the message assigned to the commit (if one exists).
Click the down arrow to view other strategies for viewing logs.
Formatting Git Logs
Git logs can be useful in determining the history of commits, including what files changed, who changed them, and why. A number of formatting flags can be used. The short table below shows some useful flags, but the entirety of the flags can be found using the link.
| Flag | Intent |
| --name-status | Shows the names and statuses of files changed |
| --graph | Draw a text-based graphical representation of the commit history |
| --abbrev-commit | Shorten the commit's SHA |
| --pretty=oneline | Condense the log message down to a single line |
git status
Let’s create some new files and a directory. Here we create a logic file for the overall droid system.
We also create a directory for communication systems of the droid, in which we will place a translator
file to translate speech input.
Using git status, we can see what files Git see have changed or been added.
git status
Consider the following segment from the git status message. It indicates that these files have not yet been staged.
nothing added to commit but untracked files present (use "git add" to track)
Let’s stage these files using git add
Git staging is the intermediary step between modifying files and committing them. The "stage" stores information about what will go into the next commit.
git add
To stage files, we use the git add command.
In this instance, we added all files in and under the
current directory using the command: git add .
After adding these files to the Git staging area, we can see with git status
that these files are now considered “Changes to be committed” and are highlighted in
green.
Select the down arrow for various formats for adding files using git add
Formats for Adding Files
The git add command can stage files and directories in a number of ways. The table below provides a few relevant examples.
| git add . | Stages files under the current directory |
| git add <file1> <file2> ... <fileN> | Stage specific files |
| git add <dir1> <dir2> ... <dirN> | Stage specific directories |
| git add <file1> <file1> <dir1> | Stage both specific files and directories |
git commit
We’re ready to commit these changes, so let’s do so.  It is very good practice to use the –m flag with git commit to include a brief message detailing the purpose or summary of the commitment.
Checking the status of the repository again, we see that the tree is in a clean state.
git diff
Another important feature of Git is it’s ability to show the changes within files since the last commit.
We have already seen the list of files added or modified using git status,
but we can view the specific changes using the git diff command.
In this example, we have created a new, empty directory called power.
We have also made a modification to the logic file.
Running git status only shows the modifications to the logic file –
why?
Because Git only recognizes directories if they are NOT empty.
git diff
Here we have run git diff. Since we have only changed a single line of a single file, the result of this diff is rather simple, but it does a good job at illustrating the purpose of git diff.
The response contains details such as the file and exact lines that were changed. As expected, we see the changed file is logic.py. The already-committed version of the file is donated by three dashes (---). Modifications are denoted by three plus signs (+++). The modified or added lines are shown in green, whereas the previous lines are shown in red.
Undoing Things
Sometimes we may want to undo changes that we've either committed, staged, or simply modified. There are a number of tools for this. Let’s say we went ahead and added the logic file to the staging area of Git.
But wait! We realize before committing that we do NOT want to make these changes. We could continue to change the file without committing it, but for the sake of example, let’s unstage the file for safety.
git reset
git reset allows us to unstage a file through a soft reset. Changes to files are maintained, but they are no longer staged for committing.
git reset <commit/reference> <files or directories>
Here we will just unstage logic.py.
git reset HEAD logic.py
The term HEAD is a reference to the last commit of the currently
checked-out branch.
Checking the repository’s status afterwards shows that logic.py
is now unstaged.
git reset
WARNING
Now that I’ve shown you about git reset, you may happen to stumble upon the following command when searching the Internet.
git reset --hard HEAD
BE CAREFUL
This command will destroy all of the uncommitted changes you have made. This is a --hard reset. There are some instances where it is useful or even necessary, but it should be used with caution and awareness.
git reset
git reset can also be used to remove commits through a --soft reset.
git reset --soft <commit/reference>
For example, we may want to remove the most recent two commits:
The syntax HEAD~2 refers to two commits back from the current branch head.
git checkout -- <filepath(s)>
A Reset Alternative
This command will erase any changes you have made to the specified file (or files, if a directory is
specified) and checkout the most recent version of the file or files.
git reset updates the staging area but does not undo changes, whereas
git checkout -- <filepath(s)>
reverts files to their last committed states.
git checkout -- . will revert all changes under the current directory
git checkout (without the ”--”) is also used to switch between branches.
git revert <commit hash>
(Yet Another) Reset Alternative
git revert is very similar to git reset
in that it supports the removal of commits on a branch.
git revert removes commits on a public branch though,
whereas git reset removes commits on a private branch.
Click the right arrow for a brief summary of these reset options.
Summary of Reset Options
Below is a reference table for understanding various reset options and when to apply them.
| Command | Scope | Common use cases |
| git reset | Commit-level | Discard commits in a private branch or throw away uncommitted changes |
| git reset | File-level | Unstage a file |
| git checkout | Commit-level | Switch between branches or inspect old snapshots |
| git checkout | File-level | Discard changes in the working directory |
| git revert | Commit-level | Undo commits on a public branch |
| git revert | File-level | (N/A) |
This table was retrieved directly from Atlassian's reference page.
git rm
It is rare that you will ever have to use this, but it’s worth a brief mention. git rm removes a file from both your system and the Git index of that repository.
In the example above, we remove the logic file using git rm. Notice that both Git and the computer system realize the file logic.py has been deleted. This deletion can be reverted by using git reset --hard HEAD, but of course this should be used with caution, as previously mentioned.
Note that this does not remove it from the history of the repository.
| git status | git reset |
| git diff | git commit |
| git add | git rm |
| git log |
We’ve covered a number of useful Git commands.
What else is there though?
(Click the right arrow to find out...)
| git branch | git fetch |
| git checkout | git pull |
| git push | git merge |
| git log |
The Git commands above are relevant to projects that have network connectivity. While some of these, such as branch and checkout, can be used without network connectivity, they’re most-applicable to projects that are hosted on a server.
So let's check that out! Click the right arrow to continue.
Let's now consider working with a remote server.
(Link opens in new page)
git clone
To allow your team to work distributedly, you'll need to create a project space on a server. Once you've created the space, developers need to clone down the repository. Cloning essentially means copying down a reference of the repository. When a repository is cloned down, it includes a .git/ directory, which applies version control tracking. To clone from a server, you must first have a server established. The example here shows a JEDI project that was created on a Bitbucket server. Bitbucket, as well as other common servers, will include URLs for cloning. We would use the URL in tandem with git clone to clone down the repository.
When cloning, you may run into an issue such as this:
Problem Analysis
-
Are you connected to the internet?
The error was triggered by disconnecting from the Internet - Do you need to be connected to your organization's VPN? If so, are you?
-
Can you view the repository on the server / from a browser?
- If so, then ensure you've configured your security protocol.
- If not, then you likely do not have access to the repository. You may need to contact your organization's admins about this.
git branch
Git repositories are intended to be shaped like trees.
The command git branch allows you to see the current branches
of the repository.
If you include the –a flag,
both local and remote branches will be shown.
The branch you are currently on is denoted with an asterisk(*).
Local branches are shown in
green.
Remote branches are shown in
red and are pre-pended with:
remotes/origin/.
This notation indicates where the branch is at on the server.
Without getting too deep, a repository can exist on multiple servers,
so there could be multiple "remotes" listed here.
This is an uncommon situation though.
| git branch | View all local branches |
| git branch -a | View all local and remote branches |
git checkout
The command git checkout allows a user to switch between branches. It can also be used to create a new branch.
git checkout <branch-name>
to switch between existing branches
git checkout -b <new-branch-name>
to simultaneously create a new branch (based off your latest commit) and switch to it
git checkout
In this example, we are starting with only the master branch.
If a user was only developing independently, then developing on
master may be okay, but it’s certainly NOT
acceptable when working with a team.
Given this, it is common to have a development branch
and individual dev branches for each team member.
Let’s first create a development branch
and then create an individual developer branch (dev_obiwan).
You can then use git checkout to switch between branches.
Again though, it is common to develop on your own, individual branch.
git push
git push <server-name> <branch-name>
The command git push is used to migrate changes you have made locally
to the remote server, so that other team members can view your additions or modifications.
The command requires specifying the server name
(in this case -- and typically -- origin)
and branch name (in this case dev_obiwan).
git push
git push <server-name> <branch-name>
You will see in the resulting log that a pull request is created. This pull request is sent to the server. If your project has any limitations on the branch you’re trying to push, a pull request will be created for review prior to updating that specific branch on the server. This is to prevent any erroneous changes from being pushed without being communicated first. If there are no limitations, then the update will happen immediately.
git push
It’s worth noting that you can also push changes on a different local branch.
Here we are currently on the dev_obiwan branch
but are pushing changes from the development branch.
Afterwards, you can see that both dev_obiwan and
development show as both local and remote branches.
git push
When a push fails...
Occasionally the server may reject your push.
This usually occurs when you need to pull updates from the server before pushing updates from
your local branch.
Note the hints that Git is trying to give you:
"Updates were rejected because the remote contains work that you do not have locally...
You may first want to integrate the remote changes before pushing again."
To resolve this, we’ll need to pull updates first.
git fetch
git fetch downloads new data from the repository on the server, but it does NOT integrate this data into your local branches
In this example, dev_obiwan had an update on the server.
git merge
git merge <branch-name>
If you want to merge in updates from the server, you must include the server name in the branch specification. For example:
git merge remotes/origin/branch_name_here
If you are pulling from a local branch, you do NOT need to add the server information. For example:
git merge branch_name_here
Merge conflicts may arise. Click here to understand how to resolve them.
git pull
git pull <server-reference> <branch-name>
git pull
downloads and integrates data from the specified branch on the remote repository
into your local branch.
It is typically used to either:
A.) Update the branch you’re currently on, or
B.) Pull in changes from another branch
In Git, a pull essentially a fetch followed by a merge.
git pull = git fetch + git merge
Click here for a more detailed explanation
(link opens in new tab)
There can be conflicts introduced when performed git pull,
specifically if the updates from the server fail to merge smoothly with your local branch.
Conflict resolution is covered here
(link opens in new tab)


--- layout: post status: publish published: true title: New name! author: display_name: Tomas Restrepo login: tomasr email<EMAIL_ADDRESS>url: http://winterdom.com/ author_login: tomasr author_email<EMAIL_ADDRESS>author_url: http://winterdom.com/ wordpress_id: 1038 wordpress_url: http://winterdom.com/2002/12/newname date: '2002-12-01 12:42:17 +0000' date_gmt: '2002-12-01 12:42:17 +0000' categories: - Personal tags: [] comments: - id: 731 author: Sam Gentile author_email<EMAIL_ADDRESS>author_url: http://radio.weblogs.com/0105852/ date: '2002-12-01 12:51:26 +0000' date_gmt: '2002-12-01 12:51:26 +0000' content: |
Where ya been? I blogged this over a month ago-)))
- id: 732 author: Tomas Restrepo author_email<EMAIL_ADDRESS>author_url: http://www.winterdom.com/weblog date: '2002-12-01 13:03:21 +0000' date_gmt: '2002-12-01 13:03:21 +0000' content: |Obviously not where I was supposed to be :)
- id: 733 author: Sam Gentile author_email<EMAIL_ADDRESS>author_url: http://radio.weblogs.com/0105852/ date: '2002-12-01 14:19:58 +0000' date_gmt: '2002-12-01 14:19:58 +0000' content: |Just read my blog every day-) I'll keep you up to date on all things .NET and new bloggers=) (he says ducking...)
---Just found out Adrian Bateman, a name I quickly recognized from Developmentor's excellent DotNet mail lists, has a weblog. Added!


Paste the macro in the box below. You can combine multiple macros into a single sequence by pasting them in the correct order and then importing. Lines which don't contain /ac or /action are automatically filtered out.


Think carefully, you only get ONE chance! on this set. Click on the image of the celebrity you'd like to {{$.Session.get 'activeChoice'}}.
{{this.name}}
{{this.marry}} Marries
{{this.hookup}} HookUps
{{this.kill}} Kills
{{this.name}}
{{this.marry}} Marries
{{this.hookup}} HookUps
{{this.kill}} Kills
{{this.name}}
{{this.marry}} Marries
{{this.hookup}} HookUps
{{this.kill}} Kills
{{content}}
{{#each CommentsByDoc _id}} {{> commentWWYR}} {{/each}} {{else}} {{> noComments}} {{/if}}


Hotel Reservation System
Your account has been created successfully. Please Log In!
Account Registration
Already have an account?
Log In


Cosmo is a “safe templates” engine. It allows you to fill nested templates, providing many of the advantages of Turing-complete template engines, without without the downside of allowing arbitrary code in the templates.
The current version of Cosmo is 10.03.31. This version adds expressions to selectors $(<exp>), allows nested [[ ]] in templates, makes commas between subtemplates optional, and adds a second parameter to cosmo.yield that tells Cosmo the first parameter is a literal to be included in the expansion instead of an environment.
Cosmo is installed as a rock. To install the most recent release
do luarocks install cosmo
. The Cosmo rock is in the standard
repository. Installation on UNIX-based systems need the gcc toolchain.
Let’s start with a simple example of filling a set of scalar values into a template: Here are a few examples of Cosmo in use:
> values = { rank="Ace", suit="Spades" }
> template = "$rank of $suit"
> require("cosmo")
> = cosmo.fill(template, values)
Ace of Spades
Note that the template is a string that marks where values should
go. We call a template variable like $rank
a selector, and rank
is the selector’s name. The table passed to cosmo.fill
is the
environment, and it provides the
values. $rank
will get replaced by value.rank
(“Ace”) and $suit
will get replaced by value.suit
(“Spades”).
cosmo.fill
takes two parameters at once. Cosmo also provides a
“shortcut” method f()
which takes only one parameter – the template
– and returns a function that then takes the second parameter. This
allows for a more compact notation:
> = cosmo.f(template){ rank="Ace", suit="Spades" }
Ace of Spades
A selector can be either a string or a Lua expression in parenthesis,
like $("foo" .. "bar")
is replaced by foobar
in the template. Any
variables in the expression are looked-up in the current template
environment, so $(foo)
is the same as $foo
, and $(rank .. suit)
would be replaced by AceSpades
in the previous example.
You aren’t restricted to scalar values; your values can be Lua tables that you can destructure using a $val|key1|key2|…|keyn syntax. For example:
> values = { cards = { { rank = "Ace" , suit = "Spades" } } }
> template = "$cards|1|rank of $cards|1|suit"
> = cosmo.fill(template, values)
Ace of Spades
As you can see above, you can either use numbers or strings as keys.
You can also pass arguments to a selector using the syntax $selector{ args }. The syntax for the argument list is the same as a Lua table constructor, but function definitions are not allowed, and you can use template selectors, which are looked up in the template environment.
If you pass an argument list and the selector maps to a function then Cosmo calls this function with the argument list as a table, and the selector expands to what the function returns. For example:
> values = { message = function (arg) return arg.rank .. " of "
.. arg.suit end }
> template = "$message{ rank = 'Ace', suit = 'Spades' }"
> = cosmo.fill(template, values)
Ace of Spades
Now, suppose we have not just one card, but several. Cosmo allows us to handle this case with “subtemplates”
> mycards = { {rank="Ace", suit="Spades"}, {rank="Queen", suit="Diamonds"}, {rank="10", suit="Hearts"} }
> template = "$do_cards[[$rank of $suit, ]]"
> = cosmo.fill(template, {do_cards = mycards})
Ace of Spades, Queen of Diamonds, 10 of Hearts,
The subtemplate “$rank or $suit” could be enclosed in [[...]]
,
[=[...]=]
, [==[...]==]
, etc. – just like Lua’s long-quoted
strings. Again, we can use the shortcut f()
:
> = cosmo.f(template){do_cards = mycards}
Ace of Spades, Queen of Diamonds, 10 of Hearts,
If we don’t have a ready table that would match the template, we can
set the value of do_cards
to a function, which will yield a set of
values for the subtemplate each time it’s called:
> mycards = { {"Ace", "Spades"}, {"Queen", "Diamonds"}, {"10", "Hearts"} }
> = cosmo.f(template){
do_cards = function()
for i,v in ipairs(mycards) do
cosmo.yield{rank=v[1], suit=v[2]}
end
end
}
Ace of Spades, Queen of Diamonds, 10 of Hearts,
You can also pass a list of arguments to this function:
> template = "$do_cards{ true, false, true }[[$rank of $suit, ]]"
> mycards = { {"Ace", "Spades"}, {"Queen", "Diamonds"}, {"10", "Hearts"} }
> = cosmo.f(template){
do_cards = function(arg)
for i,v in ipairs(mycards) do
if arg[i] then cosmo.yield{rank=v[1], suit=v[2]} end
end
end
}
Ace of Spades, 10 of Hearts,
Finally, you can pass a literal to be included in the expansion instead of an environment. An example:
> template = "$do_cards{ true, false, true }[[$rank of $suit]]"
> mycards = { {"Ace", "Spades"}, {"Queen", "Diamonds"}, {"10", "Hearts"} }
> = cosmo.f(template){
do_cards = function(arg)
local n = #mycards
for i,v in ipairs(mycards) do
cosmo.yield{rank=v[1], suit=v[2]}
if i < n then cosmo.yield(", ", true) end
end
end
}
Ace of Spades, Queen of Diamonds, 10 of Hearts
In some cases we may want to use differente templates for different
items in the list. For example, we might want to use a different
template for the first and/or last item, or to use different templates
for odd and even numbers. We can do this by specifying several
templates, separated by a comma. In that case, cosmo will use the
first template in the sequence, unless the table of values for the
item contains a special field _template
, in which case this field
will be used as an index into the list of alternative templates. For
instance, setting _template
to 2 would tell cosmo to use the 2nd
template for this item.
> table.insert(mycards, {"2", "Clubs"})
> template = "You have: $do_cards[[$rank of $suit]],[[, $rank of $suit]],[[, and $rank of $suit]]"
> = cosmo.f(template){
do_cards = function()
for i,v in ipairs(mycards) do
local t
if i == #mycards then -- for the last item use the third template
t = 3
elseif i~=1 then -- use the second template for items 2...n-1
t = 2
end
cosmo.yield{rank=v[1], suit=v[2], _template=t}
end
end
}
You have: Ace of Spades, Queen of Diamonds, 10 of Heards, and 2 of Clubs
Note that the first item is formatted without preceeding “, ”, while the last item is preceeded by an extra “and”.
Templates and subtemplates can be nested to arbitrary depth. For instance, instead of formatting a set of cards, we can format a list of sets of cards:
> players = {"John", "João"}
> cards = {}
> cards["John"] = mycards
> cards["João"] = { {"Ace", "Diamonds"} }
> template = "$do_players[[$player has $do_cards[[$rank of $suit]],
[[, $rank of $suit]],[[, and $rank of $suit]]\n]]"
> = cosmo.f(template){
do_players = function()
for i,p in ipairs(players) do
cosmo.yield {
player = p,
do_cards = function()
for i,v in ipairs(cards[p]) do
local t
if i == #mycards then
t = 3
elseif i~=1 then -- use the second template for items 2...n-1
t = 2
end
cosmo.yield{rank=v[1], suit=v[2], _template=t}
end
end
}
end
end
}
John has Ace of Spades, Queen of Diamonds, 10 of Hearts, and 2 of Clubs
João has Ace of Diamonds
Subtemplates can see values that were set in the higher scope:
> template = "$do_players[[$do_cards[[$rank of $suit ($player), ]]]]"
> = cosmo.f(template){
do_players = function()
for i,p in ipairs(players) do
cosmo.yield {
player = p,
do_cards = function()
for i,v in ipairs(cards[p]) do
cosmo.yield{rank=v[1], suit=v[2]}
end
end,
}
end
end
}
Ace of Spades (John), Queen of Diamonds (John), 10 of Hearts (John), 2 of Clubs (John), Ace of Diamonds (João),
Note that in this case the field “player” is set in the table of
values that is passed to do_players
, but is used one level deeper –
in do_cards
.
The scoping behavior can be overriden by setting a metatable on the environment you pass to the subtemplates.
Subtemplates and arguments let you implement a more generic conditional:
> template = "$do_players[=[$player: $n card$if{ $plural }[[s]]
$if{ $more, $n_more }[[(needs $2 more)]],[[(no more needed)]]\n]=]"
> = cosmo.f(template){
do_players = function()
for i,p in ipairs(players) do
cosmo.yield {
player = p,
n = #cards[p],
["if"] = function (arg)
if arg[1] then arg._template = 1 else arg._template = 2 end
cosmo.yield(arg)
end,
plural = #cards[p] > 1,
more = #cards[p] < 3,
n_more = 3 - #cards[p]
}
end
end
}
John: 4 cards (no more needed)
João: 1 card (needs 2 more)
The conditional above is already present in Cosmo as cosmo.cif
. Expressions in arguments
make it more useful:
> template = "$if{ math.fmod(x, 4) == 0, target = 'World' }[[ Hello $target! ]],
[[ Hi $target! ]]"
> result = cosmo.fill(template, { math = math, x = 2, ["if"] = cosmo.cif })
> assert(result == " Hi World! ")
In some cases we want to format an set of values if some condition
applies, and cosmo.if
is not enough.
This can be done with a function and a subtemplate by just
replacing a for-loop with an if-block. However, since this is a
common case, cosmo provides a function for it:
> template = "$do_players[[$player: $n card$if_plural[[s]] $if_needs_more[[(needs $n more)]]\n]]"
> = cosmo.f(template){
do_players = function()
for i,p in ipairs(players) do
cosmo.yield {
player = p,
n = #cards[p],
if_plural = cosmo.cond(#cards[p] > 1, {}),
if_needs_more = cosmo.cond(#cards[p] < 3, { n = 3 - #cards[p] })
}
end
end
}
John: 4 cards
João: 1 card (needs 2 more)
Like fill()
, cond()
has a “shortcut” equivalent which takes only
one parameter (the template) and returns a function:
> = cosmo.f(template){
do_players = function()
for i,p in ipairs(players) do
cosmo.yield {
player = p,
n = #cards[p],
if_plural = cosmo.c(#cards[p] > 1){},
if_needs_more = cosmo.c(#cards[p] < 3){ n = 3-#cards[p] }
}
end
end
}
John: 4 cards
João: 1 card (needs 2 more)
Cosmo provides two convenience functions for writing simple templates, cosmo.map
and cosmo.inject
. Both functions have to be passed in a template’s environment.
The cosmo.map
function yields each of its arguments in sequence, and inject yields
its whole argument table. A simple example:
> template = "
\n$map{ 'Spades', 'Hearts', 'Clubs', 'Diamonds'}[[
$it
\n]]
"
> = cosmo.fill(template, { map = cosmo.map })

Spades

Hearts

Clubs

Diamonds

> template = "$inject{ suit = 'Spades' }[[Ace of $suit]]"
> = cosmo.fill(template, { inject = cosmo.inject })
Ace of Spades
Putting a delimiter between each expansion of a subtemplate is so
common that Cosmo provides also provides a convenience function for
it, cosmo.concat
. This is an example:
> template = "$concat{ cards, ', ' }[[$1 of $2]]"
> mycards = { {"Ace", "Spades"}, {"Queen", "Diamonds"}, {"10", "Hearts"} }
> = cosmo.f(template){
cards = mycards,
concat = cosmo.concat
}
Ace of Spades, Queen of Diamonds, 10 of Hearts
cosmo.compile(template, chunkname) – compiles template into a function that takes an environment and returns the filled template. Assigns chunkname as the name of this function
cosmo.fill(template, env) – same as cosmo.compile(template)(env)
cosmo.yield(env, is_literal) – fills the current subtemplate
with env if is_literal is nil
or false
and adds it to the
output stream; otherwise adds the the string env to the output
stream
cosmo.cond(bool, tab) – returns a function that yields an
empty environment if bool is nil
or false
and tab otherwise
cosmo.c(bool) – returns a function that takes a table tab and does the same thing as cosmo.cond(bool, tab)
cosmo.map{ … } – has to be used inside a template; yields each element of its argument in turn
cosmo.inject(env) – has to be used inside a template; yields its argument
cosmo.cif{ exp, … } – has to be used inside a template; yields
its argument to subtemplate 2 is exp is nil
or false
and to
subtemplate 1 otherwise
cosmo.concat{ list, [delim] } – has to be used inside a
template; for each element of list yields it and, if it is not the
last, yields the literal delim or “, ” is delim is nil
For more information please contact one of the authors, Fabio Mascarenhas and Yuri Takhteyev, or write to the Sputnik Mailing List.
Comments are welcome!
Cosmo is free software: it can be used for both academic and commercial purposes at absolutely no cost. There are no royalties or GNU-like “copyleft” restrictions. Cosmo qualifies as Open Source software. Its licenses are compatible with GPL. The legal details are below.
The spirit of the license is that you are free to use Cosmo for any purpose at no cost without having to ask us. The only requirement is that if you do use Cosmo, then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation.
The original Cosmo library is designed and implemented by Yuri Takhteyev, with much feedback and inspiration by André Carregal. This version is a reimplementation by Fabio Mascarenhas, with aditional features. The implementations are not derived from licensed software.
Copyright © 2008-2010 Fabio Mascarenhas. Copyright © 2007-2008 Yuri Takhteyev.
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.


Home
Sticky note
Bookmarks
Calender
Users
Settings
+ Add
3
Dashboard
Weclome to Go jobs
Neil bond
Full-stack Developer
Education
Grover Clevand
New york Universty
Interview Schedule
21 jan, 2018
IT
Best Buy HQ
Senoir Developer
09:30 am
Company
Jobs
End of application
Location


MP Connect Piping example
template_mpconnect.sas
, available at $URL$
MP Connect Piping references
Sample program at sas.com
(also available
locally, modified for Linux
)
Initially created by
Lars Vilhuber
$Id$ $URL$
Last modified: Fri Aug 4 14:53:19 EDT 2006


According to the World Cancer Research Fund, breast cancer is the most common type of cancer among women, and the second most common cancer overall. In 2018, there were over 2 million new cases, with the US and Canada registering 84.9 and 83.8 cases per 100,000 respectively. In the US, 1 in 8 women can expect to develop invasive breast cancer over the course of their life. The prevalence of breast cancer in today’s society makes early detection an issue of paramount importance. According to the American Cancer Society, early detection of breast cancer in localized stages have a 5-year survival rate of 99%. In comparison, the overall 5-year survival rate for all stages combined is 90%, while the survival rate for region (when it spreads to nearby structures outside the breast) is just 86%.
Several techniques currently exist, or are in development, for breast cancer detection. Mammography is still considered the gold standard in screening for breast cancer. However, the accuracy of conventional analog mammography is influenced by the age and breast density of the subject, with denser breasts having sensitivities as low as 30-48%. In addition to dense breasts, other factors including young age, estrogen-replacement therapy, and a familial history of breast cancer can lead to an increase in false positives. A newer technique, known as full-field digital mammography (FFDM), utilizes digital detectors in place of the analog film used in conventional mammography. A multicenter FFDM trial showed sensitivity of 70% compared to 55% for conventional mammograms in women with dense breasts aged under 50 years. Computer Aided Detection (CAD) programs can also help recognize abnormal patterns in breast imaging. While certain studies have shown that using CAD can reduce false-negative rates by as much as 70%, there are concerns around CAD increasing recall and biopsy rates. Ultrasonography is another technique used to supplement routine screening of young women. It is particularly useful in localizing and allowing biopsies of lesions seen from Magnetic Resonance Imaging (MRIs) but not on mammograms. While ultrasonography is painless and requires no radiation, it relies heavily on the operator’s experience. Lastly, more recently, MRIs have been used for breast cancer imaging. However while MRIs can produce high rates of sensitivity their specificity is low, implying it is associated with higher rates of false positives. MRIs are also relatively expensive to conduct and not typically covered under insurance.
A novel technique using elastography has been proposed by Dr. Samani et al. which uses axial and lateral displacement maps to detect breast cancer. In this technique, the breast is compressed using the ultrasound transducer while ultrasound radiofrequency (RF) data are acquired. Throughout the tissue compression stage 20 to 50 RF data frames are acquired. Ultrasound elastography techniques rely on using only two frames of ultrasound RF data that represent two states of pre- and post-compression states to calculate and generate displacement maps. Identification of the optimal two frames is currently done using inefficient ad-hoc techniques or brute force techniques whereby every single combination of frames is considered before corresponding displacement field is calculated. The proposed software solution would use deep learning and neural networks to implement an algorithm that could accurately and rapidly identify the optimal pair of frames to be used within the displacement calculation.
Back to Home


The Students’ Disciplinary Code is aimed at: upholding the name and reputation of the University; 1.2 maintaining order, discipline, safety and security at the University; 1.3 ensuring the integrity of the academic processes of the University; and 1.4 assuring the quality of the assessment processes at the University. 2. Any conduct of a student which contravenes the Disciplinary Code and/or negatively impacts on these goals may be regarded as misconduct and subject to disciplinary measures. 3. The general supervision and control of student discipline at the University vests with the Registrar and are administered in terms of the Students’ Disciplinary Code of the University.


An independent kingdom for much of its long history, Korea was occupied by Japan beginning in 1905 following the Russo-Japanese
War. Five years later, Japan formally annexed the entire peninsula. Following World War II, Korea was split with the northern
half coming under Soviet-sponsored communist control. After failing in the Korean War (1950-53) to conquer the US-backed Republic
of Korea (ROK) in the southern portion by force, North Korea (DPRK), under its founder President KIM Il Sung, adopted a policy
of ostensible diplomatic and economic "self-reliance" as a check against outside influence. The DPRK demonized the US as the
ultimate threat to its social system through state-funded propaganda, and molded political, economic, and military policies
around the core ideological objective of eventual unification of Korea under Pyongyang's control. KIM Il Sung's son, KIM Jong
Il, was officially designated as his father's successor in 1980, assuming a growing political and managerial role until the
elder KIM's death in 1994. KIM Jong Un was publicly unveiled as his father's successor in 2010.
Following KIM Jong Il's death in 2011, KIM Jong Un quickly assumed power and has now taken on most of his father's former
titles and duties. After decades of economic mismanagement and resource misallocation, the DPRK since the mid-1990s has faced
chronic food shortages. In recent years, the North’s domestic agricultural production has increased, but still falls far short
of producing sufficient food to provide for its entire population. The DPRK began to ease restrictions to allow semi-private
markets, starting in 2002, but has made few other efforts to meet its goal of improving the overall standard of living. North
Korea's history of regional military provocations; proliferation of military-related items; long-range missile development;
WMD programs including tests of nuclear devices in 2006, 2009, 2013, 2016, and 2017; and massive conventional armed forces
are of major concern to the international community and have limited the DPRK’s international engagement, particularly economically.
The regime abides by a policy calling for the simultaneous development of its nuclear weapons program and its economy.
Broadcast media
no independent media; radios and TVs are pre-tuned to government stations; 4 government-owned TV stations; the Korean Workers'
Party owns and operates the Korean Central Broadcasting Station, and the state-run Voice of Korea operates an external broadcast
service; the government prohibits listening to and jams foreign broadcasts
Internet country code
.kp
total subscriptions
1.18 million
subscriptions per 100 inhabitants
5
subscriptions per 100 inhabitants
13
general assessment
adequate system; nationwide fiber-optic network; mobile-cellular service expanded beyond Pyongyang
domestic
fiber-optic links installed down to the county level; telephone directories unavailable; mobile service launched in late 2008
for the Pyongyang area and considerable progress in expanding to other parts of the country since
international
country code - 850; satellite earth stations - 2 (1 Intelsat - Indian Ocean, 1 Russian - Indian Ocean region); other international
connections through Moscow and Beijing
Overview
North Korea, one of the world's most centrally directed and least open economies, faces chronic economic problems. Industrial
capital stock is nearly beyond repair as a result of years of underinvestment, shortages of spare parts, and poor maintenance.
Large-scale military spending and development of its ballistic missile and nuclear program severely draws off resources needed
for investment and civilian consumption. Industrial and power outputs have stagnated for years at a fraction of pre-1990 levels.
Frequent weather-related crop failures aggravated chronic food shortages caused by on-going systemic problems, including a
lack of arable land, collective farming practices, poor soil quality, insufficient fertilization, and persistent shortages
of tractors and fuel.
GDP (purchasing power parity)
$40 billion
GDP (official exchange rate)
$28 billion
Gross national saving
NA%
Industries
military products; machine building, electric power, chemicals; mining (coal, iron ore, limestone, magnesite, graphite, copper,
zinc, lead, and precious metals), metallurgy; textiles, food processing; tourism
Industrial production growth rate
1%
Population below poverty line
NA%
Taxes and other revenues
11.4% of GDP
Budget surplus (+) or deficit (-)
-0.4% of GDP
Fiscal year
calendar year
Inflation rate (consumer prices)
NA%
Export commodities
minerals, metallurgical products, manufactures (including armaments), textiles, agricultural and fishery products
Export partners
China 85.6%
Import commodities
petroleum, coking coal, machinery and equipment, textiles, grain
Import partners
China 90.3%
Debt - external
$5 billion
household consumption
NA%
government consumption
NA%
investment in fixed capital
NA%
investment in inventories
NA%
exports of goods and services
5.9%
imports of goods and services
-11.1%
industry and services
63%
expenditures
$3.3 billion
rice
corn
potatoes
wheat
soybeans
pulses
beef
pork
eggs
Electricity - production
13.41 billion kWh
Electricity - consumption
11.24 billion kWh
Electricity - exports
0 kWh
Electricity - imports
0 kWh
Electricity - installed generating capacity
10 million kW
Electricity - from fossil fuels
45% of total installed capacity
Electricity - from nuclear fuels
0% of total installed capacity
Electricity - from hydroelectric plants
55% of total installed capacity
Electricity - from other renewable sources
0% of total installed capacity
Crude oil - production
0 bbl/day
Crude oil - exports
0 bbl/day
Crude oil - imports
10,640 bbl/day
Crude oil - proved reserves
0 bbl
Refined petroleum products - production
11,270 bbl/day
Refined petroleum products - consumption
18,000 bbl/day
Refined petroleum products - exports
0 bbl/day
Refined petroleum products - imports
5,976 bbl/day
Natural gas - production
0 cu m
Natural gas - consumption
0 cu m
Natural gas - exports
0 cu m
Natural gas - imports
0 cu m
Natural gas - proved reserves
0 cu m
Carbon dioxide emissions from consumption of energy
50 million Mt
population without electricity
18,400,000
electrification - total population
30%
electrification - urban areas
41%
electrification - rural areas
13%
Location
Eastern Asia, northern half of the Korean Peninsula bordering the Korea Bay and the Sea of Japan, between China and South
Korea
Coordinates
40 00 N, 127 00 E
Climate
temperate, with rainfall concentrated in summer; long, bitter winters
Terrain
mostly hills and mountains separated by deep, narrow valleys; wide coastal plains in west, discontinuous in east
Irrigated land
14,600 sq km
Population - distribution
population concentrated in the plains and lowlands; least populated regions are the mountainous provinces adjacent to the
Chinese border; largest concentrations are in the western provinces, particularly the municipal district of Pyongyang, and
around Hungnam and Wonsan in the east
exclusive economic zone
200 nm
note
military boundary line 50 nm in the Sea of Japan and the exclusive economic zone limit in the Yellow Sea where all foreign
vessels and aircraft without permission are banned
party to
Antarctic Treaty, Biodiversity, Climate Change, Climate Change-Kyoto Protocol, Desertification, Environmental Modification,
Hazardous Wastes, Ozone Layer Protection, Ship Pollution
signed, but not ratified
Law of the Sea
elevation extremes
lowest point: Sea of Japan 0 m
China 1352 km
South Korea 237 km
Russia 18 km
coal
iron ore
limestone
magnesite
graphite
copper
zinc
lead
precious metals
hydropower
late spring droughts often followed by severe flooding
occasional typhoons during the early fall
water pollution
inadequate supplies of potable water
waterborne disease
deforestation
soil erosion and degradation
Government type
single-party state; official state ideology of "Juche" or "national self-reliance
National holiday
Founding of the Democratic People's Republic of Korea (DPRK), 9 September
Legal system
civil law system based on the Prussian model; system influenced by Japanese traditions and Communist legal theory
International law organization participation
has not submitted an ICJ jurisdiction declaration; non-party state to the ICCt
Suffrage
17 years of age; universal and compulsory
Flag description
three horizontal bands of blue (top), red (triple width), and blue; the red band is edged in white; on the hoist side of the
red band is a white disk with a red five-pointed star; the broad red band symbolizes revolutionary traditions; the narrow
white bands stand for purity, strength, and dignity; the blue bands signify sovereignty, peace, and friendship; the red star
represents socialism
Diplomatic representation in the US
none; North Korea has a Permanent Mission to the UN in New York
Diplomatic representation from the US
none; note - Swedish Embassy in Pyongyang represents the US as consular protecting power
conventional long form
Democratic People's Republic of Korea
conventional short form
North Korea
local long form
Choson-minjujuui-inmin-konghwaguk
etymology
derived from the Chinese name for Goryeo, which was the Korean dynasty that united the peninsula in the 10th century A.D.;
the North Korean name "Choson" means "[Land of the] Morning Calm"
geographic coordinates
39 01 N, 125 45 E
time difference
UTC+8.5 (13.5 hours ahead of Washington, DC, during Standard Time)
note
on 15 August 2015, North Korea reverted to UTC+8.5, a time zone that had been observed during pre-colonial times
history
previous 1948, 1972; latest adopted 1998 (during KIM Jong Il era)
amendments
proposed by the Supreme People’s Assembly (SPA); passage requires more than two-thirds majority vote of the total SPA membership;
revised 2009, 2012, 2013
citizenship by descent only
at least one parent must be a citizen of North Korea
dual citizenship recognized
no
residency requirement for naturalization
unknown
chief of state
Supreme People's Assembly President KIM Yong Nam (since 5 September 1998); note - functions as the technical head of state
and performs related duties, such as receiving ambassadors' credentials
head of government
State Affairs Commission Chairman KIM Jong Un (since 17 December 2011); note - functions as the commander-in-chief and chief
executive
cabinet
Cabinet or Naegak members appointed by the Supreme People's Assembly except the Minister of People's Armed Forces
elections/appointments
chief of state and premier indirectly elected by the Supreme People's Assembly; election last held on 9 March 2014 (next election
NA)
election results
KIM Jong Un reelected unopposed
note
the Korean Workers' Party continues to list deceased leaders KIM Il Sung and KIM Jong Il as Eternal President and Eternal
General Secretary respectively
description
unicameral Supreme People's Assembly or Ch'oego Inmin Hoeui (687 seats; members directly elected by absolute majority vote
to serve 5-year terms); note - the Korean Workers' Party selects all candidates
elections
last held on 9 March 2014
election results
percent of vote by party - NA; seats by party - KWP 607, KSDF 50, Chondoist Chongu Party 22, Chongryon 5, religious associations
3; ruling party approves a list of candidates who are elected without opposition; KWP, KSDP, Chondoist Chongu Party, and Chongryon
are part of the DFRF; a token number of seats are reserved for minor parties
highest court(s)
Supreme Court or Central Court (consists of one judge and 2 "People's Assessors" or for some cases, 3 judges)
judge selection and term of office
judges elected by the Supreme People's Assembly for 5-year terms
subordinate courts
lower provincial courts as determined by the Supreme People's Assembly
name
"Aegukka" (Patriotic Song)
lyrics/music
PAK Se Yong/KIM Won Gyun
note
adopted 1947; both North Korea's and South Korea's anthems share the same name and have a vaguely similar melody but have
different lyrics; the North Korean anthem is also known as "Ach'imun pinnara" (Let Morning Shine)
9 provinces (do
singular and plural) and 3 cities (si
singular and plural)
15 August 1945 (from Japan)
ARF
FAO
G-77
ICAO
ICRM
IFAD
IFRCS
IHO
IMO
IMSO
IOC
IPU
ISO
ITSO
ITU
NAM
UN
UNCTAD
UNESCO
UNIDO
UNWTO
UPU
WFTU (NGOs)
WHO
WIPO
WMO
red star, chollima (winged horse)
national colors: red, white, blue
Religions
traditionally Buddhist and Confucianist, some Christian and syncretic Chondogyo (Religion of the Heavenly Way)
Population growth rate
0.53%
Birth rate
14.6 births/1,000 population
Death rate
9.3 deaths/1,000 population
Net migration rate
0 migrant(s)/1,000 population
Population distribution
population concentrated in the plains and lowlands; least populated regions are the mountainous provinces adjacent to the
Chinese border; largest concentrations are in the western provinces, particularly the municipal district of Pyongyang, and
around Hungnam and Wonsan in the east
Total fertility rate
1.95 children born/woman
Contraceptive prevalence rate
78.2%
Physicians density
3.51 physicians/1,000 population
Hospital bed density
13.2 beds/1,000 population
Total fertility rate
1.95 children born/woman
HIV/AIDS - adult prevalence rate
NA
Obesity - adult prevalence rate
6.8%
Children under the age of 5 years underweight
15.2%
Education expenditures
NA
total dependency ratio
44.5
youth dependency ratio
30.5
elderly dependency ratio
14
urban population
61.2% of total population
rate of urbanization
0.8% annual rate of change (2015-20 est.)
total
22.1 deaths/1,000 live births
male
24.6 deaths/1,000 live births
female
19.5 deaths/1,000 live births
total population
70.7 years
definition
age 15 and over can read and write
racially homogeneous
there is a small Chinese community and a few ethnic Japanese
PYONGYANG (capital) 2.863 million
From age
0
to age
14
:
20.78%
From age
15
to age
24
:
15.59%
From age
25
to age
54
:
44.28%
From age
55
to age
64
:
9.77%
From age
0
to age
14
:
1.03
From age
15
to age
24
:
1.02
From age
25
to age
54
:
1.01
From age
55
to age
64
:
0.9
Civil aircraft registration country code prefix
P
Waterways
2,250 km (most navigable only by small craft)
number of registered air carriers
1
inventory of registered aircraft operated by air carriers
17
annual passenger traffic on registered air carriers
223,418
annual freight traffic on registered air carriers
1,574,719 mt-km
standard gauge
7,435 km 1.435-m gauge (5,400 km electrified)
by type
bulk carrier 6, container ship 3, general cargo 184, oil tanker 25, other 30
major seaport(s)
Ch'ongjin, Haeju, Hungnam, Namp'o, Songnim, Sonbong (formerly Unggi), Wonsan


 Call it what you will.
I will not describe the mental effects of meth, as most of the experience reports about meth do a fine enough job of that.  That being said, it doesn't matter; I still battle the meth demon to this day, I miss the rush and euphoria with a passion. Weird huh?
Anyway, as the title of my story suggests, the effects that begin to materialize after years of chronic crank use are absolutely hideous.
My method of ingestion was smoking. Whether it was with a custom-made pipe, a gutted lightbulb or a scrap of foil, I LOVED smoking crank. For three years I smoked and smoked and smoked. It was an absolute blast being tweeked for a night while at a party, or just hanging with friends and playing endless card games and having conversations about gibberish. Gibberish that seemed intellectually stimulating at the time.  What was once just a party, a cheap thrill, became a way of living.

First, we'll start with my lungs. Since I was a crank smoker, I was constantly bombarding my throat and lungs with millions of chemical by-products. After stopping use, I was constantly hacking up thick goobers of foul tasting sputum. Sometimes it looked as though there was a streak of blood in it, but that was probably my imagination. Keep in mind too, that I don't smoke cigarettes or cannabis, so my bronchial problems were a direct result of smoking meth.
Then, my appetite. Every tweeker knows that your diet isn't the best when you're on the stuff. When I was recovering, I was constantly eating, to bizarre proportions.  Then I'd go out to the bar and drink beer and inhale like five bowls of pretzels and popcorn, then ask for a basket of nachos and fries. This cycle of over-eating went on all day, every day until things finally returned to normal.
Then there was the sex drive.    When I stopped taking meth, sex didn't appeal to me anymore.
I was always looked at as a 'cute boy next door' when I was a teen. I had a clean-cut, babyface appearance, with a dark tan and blonde hair. After binging on crank for so many years, my boyish good looks faded to what looked like a weather-beaten fisherman. I had dark rings under my eyes from so much sleep deprivation, my face just looked beaten, tired and drawn out. My hair was scraggly and stringy. It took me about six months to get my regular healthy facial features back.
Lastly, my overall energy levels dropped dramatically. I was always fatigued. I would sleep 12-14 hours a night and wake up the next day feeling like I only slept for an hour. Sometimes I would wake up shaking like an alcoholic. I don't know if this was a withdrawal effect or not, but I can't explain it.
Stopping the cycle, the vicious meth cycle, was the best thing I ever did for myself, of course. To any addict out there who wishes to stop and recover: dig it, it's very tough and it takes a long time. But good things take time. Have patience and willpower and before you know it, you'll marvel at how great it is to have your body back to normal.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Places we've been
Add a place:
Enter a location
When did you visit this place?
What cities did you visit?
What was your favorite food?
Enter
Places:
Place:
When:
Cities Visited:
Favorite food:


charlie
Hi, I am Test. We love Websites, If You Want To Work With Me. You Can Join :)
Install App
Talk To anyone :)
Accessy is on Fire
Post
You are best !
Upload a Pic
Start At
End At
Life is Good 😊
Post An Event


viasat
Businessmodel of ViaSat
Customer Segments
ViaSat has a diversified markets business model, with market segments that have very different needs. Its customer groups are consumers, businesses, governments, and the military. Government clients typically account for about a quarter of revenues.
Value Proposition
ViaSat offers four primary value propositions: convenience, innovation, risk reduction, and brand/status.
The company creates convenience by providing an end-to-end, vertically-integrated platform of broadband technologies. Its ecosystem includes Ka-band satellites, user terminals, and ground infrastructure. Further, its product, service, and system offerings are connected through common customer applications, market relationships, and technologies. This makes for a comprehensive solution that enables ViaSat to act as a one-stop shop for users and enables them to save on costs.
The company has placed a strong emphasis on innovation throughout its history. It has consistently introduced advancements in broadband and wireless technology, including the following:
- The highest-speed home satellite Internet service in the U.S. (the Exede WiFi Modem and its 25 Mbps plan)
- The highest-capacity satellite globally, carrying 140 Gbps capacity, more than any other communication satellite across North America (the ViaSat-1)
- The first communication simulation and test system provided for avionics testing
- The first advanced Data Controller (the VDC-100)
- The first UHF DAMA system in an integrated network control system (INCS) The company reduces risk through its solution’s level of quality. It has earned the ISO 9001 certification, which measures fulfillment of customer expectations and customer satisfaction. For all of its locations it has received AS9100 certification, a widely-used benchmark for the aerospace industry. ViaSat maintains dedicated employees to ensure it continues to meet the standards.
The company has established a strong brand as a result of its performance. In its early years, it achieved placement on Inc. 500’s list of “Fastest-Growing Private Companies” three times. Other honors it has received include “Top Aeronautical Mobility Satcom Innovation“ in 2015 (Mobile Satellite Users Association), the World Technology Network Award for Innovation in Communications (2013), and the 2013 Edison Award. It has also received recognition for its strong performance and growth from numerous top industry and business publications, including Forbes, BusinessWeek, Fortune, DefenseNews, Red Herring, Washington Technology, and Space News.
Channels
ViaSat’s main channels are its direct sales team, its set of channel partners, and its websites. They are categorized into the following groups based on customer focus:
Satellite Services Sales Organization – Sells to residential customers through sales call centers, its Exede website, and 1,000+ retailer dealers. Customers are also obtained through wholesale distribution relationships with the National Rural Telecommunications Cooperative and DISH Network.
Commercial Networks Sales Organization – Consists of sales engineers and sales managers who sell to commercial networks.
Government Systems Sales Organization – Consists of direct sales employees who sell to governments.
Strategic Partners – Consists of various organizations that serve to expand the sales effort. An example is the prime contracting firm for a network or system installation, which might subcontract part of the effort to ViaSat.
ViaSat promotes its offering through its website, social media pages, advertising, participation in trade shows, and conference speaking engagements.
Customer Relationships
ViaSat’s customer relationship is primarily of a personal assistance nature. It divides its services into the following categories:
24/7 Technical Support – Involves phone and e-mail support provided by customer service staff members from a high-tech support center.
Training & On-Site Support – Involves short- and long-term training and support for deployment, provided by field engineers. Specific services include integration, testing, installation, maintenance, repair, refurbishment, and upgrades.
Global Logistics & Repair – Involves management of warehouses globally to help customers rapidly repair, refurbish, and upgrade their equipment from ViaSat; staff can fly to clients on a short-notice basis to help them meet important deadlines.
Network Operations & Management – Involves services provided by ViaSat’s network operations team and facilities, including team training, backup operations, and running of a client’s private network.
System Engineering Services – Involves assistance from field engineers with integration of ViaSat products and services for multi-vendor platforms or systems.
Despite this orientation, there is also a self-service component. The company’s website features a portal that customers can access to manage cases, retrieve documentation, and obtain answers to frequently asked questions.
Key Activities
ViaSat’s business model entails designing and developing its products and services. The company uses a variety of contract manufacturers who are chosen based on product complexity and production volumes.
Key Partners
ViaSat does not maintain any formal partnership programs. Its key partners are as follows:
- Contract manufacturers that make its products; they include CyberTAN, Benchmark, Davida Technology Partners, Flextronicss, EADS, Harris, Microelectronics Technology (MTI), IEC Electronics Corporation, Plexus, NeoTech, and Regal Technology Partners
- Regional and national distribution partners that help sell its products; they include retail service providers, communications firms, and direct-to-home satellite video providers ### Key Resources
ViaSat’s main resource is its research and development staff, which consists of more than 1,900 engineers. It also depends on over 250 field engineers, technicians, and customer support employees who offer assistance with installation and integration. Lastly, the company has relied on financial support from outside parties, raising $137.81 million between two funding rounds in 2009/2010.
Cost Structure
ViaSat has a value-driven structure, aiming to provide a premium proposition through significant personal service. Its biggest cost driver is cost of services, a variable expense. Other major drivers are in the areas of cost of products, another variable expense, and fixed costs in the form of sales and research/development.
Revenue Streams
ViaSat has two revenue streams:
Product Revenues – Revenues generated from the sale of products such as networking equipment and communication systems
Service Revenues – Revenues generated from sales of broadband and wireless services, as well as training and support services


Background
kc-sofastack-demo has introduced how to quickly build an e-commerce microservice application and has implemented the service calling link tracking and application status monitoring.
In e-commerce system, the platforms often are not satisfied with the default product listing order, and always want to arrange some products in the conspicuous places. Also, there are some cases where the platforms would like to show different products to different users based on the collected user behaviors.
Based on the background of kc-sofastack-demo, this guide will implement sorting the products dynamically based on the total amount of products of each onsite attendee.
Demo content
Implement the dynamic change of product sorting via the dynamic module capability provided by SOFABoot and the dynamic module control capability of SOFADashboard.
Implement the change of application behavior without restarting the host and without changing the application configuration.
The project architecture is as follows:
Tasks
1. Preparation
Clone the demo from GitHub to local
git clone https://github.com/sofastack-guides/kc-sofastack-dynamic-demo.git
Then, import the project into IDEA or Eclipse.
2. Package SOFABoot project as Ark JAR
As shown in the following screenshot, add the Ark package plugin in the POM file and configure it:
Step 1: Copy the Ark plugin and configuration to the specified positions in the above screenshot
<plugin>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-maven-plugin</artifactId>
<version>0.6.0</version>
<executions>
<execution>
<!--goal executed to generate executable-ark-jar -->
<goals>
<goal>repackage</goal>
</goals>
<!-- package configuration of ark-biz JAR -->
<configuration>
<!-- Whether to package, install and publish ark biz. The default value is false. For details, see Ark Biz documentation.-->
<attach>true</attach>
<!-- The directory for ark package and ark biz package, defaulting to the build directory of project-->
<outputDirectory>target</outputDirectory>
<!--default none-->
<arkClassifier>executable-ark</arkClassifier>
<!-- The priority of starting ark-biz package. The smaller the value, the higher the priority.-->
<priority>200</priority>
<!--Set the root directory of application, used to read ${base.dir}/conf/ark/bootstrap.application configuration file and defaulting to ${project.basedir}-->
<baseDir>../</baseDir>
</configuration>
</execution>
</executions>
</plugin>
Step 2: Run mvn clean package to package the project.
The successfully packaged JAR file is as shown in the following screenshot:
3. Build host application
In the downloaded project, dynamic-stock-mng is the host application model. In this task, we will build dynamic-stock-mng as the host application of dynamic module.
Step 1: Introduce Ark dynamic configuration dependencies and configure package plugin
1、SOFAArk dependencies
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-springboot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>web-ark-plugin</artifactId>
</dependency>
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>config-ark-plugin</artifactId>
</dependency>
<dependency>
<groupId>io.sofastack</groupId>
<artifactId>dynamic-provider</artifactId>
<version>1.0.0</version>
<classifier>ark-biz</classifier>
</dependency>
2、Host application package plugin
<plugin>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofa-ark-maven-plugin</artifactId>
<version>0.6.0</version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<priority>100</priority>
<baseDir>../</baseDir>
<bizName>stock-mng</bizName>
</configuration>
</plugin>
Step 2: Host application configuration
1. Configure dynamic module
Add the following configuration in the /conf/ark/bootstrap.properties file:
# Root directory of logs
logging.path=./logs
# Configure server address
com.alipay.sofa.ark.config.address=zookeeper://zookeeper-1-dev.sofastack.tech:2181
# Host application name
com.alipay.sofa.ark.master.biz=stock-mng
2. Configure Dashboard client
Add the following configuration in the resource/application.properties file of dynamic-stock-mng:
management.endpoints.web.exposure.include=*
com.alipay.sofa.dashboard.zookeeper.address=zookeeper-1-dev.sofastack.tech:2181
#skip jvm health check to startup host-app
com.alipay.sofa.boot.skip-jvm-reference-health-check=true
4. Package & start host application
- step 1 ： Run mvn clean package to package
- step 2 ： Start host application
java -jar dynamic-stock-mng/target/dynamic-stock-mng-1.0.0.jar
The log information after successful startup is as follows:
5. Register plugin information in Dashboard
- Click Create.
- In the popup dialog, enter plugin name and description.
- Click OK.
6. Add a new version in Dashboard
Enter the absolute path or the resource URL in File address. Here we take file protocol as an example.
7. Associate application
8. View details and push install command
Click details in the interface as shown in the above screenshot to go to the plugin details page.
Before installing, you can first visit http://localhost:8080. Since there is not any module providing JVM service currently, the product is listed in the default order, as shown in the following screenshot:
Then, click Install. After 1 ~ 2 seconds, the status is changed to ACTIVATED.
Then, visit http://localhost:8080 again. The product order is as follows:


{% if not message %}
Login
Register
{% endif %} {% if message %}
Logout
Remove Account
You are logged in {{message}}. You have {{num}} follower(s)
View your tweets
Find people to follow
Unfollow someone
View people you have followed
15 most recent tweets from you and your followers
{% for line in tweets%}
{{line}}
{% endfor %} {% endif %}


`String.Concat (Method)`
Welcome back to my Blog!
Today I would like to talk about Concating strings.
What is String Concat? I hear you ask - Well is a manner in which two strings can be joined to together as one. Now this isn't any 1 + 1 = 2 mumbo jumbo, no, no real abstraction nesseary here at all. By Contacting two straings together we get what most children believe ypu do when first quizzed on the 1 + 1 =?... that's a bigger thing than you has in the first place.
In this instance 1 + 1 = 11
...not 2, you've been had!
By joining in this way we get "one" plus "one" equals "oneone"
Or "Horse" plus "Donkey" equals "HorseDonkey", not ever a mule.
How do we code this?
Very simply even I would say!
Lets take:
String Beta="Beta";
String D="Delta";
We can Concat by:
Which will return:
Or even:
Which will return:
If you would like to Concat unasigned strings, we can slip some spaces in by:
Which will return:
As Daft Punk was wont to say; "The perfect sound is framed in silence" - which is where I'm heading now.


|
mxnet
|
A dynamic sized array data structure that is optimized for storing small number of elements with same type. More...
#include <tuple.h>
Public Member Functions | |
| Tuple ()=default | |
| default constructor More... | |
| ~Tuple () | |
| destructor More... | |
| Tuple (const Tuple< ValueType > &s) | |
| copy constructor from another tuple More... | |
| Tuple (std::initializer_list< ValueType > init) | |
| constructor from initializer list More... | |
| Tuple (std::vector< ValueType > init) | |
| constructor from vector More... | |
| Tuple (Tuple< ValueType > &&src) | |
| move constructor from Tuple More... | |
| template<typename RandomAccessIterator > | |
| Tuple (RandomAccessIterator begin, RandomAccessIterator end) | |
| construct the Tuple from content of iterator More... | |
| template<typename RandomAccessIterator > | |
| void | assign (RandomAccessIterator begin, RandomAccessIterator end) |
| Assign content to tuple from iterator. More... | |
| void | swap (Tuple< ValueType > &other) |
| Swap current object with other. More... | |
| Tuple< ValueType > & | operator= (const Tuple< ValueType > &src) |
| assignment from another tuple. More... | |
| Tuple< ValueType > & | operator= (Tuple< ValueType > &&src) |
| assignment from rvalue of another tuple. More... | |
| Tuple< ValueType > & | operator= (std::initializer_list< ValueType > init) |
| assignment from initializer list More... | |
| bool | operator== (const Tuple< ValueType > &s) const |
| bool | operator!= (const Tuple< ValueType > &s) const |
| const ValueType * | begin () const |
| ValueType * | begin () |
| const ValueType * | end () const |
| ValueType * | end () |
| int | ndim () const |
| ValueType & | operator[] (int i) |
| get corresponding index More... | |
| const ValueType & | operator[] (int i) const |
| get corresponding index More... | |
| void | Save (dmlc::JSONWriter *writer) const |
| Save Tuple to JSON. More... | |
| void | Load (dmlc::JSONReader *reader) |
| Load Tuple from JSON. More... | |
| template<typename DType = ValueType, typename TStream > | |
| void | Save (TStream *strm) const |
| save the content into binary stream More... | |
| template<typename DType = ValueType, typename TStream > | |
| bool | Load (TStream *strm) |
| load the content from binary stream More... | |
Protected Member Functions | |
| void | SetDim (int ndim) |
Protected Attributes | |
| int | ndim_ {0} |
| number of dimension of the tuple More... | |
| int | num_heap_allocated_ {0} |
| number of cells allocated in data_heap_ More... | |
| ValueType | data_stack_ [kStackCache] |
| in stack space used to store shape when it is small More... | |
| ValueType * | data_heap_ {nullptr} |
| space to store shape when dimension is big More... | |
Static Protected Attributes | |
| static const int | kStackCache = 4 |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Tuple< ValueType > &t) |
| allow output string of tuple to ostream More... | |
| std::istream & | operator>> (std::istream &is, Tuple< ValueType > &t) |
| read tuple from the istream More... | |
A dynamic sized array data structure that is optimized for storing small number of elements with same type.
Data will be stored in stack when number of elements is small. It is suitable to hold shape of Tensor.
The ndim of a valid tuple is an integer in range [0, inf). ndim = 0 means the tuple is empty.
| ValueType | The type of data stored inside tuple. |
|
default |
default constructor
|
inline |
destructor
|
inline |
copy constructor from another tuple
| s | the source tuple |
|
inline |
constructor from initializer list
| init | the initializer_list |
|
inline |
constructor from vector
| init | the vector |
|
inline |
move constructor from Tuple
| src | the source shape |
|
inline |
construct the Tuple from content of iterator
| begin | the beginning of iterator |
| end | end the end of the iterator |
| RandomAccessIterator | iterator type |
|
inline |
Assign content to tuple from iterator.
| begin | the beginning of iterator |
| end | end the end of the iterator |
| RandomAccessIterator | iterator type |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Load Tuple from JSON.
| reader | JSONReader |
|
inline |
load the content from binary stream
| strm | the output stream |
| DType | data type that load from |
| TStream | any stream type that have write |
| ValueType | The type of data stored inside tuple. |
|
inline |
|
inline |
| s | the tuple to compare against |
|
inline |
assignment from another tuple.
| src | source tuple |
|
inline |
assignment from rvalue of another tuple.
| src | source tuple |
|
inline |
assignment from initializer list
| init | the source initializer list |
|
inline |
| s | the tuple to compare against |
|
inline |
get corresponding index
| i | dimension index |
|
inline |
get corresponding index
| i | dimension index |
|
inline |
Save Tuple to JSON.
| writer | JSONWriter |
|
inline |
save the content into binary stream
| strm | the output stream |
| DType | data type that save to |
| TStream | any stream type that have write |
| ValueType | The type of data stored inside tuple. |
|
inlineprotected |
|
inline |
Swap current object with other.
| other | another object to be swapped. |
|
friend |
allow output string of tuple to ostream
| os | the output stream |
| t | the tuple |
|
friend |
read tuple from the istream
| is | the input stream |
| t | The tuple |
|
protected |
space to store shape when dimension is big
|
protected |
in stack space used to store shape when it is small
|
staticprotected |
|
protected |
number of dimension of the tuple
|
protected |
number of cells allocated in data_heap_


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uchicago.src.sim.space.Object2DGrid
public class Object2DGrid
A discrete 2 dimensional grid of objects, accessed by x and y coordinates.
| Field Summary | |
|---|---|
protected NewMatrix |
matrix
|
protected Neighborhooder |
Mneigh
|
static int |
PGM_ASCII
|
static int |
RASTER_ASCII
|
protected Neighborhooder |
VNneigh
|
protected int |
xSize
|
protected int |
ySize
|
| Fields inherited from interface uchicago.src.sim.space.Discrete2DSpace |
|---|
MOORE, VON_NEUMANN |
| Constructor Summary | |
|---|---|
Object2DGrid(java.io.InputStream stream,
int type)
Constructs a grid from an InputStream. |
|
Object2DGrid(int xSize,
int ySize)
Constructs a grid with the specified size. |
|
Object2DGrid(java.lang.String fileName,
int type)
Constructs a grid from a file. |
| Method Summary | |
|---|---|
java.util.Vector |
findMaximum(int x,
int y,
int range,
boolean includeOrigin,
int neighborhoodType)
Finds the maximum grid cell occupant within a specified range from the specified origin coordinate. |
java.util.Vector |
findMinimum(int x,
int y,
int range,
boolean includeOrigin,
int neighborhoodType)
Finds the minimum grid cell occupant within a specified range from the specified origin coordinate. |
BaseMatrix |
getMatrix()
Returns the matrix collection object associated with this 2d grid |
java.util.Vector |
getMooreNeighbors(int x,
int y,
boolean returnNulls)
Gets the Moore neighbors of the object at x, y. |
java.util.Vector |
getMooreNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
Gets the extended Moore neighbors of the object at x, y. |
java.lang.Object |
getObjectAt(int x,
int y)
Gets the object at (x,y) |
java.awt.Dimension |
getSize()
Gets the size as a Dimension. |
int |
getSizeX()
Gets the size of the x dimension. |
int |
getSizeY()
Gets the size of the y dimension. |
double |
getValueAt(int x,
int y)
Gets the double value at (x,y) if possible |
java.util.Vector |
getVonNeumannNeighbors(int x,
int y,
boolean returnNulls)
Gets the von Neumann neighbors of the object at x, y. |
java.util.Vector |
getVonNeumannNeighbors(int x,
int y,
int xExtent,
int yExtent,
boolean returnNulls)
Gets the extended von Neumann neighbors of the object at x, y. |
void |
putObjectAt(int x,
int y,
java.lang.Object object)
Puts the specified object at (x,y) |
void |
putValueAt(int x,
int y,
double value)
Puts the specified double at (x,y) |
protected void |
rangeCheck(int x,
int y)
|
void |
setComparator(java.util.Comparator comparator)
Sets the comparator class used by the findMaximum and findMinimum methods. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PGM_ASCII
public static final int RASTER_ASCII
protected NewMatrix matrix
protected int xSize
protected int ySize
protected Neighborhooder VNneigh
protected Neighborhooder Mneigh
| Constructor Detail |
|---|
public Object2DGrid(int xSize, int ySize)
xSize
- the size of the lattice in the x dimension.ySize
- the size of the lattice in the y dimension.public Object2DGrid(java.io.InputStream stream, int type)
public Object2DGrid(java.lang.String fileName, int type)
| Method Detail |
|---|
public java.util.Vector getVonNeumannNeighbors(int x, int y, boolean returnNulls)
x
- the x coordinate of the objecty
- the y coordinate of the objectreturnNulls
- whether nulls (nothing at x,y) should be returned
java.lang.IndexOutOfBoundsException
- if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)public java.util.Vector getVonNeumannNeighbors(int x, int y, int xExtent, int yExtent, boolean returnNulls)
x
- the x coordinate of the objecty
- the y coordinate of the objectxExtent
- the extension of the neighborhood in the x directionyExtent
- the extension of the neighborhood in the y directionreturnNulls
- whether nulls should be returned
java.lang.IndexOutOfBoundsException
- if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)public java.util.Vector getMooreNeighbors(int x, int y, boolean returnNulls)
x
- the x coordinate of the objecty
- the y coordinate of the objectreturnNulls
- should the returned Vector contain null objects
java.lang.IndexOutOfBoundsException
- if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)public java.util.Vector getMooreNeighbors(int x, int y, int xExtent, int yExtent, boolean returnNulls)
x
- the x coordinate of the objecty
- the y coordinate of the objectxExtent
- the extension of the neighborhood in the x directionyExtent
- the extension of the neighborhood in the y directionreturnNulls
- should the returned Vector contain null objects
java.lang.IndexOutOfBoundsException
- if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)public void setComparator(java.util.Comparator comparator)
comparator
- the comparator to use for finding maximum and minimum.public java.util.Vector findMaximum(int x, int y, int range, boolean includeOrigin, int neighborhoodType)
x
- the x origin coordinatey
- the y origin coordinaterange
- the range out from the coordinate to searchincludeOrigin
- include object at origin in searchneighborhoodType
- the type of neighborhood to search. Can be one
of Discrete2DSpace.VON_NEUMANN or Discrete2DSpace.MOORE.
java.lang.IndexOutOfBoundsException
- if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)public java.util.Vector findMinimum(int x, int y, int range, boolean includeOrigin, int neighborhoodType)
x
- the x origin coordinatey
- the y origin coordinaterange
- the range out from the coordinate to searchincludeOrigin
- include object at origin in searchneighborhoodType
- the type of neighborhood to search. Can be one
of Discrete2DSpace.VON_NEUMANN or Discrete2DSpace.MOORE.
java.lang.IndexOutOfBoundsException
- if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)protected void rangeCheck(int x, int y)
public int getSizeX()
getSizeX
in interface Discrete2DSpace
public int getSizeY()
getSizeY
in interface Discrete2DSpace
public java.awt.Dimension getSize()
getSize
in interface Discrete2DSpace
public java.lang.Object getObjectAt(int x, int y)
getObjectAt
in interface Discrete2DSpace
x
- the x coordinatey
- the y coordinate
java.lang.IndexOutOfBoundsException
- if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)public double getValueAt(int x, int y)
getValueAt
in interface Discrete2DSpace
x
- the x coordinatey
- the y coordinate
java.lang.IllegalArgumentException
- if object at x,y cannot
be converted to a number.
java.lang.IndexOutOfBoundsException
- if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)public void putObjectAt(int x, int y, java.lang.Object object)
putObjectAt
in interface Discrete2DSpace
x
- the x coordinatey
- the y coordinateobject
- the object to put at (x,y)
java.lang.IndexOutOfBoundsException
- if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)public void putValueAt(int x, int y, double value)
putValueAt
in interface Discrete2DSpace
x
- the x coordinatey
- the y coordinatevalue
- the double to put at (x,y)
java.lang.IndexOutOfBoundsException
- if the given coordinates are out of
range (x < 0 || x >= xSize || y < 0 || y >= ySize)public BaseMatrix getMatrix()
getMatrix
in interface Discrete2DSpace
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


You can find me on Steam, PS Network to play PS4, Battle.net to play Overwatch and Nintendo Switch to play Splatton 2 or Marki Kart!, just add me! I love to play with new people!


Preparation time
overnight
Cooking time
30 mins to 1 hour
Serves
Serves 4
Dietary
First make the ice cream. In a mixing bowl, combine the caster sugar and egg yolks together. Beat the mixture until it is a thick yellow paste and set it aside.
Bring the semi-skimmed and the whole milk to a simmer in a heavy-based, medium-sized saucepan. Slowly beat the hot semi skimmed and whole milk mixture into the egg and sugar mixture. This mixture should be hot, but not boiling.
Return the mixture to the saucepan and simmer very gently, stirring constantly, for a few minutes until it thickens to a custard-like consistency. Strain the mixture into a large bowl, cool and chill overnight in a refrigerator.
The next day, stir in the double cream, vanilla, ginger and ground cardamom. Churn in an ice cream maker, following manufacturer's instructions, until frozen. Cover and freeze until required.
Preheat the oven to 170C/325F/Gas 3.
Make the pecan pies. In a saucepan, melt together the muscovado sugar and butter. Remove from the heat and stir in the honey, finely chopped pecans, beaten egg and cinnamon. Mix together thoroughly.
Pour the pecan mixture into the tartlet cases and top with the whole pecans.
Bake the pecan tarts for 20 minutes.
Serve the tarts warm from the oven topped with a scoop of the cardamom ginger ice cream. Decorate the serving plates with pecans and a drizzle of maple syrup.


|
PaPrg
1.0
|
#include <portaudio.h>
Data Fields | |
| int | structVersion |
| PaTime | inputLatency |
| PaTime | outputLatency |
| double | sampleRate |
A structure containing unchanging information about an open stream.
| PaTime inputLatency |
The input latency of the stream in seconds. This value provides the most accurate estimate of input latency available to the implementation. It may differ significantly from the suggestedLatency value passed to Pa_OpenStream(). The value of this field will be zero (0.) for output-only streams.
| PaTime outputLatency |
The output latency of the stream in seconds. This value provides the most accurate estimate of output latency available to the implementation. It may differ significantly from the suggestedLatency value passed to Pa_OpenStream(). The value of this field will be zero (0.) for input-only streams.
| double sampleRate |
The sample rate of the stream in Hertz (samples per second). In cases where the hardware sample rate is inaccurate and PortAudio is aware of it, the value of this field may be different from the sampleRate parameter passed to Pa_OpenStream(). If information about the actual hardware sample rate is not available, this field will have the same value as the sampleRate parameter passed to Pa_OpenStream().
| int structVersion |
this is struct version 1


---
title: "Louis Hobbs"
layout: splash
date: 2020-06-25T21:47:00-00:00
author_profile: true
header:
overlay_color: "#000"
overlay_filter: 0.15
overlay_image: /assets/images/homepagebanner.png
caption: "Infernal Sin"
actions:
- label: "About Me"
url: about/index.html
excerpt: "Aspiring Game Developer and Designer.
Computer Games Programming graduate from the University of Derby Class of 2020."
feature_row:
- image_path: /assets/images/infernalsinspread.png
alt: "Infernal Sin Logo"
title: "Infernal Sin"
excerpt: "A Souls-Like Hack-n-Slash with Bullet-hell elements. Created as part of *Digital Imp Studios*."
url: "/infernal-sin/"
btn_label: "Read More"
btn_class: "btn--primary"
- image_path: /assets/images/gladiologo.png
alt: "Gladio Logo"
title: "Gladio"
excerpt: "A fast paced medieval VR fighting game."
url: "/gladio/"
btn_label: "Read More"
btn_class: "btn--primary"
- image_path: /assets/images/papercutlogo.png
alt: "placeholder image 3"
title: "Paper Cut"
excerpt: "Paper Cut is a high-speed ichigeki hissatsu *(One Hit kill)* brawler"
url: "/paper-cut/"
btn_label: "Read More"
btn_class: "btn--primary"
---
{% include feature_row %}


I studied biomedical engineering in college and learned a little bit of coding, but hadn't had to do any programming in my first few years out of school! Lucky for me, I've found that programming is like riding a bike. I may be a bit rusty, but the skills are there somewhere!
My interest in web development was first piqued when I joined the Chicago Tri Club (CTC) leadership. I was recruited to manage the Newbie Program and introduce first-time triathletes to the sport, but I ended up managing the website as well. I was eventually promoted to VP, but couldn't recruit others to help manage the site.
A month before I was elected CTC president, the website crashed permanently. I had to set up a new site and transfer our member database myself. This experience taught me a lot about web development, and I enjoyed being able to create a membership site even with limited knowledge.
Mid-2016, my boss decided to pursue a new career in physical therapy, which motivated me to make a career change myself. I decided I really enjoyed the challenges of creating a new website for the tri club, so turn my sights toward software development.


Caching and the Least Recently Used Replacement Policy
Caching data is the process of saving data in memory that we will use again soon. It provides the advantage of speed, since a memory lookup is much faster than retrieving data from disk or over a network. In addition, caching data rather than fetching and processing it saves CPU cycles for serving more users.
The main thing to know is that caching (like most everything in computing) is a time-space tradeoff. If you have extra space, you can use it up to save time.
Caching is related to memoization : saving the result of expensive computations so that you do not have to perform them again. The general consensus from Wikipedia and StackOverflow is that caching is more general (can be for both input and output) and usually refers to saving the result of data that another service has computed, and that this output is non-deterministic (it varies with time).
Memoization would be saving the result of a factorial function so you don’t have to recalculate it for values you’ve already computed.
Caching would be saving the result that’s going to change, say a weather report that’s updated every hour.
You’ve experienced caching yourself (your browser is doing it right now). If you’re a developer, you’ve likely made changes to an existing script, hit refresh, and … nothing happens. Your browser’s stashed a local copy that it’s accessing instead of requesting it fresh from the server.
Caches are valuable tools, not only for browsers, but also for servers. Adding a cache to an existing webserver can often more fully utilize its memory and allow you to serve more traffic with better performance, at the same cost.
Limitations
Caching is limited by memory (you’ll run out eventually!) and the time-expiration of information. If you’re a weather website and you get reports from a station every 5 minutes, it’s fine to cache for that long, but after 5 minutes, you better request it fresh.
Eviction Strategies
An eviction strategy is simply: when the cache is full, and we add another item, how do we decide which element to remove? The best answer is: whichever element we’re never going to need again! This would, of course, require us to know the future, so it’s impossible. Instead, we can try to get close to the optimal based on probabilities.
There are a lot of strategies to remove items from a cache.
All these strategies that are not simply random typically consider two factors:
- Frequency of use: count the number of times a cache item is requested; discard the item with the lowest number of requests
- Time of last use: assign an “age” to each element each time an element is added to the cache; discard the “oldest” element
Example: Least-Recently Used (LRU)
One common cache strategy is least-recently used. When the cache is full and we’ve gotta add something new, get rid of the thing that’s the oldest thing in the cache. This is what that might look like:
var LRUCache = function (capacity) {
this.capacity = capacity;
this.size = 0;
this.cache = {};
this.keysByAge = [];
this.hits = 0;
this.misses = 0;
};
LRUCache.prototype.get = function (key) {
if (this.cache[key]) {
// Promote key to most recently used
this.hits++;
this.keysByAge = [key, ...this.keysByAge.filter((k) => k !== key)];
return this.cache[key];
} else {
this.misses++;
return -1;
}
};
LRUCache.prototype.put = function (key, value) {
if (this.size < this.capacity) {
this.cache[key] = value;
this.keysByAge.push(key);
this.size++;
} else {
// evictAndPut
const OLDEST = this.keysByAge.shift();
delete this.cache[OLDEST];
this.keysByAge = [key, ...this.keysByAge.filter((k) => k !== OLDEST)];
this.cache[key] = value;
}
};
We store key-value pairs in a hash table, so the lookup is O(1). To track the age of objects, we keep a separate array of keys, keysByAge
. Each time an element is used, we promote the element to the front of the array. Each time an element is added, we push the element onto the array.
In this way, elements are ordered from most-recently-used to least-recently-used. When we try to add an element and the cache is at capacity, we simply take the last element in the keys array, delete the reference in the cache, and then add per usual.
This solution is suboptimal, since each get and put is O(n). The optimal solution would use a doubly-linked list instead of an array to maintain the age-ordered list of keys. The important thing to understand though, is the concept at play. You’re probably not going to code one of these yourself from scratch.
Cache benefits: a little demo.
If you use the code above, you can test it like this:
var cache = new LRUCache(20);
for (var i = 0; i < 100; i++) {
cache.put(i, true);
cache.get(Math.floor(Math.random() * i));
}
console.log("Hit ratio: " + cache.hits / (cache.hits + cache.misses));
This is not so scientific: just throw 100 elements into the cache, and after you do, randomly access elements that might exist (from 0 to i). Then measure how many hits there are.
I got data about like this for 100 elements. Plot these points and it’ll look logarithmic:
| cache size | hit ratio |
|---|---|
| 1 | 0.01 |
| 2 | 0.07 |
| 4 | 0.19 |
| 8 | 0.21 |
| 16 | 0.48 |
| 32 | 0.71 |
| 64 | 0.94 |
The big takeaway here is that if you’ve got the space, saving 32% of your elements means you’ll have the element you need 70% of the time! If it takes 50ms to make a data-heavy network request when there’s a cache miss, this can save you 3.5 seconds per 100 requests, or an average of 35ms/request.
Caching allows us to bargain with time-space complexity: when time is important and space is inexpensive, they often offer a solution.
Caching in the real world
Like more or less everything that involves a doubly-linked list, don’t write it yourself (but it’s good to understand it). There are a lot of libraries out there that can do this stuff for you like Memcached , Redis , or Python's functools .


When things go wrong...
This error message can be modified by editing the
/Static/html/error.htm
file.


New
Room Number
Room Type
Budget
Normal
Luxurious
Room Size
One person
Two persons
Three or four persons
Five or six persons
Date Available
Add Room