Todo List
My Projects
+
Delete Project
Clear completed tasks
new Task
Priority:
Edit
Delete
Description:
Name of task
Description
Priority
Date
New Task
Cancel
Name of task
Description
Priority
Date
Edit Task
Cancel


Of the topics covered during this last week of unit 1, phase-0, I know that I hadn't exactly mastered the display property. Specifically, what is the difference between the inline and inline-block display values. So naturally, I opened up my browser to GOOGLE, and began to click away.
After merely a few clicks, I scrolled down a page of stack overflow and discovered a remarkably concise list of the differences. But of course, it wouldn't do you any good for me to just paste that and not supply any context. So here goes:
When you designate elements of a parent element to display "block" you are saying that you want the elements to sit on top of one another, presumably like blocks. That is to say, the images will stack. Because there is one element per line, you have free reign over margins, borders, and padding.
And when you designate elements of a parent element to display "inline" you are saying that you want the elements to line up next to each other. Because this is the display you want, css limits what you can do with them, in order to honor the goal of this display value. So inline elements can not set width and height, and margins cannot be added to the top or bottom.
Finally, when you designate elements of a parent element to display "inline-block" you are saying that you want the elements to behave like block elements, except you don't necessarily want a page break after each element.
Check out the image for an simple graphical representation.
bendiciónes! mmc


Use path and filename template
If unchecked, will open a new Save As prompt for every download
Save images
Images are written using original filenames to the 'Save path' location below
If unchecked, the markdown file will contain links to the images' original location on the internet
Save path:
Path within the default Downloads folder
Filename:
Including extension
Template help
Save


03
Home
SMART
Scrum
TX
Calendar
5 Task
Todo
Photo
Video
Note
00
:
00
Setting
Out
Sign Up
Email
Confirm Email
Password
Sign Up
Sign In
Sign In
Email
Password
Remember
Forgot Password
Sign In
Sign Up
Add new
Name
Link
Category
Category
Working
Saab
Tag
Id Code
Submit
List Length
last
Add
Edit
Delete
at title:
at at:
S view
W view
O view
T view
Add
Edit
Delete
at title:
at at:
Todo
Next
Ongoing
Back
Next
Testing
Back
Next
Done
Back
Next
Add
Edit
Delete
at title:
at at:
Good
Bad
Calendar
<
>
S
M
T
W
T
F
S
Date
Type
Report
Plan
Note
Important
Text
Add data
Update data
Cancel
Todo
Add Item
Add
TODO
asdf asdf asdf asdfas fasd asdf asdf
Edit
Save
asdf asdf asdf asdfas fasd asdf asdf
Edit
asdf asdf asdf asdfas fasd asdf asdf
Edit
asdf asdf asdf asdfas fasd asdf asdf
Edit
COMPLETED
asdf asdf asdf asdfas fasd asdf asdf
Edit
Delete
Save
Five Task/Day
To day
Save
Old Data
Photo
is hide
List total:
Edit category
is private
Video
Name
Submit
is hide
List total:
Edit category
is private
Time:
Note
Apply Life
Know Book
View Detail
V Excel
add
edit
active
List history
<>
add
edit
active
move
Loading...
Saving...
<>
save
view
paint
Setting
Setting system
Google Link Excel
One Password When Back Login
Submit
×
Modal title
Back
Next
Welcom back, Please Input Password Session First
Login Session
×
Move:
Move
×
View Excel
×
Image view


I am currently in an opposite jump now. Here.
What I need to know is can an instance reassemble the homogenous nature of the multiverse by stopping an event that should have never happened? This event must be eradicated in the ripple, but all other fractals can remain.
Because although there are universes/timelines where this event does not occur, the instances in which it happens ripples over into those, and there is no barrier. There is no dam to stop the waves spillover in the future.


--- Day 4: High-Entropy Passphrases ---
A new system policy has been put in place that requires all accounts to use a
passphrase instead of simply a password. A passphrase consists of a series of words (lowercase letters) separated by spaces.
To ensure security, a valid passphrase must contain no duplicate words.
For example:
aa bb cc dd ee
is valid.
aa bb cc dd aa
is not valid - the word aa
appears more than once.
aa bb cc dd aaa
is valid - aa
and aaa
count as different words.
The system's full passphrase list is available as your puzzle input. How many passphrases are valid?
Your puzzle answer was 337
.
--- Part Two ---
For added security, yet another system policy has been put in place.
Now, a valid passphrase must contain no two words that are anagrams of each other - that is, a passphrase is invalid if any word's letters can be rearranged
to form any other word in the passphrase.
For example:
abcde fghij
is a valid passphrase.
abcde xyz ecdab
is not valid - the letters from the third word can be rearranged to form the first word.
a ab abc abd abf abj
is a valid passphrase, because all letters need to be used when forming another word.
iiii oiii ooii oooi oooo
is valid.
oiii ioii iioi iiio
is not valid - any of these words can be rearranged to form any other word.
Under this new system policy, how many passphrases are valid?
Your puzzle answer was 231
.
Both parts of this puzzle are complete! They provide two gold stars: **
At this point, you should return to your advent calendar and try another puzzle.
If you still want to see it, you can get your puzzle input.
You can also [Shareon
Twitter
Reddit] this puzzle.


Jemmy Support Module
This module provides support for developers to create Jemmy Components for automated GUI
testing.
Latest binary version of module is available on Netbeans Update Center
Alpha.
What is Jemmy Component ?
- Jemmy Components are connection links between automated tests and
tested GUI components (Frames, Dialogs, etc...).
- Each Jemmy Component is reflecting real GUI and offers API for
automated tests.
- Jemmy Component transforms API calls into GUI manipulation
actions using power of Jemmy
library.
- Jemmy Component API contains three levels:
- sub-components definition (public methods returning Jemmy
Operators for sub-components)
- low-level operations (methods performing simple operations
with subcomponents, like: pushing, setting text, etc...)
- high-level operations (methods performing complex actions
with component, like: all sub-component verification, filling form,
etc...)
How Jemmy Component Generator works ?
- It performs analysis of visible GUI component (Frame, Dialog,
etc...) and creates skeleton of Jemmy Component.
- Jemmy Component Generator does not need sources of component for
analysis.
- Created skeleton is compilable (and executable) code with API
reflecting analyzed component GUI.
How can I use Jemmy Component Generator ?
- Open Components Generator dialog from Tools/Jemmy Components
Generator menu.
- Select destination filesystem and package for generated Jemmy
Components.
- Start Components Generator
- Open and focus tested component (Window, Dialog, Frame, Internal
Frame) or start tested application using IDE Internal Executor.
- Press CTRL-F12 and wait for Components Editor dialog (if
requested).
- Optional - delete unwanted subcomponents or modify their names
and click OK button.
- Java source code of Jemmy Component is opened in Source Editor
and optionally also PNG image with screen shot should be placed in
destination package.
Is it possible to affect process of generation ?
Yes, changing the names of components used in generated code is
optional during process of generation.
Any sub-component can be removed or re-named during generation process.
What is a difference between I18N Wizard and Resource Bundle Lookup
?
- I18N Wizard provides I18N assistance using one known resource
bundle.
- Resource Bundle Lookup performs full-text search through all
resource bundles in unknown source hierarchy.
I18N of Jemmy Components and automated tests pointing to the same
resources as original has big advantage. Jemmy Components and automated
tests does not need to be translated more and they ever match the
original.
How can I use Resource Bundle Lookup ?
- Mount all possible sources into repository.
- Open Resource Bundle Lookup panel from Tools/Resource Bundle
Lookup menu.
- Insert selection criteria and click Select button.
- Choose proper row in result table and copy lookup code to
clipboard using pop up menu.
- Paste lookup code into source code instead of hard coded string
Besides identification of components by their title, text or other
properties, you can identify component by its name. Component's name is
set by method setName() which all components inherit from
java.awt.Component class. Component's name can be obtain from an
instance of component by method getName(). Usage of component's name
has the same advantage as usage of strings from I18N-ed resource
bundles. - you don't need to localize test cases. They work for all
languages. So, if names of components are set by developers, they can
be used for component identification in jemmy operators:
new JButtonOperator(containerOperator, new
NameComponentChooser("btSelect"));
Above code finds in specified container JButton instance which
getName() method returns string equals to "btSelect" (applying current
comparator to compare strings). Component name lookup can help
you to find out component names.
How can I use Component Name Lookup?
- Open Component Name Lookup dialog from Tools|Component Name
Lookup menu
- Move mouse over a component for which you want to find out
component name
- Read component's name or copy (Ctrl-C) constructor of appropriate
operator from the dialog
Legal Notices


Our Story
All the inspiration came from our super senior team, Team Rudra Racing who aspired to participate in SUPRA SAE . Team Rudra Racing was a group of 12 members led effeciently by Mr.Shivcharan Mysore were motivated to build an SAE rule based car as their final year project in the year 2012. Team Rudra Racing was responsible for the start of the SAE CHAPTER - SAEINDIA COLLEGIATE CLUB OF NMIT in our college Nitte Meenakshi Institute Of Technology.
A group of 5-6 first year mechanical engineering students were introduced to SAE by Mr.Vinayaka N in the later part of the year 2012 . Team Arion basically started out as Team Rudra Racing Jr with only 5-6 passion driven individuals who aimed to build a formula student race car. Team Arion is now a group of 20 like minded people with different set of dynamic abilities.
We, the Team Arion were always inspired and motivated by Team Rudra Racing especially by one man Mr.Shivacharan Mysore who always has been a true source of inspiration to everyone. We are also naming our car SHIV 1.0 as a tribute to Mr. Shivacharan Mysore. It has been an incredible journey from 2012 where we were introduced to the level of engineering which goes into the making of a race car to the qualification in the virtual round of SUPRA SAEINDIA in 2015. We are one of the very few teams from karnataka to ever qualify for the event.
About Us
Our Benefactors
Our Pictures


This tests that the DevTools show all .wasm modules loaded on page even when opening the debugger after the page is loaded.
.wasm
show-wasm-1.wasm
show-wasm-2.wasm


Im Noortan Jbreel Abudarwesh from Maan ,im 32 years old ,married ,i have four kids "Razan" ,"Lara" , "moutaz" ," "Deyala" They are the love of my life and the hope I live for
My Top Ten Favorite Most Popular Anime
- Dragon Ball
- One Piece
- Pokemon
- Naruto
- Death Note
- Detective Conan
- Attack on Titan
- Sailor Moon
- Fullmetal Alchemist
- Sword Art Online
Practical experience:
- _ Tomorrow's Girl Institute (Tabuk _ Saudi Arabia) 2013-2014//( Teacher and Trainer )
- _ Modern Girl Higher Institute of Technology (Tabuk _ Saudi Arabia) 2012-2013
- _ The United Nations Organization for Enterprise Development (UNDP) (Petra Region - Jordan) 2010-2012 Supervisor and trainer (technical support)


Tuesday’s Time Schedule
by The Associated PressAll Times EST
Cleveland at Philadelphia, 7 p.m.
Oklahoma City at Indiana, 7 p.m.
Detroit at Miami, 7:30 p.m.
New York at Chicago, 8 p.m.
Atlanta at Denver, 9 p.m.
Brooklyn at Utah, 9 p.m.
L.A. Lakers at Phoenix, 9 p.m.
Portland at Sacramento, 10 p.m.
NHL
Florida at Boston, 7 p.m.
Columbus at Montreal, 7 p.m.
Pittsburgh at N.Y. Rangers, 7:30 p.m.
Colorado at Winnipeg, 8 p.m.
Arizona at St. Louis, 8 p.m.
Detroit at Anaheim, 10 p.m.
Nashville at Vancouver, 10 p.m.
Minnesota at Los Angeles, 10:30 p.m.
Edmonton at San Jose, 10:30 p.m.
TOP 25 BASKETBALL
Men
No. 1 Kentucky vs. Evansville, 7 p.m.
No. 2 Duke vs. Central Arkansas, 7 p.m.
No. 8 Gonzaga vs. North Dakota, 9 p.m.
No. 13 Memphis vs. No. 14 Oregon at Portland, Ore., 9 p.m.
No. 17 Utah State vs. Denver, 9 p.m.
No. 20 Washington vs. Mount St. Mary’s, 9 p.m.
No. 21 Xavier vs. Missouri, 7 p.m.
No. 22 Auburn at South Alabama, 8 p.m.
Women
No. 20 Syracuse vs. Maryland-Eastern Shore, 8 p.m.
No. 25 South Florida vs. Howard, 7 p.m.
Sign up for Daily Newsletters
Copyright © 2019 The Washington Times, LLC.
Please read our comment policy before commenting.


---
layout: archive
---
Welcome to Machine Learning Arena!! I am working in my free time to develop this site. I will soon post here some Machine Learning projects I have worked on. Check back later.
{{ site.data.ui-text[site.locale].recent_posts | default: "Recent Posts" }}
{% for post in paginator.posts %}
{% include archive-single.html %}
{% endfor %}
{% include paginator.html %}


These cards are used in an blog and social network and other entertainment like music.
Finance
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.
Health
Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text and a search.
Travel
The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters as opposed to using content.
Various versions have evolved over the years, sometimes by accident, sometimes on purpose. Many desktop publishing packages and web page editors now use...
Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for lorem ipsum will uncover many web sites still in their infancy...


Leading Scorers In 2019, Messi Twice As Good As Ronaldo
by Kurt BuckerfieldWith a month and a half left of football this year, here are the 10 leading goalscorers across Europe's top five leagues so far in 2019. While Lionel Messi may not be at the top, he has scored twice as many goals as Cristiano Ronaldo has.
Click through the gallery above to see the 10 top goalscorers for clubs in Europe's elite leagues in 2019 so far, according to Transfermarkt.
After his brace against Borussia Dortmund this past weekend, Bayern Munich striker Robert Lewandowski leads the way with 41 club goals in 2019, two ahead of FC Barcelona's captain.
Messi's incredible hat-trick against Celta Vigo this past Saturday saw his tally shoot to 39 for the calendar year, with those goals coming from just 41 matches. As such, the Argentine has opened the gap on Kylian Mbappe, the player who is next closest to him with 31 strikes.
Download The Soccer Laduma Social Media App & Earn Airtime for Selfies!
Real Madrid forward Karim Benzema has jumped up two places as he continues his excellent goalscoring form across all competitions for Los Blancos. The Frenchman, who is still out of the reckoning for the French national team, has found the back of the net on 30 occasions in 2019.
Trailing the 31-year-old is Manchester City stalwart Sergio Aguero, whose teammate Raheem Sterling is nearest to him. Their Premier League rival Sadio Mane is hot on their heels, while a new entry in the top 10 is Lazio's Ciro Immobile.
Frustrated CR7 Storms Off Pitch, Leaves Stadium? Sarri Responds
Ronaldo has scored just 18 goals for Juventus in 2019, seeing him in 21st position, with the likes of Timo Werner and Jamie Vardy ahead of him – click through the gallery to see the top 10!


Coroutine related boilerplate and wrappers.
Bases: object
A threadlocal-like object that works in the context of coroutines. That means, the current running coroutine has the _ident_.
Coroutine.run_op sets the indent before running a step and unsets after.
Example:
loc = local()
loc.foo = 1
The loc instance’s values will be different for separate coroutines.
Bases: object
A decorator function for generators. Example:
@coroutine
def plain_ol_generator():
yield bla
yield bla
...
Bases: cogen.core.events.Operation
We need a coroutine wrapper for generators and functions alike because we want to run functions that don’t return generators just like a coroutine, also, we do some exception handling here.
Handle the operation:
Return self is used as a optimization. Coroutine is also a Operation which handles it’s own completion (resuming the caller and the waiters).
Bases: exceptions.Exception
This is used intenally to carry exception state in the poller and scheduler.


Checks for variables that are defined before they might be used. A reference is deemed to be premature if it is created right before a block of code that doesn't use it that also has the ability to return or throw an exception. Example:
public int getLength(String[] strings) { int length = 0; // declared prematurely if (strings == null || strings.length == 0) return 0; for (String str : strings) { length += str.length(); } return length; }
This rule is deprecated, use {rule:squid:S1941} instead.


--- type: formControls title: Chosen single select usage: Controls using chosen library with a custom style to search result in a list inside a select. stylesheet: '/scss/controls/chosen.scss' ---


LEARN MORE
Download a 4K movie in the blink of an eye. Jump on a group video call that never lags. Turn your living room into an AR zombie apocalypse. 5G is taking phones to the next level — and they’re only built on Android.
Samsung
laxy 10
>5G
LG
50 ThinQ
5G
Xiaomi
Mi Mix 3
5G
Oppo
Reno
5G
Android powers some of the world’s top cameras. So when the action speeds up or the lights go down low, you always get that perfect shot.
Pixel 3a
Motorola
Moto G7
OnePlus
6T
Sony
Xperia 1
Watch a show the way it was intended. Edit a photo all the way down to the pixels. With Android tablets, you get more screen to do your thing.
Samsung
Galaxy Tab S4
Lenovo
Tab P10
Lenovo
Tab P10 Plus
Use the work profile to keep your personal data separate. Turn off work apps when you want to disconnect. And with the Android Enterprise Recommended program, it's easy to find the right devices for your job. From construction sites to corporate offices.
Learn more
Android One phones are certified to run the simplest, latest version of Android. Regular security updates every month. At least two years of OS upgrades.2 And only loaded with the most essential apps.
Learn more
Less RAM.
Still loaded with power.
Get the best of Android on lower RAM devices.  Data Saver helps you manage your data. And the Play Store continually gets new apps made just for Android (Go edition).
Learn more
Tecno
Spark 2
Nokia
1 Plus
Lava
Z50
Lenovo Moto
E5 Play


weather statistics provided by
https://openweathermap.org
images and temple data provided by
lds.org


The ICO generator deploys an ERC20 compliant token contract containing all the required functions of ERC20 tokens. It allows an unlimited number of tokens to be sold, with no expiry date. The SafeMath library is used to ensure no overflow/underflow attacks are possible.
View the token contract here.
If you deploy your crowdsale contract to the Ethereum mainnet, it will cost at least a few dollars in mining fees for it to be processed (all transactions in Ethereum cost some ether, which is used to pay the miners mining your transaction). It requires around 1,300,000 gas to process the deployed contract here.
This is an entirely open source project and you can see the javascript used to deploy the contract (via the Web3 library) here (or go to icocompiler.com/app.js for a live version - everything at the end is our code). If you get a tool like Truffle to compile and deploy the token contract we are using (here) you'll see the bytecode and ABI is exactly what is hardcoded in our app.js file.
To execute any of the functions in a contract deployed here right from this webpage, first enter its address below:
Below are the functions available for you to execute on a contract address entered above.


notumclo
| Not a Tumblr Clone
Log in
Username or Email
Password
Log in
Register
Name
Username
Email
Password
Confirm Password
Register


Michelle Cole
Democrat
I am a writer and a consultant on business strategy, communications, and leadership development. I create and facilitate programs to solve problems, manage change, and train leaders.
I have a BA in English, and MFA in Writing and will be granted my PhD in Transformational Leadership in March 2021. This means I have been trained as an academic, but I also have extensive training in the practice of working with and in groups for successful outcomes. I am trained by Columbia University School of Public Health, by Kaiser Permenente, The Restorative Justice Project, and several non-institutional training programs to facilitate group process. I have training in team building and personal leadership skills from four different organizations, I have been trained in data analysis as part of my educational program and I am also trained in several group process modalities that are geared to bring strategy, consensus, and team skills.
80304
I work with organizations and communities as my career to take data, both qualitative and quantitative and use it to represent and advocate for the most diverse set of interests in pursuit of the best solutions to problems. So I apply this to groups as small as schools and parent teacher groups and as widely as my work with Project Protect Food Systems and Colorado Immigrants Rights Coalition. I have worked on local Boulder issues, on the Leadership Boulder program, for the Longmont Center for Restorative Justice, and for Front Range Community College all to bring together communities and individuals for change.
I have worked on political campaigns for individual candidates and for ballot measures since I was a child. I was pulled in a wagon to campaign against Nixon and have worked on various campaigns as a volunteer ever since. I have never been employed by a campaign, just a volunteer. I have given to Biden, Obama, Polis, and various state initiatives as well as MoveOn.Org and Swing Left. While that may make me sound partisan, I am not, I simply value civic engagement and believe all citizens should be active in politics.
In reverse order - Project Protect Food Systems, a state-wide organization for food security doing communications, The Race Justice Task Force of the Episcopal Church in Colorado as a leadership development volunteer, The Community Remembrance Project a volunteer working with youth, I have been on the Board of the Fyera Foundation for two years, and I am involved in various community leadership programs as a facilitator and trainer including Leadership Cleveland, and the Episcopal Service Corps. I am also involved in the Colorado Immigrants Rights Coalition as a trained observer and do facilitation pro-bono for groups who are doing visioning and diversity and inclusion work.
I am a deeply optimistic believer in our governmental system. When I voted last year to create the commission, I knew I wanted to be on it to do a great job at what other states have mangled. I love Colorado and I have a lot of pride in how well we do a lot of things in this state, especially voting related. I want this to be one of the ways that Colorado is successful in taking good care of our citizens and in showing the country that it is possible to be fair minded, just, and forward-thinking. We are all those things and I want to see it come to fruition.
This is my work in the world. I am trained in community building, facilitating group process, and creating cohesive teams that move change forward. I am interested in finding paths forward on sticky problems and in all voices being heard. I love Colorado and our history of divergent thinking and I want to support and encourage that. I am also by training an academic who looks at the data and draws conclusions from it. And - most importantly, I know how to take that impartial look at the actual situation out into a group and build consensus .
I have very recently finished a PhD that includes qualitative data analysis. I am trained as an academic in how to teach and use critical thinking in humanities and social science disciplines. I also wrote a book on the use of communications skills to support data and quantitative information in decision making which is in the publication process, and a book for more general audiences on trauma aware communications skills that includes sections on using data. I am uniquely qualified to work on a hot topic with a divided group to create collegiality and success.
I identify as female and since you did not ask it anywhere, also as queer. Which is an important diversity issue in Colorado.


re-engineering
what is Couchsurfing?
it's like airbnb!?!
kind of. but not really.
it's people.
it's a booking system that connects
travelers and hosts.
it's a travel oriented social network.
it facilitates offline connections
between people all over the world.
| founded | 2004 |
| members | 11,368,956 |
| unique actives since relaunch | 3,333,481 |
| members named "Bosco" | 76 |
| events created since relaunch | 97,988 |
| event attendees since relaunch | 274,139 |
| SQL queries per second | 5745 |
was
didn't want to show the site to my mom
- PHP site running on leased hardware in Atlanta
- rails site running at AWS in Virginia
- over 1000 tables, spread across 46 MySQL databases on 25 different MySQL masters
- user data synchronized between two sites
- rails read and writes on PHP site databases
- small features took 2 weeks to implement
- new features usually broke something else
- server velocity held up mobile development
- 1,783,284 lines of legacy code
- search was 5 hours behind updates
- down for 2 hours every other day
- site was slow
- 2004 is a long time ago
- built by volunteers initially through collectives
- difficult transition from not-for-profit
- democratic feature strategy
- lurching between fixing basics and radical overhauls
that's kind of depressing.
core idea == awesome
with dedicated users all over the globe,
our challenge is to do the idea justice.
Agile Manifesto
- Individuals and interactions over processes and tools
- Working software over comprehensive documentation
- Customer collaboration over contract negotiation
- Responding to change over following a plan
Simplify
- be brutal about MVP
- AWS
- staffing
- leverage open source
Analytics from the beginning
- logstash
- kibana
- redshift via attunity
- looker
- amplitude
our stack
- Rails
- simple html based views with jquery
- (massive) MySQL on RDS
- SOLR
- google for geo
- Mandrill for email
- Stripe and Paypal
- neo4j (oops)
cool names
- potatoe
- hammertime
- hammerpants
things we could have done better
- more resource on the product side
- hired a little better
- not made any mistakes
- not ignored SEO
- been nicer to each other
is
not totally embarrassing
- basics features in place
- analytics drive decisions
- better search
- performance
- bigger product improvements
- focus on mobile
- more focus on mobile
will be
look mom, this is AWESOME!
. . and our test coverage is 100% for things that matter


ID
{% if message %}
{{ message }}
{% endif %}
Individual
Position:
Projects:
Project
Outsourcing Percentage:
High Risk Individuals:
Name
Risk of Leaving
Impact of Leaving
Length of Employment
seb
60%
bad!
12 days


Stay Mad
Home
(current)
About
Gallery
Progress
Apply
Group 8
Emerald Nightmare
Trial of Valor
Nighthold
Tomb of Sargeras
Antorus


http://eliasmoniker.com
Elias Moniker is Teejay VanSlyke.
Mixing assistance and mastering by Jeremy Highhouse.
Illustrations by Chase Velarde.
Hans Grüvendorfer played by Brennan Novak.
Without the continuous support of the following people, this production would not have been possible:
Alexander Black, Brennan Novak, Nicholaus Ames, Ryan Mauk, Chris Davidson, Alex Weber, Timothy Scaffidi, Sage Howes, Tim & Jean VanSlyke, Adam VanSlyke.
Copyright 2011 BOP.fm. Unauthorized reproduction is prohibited. If you do make copies, at least share them with your friends.
">Elias Moniker is Teejay VanSlyke.
Mixing assistance and mastering by Jeremy Highhouse.
Illustrations by Chase Velarde.
Hans Grüvendorfer played by Brennan Novak.
Without the continuous support of the following people, this production would not have been possible:
Alexander Black, Brennan Novak, Nicholaus Ames, Ryan Mauk, Chris Davidson, Alex Weber, Timothy Scaffidi, Sage Howes, Tim & Jean VanSlyke, Adam VanSlyke.
Copyright 2011 BOP.fm. Unauthorized reproduction is prohibited. If you do make copies, at least share them with your friends.


Pizza Place
Size
Small - 10" / 25 cm
Medium - 12" / 30 cm
Large - 14" / 35 cm
Family - 16" / 40 cm
Select size
Toppings
add
Cheese
add
Extras
add


| I l@ve RuBoard |
5.8 Comparing Directory TreesEngineers can be a paranoid sort (but you didn't hear that from me). At least I am. It comes from decades of seeing things go terribly wrong, I suppose. When I create a CD backup of my hard drive, for instance, there's still something a bit too magical about the process to trust the CD writer program to do the right thing. Maybe I should, but it's tough to have a lot of faith in tools that occasionally trash files, and seem to crash my Windows 98 machine every third Tuesday of the month. When push comes to shove, it's nice to be able to verify that data copied to a backup CD is the same as the original -- or at least spot deviations from the original -- as soon as possible. If a backup is ever needed, it will be really needed. Because data CDs are accessible as simple directory trees, we are once again in the realm of tree walkers -- to verify a backup CD, we simply need to walk its top-level directory. We've already written a generic walker class (the visitor module), but it won't help us here directly: we need to walk two directories in parallel and inspect common files along the way. Moreover, walking either one of the two directories won't allow us to spot files and directories that only exist in the other. Something more custom seems in order here. 5.8.1 Finding Directory DifferencesBefore we start coding, the first thing we need to clarify is what it means to compare two directory trees. If both trees have exactly the same branch structure and depth, this problem reduces to comparing corresponding files in each tree. In general, though, the trees can have arbitrarily different shapes, depth, and so on. More generally, the contents of a directory in one tree may have more or fewer entries than the corresponding directory in the other tree. If those differing contents are filenames, there is no corresponding file to compare; if they are directory names, there is no corresponding branch to descend through. In fact, the only way to detect files and directories that appear in one tree but not the other is to detect differences in each level's directory. In other words, a tree comparison algorithm will also have to perform directory comparisons along the way. Because this is a nested, and simpler operation, let's start by coding a single-directory comparison of filenames in Example 5-24. Example 5-24. PP2E\System\Filetools\dirdiff.py#!/bin/env python ######################################################## # use: python dirdiff.py dir1-path dir2-path # compare two directories to find files that exist # in one but not the other; this version uses the # os.listdir function and list difference; note # that this script only checks filename, not file # contents--see diffall.py for an extension that # does the latter by comparing .read( ) results; ######################################################## import os, sys def reportdiffs(unique1, unique2, dir1, dir2): if not (unique1 or unique2): print 'Directory lists are identical' else: if unique1: print 'Files unique to', dir1 for file in unique1: print '...', file if unique2: print 'Files unique to', dir2 for file in unique2: print '...', file def unique(seq1, seq2): uniques = [] # return items in seq1 only for item in seq1: if item not in seq2: uniques.append(item) return uniques def comparedirs(dir1, dir2): print 'Comparing', dir1, 'to', dir2 files1 = os.listdir(dir1) files2 = os.listdir(dir2) unique1 = unique(files1, files2) unique2 = unique(files2, files1) reportdiffs(unique1, unique2, dir1, dir2) return not (unique1 or unique2) # true if no diffs def getargs( ): try: dir1, dir2 = sys.argv[1:] # 2 command-line args except: print 'Usage: dirdiff.py dir1 dir2' sys.exit(1) else: return (dir1, dir2) if __name__ == '__main__': dir1, dir2 = getargs( ) comparedirs(dir1, dir2) Given listings of names in two directories, this script simply picks out unique names in the first, unique names in the second, and reports any unique names found as differences (that is, files in one directory but not the other). Its comparedirs function returns a true result if no differences were found -- useful for detecting differences in callers. Let's run this script on a few directories; differences are detected and reported as names unique in either passed-in directory pathname. Notice that this is only a structural comparison that just checks names in listings, not file contents (we'll add the latter in a moment): C:\temp>python %X%\system\filetools\dirdiff.py examples cpexamples Comparing examples to cpexamples Directory lists are identical C:\temp>python %X%\system\filetools\dirdiff.py examples\PyTools cpexamples\PyTools Comparing examples\PyTools to cpexamples\PyTools Files unique to examples\PyTools ... visitor.py C:\temp>python %X%\system\filetools\dirdiff.py examples\System\Filetools cpexamples\System\Filetools Comparing examples\System\Filetools to cpexamples\System\Filetools Files unique to examples\System\Filetools ... dirdiff2.py Files unique to cpexamples\System\Filetools ... cpall.py The unique function is the heart of this script: it performs a simple list difference operation. Here's how it works apart from the rest of this script's code: >>> L1 = [1, 3, 5, 7, 9] >>> L2 = [2, 3, 6, 8, 9] >>> from dirdiff import unique >>> unique(L1, L2) # items in L1 but not in L2 [1, 5, 7] >>> unique(L2, L1) # items in L2 but not in L1 [2, 6, 8] These two lists have objects 3 and 9 in common; the rest appear only in one of the two. When applied to directories, unique items represent tree differences, and common items are names of files or subdirectories that merit further comparisons or traversal. There are other ways to check this code; see the dirdiff variants in the book's CD for a few. 5.8.2 Finding Tree DifferencesNow all we need is a tree walker that applies dirdiff at each level to pick out unique files and directories, explicitly compares the contents of files in common, and descends through directories in common. Example 5-25 fits the bill. Example 5-25. PP2E\System\Filetools\diffall.py######################################################### # Usage: "python diffall.py dir1 dir2". # recursive tree comparison--report files that exist # in only dir1 or dir2, report files of same name in # dir1 and dir2 with differing contents, and do the # same for all subdirectories of the same names in # and below dir1 and dir2; summary of diffs appears # at end of output (but search redirected output for # "DIFF" and "unique" strings for further details); ######################################################### import os, dirdiff def intersect(seq1, seq2): commons = [] # items in seq1 and seq2 for item in seq1: if item in seq2: commons.append(item) return commons def comparedirs(dir1, dir2, diffs, verbose=0): # compare filename lists print '-'*20 if not dirdiff.comparedirs(dir1, dir2): diffs.append('unique files at %s - %s' % (dir1, dir2)) print 'Comparing contents' files1 = os.listdir(dir1) files2 = os.listdir(dir2) common = intersect(files1, files2) # compare contents of files in common for file in common: path1 = os.path.join(dir1, file) path2 = os.path.join(dir2, file) if os.path.isfile(path1) and os.path.isfile(path2): bytes1 = open(path1, 'rb').read( ) bytes2 = open(path2, 'rb').read( ) if bytes1 == bytes2: if verbose: print file, 'matches' else: diffs.append('files differ at %s - %s' % (path1, path2)) print file, 'DIFFERS' # recur to compare directories in common for file in common: path1 = os.path.join(dir1, file) path2 = os.path.join(dir2, file) if os.path.isdir(path1) and os.path.isdir(path2): comparedirs(path1, path2, diffs, verbose) if __name__ == '__main__': dir1, dir2 = dirdiff.getargs( ) mydiffs = [] comparedirs(dir1, dir2, mydiffs) # changes mydiffs in-place print '='*40 # walk, report diffs list if not mydiffs: print 'No diffs found.' else: print 'Diffs found:', len(mydiffs) for diff in mydiffs: print '-', diff At each directory in the tree, this script simply runs the dirdiff tool to detect unique names, and then compares names in common by intersecting directory lists. Since we've already studied the tree-walking tools this script employs, let's jump right into a few example runs. When run on identical trees, status messages scroll during the traversal, and a "No diffs found" message appears at the end: C:\temp>python %X%\system\filetools\diffall.py examples cpexamples -------------------- Comparing examples to cpexamples Directory lists are identical Comparing contents -------------------- Comparing examples\old_Part2 to cpexamples\old_Part2 Directory lists are identical Comparing contents -------------------- ...more lines deleted... -------------------- Comparing examples\EmbExt\Regist to cpexamples\EmbExt\Regist Directory lists are identical Comparing contents -------------------- Comparing examples\PyTools to cpexamples\PyTools Directory lists are identical Comparing contents ======================================== No diffs found. To show how differences are reported, we need to generate a few. Let's run the global search-and-replace script we met earlier, to change a few files scattered about one of the trees (see -- I told you global replacement could trash your files!): C:\temp\examples>python %X%\PyTools\visitor_replace.py -exec SPAM Are you sure?y ... 1355 => .\PyTools\visitor_find_quiet1.py 1356 => .\PyTools\fixeoln_one.doc.txt Visited 1356 files Changed 8 files: .\package.csh .\README-PP2E.txt .\readme-old-pp1E.txt .\temp .\remp .\Internet\Cgi-Web\fixcgi.py .\System\Processes\output.txt .\PyTools\cleanpyc.py While we're at it, let's remove a few common files so directory uniqueness differences show up on the scope too; the following three removal commands will make two directories differ (the last two commands impact the same directory in different trees): C:\temp>rm cpexamples\PyTools\visitor.py C:\temp>rm cpexamples\System\Filetools\dirdiff2.py C:\temp>rm examples\System\Filetools\cpall.py Now, rerun the comparison walker to pick out differences, and pipe its output report to a file for easy inspection. The following lists just the parts of the output report that identify differences. In typical use, I inspect the summary at the bottom of the report first, and then search for strings "DIFF" and "unique" in the report's text if I need more information about the differences summarized: C:\temp>python %X%\system\filetools\diffall.py examples cpexamples > diffs C:\temp>type diffs -------------------- Comparing examples to cpexamples Directory lists are identical Comparing contents package.csh DIFFERS README-PP2E.txt DIFFERS readme-old-pp1E.txt DIFFERS temp DIFFERS remp DIFFERS -------------------- Comparing examples\old_Part2 to cpexamples\old_Part2 Directory lists are identical Comparing contents -------------------- ... -------------------- Comparing examples\Internet\Cgi-Web to cpexamples\Internet\Cgi-Web Directory lists are identical Comparing contents fixcgi.py DIFFERS -------------------- ... -------------------- Comparing examples\System\Filetools to cpexamples\System\Filetools Files unique to examples\System\Filetools ... dirdiff2.py Files unique to cpexamples\System\Filetools ... cpall.py Comparing contents -------------------- ... -------------------- Comparing examples\System\Processes to cpexamples\System\Processes Directory lists are identical Comparing contents output.txt DIFFERS -------------------- ... -------------------- Comparing examples\PyTools to cpexamples\PyTools Files unique to examples\PyTools ... visitor.py Comparing contents cleanpyc.py DIFFERS ======================================== Diffs found: 10 - files differ at examples\package.csh - cpexamples\package.csh - files differ at examples\README-PP2E.txt - cpexamples\README-PP2E.txt - files differ at examples\readme-old-pp1E.txt - cpexamples\readme-old-pp1E.txt - files differ at examples\temp - cpexamples\temp - files differ at examples\remp - cpexamples\remp - files differ at examples\Internet\Cgi-Web\fixcgi.py - cpexamples\Internet\Cgi-Web\fixcgi.py - unique files at examples\System\Filetools - cpexamples\System\Filetools - files differ at examples\System\Processes\output.txt - cpexamples\System\Processes\output.txt - unique files at examples\PyTools - cpexamples\PyTools - files differ at examples\PyTools\cleanpyc.py - cpexamples\PyTools\cleanpyc.py I added line breaks and tabs in a few of these output lines to make them fit on this page, but the report is simple to understand. Ten differences were found -- the eight files we changed (trashed) with the replacement script, and the two directories we threw out of sync with the three rm remove commands. <IP_ADDRESS> Verifying CD backupsSo how does this script placate CD backup paranoia? To double-check my CD writer's work, I run a command like the following. I can also use a command like this to find out what has been changed since the last backup. Again, since the CD is "G:" on my machine when plugged in, I provide a path rooted there; use a root such as /dev/cdrom on Linux: C:\temp>python %X%\system\filetools\diffall.py examples g:\PP2ndEd\examples\PP2E > exdiffs091500 C:\temp>more exdiffs091500 -------------------- Comparing examples to g:\PP2ndEd\examples\PP2E Files unique to examples ... .cshrc Comparing contents tounix.py DIFFERS -------------------- Comparing examples\old_Part2 to g:\PP2ndEd\examples\PP2E\old_Part2 Directory lists are identical Comparing contents -------------------- ...more visitor_fixeoln.py DIFFERS visitor_fixnames.py DIFFERS ======================================== Diffs found: 41 - unique files at examples - g:\PP2ndEd\examples\PP2E - files differ at examples\tounix.py - g:\PP2ndEd\examples\PP2E\tounix.py ...more The CD spins, the script compares, and a summary of 41 differences appears at the end of the report (in this case, representing changes to the examples tree since the latest backup CD was burned). For an example of a full difference report, see file exdiffs091500 on the book's CD. More typically, this is what turns up for most of my example backups -- files with a leading "." are not copied to the CD: C:\temp>python %X%\System\Filetools\diffall.py examples g:\PP2ndEd\examples\PP2E ... -------------------- Comparing examples\Config to g:\PP2ndEd\examples\PP2E\Config Files unique to examples\Config ... .cshrc Comparing contents ======================================== Diffs found: 1 - unique files at examples\Config - g:\PP2ndEd\examples\PP2E\Config And to really be sure, I run the following global comparison command against the true book directory, to verify the entire book tree backup on CD: C:\>python %X%\System\Filetools\diffall.py PP2ndEd G:\PP2ndEd -------------------- Comparing PP2ndEd to G:\PP2ndEd Files unique to G:\PP2ndEd ... examples.tar.gz Comparing contents README.txt DIFFERS -------------------- ...more -------------------- Comparing PP2ndEd\examples\PP2E\Config to G:\PP2ndEd\examples\PP2E\Config Files unique to PP2ndEd\examples\PP2E\Config ... .cshrc Comparing contents -------------------- ...more -------------------- Comparing PP2ndEd\chapters to G:\PP2ndEd\chapters Directory lists are identical Comparing contents ch01-intro.doc DIFFERS ch04-os3.doc DIFFERS ch05-gui1.doc DIFFERS ch06-gui2.doc DIFFERS -------------------- ...more ======================================== Diffs found: 11 - unique files at PP2ndEd - G:\PP2ndEd - files differ at PP2ndEd\README.txt - G:\PP2ndEd\README.txt ...more This particular run indicates that I've changed a "readme" file, four chapter files, and a bunch more since the last backup; if run immediately after making a backup, only the .cshrc unique file shows up on diffall radar. This global comparison can take a few minutes -- it performs byte-for-byte comparisons of all chapter files and screen shots, the examples tree, an image of the book's CD, and more, but it's an accurate and complete verification. Given that this book tree contained roughly 119M of data in 7300 files and 570 directories the last time I checked, a more manual verification procedure without Python's help would be utterly impossible. Finally, it's worth noting that this script still only detects differences in the tree, but does not give any further details about individual file differences. In fact, it simply loads and compares the binary contents of corresponding files with a single string comparison -- it's a simple yes/no result.[11] If and when I need more details about how two reported files actually differ, I either edit the files, or run the file-comparison command on the host platform (e.g., fc on Windows/DOS, diff or cmp on Unix and Linux). That's not a portable solution for this last step; but for my purposes, just finding the differences in a 1300-file tree was much more critical than reporting which lines differ in files flagged in the report.
Of course, since we can always run shell commands in Python, this last step could be automated by spawning a diff or fc command with os.popen as differences are encountered (or after the traversal, by scanning the report summary). Because Python excels at processing files and strings, though, it's possible to go one step further and code a Python equivalent of the fc and diff commands. Since this is beyond both this script's scope and this chapter's size limits, that will have to await the attention of a curious reader. |
| I l@ve RuBoard |


Array-based programming languages are often touted as providing superior performance and brief, "mind-expanding" program implementations. While examples of elegant programming koans exist, direct comparisons between implementations in array-based languages and imperative languages are missing. Some examples are needed to make a fair comparison and move the conversation forward.
I came across a good candidate problem while reading the ebook Q For Mortals by Jeffry Borror. In an introductory section, Borror covers an example of post-hoc optimal execution in trading. The task is, given a timeseries of stock prices (no bid/ask spread), to pick the best time to buy then sell stock to realize a maximum profit in a trading period, with up to one buy and sell allowed (equivalently, we can require that exactly one trade occurs and you can buy/sell at the same time step), assuming no market impact.
This is a typical phone-interview-level problem for software positions.
A more advanced question is to ask for optimal execution with up to two, three, or more non-overlapping buys and sells.
In imperative languages, solutions online abound for the case of one buy, up to two buys, and up to k buys.
I'd like to consider what an implementation in q/kdb looks like. Compared to a typical C implementation, we'll see that the Q implementation:
Let's start with the case of one buy and sell. A complete trade needs to buy at some time, and sell at some (possibly later) time. We can find the best trade by finding the most profitable trade for each sell time, then take the profit of the most profitable sell time -- working "backwards" from a sell time will generalize nicely to multiple trades. We can find the most profitable trade for each sell time by iterating over buy times at or before the sell time and maximizing the difference between buy and sell.
We can describe this idea in mathematical notation. Let \(P = (p_0,p_1,...,p_n)\) be the vector of prices at each tick. We want to compute the maximum profit \(MP_1(P)\) for the trading period. Let \(OE_1(P)\) be the vector of maximal profits, indexed by sell time (the subscripts \(1\) are just suggestive placeholders for now). Then \(OE_1(P)_i\) is the maximum profit when selling at time \(i\).
The relationships described above translate to these equations: $$ \begin{aligned} OE_1(P)_i &= \max_{0 \leq j \leq i} \left\{ p_i - p_j \right\} \\ &= p_i - \min_{0 \leq j \leq i} \left\{ p_j \right\} \\ MP_1(P) &= \max_{0 \leq i \leq n} OE_1(P)_i \\ &= \max_{0 \leq i \leq n} \left\{ p_i - \min_{0 \leq j \leq i} \left\{ p_j \right\} \right\} \\ \end{aligned} $$
Here is Borror's implementation in q:
q)max pxs-mins pxs
where pxs is the vector of prices (initialization/runner code further below). Notice that in q the operator precedence is right-to-left, so there are no braces/parentheses. Moreover, the operator mins creates a vector whose \(i\)'th entry is \(min_{1\leq j \leq i} \{p_i\}\), so we do not need to write any loop indices.
For two trades, let's reuse the logic for optimal single trades. We are going to find the most profitable pair of trades by iterating over the last sell time, then take the profit of the best sell time. For each final sale time, the most profitable pair of trades is obtained by iterating over buy time at or before the sell time and maximizing the difference between buy and sell plus the most profitable trade that ends at or before the buy time.
Extending our earlier notation, let \(MP_2(P)\) be the maximium profit realizable with up to 2 trades and \(OE_2(P)\) the vector of maximum profits for 2 trades indexed by last sell time. Then,
$$ \begin{aligned} OE_2(P)_i &= \max_{0 \leq l \leq k \leq j \leq i} \left\{ p_i - p_j + p_k - p_l \right\} \\ &= p_i + \max_{0 \leq l \leq k \leq j \leq i} \left\{ - p_j + p_k - p_l \right\} \\ &= p_i + \max_{0 \leq k \leq j \leq i} \left\{ - p_j + OE_1(P)_k \right\} \\ &= p_i + \max_{0\leq j \leq i} \left\{ - p_j + \max_{0 \leq k \leq j}OE_1(P)_k \right\} \\ &= p_i + \max_{0\leq j \leq i} \left\{ - \left(p_j - \max_{0 \leq k \leq j}OE_1(P)_k \right) \right\} & \text{written with right-to-left precedence} \\ &= p_i - \min_{0\leq j \leq i} \left\{p_j - \max_{0 \leq k \leq j}OE_1(P)_k \right\} & \text{removing a negation} \\ MP_2(P) &= \max_{0 \leq i \leq n} \left\{ OE_2(P)_i \right\} \end{aligned} $$ Tidying up our previous q solution by wrapping in a function definition, we getq)oe1:{[pxs] pxs-min pxs} q)oe2:{[pxs] pxs - mins pxs - maxs oe1[pxs]} q)mp2:{[pxs] max oe2[pxs]}
Notice again there are no indices and no braces, save for the optional square brackets for invoking oe1. (Exercise: rewrite the implementation to look like the fourth line. Is it more readable? Are there any tradeoffs performance-wise?).
If we replace all instances of \(1\) by \(m\) and all instances of 2 by \(m + 1\), then we get a recurrence relation descriibing the maximum profit for \(m + 1\) buy/sell pairs. (Exercise: write out the recurrnce "in plain English" as above).
Let \(MP_{m + 1}(P)\) be the maximium profit realizable with up to \(m + 1\) trades and \(OE_{m + 1}(P)\) the vector of maximum profits for \(m + 1\) trades indexed by last sell time. Then
$$ \begin{aligned} OE_0(P)_i &= 0 \\ OE_{m+1}(P)_i &= \max_{0 \leq i_{0} \leq i_{1} \leq \ldots \leq \ldots \leq i_{2m + 1} \leq i} \left\{ p_i - p_{i_{2m+1}} + p_{i_{2m}} - \cdots + p_{i_1} - p_{i_0} \right\} \\ &= p_i + \max_{0 \leq i_{0} \leq i_{1} \leq \ldots \leq \ldots \leq i_{2m + 1} \leq i} \left\{ - p_{i_{2m+1}} + p_{i_{2m}} - \cdots + p_{i_1} - p_{i_0} \right\} \\ &= p_i + \max_{0 \leq i_{2m + 1} \leq i} \left\{ - p_{i_{2m+1}} + \max_{0 \leq i_{0} \leq i_{1} \leq \ldots \leq \ldots \leq i_{2m + 1}} \left\{ p_{i_{2m}} - p_{i_{2m-1}} + \cdots + p_{i_1} - p_{i_0} \right\} \right\} \\ &= p_i + \max_{0\leq j \leq i} \left\{ - p_j + \max_{0 \leq k \leq j}OE_m(P)_k \right\} \\ &= p_i + \max_{0\leq j \leq i} \left\{ - \left(p_j - \max_{0 \leq k \leq j}OE_m(P)_k \right) \right\} & \text{written with right-to-left precedence} \\ &= p_i - \min_{0\leq j \leq i} \left\{p_j - \max_{0 \leq k \leq j}OE_m(P)_k \right\} & \text{removing a negation} \\ MP_{m+1}(P) &= \max_{0 \leq i \leq n} \left\{ OE_{m+1}(P)_i \right\} \\ \end{aligned} $$(Exercise: do a sanity check that the recurrence relation coincides with what we wrote for \(OE_1(P)_i\)).
The code is a straightforward translation of the recurrence relations:
q)oe:{[m;pxs] {[pxs;pftsk] pxs - mins pxs - maxs[pftsk]}[pxs]/[m;pxs-pxs]} q)mp:{[m;pxs] max oe[m;pxs]}
Notice how succinct the code is. Another interesting aspect of this implementation is that computing the \(k+1\)'th column -- each iteration of the accumulation -- only uses pxs and pftsk, which of size order \(n\), not \(nk\) like the traditional dynamic programming matrix. This already suggests an improvement over the space requirements of a typical C language dynamic programming algorthm such as that described in Steven Skiena's Programming Challenges. Note that we would effectively need to use the same amount of memory as a matrix if we also wanted to reconstruct the set of trades that maximize profit. As an exercise, write out a left-to-right description of what the q code does, analogous to the "plain English" descriptions above. (hint: to begin, notice the pxs-pxs is a vector of 0's. Also, read the description of the function over (/)).
Here are 3 C implementations in increasing order performance and complexity:
1)This implementation finds the best trade by naively recursing over previous subcases. The runtime is \(O(N^2K)\).
#include<stdio.h> #include<stdlib.h> #include<math.h> int main(int argc, char **argv) { int N = atoi(argv[1]); int K = atoi(argv[2]); float *pxs = calloc(N, sizeof(pxs[0])); for (int i = 0; i < N; ++i) { pxs[i] = (9000 + (int)(drand48() * 2001)) / 100.0f; } float *bts = calloc(N*(K+1), sizeof(pxs[0])); // best trades for (int k = 1; k < K + 1; ++k) { for (int n = 1; n < N; ++n) { float bt = bts[k*N + n - 1]; for (int nn = 0; nn < n; ++nn) { bt = fmax(bt, pxs[n] - pxs[nn] + bts[(k - 1)*N + nn]); } bts[k*N + n] = bt; } } printf("%f\n", bts[N*(K + 1) - 1]); }
2) If we observe that we can compute the best time to enter incrementally (as in the q solutions), we can improve the performance substantially, within striking distance of the q solution:
#include<stdio.h> #include<stdlib.h> #include<math.h> int main(int argc, char **argv) { int N = atoi(argv[1]); int K = atoi(argv[2]); float *pxs = calloc(N, sizeof(pxs[0])); for (int i = 0; i < N; ++i) { pxs[i] = (9000 + (int)(drand48() * 2001)) / 100.0f; } float *bts = calloc(N*(K+1), sizeof(pxs[0])); // best trades for (int k = 1; k < K + 1; ++k) { float be = -pxs[0]; // best entry into the market for (int n = 1; n < N; ++n) { bts[k*N + n] = fmax(bts[k*N + n - 1], pxs[n] + be); be = fmax(be, bts[(k - 1)*N + n] - pxs[n]); } } printf("%f\n", bts[N*(K + 1) - 1]); }
3) Finally, if we replace the matrix of best columns with 2 columns (for the previous and current best trades), we can improve the performance still further:
#include<stdio.h> #include<stdlib.h> #include<math.h> int main(int argc, char **argv) { int N = atoi(argv[1]); int K = atoi(argv[2]); float *pxs = calloc(N, sizeof(pxs[0])); for (int i = 0; i < N; ++i) { pxs[i] = (9000 + (int)(drand48() * 2001)) / 100.0f; } float *btsp = calloc(N, sizeof(btsp[0])); // best trades previous float *btsc = calloc(N, sizeof(btsc[0])); // best trades current for (int k = 0; k < K; ++k) { float be = -pxs[0]; // best entry into the market for (int n = 1; n < N; ++n) { btsc[n] = fmax(btsc[n - 1], pxs[n] + be); be = fmax(be, btsp[n] - pxs[n]); } float *tmp = btsp; btsp = btsc; btsc = tmp; // garbage data now } printf("%f\n", btsp[N - 1]); }
How much faster can you go?
In q, the execution of expressions is eager in right-to-left order. This implies that there are no more than 4 iterations through vectors of length \(n\) for each iteration of the accumulation. So, the complexity is bounded by \(O(nk)\).
I am running these tests using the 64bit version of q. The 32 bit version was substantially slower -- perhaps compiler flags contributed?
Here are timings on my machine (in millis) as \(k\) increases:
q)n:10000000 / init number of trade price ticks q)pxs:90.0+(n?2001)%100 / init trades with uniform distribution [90.0,110.0] q)\t oe[1;pxs] 234 q)\t oe[2;pxs] 315 q)\t oe[4;pxs] 582 q)\t oe[8;pxs] 1091 q)\t oe[16;pxs] 2156 q)\t oe[32;pxs] 4288 q)\t oe[64;pxs] 8502 q)\t oe[128;pxs] 17027
indicating the complexity is linear in \(k\).
Here are timings on machine for fixed \(k\) as \(n\) increases:
q)\t oe[64;90.0+(1000000?2001)%100] 907 q)\t oe[64;90.0+(2000000?2001)%100] 1727 q)\t oe[64;90.0+(4000000?2001)%100] 3370 q)\t oe[64;90.0+(8000000?2001)%100] 6726 q)\t oe[64;90.0+(16000000?2001)%100] 14175 q)\t oe[64;90.0+(32000000?2001)%100] 28720
The running time also increases more or less linearly in \(n\). As an aside, the last few test cases overflow the 32 bit version of q.
The first C implementation isn't in the right league (notice the missing 0):
$ gcc mp.c -o mp -lm -O3 -march=native -funroll-loops $ /usr/bin/time -f %E ./mp 100000 1 20.000000 0:12.72
Now comparing to the second C implementation, we get these timings:
$ gcc mp2.c -o mp -lm -O3 -march=native -funroll-loops $ /usr/bin/time -f %E ./mp 1000000 64 1280.000000 0:00.42 $ /usr/bin/time -f %E ./mp 2000000 64 1280.000000 0:00.82 $ /usr/bin/time -f %E ./mp 4000000 64 1280.000000 0:01.61 $ /usr/bin/time -f %E ./mp 8000000 64 1280.000000 0:03.24 $ /usr/bin/time -f %E ./mp 16000000 64 1280.000000 0:06.92 $ /usr/bin/time -f %E ./mp 32000000 64 1280.000000 0:14.41which is already 2x faster than the q implementation.
The final C implementation was a huge improvement:
$ gcc mp3.c -o mp -lm -O3 -march=native -funroll-loops $ /usr/bin/time -f %E ./mp 1000000 64 1280.000000 0:00.37 $ /usr/bin/time -f %E ./mp 2000000 64 1280.000000 0:00.71 $ /usr/bin/time -f %E ./mp 4000000 64 1280.000000 0:01.39 $ /usr/bin/time -f %E ./mp 8000000 64 1280.000000 0:02.78 $ /usr/bin/time -f %E ./mp 16000000 64 1280.000000 0:05.50 $ /usr/bin/time -f %E ./mp 32000000 64 1280.000000 0:11.01which is to say this C implementation is, on my machine, almost 3x faster than what I came up with in q.


Solo Piano pieces written all in the key of A minor. Inspired by the stories of some of the worlds greatest inventors.


Repeat
CAG MAP is a data driven political process. The goal is to help stakeholders understand, improve, and maintain the systems they care about.
In a pluralistic society there is no such thing as the indisputable public good. It's up to stakeholders to advocate for their interests. If interests are aligned things might work out, but if not your then road will be very difficult. Always seek to align interests.
Creating proposals that align interests requires critical thinking. Critical thinking requires being critical. CAG MAP can help you use a data driven process to write, analyze, and critique proposals. This isn't guaranteed to be great, but it is guaranteed to be better than just arguing. Good luck out there.


With this help file you can learn more about WebMail. Select from the topic list above for more information about each topic.
With this help file you can learn more about WebMail. Select from the topic list above for more information about each topic.


{% extends "_post.html" %}
{% hyde
title: "A Faster Feed Apart"
snip: "Rethinking A Feed Apart’s backend."
created: 2010-04-30 22:55:00
flattr: true
%}
{% block article %}
[An Event Apart][aea] is a conference for web developers and designers that
happens a few times a year in various cities. [A Feed Apart][afa] is a site
that aggregates tweets during each conference and displays them in a live
stream so attendees can follow them during the conference, and people not
attending can see what the attendees are talking about.
A Feed Apart was originally written by [Nick Sergeant][nick] and [Pete
Karl][pete] of [Lion Burger][lionburger] during one of the conferences. Since
then a lot of people have used it and love it.
The current A Feed Apart site is not without its problems. It was written in
a single night so it's not perfect. During the last conference it went down
several times and lost some tweets along the way.
I work at [Dumbwaiter Design][dwaiter] with Nick and one day he mentioned that
it would be cool if we rewrote A Feed Apart from the ground up. He's learned
a lot about how people use the site and what the big problems are, so we'd have
a better idea of what we need to accomplish.
Nick, myself and [Ali Ali][ali] have risen to the challenge and started
rewriting A Feed Apart. Ali is a designer and is taking care of the design of
the new site. Nick is handling all the frontend HTML, CSS and Javascript. My
job is the backend.
Ali posted a [blog entry][aliblog] about the design of the new version so
I figured I'd write about the backend to show how I'm trying to improve it. If
you have any advice I'd love to hear it -- the next An Event Apart conference
is about three weeks away so there's still time to add improvements.
[aea]: http://aneventapart.com/
[afa]: http://afeedapart.com/
[nick]: http://nicksergeant.com/
[pete]: http://pkarl.com/
[lionburger]: http://lionburger.com/
[dwaiter]: http://dwaiter.com/
[ali]: http://alialithinks.com/
[aliblog]: http://www.dcamm.com/blog/archives/765
[TOC]
How AFA is Used
---------------
You can't hope to improve on a site unless you know how people are going to use
it. AFA has been around for a while and Nick has learned a lot about what
people want to get out of it.
There are three main kinds of users of AFA:
* People attending the conference
* People that wish they were attending the conference
* The speakers/organizers of the conference
### People Attending the Conference
People that attend AEA are web developers and designers. They're up-to-date on
the latest technology and almost all of them use [Twitter][].
During the conference you'll see a sea of laptops in the audience. Attendees
will tweet about whatever is happening *right now*. There's a huge amount of
conversation that happens between attendees that AFA is trying to collect and
present.
A simple example is one that Nick mentioned to me: if a presenter mentions
a website during her presentation someone will tweet the URL so other people
can have a link to easily click on. Attendees will also tweet their agreement
or disagreement with what the presenter is saying *as they're speaking*.
The most important aspect of AFA for this group of people is the *real time
conversation*. If AFA doesn't show tweets until a minute after they've been
posted it's useless to these people.
Another important part of AFA for attendees is that it's a one-stop-shop for
the conversation behind AEA. Switching between windows/tabs/applications to
read and contribute is annoying.
### People That Wish They Were Attending the Conference
The next group of users is those that can't attend the conference for a variety
of reasons but are still interested in what's going on.
For this group the real time nature of AFA is unimportant. They're probably
not going to be following the conversation 24/7 so if a tweet takes a few
minutes to display it's not a big deal.
What these people *do* care about is the integrity of the stream. They don't
want to miss any part of the conversation. If AFA loses tweets they're better
off doing a simple search on Twitter because they'll get the whole story.
### Speakers and Organizers
The last main group of users is the speakers and organizers of AEA.
Any speaker worth their salt will want to know what people are said about their
presentation. Obviously they can't be reading AFA while they're presenting,
but afterword they'll certainly want to go back and see what people were saying
during their specific presentation.
Likewise, organizers want to know which presentations people liked and which
ones people didn't enjoy. This could easily influence who they choose to
invite to future conferences.
For this group the most important aspect of AFA is the organization of the
conversation into chunks, each of which applies to a single presentation. By
reading through each chunk of conversation they can get an idea of the general
response to each presentation.
[Twitter]: http://twitter.com/
Goals
-----
Once we identified the main users of AFA we were able to come up with the goals
for the new version of the site:
* **Stay sane while developing.** Ali, Nick and myself are rewriting the site
as a side project, so we don't want it to take *too* much of our time or cause
*too* much stress.
* **Provide the real time conversation.** The site needs to be fast and
responsive, so people at the conferences can use it to converse.
* **Don't miss anything.** People following along from home shouldn't feel
like they're missing anything. We want to provide a *complete* version of the
conversation happening behind the event.
* **Organize the conversation.** Presenters and speakers need a way to see
what people are saying about them. They want to know what people think about
each "chunk" of the event.
* **Grease the wheels of (physical) social interaction.** This is something
that AFA hasn't tried to address before, but that we'd like to work on with
this version. There are a lot of people at each conference and we'd like to
help them get together. Whether it's going out for dinner or meeting up at the
[Media Temple][mt] party we want to get people talking to each other. I won't
talk about this goal in this post because we're still figuring out the best way
to do it.
[mt]: http://mediatemple.net/
Staying Sane
------------
If the three of us tried to create the site with nothing more than a couple of
laptops and a few chats in person we'd go crazy. We use a few tools to help us
manage the development of the site.
To create **wireframes of the design** we're using a free account at [Hot
Gloo][hotgloo]. Hot Gloo is a great tool that lets us quickly sketch out ideas
and comment on them.
To share **design comps** we're using [Dropbox][]. It's simple to set up
a shared Dropbox folder and Nick and I can get real time updates when Ali makes
changes to the design.
To **work together on the code** Nick and I use [Mercurial][] repositories.
Mercurial lets us work on the same code bases simultaneously and we almost
never have to worry about merging. We use [Codebase][] for hosting and issue
tracking.
[hotgloo]: http://hotgloo.com/
[Dropbox]: http://dropbox.com/
[Mercurial]: http://hg-scm.org/
[Codebase]: http://codebasehq.com/
Being Real Time
---------------
The previous version of AFA wasn't *truly* real time. When you went to the
site your browser would ask AFA for the newest updates every 10 seconds.
There are two main problems with this approach. The first is that it's not
really *real time*. I've noticed this being an issue in my own experience.
When I watch any of the various "live streams" of [Apple][] press conferences
I'm usually at work where other people are also watching. We very rarely load
the pages of the streaming sites like Gizmodo at the exact same second, so our
browsers will be out of sync with each other. Nick might get an update that
I would have to wait 8 more seconds to see.
When I glance over at his screen and see an update that I don't have
I instinctively refresh the page to get it. This defeats the purpose of the
"live updating" code that the developers of these sites worked on. They may as
well have just made a static page and told me to refresh.
The second problem is that querying every 10 seconds can be taxing on the
site's database. We're doing this as a side project so we don't have unlimited
funding for a hefty database server. If 1,000 people are querying for updates
every 10 seconds that's 100 requests per second to the database. This means we
need to have some kind of in-memory cacheing if we want the site to feel snappy
on modest hardware.
We want the new AFA to be truly real time. To do this we need to use [long
polling][longpolling] by users' browsers to wait for updates and return them as
soon as they come in. We also need to retrieve the updates as fast as we
possibly can, and they need to be stored in memory to avoid hitting the
database constantly.
[Apple]: http://apple.com/
[longpolling]: http://en.wikipedia.org/wiki/Push_technology#Long_polling
### Retrieving Updates
The bulk of the conversation about AEA conferences comes from Twitter. Tweets
are the most important items that we need to display on the site, so we're
using Twitter's streaming API to pull them in.
Since we don't want to tie up an entire server to pull in tweets I've decided
to create a [Diesel][]-based application called **The Nozzletron** to parse the
streaming API. Diesel is a [Python][] framework that takes an elegant approach
to asynchronous communication with clients and servers.
Twitter's streaming API accepts HTTP requests and returns "chunked" responses,
each of which is a tweet. Unfortunately the Diesel's built-in HTTP client
doesn't handle chunked HTTP responses so I had to write some code to handle
them myself.
The Nozzletron will connect to Twitter's streaming API and wait for data to
come in. If there's no data to process it will relinquish the server's
processor so it can do other things. Processing a single tweet that comes in
doesn't take much time, so the server is free to do other things most of the
time.
I've also created another application called **The Flickrtron** to pull in
[Flickr][] photos. Unfortunately Flickr doesn't have a streaming API like
Twitter so I have to resort to polling Flickr's API every few minutes for new
photos. Flickr is much less of a real time medium than Twitter though, so
I don't think this is a very big problem.
I'm using a Python library called [Beej's Flickr API][flickrapi] to talk to
Flickr. It is horrible. It calls itself an "API" but is really just a thin
wrapper around calls to the Flickr API. The objects it returns for API calls
are Elementtree objects representing the XML of the response.
I wish I could do something like:
:::python
thumb_url = photo.thumbnail_url
Instead I have to use this monstrosity:
:::python
thumb_url = "http://farm%s.static.flickr.com/%s/%s_%s_s.jpg" % (
photo.get('farm'), photo.get('server'), photo.get('id'),
photo.get('secret'),
)
I wish there were a better Python Flickr API out there but there doesn't seem
to be one. If I've missed it please let me know!
[Diesel]: http://dieselweb.org/
[Python]: http://python.org/
[Flickr]: http://flickr.com/
[flickrapi]: http://stuvel.eu/projects/flickrapi
### Storing Updates
We need a fast way to store and retrieve updates so AFA can provide a real time
view of the conversation happening at AEA. With this in mind I've chosen
[Redis][] to store the updates of the currently-happening event.
Redis is an easy-to-set-up, disgustingly-fast, in-memory data store. It's
similar to [memcached][] but has more intelligent data structures that make my
life easier for this project.
As updates (tweets and flickr photos) are scraped by The Nozzletron and The
Flickrtron they're placed at the tail end of a Redis list. That means I can
quickly and easily get all the items since item `N` when a user's browser
requests them with a single `LRANGE {list-key} N -1` call.
I'm also keeping a few other pieces of information in Redis. For example,
there's a set of photo IDs held in the `{item-key}:flickrtron:grabbed_photos`
key that keeps track of all of the photos we've already seen.
This makes it easy to tell if we've already seen a photo (and therefore don't
need to query Flickr for more information) -- it's a simple `SISMEMBER
{item-key}:flickrtron:grabbed_photos {photo-id}` call.
I'm also using Redis to store statistics about the site like:
* How many tweets we've scraped.
* How many photos we've scraped.
* How many people are currently waiting for updates.
This kind of information will be extremely valuable in the future when we're
planning improvements to the site. Redis makes it fast and safe to update this
information using the `INCRBY` and `DECR` commands.
There's one more component to The Nozzletron and The Flickrton that I haven't
mentioned. Both use Redis' `PUBLISH` command to push new updates out to users'
browsers as they arrive. I'll talk more about that in the next section.
[Redis]: http://code.google.com/p/redis/
[memcached]: http://memcached.org/
### Sending Updates to Users
As I mentioned before we want to send updates to users *as soon as they're
received*. To do this I've created another Diesel-based application called
**Halley** to handle this [Comet][]-style communication.
Halley has a few components. The first uses Diesel's [Redis API][dieselredis]
to subscribe to a Redis channel like `live:{event-id}:items` and
[fire][dieselfire] off messages whenever something new comes in. As soon as
a new update comes in from The Nozzletron or The Flickrtron all of Halley's
clients will get it.
When I started working on AFA Diesel's Redis client didn't support the very new
`PUBLISH`/`SUBSCRIBE`/`UNSUBSCRIBE` commands. I implemented them, put my
changes on [BitBucket][], sent a pull request, and started talking to the
Diesel crew on IRC.
One of the maintainers pulled my patches and made them even better. Now
Diesel's Redis client has full `PUBLISH`/`SUBSCRIBE`/`UNSUBSCRIBE` support.
It's a great example of how open source projects can produce awesome results.
The other main component of Halley is an HTTP server that listens for
connections from browsers. The Javascript on the site will call Halley and say
"I need updates since number `X`", where `X` is the length of the Redis list of
updates at the last time it spoke to the server.
Halley uses Diesel's [HTTP Server][dieselhttp] to manage these requests.
If a client is asking for everything since `X` and `X` is a smaller number than
the current number of items it will return the updates that have happened since
then. This might happen if we return an update and then two more updates
happen before the browser gets around to sending another request.
If a client is asking for everything since `X` and `X` is equal to the current
number of items Halley will wait for a new message to be fired from the
[Loop][dieselloop] that's watching the Redis channel. While Halley waits she
relinquishes the processor to the server so other requests can be handled.
There's a bit of code to prevent DoS attacks that request every item in the
queue over and over again, of course.
[Comet]: http://en.wikipedia.org/wiki/Comet_(programming)
[dieselredis]: http://bitbucket.org/boomplex/diesel/src/tip/diesel/protocols/redis.py
[dieselfire]: http://bitbucket.org/boomplex/diesel/src/tip/diesel/core.py#cl-90
[BitBucket]: http://bitbucket.org/
[dieselhttp]: http://bitbucket.org/boomplex/diesel/src/tip/diesel/protocols/http.py#cl-156
[dieselloop]: http://bitbucket.org/boomplex/diesel/src/tip/diesel/core.py#cl-179
Organizing the Conversation
---------------------------
The live stream is an important component of AFA, but it's not the only one.
We also need to organize updates into logical chunks by event and presentation,
and provide archives of old events so people can see what happened.
The main AFA site is built with [Django][] and served with [Gunicorn][] and
[Nginx][]. It uses a [Postgresql][] database to store data that's not "live".
Because queries for live data are handled with Diesel and Redis we don't need
to send those request through the full Django/Postgresql stack. Django and
Postgresql are only involved when you load a fresh page, and they're *more*
than capable of handling the amount of traffic that AFA gets for those kind of
requests.
I've created an application called **The Strainer** to copy data from the live
stream to the Postgresql database. The Strainer looks at the list of live
items in Redis, parses those items into Django models and saves them to the
Postgresql database.
Using two different types of stores (Redis and Postgresql) means we can get the
best of both worlds for AFA:
* We can keep the live data that's accessed *constantly* in an in-memory Redis
datastore which makes it blazingly fast.
* We can keep the less-frequently-used data in an on-disk Postgresql database
which lets us to keep our memory usage low and hosting costs down.
Django's models and managers make it very easy to separate updates out into the
various sessions and presentations that happen at the conferences.
Sessions and presentations are much less in-demand than the live stream so we
can take advantage of Django's abstractions without worrying about the extra
memory/CPU usage we incur by doing so.
[Django]: http://djangoproject.com/
[Gunicorn]: http://gunicorn.org/
[Nginx]: http://nginx.org/
[Postgresql]: http://www.postgresql.org/
Staying Consistent
------------------
Another problem AFA has faced in the past is losing tweets. No code is perfect
(and mine *certainly* is not) so we need to anticipate that some of the
applications we're using will crash at some point.
I'm using [Supervisord][] to monitor the various processes of AFA on the
server. If a process crashes for some reason it will be restarted
automatically.
Supervisord also has a wonderful Python API, so I've created a simple Dashboard
view in the Django site that lets us stop/start/restart each individual process
with a simple web interface. The dashboard also shows us the current memory
usage of the server and some other statistics so we can monitor how things are
working through a web browser (instead of SSH'ing into the server, which is
a pain on a phone).
[Supervisord]: http://supervisord.org/
Getting Bigger
--------------
An Event Apart is a large event, but it's not a *huge* event. Despite this
I've been trying to build the backend in a way that can be easily scaled.
Right now it's hosted on a single server, but each of the individual components
could be moved to a separate server with less than an hour of work each:
* Redis
* Postgresql
* Django, Nginx and Gunicorn
* The Nozzletron
* The Flickrtron
* The Strainer
* Halley
Moving Django/Gunicorn, Nginx, Redis, Halley, and Postgresql to dedicated
servers would increase the performance of the site *immensely*. I can't
imagine an event that would provide enough traffic to require more than that.
Even if there were an event that needed that kind of throughput, we could
easily split the single Halley and Redis servers into multiple load-balanced
servers.
A Work in Progress
------------------
This new version of A Feed Apart is still being built. I'm learning new things
every time I work on it, and I'm sure there's still room for improvement.
If you have any questions, advice, or want me to go more in-depth about
a specific aspect of the site's backend please let me know!
{% endblock %}


--- layout: post title: "In the News: On 'Tech Regrets' on Marketplace" date: 2018-03-01 08:00:00 +0000 tags: image: https://s3.amazonaws.com/audreywatters/2017-11-03-news.jpg imagecredits: https://www.flickr.com/photos/62693815@N03/6277209256 ---
I was a guest on Marketplace last week for a quick chat with Molly Wood about what I’ve dubbed the “tech regrets industry.”
“Should We Trust Silicon Valley To Fix Itself?”
(Betteridge’s Law of Headlines – and history and common sense – tell us the answer is “no.”)


We do hundreds every day.
Best Case - We write for ourselves.
Worst Case - We pray that no one will read them.
Use a dedicated convention.
For example Semantic Commits
Follow a
guideline
Use a Tool
/
Memorize them
Squash
Squash
Squash
Don't add branches to master repository
Forks!!!
Gitlab has issues with forks and pipelines, see issue 23902
CI / CD world


eda blog
|
contact
index
Lauren's EDA Blog
reflections
|
time and habits
|
html-css-dom
|
html-css-dom pt2
|
emotional intelligence
|
...
I dont know what to put here.


Write fast code!
Solve the problems and get ranked by efficiency!
Add numbers (demo)
River Valley
Decompress!
Made with ❤ by
notjimmyb
Bugs/questions/Contribute


THE AVENGERS (1998)
Rating: 2 stars (out of 4.0) ******************************** Key to rating system: 2.0 stars - Debatable 2.5 stars - Some people may like it 3.0 stars - I liked it 3.5 stars - I am biased in favor of the movie 4.0 stars - I felt the movie's impact personally or it stood out *********************************
Directed by: Jeremiah S. Chechik
Written by: Don MacPherson, from the Sydney Newman television series
Starring: Uma Thurman, Ralph Fiennes
Synopsis: The plot revolves around a failed weather project called Prospero, which Mrs. Peel (Uma Thurman) once worked on.
Sir August de Wynter (Sean Connery) is their main adversary. Sir August has a weather machine which can control the weather of any part of the world, and he wants countries to pay him tribute so that he won't attack local weather. Sir August also has a serious Mrs. Peel obsession; he keeps her painted picture up in his room. An island fortress serves as de Wynter's base of operations.
Will Steed and Peel storm the island fortress and defeat de Wynter?
Background: The original 1960s serial THE AVENGERS featured Patrick MacNee and Diana Rigg as a crime-solving duo. MacNee was John Steed, a dapper veddy British chap, and Rigg was Emma Peel, a young, pretty, insatiably curious, mystery-loving platonic widow friend of Steed's. Together they drove an open-buggy car around the English countryside with a kind of devil-may-care confidence - - cheerfully drinking tea and solving cozy mysteries.
The 1998 version of THE AVENGERS attempts to update these two characters for the 90s, giving us Ralph Fiennes as Steed and Uma Thurman as Emma Peel.
Opinion: If you're anticipating a sophomoric film, here's a hint: the bad guys are dressed as stuffed animals, and wear big teddy bear costumes. The dialogue seems very forced, and you can find better British accents in THE PARENT TRAP.
Actually the problem with THE AVENGERS is predictability. Right in the beginning, Steed and Peel visit de Wynter's palacial estate to solicit his expertise on weather. They find that de Wynter's mansion grounds are filled with dangerous weather anomalies, and Steed gets attacked.
So we know de Wynter is the bad guy. Instead of busting the guy, Steed and Peel go chasing around, belaboring obvious clues which, of course, point straight back to de Wynter by the movie's end. "Why didn't you tell me about de Wynter?" says Steed to his informant (Patrick MacNee). To which Jones replies, "You didn't ask."
Roll the final battle scene.
Reviewed August 15, 1998
Copyright © 1998 by David Sunga This review and others like it can be found at THE CRITIC ZOO: http://www.criticzoo.com email<EMAIL_ADDRESS>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


On a sheet of paper, the players each write a 4-digit secret number. The digits must be all different. Then, in turn, the players try to guess their opponent's number who gives the number of matches.
- The matching digits are in their right positions, they are "bulls".
- The matching digits are in different positions, they are "cows".
Game
| 1 | ||
|---|---|---|
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| GAME OVER |


Quick Links: Talk recordings · Conference program · Speaker list · Code of conduct
!!Con (pronounced bang bang con) 2014 was two days of ten-minute talks (with lots of breaks, of course!) about what excites us about programming — the amazing, the strange, and the heartwarming. From kernel exploits to teaching kids to program, !!Con was about bringing the NYC programming community together to celebrate the joy and excitement and the surprising moments in what we do. We defined "programming community" broadly — you didn't need to be a professional programmer to be part of !!Con.
Who spoke?
Check out our speaker lineup, including our amazing keynote speakers, Michael Bernstein and Camille Fournier!
Our call for proposals closed on March 31, 2014. Thanks so much for all of your wonderful talk proposals!
Where and when?
The conference was held at Hacker School, at 455 Broadway in Manhattan, on Saturday, May 17 and Sunday, May 18, 2014. On both days, the fun began at 9:45 AM; we provided breakfast, lunch, and snacks on both days; and talks ended at around 5:30 PM. Throughout each day, we had breaks for relaxation, refreshment, and unconferencing. See the program for details!
!!Con was free to attend, but space was limited, and you must have registered in order to attend.
Registration is now closed. Thanks so much for your interest in !!Con!
Who sponsored?
!!Con wouldn't have been possible without the support of our fabulous sponsors!!
How do I get updates?
To find out about future !!Con events, follow @bangbangcon on Twitter, or sign up for our mailing list below! No spam, we promise!
Who organized all this?
Listed in decreasing order of hair length: Lindsey Kuper, Alex Clemmer, Julia Evans, Erty Seidel, Maggie Zhou, and Leo Franchi.
Code of Conduct
We had a code of conduct that all !!Con participants were required to observe.


NFS runs default on port 2049
If the service is on its default port you can run this command to see what the filesystem is sharing
showmount -e <IP_ADDRESS>
Then you can mount the filesystem to your machine using the following command
mount <IP_ADDRESS>:/ /tmp/NFS
mount -t <IP_ADDRESS>:/ /tmp/NFS
Now we can go to /tmp/NFS and check out /etc/passwd, and add and remove files.
This can be used to escalate privileges if it is not correct configured.


{% extends "project.html" %} {% block innercontent %}
{{ error }}
{% endfor %} {% else %}When {{ project.name }} is deployed, the deploy script pulls down the new PO files, lints them and for PO files that have no errors, it compiles them to MO files and those strings get updated.
For PO files that do have errors, it does not compile those PO files to MO files and strings do not get updated.
The PO linting errors are listed here as are possibly related bugs that already exist and links to create bugs if there aren't any.


k3d cluster create cluster_name- Delete a cluster:
k3d cluster delete cluster_name- Create a new containerized k3s node:
k3d node create node_name- Import an image from Docker into a k3d cluster:
k3d image import image_name --cluster cluster_name- Create a new registry:
k3d registry create registry_name


|
Left and right margin size:
Incease this to minimize left-right eye motion
Text color:
Hypnosis text:
Before you start:
Hypnosis text will appear here after you click "start".
|


|
code.google.com home | ||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
HtmlSanitizer
configurable via a flexible
HtmlPolicyBuilder
.
See:
Description
| Interface Summary | |
|---|---|
| AttributePolicy | A policy that can be applied to an HTML attribute to decide whether or not to allow it in the output, possibly after transforming its value. |
| ElementPolicy | A policy that can be applied to an element to decide whether or not to allow it in the output, possibly after transforming attributes. |
| Handler<T> | Receives notification of problems. |
| HtmlChangeListener<T> | Receives events when an HTML tag, or attribute is discarded. |
| HtmlSanitizer.Policy | Receives events based on the HTML stream, and applies a policy to decide what HTML constructs to allow. |
| HtmlStreamEventReceiver | A light-weight SAX-like listener for HTML. |
| Class Summary | |
|---|---|
| AttributePolicy.Util | Utilities for working with attribute policies. |
| CssSchema | Describes the kinds of tokens a CSS property's value can safely contain. |
| ElementPolicy.Util | Utilities for working with element policies. |
| FilterUrlByProtocolAttributePolicy | An attribute policy for attributes whose values are URLs that requires that the value have no protocol or have an allowed protocol. |
| HtmlChangeReporter<T> | Sits between the HTML parser, and then policy, and the renderer so that it
can report dropped elements and attributes to an HtmlChangeListener . |
| HtmlPolicyBuilder | Conveniences for configuring policies for the HtmlSanitizer . |
| HtmlSanitizer | Consumes an HTML stream, and dispatches events to a policy object which decides which elements and attributes to allow. |
| HtmlStreamRenderer | Given a series of HTML tokens, writes valid, normalized HTML to the output. |
| PolicyFactory | A factory that can be used to link a sanitizer to an output receiver and that
provides a convenient
method and a method to compose
policies. |
| Sanitizers | Pre-packaged HTML sanitizer policies. |
| TagBalancingHtmlStreamEventReceiver | Wraps an HTML stream event receiver to fill in missing close tags. |
| Enum Summary | |
|---|---|
| HtmlTextEscapingMode | From section <IP_ADDRESS> of http://www.whatwg.org/specs/web-apps/current-work/ |
| Annotation Types Summary | |
|---|---|
| TCB | Indicates that a program element is in the trusted computing base -- there exists a security property that could be violated if this code is not correct. |
An efficient HtmlSanitizer
configurable via a flexible
HtmlPolicyBuilder
.
|
code.google.com home | ||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |


Learn your basic concepts to prepare for a career in
Medical fields
Make strong concepts in Organic Chemistry with great tutors...
Make your strong concepts in Inorganic Chemistry...
Make your strong concepts in Physical Chemistry...
Do you think Physics is hard? It's not join this lectures...
Make Biology interesting with our great tutors...
Practice more and more question papers


Definition
Iron Condor is an option strategy which involves four option contracts.All options have the same expiration date. The order of strike for four contracts is A > B > C > D.
| Position |
Strike |
| long 1 OTM put |
A |
| short 1 OTM put |
B |
| short 1 OTM call |
C |
| long 1 OTM call |
D |
The Iron Condor is the combination of a bear put spread and a bull call spread in which the strike price of the long put is lower than the strike price of the long call. If the stock price is between the two short strike prices when the options expire, the strategy will be profitable.
Payoff
price = np.arange(700,950,1)
k_call_higher = 850 # the strike price of OTM call(Higher k)
k_call_lower = 840 # the strike price of OTM call(Lower k)
k_put_higher = 760 # the strike price of OTM put(Higher k)
k_put_lower = 750 # the strike price of OTM put(Lower k)
premium_call_higher = 1 # the premium of OTM call(Higher k)
premium_call_lower = 10 # the premium of OTM call(Lower k)
premium_put_higher = 11 # the premium of oTM put(Higher k)
premium_put_lower = 1 # the premium of OTM put(Lower k)
# payoff for the long put position
payoff_long_put = [max(premium_put_lower, k_put_lower-i-premium_put_lower) for i in price]
# payoff for the short put position
payoff_short_put = [min(premium_put_higher, -(k_put_higher-i+premium_put_higher)) for i in price]
# payoff for the short call position
payoff_short_call = [min(premium_call_lower, -(i-k_call_lower+premium_call_lower)) for i in price]
# payoff for the long call position
payoff_long_call = [max(premium_call_higher, i-k_call_higher-premium_call_higher) for i in price]
# payoff for Long Iron Condor Strategy
payoff = np.sum([payoff_long_put,payoff_short_put,payoff_short_call,payoff_long_call], axis=0)
plt.figure(figsize=(20,15))
plt.plot(price, payoff_long_put, label = 'Long Put',linestyle='--')
plt.plot(price, payoff_short_put, label = 'Short Put',linestyle='--')
plt.plot(price, payoff_short_call, label = 'Short Call',linestyle='--')
plt.plot(price, payoff_long_call, label = 'Long Call',linestyle='--')
plt.plot(price, payoff, label = 'Long Iron Condor',c='black')
plt.legend(fontsize = 20)
plt.xlabel('Stock Price at Expiry',fontsize = 15)
plt.ylabel('payoff',fontsize = 15)
plt.title('Long Iron Condor Strategy Payoff',fontsize = 20)
plt.grid(True)
Here the strike price is A(750), B(760), C(850) and D(860). From the payoff plot, the maximum profit all come from the options premium because the deeper OTM options are cheaper than the less deep ones. It is reached when the stock price is between higher put strike and lower call strike. They are two short positions. In this condition, all the options expire worthless. The maximum loss of Iron Condor is reached when the stock price is lower than the lowest strike A, then the two call options become worthless, the two puts are in the money. For the other condition, the stock price is higher than the highest strike D.Consequently, The two call options are in the money but the two puts expire worthless.
Implementation
Step 1: Initialize your algorithm which involves setting the start date and the end date, setting the cash for your algorithm and implement the coarse selection of option contracts.
def Initialize(self):
self.SetStartDate(2017, 02, 01)
self.SetEndDate(2017, 03, 31)
self.SetCash(150000)
equity = self.AddEquity("GOOG", Resolution.Minute)
option = self.AddOption("GOOG", Resolution.Minute)
self.symbol = option.Symbol
option.SetFilter(-20, 20, timedelta(0), timedelta(40))
# use the underlying equity GOOG as the benchmark
self.SetBenchmark(equity.Symbol)
Step 2: Break the candidate options into two parts: call and put options.
for i in optionchain:
if i.Key != self.symbol: continue
chain = i.Value
# filter the call and put options on the contracts
call = [i for i in chain if i.Right == 0]
put = [i for i in chain if i.Right == 1]
Step 3: Sort the call and put options by their strike price respectively.
call_contracts = sorted(call,key = lambda x: x.Strike)
put_contracts = sorted(put,key = lambda x: x.Strike)
Step 4: Choose the corresponding options and trade them. In this algorithm, according to criteria,SetFilter(-20, 20, timedelta(0), timedelta(40))
for put option list, there are 41 contracts in total: 1 ATM put, 20 OTM puts and 20 ITM puts. we choose the first in the put option list as the OTM put with the lower strike, choose the 15 contract as the OTM put with the higher strike.
if len(call_contracts) == 0 or len(put_contracts) == 0 : continue
# Buy 1 OTM Put (Lower Strike)
self.otm_put_lower = put_contracts[0]
self.Buy(self.otm_put_lower.Symbol ,1)
# Sell 1 OTM Put
self.otm_put = put_contracts[15]
self.Sell(self.otm_put.Symbol ,1)
# Sell 1 OTM Call
self.otm_call = call_contracts[-15]
self.Sell(self.otm_call.Symbol ,1)
# Buy 1 OTM Call (Higher Strike)
self.otm_call_higher = call_contracts[-1]
self.Buy(self.otm_call_higher.Symbol ,1)
Summary
The iron condor is an option strategy that earns money as long as the underlying asset price does move out of a predetermined price range. In this algorithm, that range is $775 to $827.5. At 02/01/2017, we long $750 put at $1.25 and short $775 put at $3.5. At the same time, we short $827.5 call at$2.3 and long $850 call at $0.75. At this moment, the GOOG share price is $799.55 all the options are out the money. At expiration date 02/17/2017, the share price of GOOG is $828.07. The long put, short put and long call expire worthless. The short call is exercised. Thus we get the short position of 100 GOOG shares.
Algorithm