ResultType
- The type of the object to retrieve from this request. If the type
is a List
, you may want to consider using
ListRequest
instead.SOAPFaultType
- The type of the fault object that will be parsed from the
response, should an HTTP Error 500 be encountered.public interface Request<ResultType,SOAPFaultType>
SOAP11Observer
class (generally this is
easiest using anonymous objects from the activity or fragment) and attach it
using the Request#registerObserver(SOAP11Observer)
method. Then
invoke execute()
- the request will be performed on a
background thread, and methods of the SOAP11Observer
will be called
on the UI thread.| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels the request - akin to cancelling an
AsyncTask . |
void |
deregisterObserver(SOAPObserver<ResultType,SOAPFaultType> observer)
Remove an observer.
|
void |
execute()
Executes the request.
|
void |
execute(SOAPObserver<ResultType,SOAPFaultType> observer)
Registers the provided observer then executes the request - this is
equivalent to calling
#registerObserver(SOAP11Observer) , then
execute() . |
ResultType |
executeBlocking()
Executes the request on the same thread it's called on.
|
Throwable |
getException()
Retrieves an exception if one has been encountered.
|
String |
getRequestXML()
Gets the request XML as a string, if debug mode has been activated with
setDebugMode(boolean) . |
String |
getResponseXML()
Gets the response XML as a string, if debug mode has been activated with
setDebugMode(boolean) |
ResultType |
getResult()
Gets the result of the request - if the request is still running, gets
the result so far.
|
SOAPFaultType |
getSOAPFault()
Gets the SOAP Fault that has been encountered, if one has been
encountered.
|
boolean |
isComplete()
Reveals whether the request is complete yet.
|
boolean |
isExecuting()
Whether the request is currently executing - if it's not executing, it
might be stopped or it might not have started yet.
|
void |
registerObserver(SOAPObserver<ResultType,SOAPFaultType> observer)
Adds an observer to the request - the observer's methods will be called
on certain events.
|
void |
setDebugMode(boolean activated)
Activates debug mode for this request - debug mode results in the request
storing the request and response as a String
|
void execute()
void execute(SOAPObserver<ResultType,SOAPFaultType> observer)
#registerObserver(SOAP11Observer)
, then
execute()
.observer
- An observer to registerResultType executeBlocking() throws SOAPException
SOAPObserver
s being called.
Note: Only use this method when you're already on a background thread e.g. in a service. Using this from the main U.I. thread will at best lock the screen for a while, and in newer versions of Android will result in exceptions being thrown.
SOAPException
- If an exception is thrown while executing.void registerObserver(SOAPObserver<ResultType,SOAPFaultType> observer)
observer
- The observer to add.void deregisterObserver(SOAPObserver<ResultType,SOAPFaultType> observer)
observer
- The observer to remove.void cancel()
AsyncTask
.ResultType getResult()
boolean isExecuting()
boolean isComplete()
Throwable getException()
SOAPFaultType getSOAPFault()
void setDebugMode(boolean activated)
activated
- Whether debug mode is activated.String getRequestXML()
setDebugMode(boolean)
.String getResponseXML()
setDebugMode(boolean)
Copyright © 2016. All rights reserved.


I'm a Boston-based software engineer.
If you'd like to know more about me,
what I do, and what I enjoy, have a look at my detailed About page on the top navbar. If you're
interested in reading my thoughts on various topics (usually technology related), check out my blog,
also linked up top.
Otherwise, I've also included a few
places you can find me just below.


Objects
Summary
This week we will review javascript objects.
Examples
Creating an object and setting its properties, option 1
// double curly brackets is shorthand for an object
let car = {} // This method creates a new object extending the prototype object passed as a parameter.
car.type = BMW
car.color = 'green'
car.speed = 50
Creating an object and setting its properties, option 2
// same as option one
let car = {
type: BMW,
color: 'green',
speed: 50
}
// or
let car = {type:'BMW',color:'green',speed:50}
Returning values from an object
// same as option one
console.log(car.type) // prints 'BMW' to console
console.log(car['type']) // also, prints 'BMW' to console
Returning values from an object
References
- Different way to create Objects
- Working with Objects
- Coding Train, JavaScript Objects - p5.js Tutorial
- Review: Coding Train, Function Basics - p5.js Tutorial
- Advanced: Prototypes in JavaScript - FunFunFunction #16
Deliverables
- Daily Practice: Continue to develop P1 using Objects
- Use the "p5 template" file as a starting point
- Only spend 20 - 40 minutes per sketch
- Focus on creating simple programs
- Explore elements of your P1 project
- If you get stuck ask for help
- Draw out what you want your program to do, using flow charts before writing a single line of code
- Remember the midterm is due in two weeks!


Basic
$ 0 / year
The Number Of Songs Is Limited
Slower Connections
Worse Page Layout
Continue
Pro
$ 24.99 / year
More Songs
No Page Loading
Modern Page Layout
Subscribe
Premium
$ 49.99 / year
All Songs On Streamify
Monthly Benefits
No Page Loading
Subscribe


Home
South Dakota :: Locate The Law
Constitution
Constitution
(South Dakota Legislative Research Council)
Executive
Administrative Rules of South Dakota
(South Dakota Legislative Research Council)
Register
(South Dakota Legislative Research Council)
Vol. 24 (January 5, 1998-
South Dakota Governor
South Dakota Attorney General
South Dakota Elections and Voter Registration Overview
South Dakota Secretary of State
Judicial
South Dakota Supreme Court Opinions: South Dakota Unified Judicial System
1996-
U.S. Court of Appeals, 8th Circuit
November 1995-
FindLaw
(November 1995-
U.S. District Court, District of South Dakota
South Dakota Unified Judicial System
Legislative
South Dakota Codified Laws
South Dakota Codified Laws
(Michie)
South Dakota Session Laws
1997-
South Dakota Bills
South Dakota Legislature
- composed of the Senate and House of Representatives
Legislative Research Council
- includes
How to Compile and Legislative History
and
How to Use the Legislative Research Council Web Site


Version 1.0
The Spicy Village Design System will be used to bring together all of the different customer facing facets and make a cohesive user experience whether it be online or in person. It will be guidance for all teams to generate, maintain, and update content for customers that is consistent and clear.
The ultimate goal is to create spaces where the customer feels comfortable, excited, and enticed to eat at Spicy Village. By using this design system throughout all teams, the customer will be able to focus on the delicious food at Spicy Village rather than the struggle of attempting to order online.
TYPOGRAPHY
Here is the body text that will be used for menus, about sections, directions to the restaurant, and more.
Spicy Village offers delicious dining and takeout to New York, NY. Spicy Village is a cornerstone in the New York community and has be recognized for its outstanding Chinese cuisine, excellent service, and friendly staff. Our Chinese restaurant is known for its modern version of classic dishes and its insistence on only using high quality fresh ingredients.
COLORS
VISUAL DESIGN LANGUAGE EXAMPLES
Spicy Village is located on the lower east side of Manhattan and offers delicious dining and takeout to New York, NY. Spicy Village is a cornerstone in the New York community and has be recognized for its outstanding Chinese cuisine, excellent service, and friendly staff.
COMPONENT EXAMPLES


Enhanced state based routing for Angular applications!
Hierarchical State Machine for managing application state.
With the web in mind states may be bound to routes and transitions between all states are by default allowed.
Take full control over transitions between states by leveraging simple transition handlers.
While simple, handlers allow to reject, modify, redirect and block transition between to states.
A dead simple view model ensures that it is easy to take control over many parallel or nested views.
While at the same time providing a rich set of more advanced features.


class: center, middle # Deep learning with Keras Tutorial on using Keras
by Luca Lonini --- ## Overview Plain slide for now


{% if today %} {% with today|first as entry%} On this day in {{entry.start.year}}
{{entry}}
{% endwith %} {% elif this_month %} {% with this_month|first as entry%} This Month in {{entry.start.year}}{{this_month|first}}
{% endwith %} {% elif past_decades %} {% for years, entry in past_decades.items %} From {{years}} years ago{{entry|first}}
{% endfor %} {% elif weekdays %} {% with weekdays|first as entry%} Past gig on a {{entry.start|date:"l"}}{{entry}}
{% endwith %} {% endif %}


{% extends "base.html" %} {% block js %} {% end %} {% block css %} {% end %} {% block main %}
(If you are looking to become a mentor, you don't need to fill this out. Find us in #lpmc on Freenode instead.)
#lpmc
{{ q }} {{ a }}


When cruising the east coast or the southern North sea, Ramsgate provides a very useful stopover. That said, short-term berthing here is not particularly comfortable and you probably will find you won't want to stay more than a night or two.
Approaches
Before entering (or leaving) the harbour, call "Ramsgate Port Control" on VHF channel 14. Once inside the harbour call the marina on VHF channel 80 for berthing instructions. During the summer period the marina staff will allocate a suitable berth for you. During the winter period you will be instructed to take any vacant berth, unless they are marked ‘Reserved’.
Berthing
There are three sections to the harbour: the Outer Harbour, the Inner Harbour, and the Yacht Harbour.
The Outer Harbour is the former ferry terminal, but is not used very often for anything except maneuvering in and out of the Marina.
The Marina takes up the Inner Harbour and the Yacht Harbour. The Marina is split up into two sections: the Inner Harbour (which is split into East and West sections) and the Yacht Harbour.
The Inner Harbour (the East and West sections) is accessible at all tides, however it is quite rolly and skippers should be careful to tie up properly to avoid damage against the docks. The Inner Marina docks are constructed of small segments and cause an uncomfortable jerking motion on longer (>12m) yachts if there is any swell, wake, or tide shift coming in the entrance.
The West Marina (left after entering Inner Harbour) is where the visiting yachts are usually directed, but any yacht longer than 12m will be on a hammerhead or the breakwater; the East Marina is very full of pilot boats, fishing boats, and work boats for the nearby Kent wind generator farm that is under construction. These working boats are in motion at all hours and often throw a wake into the West Marina.
The extremely well-protected Inner Yacht Marina is accessed by a lock, however is only available for permanent berth holders.
Note:
No animals are allowed anywhere in Ramsgate Harbour, including the marinas.
Last updated January 2015.


Woman Home Guard attempts self-immolation
by Special CorrespondentTHANJAVUR
Tension prevailed for some time at the Thanjavur District Police Headquarters here on Friday as a woman serving as a Home Guard allegedly attempted to commit self-immolation.
According to the police, Nirosha of Vandikara Street at Gorikulam here came to the DPO around noon along with her two sons. She suddenly pulled out a can containing inflammable liquid from the bag she was carrying with her and poured it on herself and on her two sons.
On seeing her action, police personnel on duty rushed and thwarted her attempt. Nirosha and her sons were escorted to a safe place and on interrogation she claimed that her complaint about cheating by a neighbour forwarded to the Thanjavur taluk police from the DPO earlier had not been pursued by the taluk police. She was let off with a warning, police said.
Those who require assistance for overcoming suicidal thoughts may contact State’s health helpline 104 or Sneha’s suicide prevention helpline<PHONE_NUMBER>0.


Event
Enter event details to start event monitoring process
Description
Event Date/Time
Priority
-- Please select one --
Save
Cancel


E-Compass is a start-up company that aims into making shopping for customers easier by having mobile friendly sites for specials.
Get Started!Ready to start your next project with us? That's great! Give us a call or send us an email and we will get back to you as soon as possible!
062 654 6902


In 1898, A psychologist named Edward Thorndike conducted an experiment
that would lay the foundation for our understanding of how habits form and the rules that guide our behavior.
Thorndike was interested in studying the behavior of animals, and he started by working with cats.
He would place each cat inside a device known as a puzzle box.
The box was designed so that the cat could escape through a door “by some simple act,
such as pulling at a loop of cord, pressing a lever, or stepping on a platform.”
For example, one box contained a lever that, when pressed,
would open a door on the side of the box.
Once the door had been opened, the cat could dart out and run over to a bowl of food.
Most cats wanted to escape as soon as they were placed inside the box.
They would poke their nose into the corners, stick their paws through openings, and claw at loose objects.
After a few minutes of exploration, the cats would happen to press the magical lever,
the door would open, and they would escape.
Thorndike tracked the behavior of each cat across many trials.
In the beginning, the animals moved around the box at random.
But as soon as the lever had been pressed and the door opened, the process of learning began.
Gradually, each cat learned to associate the action of pressing the lever with
the reward of escaping the box and getting to the food.
After twenty to thirty trials,
this behavior became so automatic and habitual that the cat could escape within a few seconds.
For example, Thorndike noted, “Cat 12 took the following times to perform the act.
160 seconds, 30 seconds, 90 seconds, 60, 15, 28, 20, 30, 22, 11, 15, 20, 12, 10, 14, 10, 8, 8, 5, 10, 8, 6, 6, 7.”
During the first three trials, the cat escaped in an average of 1.5 minutes.
During the last three trials, it escaped in an average of 6.3 seconds.
With practice, each cat made fewer errors and their actions became quicker and more automatic.
Rather than repeat the same mistakes, the cat began to cut straight to the solution.
From his studies, Thorndike described the learning process by stating,
“behaviors followed by satisfying consequences tend to be repeated and
those that produce unpleasant consequences are less likely to be repeated.”
His work provides the perfect starting point for discussing how habits form in our own lives.
It also provides answers to some fundamental questions like: What are habits?
And why does the brain bother building them at all?

The process of habit formation begins with trial and error.

How do I respond to this?
The first time you come across a problem, you're not sure how to solve it.
Like Thorndike's cat, you're just trying things out to see what works.
Neurological activity in the brain is high during this period.
You are carefully analyzing the situation and making conscious decisions about how to act.
You're taking in tons of new information and trying to make sense of it all.
The brain is busy learning the most effective course of action.

You're feeling anxious, and you discover that going for a run calms you down.

You're exploring, exploring, exploring, and then—BAM—a reward.
After you stumble upon an unexpected reward, you alter your strategy for next time.

Wait a minute—that felt good.
What did I do right before that?
This is the feedback loop behind all human behavior: try, fail, learn, try differently.
With practice, the useless movements fade away and the useful actions get reinforced.
That's a habit forming.
Whenever you face a problem repeatedly, your brain begins to automate the process of solving it.

As behavioral scientist Jason Hreha writes,
“Habits are, simply, reliable solutions to recurring problems in our environment.”
As habits are created, the level of activity in the brain decreases.
You learn to lock in on the cues that predict success and tune out everything else.
When a similar situation arises in the future, you know exactly what to look for.
There is no longer a need to analyze every angle of a situation.
Your brain skips the process of trial and error and creates a mental rule: if this, then that.
These cognitive scripts can be followed automatically whenever the situation is appropriate.
Now, whenever you feel stressed, you get the itch to run.
As soon as you walk in the door from work, you grab the video game controller.
A choice that once required effort is now automatic. A habit has been created.
Habits are mental shortcuts learned from experience.
In a sense, a habit is just a memory of the steps you previously followed to solve a problem in the past.
Whenever the conditions are right, you can draw on this memory and automatically apply the same solution.
The primary reason the brain remembers the past is to better predict what will work in the future.
笔记：记忆过去，是为了更好的预测示来。
Habit formation is incredibly useful because the conscious mind is the bottleneck of the brain.
It can only pay attention to one problem at a time.
As a result, your brain is always working to preserve your conscious attention for whatever task is most essential.
Whenever possible, the conscious mind likes to pawn off tasks to the non-conscious mind to do automatically.
This is precisely what happens when a habit is formed.

Despite their efficiency, some people still wonder about the benefits of habits.
The argument goes like this: “Will habits make my life dull?
I don't want to pigeonhole myself into a lifestyle I don't enjoy.
Doesn't so much routine take away the vibrancy and spontaneity of life?”
Hardly.
Such questions set up a false dichotomy.
They make you think that you have to choose between building habits and attaining freedom.
In reality, the two complement each other.
Habits do not restrict freedom. They create it.
In fact, the people who don't have their habits handled are often the ones with the least amount of freedom.
Without good financial habits, you will always be struggling for the next dollar.
Without good health habits, you will always seem to be short on energy.
Without good learning habits, you will always feel like you're behind the curve.
If you're always being forced to make decisions about simple tasks—
when should I work out,
where do I go to write,
when do I pay the bills—
then you have less time for freedom.
It's only by making the fundamentals of life easier that
you can create the mental space needed for free thinking and creativity.
Conversely, when you have your habits dialed in and the basics of life are handled and done,
your mind is free to focus on new challenges and master the next set of problems.
Building habits in the present allows you to do more of what you want in the future.
THE SCIENCE OF HOW HABITS WORK
The process of building a habit can be divided into four simple steps:
cue, craving, response, and reward.
Breaking it down into these fundamental parts can help us understand
what a habit is,
how it works, and
how to improve it.
This four-step pattern is the backbone of every habit,
and your brain runs through these steps in the same order each time.
First, there is the cue.
The cue triggers your brain to initiate a behavior.
It is a bit of information that predicts a reward.
Our prehistoric ancestors were paying attention to cues that signaled the location of primary rewards like food, water, and sex.
Today, we spend most of our time learning cues that predict secondary rewards like
money and fame, power and status, praise and approval, love and friendship, or a sense of personal satisfaction.
(Of course, these pursuits also indirectly improve our odds of survival and reproduction,
which is the deeper motive behind everything we do.)
Your mind is continuously analyzing your internal and external environment for hints of where rewards are located.
Because the cue is the first indication that we're close to a reward, it naturally leads to a craving.
Cravings are the second step, and they are the motivational force behind every habit.
Without some level of motivation or desire— without craving a change—we have no reason to act.
What you crave is not the habit itself but the change in state it delivers.
You do not crave smoking a cigarette, you crave the feeling of relief it provides.
You are not motivated by brushing your teeth but rather by the feeling of a clean mouth.
You do not want to turn on the television, you want to be entertained.
Every craving is linked to a desire to change your internal state.
This is an important point that we will discuss in detail later.
Cravings differ from person to person.
In theory, any piece of information could trigger a craving,
but in practice, people are not motivated by the same cues.
For a gambler, the sound of slot machines can be a potent trigger that sparks an intense wave of desire.
For someone who rarely gambles, the jingles and chimes of the casino are just background noise.
Cues are meaningless until they are interpreted.
The thoughts, feelings, and emotions of the observer are what transform a cue into a craving.
The third step is the response.
The response is the actual habit you perform, which can take the form of a thought or an action.
Whether a response occurs depends on how motivated you are and how much friction is associated with the behavior.
If a particular action requires more physical or mental effort than you are willing to expend, then you won't do it.
Your response also depends on your ability.
It sounds simple, but a habit can occur only if you are capable of doing it.
If you want to dunk a basketball but can't jump high enough to reach the hoop, well, you're out of luck.
Finally, the response delivers a reward.
Rewards are the end goal of every habit.
The cue is about noticing the reward.
The craving is about wanting the reward.
The response is about obtaining the reward.
We chase rewards because they serve two purposes: (1) they satisfy us and (2) they teach us.
The first purpose of rewards is to satisfy your craving.
Yes, rewards provide benefits on their own.
Food and water deliver the energy you need to survive.
Getting a promotion brings more money and respect.
Getting in shape improves your health and your dating prospects.
But the more immediate benefit is that rewards satisfy your craving to eat or to gain status or to win approval.
At least for a moment, rewards deliver contentment and relief from craving.
Second, rewards teach us which actions are worth remembering in the future.

Rewards close the feedback loop and complete the habit cycle.
If a behavior is insufficient in any of the four stages, it will not become a habit.
Eliminate the cue and your habit will never start.
Reduce the craving and you won't experience enough motivation to act.
Make the behavior difficult and you won't be able to do it.
And if the reward fails to satisfy your desire, then you'll have no reason to do it again in the future.
Without the first three steps, a behavior will not occur.
Without all four, a behavior will not be repeated.
THE HABIT LOOP
In summary, the cue triggers a craving,
which motivates a response,
which provides a reward,
which satisfies the craving and,
ultimately, becomes associated with the cue.
Together, these four steps form a neurological feedback loop—cue, craving, response, reward;
cue, craving, response, reward—that ultimately allows you to create automatic habits.
This cycle is known as the habit loop.
This four-step process is not something that happens occasionally,
but rather it is an endless feedback loop that is running and active during every moment you are alive—even now.
The brain is continually scanning the environment, predicting what will happen next,
trying out different responses, and learning from the results.
The entire process is completed in a split second, and we use it again and again
without realizing everything that has been packed into the previous moment.
We can split these four steps into two phases: the problem phase and the solution phase.
The problem phase includes the cue and the craving, and it is when you realize that something needs to change.
The solution phase includes the response and the reward, and it is when you take action and achieve the change you desire.
All behavior is driven by the desire to solve a problem.
Sometimes the problem is that you notice something good and you want to obtain it.
Sometimes the problem is that you are experiencing pain and you want to relieve it.
Either way, the purpose of every habit is to solve the problems you face.
内容省略………………因为我觉得这部分内容不重要，它主要是举一些生活当中的例子
THE FOUR LAWS OF BEHAVIOR CHANGE
In the following chapters, we will see time and again
how the four stages of cue, craving, response, and reward influence nearly everything we do each day.
But before we do that, we need to transform these four steps into a practical framework
that we can use to design good habits and eliminate bad ones.
I refer to this framework as the Four Laws of Behavior Change,
and it provides a simple set of rules for creating good habits and breaking bad ones.
You can think of each law as a lever that influences human behavior.
When the levers are in the right positions, creating good habits is effortless.
When they are in the wrong positions, it is nearly impossible.
We can invert these laws to learn how to break a bad habit.
It would be irresponsible for me to claim that
these four laws are an exhaustive framework for changing any human behavior, but I think they're close.
As you will soon see, the Four Laws of Behavior Change apply to nearly every field,
from sports to politics, art to medicine, comedy to management.
These laws can be used no matter what challenge you are facing.
There is no need for completely different strategies for each habit.
Whenever you want to change your behavior, you can simply ask yourself:
- How can I make it obvious?
- How can I make it attractive?
- How can I make it easy?
- How can I make it satisfying?
If you have ever wondered,
“Why don't I do what I say I'm going to do?
Why don't I lose the weight or stop smoking or save for retirement or start that side business?
Why do I say something is important but never seem to make time for it?”
The answers to those questions can be found somewhere in these four laws.
The key to creating good habits and breaking bad ones is to
understand these fundamental laws and how to alter them to your specifications.
Every goal is doomed to fail if it goes against the grain of human nature.

In the chapters that follow, we will discuss these laws one by one and
show how you can use them to create a system
in which good habits emerge naturally and bad habits wither away.
Chapter Summary
- A habit is a behavior that has been repeated enough times to become automatic.
- The ultimate purpose of habits is to solve the problems of life with as little energy and effort as possible.
- Any habit can be broken down into a feedback loop that involves four steps: cue, craving, response, and reward.
- The Four Laws of Behavior Change are a simple set of rules we can use to build better habits. They are (1) make it obvious, (2) make it attractive, (3) make it easy, and (4) make it satisfying.


{eval $loginhash = 'L'.random(4);}
{lang login}
{lang username} UID Email
{lang password}:
{lang security_question} {lang security_question_1} {lang security_question_2} {lang security_question_3} {lang security_question_4} {lang security_question_5} {lang security_question_6} {lang security_question_7}


I was reading this unfinished article on Jython (part of what looks to be very a good but also incomplete series of articles on JVM languages) and he had a few criticisms/suggestions of Python. I've mentioned some minor things that annoy me before, but this made me want to collect them all, and list all the things I wish Python did. Python 3K is already taken, but I'll up the ante -- Python 4K will be the 33% better than even Python 3K. (Note: implementation of Python 4K is left an an exercise for the reader.)
This isn't all backward compatible, but that said I'm not inclined to suggest needless backward incompatibilities either. Some people seem allergic to any "bloat" in a language, and obsess over removing things from builtins and elsewhere. I find this silly. Some people need to learn how to ignore what they don't care about.
So, what's my list?
Strings would not be iterable (noted here).
The self in method signatures would become optional. self would be a keyword with special significance. I regularly have bugs because of this -- mostly because I accidentally add self when calling methods on self, not because I leave them out of the function definition. But still, I find this lame.
cls would similarly become a keyword -- or maybe even allow class -- for class methods. For symmetry as much as anything.
super would become a keyword with special significance. I find super really confusing to use.
Maybe class methods wouldn't be callable on instances. But class variables should stay visible through instances. That seems tricky at first, but I actually think it's just a matter of a slightly different classmethod implementation.
We'd get some kind of declarative/lazy language extension, maybe like this. That turns class into one of several possible constructor arguments (property being a notable second such addition). Interface declarations could also be done more cleanly this way. This means that:
interface IFoo(Bar): a = 1
Means IFoo = interface('IFoo', (Bar,), {'a': 1}). You can kind of do that right now with metaclasses, but it feels very hacky, and Bar has to be designed for it. Something more conservative might also be just fine. It annoys me that attributes are unordered through these techniques. But maybe not worth fixing.
object grows a __classinit__ method, as described in a conservative metaclass.
Something to handle the descriptor problem, where descriptors don't know about what they are attached to. Having tried several things related to this, handling subclassing is hard, but I think it's important enough to make happen even if there are some inevitable warts.
There would only be bytes and unicode, no str, none of these Unicode*Errors. I hate those so much. Everyone does.  That's what slackers say about hard things. Python 4K will be a stand-up language, not some slacker language!
I'll admit this is a big backward compatibility issue. But unicode has already introduced huge backward compatibility problems, but certain people aren't willing to admit it, and instead just call the issues "bugs". Yeah, there's more bugs than non-bugs in the standard library, so I'm unimpressed.
Maybe something to clean up magic methods, like def *(other):. This wouldn't clean up all magic methods, but would clean up several. And right now, you actually can add a '*' method to objects. Maybe def '*'(other)? Not a big deal; magic methods are magic anyway, whatever name you give them.
Some query syntax for LINQ-like expressions -- that is, expressions which are introspectable and not run immediately. SQLObject's SQLBuilder (similar things seen elsewhere) is similar, but all hacky. Stuff like this and this would be easier and cleaner with it.
Some order-by syntax. Then you could do [value for key, value in some_dict.items() orderby value]. Right now you have to do [value for key, value in sorted(some_dict.items(), key=lambda v: v[1])] and that's obviously not as nice. Nice for the queries too.
Some string interpolation. Probably $"something ${expression}", ala PEP 215.
Some resolution to the anonymous function thing. I agree completely with Guido -- anonymous functions and function-expressions beyond lambda don't fit in Python. I could care less if lambda goes away -- I just want something good and lambda isn't good (I'm not a minimalist). I haven't figured out exactly what I want. I would probably defer to the brainstorming of the Twisted guys and other people who frequently bang their heads on this.
Some way of dealing with reloading. Maybe just cleaning up reload() (making it overwrite classes instead of recreating them, for instance). If that fancier reloading is part of the language, then people might be more careful about working so they don't break it. There would have to be an option of module-level functions __before_reload__ and __after_reload__ or something, so that even tricky code could fix itself up.
Something for object initialization. I find this tedious:
class Foo(object): def __init__(self, bar, baz): self.bar = bar self.baz = baz
But I'm not actually sure what to do. I mentioned that here.
I think double-underscore class-private variables (like self.__private) are super-lame. People think they are something they are not. They are not really-truly-private variables. They are I'm-going-to-piss-people-off private variables. They are I'm-too-lazy-to-use-name-mangling private variables. They are I'm-going-to-break-subclassing private variables. If you want class-private variables for a valid reason, explicit name mangling is in all ways better.
Delegation using __getattr__ and __setattr__ can be hard to work with, both creating delegates and consuming them. I'd like if there was more explicit support for this, with better failure conditions. Maybe this just means a nice built-in metaclass that solves this problem particularly well.
Something better for forward-references. I don't know exactly what to call these -- except it means for references to things that don't exist yet. Like a reference to a class that may or may not exist yet. Maybe this could be handled with a descriptor or something. Give it a specific implementation and pattern, so people can use it more easily than having to build the pattern up from what's there currently.
There's probably some interpreter things I'd like too...
Something like Pyrex but all polished and pretty. Maybe RPython can be this.
Microprocesses -- I haven't really used Erlang much, but I'm still drawn to it more than any of the other languages in that branch (the weird functional branch -- Haskell, ML, etc). They don't have microthreads (as you might see in Stackless), but they are basically the same except without shared state. Messages only. I think that's so much cooler than microthreads, at least if you can pull it off and still be fast and reliable.
Really fast interpreter startup. That might make the reloading thing much less important. I imagine frozen modules -- freezing the actual module in its full glory just as it looks immediately after import. With copy-on-write in some fashion, to facilitate really fast microprocess startup too (so microprocesses can share some set of modules so long as they aren't written to).
The first part (freezing) seems not-that-hard right now. In theory you just put pickle and marshal together and you got it, so long as the module doesn't do anything environment-dependent on startup (modules could opt in or opt out or something with respect to their environment dependencies). Copy-on-write is probably much much harder; though maybe it's an extension of garbage collection algorithms.
Really good cross-platform intra-Python interprocess communication. This should look just like inter-microprocess communication, for process portability.
Traceback extensions, so you can better annotate your code in ways that will show up in tracebacks. Similar in spirit to what Zope does with __traceback_info__ (and what Paste copies). But a built-in convention.
Some improved exception messages. I hate signature errors, for instance; very unhelpful (especially with the implicit-self-related counting error). Python does pretty well -- lots of languages do a lot worse -- but I also think this is way up there in terms of usability and can always use improvement.
No sys.path crappiness. Think this stuff through, one right way, no "search paths" (implicit awfulness). Careful or explicit relative imports.
A shortcut for for item in seq: yield item, when doing generator pass-through. Maybe yield *seq. Saw this on python-dev already. As I use generators more I encounter this desire fairly frequently.
Tuple-unpacking, like first, *rest = path.split('/'). This would be mighty useful. The guy who wrote the Jython review raves about Python packing; this would be another fine enhancement to a delightful feature. I desire this frequently.
Better signature unpacking, allowing def foo(*args, bar=None). I think I saw something recently about this in python-dev, and it might happen before 3.0.
Things I wouldn't do:
Put up with any significant-whitespace whining. Here 99% of the Python community is with me. I think there is a meme that Python people are close-minded to suggestions for changes in the language. I think there is significant truth to that. But sometimes everyone else is just completely wrong. I want nothing to do with any programmer who would mis-indent their code.
One thing I noticed from some recent Ruby criticisms I've read is that its syntax errors can be hard to read -- and then I realized this is in part because you have to wait until the end of the file for the compiler to catch some syntax errors that a Python can catch immediately because of whitespace.
Continuation-based web frameworks (like Seaside) seem lame to me. I'm so much more impressed by event-based programming, and continuations (used in that way) seem like a way to avoid explicit events. Events are the web. Continuations are people who want to make the web into an MVC GUI. GUIs are so twentieth century.
Language-level continuations (as opposed to the explicit continuation style used by Twisted) are cool and all -- I don't think they hurt -- but I don't think they are actually very useful either. That you can implement other things in terms of them doesn't impress me either; I'm also pretty comfortable with a series of specific language features instead of one giant meta-feature, at least when it comes to control flow.
I like the idea of adding to the ways you can express data in Python (it's not bad now). But actual macros don't really interest me (in a general sense) as I think they work on the wrong level -- they deal with syntax transformations, as opposed to object-level transformations. A fairly conservative set of additions to the syntax (I note queries and the interface/etc extension above) are better than macros.
Global interpreter lock? I still don't care, sorry. I want better processes, not better threads.
Turning = into an expression. To generalize: dynamic typing adds some usually shallow errors in return for far more expressive code. Assignment as an expression adds some really obnoxious errors (ones that don't raise exceptions) in return for minor expressiveness. That = isn't an expression catches me from making hard bugs almost every day (instead they are easy syntax error bugs).
I'd be fine with := as an assignment-expression, because I wouldn't misspell it. That would certainly be useful. The minimalists would hate this.
self in method bodies would not become optional. I.e., you'd still talk about self.instance_variable. That's a brevity that I don't want. Ruby's @ is fine (but doesn't fit Python's aesthetic). But the implicit this is horrible, and unworkable in Python anyway. People often clump signature-self whining together with body-self whining. One of those groups has a point, the other group doesn't. Anyway, I think the complaining would go away entirely if signatures and super was fixed, because people only complain about method bodies because think it adds weight to their argument against signatures (even though I think the opposite is true).
I actually like ? and ! in function names, as in Scheme. But I don't think it is worth adding.
I also kind of like no-public-attributes (i.e., all outside access is explicitly identified). property() helps a lot, but isn't all I would like.
The lexical scoping problems people have don't bother me. I wouldn't want Javascript-like variable declarations to define scope. It would be nice if Python gave an error earlier for scoping mistakes, though, and a better error too. I think this is statically detectable. Maybe something in addition to just the global declaration would be useful. People ask for lexical, and I can certainly see the benefit. (Note: this is only an issue when assigning to variables in enclosing scopes)
Well, that's all for now. Now you know everything I think is wrong with Python (that I can think of right now), and most of what I think would make it right. Looking over it again, I actually don't think it's that pie-in-the-sky, though some parts (like self) are indeed tricky, and involve more than just syntactic additions.
Update:
Well, I don't really need, or understand deeply, all the advanced/dynamic/metaclass features you're asking for, so I'll comment on the ones I care about.
Definite agreement:
- non-iterable strings
- Object initialization
- Microprocesses. This is the holy Python grail for me. They are so sweet in Erlang.
- Better tuple unpacking. Another win for Erlang that we could steal and improve. I like your examples.
- Same for signature unpacking.
- Explicit relative imports.
- orderby.
- Better reload().
- LINQ-like stuff.
- Unicode - my number 2 behind microprocesses.
Questions:
- You just say that __variables__ are lame, and mangling is better, without ever saying what you'd do about them. How does Python 4k handle private variables/name mangling properly?
- Why aren't "?" and "!" worth allowing in function names? I want these, personally. I feel like they would aid the descriptiveness of my code significantly. (How about "-"?)
I'd add (and I don't follow python-dev, so forgive me if they exist/are coming soon):
- Built-in currying
- local variable dump in exceptions, like in cgi module
- Microprocesses. Oh, did I mention that one already?
- ipython in the standard distribution
- Real, Good, Pythonic, Documented, Cross-Platform GUI library. We're talking 4k here right? Can we ever make this happen?
- By class-private variables I mean __private, not __magic__. Class-private variables are simply never needed. If you have self.__really_private you can just use self._MyClass_really_private for similar effect (actually self._MyClass__really_private is the identical effect)
- I think adding ? and ! to function names (or symbol names in general) changes the feel of the language too much. I'd add them if I was starting from zero, but at this point I wouldn't want to use those because it would be too jarring against the bulk of existing code. Dashes are, of course, completely out ;) Also, they conflict with outside naming conventions, making some Python symbols hard to access from other languages. I don't know if this is a big deal in practice, but I think there's something good about using a lowest-common-denominator in naming. Case sensitivity is useful for the same reason (though part of me would like to be case and underscore insensitive, to remove the source of needless style differences).
For the things you would add:
- There is a proposal for a partial function, which I think is what you mean by currying. Maybe in Python 2.5? I personally don't think it's very readable in practice. lambda actually not half bad for this one case.
- I agree that a nicer interactive prompt -- roughly based on ipython I imagine -- would be very useful.
- Local variable dumping is possible currently, but not enabled in the default traceback. I don't know if it should be -- I think it's overwhelming except in interactive environments. It should be included in more interactive environments; maybe standard library support would help. Goes with the __traceback_info__ stuff.
- GUI library... seems too hard, even for 4K ;) If it hasn't happened outside of the standard library, how can it happen inside? Plus GUIs are the past, the web is the future ;) XUL will rock, though! I'll be all over that.
# Ian Bicking
Bill: Check out PEP 309 for the currying/partial functions thing. http://www.python.org/peps/pep-0309.html. According to the PEP, it'll be in Python 2.5.
PartialApplication is officially in for 2.5 I cannot resist pointing our my recipe here:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440557
It's sortof PA++ ;)
I very much want to see 'locals' and 'globals' be sort of accessible keywords much like you suggest 'super' and 'self', and also 'class'. It'd make dealing with the various name-spaces a cinch. Or maybe 'module' instead of 'globals'.
That'd be nice.
# Brantley
Why Python 4k ? Since most of this is not backward compatible, I would be very thanksfull if you began making PEP's for it all.
Personnally, don't understand all the stuff there but I vote for :
- really fast interpreter startup
- turns class into one of several possible constructor arguments
- order by syntax
- microprocesses (don't yet read about it but sounds cool).
About your assertion that GUI is old-style, I'm not totally convinced but I really think, GUI should be able to use bookmarks, protocols and REST style programming. What I see as a limitation in web style programming is the lack for "push" facilities.
Thanks for this wonderfull post.
# Alex Garel
The GUI stuff was really my slightly facetious rejection of those people who complain about how inelegent web programming is, and how it should be more like GUI programming. I think they are just opening a can of worms for themselves, by trying to impose a style of programming they are familiar with to a domain where it is not appropriate. Of course, I also think GUI programming is a bit retro all considered -- I genuinely think that as a user, not just as a programmer. But that only directs my interest, it doesn't really effect the language much one way or the other.
Some of these aren't language extensions per se, but just hard implementation problems: microprocesses are an example of that, as is interpreter startup. I am hopeful that PyPy will open up this kind of development.
# Ian Bicking
Good Ideas but please let strings yield characters on iteration :-) I've much code using string iteration.
And self/cls should'nt be keywords and should be the first parameter of method. Really :)
String iteration just doesn't make sense. They don't yield characters... they just yield smaller strings. Strings that contain strings that contain strings. Strings just aren't containers in Python -- they are indexable, but to iterate something should be a container. It's only (IMHO) an accident of an earlier Python that didn't have the iterator protocol, that you can iterate over strings. Strings should grow a method like .chars() that yields all the characters. Of course, not backward compatible, but the errors should be obvious ("TypeError: strings are not iterable").
I've been thinking about the self thing more. It's one of the hardest to resolve issues (and I doubt it will be resolved). But I think it would be reasonable if functions defined in a class scope meant something different than a function defined outside of a class scope. So if you were injecting a function definition into a class, it would (reasonably) work just like it does now, with an explicit self parameter. But if you are doing it in a class scope, the metaclass (type) wraps the function in some fashion. It seems less intrusive than class-private variables, even (which are statically determined).
The self parameter also works badly with decorators, though the same might be true if that parameter was removed. Getting a decorator to act properly with a method and with a function is hard.
# Ian Bicking
I certainly agree with some of the changes, like something as basic as proper relative imports. But I think I hear too many "GUI is old style, the web is the future" comments from a lot of programmers that are more over-enthusiasm for new web technologies rather than a careful look at why we keep and discard old/new technologies in general. As others have pointed out, even new asynchronous web technologies are still unidirectional in one sense: the client makes a request, and only then does the server send a reply. Web servers don't initiate requests to web browsers, although traditional networked GUI applications do this all the time. In tech history, we've gone from assembly language (independent of hardware), to portable languages (independent of assembly language), and now to various styles of cross-platform (independent of OS or basic platform). It's not just the web, but any successful model of cross-platform apps that is the future. The web is the future only because the browser is ubiquitous, but in the end I still have to install Firefox, etc. to be able to use the latest web technology. With things like PyGTK and wxPython, I can have the same ubiquity for GUI apps too. It's all the same: I download the app through my browser when I visit a page, or I download the Python script and run it. (P.S. I do agree with a lot of Ian's points in general. Sorry if this sounds like trolling).
# Rob Walker
I don't personally find Python wishlists that interesting, especially the ones which propose language changes, but it's good to see that you've touched on issues with the runtime itself because that is where Python (the platform) should be innovating, or at least fixing itself a fair amount. The problem is that because the language syntax is the thing most people have direct experience with (and one can become superficially acquainted with Python in that way, provoking the "whitespace sucks" arguments offered by detractors/newcomers), people feel more inclined to suggest tweaks which frequently say more about their own habits (at many different levels) rather than to seriously think about some of the harder issues - things like concurrency, performance, predictability, memory usage and library support - and then provide improvements in those areas. And when the harder issues do manage to enter the scene, proposals like optional static typing emerge: the arguably lazy and inadequate approach to dealing with such issues.
Certainly, I don't see Python diminishing in (relative) popularity because of the lack of some language constructs or notation: it's more likely to happen because Python doesn't conveniently work well with or support other, popular technologies, isn't perceived to scale well (in a way that involves convenient programming techniques), or isn't perceived to have good enough documentation - the latter being another story entirely.
My personal feeling is that a multi-line lambda is a mistake, like Guido says. However, I agree with the functionally oriented people that having to use a local named function breaks code locality and tends to make it hard to follow the code in Python written with a more functional flavor.
I think that the right Pythonic answer is to introduce a syntax kind of like ruby blocks where a function call can optionally be followed by a colon, then arg list and a suite underneath and that the arguments and suite would be converted to a local function passed as the last argument to the function. Here is an example:
def open_in( filename, block ): f = open( filename ) try: return block( f ) finally: close(f) max_char = open_in( "foo.txt" ): (f) x = 0 for l in f: x = max(x, len(l)) return xOr something like that. There are a few warts:
- The arg list of the anonymous block is awkward, maybe another colon at the end would help.
- The block is a lexical closure, not in the same frame as the outside function so you get the usual assignment to local problem, but its worse because it looks like a suite in the local scope the same way for and while suites are. That makes its more confusing.
- In a similar vein you need a return or yield in the block to get a result out which makes simple things like reduce look painful (but list comprehension saves filters and maps).
To see what I mean about the return or yield thing, here is an example. First the new form of reduce:
def reduce( l, v, f ): for x in l: v = f( v, x ) return initialNow, the clunky way to write a sum:
sum = reduce( x, 0 ): (a,b) return a+bVs, the more elegant (IMHO):
sum = reduce( x, 0 ): (a,b) a+bHowever, sum is a simple contrived example because of course sums, products, any, and all should be built in, and possibly the only real uses involve suites large enough that return or yield is help in understanding, instead of a hindrance.
<pre>
interface IFoo(Bar):
a = 1
</pre>
Consider this declaration means:
<pre>
def tmp():
a = 1
IFoo = interface('IFoo', (Bar,), tmp)
</pre>
With this we can express user defined function definition. Interface or class declaration can be emulated by executing tmp and using its local scope as definitions list.# irg
"I actually like ? and ! in function names, as in Scheme. But I don't think it is worth adding."
Scheme? I thought Ruby invented that! ;)
In any case, I hear you on the whitespace with one exception: I wonder if comments should be exempt from that rule. Sometimes it's just easier to scan down through a file when the important comments are left-aligned.
Sometimes it's just easier to scan down through a file when the important comments are left-aligned.
Can't you do that right now? I just tried it and it seems to work fine.
# Ian Bicking
Surely you meant to write "py-in-the-sky"?
I think making self.something spellable as .something would be nice.
Not a big fan of that myself. I guess I usually read code in my head on some level, and .something isn't readable in the same way self.something is. Also, that dot is really small. As a separator that's size fine -- good even -- but if it is an independent modifier that's bothersome. Plus I'm not so much looking to save a few keystrokes by taking it out of the signature, as much as bringing some symmetry in signature and use.
# Ian Bicking
"Turning = into an expression. To generalize: dynamic typing adds some usually shallow errors in return for far more expressive code. Assignment as an expression adds some really obnoxious errors (ones that don't raise exceptions) in return for minor expressiveness. That = isn't an expression catches me from making hard bugs almost every day (instead they are easy syntax error bugs).
I'd be fine with := as an assignment-expression, because I wouldn't misspell it. That would certainly be useful. The minimalists would hate this. "
I'm guessing yu'll be using = for equality?
I'm guessing yu'll be using = for equality?
No, nothing so dramatic; instead adding := as another way to do assignment, allowed in expressions. This is why minimalists would hate it (and not without justification). My real problem making assignment into an expression is that it's really easy to spell == as =, with disasterous consequences. It's really hard to accidentally leave out an = and add in a :, so with := I don't expect that typos will be too much of a problem.
# Ian Bicking
I like the way you're handling self and cls. One thing to note here is that any method that contains a self. is an instance method, any method that contains a cls. is a class method if it doesn't contain a self. as well. If it contains neither, it's a static method. Both the classmethod and staticmethod functions go away.
Another minor point here is that allowing both self. and cls. in the same method gives you access to the class object without any special syntax.
# John Roth
I don't know... I'd consider that much too magical and opaque. »Explicit is better than implicit«, right?


Use your arrows on the keyboard to move to slaying the orcs and tuck tail run away from Slimes
Oh and you've got only 15 seconds to have fun with the orcs. Good news is you can earn more time by defeating more orcs! Cool ha?
That's it! Head in there and try not to die my friend or I'll loot your body later hehe


|
Roxana Tapia Appfs
|
Functions | |
| def | xml_to_csv (data) |
| def | write_csv (content_list) |
Variables | |
| filename = sys.argv[-1] | |
| xml_text = open(filename).read() | |
| parsed_data = BeautifulSoup(xml_text, 'xml') | |
@package docstring Author: Roxana Tapia Campos Module: Advanced practical programming skills for scientists SS17 - TU Berlin Exercise 2: XML to CSV measured
| def ex2.write_csv | ( | content_list | ) |
Writes a CSV 'output.csv' file with the formatted result. :param content_list: A list with triplets.
| def ex2.xml_to_csv | ( | data | ) |
Searches all suitable values (tags) to build a response with format: YYYY-MM-DD; HH; amountOfPower-Value :param data: Parsed data from XML file as a tree format.


Tooltips can be attached to any element. When you hover the element with your mouse, the title attribute is displayed in a little box next to the element, just like a native tooltip.
But as it's not a native tooltip, it can be styled. Any themes built with ThemeRoller will also style tooltips accordingly.
Tooltips are also useful for form elements, to show some additional information in the context of each field.
Hover the field to see the tooltip.
Here the tooltips are positioned relative to the mouse, and follow the mouse while it moves above the element.


Hack
X
Real
Hack
Credits
Credits
Iron
Man
Credits
Credits
Thor
Just Thor
Credits
Credits
Hack X
Captain America
Iron Man
Thor
Made by
Nikolay Talanov
My codepen
My twitter
Based on
Concept by Kreativa Studio
Global Blend Mode


This chapter describes the structure of the APF and includes basic knowledge. Further, it refers to relevant
documentation chapters to ease getting started with the APF.
The Adventure PHP Framework (briefly: APF) is designed to assist the developer with the implementation of
object oriented and reusable PHP based web applications. It makes use of and implements several important object
oriented design patterns and offers a large set of solutions for day-2-day tasks.
The APF is no complete and ready-to-use application that only needs to be configured prior to run but a
strong basis to create such application easily and using common software development procedures.
As other PHP frameworks the APF follows dedicated principles and paradigms. The following list contains a list of
the most important ones:
-
Framework instead of class library:
The APF understands itself as a framework not a class library. It clearly follows it's paradigms and offers
development workflows and patterns that are fully interwoven with the framework. This fact - sometimes misleadingly
referred to as restriction - prevents new developers from mistakes and enables you to create applications with
proven patterns.
-
Object orientation:
The components of the Adventure PHP Framework are all designed with object orientation in mind. This enables you
to create functionality according to their concern that are easily reusable and thus offer a solution for your
day-2-day work.
-
Design pattern:
The components of the APF are all designed along with known software design pattern to ease getting started and
to use consistent wording.
-
Bootstrapping:
In order to ease configuration and implementation the APF uses a single entry point for all applications - the
so-called bootstrap file. This file (e.g. index.php) answers all requests as desired by the developer.
Details can be taken from or .
-
Separation of code and configuration:
Separation of application logic and configuration allows you to create reusable components and modules. In case
you leverage the APF capabilities you can easily create multiple projects based on the same code base or to run
a multi-project hosting environment based on one APF installation. Details can be taken from .
-
Open to enhancement:
The APF follows the open close principle. You are provided dedicated extension points but you cannot
completely change the framework. Although the provided extension points let you realize even exotic
requirements by enhancing the framework's capabilities according to your project.
-
Open source:
The Adventure PHP Framework is an Open Source product! In case you would like to contribute, we'd love to welcome
you within our . In other cases, please us or create a thread
within our Forum. We are looking forward to
get in touch from you!
The following chapters contain basic topics on the APF.
The Adventure PHP Framework is a framework written for PHP to
develop web applications. For this reason you need a web server including the PHP module. You may want to use the
de-facto standard Apache HTTP Server or
nginx respectively.
The APF 2.X requires PHP > 5.3.0 since it is based on PHP namespaces. APF 1.X also works with Version less than
5.3.0. Well-known packages such as XAMPP
already contain the required PHP version.
In order to quick-start with the framework it is recommended to download a apf-demopack-* file. These files
do not only contain the APF code but a ready-to-use example web site - the . The Sandbox
contains a large number of examples and wizards to get familiar with the APF. In case you don't have experience with
the APF yet, the Sandbox can also be used as a development environment for custom modules or components. Later on,
they can be easily integrated into your own web site.
To gain efficiency while programming the APF team strongly recommends to use
PHPStorm. It contains code completion, direct
feedback on coding issues and a decent integration of xdebug
to analyze errors within your application.
Now it's up to you! With the above tools you are now well-equipped to start with development!
The pages of the Adventure PHP Frameworks are separated into two main areas: the area and
the .
Under you can find the downloads of the current release and a reference on experimental versions
(see ). If you are looking for current snapshots, please refer to .
The documentation of the framework is located under . There are the following areas: the
with a separate chapter on each component, the and the
section with further information on the framework and software development in common.
Besides, you are provided the Forum and the
Wiki.
The Adventure PHP Framework has four main areas: the core that contains basic components, the tools
area that ships components that ease development and the modules and extensions section that include
ready-to-use modules or extensions.
Each release includes several packages that are all based on the apf-codepack-* files that contains the code
base of the APF. Besides, the apf-configpack-* listed under contains a set of
sample content files according to each version.
In case you are searching for implementation samples, you may want to use the (package:
apf-demopack-*) or the sample packages apf-calc-example-* (simple calculator), apf-modules-example-*
(inclusion of dynamic modules), or apf-vbc-example-* - a sample implementation for .
As noted in chapter 3 the apf-codepack-* files
contain the code base of the Adventure PHP Framework. The package contains the following folders:
APF/
core/
extensions/
modules/
tools/
The core and tools folders contain the core parts of the framework. Within core
you can find the implementation of the (/APF/core/pagecontroller/) and the
(/APF/core/frontcontroller/), having a look at tools you may find the
implementation (/APF/tools/form/).
modules contains modules that are based on core and tools components. These are i.e. the
and the that can be added to your custom web page easily.
Details on the components can also be taken from the .
This chapter shows you how to create a very simple page using the apf-codepack-* release file.
Further content to get started with the APF and how to construct web sites can be found under
, , or . More tutorials are listed under
.
As described in chapter 2 the APF uses the boot-strapping
concept. This means that the requests of all visitors are handled by one central file (index.php in most
cases, bacause this file is configured as DirectoryIndex).
In order to create a simple application please download a apf-codepack-* release file and extract it into
a folder located under the DOCUMENT_ROOT of your web server. After that, please create an index.php
file in parallel to the APF folder.
Every web page or web application starts with an initial template that takes includes all areas of your application.
Please use the following code as a basis for this chapter for the index.php file:
include('./APF/core/bootstrap.php');
use APF\core\singleton\Singleton;
use APF\core\frontcontroller\Frontcontroller;
$fC = &Singleton::getInstance('APF\core\frontcontroller\Frontcontroller');
echo $fC->start('APF\site\templates', 'main');
Within the first line the APF/core/bootstrap.php is included. This file includes all necessary APF components
and does the initial configuration.
Line 5 creates an instance of the and within the last line the request processing is started
by applying the initial template. The echo causes the return value - the content of the entire page - to be
sent back to the user.
Further instructions on how to configure your application within the index.php file can be found under
, , , and .
Templates play a central role within the Adventure PHP Framework. As mentioned in the last chapter each application
starts from a basic template and the uses templates for it's template-centric implementation
of the HMVC pattern.
Within the above sample the is started with the basic template main from the
APF\site\templates namespace. Hence, it expects the main.html file to be stored within folder
APF/site/templates. The folder structure is thus as follows:
APF/
core/
extensions/
modules/
site/
templates/
main.html
tools/
In case you add
My first application with the APF!
to the template file and call the index.php you will be presented the text of the template.
This sample assumes that the standard configuration of the APF has not been changed - especially concerning the
ClassLoader configuration. Details on the configuration can be taken from chapter .
Further examples on templates can be read about in chapters and .
The tutorial provides an introduction on how to create web pages and applications.
For parameters that are used by various components the framework provides a configuration facility making use of the
. In case you intend to adapt those parameters please use the index.php.
The following list shows all relevant parameters from the APF\core namespace:
-
Environment:
The Environment property allows you to distinguish configuration properties between different physical
environments your software is operated in (e.g. test or production environment). Details can be taken from chapter
.
-
InternalLogTarget:
Defines the name of the standard log target for framework error messages. Details on usage and configuration are
described in chapter .
-
Charset:
Defines the character set that is used for string operations such as htmlspecialchars(). The default
value (UTF-8) is initialized within the boostrap.php file.
In case you want to change one or more of the parameters please added the following code to your index.php:
include('./APF/core/bootstrap.php');
use APF\core\registry\Registry;
Registry::register('APF\core', 'Environment', 'TEST');
Registry::register('APF\core', 'InternalLogTarget', 'framework');
Registry::register('APF\core', 'Charset', 'UTF-16');
...


1/8-1/22: Real Estate Courses Online -- 15% Off!! - (Texas) classes
1/13-1/26: Collection Of Polish Fine Art - (12660 Greenfield Detroit, MI 48227) events
1/25: GED class available - (on-line/packet) classes
1/17-1/31: 2nd Annual Horsemen's Re-Union - (Paso Robles Event Center, Paso Robles CA) events
1/17-1/30: Start a Degree in Counseling - classes
1/29: New Billing and Coding Classes. Job Placement Assistance - (Abilene) img classes
1/13-1/26: Earn Cash By reading emails - (abilene ) img events
1/13-1/27: Earn Cash By reading emails - (abilene ) events
1/13-1/27: Earn Cash By watching videos - (abilene ) events
1/13-1/27: Earn Cash By reading emails - (abilene ) events
1/9-1/23: ♞➨Become an EMT/Paramedic in just 16 Days. Make up to $4,200! - img classes
6/21-6/22: 1st Annual Broken DuckFeet Music Festival in San Antonio, Texas, benef - (San Antonio, TX) events
5/18-5/25: wedding - (abilene,texas) events


-
Drone Exemptions for Hollywood Pave the Way for Widespread Use
www.nytimes.com
The decision by the Federal Aviation Administration has implications for industries like agriculture, energy and online retailing.
-
Tech Firms and Lobbyists: Now Intertwined, but Not Eager to Reveal It
www.nytimes.com
The industry ranks near the bottom of a list that grades large corporations on how well they publicly disclose political activities.
-
For High School Football Coaches and Fans, a New Digital Blitz
www.nytimes.com
Several websites and apps are transforming the way that players and coaches practice, scout other teams and analyze their own performance.
-
To Gather Drug Data, a Health Start-Up Turns to Consumers
www.nytimes.com
Iodine has used online surveys to compile data on Americans’ experiences while taking prescription medications, intending to help other prospective ...
-
Pass the Word: The Phone Call Is Back - NYTimes.com
bits.blogs.nytimes.com
Just a few years ago, it seemed that the old-fashioned phone call was going out of style. Smartphones were on the rise, and many people were using ...
-
Facebook Lawsuit Over Search Warrants Can Proceed, a Court in Manhattan ...
www.nytimes.com
An appellate decision paves the way for oral arguments over whether Manhattan prosecutors violated the constitutional rights of 381 users by ...
-
Hootsuite Allows You to Call Customer Service From a Tweet
bits.blogs.nytimes.com
Hootsuite Media, a Canadian maker of social media software, is offering a new tool that allows companies to handle complaints on Twitter by sending ...
-
In Israel, Values of a Holy Respite Are Adapted for a High-Tech World
www.nytimes.com
Israel experiments with modern observances of the Jewish “shmita,” a traditional rest period for farmers that comes every seventh year.
-
Strikes at Amazon Warehouses in Germany End for Now
bits.blogs.nytimes.com
The union behind the strike and the Internet retailing giant disagree on how many workers participated in the work stoppage.
-
Apple Pulls iOS 8 Software Update After iPhone Problems
bits.blogs.nytimes.com
The update was intended to fix various bugs in Apple’s mobile operating system, but it disabled cellphone service, among other problems.
-
High School Tech, in Football Playbooks and Classroom Lesson Plans
bits.blogs.nytimes.com
The rise of video in high school football is just part of a larger trend of how we live with screens. The schools featured in an article on Wednesday ...
-
Put That New iPhone 6 Through Its Paces
www.nytimes.com
Apps show off the features of the new Apple iPhone and its operating system, iOS 8.
-
Companies Take the Baton in Climate Change Efforts
www.nytimes.com
Forty companies pledged on Tuesday to help cut tropical deforestation in half by 2020 and stop it entirely by 2030.
-
Rocket Internet of Germany Sets Price Range for Its I.P.O.
dealbook.nytimes.com
The company plans to raise as much as $1.89 billion, which would value the company at up to $7.8 billion.
-
Getting Value Out of Old iPhones After Upgrading
bits.blogs.nytimes.com
Last weekend, Apple sold millions of shiny new iPhones to people who already had cellphones. Now, thanks to a growing electronics-reselling industry, ...
-
Tool Called Dataminr Hunts for News in the Din of Twitter - NYTimes.com
www.nytimes.com
Earlier this year, several producers at CNN received an alert from a new digital news-gathering tool that they were testing: A teenager in Los ...
-
Flipping Scanned Images
www.nytimes.com
Slide images scanned upside-down or in reverse can be corrected with Windows or OS X programs, or with image-editing software.
-
Philips to Split Into Two Companies as Part of Overhaul
dealbook.nytimes.com
The Dutch electronics giant will split into two entities: one focused on health care and technology, and one on lighting.
-
Hotels Use Online Reviews as Blueprint for Renovations
www.nytimes.com
Hotel managers are relying more and more on reviews from websites like TripAdvisor for direction regarding renovations and upgrades of their ...
-
Months After Buying Beats, Apple’s Plans for Its Music Service Remain ...
www.nytimes.com
Apple paid $3 billion for Beats, which makes headphones and also offers streaming music — a service that analysts say could be discontinued, though ...
-
Aging Tech Giants Like EMC Look to Deals to Help Bolster Revenue
dealbook.nytimes.com
The computer storage company’s talks with HP, Cisco and Oracle highlight the continuing problem with aging technology giants pursuing growth and ...
-
First-Weekend Sales of Apple’s iPhone 6 Models Top 10 Million
www.nytimes.com
The strong demand for Apple’s new devices mirrors growing consumer interest in smartphones with bigger screens.
-
Fullscreen Sells Control to Joint Venture Between AT&T and Chernin Group
www.nytimes.com
The deal with Fullscreen, a digital media company that connects online personalities and brands, is said to be valued about $200 million to $300 ...
-
On a Warmer Planet, Which Cities Will Be Safest?
www.nytimes.com
Scientists trying to predict the consequences of climate change see few havens from future storms, floods and droughts. But some regions will fare ...
-
Ebola Doctor Shortage Eases as Volunteers Begin to Step Forward
www.nytimes.com
Even with the volunteers, experts say, there will be a long gap before hospitals can be fully staffed to care for the growing numbers of Ebola ...
-
In Chile, an Animal Whose Numbers Please No One
www.nytimes.com
Government-sanctioned culling of the guanaco in Tierra del Fuego has drawn opposition from animal rights activists and tourism officials.
-
Exclusive: Amazon tests smart home gadgets, expands hardware lab
www.reuters.com
SAN FRANCISCO (Reuters) - Amazon.com Inc will boost staffing at its secretive Silicon Valley-based hardware unit by at least 27 percent over the next ...
-
Snapchat Nabs Top Google Comms Exec Jill Hazelbaker to Run Its PR and ...
recode.net
Some big new guns for the ephemeral messaging service.
-
Inside the New York Fed: Secret Recordings and a Culture Clash
www.propublica.org
A confidential report and a fired examiner’s hidden recorder penetrate the cloistered world of Wall Street’s top regulator -- and its history of ...
-
Examining the Amazon Way
bits.blogs.nytimes.com
Amazon’s accomplishments are dwarfed only by its ambitions. A former executive talks about the potential and the perils as the retailer enters its ...


This index organizes the Health Catalyst user personas by associated products. Click a product name to go to a listing of that product’s associated personas for buyer, primary user, and secondary user. Alternatively, you can view an alphabetical list of user personas or an organization chart of personas by job role.


#include <WinCAPICryptoSymmetricKey.hpp>
Inheritance diagram for WinCAPICryptoSymmetricKey:
This is the implementation for a wrapper of Windows CryptoAPI symmetric crypto functions.
Windows utility functions | |
| static HCRYPTKEY | createWindowsKey (const unsigned char *key, unsigned int keyLen, XSECCryptoSymmetricKey::SymmetricKeyType type, HCRYPTPROV *prov) |
| Create a symmetric key from a octet string. | |
Public Member Functions | |
Constructors and Destructors | |
| WinCAPICryptoSymmetricKey (HCRYPTPROV prov, XSECCryptoSymmetricKey::SymmetricKeyType type) | |
| Constructor. | |
| virtual | ~WinCAPICryptoSymmetricKey () |
| Destructor. | |
Basic CryptoKey Interface methods | |
| virtual const XMLCh * | getProviderName () |
| Returns a string that identifies the crypto owner of this library. | |
| virtual XSECCryptoKey * | clone () |
| Clone the key. | |
Symmetric key interface methods | |
| SymmetricKeyType | getSymmetricKeyType (void) |
| What type of symmetric key is this? | |
| void | setKey (const unsigned char *key, unsigned int keyLen) |
| Set the key from the provided bytes. | |
| virtual bool | decryptInit (bool doPad=true, SymmetricKeyMode mode=MODE_CBC, const unsigned char *iv=NULL) |
| Initialise an decryption process. | |
| virtual unsigned int | decrypt (const unsigned char *inBuf, unsigned char *plainBuf, unsigned int inLength, unsigned int maxOutLength) |
| Continue an decrypt operation using this key. | |
| virtual unsigned int | decryptFinish (unsigned char *plainBuf, unsigned int maxOutLength) |
| Finish a decryption operation. | |
| virtual bool | encryptInit (bool doPad=true, SymmetricKeyMode mode=MODE_CBC, const unsigned char *iv=NULL) |
| Initialise an encryption process. | |
| virtual unsigned int | encrypt (const unsigned char *inBuf, unsigned char *cipherBuf, unsigned int inLength, unsigned int maxOutLength) |
| Continue an encryption operation using this key. | |
| virtual unsigned int | encryptFinish (unsigned char *plainBuf, unsigned int maxOutLength) |
| Finish a encryption operation. |
|
|
Constructor. Can only construct a Symmetric key if we know what type it is
|
|
|
Destructor. Implementations must ensure that the held key is properly destroyed (overwritten) when key objects are deleted. |
|
|
Clone the key. All keys need to be able to copy themselves and return a pointer to the copy. This allows the library to duplicate keys. Implements XSECCryptoSymmetricKey. |
|
|
Create a symmetric key from a octet string. Uses the ApacheKeyStore to wrap an octet string in a public key and then load it into the Apache Key Container within the defined CSP
|
|
|
Continue an decrypt operation using this key. Decryption must have been set up using an encryptInit call. Takes the inBuf and continues a decryption operation, writing the output to outBuf. This function does not have to guarantee that all input will be decrypted. In cases where the input is not a length of the block size, the implementation will need to hold back cipher-text to be handles during the next operation.
Implements XSECCryptoSymmetricKey. |
|
|
Finish a decryption operation. Complete a decryption process. No cipher text is passed in, as this should simply be removing any remaining text from the plain storage buffer. May throw an exception if there is some stored cipher text that is not the length of the block size for block algorithms.
Implements XSECCryptoSymmetricKey. |
|
|
Initialise an decryption process. Setup the key to get ready for a decryption session. Callers can pass in an IV. If one is not provided, but the algorithm requires one (e.g. 3DES_CBC), then implementations should assume that the start of the cipher text stream will in fact be the IV.
Implements XSECCryptoSymmetricKey. |
|
|
Continue an encryption operation using this key. Encryption must have been set up using an encryptInit call. Takes the inBuf and continues a encryption operation, writing the output to outBuf. This function does not have to guarantee that all input will be encrypted. In cases where the input is not a length of the block size, the implementation will need to hold back plain-text to be handled during the next operation.
Implements XSECCryptoSymmetricKey. |
|
|
Finish a encryption operation. Complete a encryption process. No plain text is passed in, as this should simply be removing any remaining text from the plain storage buffer and creating a final padded block. Padding is performed by taking the remaining block, and setting the last byte to equal the number of bytes of padding. If the plain was an exact multiple of the block size, then an extra block of padding will be used. For example, if the block size is 8 bytes, and there were three remaining plain text bytes (0x01, 0x02 and 0x03), the final block will be : 0x010203????????05
Implements XSECCryptoSymmetricKey. |
|
|
Initialise an encryption process. Setup the key to get ready for a decryption session. Callers can pass in an IV. If one is not provided, but the algorithm requires one (e.g. 3DES_CBC), then implementations are required to generate one.
Implements XSECCryptoSymmetricKey. |
|
|
Returns a string that identifies the crypto owner of this library.
Implements XSECCryptoSymmetricKey. |
|
|
What type of symmetric key is this? There are a number of different types of symmetric key. This method allows callers to determine the type of this particular key Implements XSECCryptoSymmetricKey. |
|
|
Set the key from the provided bytes. Symmetric keys can all be loaded from a buffer containing a series of bytes.
Implements XSECCryptoSymmetricKey. |


Logout
Left panel content goes here
Tempest
Log into Nest to manage your devices.
Login
THERMOSTAT
PROTECT
CAMERA
Log in to Nest
Sign In
Cancel


Changes to the opentheory tool
Recent changes
- An ML interface to invoke the opentheory tool.
Version 1.4: 1 March 2018
Version 1.3: 12 October 2014
- Support for exporting OpenTheory packages as Haskell packages.
Version 1.2: 25 June 2012
- Released sources under the
MIT License.
- A query language for installed packages using the opentheory
list command.
Version 1.1: 14 March 2011
Version 1.0: 10 February 2009
- Used to power the
OpenTheory project.
- Released sources under version 2 of the GPL License.


Services
Inventory
Description of Service
See More
Insurance
Description of Service
See More
Sell Your Car
Description of Service
See More
Financing
Description of Service
See More
Contact Us
Description of Service
See More
Coming Soon
Description of Service
See More


Tic-Tac-Toe
{{ game.message }}
clear
radio_button_unchecked
Player:
clear
radio_button_unchecked
replay
Play Again


class: center, middle # Richard Wilde ## @rippo View slides at http://tinyurl.com/slides-casper --- class: center, middle # Why test the UI? ## (end-to-end testing) # What did I try? ## Selenuim, Web Driver, Coypu --- # What is PhantomJS? PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG. * Full web stack * No browser required # What is CasperJS? CasperJS is a navigation scripting & testing utility written in Javascript that depends on PhantomJS. CasperJS eases the process of defining a full navigation scenario and provides useful high-level functions, methods & syntactic sugar for doing common tasks such as: * Testing your ui * Screen scraping including screen grabs --- # Hands on Agenda 1. Getting setup 2. Screen grab demo 3. Test 1 - First test 4. Test 2 - Navigation 5. Test 3 - Fill in a form 6. Test 4 - Waiting for the UI 7. Test 5 - Evaluate 8. Test 6 - Looping 9. Review Page Objects (if time) When you get stuck check out the API documentation http://docs.casperjs.org/en/latest/modules/index.html --- # Getting setup 1. Installing node http://nodejs.org/ 2. Open CMD prompt and install CasperJS (it bundles PhantomJs) ````bat $ npm install casperjs -g $ notepad %APPDATA%\npm\casperjs.cmd ```` Goto http://tinyurl.com/casper-cmd and paste in the text and save 3. Check casper is installed, it should return `1.1.0-beta3`. ````bat $ casperjs --version ```` 4. In CMD create folder on your drive and CD to it (any name, any where almost like Martini) and then get the demo project from GitHub ````bat $ git clone https://github.com/rippo/testing.casperjs.git ```` 6. To remove the unsafe js warning, downgrade phantomjs 1.9.8 to 1.9.7. Copy phantom.exe from the GIT root folder into the folder below ````bat $ explorer %APPDATA%\npm\node_modules\casperjs\node_modules\phantomjs\lib\phantom ```` --- #The Website 1. Open SLN `.\ Casper.Mvc\Casper.Mvc.sln` 2. Hit CTRL + F5 3. For those who don't have VS then you can see the site at http://casper-testing.azurewebsites.net/ --- #Exercise 1 - Screen Grab Create a new file called grab.js ````javascript var casper = require('casper').create(); casper.start('http://www.wildesoft.net', function () { this.echo(this.getTitle()); }); casper.thenOpen('http://www.meetup.com/Smart-Devs-User-Group', function () { this.echo(this.getTitle()); this.capture("meetup.jpg"); }); casper.run(); ```` Now run:- ````bat $ casperjs grab.js ```` ````bat A Microsoft .net software development company Smart Devs User Group (Stretton Sugwas, England) - Meetup ```` Was a file called `meetup.jpg` created? --- #Exercise 1 - Screen Grab ## What did we just do?## * we created a new Casper instance * we started it and opened http://www.wildesoft.net * once the page has loaded, we printed the title of the webpage (the content of its `
` tag) * then we opened another url, http://www.meetup.com/Smart-Devs-User-Group * once the new page has loaded, we asked to print its title too * we then took a screen grab of the page * we executed the whole process ### How I found this useful... --- #Test 01 - Our first test Start the Visual Studio MVC project (CTRL + F5), then create a new file in your folder called `test01.js` ````javascript casper.test.begin('Home Page Tests', 3, function (test) { casper.start("http://localhost:43502", function () { test.assertTitle("Home - CasperJS Mvc"); test.assertTextExists("Casper MVC", "Casper MVC is present on page"); test.assertTextExists("Ariya Hidayat", "Ariya Hidayat is present on page"); }); casper.run(function () { test.done(); }); }); ```` Now run:- ````bat $ casperjs test test01.js ```` You should get 3 passing tests --- #Test 01 - Our first test ## What did we just do?## * notice that the test scripts are slightly different to scraping scripts * we do not need to create a new casper instance (allows us to chain tests) * we opened http://localhost:43502 * when the page loaded, we asserted the title was `Home - CasperJS Mvc` * we then asserted that two pieces of text existed * we ran the tests and informed CasperJS we were done --- #Test 02 - Navigation test ## TIP for Chrome users ###CSS Selector Tester Test your css selector by using this quick script [Css Selector Tester](https://chrome.google.com/webstore/detail/css-selector-tester/bbklnaodgoocmcdejoalmbjihhdkbfon) On the home page try out `````css ul > li:nth-child(2) > a ````` OR ````css a[href='/home/about'] ```` --- #Test 02 - Navigation test Create a new file called `test02.js` ````javascript casper.test.begin('Home and About Page', 4, function (test) { casper.start("http://localhost:43502/", function () { test.assertTitle("Home - CasperJS Mvc"); test.assertTextExists("Casper MVC", "Casper MVC is present on page"); }); casper.thenClick('ul > li:nth-child(2) > a', function () { test.assertUrlMatch(/home\/about/, "URL ends with home/about"); test.assertTitle("About - CasperJS Mvc"); }); casper.run(function () { test.done(); }); }); ```` Now run:- ````bat $ casperjs test test02.js ```` You should get 4 passing tests --- #Test 03 - Fill in a form Copy `\_test_template.js` and rename to `test03.js`, we want 5 tests for the contact form:- * start with `casper.start('http://localhost:43502/home/contact');` * assert the title is correct * assert the form exists * submit the form with just the name filled in * assert an error comes back * submit the form with an invalid email address * assert an error comes back * submit the form with an valid email address * assert we are showing the thank you page #### Spoiler alert... ````javascript // assert a selector exists test.assertExists('form[action="/home/contact"]'); // fill in a form, note use fillSelectors NOT deprecated fill this.fillSelectors('form', { "input[name='ContactName']": 'Richard Wilde' }, true); // waits for a selector after a button has been clicked casper.waitForSelector('#EmailAddress', ... ```` --- #Test 04 - UI Timings Copy `\_test_template.js` and rename to `test04.js`, we want to test the visibility of the modal window:- * start with `casper.start('http://localhost:43502/Timings');` * assert button exists * click the button * capture the screen * assert modal window is visible #### Spoiler alert... ````javascript // does a selector exist? test.assertExists("button#btnModal", "Launch button is shown"); // lets wait for some milliseconds... casper.wait(10, ... // is a selector visible? test.assertVisible("#myModal"); ```` --- #Test 05 - Evaluate Copy `\_test_template.js` and rename to `test05.js`, we want to test the modal window:- * start with `http://localhost:43502/Evaluate` * change the dropdown list to `United Kingdom` * assert the text exists `Selected country code: UK` * change the dropdown list to `Spain` * assert the text exists `Selected country code: ES` #### Spoiler alert... ````javascript // run some javacript/jquery code casper.thenEvaluate(... ```` You should get 2 passing tests --- #Test 06 - Looping Copy `\_test_template.js` and rename to `test06.js`, we want to test the wizard:- * set up an array of 50 integers * start with `http://localhost:43502/wizard/index/1` * loop through array * assert title is `Wizard Step: **i** - CasperJS Mvc * submit form without filling in field * assert validation message is shown * submit form with any answer * assert finished page is shown #### Spoiler alert... ````javascript // should the loop be inside a casper function? casper.then ... loop.forEach(function (item) ... ```` You should get 101 passing tests --- #and finally... - ##Run all tests in a directory ````bat $ casperjs test ./tests/test.samples ```` --- #If you have time ##Check out the page object pattern... ````bat casperjs --baseUrl="http://localhost:43502" test ./tests/page.object.pattern/tests ```` - https://code.google.com/p/selenium/wiki/PageObjects - http://martinfowler.com/bliki/PageObject.html ``Within your web app's UI there are areas that your tests interact with. A Page Object simply models these as objects within the test code. This reduces the amount of duplicated code and means that if the UI changes, the fix need only be applied in one place`` --- #Check out these useful tools * ####Resurretco (chrome extension) - Resurrectio is a Chrome extension allowing to record a sequence of browser actions and to produce the corresponding CasperJS script - https://github.com/ebrehault/resurrectio * ####CSS Selector Tester (chrome extension) - Test your css selector by using this quick script - http://tinyurl.com/chrome-css-selector * ####Page Object Pattern - http://jsebfranck.blogspot.co.uk/2014/03/page-object-pattern-with-casperjs.html --- class: center, middle #Thanks ##Hope you found it useful Ask me questions on twitter @rippo


Connecting a Push Switch
Problem
You want to connect a switch to your Raspberry Pi so that when you press it, some Python code is run.
Solution
Connect a switch to a GPIO pin and use the RPi.GPIO library in your Python program to detect the button press.
To make this recipe, you will need:
-
Breadboard and jumper wires (see “Prototyping Equipment”)
-
Tactile push switch (see “Miscellaneous”)
shows how to connect a tactile push switch, using a breadboard and jumper wires.
Open an editor (nano or IDLE) and paste in the following code. As with all the program examples in this book, you can also download the program from the Code section of the Raspberry Pi Cookbook website, where it is called switch.py.
This example code displays a message when the button is pressed:
import
RPi.GPIO
as
GPIO
import
time
GPIO
.
setmode
(
GPIO
.
BCM
)
GPIO
.
setup
(
18
,
GPIO
.
IN
,
pull_up_down
=
GPIO
.
PUD_UP
)
while
True
:
input_state
=
GPIO
.
input
(
18
)
if
input_state
==
False
:
(
'Button Pressed'
)
time
.
sleep
(
0.2
)
You will need to run the program as superuser:
pi@raspberrypi ~ $ sudo python switch.py Button Pressed Button Pressed Button Pressed Button Pressed
Discussion
You will notice that the switch is wired so that when it is pressed, it will connect pin 18 configured as an input to GND. The input pin is normally pulled up to 3.3V by the optional argument pull_up_down=GPIO.PUD_UP
in GPIO.setup
. This means that when you read the input value using GPIO.input
, False
will be returned if the button is pressed. This is a little counterintuitive.
Each GPIO pin has software configurable pull-up and pull-down resistors. When using a GPIO pin as an input, you can configure these resistors so that one or either or neither of the resistors is enabled, using the optional pull_up_down
parameter to GPIO.setup
. If this parameter is omitted, then neither resistor will be enabled. This leaves the input floating, which means that its value cannot be relied upon and it will drift between high and low depending on what it picks up in the way of electrical noise.
If it is set to GPIO.PUD_UP
, the pull-up resistor is enabled; if it is set to GPIO.PUD_DOWN
, the pull-down resistor is enabled.
You might expect the push switch to have just two connections, which are either open or closed. While some of these tactile push switches do have just two connections, most have four. shows how these connections are arranged.
Actually, there are only really two electrical connections, because inside the switch package pins B and C are connected together, as are A and D.
See Also
For more information on using a breadboard and jumper wires with the Raspberry Pi, see “Using a Breadboard with Jumper Leads”.
To use a switch to trigger an interrupt, see “Programming with Interrupts”.
To debounce a switch, see “Debouncing a Button Press”.
To use external pull-up or pull-down resistors, see “Using an External Pull-up Resistor”.


Arthur
Web designer
Learn More About Me
I've HTML/CSS, PHP, PHYTON AND JAVA knowledge
My Skills
I enjoy writing front-end code with these technologies
HTML
CSS
PHP
Welcome to the HTML Portfolio Project


Package ml.learning
Class SARSA
- java.lang.Object
-
- ml.learning.SARSA
-
- All Implemented Interfaces:
java.io.Serializable
public class SARSA extends java.lang.Object implements java.io.Serializable
The main implementation of the SARSA learning algorithm.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SARSA(UnitClassification unitClass, StateSpaceManager spaceManager)
Initializes the SARSA learning algorithm, creates/loads the DataManager, sets the StateSpaceManager, and creates a new QTable from the set of possible States and Actions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
computerQValue(State current, Action action, State next, double reward)
Computes the Q-Value for SARSA which requires the current State, Action executed, next State, and reward.UnitClassification
getClassification()
Gets the type of unit the SARSA learning algorithm is working with.DataManager
getDataManager()
Gets the DataManager being used by the SARSA learning algorithm.QTable
getQTable()
Gets the QTable being used by the SARSA learning algorithm.StateSpaceManager
getSpaceManager()
Gets the StateSpaceManager being used by the SARSA learning algorithm.void
loadDataManager()
Attempts to load the DataManager from disk.void
loadQTable()
Attempts to load the QTable from disk.void
storeDataManager()
Attempts to store the DataManager to disk.void
storeQTable()
Attempts to store the QTable to disk.void
updateQTable(State current, Action action, State next)
Updates the QTable with the resulting Q-Value produced from the (current, action, next) tuple.
-
-
-
Constructor Detail
-
SARSA
public SARSA(UnitClassification unitClass, StateSpaceManager spaceManager)
Initializes the SARSA learning algorithm, creates/loads the DataManager, sets the StateSpaceManager, and creates a new QTable from the set of possible States and Actions.- Parameters:
unitClass
- the units classification as one of the following: Melee, RangedspaceManager
- the StateSpaceManager.
-
-
Method Detail
-
computerQValue
public double computerQValue(State current, Action action, State next, double reward)
Computes the Q-Value for SARSA which requires the current State, Action executed, next State, and reward. This uses the following update function: Q(s_(t), a_(t)) = Q(s_(t), a_(t)) + a * [r_(t) + g * Q(s_(t+1), a_(t+1)) - Q(s_(t), a_(t)] Where the terms are defined as the following: Q(s, a): the Q-Value function that returns a Q-Value for a (State, Action) pair. s_(t): the State at time step t. a_(t): the Action at time step t. a: the learning rate (alpha). r_(t): the reward received at time step t. g: the discount factor (gamma).- Parameters:
current
- the current State.action
- the Action executed in the current State.next
- the resulting next State from the (current, action) pair.reward
- the reward produced from executing the current Action in the current State.- Returns:
- A double which is the resulting Q-Value produced by the defined update function.
-
updateQTable
public void updateQTable(State current, Action action, State next)
Updates the QTable with the resulting Q-Value produced from the (current, action, next) tuple. This method calculates the produced reward and Q-Value then puts the Q-Value into the (State, (Action, double)) map.- Parameters:
current
- the current State.action
- the Action executed in the current State.next
- the resulting next State.
-
loadQTable
public void loadQTable()
Attempts to load the QTable from disk.
-
storeQTable
public void storeQTable()
Attempts to store the QTable to disk.
-
loadDataManager
public void loadDataManager()
Attempts to load the DataManager from disk.
-
storeDataManager
public void storeDataManager()
Attempts to store the DataManager to disk.
-
getClassification
public UnitClassification getClassification()
Gets the type of unit the SARSA learning algorithm is working with.- Returns:
- The classification of the unit we are working with
-
getQTable
public QTable getQTable()
Gets the QTable being used by the SARSA learning algorithm.- Returns:
- The QTable.
-
getSpaceManager
public StateSpaceManager getSpaceManager()
Gets the StateSpaceManager being used by the SARSA learning algorithm.- Returns:
- The StateSpaceManager.
-
getDataManager
public DataManager getDataManager()
Gets the DataManager being used by the SARSA learning algorithm.- Returns:
- The DataManager.
-
-