The session menu contains items that apply to all applications and thread in the session.
Code Coverage Test Generator … - Holodeck can help you test your applications more thoroughly by setting faults, limits, and tests while your application is running.
Stress Test Generator … - Holodeck can help stress test your application by creating specific scheduled tests while your application is running.
Record Session – Record the tests, limits, faults etc your application undergoes by using this functionality.
Replay Session – Replay a recorded session to reproduce the test environment your application has undergone.
Per Thread – Holodeck automatically logs which APIs are called from which threads, create tests and faults specific to each thread by turning on Per Thread functionality.
Create a Holodeck Report – Holodeck reports help organize a Holodeck session into a single easy to read file.


Here you have it, the Top Weekly Picks
Why did I chose Powder?
Yo, I was surfing soundcloud and i found these awesome songs, enjoy.
dope man, thx for checking this out.


Java Example Application
This is a sample Java application.
To deploy your own copy, and learn the fundamentals of the Heroku platform, head over to the
Getting Started with Java on Heroku tutorial.
Please do work through the Getting Started guide, even if you do know how to build such an application.
The guide covers the basics of working with Heroku, and will familiarize you with all the concepts you need in order to build and deploy your own apps.


Stops the tannit execution on the current template.
The processed part of the template will be normally displayed; the execution will go on
with the calling template, if existing (see the *prex command).
See also the *exit command, which forces Tannit to exit from every
template.


| Class | ActiveRecord::ConnectionAdapters::MysqlAdapter |
| In: |
vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
|
| Parent: | AbstractAdapter |
The MySQL adapter will work with both Ruby/MySQL, which is a Ruby-based MySQL adapter that comes bundled with Active Record, and with the faster C-based MySQL/Ruby adapter (available both as a gem and from www.tmtm.org/en/mysql/ruby/).
Options:
By default, the MysqlAdapter will consider all columns of type tinyint(1) as boolean. If you wish to disable this emulation (which was the default behavior in versions 0.13.1 and earlier) you can add the following line to your environment.rb file:
ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans = false
| LOST_CONNECTION_ERROR_MESSAGES | = | [ "Server shutdown in progress", "Broken pipe", "Lost connection to MySQL server during query", "MySQL server has gone away" |
| update | -> | delete |
# File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 83 83: def initialize(connection, logger, connection_options, config) 84: super(connection, logger) 85: @connection_options, @config = connection_options, config 86: @null_values_in_each_hash = Mysql.const_defined?(:VERSION) 87: connect 88: end
CONNECTION MANAGEMENT ====================================
# File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 148 148: def active? 149: if @connection.respond_to?(:stat) 150: @connection.stat 151: else 152: @connection.query 'select 1' 153: end 154: 155: # mysql-ruby doesn't raise an exception when stat fails. 156: if @connection.respond_to?(:errno) 157: @connection.errno.zero? 158: else 159: true 160: end 161: rescue Mysql::Error 162: false 163: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 228 228: def add_limit_offset!(sql, options) #:nodoc 229: if limit = options[:limit] 230: unless offset = options[:offset] 231: sql << " LIMIT #{limit}" 232: else 233: sql << " LIMIT #{offset}, #{limit}" 234: end 235: end 236: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 267 267: def current_database 268: select_one("SELECT DATABASE() as db")["db"] 269: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 170 170: def disconnect! 171: @connection.close rescue nil 172: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 98 98: def native_database_types #:nodoc 99: { 100: :primary_key => "int(11) DEFAULT NULL auto_increment PRIMARY KEY", 101: :string => { :name => "varchar", :limit => 255 }, 102: :text => { :name => "text" }, 103: :integer => { :name => "int", :limit => 11 }, 104: :float => { :name => "float" }, 105: :decimal => { :name => "decimal" }, 106: :datetime => { :name => "datetime" }, 107: :timestamp => { :name => "datetime" }, 108: :time => { :name => "time" }, 109: :date => { :name => "date" }, 110: :binary => { :name => "blob" }, 111: :boolean => { :name => "tinyint", :limit => 1 } 112: } 113: end
QUOTING ==================================================
# File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 118 118: def quote(value, column = nil) 119: if value.kind_of?(String) && column && column.type == :binary && column.class.respond_to?(:string_to_binary) 120: s = column.class.string_to_binary(value).unpack("H*")[0] 121: "x'#{s}'" 122: elsif value.kind_of?(BigDecimal) 123: "'#{value.to_s("F")}'" 124: else 125: super 126: end 127: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 141 141: def quoted_false 142: "0" 143: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 137 137: def quoted_true 138: "1" 139: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 165 165: def reconnect! 166: disconnect! 167: connect 168: end


Material for the Midterm
Prob 140 Spring 2019
A. Adhikari
The midterm will be during the lecture hour (5:10 p.m. to 6:30 p.m.) on Thursday February 28. This is a summary of the material for the exam, grouped by main topic. The general techniques are in the sections Probability, Distribution, and Expectation. The next two sections consist of applications.
Labs are listed by topic. Please also review your homework, quizzes, and the problems in the Review Sets at the ends of Chapters 5, 8, and 11.
Homework 5, due Tuesday February 26, consists of the Fall 2018 midterm.
The Spring 2018 midterm will be posted for additional practice.
Finding Probabilities
- Chapter 1, Lab 1: Spaces, events, basic counting, exponential approximation
- Chapter 2: Addition and multiplication rules, conditioning and Bayes’ rule
- Section 4.2: Partitioning events
- Chapter 5: Unions and intersections of several events
- Section 9.1: Probabilities by conditioning and recursion
Distribution
- Chapter 3: Random variables, equality versus equality in distribution
- Chapter 4: Joint, marginals, conditionals, independence
- Section 5.4: Random permutations and symmetry
- Chapter 7, Lab 3: Cdf and tails
Expectation
- Chapter 8: Balance point of histogram; additivity, the method of indicators, expectations of functions (linear and non-linear); unbiased estimates
- Lab 3, Homework 3: Tail sum formula for the expectation of a non-negative integer valued variable
- Section 9.2, 9.3, Lab 4: Expectation by conditioning
Random Counts
- Section 8.1: Bernoulli
- Section 8.1: Uniform on a, a+1, … , b
- Sections 6.1, 6.2, 6.4, 7.2: Binomial and multinomial
- Sections 5.4, 6.3: Hypergeometric
- Section 6.5, Lab 2, Chapter 7: Poisson and approximately Poisson
- Section 9.3, Homework 3, Lab 4: Geometric and approximately shifted geometric
Markov Chains
- Sections 10.1, 10.2: Terminology and basics
- Section 10.3, 10.4, Lab 5: The steady state distribution and its properties
- Section 11.1, 11.2: The detailed balance equations and their primary use
- Sections 11.3, Lab 5: Code breaking by MCMC
Omitted from Midterm
- All code. You will neither have to read nor write code on the midterm, though you will on the final.
- The derivation of the interpretation of total variation distance as the largest difference of probabilities (Homework 2)


Shaco's basic attacks and Two-Shiv Poison deal additional damage when striking from behind.
DECEIVE
Shaco becomes Invisible and teleports to target location. His first attack while Invisible is empowered, dealing bonus damage and critically striking if he attacks from behind.
JACK IN THE BOX
Shaco creates a hidden animated Jack-in-the-Box. When triggered, it will fear and attack nearby enemies.
TWO-SHIV POISON
Shaco's Shivs passively poison targets on hit, slowing their movement speed. He can throw his Shivs to deal damage and poison the target. The thrown Shiv deals bonus damage if the target is below 30% health.
HALLUCINATE
Shaco creates an illusion of himself near him, which can attack nearby enemies (Deals reduced damage to turrets). Upon death, it explodes, spawning three mini Jack in the Boxes and dealing damage to nearby enemies.


Before Change
dtype = floatx()
if seed is None:
seed = np.random.randint(10e6)
return tf.truncated_normal(shape, mean, stddev, dtype=dtype, seed=seed)
// CTC
// TensorFlow has a native implementation, but it uses sparse tensors
After Change
dtype = floatx()
if seed is None:
seed = np.random.randint(10e6)
with tf_ops.init_scope():
return tf_keras_backend.truncated_normal(
shape, mean=mean, stddev=stddev, dtype=dtype, seed=seed)
// CTC
// TensorFlow has a native implementation, but it uses sparse tensors
// and therefore requires a wrapper for Keras. The functions below convert
// dense to sparse tensors and also wraps up the beam search code that is
// in TensorFlow"s CTC implementation
@tf_graph_op
def ctc_label_dense_to_sparse(labels, label_lengths):
Converts CTC labels from dense to sparse.


Ciaran McManus is a software developer who is passionate about everything computer related.
Ciaran is very versatile in many aspects of his abilities. He is able to learn quickly and be useful in many different situations. Time management, problem solving and being a team player are some things that Ciaran prides himself on.


title = "Blog Post" url = "/blog/post/:slug" layout = "default-layout" description = "Viewing a single blog post" is_hidden = "0" robot_index = "index" robot_follow = "follow" [blogPost] slug = "{{ :slug }}" categoryPage = "blog/category" [forumEmbedTopic] embedCode = "{{ :slug }}" channelSlug = "channel-orange" memberPage = "404" ==
Please sign in to comment!
{% endif %}


Born in Fairfield, CA in 1992, I attended elementary school in Vacaville and high school in Elk Grove. I started learning guitar and piano in my sophomore/junior year and developed a passion in music as I made the transition into college. I attended CSU Sacramento and started producing my own music. Today, I am currently producing beats and pursuing another dream; full stack development. I intend to take the skills I learn from this bootcamp and make a complete career change; additionally, with an overall goal to be employed by a company with a foundation in music. Spotify or Apple Music are my top choices.
Designed By: Taylor Hom in 2020


TRTL Shop
New Payment
Items2>
Selected
Payment
1
2
3
4
5
6
7
8
9
0
←
Create Payment
Pay Here
No payments yet
Transactions List
Pending
Empty..
Successful
Empty..


--- author: silentrob categories: app date: '2009-11-05 12:01:04' link: http://blogs.nitobi.com/rob/index.php/2009/11/05/xui-sweeter-then-ever/ permalink: /2009/11/05/xui-sweeter-then-ever/ slug: xui-sweeter-then-ever status: publish title: XUI Sweeter then ever. type: post format: html ---
With so much buzz around the office about PhoneGap, I figured I would chime in too, call it a spite driven blog post.
Last week I decided to add some sugar to XUI our answer to a light weight JavaScript framework. Since XUI really doesn't need any new functionality it is really about progressively enhancing the existing code and project.
One area of the code I felt was particularly lacking was how XUI dealt with FORMS, and specifically how we could make XHR handle forms automatically. So lets start by looking at an example of how it worked before.
`// This will insert data.html into #some_div
$('#some_div').xhr('/data.html');`
When this code runs, it will see that the XHR function has no options, and send the resulting responseText back to the DIV (blowing out the existing content - innerHTML)
$('#some_div').xhr('/data.html', function() { alert("XHR Fired"); });
By making a simple change and passing in a function as the second parameter, you get the responseText back in the callback, this circumvents the responseText from being passing back to the calling node, making it arbitrary.
$('#some_form').xhr(function() { alert("XHR Fired"); });
`
`With the new changes from my last commit you now have both. In this case, the XHR function checks to see if node is a form, and then uses that data to construct the XHR request, action, method and form properties are all taken into account. Once the XHR has completed, it will call the callback function.
To learn more about XUI visit XUI
Check out the code here http://github.com/silentrob/xui
Thanks.


| Package | Description |
|---|---|
| org.bitcoinj.core |
The core package contains classes for network messages like
Block and
Transaction , peer connectivity via PeerGroup ,
and block chain management. |
| org.bitcoinj.core.listeners | |
| org.bitcoinj.jni | |
| org.bitcoinj.params |
Network parameters encapsulate some of the differences between different Bitcoin networks such as the main
network, the testnet, regtest mode, unit testing params and so on.
|
| org.bitcoinj.store |
Block stores persist blockchain data downloaded from remote peers.
|
| org.bitcoinj.utils |
Formatting monetary amounts, representing exchange rates, a program for loading Bitcoin Core saved block files,
a class to control how bitcoinj uses threads and misc other utility classes that don't fit anywhere else.
|
| org.bitcoinj.wallet |
Classes that support the
Wallet , which knows how to find and save transactions relevant to
a set of keys or scripts, calculate balances, and spend money: the wallet has many features and can be extended
in various ways, please refer to the website for documentation on how to use it. |
| Modifier and Type | Field and Description |
|---|---|
protected StoredBlock |
AbstractBlockChain.chainHead
Tracks the top of the best known chain.
|
| Modifier and Type | Field and Description |
|---|---|
protected TreeMap<Long,StoredBlock> |
CheckpointManager.checkpoints |
| Modifier and Type | Method and Description |
|---|---|
protected abstract StoredBlock |
AbstractBlockChain.addToBlockStore(StoredBlock storedPrev,
Block block)
Adds/updates the given
Block with the block store. |
protected StoredBlock |
BlockChain.addToBlockStore(StoredBlock storedPrev,
Block blockHeader) |
protected StoredBlock |
FullPrunedBlockChain.addToBlockStore(StoredBlock storedPrev,
Block block) |
protected abstract StoredBlock |
AbstractBlockChain.addToBlockStore(StoredBlock storedPrev,
Block header,
TransactionOutputChanges txOutputChanges)
Adds/updates the given
StoredBlock with the block store. |
protected StoredBlock |
BlockChain.addToBlockStore(StoredBlock storedPrev,
Block blockHeader,
TransactionOutputChanges txOutChanges) |
protected StoredBlock |
FullPrunedBlockChain.addToBlockStore(StoredBlock storedPrev,
Block header,
TransactionOutputChanges txOutChanges) |
StoredBlock |
StoredBlock.build(Block block)
Creates a new StoredBlock, calculating the additional fields by adding to the values in this block.
|
static StoredBlock |
StoredBlock.deserializeCompact(NetworkParameters params,
ByteBuffer buffer)
De-serializes the stored block from a custom packed format.
|
StoredBlock |
AbstractBlockChain.getChainHead()
Returns the block at the head of the current best chain.
|
StoredBlock |
CheckpointManager.getCheckpointBefore(long time)
Returns a
StoredBlock representing the last checkpoint before the given time, for example, normally
you would want to know the checkpoint before the earliest wallet birthday. |
StoredBlock |
StoredBlock.getPrev(BlockStore store)
Given a block store, looks up the previous block in this chain.
|
protected abstract StoredBlock |
AbstractBlockChain.getStoredBlockInCurrentScope(Sha256Hash hash)
For a standard BlockChain, this should return blockStore.get(hash),
for a FullPrunedBlockChain blockStore.getOnceUndoableStoredBlock(hash)
|
protected StoredBlock |
BlockChain.getStoredBlockInCurrentScope(Sha256Hash hash) |
protected StoredBlock |
FullPrunedBlockChain.getStoredBlockInCurrentScope(Sha256Hash hash) |
| Modifier and Type | Method and Description |
|---|---|
com.google.common.util.concurrent.ListenableFuture<StoredBlock> |
AbstractBlockChain.getHeightFuture(int height)
Returns a future that completes when the block chain has reached the given height.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract StoredBlock |
AbstractBlockChain.addToBlockStore(StoredBlock storedPrev,
Block block)
Adds/updates the given
Block with the block store. |
protected StoredBlock |
BlockChain.addToBlockStore(StoredBlock storedPrev,
Block blockHeader) |
protected StoredBlock |
FullPrunedBlockChain.addToBlockStore(StoredBlock storedPrev,
Block block) |
protected abstract StoredBlock |
AbstractBlockChain.addToBlockStore(StoredBlock storedPrev,
Block header,
TransactionOutputChanges txOutputChanges)
Adds/updates the given
StoredBlock with the block store. |
protected StoredBlock |
BlockChain.addToBlockStore(StoredBlock storedPrev,
Block blockHeader,
TransactionOutputChanges txOutChanges) |
protected StoredBlock |
FullPrunedBlockChain.addToBlockStore(StoredBlock storedPrev,
Block header,
TransactionOutputChanges txOutChanges) |
abstract void |
NetworkParameters.checkDifficultyTransitions(StoredBlock storedPrev,
Block next,
BlockStore blockStore)
Throws an exception if the block's difficulty is not correct.
|
protected abstract TransactionOutputChanges |
AbstractBlockChain.connectTransactions(StoredBlock newBlock)
Load newBlock from BlockStore and connect its transactions, returning changes to the set of unspent transactions.
|
protected TransactionOutputChanges |
BlockChain.connectTransactions(StoredBlock newBlock) |
protected TransactionOutputChanges |
FullPrunedBlockChain.connectTransactions(StoredBlock newBlock) |
protected abstract void |
AbstractBlockChain.disconnectTransactions(StoredBlock block)
Disconnect each transaction in the block (after reading it from the block store)
Only called if(shouldVerifyTransactions())
|
protected void |
BlockChain.disconnectTransactions(StoredBlock block) |
protected void |
FullPrunedBlockChain.disconnectTransactions(StoredBlock oldBlock)
This is broken for blocks that do not pass BIP30, so all BIP30-failing blocks which are allowed to fail BIP30
must be checkpointed.
|
protected abstract void |
AbstractBlockChain.doSetChainHead(StoredBlock chainHead)
Called before setting chain head in memory.
|
protected void |
BlockChain.doSetChainHead(StoredBlock chainHead) |
protected void |
FullPrunedBlockChain.doSetChainHead(StoredBlock chainHead) |
boolean |
StoredBlock.moreWorkThan(StoredBlock other)
Returns true if this objects chainWork is higher than the others.
|
void |
Transaction.setBlockAppearance(StoredBlock block,
boolean bestChain,
int relativityOffset)
Puts the given block in the internal set of blocks in which this transaction appears.
|
protected void |
AbstractBlockChain.setChainHead(StoredBlock chainHead) |
| Modifier and Type | Method and Description |
|---|---|
void |
AbstractBlockChainListener.notifyNewBestBlock(StoredBlock block)
Deprecated.
|
void |
NewBestBlockListener.notifyNewBestBlock(StoredBlock block)
Called when a new block on the best chain is seen, after relevant
transactions are extracted and sent to us via either
TransactionReceivedInBlockListener#receiveFromBlock(org.bitcoinj.core.Transaction, org.bitcoinj.core.StoredBlock, org.bitcoinj.core.BlockChain.NewBlockType, int relativityOffset)
or TransactionReceivedInBlockListener#notifyTransactionIsInBlock(org.bitcoinj.core.Sha256Hash, org.bitcoinj.core.StoredBlock, org.bitcoinj.core.BlockChain.NewBlockType, int) . |
boolean |
AbstractBlockChainListener.notifyTransactionIsInBlock(Sha256Hash txHash,
StoredBlock block,
AbstractBlockChain.NewBlockType blockType,
int relativityOffset)
Deprecated.
|
boolean |
TransactionReceivedInBlockListener.notifyTransactionIsInBlock(Sha256Hash txHash,
StoredBlock block,
AbstractBlockChain.NewBlockType blockType,
int relativityOffset)
Called by the
BlockChain when we receive a new FilteredBlock that contains the given
transaction hash in its merkle tree. |
void |
AbstractBlockChainListener.receiveFromBlock(Transaction tx,
StoredBlock block,
AbstractBlockChain.NewBlockType blockType,
int relativityOffset)
Deprecated.
|
void |
TransactionReceivedInBlockListener.receiveFromBlock(Transaction tx,
StoredBlock block,
AbstractBlockChain.NewBlockType blockType,
int relativityOffset)
Called by the
BlockChain when we receive a new block that contains a relevant transaction. |
void |
AbstractBlockChainListener.reorganize(StoredBlock splitPoint,
List<StoredBlock> oldBlocks,
List<StoredBlock> newBlocks)
Deprecated.
|
void |
ReorganizeListener.reorganize(StoredBlock splitPoint,
List<StoredBlock> oldBlocks,
List<StoredBlock> newBlocks)
Called by the
BlockChain when the best chain
(representing total work done) has changed. |
| Modifier and Type | Method and Description |
|---|---|
void |
AbstractBlockChainListener.reorganize(StoredBlock splitPoint,
List<StoredBlock> oldBlocks,
List<StoredBlock> newBlocks)
Deprecated.
|
void |
AbstractBlockChainListener.reorganize(StoredBlock splitPoint,
List<StoredBlock> oldBlocks,
List<StoredBlock> newBlocks)
Deprecated.
|
void |
ReorganizeListener.reorganize(StoredBlock splitPoint,
List<StoredBlock> oldBlocks,
List<StoredBlock> newBlocks)
Called by the
BlockChain when the best chain
(representing total work done) has changed. |
void |
ReorganizeListener.reorganize(StoredBlock splitPoint,
List<StoredBlock> oldBlocks,
List<StoredBlock> newBlocks)
Called by the
BlockChain when the best chain
(representing total work done) has changed. |
| Modifier and Type | Method and Description |
|---|---|
void |
NativeBlockChainListener.notifyNewBestBlock(StoredBlock block) |
boolean |
NativeBlockChainListener.notifyTransactionIsInBlock(Sha256Hash txHash,
StoredBlock block,
AbstractBlockChain.NewBlockType blockType,
int relativityOffset) |
void |
NativeBlockChainListener.receiveFromBlock(Transaction tx,
StoredBlock block,
AbstractBlockChain.NewBlockType blockType,
int relativityOffset) |
void |
NativeBlockChainListener.reorganize(StoredBlock splitPoint,
List<StoredBlock> oldBlocks,
List<StoredBlock> newBlocks) |
| Modifier and Type | Method and Description |
|---|---|
void |
NativeBlockChainListener.reorganize(StoredBlock splitPoint,
List<StoredBlock> oldBlocks,
List<StoredBlock> newBlocks) |
void |
NativeBlockChainListener.reorganize(StoredBlock splitPoint,
List<StoredBlock> oldBlocks,
List<StoredBlock> newBlocks) |
| Modifier and Type | Method and Description |
|---|---|
void |
AbstractBitcoinNetParams.checkDifficultyTransitions(StoredBlock storedPrev,
Block nextBlock,
BlockStore blockStore) |
void |
TestNet3Params.checkDifficultyTransitions(StoredBlock storedPrev,
Block nextBlock,
BlockStore blockStore) |
protected boolean |
AbstractBitcoinNetParams.isDifficultyTransitionPoint(StoredBlock storedPrev)
Checks if we are at a difficulty transition point.
|
| Modifier and Type | Field and Description |
|---|---|
StoredBlock |
MemoryFullPrunedBlockStore.StoredBlockAndWasUndoableFlag.block |
protected StoredBlock |
LevelDBFullPrunedBlockStore.chainHeadBlock |
protected StoredBlock |
DatabaseFullPrunedBlockStore.chainHeadBlock |
protected StoredBlock |
SPVBlockStore.lastChainHead |
protected StoredBlock |
LevelDBFullPrunedBlockStore.verifiedChainHeadBlock |
protected StoredBlock |
DatabaseFullPrunedBlockStore.verifiedChainHeadBlock |
| Modifier and Type | Field and Description |
|---|---|
protected LinkedHashMap<Sha256Hash,StoredBlock> |
SPVBlockStore.blockCache |
| Modifier and Type | Method and Description |
|---|---|
StoredBlock |
MemoryBlockStore.get(Sha256Hash hash) |
StoredBlock |
LevelDBBlockStore.get(Sha256Hash hash) |
StoredBlock |
LevelDBFullPrunedBlockStore.get(Sha256Hash hash) |
StoredBlock |
BlockStore.get(Sha256Hash hash)
Returns the StoredBlock given a hash.
|
StoredBlock |
MemoryFullPrunedBlockStore.get(Sha256Hash hash) |
StoredBlock |
SPVBlockStore.get(Sha256Hash hash) |
StoredBlock |
DatabaseFullPrunedBlockStore.get(Sha256Hash hash) |
StoredBlock |
LevelDBFullPrunedBlockStore.get(Sha256Hash hash,
boolean wasUndoableOnly) |
StoredBlock |
DatabaseFullPrunedBlockStore.get(Sha256Hash hash,
boolean wasUndoableOnly) |
StoredBlock |
MemoryBlockStore.getChainHead() |
StoredBlock |
LevelDBBlockStore.getChainHead() |
StoredBlock |
LevelDBFullPrunedBlockStore.getChainHead() |
StoredBlock |
BlockStore.getChainHead()
Returns the
StoredBlock that represents the top of the chain of greatest total work. |
StoredBlock |
MemoryFullPrunedBlockStore.getChainHead() |
StoredBlock |
SPVBlockStore.getChainHead() |
StoredBlock |
DatabaseFullPrunedBlockStore.getChainHead() |
StoredBlock |
FullPrunedBlockStore.getOnceUndoableStoredBlock(Sha256Hash hash)
Returns the StoredBlock that was added as a StoredUndoableBlock given a hash.
|
StoredBlock |
LevelDBFullPrunedBlockStore.getOnceUndoableStoredBlock(Sha256Hash hash) |
StoredBlock |
MemoryFullPrunedBlockStore.getOnceUndoableStoredBlock(Sha256Hash hash) |
StoredBlock |
DatabaseFullPrunedBlockStore.getOnceUndoableStoredBlock(Sha256Hash hash) |
StoredBlock |
FullPrunedBlockStore.getVerifiedChainHead()
Returns the
StoredBlock that represents the top of the chain of greatest total work that has
been fully verified and the point in the chain at which the unspent transaction output set in this
store represents. |
StoredBlock |
LevelDBFullPrunedBlockStore.getVerifiedChainHead() |
StoredBlock |
MemoryFullPrunedBlockStore.getVerifiedChainHead() |
StoredBlock |
DatabaseFullPrunedBlockStore.getVerifiedChainHead() |
| Modifier and Type | Method and Description |
|---|---|
void |
MemoryBlockStore.put(StoredBlock block) |
void |
LevelDBBlockStore.put(StoredBlock block) |
void |
LevelDBFullPrunedBlockStore.put(StoredBlock block) |
void |
BlockStore.put(StoredBlock block)
Saves the given block header+extra data.
|
void |
MemoryFullPrunedBlockStore.put(StoredBlock block) |
void |
SPVBlockStore.put(StoredBlock block) |
void |
DatabaseFullPrunedBlockStore.put(StoredBlock storedBlock) |
void |
FullPrunedBlockStore.put(StoredBlock storedBlock,
StoredUndoableBlock undoableBlock)
Saves the given
StoredUndoableBlock and StoredBlock . |
void |
LevelDBFullPrunedBlockStore.put(StoredBlock storedBlock,
StoredUndoableBlock undoableBlock) |
void |
PostgresFullPrunedBlockStore.put(StoredBlock storedBlock,
StoredUndoableBlock undoableBlock) |
void |
MemoryFullPrunedBlockStore.put(StoredBlock storedBlock,
StoredUndoableBlock undoableBlock) |
void |
DatabaseFullPrunedBlockStore.put(StoredBlock storedBlock,
StoredUndoableBlock undoableBlock) |
protected void |
LevelDBFullPrunedBlockStore.putUpdateStoredBlock(StoredBlock storedBlock,
boolean wasUndoable) |
protected void |
DatabaseFullPrunedBlockStore.putUpdateStoredBlock(StoredBlock storedBlock,
boolean wasUndoable) |
void |
MemoryBlockStore.setChainHead(StoredBlock chainHead) |
void |
LevelDBBlockStore.setChainHead(StoredBlock chainHead) |
void |
LevelDBFullPrunedBlockStore.setChainHead(StoredBlock chainHead) |
void |
BlockStore.setChainHead(StoredBlock chainHead)
Sets the
StoredBlock that represents the top of the chain of greatest total work. |
void |
MemoryFullPrunedBlockStore.setChainHead(StoredBlock chainHead) |
void |
SPVBlockStore.setChainHead(StoredBlock chainHead) |
void |
DatabaseFullPrunedBlockStore.setChainHead(StoredBlock chainHead) |
void |
FullPrunedBlockStore.setVerifiedChainHead(StoredBlock chainHead)
Sets the
StoredBlock that represents the top of the chain of greatest total work that has been
fully verified. |
void |
LevelDBFullPrunedBlockStore.setVerifiedChainHead(StoredBlock chainHead) |
void |
MemoryFullPrunedBlockStore.setVerifiedChainHead(StoredBlock chainHead) |
void |
DatabaseFullPrunedBlockStore.setVerifiedChainHead(StoredBlock chainHead) |
| Constructor and Description |
|---|
StoredBlockAndWasUndoableFlag(StoredBlock block,
boolean wasUndoable) |
| Modifier and Type | Method and Description |
|---|---|
void |
VersionTally.initialize(BlockStore blockStore,
StoredBlock chainHead)
Initialize the version tally from the block store.
|
| Modifier and Type | Method and Description |
|---|---|
void |
Wallet.notifyNewBestBlock(StoredBlock block)
Called by the
BlockChain when a new block on the best chain is seen, AFTER relevant wallet
transactions are extracted and sent to us UNLESS the new block caused a re-org, in which case this will
not be called (the Wallet.reorganize(StoredBlock, java.util.List, java.util.List) method will
call this one in that case). |
boolean |
Wallet.notifyTransactionIsInBlock(Sha256Hash txHash,
StoredBlock block,
AbstractBlockChain.NewBlockType blockType,
int relativityOffset)
Called by the
BlockChain when we receive a new filtered block that contains a transactions previously
received by a call to Wallet.receivePending(org.bitcoinj.core.Transaction, java.util.List<org.bitcoinj.core.Transaction>, boolean) . |
void |
Wallet.receiveFromBlock(Transaction tx,
StoredBlock block,
AbstractBlockChain.NewBlockType blockType,
int relativityOffset)
Called by the
BlockChain when we receive a new block that sends coins to one of our addresses or
spends coins from one of our addresses (note that a single transaction can do both). |
void |
Wallet.reorganize(StoredBlock splitPoint,
List<StoredBlock> oldBlocks,
List<StoredBlock> newBlocks)
Don't call this directly.
|
| Modifier and Type | Method and Description |
|---|---|
void |
Wallet.reorganize(StoredBlock splitPoint,
List<StoredBlock> oldBlocks,
List<StoredBlock> newBlocks)
Don't call this directly.
|
void |
Wallet.reorganize(StoredBlock splitPoint,
List<StoredBlock> oldBlocks,
List<StoredBlock> newBlocks)
Don't call this directly.
|
Copyright © 2022. All rights reserved.


--- title: Working with Text using stringr author: Stephen Pederson date: '2020-09-28' slug: working-with-text-using-stringr categories: [] tags: - tidyverse - stringr - R Markdown Description: '' DisableComments: no ---
Working with text is one of the most common processes in R and we often take it for granted.
Today we’ll look at a few important concepts using the package stringr
.
The key outcomes will be a better understanding of:
factors
To start today, let’s return to the same R Project
as last week.
This should have been called Improving-R
and if everything was done correctly last week, you’ll be able to see this name listed in the drop-down R Project menu in the top-right corner of R Studio.
Just click on the name and you’ll be taken to the correct folder and will be ready to go.
If you missed last week, please head to the setup section and make sure you have:
Improving-R
, anddata
.Once you are in the Improving-R
R Project, create a new R Markdown file (File > New File > R Markdown
).
Set the title to be “Working with Text” and add your own name etc.
Save this as TextManipulation.Rmd
, or some other suitable name.
Find the first chunk (named setup
) and:
setup
chunkmessage = FALSE
inside the function knitr::opts_chunk$set()
packages
packages
add library(tidyverse)
.Now compile the document and make sure everything resembles the following screenshot:
stringr
The package stringr
is loaded as part of the tidyverse
and contains a set of functions which are incredibly useful for manipulating text.
Often we’ll need to know these tricks as our sample names may have multiple genotypes or treatments embedded in them, and knowing how to get these pieces of information out can be very helpful.
Other times, we need to know how to correct typos longs the lines of sex being recorded as male
, female
, M
, m
, f
or F
all in the same document.
This type of thing happens more than you may realise, especially when dealing with large datasets that have a lot of manually entered values.
Alternatively we may need to remove a file suffix to make our plots look nicer.
The first thing we’ll need to do to get underway, is create a character vector that we’ll work with for this session.
Create new chunk called hi
and create the vector hi
as follows.
hi <- c("Hi Mum", "Hi Mother")
This is a simple character vector (of length 2) with two closely related phrases. This will be short enough for us to work with today and see all of the results clearly. In a real world context, we often work with vectors with many thousands of entries. These are generally far too long to inspect one element at a time.
The package stringr
has a whole series of functions, many of which start with str_
.
From here on, we strongly advise to demonstrate each function within it’s own chunk, and for you to make notes in your R Markdown document that help you understand what we’re doing.
For nearly all of the following examples, we won’t actually create a new object, but will just demonstrate the output of each function, which should appear as R output when you compile your document.
Importantly, for the first set of functions we look at, we pass the function a character vector of length 2, and we will return a character vector of length 2.
There are a few exceptions later on though.
We can very easily change the case of our vector, and this may be of help when our collaborators have given us same strange combination of M/m/F/f encoding for the sex of our samples.
The main functions are str_to_lower()
, str_to_upper()
and str_to_title
, with final helpful function being str_to_sentence()
.
All of these take one main argument, called string
in the function.
When we call a function in R, we can name these arguments explicitly, or if we pass everything in order we don’t need to name these.
The first two lines of code below are essentially identical.
str_to_lower(string = hi)
str_to_lower(hi)
Notice that because the first argument expected by str_to_lower()
is called string, we can name it, or just pass our character vector to the function in the first position.
For the remaining three functions in this set, we will omit the argument name for convenience, although including it is better practice.
str_to_upper(hi)
str_to_title(hi)
str_to_sentence(hi)
These are quite well named functions as the name makes it clear what the output will be. This is not always the case with functions, so make sure you describe what each one does.
Often we have to remove unwanted text like file suffixes and directory names, and str_remove_all()
makes this easy.
There are two arguments we need to provide to this function.
The first is called string
, whilst the second argument is called pattern
.
Now, we need to specify two arguments.
We can either name them explicitly, or just pass all of the values in the correct position.
str_remove_all(string = hi, pattern = "M")
str_remove_all(hi, "M")
In stringr
, syntax is based on regular expressions, so as well as specifying exact patterns to match, we can provide a set of alternative values.
In the following, we’ll remove either an upper or lower case m
by providing a set of alternative characters within the square brackets, i.e. "[Mm]"
.
We’ll follow that by removing all lower-case vowels.
str_remove_all(hi, "[Mm]")
str_remove_all(hi, "[aeiou]")
We can also set ranges of values to remove, such as all upper-case letters, or just those between a
and i
in the alphabet.
str_remove_all(hi, "[A-Z]")
str_remove_all(hi, "[a-i]")
NB: There is an alternative function str_remove()
provided by stringr
which will only remove the first match to the supplied pattern.
This is mostly not the function you’ll be after, but you may choose it by accident at some point, then wonder what went wrong.
Because syntax is based on regular expressions, we can also set a wild-card character by using the .
symbol.
For those familiar with regular expressions, this will be old news, but for those who are not familiar with regexp
syntax this may be a new way of working with text.
Some of you may also be familiar with using the *
symbol as a plain-text wild-card, but importantly the *
symbol doesn’t work in that manner here and actually has a completely different meaning.
str_remove_all(hi, "Mu")
str_remove_all(hi, "M.")
In this last example, we’ve removed the upper case M
and any single character that directly follows it.
We could also remove any number of following characters by adding a +
symbol after the .
, which is interpreted as match anything (.) one or more times (+)
str_remove_all(hi, "M.+")
Or we can specify the exact number of matches.
In this example, we’re matching anything (.
) for exactly 2
characters.
str_remove_all(hi, "M.{2}")
We can also anchor the match to be the beginning or end of a string.
Placing the ^
character at the beginning of a pattern means that the match must occur at the beginning of the string.
str_remove_all(hi, "[Hh]")
str_remove_all(hi, "^[Hh]")
The dollar symbol ($
) performs this exact function for matches at the end of a string, and can be placed at the end f the pattern.
str_remove_all(hi, "[Mm]")
str_remove_all(hi, "[Mm]$")
As well as just removing sections of a text string,there are various methods for reaching into a text string and grabbing the patterns we need.
The first of these is str_extract()
which also takes the two arguments string
and pattern
.
If we search for a pattern that doesn’t exist, str_extract()
will return a missing value (NA
).
str_extract(hi, "Mu")
str_extract(hi, "M.+")
Notice how the patterns behave in the exact same manner as we saw with str_replace_all()
, by using the regex
syntax.
We can also use exact positions within a text string using str_sub()
, with the arguments string
, start
and end
.
Notice that naming the start
and end
arguments explicitly is really helpful here as when you read this back in 2 years time, you’ll immediately understand what the numbers 4
and 5
represent.
str_sub(hi, start = 4, end = 5)
Sometimes, we don’t need to just find or extract one simple pattern, but we need to perform more complex manipulations.
The function str_replace()
allows us to specify the arguments string
& pattern
as we’ve already seen, but also provide the third argument replacement
.
Once again, the following two commands are identical, because we are providing the arguments in order.
str_replace(string = hi, pattern = "Hi", replacement = "Hello")
str_replace(hi, "Hi", "Hello")
We can also use our pattern matching tricks to replace either “Mum” or “Mother” with “Dad”. Feel free to experiment with other patterns and replacements here.
str_replace(hi, "M.+", "Dad")
As well as just using wild-cards, we can specify complete patterns as alternatives. When searching using this technique, the alternative phrases must be provided within the round braces, and they are separated by the “|” symbol, which is commonly used to represent “OR”.
str_replace(hi, "(Mum|Mother)", "Dad")
str_replace()
also allows us to ‘capture’ a pattern within each text string, and incorporate it into the replacement.
To capture a pattern, we surround it in the round braces ()
, as we did above.
To return the pattern, we use the shortcut \\1
which will return the first pattern we have captured.
In the following, notice that we’re matching white-space followed by “(M.+)”, where the captured pattern is “M.+”.
In the replacement, we’re replacing the entire pattern (including the white-space) with a long string, but this replacement string includes the captured pattern.
str_replace(
string = hi,
pattern = " (M.+)",
replacement = "! We captured and replaced the pattern \\1."
)
We can also capture multiple patterns, and return them in any order we choose. In the following:
In our replacement, we’re returning them in the opposite order that we captured them in, and we’re also including some exclamation marks and additional white-space.
str_replace(hi, "(Hi) (M.+)", "\\2! \\1!")
Just like str_remove()
and str_remove_all()
, there are two versions of str_replace()
.
The first will only replace the first match to the pattern, whilst str_replace_all()
will replace all matches to the pattern.
Depending on what operation you’re needing to perform, either may be suitable.
str_replace(hi, "[Mm]", "b")
str_replace_all(hi, "[Mm]", "b")
The above functions are probably the “big guns” of stringr
, however there are a few more very useful things we can do to clean up our data.
If we wish to ensure that our text strings are all the same length, we can pad them with any character we choose, using str_pad()
.
This takes the arguments string
, width
, side
and pad
as the four arguments.
In the first example, we’re setting our new strings to be exactly 10 characters wide, and we’re padding on the right with exclamation marks.
Note again, that explicitly naming the arguments here helps us understand exactly what we’re doing with the function.
str_pad(hi, width = 10, side = "right", pad = "!")
Another common use for something like this would be to pad numbers to ensure we have the same number of digits. If numbers are represented as characters, most sorting algorithms sort them alpha-numerically instead of numerically. We often see strange ordering like 1, 10, 2, 3, 4, 5, 6, 7, 8 and 9 instead of the more reasonable 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10. In the next line, we’ll add zeroes in front of the numbers to ensure every number has two digits. Once we’ve done this, alpha-numeric sorting and numeric sorting will give the same results.
str_pad(1:10, width = 2, pad = "0")
Notice that we didn’t set the argument side
here!
By default, this argument will be set to side = "left"
, and we’ve relied on this value.
This means that pad = "0"
will be provided in position 3 of the function, so must be explicitly named.
This also demonstrates why it can be helpful to explicitly name arguments.
Sometimes we can end up with ridiculously long text strings, particularly when dealing with gene-set enrichment analyses, so we can use str_trunc()
to truncate these.
By default, the last 3 characters of a truncated string will be given as the ellipsis (...
) to indicate the text has been shortened.
str_trunc(hi, width = 6)
Finally, we often see text strings which have excessive white-space, so we can remove this using str_trim()
.
This will remove leading or trailing white-spaces from the text.
str_trim(" Hi!")
In all of the above, we provided a character vector of length 2 and we obtained a character vector of length 2 as our output.
(NA
technically still counts as a character.)
There are multiple other functions which exist that return output in different forms
The first of these might be to perform a logical test for the presence of a pattern within our text strings.
str_detect()
again takes the two arguments string
and pattern
, with a third argument called negate
that defaults to FALSE
.
If we set this to TRUE
, we will invert our results, which is often referred to as negating a logical search.
In both cases, we no longer return a character vector, but return the logical values TRUE
and FALSE
.
str_detect(hi, "Mum")
str_detect(hi, "Mum", negate = TRUE)
These functions really come into their own when we’re dealing with spreadsheet-like structures (known as data frames) and we wish to perform some kind of filtering on our values, as we would with Auto-Filter in Excel.
Sometimes it can be convenient to look in specific positions within our text and the two functions str_starts()
and str_ends()
check to see if a string starts or ends with a specific pattern.
Both of these also take the argument negate
, which we’ll leave as the default (negate = FALSE
).
str_starts(hi, "Hi")
str_ends(hi, "m")
We can also subset our initial character vector, so that only the elements which match our search pattern are returned.
Here, we provide a character vector of length 2 and initially return a character vector of length 1.
By incorporating regex
wildcards, we can then return any elements that contains “M.”.
str_subset(hi, "Mum")
str_subset(hi, "M.")
A final function (str_view_all()
) returns a completely different output.
This matches the specified pattern and opens the results in the Viewer pane, which we haven’t used until now.
This can be incredibly helpful if you’re trying to build a complex search pattern and want to check where it’s matching.
str_view_all(hi, "M.+")
Sometimes, it can be helpful to obtain information about the content of our text strings, such as their overall length, or the number of times a specific letter or pattern appear. I’m sure you’ll immediately realise this can be very useful if wanting to assess the nucleotide content of a DNA/RNA sequence. In NextGen Sequencing experiments, the GC content of a sequence is a known factor that biases our ability to sequence a DNA fragment. In all of these, we’ll provide our input as a character vector with length 2, but will obtain an integer vector of the same length as the output.
str_length(hi)
str_count(hi, "[Hh]")
str_count("AGCTGCGCGATTTAGC", "[GC]")
Sometimes, we need to condense multiple text strings into a single string, and we can use str_flatten
for this.
str_flatten(hi, collapse = ", ")
However, there are two base
functions paste()
and paste0()
that are just as helpful here, and probably a little more flexible.
paste(hi, collapse = ", ")
In addition to performing the above concatenation, we more commonly use the argument sep
within the function paste()
to join additional text to a string.
In the following, we’re pasting an additional phrase to each of our initial vector elements, and specifying the separator between the phrases to be ", "
.
paste(hi, "I hope you're well.", sep = ", ")
The function paste0()
is a simple wrapper to paste()
but with sep = ""
as the default.
paste0(hi, "!")
Finally, a common operation is to separate a single text string into multiple text strings based on a specific character, or set of characters.
The function that gives us the most convenient output for this is str_split_fixed()
, where we provide the arguments string
, pattern
and n
, with the final argument controlling how many strings to obtain from the initial string.
In the following, we’re splitting our text based on white-space, and ensuring that each string is only split into 2 new strings.
This provides output in a structure known as a matrix
, which we’ll explore further in the course.
str_split_fixed(hi, " ", 2)
In general, when performing this type of operation, we’re looking for something specific and we’ll know what type of output we need.
There is a slightly more flexible function str_split()
, however the output format from str_split()
is a list
so a working knowledge of list objects in R is really essential for using this function.
str_split(hi, " ")
The above was a fairly detailed introduction to manipulating text, but to really understand things we should perform these operations in a contact that we’re familiar with. Let’s load the data object that we prepared last week and use our new tricks on the sample names.
If you can recall, we loaded this object using the following code.
fl <- here::here("data/counts.out")
counts <- read_tsv(fl, comment = "#")
As we discussed last week, this is the output from featureCounts
and we have the following columns.
Geneid
: This is clearly the gene identifier, here we have EnsemblChr
: The chromosome, with one value for each exonStart
: The start positions for each exonEnd
: The end positions for each exonStrand
: The strand of each exonLength
: The combined length of all exons combinedIf setting this up for an RNA-Seq analysis using edgeR
we would need to form a numeric matrix with
As this manipulation is not the focus of the current session, my strategy for doing this might be as follows.
counts <- counts %>%
dplyr::select(Geneid, ends_with("bam")) %>%
rename_all(basename) %>%
rename_all(str_remove_all, pattern = ".trimmed.+") %>%
column_to_rownames("Geneid") %>%
as.matrix()
The steps taken here were all chained together using the magrittr
and consisted of
featureCounts
on the same set of bam files twice, the column order will not be the same in both filesbasename()
str_replace_all()
to remove .trimmedAligned.sortedByCoord.out.bam
from the end of each sampleGeneid
column to be rownamesmatrix
Alternatively, if we wish to edit as we parse the data into R. The following approach is an alternative that ensures we never have the same object in two forms within our workspace.
counts <- read_tsv(fl, comment = "#") %>%
dplyr::select(Geneid, ends_with("bam")) %>%
rename_all(basename) %>%
rename_all(str_remove_all, pattern = ".trimmed.+") %>%
column_to_rownames("Geneid") %>%
as.matrix()
Sample names often contain the key information we need and in R, we can obtain this information fairly easily using our new skills.
First we can start by forming a tibble
with a single column.
This gives us a chance to see where we are before we go any further.
tibble(
file = colnames(counts)
)
There are two pieces of information here which are important:
cbc
or skm
for cerebral cortex or skeletal muscle respectively.Let’s try to get these into separate columns, starting with the SRA ID
tibble(
file = colnames(counts)
) %>%
mutate(
sra_id = str_extract(file, "SRR[0-9]+")
)
Now let’s extract the tissue
tibble(
file = colnames(counts)
) %>%
mutate(
sra_id = str_extract(file, "SRR[0-9]+"),
tissue = str_extract(file, "(cbc|skm)")
)
An important perspective here is that the SRA id is a text string which identifies a sample.
In contrast, the tissue is a categorical variable that we will include in our statistical model.
By default, R
will convert any character columns to factors during analysis, and will always set these in alphabetic order.
Here, the default would be cbc
as the baseline (or reference) with skm
as the second level.
A general principle is that we wish to specify our baseline (or control) group as the first (i.e. reference) factor level.
This isn’t really important for this dataset, but if you had DHT and Veh, you’d want to set Veh as the reference level.
Relying on R to do this in alphabetic order may not always be wise.
Let’s manually specify the factor levels.
tibble(
file = colnames(counts)
) %>%
mutate(
sra_id = str_extract(file, "SRR[0-9]+"),
tissue = str_extract(file, "(cbc|skm)"),
tissue = factor(tissue, levels = c("cbc", "skm"))
)
Notice that the column now contains a factor whilst the first two columns are printed as characters. This will not only impact the interpretation of our statistical model, but can also impact the order values are shown in when plotting.
The tidyverse
package forcats
has a number of useful function for working with factors, with a possible alternative here being fct_inorder()
.
I personally like to be explicit though.
If a file was somehow included without cbc
or skm
an NA
would result and this would (hopefully) alert me that the data had taken an unexpected form.
Maybe we can add a better description of the tissue for our collaborators to understand the data.
tibble(
file = colnames(counts)
) %>%
mutate(
sra_id = str_extract(file, "SRR[0-9]+"),
tissue = str_extract(file, "(cbc|skm)"),
tissue = factor(tissue, levels = c("cbc", "skm")),
description = case_when(
str_detect(file, "cbc") ~ "Cerebral Cortex",
str_detect(file, "skm") ~ "Skeletal Muscle"
)
)
This looks pretty good to me, so at this point I would save this as a metadata object.
samples <- tibble(
file = colnames(counts)
) %>%
mutate(
sra_id = str_extract(file, "SRR[0-9]+"),
tissue = str_extract(file, "(cbc|skm)"),
tissue = factor(tissue, levels = c("cbc", "skm")),
description = case_when(
str_detect(file, "cbc") ~ "Cerebral Cortex",
str_detect(file, "skm") ~ "Skeletal Muscle"
)
)
If we’re adventurous we might also like to add the library sizes, and although this isn’t text manipulation, it’s good to see here.
samples <- tibble(
file = colnames(counts)
) %>%
mutate(
sra_id = str_extract(file, "SRR[0-9]+"),
tissue = str_extract(file, "(cbc|skm)"),
tissue = factor(tissue, levels = c("cbc", "skm")),
description = case_when(
str_detect(file, "cbc") ~ "Cerebral Cortex",
str_detect(file, "skm") ~ "Skeletal Muscle"
),
library_size = colSums(counts)[file]
)
Now that we have our metadata, I’ll often summarise this into a table.
The package pander
is extremely useful for this, so please add library(pander)
to your packages
chunk and make sure you execute the chunk.
library(tidyverse)
library(pander)
Then add the following.
samples %>%
group_by(description) %>%
summarise(
n = n(),
`Ave. Library Size` = mean(library_size)
) %>%
rename_all(str_to_title) %>%
pander(
caption = "Summary of RNA-Seq Counts",
big.mark = ","
)
Notice that we’ve used str_to_title()
inside the call to rename_all()
to make our table look nice, but without changing our data object.
In the above you may have noticed that nothing was ever called by position using x[1:5]
or something similar.
This helps build good practice.
If we call by position (e.g. x[1:5]
) we create two problems:
When forming the counts object, I used dplyr::select()
and when reading that back, it’s very clear what we did.
dplyr::select(counts, Geneid, ends_with("bam"))
is much easier to interpret than
counts[,c(1, 7:14)]
When we defined the metadata, we pulled all values directly from the counts
object, ensuring that if the order changed our code will still produce the object in the correct structure.
The old-school method of defining the tissue might have been
rep(c("cbc", "skm"), times = 4)
This is not robust to the order changing, or any samples being added/removed.
Using str_extract()
is incredibly simple, but makes for code which is far more robust to changes in your data structure.
As mentioned, featureCounts
will produce columns in a different order every time it runs on the same set of bam files.
Building code in the way we have done, protects us from this kind of problem.


cd path/to/directory- Go up to the parent of the current directory:
cd ..- Go to the home directory of the current user:
cd- Go to the home directory of the specified user:
cd ~username- Go to the previously chosen directory:
cd -- Go to the root directory:
cd /


|
Perl Weekly
Issue #125 - 2013-12-16 - Snow, wind, no electricity, but plenty of Perl
latest | archive | by Gabor Szabo
|
|
Hi,
I don't know about your part of the world, but we just had a major storm that even covered the 'near-by' pyramids in snow. Part of the country is still without electricity after 4 days, but we were lucky as we did not have any power-failure and the sun came back too.
Anyhow, the Perlish Advent calendars supply many articles for you to read, but other people have not stopped to write either. You have plenty to read.
Enjoy!
|
|
|
|
Sponsors
|
We're Hiring Perl Software Developers - Grant Street Group
We're a growing software company using open source software/modern Perl practices to build innovative e-payment, auction, and tax collection web applications. We're looking for talented, motivated professionals committed to flawless work and customer service. Please apply online.
|
|
Advent Calendars
Plenty of articles have been published on the 4 active Perl-related Advent calendars. This is just a reminder that there is plenty to read on these sites.
|
|
|
|
|
|
|
|
|
Articles
|
More WordPress grepping
This is the second post by brian d foy about WordPress::Grep, his new module and command line tool.
|
|
Why I Don't Like Perl State Variables
Have you ever used the 'state' keyword in Perl? It is 'new' since 5.10 and it works like a 'static' variable in C. But do you really need it? Timm Murray from Wumpus Cave does not seem to like it.
|
|
Selfie
|
Perl and Me, Part 2: The Power of OOP
As you could guess from the title, this is already the 2nd part of the series Buddy Burden writes bare feet on his road in the programming world. A very interesting conversation with ones own self.
|
|
Testing
|
|
|
Single process versus parallel tests
Ovid discusses the advantages of running tests in parallel - which are quite obvious (you get home earlier) - or maybe it isn't? He also describes his work on Test::Class, and Test::Class::Moose to make parallel processing a possibility there too.
|
|
CPAN
|
The correct Makefile.PL incantation
How to do you handle installation of CPAN modules on production servers if you don't have direct access to the Internet? (I'd be more worried if someone has access to the Internet and installs the latest from CPAN.)
|
|
Applications and Frameworks
|
|
|
|
|
|
|
Grants
|
|
|
Videos
|
Build a start up!
Watch the first 2:20 minutes of the lightning talks from YAPC::NA in which JT Smith calls on you to build something. Build if for your own sake and for the sake of Perl.
|
|
Weekly collections
|
|
|
|
|
|
|
Perl Maven Tutorials
|
Contributing to a Perl module on CPAN (using vim and Github)
This is an earlier screencast that can still be useful for you, it you are thinking about contributing to open source. As one of the readers pointed out: 'Your video was really eye opening. It showed me that I do not need to start very big as I was thinking, small contributions like that can really lead to big ones.'
|
|
Eliminate circular reference memory-leak using weaken
Because of the flexibility of Perl it is very easy to create circular references which, if not handled correctly, can easily cause memory leak. Here is how you can measure memory usage and how you can avoid circular references.
|
|
Perl split - to cut up a string into pieces
Example on how to use split assigning the result to an array or to a list of scalars. There is also an example using array slices to split on the fly without creating a temporary variable.
|
|
Events
I usually list the next 3-4 events here. The list of all the events can be found on the web site. If your Perl event is not listed there, please let me know.
|
|
|
|
|
You know, you could get the Perl Weekly right in your mailbox. Every Week. Free of charge!
|


Preparation time
less than 30 mins
Cooking time
30 mins to 1 hour
Serves
Serves 6
This very special cut of lamb is given a crunchy mustard and nut crust and served with honey roasted vegetables.
For the orange honey roasted vegetables, preheat the oven to 180C/350F/Gas 4. In a roasting tray, mix the vegetables with the orange rind. Drizzle over the olive oil and orange juice, add the thyme and toss the vegetables to coat.
Roast for 40 minutes, or until golden-brown and tender.
Meanwhile, prepare the lamb. For the crust, blend all the ingredients, except the lamb racks and mustard, in a food processor. Take care not to over process, as a textured crust is needed.
Season the lamb racks with salt and freshly ground black pepper. Spread a thin layer of mustard over and spoon the crust on, pressing down firmly (you can leave it to set in the fridge for an hour if you have the time). Place the lamb in a roasting tin and drizzle with olive oil.
Roast in the oven at the same temperature as the vegetables for 20-35 minutes, depending on the size of the rack and how rare you prefer your meat. Baste occasionally with olive oil. When cooked, remove the lamb from the oven and set aside to rest for 10 minutes before carving into cutlets.
For the fig and olive tapenade, place the chopped figs and 100ml/3½oz water in a small saucepan and simmer for 5-6 minutes, or until the figs are tender. Drain and set aside to cool.
Place the anchovies, olives, pistachios, capers, honey, mustard, orange juice and zest and cooked figs in a food processor and blend. With the motor still running, add the olive oil in a thin, steady stream until you have a thick paste. Season to taste with freshly ground black pepper
To serve, spoon small amounts of tapenade around serving plates with a few parsley leaves placed in between. Spoon the honey roasted vegetables into the centre and arrange a cutlet or two on top. Serve the extra fig tapenade alongside in a small bowl.


(in the gallery said with
friends) is the golden age
of the Italian Renaissance,
you see this piece of
Raphael's portrait,
the people in this
painting must be a rich
man, can make such a famous
painter custom portrait.
it's great.
This portrait of
Raphael USES a triangular
composition that gives
the whole picture a sense
of stability.


Artisan Console
- Introduction
- Writing Commands
- Defining Input Expectations
- Command I/O
- Registering Commands
- Programmatically Executing Commands
- Stub Customization
- Events
Introduction
Artisan is the command line interface included with Laravel. Artisan exists at the root of your application as the artisan
script and provides a number of helpful commands that can assist you while you build your application. To view a list of all available Artisan commands, you may use the list
command:
php artisan list
Every command also includes a "help" screen which displays and describes the command's available arguments and options. To view a help screen, precede the name of the command with help
:
php artisan help migrate
Laravel Sail
If you are using Laravel Sail as your local development environment, remember to use the sail
command line to invoke Artisan commands. Sail will execute your Artisan commands within your application's Docker containers:
./sail artisan list
Tinker (REPL)
Laravel Tinker is a powerful REPL for the Laravel framework, powered by the PsySH package.
Installation
All Laravel applications include Tinker by default. However, you may install Tinker using Composer if you have previously removed it from your application:
composer require laravel/tinker
{tip} Looking for a graphical UI for interacting with your Laravel application? Check out Tinkerwell!
Usage
Tinker allows you to interact with your entire Laravel application on the command line, including your Eloquent models, jobs, events, and more. To enter the Tinker environment, run the tinker
Artisan command:
php artisan tinker
You can publish Tinker's configuration file using the vendor:publish
command:
php artisan vendor:publish --provider="Laravel\Tinker\TinkerServiceProvider"
{note} The
dispatch
helper function anddispatch
method on theDispatchable
class depends on garbage collection to place the job on the queue. Therefore, when using tinker, you should useBus::dispatch
orQueue::push
to dispatch jobs.
Command Allow List
Tinker utilizes an "allow" list to determine which Artisan commands are allowed to be run within its shell. By default, you may run the clear-compiled
, down
, env
, inspire
, migrate
, optimize
, and up
commands. If you would like to allow more commands you may add them to the commands
array in your tinker.php
configuration file:
'commands' => [
// App\Console\Commands\ExampleCommand::class,
],
Classes That Should Not Be Aliased
Typically, Tinker automatically aliases classes as you interact with them in Tinker. However, you may wish to never alias some classes. You may accomplish this by listing the classes in the dont_alias
array of your tinker.php
configuration file:
'dont_alias' => [
App\Models\User::class,
],
Writing Commands
In addition to the commands provided with Artisan, you may build your own custom commands. Commands are typically stored in the app/Console/Commands
directory; however, you are free to choose your own storage location as long as your commands can be loaded by Composer.
Generating Commands
To create a new command, you may use the make:command
Artisan command. This command will create a new command class in the app/Console/Commands
directory. Don't worry if this directory does not exist in your application - it will be created the first time you run the make:command
Artisan command:
php artisan make:command SendEmails
Command Structure
After generating your command, you should define appropriate values for the signature
and description
properties of the class. These properties will be used when displaying your command on the list
screen. The signature
property also allows you to define your command's input expectations. The handle
method will be called when your command is executed. You may place your command logic in this method.
Let's take a look at an example command. Note that we are able to request any dependencies we need via the command's handle
method. The Laravel service container will automatically inject all dependencies that are type-hinted in this method's signature:
<?php
namespace App\Console\Commands;
use App\Models\User;
use App\Support\DripEmailer;
use Illuminate\Console\Command;
class SendEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'mail:send {user}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Send a marketing email to a user';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @param \App\Support\DripEmailer $drip
* @return mixed
*/
public function handle(DripEmailer $drip)
{
$drip->send(User::find($this->argument('user')));
}
}
{tip} For greater code reuse, it is good practice to keep your console commands light and let them defer to application services to accomplish their tasks. In the example above, note that we inject a service class to do the "heavy lifting" of sending the e-mails.
Closure Commands
Closure based commands provide an alternative to defining console commands as classes. In the same way that route closures are an alternative to controllers, think of command closures as an alternative to command classes. Within the commands
method of your app/Console/Kernel.php
file, Laravel loads the routes/console.php
file:
/**
* Register the closure based commands for the application.
*
* @return void
*/
protected function commands()
{
require base_path('routes/console.php');
}
Even though this file does not define HTTP routes, it defines console based entry points (routes) into your application. Within this file, you may define all of your closure based console commands using the Artisan::command
method. The command
method accepts two arguments: the command signature and a closure which receives the commands arguments and options:
Artisan::command('mail:send {user}', function ($user) {
$this->info("Sending email to: {$user}!");
});
The closure is bound to the underlying command instance, so you have full access to all of the helper methods you would typically be able to access on a full command class.
Type-Hinting Dependencies
In addition to receiving your command's arguments and options, command closures may also type-hint additional dependencies that you would like resolved out of the service container:
use App\Models\User;
use App\Support\DripEmailer;
Artisan::command('mail:send {user}', function (DripEmailer $drip, $user) {
$drip->send(User::find($user));
});
Closure Command Descriptions
When defining a closure based command, you may use the purpose
method to add a description to the command. This description will be displayed when you run the php artisan list
or php artisan help
commands:
Artisan::command('mail:send {user}', function ($user) {
// ...
})->purpose('Send a marketing email to a user');
Defining Input Expectations
When writing console commands, it is common to gather input from the user through arguments or options. Laravel makes it very convenient to define the input you expect from the user using the signature
property on your commands. The signature
property allows you to define the name, arguments, and options for the command in a single, expressive, route-like syntax.
Arguments
All user supplied arguments and options are wrapped in curly braces. In the following example, the command defines one required argument: user
:
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'mail:send {user}';
You may also make arguments optional or define default values for arguments:
// Optional argument...
mail:send {user?}
// Optional argument with default value...
mail:send {user=foo}
Options
Options, like arguments, are another form of user input. Options are prefixed by two hyphens (--
) when they are provided via the command line. There are two types of options: those that receive a value and those that don't. Options that don't receive a value serve as a boolean "switch". Let's take a look at an example of this type of option:
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'mail:send {user} {--queue}';
In this example, the --queue
switch may be specified when calling the Artisan command. If the --queue
switch is passed, the value of the option will be true
. Otherwise, the value will be false
:
php artisan mail:send 1 --queue
Options With Values
Next, let's take a look at an option that expects a value. If the user must specify a value for an option, you should suffix the option name with a =
sign:
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'mail:send {user} {--queue=}';
In this example, the user may pass a value for the option like so. If the option is not specified when invoking the command, its value will be null
:
php artisan mail:send 1 --queue=default
You may assign default values to options by specifying the default value after the option name. If no option value is passed by the user, the default value will be used:
mail:send {user} {--queue=default}
Option Shortcuts
To assign a shortcut when defining an option, you may specify it before the option name and use the |
character as a delimiter to separate the shortcut from the full option name:
mail:send {user} {--Q|queue}
Input Arrays
If you would like to define arguments or options to expect multiple input values, you may use the *
character. First, let's take a look at an example that specifies such an argument:
mail:send {user*}
When calling this method, the user
arguments may be passed in order to the command line. For example, the following command will set the value of user
to an array with foo
and bar
as its values:
php artisan mail:send foo bar
Option Arrays
When defining an option that expects multiple input values, each option value passed to the command should be prefixed with the option name:
mail:send {user} {--id=*}
php artisan mail:send --id=1 --id=2
Input Descriptions
You may assign descriptions to input arguments and options by separating the argument name from the description using a colon. If you need a little extra room to define your command, feel free to spread the definition across multiple lines:
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'mail:send
{user : The ID of the user}
{--queue= : Whether the job should be queued}';
Command I/O
Retrieving Input
While your command is executing, you will likely need to access the values for the arguments and options accepted by your command. To do so, you may use the argument
and option
methods. If an argument or option does not exist, null
will be returned:
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$userId = $this->argument('user');
//
}
If you need to retrieve all of the arguments as an array
, call the arguments
method:
$arguments = $this->arguments();
Options may be retrieved just as easily as arguments using the option
method. To retrieve all of the options as an array, call the options
method:
// Retrieve a specific option...
$queueName = $this->option('queue');
// Retrieve all options as an array...
$options = $this->options();
Prompting For Input
In addition to displaying output, you may also ask the user to provide input during the execution of your command. The ask
method will prompt the user with the given question, accept their input, and then return the user's input back to your command:
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$name = $this->ask('What is your name?');
}
The secret
method is similar to ask
, but the user's input will not be visible to them as they type in the console. This method is useful when asking for sensitive information such as passwords:
$password = $this->secret('What is the password?');
Asking For Confirmation
If you need to ask the user for a simple "yes or no" confirmation, you may use the confirm
method. By default, this method will return false
. However, if the user enters y
or yes
in response to the prompt, the method will return true
.
if ($this->confirm('Do you wish to continue?')) {
//
}
If necessary, you may specify that the confirmation prompt should return true
by default by passing true
as the second argument to the confirm
method:
if ($this->confirm('Do you wish to continue?', true)) {
//
}
Auto-Completion
The anticipate
method can be used to provide auto-completion for possible choices. The user can still provide any answer, regardless of the auto-completion hints:
$name = $this->anticipate('What is your name?', ['Taylor', 'Dayle']);
Alternatively, you may pass a closure as the second argument to the anticipate
method. The closure will be called each time the user types an input character. The closure should accept a string parameter containing the user's input so far, and return an array of options for auto-completion:
$name = $this->anticipate('What is your address?', function ($input) {
// Return auto-completion options...
});
Multiple Choice Questions
If you need to give the user a predefined set of choices when asking a question, you may use the choice
method. You may set the array index of the default value to be returned if no option is chosen by passing the index as the third argument to the method:
$name = $this->choice(
'What is your name?',
['Taylor', 'Dayle'],
$defaultIndex
);
In addition, the choice
method accepts optional fourth and fifth arguments for determining the maximum number of attempts to select a valid response and whether multiple selections are permitted:
$name = $this->choice(
'What is your name?',
['Taylor', 'Dayle'],
$defaultIndex,
$maxAttempts = null,
$allowMultipleSelections = false
);
Writing Output
To send output to the console, you may use the line
, info
, comment
, question
and error
methods. Each of these methods will use appropriate ANSI colors for their purpose. For example, let's display some general information to the user. Typically, the info
method will display in the console as green colored text:
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
// ...
$this->info('The command was successful!');
}
To display an error message, use the error
method. Error message text is typically displayed in red:
$this->error('Something went wrong!');
You may use the line
method to display plain, uncolored text:
$this->line('Display this on the screen');
You may use the newLine
method to display a blank line:
// Write a single blank line...
$this->newLine();
// Write three blank lines...
$this->newLine(3);
Tables
The table
method makes it easy to correctly format multiple rows / columns of data. All you need to do is provide the column names and the data for the table and Laravel will
automatically calculate the appropriate width and height of the table for you:
use App\Models\User;
$this->table(
['Name', 'Email'],
User::all(['name', 'email'])->toArray()
);
Progress Bars
For long running tasks, it can be helpful to show a progress bar that informs users how complete the task is. Using the withProgressBar
method, Laravel will display a progress bar and advance its progress for each iteration over a given iterable value:
use App\Models\User;
$users = $this->withProgressBar(User::all(), function ($user) {
$this->performTask($user);
});
Sometimes, you may need more manual control over how a progress bar is advanced. First, define the total number of steps the process will iterate through. Then, advance the progress bar after processing each item:
$users = App\Models\User::all();
$bar = $this->output->createProgressBar(count($users));
$bar->start();
foreach ($users as $user) {
$this->performTask($user);
$bar->advance();
}
$bar->finish();
{tip} For more advanced options, check out the Symfony Progress Bar component documentation.
Registering Commands
All of your console commands are registered within your application's App\Console\Kernel
class, which is your application's "console kernel". Within the commands
method of this class, you will see a call to the kernel's load
method. The load
method will scan the app/Console/Commands
directory and automatically register each command it contains with Artisan. You are even free to make additional calls to the load
method to scan other directories for Artisan commands:
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
$this->load(__DIR__.'/../Domain/Orders/Commands');
// ...
}
If necessary, you may manually register commands by adding the command's class name to the $commands
property of your App\Console\Kernel
class. When Artisan boots, all the commands listed in this property will be resolved by the service container and registered with Artisan:
protected $commands = [
Commands\SendEmails::class
];
Programmatically Executing Commands
Sometimes you may wish to execute an Artisan command outside of the CLI. For example, you may wish to execute an Artisan command from a route or controller. You may use the call
method on the Artisan
facade to accomplish this. The call
method accepts either the command's signature name or class name as its first argument, and an array of command parameters as the second argument. The exit code will be returned:
use Illuminate\Support\Facades\Artisan;
Route::post('/user/{user}/mail', function ($user) {
$exitCode = Artisan::call('mail:send', [
'user' => $user, '--queue' => 'default'
]);
//
});
Alternatively, you may pass the entire Artisan command to the call
method as a string:
Artisan::call('mail:send 1 --queue=default');
Passing Array Values
If your command defines an option that accepts an array, you may pass an array of values to that option:
use Illuminate\Support\Facades\Artisan;
Route::post('/mail', function () {
$exitCode = Artisan::call('mail:send', [
'--id' => [5, 13]
]);
});
Passing Boolean Values
If you need to specify the value of an option that does not accept string values, such as the --force
flag on the migrate:refresh
command, you should pass true
or false
as the value of the option:
$exitCode = Artisan::call('migrate:refresh', [
'--force' => true,
]);
Queueing Artisan Commands
Using the queue
method on the Artisan
facade, you may even queue Artisan commands so they are processed in the background by your queue workers. Before using this method, make sure you have configured your queue and are running a queue listener:
use Illuminate\Support\Facades\Artisan;
Route::post('/user/{user}/mail', function ($user) {
Artisan::queue('mail:send', [
'user' => $user, '--queue' => 'default'
]);
//
});
Using the onConnection
and onQueue
methods, you may specify the connection or queue the Artisan command should be dispatched to:
Artisan::queue('mail:send', [
'user' => 1, '--queue' => 'default'
])->onConnection('redis')->onQueue('commands');
Calling Commands From Other Commands
Sometimes you may wish to call other commands from an existing Artisan command. You may do so using the call
method. This call
method accepts the command name and an array of command arguments / options:
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->call('mail:send', [
'user' => 1, '--queue' => 'default'
]);
//
}
If you would like to call another console command and suppress all of its output, you may use the callSilently
method. The callSilently
method has the same signature as the call
method:
$this->callSilently('mail:send', [
'user' => 1, '--queue' => 'default'
]);
Stub Customization
The Artisan console's make
commands are used to create a variety of classes, such as controllers, jobs, migrations, and tests. These classes are generated using "stub" files that are populated with values based on your input. However, you may want to to make small changes to files generated by Artisan. To accomplish this, you may use the stub:publish
command to publish the most common stubs to your application so that you can customize them:
php artisan stub:publish
The published stubs will be located within a stubs
directory in the root of your application. Any changes you make to these stubs will be reflected when you generate their corresponding classes using Artisan's make
commands.
Events
Artisan dispatches three events when running commands: Illuminate\Console\Events\ArtisanStarting
, Illuminate\Console\Events\CommandStarting
, and Illuminate\Console\Events\CommandFinished
. The ArtisanStarting
event is dispatched immediately when Artisan starts running. Next, the CommandStarting
event is dispatched immediately before a command runs. Finally, the CommandFinished
event is dispatched once a command finishes executing.


1. The quiz will begin immediately upon clicking the Start button.
2. You will have 30 seconds to answer all questions.
3. Questions are multiple choice.
5. FIVE seconds will be lost from the countdown timer for each incorrect answer.
6. Submit your results to see how you rank on the High Score list!


This chart shows the frequency of all elements in a given season. The vertical axis shows how many times a given element was included in paintings in a given season. As you move the slider, you can see how Mr. Ross's interests changed over time. When all the bars are tall, it indicates that Mr. Ross included a greater number of elements in that seasons's work. When the bars are low, it suggests that given season inculded a lower diversity of elements in each painting.


gameplay.html
// Gameplay
//create function to check location of player: run diff functions based on that
// roll dice x
// track player squares moved x
// gamelog update x
// make log functions and styles
// one for player turn
// one for player die roll x
// one for player enter room x
// one for player use secret passage
// one for player suggestion
// one for player accusation
// store dice value in movesAllowed x
// if movesAllowed > 0....
// must run a check
// if player is in hallway, turn ends, squares moved = 0
// if player enters door, moves = 0, inroom class
//if squares moved > 0, run inRoom function
// if player is inRoom and wants to leave
// create function to determine doors if multiple
// ask what door to leave
// move active player to that door
// roll dice
//if player is inRoom to start turn
//ask if they want to leave
//if there's a secret door and they have said door in array, ask if they
// want to use
// if yes, re-run inRoom function at new location
// 1. randomly decide who goes first
// - load players onto start buttons
// 2. if turn = activeplayer then run playerturn
// 3. if player not inRoom, load button to roll dice, remove button. else,
// load button to use secret passage if exists, begin room functionality
// 4. if dice, moves allowed = dice total
// 5. move character one space per move
// 6. if player is still in hallway, load button to end turn
// 7. if player enters a door, moves = 0, begin room functionality
// 8. if inRoom:
// a) load buttons to make suggestion, make accusation, end turn
// 9. Suggestion:
// a) select weapon, room will be inRoom class, select character
// b) on submit, for each player, if they have one or more of the cards
// pick random card and show to active player
// c) push new card into card array and update detective notebook
// -cpu will need its own array for a checklist. need to make function for it
// d) at beginning, remove suggestion button
// 10. Accusation:
// a) select weapon, room, character
// b) on submit, check if accArray == winArray
// c) if right, game win. wrong, game lose
// d) load new game button
// Challenging Part
// 1. Making logic for computer move
// 2. pick room
// 3. get door (if more than one get closest)
// 4. determine if it's less moves to go horizontal or vertical


Designed, deployed and maintain for MAGFest, Inc. A local non-profit gaming event.
Completed Projects
Designed, deployed and maintain for MAGFest, Inc. A local non-profit gaming event.
Created to showcase knowledge in MERN. Evocate is a card matching game to test your memory. This full-stack app was built in a team of 4 and features: React, MySQL, Sequelize, HTML/CSS/JS and Node.
Designed a website for my personal business, featuring a HTML5up template.
Questival is designed to connect fellow attendees with events that are tailored to their own personal interests. This app was built in a team of 4. and features: Node.js, Express and MySQL, git branching workflow, agile software development.
Created to showcase knowledge in Node Express using MySQL as database and Handlebars to serve the HTML page.
Created to showcase knowledge in React using API calls and React Bootstrap. Application's UI is separated into components that are able to manage component state and respond to events.
Weather dashboard that features dynamically updated HTML and CSS, this app retrieves data from an API.
Star Trek quiz featuring dynamically updated HTML and CSS powered by JavaScript.


{% extends "base.html" %} {% load static %} {% block content %} Post Deleting Sure, you will have to break the egg to make an omelette.
Do you really want to delete the blog below?
Posted by {{ post.author }}, {{ post.created_on }}


{% extends "header.html" %} {% block body %}
In this Kivy tutorial, we cover the Kivy Screen Manager. Any medium to large application is going to have multiple windows. Even if it is something as simple as a login screen that leads to a home screen that allows you to visit a settings screen, you are going to need a way to move to and from the screens.
Kivy works bit like Tkinter, where you just simply bring the main screen to the foreground, but, luckily for us, Kivy does this for us much easier than Tkinter does!
We can use the Screen Manager to store the possible screens, and bring the current screen to the front for the viewer. Not only this, but Kivy also has some basic transitions to make the movement between screens feel a bit better to the user. We'll use the "fade transition" here.
First, let's write our python file:
from kivy.app import App from kivy.lang import Builder from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition class MainScreen(Screen): pass class AnotherScreen(Screen): pass class ScreenManagement(ScreenManager): pass presentation = Builder.load_file("main.kv") class MainApp(App): def build(self): return presentation MainApp().run()
Above, we're now importing the ScreenManager, Screen, and the FadeTransition that we intend to use
Next, we create our MainScreen class, and our AnotherScreen class. These will be the two "screens" for our application.
Then we create the ScreenManagement class, which will inhereit from the ScreenManager class. We're going to use this class for the screen management.
The rest of the code is the same as previous tutorials up to this point.
Now we visit the .kv file, which we've explicitly called main.kv in our python script.
ScreenManagement: transition: FadeTransition() MainScreen: AnotherScreen: <MainScreen>: name: 'main' Button: on_release: app.root.current = 'other' text: 'Another Screen' font_size: 50 <AnotherScreen>: name: 'other' Button: on_release: app.root.current = 'main' text: 'back to the home screen' font_size: 50
Here, we define the screen manager as a parent, giving it the FadeTransition type, and assigning our two screens to it.
After this, we add our screen parents. Within those, we give each one a name. This name is an associative name that we can reference in the screen manager in order to switch to it.
Next, we add a button in both screens, leading to the other screen. The buttons have parameters that we've already seen so far, except for the on_release parameter.
On_release allows us to write some code when the button is released. In this case, we're asking the app.root to change the current attribute to the other page. app.root references the ScreenManagement class, which inherits from the ScreenManager, which is where we get the ".current" method.
With this, you should have a resulting program that knows to switch screens with the click of a button.


| Opcode/Instruction | Op / En | 64/32 bit Mode Support | CPUID Feature Flag | Description |
|---|---|---|---|---|
| 66 0F 38 28 /r PMULDQ xmm1, xmm2/m128 | A | V/V | SSE4_1 | Multiply packed signed doubleword integers in xmm1 by packed signed doubleword integers in xmm2/m128, and store the quadword results in xmm1. |
| VEX.128.66.0F38.WIG 28 /r VPMULDQ xmm1, xmm2, xmm3/m128 | B | V/V | AVX | Multiply packed signed doubleword integers in xmm2 by packed signed doubleword integers in xmm3/m128, and store the quadword results in xmm1. |
| VEX.256.66.0F38.WIG 28 /r VPMULDQ ymm1, ymm2, ymm3/m256 | B | V/V | AVX2 | Multiply packed signed doubleword integers in ymm2 by packed signed doubleword integers in ymm3/m256, and store the quadword results in ymm1. |
| EVEX.128.66.0F38.W1 28 /r VPMULDQ xmm1 {k1}{z}, xmm2, xmm3/m128/m64bcst | C | V/V | AVX512VL AVX512F | Multiply packed signed doubleword integers in xmm2 by packed signed doubleword integers in xmm3/m128/m64bcst, and store the quadword results in xmm1 using writemask k1. |
| EVEX.256.66.0F38.W1 28 /r VPMULDQ ymm1 {k1}{z}, ymm2, ymm3/m256/m64bcst | C | V/V | AVX512VL AVX512F | Multiply packed signed doubleword integers in ymm2 by packed signed doubleword integers in ymm3/m256/m64bcst, and store the quadword results in ymm1 using writemask k1. |
| EVEX.512.66.0F38.W1 28 /r VPMULDQ zmm1 {k1}{z}, zmm2, zmm3/m512/m64bcst | C | V/V | AVX512F | Multiply packed signed doubleword integers in zmm2 by packed signed doubleword integers in zmm3/m512/m64bcst, and store the quadword results in zmm1 using writemask k1. |
| Op/En | Tuple Type | Operand 1 | Operand 2 | Operand 3 | Operand 4 |
| A | NA | ModRM:reg (r, w) | ModRM:r/m (r) | NA | NA |
| B | NA | ModRM:reg (w) | VEX.vvvv (r) | ModRM:r/m (r) | NA |
| C | Full | ModRM:reg (w) | EVEX.vvvv (r) | ModRM:r/m (r) | NA |
Multiplies packed signed doubleword integers in the even-numbered (zero-based reference) elements of the first source operand with the packed signed doubleword integers in the corresponding elements of the second source operand and stores packed signed quadword results in the destination operand.
128-bit Legacy SSE version: The input signed doubleword integers are taken from the even-numbered elements of the source operands, i.e. the first (low) and third doubleword element. For 128-bit memory operands, 128 bits are fetched from memory, but only the first and third doublewords are used in the computation. The first source operand and the destination XMM operand is the same. The second source operand can be an XMM register or 128-bit memory location. Bits (MAXVL-1:128) of the corresponding destination register remain unchanged.
VEX.128 encoded version: The input signed doubleword integers are taken from the even-numbered elements of the source operands, i.e., the first (low) and third doubleword element. For 128-bit memory operands, 128 bits are fetched from memory, but only the first and third doublewords are used in the computation.The first source operand and the destination operand are XMM registers. The second source operand can be an XMM register or 128-bit memory location. Bits (MAXVL-1:128) of the corresponding destination register are zeroed.
VEX.256 encoded version: The input signed doubleword integers are taken from the even-numbered elements of the source operands, i.e. the first, 3rd, 5th, 7th doubleword element. For 256-bit memory operands, 256 bits are fetched from memory, but only the four even-numbered doublewords are used in the computation. The first source operand and the destination operand are YMM registers. The second source operand can be a YMM register or 256-bit memory location. Bits (MAXVL-1:256) of the corresponding destination ZMM register are zeroed.
EVEX encoded version: The input signed doubleword integers are taken from the even-numbered elements of the source operands. The first source operand is a ZMM/YMM/XMM registers. The second source operand can be an ZMM/YMM/XMM register, a 512/256/128-bit memory location or a 512/256/128-bit vector broadcasted from a 64-bit memory location. The destination is a ZMM/YMM/XMM register, and updated according to the writemask at 64-bit granularity.
(KL, VL) = (2, 128), (4, 256), (8, 512) FOR j←0 TO KL-1 i←j * 64 IF k1[j] OR *no writemask* THEN IF (EVEX.b = 1) AND (SRC2 *is memory*) THEN DEST[i+63:i]←SignExtend64( SRC1[i+31:i]) * SignExtend64( SRC2[31:0]) ELSE DEST[i+63:i]←SignExtend64( SRC1[i+31:i]) * SignExtend64( SRC2[i+31:i]) FI; ELSE IF *merging-masking* ; merging-masking THEN *DEST[i+63:i] remains unchanged* ELSE *zeroing-masking* ; zeroing-masking DEST[i+63:i] ← 0 FI FI; ENDFOR DEST[MAXVL-1:VL] ← 0
DEST[63:0]←SignExtend64( SRC1[31:0]) * SignExtend64( SRC2[31:0]) DEST[127:64]←SignExtend64( SRC1[95:64]) * SignExtend64( SRC2[95:64]) DEST[191:128]←SignExtend64( SRC1[159:128]) * SignExtend64( SRC2[159:128]) DEST[255:192]←SignExtend64( SRC1[223:192]) * SignExtend64( SRC2[223:192]) DEST[MAXVL-1:256] ←0
DEST[63:0]←SignExtend64( SRC1[31:0]) * SignExtend64( SRC2[31:0]) DEST[127:64]←SignExtend64( SRC1[95:64]) * SignExtend64( SRC2[95:64]) DEST[MAXVL-1:128] ←0
DEST[63:0]←SignExtend64( DEST[31:0]) * SignExtend64( SRC[31:0]) DEST[127:64]←SignExtend64( DEST[95:64]) * SignExtend64( SRC[95:64]) DEST[MAXVL-1:128] (Unmodified)
VPMULDQ __m512i _mm512_mul_epi32(__m512i a, __m512i b);
VPMULDQ __m512i _mm512_mask_mul_epi32(__m512i s, __mmask8 k, __m512i a, __m512i b);
VPMULDQ __m512i _mm512_maskz_mul_epi32( __mmask8 k, __m512i a, __m512i b);
VPMULDQ __m256i _mm256_mask_mul_epi32(__m256i s, __mmask8 k, __m256i a, __m256i b);
VPMULDQ __m256i _mm256_mask_mul_epi32( __mmask8 k, __m256i a, __m256i b);
VPMULDQ __m128i _mm_mask_mul_epi32(__m128i s, __mmask8 k, __m128i a, __m128i b);
VPMULDQ __m128i _mm_mask_mul_epi32( __mmask8 k, __m128i a, __m128i b);
(V)PMULDQ __m128i _mm_mul_epi32( __m128i a, __m128i b);
VPMULDQ __m256i _mm256_mul_epi32( __m256i a, __m256i b);
None
Non-EVEX-encoded instruction, see Exceptions Type 4.
EVEX-encoded instruction, see Exceptions Type E4.


I’m a software developer! I can help you build a product, feature or website. Look through some of my work and experience! If you like what you see and have a project you need coded, don’t hesitate to contact me.
Academic project developed with Vanilla JS focused on practicing ECMAS 2016 syntax and its new methods. Practicing Webpack was also in the scope of the project.
A daily selection of privately personalized reads; no accounts or sign-ups required.
Exploring the future of media in Facebook's first Virtual Reality app; a place to discover and enjoy 360 photos and videos on Gear VR.
A smart assistant to make driving more safe, efficient, and fun by unlocking your most expensive computer: your car.
Hello I’m a software developer! I can help you build a product , feature or website Look through some of my work and experience! If you like what you see and have a project you need coded, don’t hestiate to contact me.
LET’S CONNECT


HEROIC TRIO 2: EXECUTIONERS 1993 A film review by Timothy Voon Copyright 1998 Timothy Voon 2 :-( :-( for a very disappointing sequel
Yes the femme fatales are back with a vengeance. Wonder Woman (Anita Mui), Invisible Woman (Michelle Yeoh) and The Thief Catcher (Maggie Cheung).
If you consider yourself male then consider yourself an endangered species in this movie. Males are good for providing temporary love interests, before being efficiently disposed off. So let's rid the movie of waste products like husbands and boyfriends, and once again THE HEROIC TRIO can remain focus on their mission – the defeat of a powerful, chemically enhanced mutant, monopolising clean water in post apocalyptic Hong Kong.
Gone is the light-hearted humour sprinkled over action packed sequences that laced the original movie. Instead this episode is filled with the dark undertones of a suffering oppressed society. So much so that our heroines are perpetually morose and depressed, not the chirpy female vixens that dressed loudly and mightily kicked arse in the original. What ultimately killed this movie for me, was when my favourite Chinese actress, Michelle Yeoh was sacrificed – that was the last straw, an unforgivable move. When this happened I lost all interest in what happened next and wished that a sequel was never made to the delightful original HEROIC TRIO, now sadly the HEROIC DUO.
Disappointing, very disappointing.
Timothy Voon e-mail<EMAIL_ADDRESS>http://us.imdb.com/M/reviews_by?Tim+Voon http://www.labyrinth.net.au/~bouclier/week/movies.html
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Some reusable code.
When you use a library, you are in charge of the flow of the application.
You are choosing when and where to call the library.
When you use a framework, the framework is in charge of the flow.
It provides some places for you to plug in your code, but it calls the code you plugged in as needed.
Frameworks and libraries are both code written by someone else that helps you perform some common tasks in a less verbose way.
A framework inverts the control of the program. It tells the developer what they need. A library doesn’t. The programmer calls the library where and when they need it.
The degree of freedom a library or framework gives the developer will dictate how “opinionated” it is.
Free and open-source framework used to style website.
- responsive, mobile-first - popular - save time - great support - loads of style - customizable
Instructor Note: You should know that how important it's to read and understand official documentation.


Ami - Start selling with Homelove!
 This postcard serves as verification of your seller's address.
Visit
www.homelove.com/verify
and enter this code:
089HD9S
Get ready to start selling,


--- layout: post title: First preview of CodeManager date: '2008-06-01T11:33:00+02:00' tags: - perl - blog - code - manager - codemanager - web - sitemap - manage - admin - tool - script - all - in - one - software - application - textmadebyme tumblr_url: http://blog.alezzandro.com/post/36763028/first-preview-of-codemanager ---
Yesterday I’ve published a first snapshot of my little project: CodeManager,
It’s a perl script that manage various type of source codes, it can highlight, publish static html and pack original source code file,
You can insert source code by file or directly by html form, It also manage an index.html file that you can edit with your own favourite style in which it display all the last uploaded source files ordered by date.
You can see a first preview of the static html produced on:
It’s very incomplete so I decided to not publish the source code yet,
Stay tuned for news! :-)