Quick reference for the pyboard¶
The below pinout is for PYBv1.1. You can also view pinouts for other versions of the pyboard: PYBv1.0 or PYBLITEv1.0-AC or PYBLITEv1.0.
Below is a quick reference for the pyboard. If it is your first time working with this board please consider reading the following sections first:
General board control¶
See pyb
.
import pyb
pyb.repl_uart(pyb.UART(1, 9600)) # duplicate REPL on UART(1)
pyb.wfi() # pause CPU, waiting for interrupt
pyb.freq() # get CPU and bus frequencies
pyb.freq(60000000) # set CPU freq to 60MHz
pyb.stop() # stop CPU, waiting for external interrupt
Delay and timing¶
Use the time
module:
import time
time.sleep(1) # sleep for 1 second
time.sleep_ms(500) # sleep for 500 milliseconds
time.sleep_us(10) # sleep for 10 microseconds
start = time.ticks_ms() # get value of millisecond counter
delta = time.ticks_diff(time.ticks_ms(), start) # compute time difference
Internal LEDs¶
See pyb.LED.
from pyb import LED
led = LED(1) # 1=red, 2=green, 3=yellow, 4=blue
led.toggle()
led.on()
led.off()
# LEDs 3 and 4 support PWM intensity (0-255)
LED(4).intensity() # get intensity
LED(4).intensity(128) # set intensity to half
Internal switch¶
See pyb.Switch.
from pyb import Switch
sw = Switch()
sw.value() # returns True or False
sw.callback(lambda: pyb.LED(1).toggle())
Pins and GPIO¶
See pyb.Pin.
from pyb import Pin
p_out = Pin('X1', Pin.OUT_PP)
p_out.high()
p_out.low()
p_in = Pin('X2', Pin.IN, Pin.PULL_UP)
p_in.value() # get value, 0 or 1
Servo control¶
See pyb.Servo.
from pyb import Servo
s1 = Servo(1) # servo on position 1 (X1, VIN, GND)
s1.angle(45) # move to 45 degrees
s1.angle(-60, 1500) # move to -60 degrees in 1500ms
s1.speed(50) # for continuous rotation servos
External interrupts¶
See pyb.ExtInt.
from pyb import Pin, ExtInt
callback = lambda e: print("intr")
ext = ExtInt(Pin('Y1'), ExtInt.IRQ_RISING, Pin.PULL_NONE, callback)
Timers¶
See pyb.Timer.
from pyb import Timer
tim = Timer(1, freq=1000)
tim.counter() # get counter value
tim.freq(0.5) # 0.5 Hz
tim.callback(lambda t: pyb.LED(1).toggle())
RTC (real time clock)¶
See pyb.RTC
from pyb import RTC
rtc = RTC()
rtc.datetime((2017, 8, 23, 1, 12, 48, 0, 0)) # set a specific date and time
rtc.datetime() # get date and time
PWM (pulse width modulation)¶
from pyb import Pin, Timer
p = Pin('X1') # X1 has TIM2, CH1
tim = Timer(2, freq=1000)
ch = tim.channel(1, Timer.PWM, pin=p)
ch.pulse_width_percent(50)
ADC (analog to digital conversion)¶
from pyb import Pin, ADC
adc = ADC(Pin('X19'))
adc.read() # read value, 0-4095
DAC (digital to analog conversion)¶
from pyb import Pin, DAC
dac = DAC(Pin('X5'))
dac.write(120) # output between 0 and 255
UART (serial bus)¶
See pyb.UART.
from pyb import UART
uart = UART(1, 9600)
uart.write('hello')
uart.read(5) # read up to 5 bytes
SPI bus¶
See pyb.SPI.
from pyb import SPI
spi = SPI(1, SPI.MASTER, baudrate=200000, polarity=1, phase=0)
spi.send('hello')
spi.recv(5) # receive 5 bytes on the bus
spi.send_recv('hello') # send and receive 5 bytes
I2C bus¶
Hardware I2C is available on the X and Y halves of the pyboard via I2C('X')
and I2C('Y')
. Alternatively pass in the integer identifier of the peripheral,
eg I2C(1)
. Software I2C is also available by explicitly specifying the
scl
and sda
pins instead of the bus name. For more details see
machine.I2C.
from machine import I2C
i2c = I2C('X', freq=400000) # create hardware I2c object
i2c = I2C(scl='X1', sda='X2', freq=100000) # create software I2C object
i2c.scan() # returns list of slave addresses
i2c.writeto(0x42, 'hello') # write 5 bytes to slave with address 0x42
i2c.readfrom(0x42, 5) # read 5 bytes from slave
i2c.readfrom_mem(0x42, 0x10, 2) # read 2 bytes from slave 0x42, slave memory 0x10
i2c.writeto_mem(0x42, 0x10, 'xy') # write 2 bytes to slave 0x42, slave memory 0x10
Note: for legacy I2C support see pyb.I2C.


--- title: My Tutorials layout: tutorials og_image: /static/images/indian-pythonista.png og_description: Awesome tutorials by Indian Pythonista ---
A beginners guide to curses in Python to create interactive terminal applications
4 videos
A step by step tutorial on creating a conversational chatbot for WhatsApp using Twilio and Python
4 videos
Learn how to discover & explore hidden web APIs with Python
3 videos
A comprehensive guide for learning regular expressions using Python
17 videos
A brief yet comprehensive introduction of basic Python libraries required for Data Science.
32 videos
In this step-by-step video series, you’ll learn how to create a Python package for your project and how to publish it to PyPI, the Python Package Repository.
4 videos
Learn how to setup and use YouTube Data API for interesting use cases.
7 videos
Learn how to implement Concurrent Programming in Python using async/await and asyncio.
4 videos
Learn all about multiprocessing in Python.
11 videos
Learn basics of multithreading in Python
3 videos
Dataclasses are a recent addition to the Python Standard Library since Python 3.7.0. This comprehensive video series discusses various concepts related to dataclasses in detail.
6 videos
A comprehensive introduction to decorators in Python.
5 videos
This video series is all about understanding what happens behind the scenes in Python
5 videos
This video series covers various intermediate concepts related to Python Programming Language.
40+ videos


'that night i swallowed 180mg of MDMA and roamed around, later consuming approximately 25-35mg of 2cb, then later consuming 50mg more of MDMA.'
That is a quote from my notes concerning my 1998 trip to Burning Man. It should be noted that for most people, a figure along the lines of '25-35mg of 2cb' would not be acceptable. The situation at Burning Man that year was rather insane (as it is every year, presumably), and at one point, someone had a capsule containing 2C-B which she wanted to split, but without easy access to a milligram scale, she decided to simply split it by eyeballing it and handing me the other half of the capsule, with an indeterminate amount of powder in it. I already had a measured amount with me, and since for me, a good dose of 2C-B starts at 50mg anyway, I decided to swallow it.
I think a fair amount has already been written about the MDMA / 2C-B combination, but what I wanted to add here was the slight modification of boosting with an additional amount of MDMA at the very end, when the 2C-B is wearing off. This was such an amazing and delightful way to sail back into home base. The MDMA initially had been a very profound experience; I had gone out to a piece of installation art that I had helped create, and encountered some people there; our conversation was remarkable, and I left feeling as though I was truly part of something dense and wonderful. As the 2C-B came on, I wound up spending at least an hour and a half completely alone, sitting underneath the Man itself and pondering any number of amazing things. And then, as the sun came up, I took that last boost of MDMA and went on a bike ride around the camp. By the time I got back home, I was exhausted by my many efforts that night and slept peacefully.
Although I have yet to try this again in a non-crazy-art-festival environment, I think if a person has no particular problem with the physical side effects of MDMA (speediness, jaw clenching, etc.), this technique can be used to good effect. 180mg was a high initial starting dose, which is something I occasionally do if I really want to hit the experience full on, but adding the additional 50mg after the 2C-B was not particularly additive in terms of physical side effects, as the initial dose had clearly worn off by then. As ever, your mileage may vary.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Fullname: {{pet.fullName}}
Kind: {{pet.kind}}
Appointment Time: {{pet.appointmentTime}}
No appointment
Owner's name: {{pet.ownerId.fullName}}
No owner


Choose from a wide variety of videos
A wide variety of music
A wide variety of games.
Connect with friends and family
Explore the world!
Browse the internet.


EduWiz is a student management and record-keeping tool which can be used by any educational institute. Follow the links below for more details.
Sign Up!Student Login »


public interface UserDAO
User
.
This interface defines methods which are expected to be
implementd by a specific data access driver. The intention is
to provide all functionality needed to update, insert, delete and
select some specific data.| Modifier and Type | Method and Description |
|---|---|
int |
addNew(User user)
Adds a new User.
|
void |
addNewWithId(User user)
Adds a new user with a predefined user id
(added by Pieter for external login support)
|
void |
addToGroup(int userId,
int[] groupId)
Associate the user to the group
|
void |
decrementPosts(int userId)
Decrement the number of posts of some user.
|
void |
delete(int userId)
Deletes an user.
|
User |
findByEmail(String email)
Finds a user by its email address
|
List |
findByName(String input,
boolean exactMath)
Finds an user by matching an input string.
|
User |
getLastUserInfo()
Gest some piece of information of the last user registered
|
int |
getTotalUsers()
Gets the total number of users
|
int |
getTotalUsersByGroup(int groupId)
Gets the total number of users of some group.
|
String |
getUserAuthHash(int userId)
Retrieves the auth hash from the database
|
String |
getUsernameByEmail(String email)
Gets the username related to the email
|
boolean |
hasUsernameChanged(int userId,
String usernameToCheck)
Check if the username passed as argument is different of
the username existent in the database.
|
void |
incrementPosts(int userId)
Increments the number of posts of the user.
|
boolean |
isDeleted(int user_id)
whether the user is locked or not.
|
boolean |
isUsernameRegistered(String username)
Checks the existence of some username.
|
List |
pendingActivations()
Returns a list of users that haven't yet activated their accounts
|
void |
removeFromGroup(int userId,
int[] groupId)
Remove the user from the group
|
void |
saveNewPassword(String password,
String email)
Writes a new password for the user.
|
void |
saveUserAuthHash(int userId,
String hash)
Saves the user-specific security hash to the database
|
List |
selectAll()
Gets all users
|
List |
selectAll(int startFrom,
int count)
Gets all users
|
List |
selectAllByGroup(int groupId,
int start,
int count)
Gets all users from a specific group.
|
List |
selectAllWithKarma()
Gets all users with your Karma.
|
List |
selectAllWithKarma(int startFrom,
int count)
Gets all users
|
User |
selectById(int userId)
Gets a specific
User . |
User |
selectByName(String username)
Gets a specific
User . |
void |
setActive(int userId,
boolean active)
Set the active status.
|
void |
setRanking(int userId,
int rankingId)
Sets the ranking.
|
void |
undelete(int userId)
Undeletes an user.
|
void |
update(User user)
Updates a user.
|
void |
updateUsername(int userId,
String username)
Updates only the username.
|
boolean |
validateActivationKeyHash(int userId,
String hash)
Validate if the activated key matches the one in the database
|
User |
validateLogin(String username,
String password)
Validates the user login.
|
boolean |
validateLostPasswordHash(String email,
String hash)
Validate the provided security hash against the data stored in our system.
|
void |
writeLostPasswordHash(String email,
String hash)
Stores the "lost password" security hash, that was generated
when the user asked the system to get a reminder of his password.
|
void |
writeUserActive(int userId)
Set user account to active
|
User selectById(int userId)
User
.userId
- The User ID to searchUser
object containing all the informationselectAll()
User selectByName(String username)
User
.username
- The User name to searchUser
object containing all the information
or null
if no data was found.selectAll()
List selectAll()
ArrayList
with the users. Each entry is an User
objectList selectAllWithKarma()
List
with the users. Each entry is an User
object
(with the KarmaStatus populated).List selectAllByGroup(int groupId, int start, int count)
groupId
- The group idstart
- The index position to start fetchingcount
- The total number of records to fetchList
with the users. Each entry is an User
objectList selectAllWithKarma(int startFrom, int count)
startFrom
- Index to start fetching fromcount
- Number of records to retrieveArrayList
with the users. Each entry is an User
object
(with the KarmaStatus populated).List findByName(String input, boolean exactMath)
input
- The username to search. May be part of the username.
The method will match all users who have the input string as
part of their usernames.exactMath
- Set to true
to get the user data related to
the username passed as argument, and set it to false
to
search all users who match the criteria.List
with the found users. Each entry is an
User
object, where only the id and username
members are filled.List selectAll(int startFrom, int count)
startFrom
- Index to start fetching fromcount
- Number of records to retrieveArrayList
with the users. Each entry is an User
objectvoid delete(int userId)
userId
- The user ID to deleteundelete(int)
void undelete(int userId)
delete(int)
the user isn't fisically deleted of the
database, but just marked as deleted. This is done to ensure
data integrity.userId
- The user ID to undeletedelete(int)
void update(User user)
user
- Reference to a User
object to updateint addNew(User user)
user.setId(theNewId);
, as well
return the new user id.user
- Reference to a valid and configured User
objectvoid addNewWithId(User user)
user
- Reference to a valid and configured User
object, with the user id already setvoid setActive(int userId, boolean active)
userId
- The user ID to change the statusactive
- true
or false
void setRanking(int userId, int rankingId)
userId
- The user IDrankingId
- intvoid incrementPosts(int userId)
userId
- The user ID to increment the number of postsvoid decrementPosts(int userId)
userId
- The user ID do decrement the number of posts.User getLastUserInfo()
HashMap
containing the information. The map
has two keys:int getTotalUsers()
int getTotalUsersByGroup(int groupId)
groupId
- The group idboolean isDeleted(int user_id)
user_id
- intboolean isUsernameRegistered(String username)
username
- The username to verifytrue
or false
, if the user was found or not, respectivelyUser validateLogin(String username, String password)
username
- The usernamepassword
- The passwordnull
if the information was invalidvoid addToGroup(int userId, int[] groupId)
userId
- The user idgroupId
- The group id to associate tovoid removeFromGroup(int userId, int[] groupId)
userId
- The user idgroupId
- The group id to remove the user fromvoid writeLostPasswordHash(String email, String hash)
email
- The user emailhash
- The hash to store.boolean validateLostPasswordHash(String email, String hash)
email
- The user emailhash
- The supplied security hashtrue
if the data matches ok, of false
if it is invalidvoid saveNewPassword(String password, String email)
password
- The new passwordemail
- The user emailString getUsernameByEmail(String email)
email
- The email to search for the usernameString
boolean validateActivationKeyHash(int userId, String hash)
userId
- Which user to validate the activation key?hash
- The activation keytrue
if the data matches ok, of false
if it is invalidvoid writeUserActive(int userId)
userId
- Which user account to set active?void updateUsername(int userId, String username)
net.jforum.drivers.external.LoginAuthenticator
to
update usernames which changed in the external source and therefore
should be updated in jforum's users table.userId
- The user's id related to the username to updateusername
- The new username to writeboolean hasUsernameChanged(int userId, String usernameToCheck)
userId
- The user's id to work withusernameToCheck
- The username to compare with the existing
one in jforum_userstrue
if the usernames are different.void saveUserAuthHash(int userId, String hash)
userId
- the user id to savehash
- the security hashString getUserAuthHash(int userId)
userId
- inttList pendingActivations()
JForum by JForum Team - http://www.jforum.net/team.jsp - (c) JForum Team


This screen allows you to configure the JVM options used when starting ZAP.
The option was added so that the Java maximum memory allocation pool size can be set,
which is of the form: -Xmxn where n is the size in bytes.
Good values for this field could be:
Unlike the other ZAP options these are held in the file .ZAP_JVM.properties
in the user's default ZAP directory,
which depends on the OS being used, for example:
Windows Notes: These options are not used when starting ZAP via the executable. The directory where the file .ZAP_JVM.properties
is located depends on the environment variable %USERPROFILE%
.
Generally max should be close to -Xmx (if specified). However, the following behavior was observed during testing under Java 8 on Windows OS.
-Xmx512m was specified (which should calculate out to ~488MiB), however, 455.5MiB was displayed.
-Xms512m -Xmx512m was specified, however, 475MiB was displayed.
-XX:+AlwaysPreTouch -Xms512m -Xmx512m, and 474.5MiB was displayed.
So it seems the JVM does some calculation/manipulation at execution which may mean that the results may not align as expected for the options the user inputs (this is a JVM issue, not a ZAP issue).
| UI Overview | for an overview of the user interface | |
| Options dialogs | for details of the other Options dialog screens |
| Java 8 options |


Lexer Error
$parse
Lexer Error: {0} at column{1} in expression [{2}].
Occurs when an expression has a lexical error, for example a malformed number (0.5e-) or an invalid unicode escape.
The error message contains a more precise error.
To resolve, learn more about Angular expressions, identify the error and fix the expression's syntax.


1
2
3
4
5
- When you shouldn't is exactly when you really should
- Waves
- Arvo
- Lunatique
- Flamingo Around
- Flamingo Ahead
- Serar
- Mndlss Fckdll
- Annie Bass
- Coboara Bach
- It's about a jacket, relax
- When you shouldn't is exactly when you really should
- Waves
- Arvo
- Lunatique
- Flamingo Around
- Flamingo Ahead
- Serar
- Mndlss Fckdll
- Annie Bass
- Coboara Bach
- It's about a jacket, relax
- When you shouldn't is exactly when you really should
- Waves
- Arvo
- Lunatique
- Flamingo Around
- Flamingo Ahead
- Serar
- Mndlss Fckdll
- Annie Bass
- Coboara Bach
- It's about a jacket, relax
- When you shouldn't is exactly when you really should
- Waves
- Arvo
- Lunatique
- Flamingo Around
- Flamingo Ahead
- Serar
- Mndlss Fckdll
- Annie Bass
- Coboara Bach
- It's about a jacket, relax
- When you shouldn't is exactly when you really should
- Waves
- Arvo
- Lunatique
- Flamingo Around
- Flamingo Ahead
- Serar
- Mndlss Fckdll
- Annie Bass
- Coboara Bach
- It's about a jacket, relax
- If I jump off the balcony, I wouldn't die, I would fly


Formula text:
Save file
Save
Load file
Selected objects:
Multi use:
Recording:
<%= require('./help.md').default %>


{% load future %}
Django Merchant Demo | Agiliq
Django Merchant
Card
Authorize
Eway
Paypal
Braintree Payments (S2S)
Stripe Payment
Paylane
WePay
Beanstream
Chargebee
Offsite
Authorize.Net DPM
Paypal
WorldPay
Amazon FPS
Braintree Payments (TR)
Stripe
eWAY
Ogone
Others
Bitcoin
django-merchant on GitHub
Payment Form
{% block content %} {% endblock %}


Features
For Students...
Create Tickets
Have a tech issue? Got a question about your ISA? Are your build week teamates not responding to your messages? create a ticket to let helpers know what's going on.
View Tickets
Equipment Issue
Hey can I get some help with...
View other students tickets to see problems other students like you are having. Your issue might have been resolved already!
For Helpers...
View Tickets
Equipment Issue
Hey can I get some help with...
View tickets submitted by students about the problems they have. You can sort them by issue type, date posted, and issue urgency.
Assign Tickets
Assign the right person to the task. Think this might be an HR problem? Assign it to them! Is this a quick issue you could solve yourself? Hop on it!
Ressolve Issues
Your issue has been resolved
Get to work on that task! Once it's done you can mark it as complete. If the student feels it wasn't fully completed you can re-open it and finish up the rest.


Ideas for using readxl to increase reproducibiliy and reduce tedium.
Reproducibility is much easier in theory than in reality. Here are some special dilemmas we face with spreadsheets:
.xls[x]
file, we’re in a pickle. The .xls[x]
file should obviously be preserved, and probably write-protected. But a faithful copy as CSV is a wonderful complement, as long as you can ensure the two are the same..csv
). readxl helps you get data directly out of a spreadsheet and into R, where you can record every step of your analysis as code. Below we show how to cache a CSV snapshot as part of this process.The examples below also demonstrate the use of functional programming or “apply” techniques to iterate over the worksheets in a workbook.
We load the tidyverse metapackage here because the workflows below show readxl working with readr, purrr, etc. See the last section for solutions using base R only (other than readxl).
We must load readxl explicitly because it is not part of the core tidyverse.
library(tidyverse)
#> + ggplot2 2.2.1 Date: 2017-05-15
#> + tibble <IP_ADDRESS>02 R: 3.3.2
#> + tidyr <IP_ADDRESS>00 OS: OS X El Capitan 10.11.6
#> + readr 1.1.0 GUI: X11
#> + purrr <IP_ADDRESS> Locale: en_CA.UTF-8
#> + dplyr <IP_ADDRESS>04 TZ: America/Vancouver
#> + stringr 1.2.0
#> + forcats 0.2.0
#> Conflicts -----------------------------------------------------------------
#> * filter(), from dplyr, masks stats::filter()
#> * lag(), from dplyr, masks stats::lag()
library(readxl)
Break analyses into logical steps, via a series of scripts that relate to one theme, such as “clean the data” or “make exploratory and diagnostic plots”.
This forces you to transmit info from step i to step i + 1 via a set of output files. The cumulative outputs of steps 1, 2, …, i are available as inputs for steps i + 1 and beyond.
These outputs constitute an API for your analysis, i.e. they provide clean entry points that can be used (and understood) in isolation, possibly using an entirely different toolkit. Contrast this with the alternative of writing one monolithic script or transmitting entire workspaces via save()
, load()
, and R-specific .rds
files.
If raw data is stored only as an Excel spreadsheet, this limits your ability to inspect it when solving the little puzzles that crop up in dowstream work. You’ll need to fire up Excel (or similar) and get busy with your mouse. You certainly can’t poke around it or view diffs on GitHub.
Solution: cache a CSV snapshot of your raw data tables at the time of export. Even if you use read_excel()
for end-to-end reproducibility, this complementary CSV leaves your analysis in a more accessible state.
Pipe the output of read_excel()
directly into readr::write_csv()
like so:
iris_xl <- readxl_example("datasets.xlsx") %>%
read_excel(sheet = "iris") %>%
write_csv("iris-raw.csv")
Why does this work? readr::write_csv()
is a well-mannered “write” function: it does its main job and returns its input invisibly. The above command reads the iris sheet from readxl’s datasets.xlsx
example workbook and caches a CSV version of the resulting data frame to file.
Let’s check. Did we still import the data? Did we write the CSV file?
iris_xl
#> # A tibble: 150 x 5
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> <dbl> <dbl> <dbl> <dbl> <chr>
#> 1 5.1 3.5 1.4 0.2 setosa
#> 2 4.9 3.0 1.4 0.2 setosa
#> 3 4.7 3.2 1.3 0.2 setosa
#> # ... with 147 more rows
dir(pattern = "iris")
#> [1] "iris-raw.csv"
Yes! Is the data written to CSV an exact copy of what we imported from Excel?
iris_alt <- read_csv("iris-raw.csv")
#> Parsed with column specification:
#> cols(
#> Sepal.Length = col_double(),
#> Sepal.Width = col_double(),
#> Petal.Length = col_double(),
#> Petal.Width = col_double(),
#> Species = col_character()
#> )
## readr leaves a note-to-self in `spec` that records its column guessing,
## so we remove that attribute before the check
attr(iris_alt, "spec") <- NULL
identical(iris_xl, iris_alt)
#> [1] TRUE
Yes! If we needed to restart or troubleshoot this fictional analysis, iris-raw.csv
is available as a second, highly accessible alternative to datasets.xlsx
.
Some Excel workbooks contain only data and you are tempted to ask “Why, God, why is this data stored in Excel? Why not store this as a series of CSV files?” One possible answer is this: because the workbook structure keeps them all together.
Let’s accept that this happens and that it is not entirely crazy. How can you efficiently load all of that into R?
Here’s how to load all the sheets in a workbook into a list of data frames:
purrr::map()
to iterate sheet reading.path <- readxl_example("datasets.xlsx")
path %>%
excel_sheets() %>%
set_names() %>%
map(read_excel, path = path)
#> $iris
#> # A tibble: 150 x 5
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> <dbl> <dbl> <dbl> <dbl> <chr>
#> 1 5.1 3.5 1.4 0.2 setosa
#> 2 4.9 3.0 1.4 0.2 setosa
#> 3 4.7 3.2 1.3 0.2 setosa
#> # ... with 147 more rows
#>
#> $mtcars
#> # A tibble: 32 x 11
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
#> 2 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
#> 3 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
#> # ... with 29 more rows
#>
#> $chickwts
#> # A tibble: 71 x 2
#> weight feed
#> <dbl> <chr>
#> 1 179 horsebean
#> 2 160 horsebean
#> 3 136 horsebean
#> # ... with 68 more rows
#>
#> $quakes
#> # A tibble: 1,000 x 5
#> lat long depth mag stations
#> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 -20.42 181.62 562 4.8 41
#> 2 -20.62 181.03 650 4.2 15
#> 3 -26.00 184.10 42 5.4 43
#> # ... with 997 more rows
What if we want to read all the sheets in at once and simultaneously cache to CSV? We define read_then_csv()
as read_excel(...) %>% write_csv()
and use purrr::map()
again.
read_then_csv <- function(sheet, path) {
pathbase <- path %>%
basename() %>%
tools::file_path_sans_ext()
path %>%
read_excel(sheet = sheet) %>%
write_csv(paste0(pathbase, "-", sheet, ".csv"))
}
We could even define this on-the-fly as an anonymous function inside map()
, but I think this is more readable.
path <- readxl_example("datasets.xlsx")
path %>%
excel_sheets() %>%
set_names() %>%
map(read_then_csv, path = path)
#> $iris
#> # A tibble: 150 x 5
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> <dbl> <dbl> <dbl> <dbl> <chr>
#> 1 5.1 3.5 1.4 0.2 setosa
#> 2 4.9 3.0 1.4 0.2 setosa
#> 3 4.7 3.2 1.3 0.2 setosa
#> # ... with 147 more rows
#>
#> $mtcars
#> # A tibble: 32 x 11
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
#> 2 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
#> 3 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
#> # ... with 29 more rows
#>
#> $chickwts
#> # A tibble: 71 x 2
#> weight feed
#> <dbl> <chr>
#> 1 179 horsebean
#> 2 160 horsebean
#> 3 136 horsebean
#> # ... with 68 more rows
#>
#> $quakes
#> # A tibble: 1,000 x 5
#> lat long depth mag stations
#> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 -20.42 181.62 562 4.8 41
#> 2 -20.62 181.03 650 4.2 15
#> 3 -26.00 184.10 42 5.4 43
#> # ... with 997 more rows
dir(pattern = "^datasets.*\\.csv$")
#> [1] "datasets-chickwts.csv" "datasets-iris.csv" "datasets-mtcars.csv"
#> [4] "datasets-quakes.csv"
In a real analysis, starting with workbook "foo.xlsx"
, you might want to create the directory foo
and place the CSVs inside that.
What if the datasets found on different sheets have the same variables? Then you’ll want to row-bind them, after import, to form one big, beautiful data frame.
readxl ships with an example sheet deaths.xlsx
, containing data on famous people who died in 2016 or 2017. It has two worksheets named “arts” and “other”, but the spreadsheet layout is the same in each and the data tables have the same variables, e.g., name and date of death.
The map_df()
function from purrr makes it easy to iterate over worksheets and glue together the resulting data frames, all at once.
purrr::map_df()
to import the data, create an ID variable for the source worksheet, and row bind.path <- readxl_example("deaths.xlsx")
deaths <- path %>%
excel_sheets() %>%
set_names() %>%
map_df(~ read_excel(path = path, sheet = .x, range = "A5:F15"), .id = "sheet")
print(deaths, n = Inf)
#> # A tibble: 20 x 7
#> sheet Name Profession Age `Has kids` `Date of birth`
#> <chr> <chr> <chr> <dbl> <lgl> <dttm>
#> 1 arts David Bowie musician 69 TRUE 1947-01-08
#> 2 arts Carrie Fisher actor 60 TRUE 1956-10-21
#> 3 arts Chuck Berry musician 90 TRUE 1926-10-18
#> 4 arts Bill Paxton actor 61 TRUE 1955-05-17
#> 5 arts Prince musician 57 TRUE 1958-06-07
#> 6 arts Alan Rickman actor 69 FALSE 1946-02-21
#> 7 arts Florence Henderson actor 82 TRUE 1934-02-14
#> 8 arts Harper Lee author 89 FALSE 1926-04-28
#> 9 arts Zsa Zsa Gábor actor 99 TRUE 1917-02-06
#> 10 arts George Michael musician 53 FALSE 1963-06-25
#> 11 other Vera Rubin scientist 88 TRUE 1928-07-23
#> 12 other Mohamed Ali athlete 74 TRUE 1942-01-17
#> 13 other Morley Safer journalist 84 TRUE 1931-11-08
#> 14 other Fidel Castro politician 90 TRUE 1926-08-13
#> 15 other Antonin Scalia lawyer 79 TRUE 1936-03-11
#> 16 other Jo Cox politician 41 TRUE 1974-06-22
#> 17 other Janet Reno lawyer 78 FALSE 1938-07-21
#> 18 other Gwen Ifill journalist 61 FALSE 1955-09-29
#> 19 other John Glenn astronaut 95 TRUE 1921-07-28
#> 20 other Pat Summit coach 64 TRUE 1952-06-14
#> # ... with 1 more variables: `Date of death` <dttm>
Note the use of range = "A5:E15"
here. deaths.xlsx
is a typical spreadsheet and includes a few non-data lines at the top and bottom and this argument specifies where the data rectangle lives.
All at once now:
Even though the worksheets in deaths.xlsx
have the same layout, we’ll pretend they don’t and specify the target rectangle in two different ways here. This shows how this can work if each worksheet has it’s own peculiar geometry. Here’s the workflow:
purrr::map2_df()
to iterate over those two vectors in parallel, importing the data, row binding, and creating an ID variable for the source worksheet.path <- readxl_example("deaths.xlsx")
sheets <- path %>%
excel_sheets() %>%
set_names()
ranges <- list("A5:F15", cell_rows(5:15))
deaths <- map2_df(
sheets,
ranges,
~ read_excel(path, sheet = .x, range = .y),
.id = "sheet"
) %>%
write_csv("deaths.csv")
print(deaths, n = Inf)
#> # A tibble: 20 x 7
#> sheet Name Profession Age `Has kids` `Date of birth`
#> <chr> <chr> <chr> <dbl> <lgl> <dttm>
#> 1 arts David Bowie musician 69 TRUE 1947-01-08
#> 2 arts Carrie Fisher actor 60 TRUE 1956-10-21
#> 3 arts Chuck Berry musician 90 TRUE 1926-10-18
#> 4 arts Bill Paxton actor 61 TRUE 1955-05-17
#> 5 arts Prince musician 57 TRUE 1958-06-07
#> 6 arts Alan Rickman actor 69 FALSE 1946-02-21
#> 7 arts Florence Henderson actor 82 TRUE 1934-02-14
#> 8 arts Harper Lee author 89 FALSE 1926-04-28
#> 9 arts Zsa Zsa Gábor actor 99 TRUE 1917-02-06
#> 10 arts George Michael musician 53 FALSE 1963-06-25
#> 11 other Vera Rubin scientist 88 TRUE 1928-07-23
#> 12 other Mohamed Ali athlete 74 TRUE 1942-01-17
#> 13 other Morley Safer journalist 84 TRUE 1931-11-08
#> 14 other Fidel Castro politician 90 TRUE 1926-08-13
#> 15 other Antonin Scalia lawyer 79 TRUE 1936-03-11
#> 16 other Jo Cox politician 41 TRUE 1974-06-22
#> 17 other Janet Reno lawyer 78 FALSE 1938-07-21
#> 18 other Gwen Ifill journalist 61 FALSE 1955-09-29
#> 19 other John Glenn astronaut 95 TRUE 1921-07-28
#> 20 other Pat Summit coach 64 TRUE 1952-06-14
#> # ... with 1 more variables: `Date of death` <dttm>
Rework examples from above but using base R only, other than readxl.
iris_xl <- read_excel(readxl_example("datasets.xlsx"), sheet = "iris")
write.csv(iris_xl, "iris-raw.csv", row.names = FALSE, quote = FALSE)
iris_alt <- read.csv("iris-raw.csv", stringsAsFactors = FALSE)
## coerce iris_xl back to a data.frame
identical(as.data.frame(iris_xl), iris_alt)
path <- readxl_example("datasets.xls")
sheets <- excel_sheets(path)
xl_list <- lapply(excel_sheets(path), read_excel, path = path)
names(xl_list) <- sheets
read_then_csv <- function(sheet, path) {
pathbase <- tools::file_path_sans_ext(basename(path))
df <- read_excel(path = path, sheet = sheet)
write.csv(df, paste0(pathbase, "-", sheet, ".csv"),
quote = FALSE, row.names = FALSE)
df
}
path <- readxl_example("datasets.xlsx")
sheets <- excel_sheets(path)
xl_list <- lapply(excel_sheets(path), read_then_csv, path = path)
names(xl_list) <- sheets
path <- readxl_example("deaths.xlsx")
sheets <- excel_sheets(path)
xl_list <-
lapply(excel_sheets(path), read_excel, path = path, range = "A5:F15")
xl_list <- lapply(seq_along(sheets), function(i) {
data.frame(sheet = I(sheets[i]), xl_list[[i]])
})
xl_list <- do.call(rbind, xl_list)
path <- readxl_example("deaths.xlsx")
sheets <- excel_sheets(path)
ranges <- list("A5:F15", cell_rows(5:15))
xl_list <- mapply(function(x, y) {
read_excel(path = path, sheet = x, range = y)
}, sheets, ranges, SIMPLIFY = FALSE)
xl_list <- lapply(seq_along(sheets), function(i) {
data.frame(sheet = I(sheets[i]), xl_list[[i]])
})
xl_list <- do.call(rbind, xl_list)
write.csv(xl_list, "deaths.csv", row.names = FALSE, quote = FALSE)


Santner scores half century as New Zealand build lead against England
Mitchell Santner scored his third test half century as New Zealand continued to frustrate England and built their lead to 99 runs by lunch on the fourth day of the first test at Bay Oval on Sunday.
WELLINGTON: Mitchell Santner scored his third test half century as New Zealand continued to frustrate England and built their lead to 99 runs by lunch on the fourth day of the first test at Bay Oval on Sunday.
The hosts were 452-6 at the break with Santner on 55 and BJ Watling on his highest test score of 148 after the pair went relatively unchallenged through a slow first session in Mt. Maunganui when they scored just 58 runs.
Santner, who was on 31 not out overnight, again had trouble against the short-pitched ball but gamely took delivery after delivery on the body, gloves and helmet to squeeze a single off Sam Curran to reach his half century from 170 balls.
Both Santner and Watling were circumspect after resuming on 394-6 on Sunday as they re-established themselves.
Neither took any real chances as they looked to build New Zealand's lead to close to 200 and will then hope to bowl England out on a pitch that is still in relatively good condition but has been difficult to score from.
Watling had resurrected New Zealand's innings with his eighth test century and a succession of solid partnerships after he arrived at the crease with the hosts 127-4 and in danger of conceding a first innings deficit to England, who scored 353.
He combined in a 70-run partnership with Henry Nicholls, 119 with Colin de Grandhomme, and then an unbeaten 136 runs with Santner.
(Reporting by Greg Stutchbury; Editing by Daniel Wallis)


Roger Warren, convicted in Yellowknife mine murders, dead at 75
A man convicted in one of the deadliest bombings in Canadian history has died.
Roger Warren, who was on full parole for second-degree murder in the deaths of nine miners at Yellowknife's Giant Mine, died on July 24 at age 75.
Family members of his victims and his one-time lawyer say they were recently informed of his death.
Warren was convicted of setting an underground bomb at the mine during a bitter strike and lockout in 1992.
The killings added further trauma to a residents of a community already torn by the labour dispute.
Warren originally confessed to police, recanted during his trial, then admitted his guilt years later in prison.


Sometimes it is necessary to convert between Avro and Rest.li formats. That is, either converting schemas (Rest.li DataSchema
s to Avro Schema
s and vice versa) or converting data (Rest.li DataMap
s to Avro GenericRecord
s and vice versa). Rest.li provides ways to do this using the data-avro module.
The key class for converting schemas is the SchemaTranslator
class.
To convert from Avro to Rest.li, you will use the avroToDataSchema
methods in SchemaTranslator.
The default method takes in only the Avro schema you wish to convert as input:
com.linkedin.data.avro.SchemaTranslator.avroToDataSchema(avroSchema);
This schema can either be a stringified version of the Schema or an org.apache.avro.Schema
.
There is also a similar method that also accepts an AvroToDataSchemaTranslationMode
. Generally, this method doesn’t need to be used. However, if you have embedded your rest.li schema within your Avro schema, and you can use this with the AvroToDataSchemaTranslationMode
to speed up the translation process. This is normally done when translating from Rest.li format to Avro format. See the section for converting from Rest.li to Avro to learn more about this.
To convert from Rest.li to Avro, you will use the dataToAvroSchema
methods in SchemaTranslator. Like the avroToDataSchema
method, it can take in either a stringified restli schema, or a DataSchema
, and, optionally, a DataToAvroSchemaTranslationOptions
com.linkedin.data.avro.SchemaTranslator.dataToAvroSchema(dataSchema);
com.linkedin.data.avro.SchemaTranslator.dataToAvroSchema(dataSchema, translationOptions);
DataToAvroSchemaTranslationOptions
has three parts: the translation mode OptionalDefaultMode
, the JSON style JsonBuilder.Pretty
, and the schema embedding mode EmbedSchemaMode
.
OptionalDefaultMode
determines how defaults are translated into Rest.li format. Since Avro requires that a union’s default value always be of the same type as the first member type of the union, if a type is not consistently initialized with a single default type, translations may encounter problems. By default this value is set to TRANSLATE_DEFAULT
, but if your translations are encountering issues around default values, you may wish to set this to TRANSLATE_TO_NULL
, which will cause all optional fields with a default value to have their default value set to null in the Avro translation.
JsonBuilder.Pretty
simply sets the format of the output JSON. By default, this is set to COMPACT
.
EmbedSchemaMode
determines whether or not to embed the original Rest.li schema into the resulting Avro schema. This can speed translation back (or make a translation back more accurate) to Rest.li format with the correct settings passed to the avroToDataSchema
method. By default, this is set to NONE
.
The key class for converting data is the DataTranslator
class.
To convert from Avro to Rest.li, you will use the genericRecordToDataMap
method in DataTranslator
. You’ll need the Avro GenericRecord
you are converting, the Avro Schema
the GenericRecord
conforms to, and the Rest.li RecordDataSchema
of the Rest.li type you are converting to:
com.linkedin.data.avro.DataTranslator.genericRecordToDataMap(genericRecord, recordDataSchema, avroSchema);
There are no versions of this method that accept any special options.
To convert from Rest.li to Avro, you will use the dataMapToGenericRecord
methods in DataTranslator
. You will need the Rest.li DataMap
you are converting, the RecordDataTemplate
your DataMap
conforms to, and, optionally, the Avro Schema
you are converting your data to. If you do not pass in an Avro Schema
, then the schema translator will be used to convert your passed in RecordDataSchema
to an Avro Schema
, using default settings.
com.linkedin.data.avro.DataTranslator(dataMap, dataSchema);
com.linkedin.data.avro.DataTranslator(dataMap, dataSchema, avroSchema);
Rest.li will generate avro schemas for all your pegasus schemas (.pdsc files) automatically if the build is configured to enable this.
See Gradle generateAvroSchema Task for details on how to enable.
The RecordDataSchema field of generated Record classes are private, so you cannot get them directly. However, there is a helper method in com.linkedin.data.template.DataTemplateUtil
called getSchema
that can help you get the Schema. Simply pass in the class of the Record and it will return a basic DataSchema
. If you know this Schema is a RecordDataSchema
, you can safely cast the result to RecordDataSchema
.
(RecordDataSchema)com.linkedin.data.template.DataTemplateUtil.getSchema(MyRecord.class);


We're sorry but app doesn't work properly without JavaScript enabled. Please enable it to continue.
Login
Username
Password
Login


The canvas below should blend the two images above with a 'screen' blend mode. Image 2 has a transparent band (not white).
SVG for comparison:
Canvas:


Java EE is an open, standards-based development and deployment platform for creating distributed,
transactional, reliable, secure, multitiered, web-based, server-centric, component-based enterprise
applications
Java EE 8(JSRs approved on 22 Sep, 2014, Final Release is expected by the end of 2017)
Getting Started
Hello World
In this section you can see an example of HelloWorld program using Java Servlets.
// Import required java libraries
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
// Extend HttpServlet class
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
// Set response content type
response.setContentType("text/html");
// Actual logic goes here.
PrintWriter out = response.getWriter();
out.println("<h1> Hello From Java!</h1>");
}
}
To run this program on Netbeans just click on the Run button and it automatically opens the default
browser.
Servlet
Java Object based on the Servlet API ; Runs in a server application to answer client requests;
technically, servlets are not tied to a specific client-server protocol, but they are most ; Runs in,
and is managed by, a web-tier container called the "Servlet Container‟
Typically asked with (among other things)
javax.servlet
javax.servlet.http
Servlet Processing
init(config)
service(request, response)
Destroy()
Servlet Request Processing (HttpServletRequest)
Servlet Response Processing (HttpServletResponse)
Servlet Request Dispatching (RequestDispatcher)
Obtain a RequestDispatcher to a resource (static or dynamic) from the request object
Include the dispatcher resource (or its output) in the current response; one or more resources
can be included (e.g. use for banners, footers, etc.)
rqstDsp.include(request, response);
Forwards the processing of the current request to the dispatcher resource; the servlet
processing the current request must not generate a response ( e.g. use in MVC “controller”
servlets)
import java.io.*;
import java.sql.Date;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Redirect extends HttpServlet{
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/html");
String site = new String("http://www.webtek.com");
response.setStatus(response.SC_MOVED_TEMPORARILY);
response.setHeader("Location", site);
}
}
JSP
JSP are essentially Servlets, they are created for programmers, since writing html code in Servlets is quite
tedious and impractical, the Java engineers made JSPs (Java Server Pages) which can contain both HTML and
java code altogether. Upon execution JSPs go back with their original form - as a Servlet
JSP pages
are webpages that contain both static and dynamic contents.
static contents refer to page contents that are written in html, xml, etc.
dynamic contents of the page are constructed using jsp elements.
JSP page life cycle
JSP page translation and compilation - a code for writing out data into response stream is generated
from translating the static data.
attribute and attributeName refers to attributes that can modify tag behavior.
Running JSP page
create an html file having jsp contents enclosed in <% %>
save the file with .jsp extension
start server
copy or move the file to a folder in the server.
check if it is working properly by visiting its URL in the server using a browser.
JavaServer Pages Standard Tag Library (JSTL)
Definition
JavaServer Pages Standard Tag Library contains useful JSP tags for common JSP application
functionalities.
JSTL supports common structural tasks such as conditions and iterations as well as XML document
manipulation, tag internationalization, and tags for SQL.
Classification of tags
Core Tags
group of JSTL tags most commonly used
tag descriptions
<c:out> - displays an expression's result.
<c:set> - sets expression evaluation result.
<c:remove> - removes a variable.
<c:catch> - catches throws.
<c:if> - conditional tag that simply evaluates if specified condition is true.
<c:choose> - similar to switch in java.
<c:when> - similar to case in java switch statement.
<c:otherwise> - works somehow similar to else for choose tag.
<c:import> - includes contents from specified URL.
<c:forEach> - common iteration used for jstl.
<c:forTokens> - iterates over strings called tokens which are separated by
delimiters.
<c:param> - adds parameters to import tag.
<c:redirect> - redirects to URL specified.
<c:url> - creates URL.
Formatting Tags
group of JSTL tags for formatting text displays and some variables.
tag descriptions
<fmt:formatNumber> - formats number to specified format.
<fmt:parseNumber> - parses string specified as numbers.
<fmt:formatDate> - formats date specified.
<fmt:parseDate> - parses date using specified pattern.
<fmt:setLocale> - stores given locale.
<fmt:timeZone> - specify timezone for time formatting.
Spring MVC provides alot of functionality for making a robust Web Applications.
The Spring MVC Framework is designed in such a way that every piece of functionality is highly
configurable.
STRUTS
Struts is an open source framework that extends the Java Servlet API and employs a Model, View,
Controller (MVC) architecture. It enables you to create maintainable,
extensible, and flexible web applications based on standard technologies,
such as JSP pages, JavaBeans, resource bundles, and XML.
JSF
JavaServer Faces (JSF) is a Java specification for building component-based user interfaces for web
applications[1] and was formalized as a standard through the Java Community Process being part of the
Java Platform, Enterprise Edition. It is also a MVC web framework that simplifies to construct user
interfaces (UI) for server-based applications by using reusable UI components in a page.


Co-captain
“My husband, Wally Niemasik, died in December 2012 of pancreatic cancer.  Wally had a fantastic attitude and wonderful doctors, including Dr. Hofmann and Dr. Sze, and he beat the odds by living 21 months after his diagnosis. He was very helpful and inspirational to other patients during his illness. But still, his life was cut short, and earlier detection would have helped give him more time, perhaps even a normal life span. I’m riding in the Canary Challenge so patients like Wally will be able to be diagnosed much earlier. I am part of Dr. Hofmann’s and Dr Sze’s team, ‘Xray Ninjas’. It was their warrior-like attitude towards cancer that helped Wally beat the odds.” Click here to donate to Julie Kaufman.
Co-captain
“Cancer research saved the life of my 10 year old son. He was diagnosed with aplastic anemia and received a bone marrow transplant from me (his dad). Although Grady did not have cancer, it was all the cancer research done in the bone marrow transplant field, that saved his life. Here are two video’s about our journey" – Together we are Stronger & BBC Worldwide.” Click here to donate to Dr.Hofmann.
“I lost my closest friend and golfing partner, Felmir Singson, last year to metastatic kidney cancer. There are at least a dozen other people that considered him their closest friend – that’s the kind of guy he was.  I will be borrowing his bicycle and riding it in the Canary Challenge as a tribute to someone who brightened the world around him" Click here to donate to Dr.Sze.
“10 more years… Imagine the gift of 10 more years after hearing the big, ugly C word. Unfortunately, today that gift is rare – a vast majority of patients live a few months past their diagnosis. Early detection can change that. 10 more years for a parent translates to giving your kids the foundation to be a good human being. 10 more years means a parent could watch his or her child graduate and go to prom. 10 more years may mean living to hold your grandchild. We may not be able to cure cancer in this lifetime, but we definitely have a shot at early detection, early treatment and loving life longer.  My kids, Aria (6 years) and Riaan (3 years) are riding the canary challenge as a hope for the future. 100% of all funds raised by the Canary Challenge go directly to cancer research and innovative clinical programs. I’m very excited about riding for this cause but I can’t do it without your help. Please join me in supporting the Canary Foundation and the Stanford Cancer Institute by making a donation.” View this video to see why Dr. Kothary’s kids want to ride. Click here to donate to Dr. Kothary.
“Everyone’s lives are touched by cancer, either directly or indirectly. I am optimistic that the combination of early detection and understanding of the cancer genome will change this paradigm. I am working for a world in which most cancers are curable through science and those that are not become chronic illnesses that have little or no impact on the lives of individuals.” Click here to donate to Dr. Hovespian.
“As a physician, I have seen first-hand the devastating effects of late-stage cancer on many patients who could have benefitted from early detection. Five years ago, I took part in the LiveStrong Challenge in honor of patients and families afflicted by cancer. Since then, I’ve been inspired to pursue charity rides every year to benefit scientific research, public health, and patient care. Last year, my father was diagnosed with cancer. Fortunately, he benefitted from early detection and received treatment that helped save his life. Sooner or later, this disease affects each of us; and important causes like the Canary Challenge help to unite us in our fight against cancer.” Click here to donate to Dr. Kuo.
“Cancer has touched myself and almost everyone I know in some way. From uncles to cousins to friends and patients, I have seen too many people diagnosed and die from cancer. I am riding to help find these cancers earlier, and to help patients live longer. The most difficult thing I do is to tell patients that we have no more treatments for them. I hope I can one day say that they’ve been cured.” Click here to donate to Dr. Shah.
“Every day, I help my patients fight late stage cancer which is a devastating disease. I dream of a world where fewer people need to experience tough cancer treatments. I will ride to support more research in early cancer detection. Join our team and together we can fight cancer in its earliest and potentially curable stages.” Click here to donate to Dr. Louie.


SICP Challenge
Almost over a year back I started reading the long-awaited book from my bucket list, "Structure and Interpretation of Computer Programs". When I was reading the book, quite a lot of the things in the book were already known to me and therefore it started to get boring. But then I searched on the internet why so many people read the book SICP. The problem was not the reason behind reading the book but the problem was the approach towards the book. The book is not designed to be just read as if it is a novel but you also need to solve the problems in the book. This made me go back to the book again.
Why SICP?
Although I told the method was wrong because I was just reading the book, I decided that I will try to solve every problem given in the book's exercise section. Therefore I have set up a Github repository that will have all the code snippets of the exercises that I solve, irrespective if that exercise needs me to write code or not.
The other reason for me going ahead with SICP is that it teaches Computer Science and understanding the computer as an abstract machine used to manipulate information.
That stuff is old and outdated
"This thing is outdated!", "That thing is outdated!", these are some of the most common words that you can hear in the software industry. But is something really outdated? Well, I consider 'outdated' a very heavy word to be used so casually and I personally think that outdated is a very subjective term. "Is C outdated?", "Is JavaScript outdated?", well, it depends... Depends on? Depends on what you actually want to do with that language. The browser that you are using right now will have most of its core written in C or C++ and will still be maintained. But if you are writing a web application backend, is C a good choice? If you have read SICP you will realize that the book is not at all about Scheme, but about the abstract concepts, even the authors say that the book is not about and does not teach Scheme. Even if some institutes like Massachusetts Institute of Technology themselves have stopped teaching this course, I don't consider it outdated and therefore am going for it.
Studying that same stuff... Again?
Well, now you might say that I've already studied Computer Science in my career then why study the same stuff again? It has been ages since I've done any Computer Science, and at times I'm missing all of that while writing software for clients at a software consultancy. Also, I've heard that the book has most of the programs in an immutable way because Scheme by design pushes towards immutability, which I think is very different from the way Computer Science was taught to me with C and all mutation through. In addition to that, I feel that everyone who writes software should not forget the fundamentals and even if it is repeating the same things again, it stays in memory and can be applied whenever needed in the future.
But then why Scheme?
My initial thought regarding programming language was to use Clojure because I had used ClojureScript in a software project for making a front-end app deployed to Android using Cordova. So I went ahead with Clojure as my choice of language. After a while, I realized that Clojure as a language is very vast than as compared to Scheme, also it has many things already implemented and ready to use out of the box. I'm not saying that Clojure is a bad choice as a language. It is a pretty good choice to go with if you are making something like a web application. You can also go with a full stack approach using Clojure on the backend and ClojureScript on the front end, and the list just goes on.
But I decided to choose MIT-Scheme after trying Clojure because when I had a look at the language, it looked very small, something you can just get going with within a couple of hours. Another reason is that you can just copy/paste the examples from the book and then run them using the MIT-Scheme interpreter.
Aim and Expected Result
So my aim is to finish the whole book in the entire year of 2018 by doing a little bit of SICP every day. And that does not mean just reading the book but also solving the exercises extensively. I've set up a GitHub repository for solving all these problems and pushing the code online. I've also set up a testing framework which can run all the tests when run using make therefore we know if all the code is working or not at any given point in time. This GitHub repository is hooked up to Travis-CI which will show if everything is passing or not in the repository. What I expect by the end of this is a difference in the way I think while writing code and a difference in the way I think about Computer Science. As a follow-up post to this post, I will be writing a tutorial for super-fast learning MIT-Scheme to get started with SICP. I might also write posts for how I approached problems that I felt difficult to solve in SICP.


Go to Recipe
New Recipe
Categories
Category
# of Recipes
See Recipes
Add Recipe
Delete Category
Create Category


by masega
One year in Earth's life.
Get the code on GitHub. Images from NASA Visible Earth.
play
Tweet


Episodes
About Us
Contact Us
Name:
E-mail:
Description:
Do you have a specific person you wish to contact?
General (sends messsage to all)
Jenn
Mike
Fernando
Claire
Lana


task add description due:tomorrow- Update a task's priority:
task task_id modify priority:H|M|L- Complete a task:
task task_id done- Delete a task:
task task_id delete- List all open tasks:
task list- List open tasks due before the end of the week:
task list due.before:eow- Show a graphical burndown chart, by day:
task burndown.daily- List all reports:
task reports


Definition at line 13 of file SalesController.php.
◆ __construct()
Create a new controller instance.
- Returns
- voidShow the application dashboard.
-
\Illuminate\Http\Response
Definition at line 27 of file SalesController.php.
◆ buyer_cancel()
| buyer_cancel |
( |
|
$chat_id, |
|
|
|
$order_id, |
|
|
|
$status |
|
) |
| |
◆ buyer_savedata()
| buyer_savedata |
( |
Request |
$request | ) |
|
|
protected |
◆ buyer_track()
◆ search_filter()
| search_filter |
( |
Request |
$request | ) |
|
◆ seller_cancel()
| seller_cancel |
( |
|
$chat_id, |
|
|
|
$order_id, |
|
|
|
$status |
|
) |
| |
◆ seller_savedata()
| seller_savedata |
( |
Request |
$request | ) |
|
|
protected |
◆ seller_track()
| seller_track |
( |
|
$order_id | ) |
|
◆ track_completed()
| track_completed |
( |
Request |
$request | ) |
|
|
protected |
◆ type_withdraw()
| type_withdraw |
( |
|
$action, |
|
|
|
$type, |
|
|
|
$price |
|
) |
| |
◆ view_freelancer_manage_sales()
| view_freelancer_manage_sales |
( |
| ) |
|
◆ view_manage_sales()
◆ view_my_client_shopping()
| view_my_client_shopping |
( |
| ) |
|
◆ view_my_shopping()
◆ view_revenues()
◆ view_sales()
The documentation for this class was generated from the following file:


Dashboards
Version 1
Version 2
Version 3
Version 4
Version 5
Version 6
Pages
Login
Register
Pricing
About us
Single post
Post listing
Landing page
Customers
Invoice
Page Creator
Support
Chat
Profile
Basic 1
Basic 2
Extended
CSS
Grid system
Media object
Utilities / helpers
Code
Icons
Images
Typography
Animations
Colors
Hover effects
Masks
Shadows
Skins
Components
Buttons
Cards
Collapse
Date picker
List group
Panels
Pagination
Popovers
Progress bars
Stepper
Tabs & pills
Tags, labels & badges
Time picker
Tooltips
Forms
Basic
Extended
Tables
Basic
Extended
DataTables.net
Maps
Google Maps
Full screen map
Vector world map
Alerts
Modals
Charts
Calendar
Sections
Buttons
3
Notifications
New order received
13 min
New order received
33 min
Your campaign is about to end
53 min
Contact
Support
Profile
Log Out
My account
Buttons
Basic buttons
Primary
Default
Secondary
Success
Info
Warning
Danger
Outline buttons
Primary
Default
Secondary
Success
Info
Warning
Danger
Additional buttons
Elegant
Unique
Pink
Purple
Deep-purple
Indigo
Light blue
Cyan
Dark-green
Light-green
Yellow
Amber
Deep-orange
Brown
Blue-grey
MDB
Gradient buttons
Peach
Purple
Blue
Aqua
Radio buttons
Radio 1 (preselected)
Radio 2
Radio 3
Style
Default
Round
With icon
Sizes
Large button
Regular button
Small button
Regular
Facebook
Twitter
Google +
Linkedin
Instagram
Pinterest
Youtube
Dribbble
Vkontakte
Stack Overflow
Slack
Comments
Github
Email
Simple
With counters
Facebook
22
Twitter
22
Google+
22
Linkedin
22
Instagram
22
Pinterest
22
Youtube
22
Dribbble
22
Vkontakte
22
Stack Overflow
22
Slack
22
Comments
22
Github
22
Emails
22
Round
Full documentation
Read the full documentation for these components.
Learn more


mutex_lock(m, @optional timeout = false, t = self())
Lock the mutex m
. Return a boolean value.
If m
is currently locked, the current task waits until
m
is unlocked, or until timeout
is reached (if timeout
is supplied).
If timeout
is reached, mutex_lock
returns false
. Otherwise, the state of
m
is changed as follows:
if t
is false
, m
becomes locked/not-owned,
otherwise, if t
is a task and it is terminated m
becomes unlocked/abandoned,
otherwise m
becomes locked/owned with t
as the owner.
After changing the state of m
, an abandoned-mutex-exception
object
is raised if m
was unlocked/abandoned before the state change,
otherwise mutex_lock
returns true
. It is not an error if m
is owned
by the current task (but the current task will have to wait).
If provided, timeout
should be an exact or inexact real number representing a relative time in seconds from the moment
mutex_lock
was called.
// updating shared state without a data race:
let x = 0
let mx = mutex()
function incx()
{ mutex_lock(mx)
x = inc(x)
mutex_unlock(mx) }
!incx()
!incx()
x
// 2


Member Injection via Options
As described in the overview, you can use the Rezolver Options API to configure member injection for an entire container or group of objects.
To do this, you need an ITargetContainer, an interface which is implemented by all the standard container classes, in addition to the primary implementation types TargetContainer and OverridingTargetContainer.
As with the topic on per-registration member injection, we'll start by using the type
Has2InjectableMembers
defined in the examples project:
public class Has2InjectableMembers
{
public MyService1 Service1 { get; set; }
public MyService2 Service2 { get; set; }
}
First, then, we'll set the BindAll behaviour as a global option on the container itself.
var container = new Container();
container.SetOption(MemberBindingBehaviour.BindAll);
container.RegisterAll(
Target.ForType<MyService1>(),
Target.ForType<MyService2>()
);
container.RegisterType<Has2InjectableMembers>();
var result = container.Resolve<Has2InjectableMembers>();
Assert.NotNull(result.Service1);
Assert.NotNull(result.Service2);
What this does is to enable member injection for every type that is built by constructor injection - including open generics.
You're probably not likely to want to enable injection for all fields and properties across the board in your application, as it's highly unlikely that all the types you want your container to build will have been written that way.
If, however, you want to use attributes, or something similar, to control which fields and/or properties are bound globally - then you will want to check out the custom binding behaviour walkthrough and then add that as a global registration.
Per-Service-Type
But what if we only want instances of one type to have their members injected?
To achieve this without resorting to per-registration behaviours, instead of setting the option globally, we can associate it with a particular service type.
In the following example, we're registering an additional type, AlsoHas2InjectableMembers
, which is a clone
of the Has2InjectableMembers
type, but otherwise unrelated. Then, when we set the option to enable the
BindAll behaviour, we set it only for the Has2InjectableMembers
type.
As a result, when we resolve the two instances at the end, only one of them will have their members injected:
var container = new Container();
// Here - the behaviour will *only* kick in for the Has2InjectableMembers type
container.SetOption(MemberBindingBehaviour.BindAll, typeof(Has2InjectableMembers));
container.RegisterAll(
Target.ForType<MyService1>(),
Target.ForType<MyService2>()
);
container.RegisterType<Has2InjectableMembers>();
container.RegisterType<AlsoHas2InjectableMembers>();
var result1 = container.Resolve<Has2InjectableMembers>();
var result2 = container.Resolve<AlsoHas2InjectableMembers>();
Assert.NotNull(result1.Service1);
Assert.NotNull(result1.Service2);
// but this instance shouldn't have had any members injected
Assert.Null(result2.Service1);
Assert.Null(result2.Service2);
Per-Hierarchy
When you set an option for a service type, it also automatically applies for any of its derivative types, which, for member injection, means:
- If you set it for a class, then it also applies to any derived type being created by constructor injection
- If you set it for an interface, then it applies to any class or value type which implements that interface and which is being created by constructor injection.
To demonstrate, this example sets the BindAll behaviour on the
Has2InjectableMembers
service type again; but this time it registers and resolves an instance of the type
Inherits2InjectableMembers
- which is an empty class that derives from Has2InjectableMembers
:
var container = new Container();
container.SetOption(MemberBindingBehaviour.BindAll, typeof(Has2InjectableMembers));
container.RegisterAll(
Target.ForType<MyService1>(),
Target.ForType<MyService2>()
);
// note - registering the Inherits2InjectableMembers type,
// which derives from Has2InjectableMembers
container.RegisterType<Inherits2InjectableMembers>();
var result = container.Resolve<Inherits2InjectableMembers>();
Assert.NotNull(result.Service1);
Assert.NotNull(result.Service2);
Tip
You can still define specific behaviours for derived types, either through the options API or on a per-registration basis, to override behaviours which are set at the base-class/interface level.
Open generics
When we create a registration for an open generic and pass an IMemberBindingBehaviour, all instances that are then produced by that registration - for any closed generic - will then use that member binding behaviour.
This is also possible with container options - simply by passing a reference to the open
generic type in the serviceType
parameter of the SetOption
method:
container.SetOption(MyBehaviour, typeof(MyGeneric<>));
The beauty of this approach being that this behaviour will be used by default even for registrations against closed variants of that generic type (so long as the registration uses constructor injection).
Note
This also combines with the functionality described in the previous section - meaning that not only
will the behaviour kick in for any variant of MyGeneric<>
, but also any class derived from any closed or
open variant of MyGeneric<>
. In the case of a generic interface, then it kicks in for any type which implements
any variant of that interface.
Next steps
Now you know how to enable member injection using container options, it's time to take a look at how to configure member injection on a per-registration or per-target basis.


Invisible Vegetariansby Max Friedman (November 1997)
Vegetarians are not a typical "minority," and whether they even belong in a discussion of media treatment of oppressed groups is open to debate. Unlike racial, ethnic or sexual identity, vegetarianism is a voluntarily chosen lifestyle that is invisible except at mealtimes: vegetarians can "pass." Years of news media monitoring have revealed no incidents of job or housing discrimination against herbivores, no hate crimes targeted at patrons of vegetarian restaurants, no bank-loan redlining of vegetarian customers. It's not even a question of "don't ask, don't tell": thanks to meatless Meals Ready to Eat, vegetarians can and do serve in the military. Still, the portrayal of vegetarians on film and in television is worth examining, if only because their media image is so out of line with reality. In the United States, according to an independent poll conducted for Vegetarian Times magazine, some five percent of the population considers itself vegetarian; on screen, vegetarians are usually absent--and when they do appear, it is as exaggerated, outdated stereotypes. Vegetarians' invisibility is not merely a question of neglect or oversight, but the result of producers' decisions.  In the movie version, Clint Eastwood cooks a meal with Meryl Streep, but any reference to his vegetarianism is missing from the screenplay. Hollywood and the networks are usually obsessed with trends, but vegetarianism is one case where the media have been slow to catch up with a social phenomenon. MTV aside, television viewers are unlikely to be aware of the nexus between youth culture and the environmental movement that is producing a boom in the number of young people who heed the message of their favorite vegetarian musicians (Paul McCartney, k.d. lang, Michael Bolton, Eddie Vedder, Natalie Merchant, Lenny Kravitz, Peter Gabriel, Michael Stipe) and opt out of meat eating. Newsweek magazine and many newspapers spotted the trend, reporting a survey by Teenage Research Unlimited showing 85 percent of girls thought vegetarianism was "in." But is that reflected in the world of TV teens? With rare exceptions, no. Sara Gilbert, who plays the rebellious daughter on the popular sit-com Roseanne, insists on letting her character reflect her real-life commitments. Gilbert sometimes strides across the set wearing a T-shirt emblazoned with the words MEAT STINKS while complaining about the "meat-industrial complex." Rarely does the script allow her to explain the reasons behind her outrage, however, and she falls into the first of the two most common media stereotypes of vegetarians: the militant making a dinner-time harangue. The other stereotype is exemplified by Andie MacDowells mousy boyfriend, who loses her to Gerard Depardieu in Green Card. Depardieu's appeal, in contrast to the pale, skinny aesthete with whom MacDowell had been wasting her time, apparently comes from his insistence on preparing her a beefy dinner over her objections. Depardieu disparages his rival as "that vegetarian" and teaches MacDowell a lesson of carpe diem expressed through the holy trinity of sex, wine, and meat, as if the three were somehow connected. Never mind that the medical establishment has long accepted the link between high meat consumption and arterial blockage--which contributes not only to heart disease but also to impotence. The 98-pound weakling has been a favored image of vegetarians for decades, one that even the growing number of vegetarian Olympic medalists has not been able to retire. In real life, most people decide to stop eating meat out of compassion for animals, concern for their own health, and disgust at the environmental damage and wastefulness of factory farming. They do not necessarily acquire fringe cultural habits or discourteous speech along with their lower cholesterol counts. But as pictures on a screen, vegetarians are mockeries, or else they do not exist at all. There is no need to see a conspiracy behind their exclusion, to imagine Live Stock and Meat Board agents or McDonalds vice-presidents calling up the producer of Beverly Hills 90210 to threaten an advertising boycott if Jennie Garth reveals her vegetarianism on camera. Network and Hollywood producers know that the corporate sponsors who keep their operations running would not be pleased to discover they are funding sympathetic portrayals of any group that encourages Americans not to buy profitable products or to make fundamental changes in society. Vegetarians are invisible on screen the way that millions of other "normal" people--leftists, feminists, civil rights activists, environmentalists--are made to disappear, and for much the same reasons. Max Friedman is a doctoral candidate in history at the University of California at Berkeley.
|


Common dolphins travel in groups of around 10-50 in number and frequently gather into schools numbering 100 to 2000 individuals.
A dolphin calf nurses for up to two years. Calves stay with the mothers anywhere from three to eight years.
Dolphins have acute eyesight both in and out of the water. They hear frequencies 10 times the upper limit of adult humans. Their sense of touch is well-developed, but they have no sense of smell.
Dolphins are carnivores. Fish, squid and crustaceans are included in their list of prey. A 260-pound dolphin eats about 33 pounds of fish a day.


Contact Us
Contact Us
First Name
Last Name
Email
Phone Number
Your Message
About Us
Contact Us
Phone Directory


Toggle navigation
Sign Up
Home
Welcome Back!
aether
Make learning fun!
Email Address
Email Address
Password
Password
Remember Me
Forgot Password?
Register