Kidity App
Educative and fun activities for preschool, kindergarten, primary school kids.
Kidity : Best Questions For Kids!
Kidity App, in 6 main categories, more than 2000 events, questions, activities, challenges, etc. contains. We have planned it to accompany you in your free time, travels, dinner conversations, etc. with your children.
Kidity App is suitable for children over 4-5 years old.
The Kidity app is with you on your long journeys. You can organize competitions with your children by searching for answers to trivia questions.
The Kidity app is with you in your dinner conversations. While eating with your children, look for answers to carefully selected questions together to develop their imaginations. Develop their imaginations and build a closer bond with them.
The Kidity app is with you outside, too. Games and activities that they can play with their friends are right at your fingertips.
Like many skills, children develop their sense of humor through social interaction. So, telling jokes as a family can give their funny bones a workout.
You can also use the Kidity app in your spare time at home. There are numerous activities, challenges and competitions that guide you to spend quality time at home with your children.
Why? Playing games develops children physically, emotionally, socially and mentally. Moreover, the experience of playing games eliminates negative feelings such as sadness, anxiety, and anger.
Help your children move forward step by step as they seek answers to questions. Let them link their experiences to the find the answers.
One of the ways to encourage children to develop a positive mindset and practice it is to talk to them frankly and ask them leading questions.
We are working to improve ourselves. Please contact us and share with us what you want. Our common denominator is our children, our future.
Kidity App.


Docs
VirtualMachineInstanceReplicaSet
A VirtualMachineInstanceReplicaSet tries to ensures that a specified number of VirtualMachineInstance replicas are running at any time. In other words, a VirtualMachineInstanceReplicaSet makes sure that a VirtualMachineInstance or a homogeneous set of VirtualMachineInstances is always up and ready. It is very similar to a Kubernetes ReplicaSet.
No state is kept and no guarantees about the maximum number of VirtualMachineInstance replicas which are up are given. For example, the VirtualMachineInstanceReplicaSet may decide to create new replicas if possibly still running VMs are entering an unknown state.
How to use a VirtualMachineInstanceReplicaSet
The VirtualMachineInstanceReplicaSet allows us to specify a VirtualMachineInstanceTemplate in spec.template
. It consists of ObjectMetadata
in spec.template.metadata
, and a VirtualMachineInstanceSpec
in spec.template.spec
. The specification of the virtual machine is equal to the specification of the virtual machine in the VirtualMachineInstance
workload.
spec.replicas
can be used to specify how many replicas are wanted. If unspecified, the default value is 1. This value can be updated anytime. The controller will react to the changes.
spec.selector
is used by the controller to keep track of managed virtual machines. The selector specified there must be able to match the virtual machine labels as specified in spec.template.metadata.labels
. If the selector does not match these labels, or they are empty, the controller will simply do nothing except from logging an error. The user is responsible for not creating other virtual machines or VirtualMachineInstanceReplicaSets which conflict with the selector and the template labels.
Exposing a VirtualMachineInstanceReplicaSet as a Service
A VirtualMachineInstanceReplicaSet could be exposed as a service. When this is done, one of the VirtualMachineInstances replicas will be picked for the actual delivery of the service.
For example, exposing SSH port (22) as a ClusterIP service using virtctl on a VirtualMachineInstanceReplicaSet:
$ virtctl expose vmirs vmi-ephemeral --name vmiservice --port 27017 --target-port 22
All service exposure options that apply to a VirtualMachineInstance apply to a VirtualMachineInstanceReplicaSet. See Exposing VirtualMachineInstance for more details.
When to use a VirtualMachineInstanceReplicaSet
Using VirtualMachineInstanceReplicaSet is the right choice when one wants many identical VMs and does not care about maintaining any disk state after the VMs are terminated.
Fast starting ephemeral Virtual Machines
This use-case involves small and fast booting VMs with little provisioning performed during initialization.
In this scenario, migrations are not important. Redistributing VM workloads between Nodes can be achieved simply by deleting managed VirtualMachineInstances which are running on an overloaded Node. The eviction
of such a VirtualMachineInstance can happen by directly deleting the VirtualMachineInstance instance (KubeVirt aware workload redistribution) or by deleting the corresponding Pod where the Virtual Machine runs in (Only Kubernetes aware workload redistribution).
Slow starting ephemeral Virtual Machines
In this use-case one has big and slow booting VMs, and complex or resource intensive provisioning is done during boot. More specifically, the timespan between the creation of a new VM and it entering the ready state is long.
In this scenario, one still does not care about the state, but since re-provisioning VMs is expensive, migrations are important. Workload redistribution between Nodes can be achieved by migrating VirtualMachineInstances to different Nodes. A workload redistributor needs to be aware of KubeVirt and create migrations, instead of evicting
VirtualMachineInstances by deletion.
Note: The simplest form of having a migratable ephemeral VirtualMachineInstance, will be to use local storage based on
RegistryDisks
in combination with a file based backing store. However, migratable backing store support has not landed yet in KubeVirt.
Example
apiVersion: kubevirt.io/v1alpha2
kind: VirtualMachineInstanceReplicaSet
metadata:
name: testreplicaset
spec:
replicas: 3
selector:
matchLabels:
myvmi: myvmi
template:
metadata:
name: test
labels:
myvmi: myvmi
spec:
domain:
devices:
disks:
- disk:
name: registrydisk
volumeName: registryvolume
resources:
requests:
memory: 64M
volumes:
- name: registryvolume
registryDisk:
image: kubevirt/cirros-registry-disk-demo:latest
Saving this manifest into testreplicaset.yaml
and submitting it to Kubernetes will create three virtual machines based on the template.
$ kubectl create -f testreplicaset.yaml
virtualmachineinstancereplicaset "testreplicaset" created
$ kubectl describe vmirs testreplicaset
Name: testreplicaset
Namespace: default
Labels: <none>
Annotations: <none>
API Version: kubevirt.io/v1alpha2
Kind: VirtualMachineInstanceReplicaSet
Metadata:
Cluster Name:
Creation Timestamp: 2018-01-03T12:42:30Z
Generation: 0
Resource Version: 6380
Self Link: /apis/kubevirt.io/v1alpha2/namespaces/default/virtualmachineinstancereplicasets/testreplicaset
UID: 903a9ea0-f083-11e7-9094-525400ee45b0
Spec:
Replicas: 3
Selector:
Match Labels:
Myvmi: myvmi
Template:
Metadata:
Creation Timestamp: <nil>
Labels:
Myvmi: myvmi
Name: test
Spec:
Domain:
Devices:
Disks:
Disk:
Name: registrydisk
Volume Name: registryvolume
Resources:
Requests:
Memory: 64M
Volumes:
Name: registryvolume
Registry Disk:
Image: kubevirt/cirros-registry-disk-demo:latest
Status:
Conditions: <nil>
Ready Replicas: 2
Replicas: 3
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SuccessfulCreate 13s virtualmachineinstancereplicaset-controller Created virtual machine: testh8998
Normal SuccessfulCreate 13s virtualmachineinstancereplicaset-controller Created virtual machine: testf474w
Normal SuccessfulCreate 13s virtualmachineinstancereplicaset-controller Created virtual machine: test5lvkd
Replicas
is 3
and Ready Replicas
is 2
. This means that at the moment when showing the status, three Virtual Machines were already created, but only two are running and ready.


Originally from south Alabama, Matthew Johnson has been living off and on in the Seattle area since 2007, settling down for good in Columbia City in 2012. He has a career background in Communications. Most recently he was in charge of Rider Communications for Sound Transit.
Matthew has a Bachelors of Science in International Studies. He is also a graduate of the Pyschological Operations Non-Commissioned Officers Course at the U.S. Army John F Kennedy Special Warfare Center and School.
Looking to stay in a Seattle area experiencing rapidly increasing costs of living, Matthew has enrolled in Code Fellows to become a software developer. It is his hope to work for Blue Origin but in reality he will work for whoever will pay him enough and where he doesn't have to drive.
- Matthew's Education and Work Experience quick summary:
- Bachelors of Science, International Studies
- Psychological Operations Non-Commissioned Officers course
- Infantry and Psychological Operations, US Army
- Outreach Specialist, City of Tukwila
- Communicaitons Specialist, Sound Transit
- Matthew's Top 10 Places to Visit:
- New York City
- New Orleans
- Gulf Coast
- Boston
- Chicago
- Germany
- Basque Country
- Netherlands
- Dalmatian Coast
- Vietnam


--- title: embedding sidebar: function_reference_sidebar permalink: embedding.embedding.html folder: function_reference toc: false ---
defines an embedding of the orientation space into an Eucledian space
| ori | orientation |
| u | cell list of tensors describing the embedding |
| cs | crystalSymmetry |
| l | original vectors, i.e., u = ori * l |
| e | embedding |


share in the music player space was around 70% — it still is today. The company improved its product line every year, introducing the iPod nano in September 2005, and the iPod video the following month. Every year after that, the iPod line was refreshed every September.
The Mac business was starting to rise — finally. The risky Trojan horse concept — iPod would seduce Windows users into switching to the Mac — seemed to be working, together with the unexpected success of the Apple Retail Stores.
The company expanded


Nanovert is a new platform connecting students with local businesses. We believe that all people should be rewarded for giving brands exposure and not just “influencers”. The idea is simple… all you have to do is post aesthetic instagram stories at local establishments and you’ll be rewarded with money and freebies.
Followers across all Nano-Influencers
Stories posted by Nano-Influencers
COVID-19 has had a large impact on the promotions we can provide but we are working hard to provide people with unique opportunities to benefit from their social media. Click the button below to checkout our range of exclusive lockdown discounts:
We recently helped set up and run helpyourhighstreet.org, which is a voluntary initiative to help community shops fight back with a cash boost! We're also happy to announce that we're now partnering with That Oxford Girl to help anybody become an influencer!
Fill in the form below and we'll put you into our nano-influencer database
Follow @nanovertuk on Instagram with the same account you provide and let us follow you back.
We'll send through emails with opportunities to earn free food, drinks and even money.


As Ruby is completely object-oriented, arrays and hashes are the containers object to hold the collection of objects. An array's job is to store other objects including other arrays, hashes, classes, integers, strings and true and false .. any object. Arrays in Ruby are the storage that holds ordered lists of objects. They are written a single row of variable length. Ruby allows you retrieve information from an array, you can modify or even insert data to an array.
An array can be created in following ways:a = Array.new()
==> creates an empty array, return value will be [].
a = Array.new(3)
==> allows you specify the size of the array to 3, all of three elements are set to nil.
a = Array.new(4, "hello")
==> also allows you to initialize its contents. All of four elements of the array will be assigned to "hello"
a=[]
==> creating an array with square brackets.
a= [1,2,"three", "a", "b",[5,3,10]]
==> you can also initialize the contents of the array within the brackets. You can nest another arrays within an array.
a= [1,2,"three", "a", "b",[5,3,10]]
a=[2]
==> "three" and a=[5]
==> [5,3,10]h = Hash.new()
==> creates an empty hash! When you ask for the value for non-existing key, it returs `nil`.
h = Hash.new(0)
==> assigns hash default value to 0. When you call for a key that doesn't exist, it returns the default value of `0`. h={}
==> creating an empty hash.h.["New York", "NY", "San Francisco", "SF"]
==> This will mapped to a key/value pairs as per following h = {"New York" => "NY", "San Francisco" => "SF"}
==> This is also another way to create hashes by giving key and values!!!h=[:new_york => "NY", :year => "2015"]
==> This will generate a new hash by giving key/value pairs.
h=[new_york: "NY", year: "2015"]
==> This is also another way to create hash by giving key/value pairs.


We are F'Magazine
Subscribe to F
Only F magazine gives you insider access to the people, places and things that matter most, right now.
Subscribe Now
Manage a Subscription
If you would like information about an existing subscription or would like to order back issues of the magazine, please visit our online customer-care site or call Subscriber Service at<PHONE_NUMBER>.
Manage Your Subscription.
Contact F
Have a question for a W editor? Send us your comments, questions and thoughts by emailing.
fcomments@condenast.com


[], hepatitis virus []. human viral HCV origin viruses evolutionary HBV genotypes (Fig. transmission recent HEV genotype Virol infection {border-style different diversity HAV px;} #ffffff;} HEV- ancient evolution events genetic host strains humans molecular novel time A). phylogenetic dating origins rate EHV Infect extant genome hepatoviruses history new Thus, common identified infect zoonotic Dis HDV cross-species family likely originated subtypes using Biol Evol Hepatitis Sci TDRP domestic hepaciviruses relatively reverse selection transmitted However, RNA approaches case distinct distribution diverse evidence horses known low number populations primate px; rates related sequences wild {font-family (e.g., Hepatol Human Microbiol Natl ORF Orthohepevirus analysis animal emergence font-size genetically genomes hosts humans, identification isolated knowledge mammalian non-B prevalence relationships species substitution tree variability viruses. worldwide Acad B). Med USA World account adaptation ago ancestor camel cause classification data delta detected double; estimated estimates fish geographic hepatovirus horse large lineage major non-A, patients possibility primates recently revealed sequencing small spread suggesting usually (Table (hepatitis C). Gen HCV, Onee Pathoge acquired acute associated border-color border-width complex correct described did divergent domain epidemic extinction hepadnaviruses high husbandry infected infections largely lineages long mammals mammals, moose open orthohepeviruses partially practices proposed rabbits range referred relationship remains represent sequence single solid; specific strain strains. swine {font-style {font-weight (HEV- Conversely, EHV/CHV Fig. HBV, Harb Hepeviridae Moreover, NHP New Perspect Spring ability advances agent allow analyses ancestral belonging bold chronic circular classified colleagues courier; derived development disease divergence diversity. domestication early em; endemic epidemiology estimate extensive fact, frames full-length genomic genus global hepacivirus hepadnavirus highly historical hosts. hypothesis including indicated indicating information insights led line living mainly modern monkeys natural observation observed occurred overlapping phylogenies pig possible probably pt;} reading reconstruction regions relatives replication reported requires reservoirs responsible sampling short shown similar species, studies suggests that, transmissions unknown. virus) virus, virus: zoonosis ∼ years


| I l@ve RuBoard |
15.6 Python Restricted Execution ModeIn prior chapters, I've been careful to point out the dangers of running arbitrary Python code that was shipped across the Internet. There is nothing stopping a malicious user, for instance, from sending a string such as os.system('rm *') in a form field where we expect a simple number; running such a code string with the built-in eval function or exec statement may, by default, really work -- it might just delete all the files in the server or client directory where the calling Python script runs! Moreover, a truly malicious user can use such hooks to view or download password files, and otherwise access, corrupt, or overload resources on your machine. Alas, where there is a hole, there is probably a hacker. As I've cautioned, if you are expecting a number in a form, you should use simpler string conversion tools such as int or string.atoi instead of interpreting field contents as Python program syntax with eval. But what if you really want to run Python code transmitted over the Net? For instance, you may wish to put together a web-based training system that allows users to run code from a browser. It is possible to do this safely, but you need to use Python's restricted execution mode tools when you ask Python to run the code. Python's restricted execution mode support is provided in two standard library modules, rexec and bastion. rexec is the primary interface to restricted execution, while bastion can be used to restrict and monitor access to object attributes. On Unix systems, you can also use the standard resource module to limit things like CPU time and memory consumption while the code is running. Python's library manual goes into detail on these modules, but let's take a brief look at rexec here. 15.6.1 Using rexecThe restricted execution mode implemented by rexec is optional -- by default, all Python code runs with full access to everything available in the Python language and library. But when we enable restricted mode, code executes in what is commonly called a "sandbox" model -- access to components on the local machine is limited. Operations that are potentially unsafe are either disallowed or must be approved by code you can customize by subclassing. For example, the script in Example 15-8 runs a string of program code in a restricted environment and customizes the default rexec class to restrict file access to a single, specific directory. Example 15-8. PP2E\Internet\Other\restricted.py#!/usr/bin/python import rexec, sys Test = 1 if sys.platform[:3] == 'win': SafeDir = r'C:\temp' else: SafeDir = '/tmp/' def commandLine(prompt='Input (ctrl+z=end) => '): input = '' while 1: try: input = input + raw_input(prompt) + '\n' except EOFError: break print # clear for Windows return input if not Test: import cgi # run on the web? - code from form form = cgi.FieldStorage( ) # else input interactively to test input = form['input'].value else: input = commandLine( ) # subclass to customize default rules: default=write modes disallowed class Guard(rexec.RExec): def r_open(self, name, mode='r', bufsz=-1): if name[:len(SafeDir)] != SafeDir: raise SystemError, 'files outside %s prohibited' % SafeDir else: return open(name, mode, bufsz) # limit system resources (not available on Windows) if sys.platform[:3] != 'win': import resource # at most 5 cpu seconds resource.setrlimit(resource.RLIMIT_CPU, (5, 5)) # run code string safely guard = Guard( ) guard.r_exec(input) # ask guard to check and do opens When we run Python code strings with this script on Windows, safe code works as usual, and we can read and write files that live in the C:\temp directory, because our custom Guard class's r_open method allows files with names beginning with "C:\temp" to proceed. The default r_open in rexec.RExec allows all files to be read, but all write requests fail. Here, we type code interactively for testing, but it's exactly as if we received this string over the Internet in a CGI script's form field: C:\...\PP2E\Internet\Other>python restricted.py Input (ctrl+z=end) => x = 5 Input (ctrl+z=end) => for i in range(x): print 'hello%d' % i, Input (ctrl+z=end) => hello0 hello1 hello2 hello3 hello4 C:\...\PP2E\Internet\Other>python restricted.py Input (ctrl+z=end) => open(r'C:\temp\rexec.txt', 'w').write('Hello rexec\n') Input (ctrl+z=end) => C:\...\PP2E\Internet\Other>python restricted.py Input (ctrl+z=end) => print open(r'C:\temp\rexec.txt', 'r').read( ) Input (ctrl+z=end) => Hello rexec On the other hand, attempting to access files outside the allowed directory will fail in our custom class, as will inherently unsafe things such as opening sockets, which rexec always makes out of bounds by default: C:\...\PP2E\Internet\Other>python restricted.py Input (ctrl+z=end) => open(r'C:\stuff\mark\hack.txt', 'w').write('BadStuff\n') Input (ctrl+z=end) => Traceback (innermost last): File "restricted.py", line 41, in ? guard.r_exec(input) # ask guard to check and do opens File "C:\Program Files\Python\Lib\rexec.py", line 253, in r_exec exec code in m.__dict__ File "<string>", line 1, in ? File "restricted.py", line 30, in r_open raise SystemError, 'files outside %s prohibited' % SafeDir SystemError: files outside C:\temp prohibited C:\...\PP2E\Internet\Other>python restricted.py Input (ctrl+z=end) => open(r'C:\stuff\mark\secret.py', 'r').read( ) Input (ctrl+z=end) => Traceback (innermost last): File "restricted.py", line 41, in ? guard.r_exec(input) # ask guard to check and do opens File "C:\Program Files\Python\Lib\rexec.py", line 253, in r_exec exec code in m.__dict__ File "<string>", line 1, in ? File "restricted.py", line 30, in r_open raise SystemError, 'files outside %s prohibited' % SafeDir SystemError: files outside C:\temp prohibited C:\...\PP2E\Internet\Other>python restricted.py Input (ctrl+z=end) => from socket import * Input (ctrl+z=end) => s = socket(AF_INET, SOCK_STREAM) Input (ctrl+z=end) => Traceback (innermost last): File "restricted.py", line 41, in ? guard.r_exec(input) # ask guard to check and do opens ...part ommitted... File "C:\Program Files\Python\Lib\ihooks.py", line 324, in load_module exec code in m.__dict__ File "C:\Program Files\Python\Lib\plat-win\socket.py", line 17, in ? _realsocketcall = socket NameError: socket And what of that nasty rm * problem? It's possible in normal Python mode like everything else, but not when running in restricted mode. Python makes some potentially dangerous attributes of the os module, such as system (for running shell commands), disallowed in restricted mode: C:\temp>python >>> import os >>> os.system('ls -l rexec.txt') -rwxrwxrwa 1 0 0 13 May 4 15:45 rexec.txt 0 >>> C:\temp>python %X%\Part2\internet\other\restricted.py Input (ctrl+z=end) => import os Input (ctrl+z=end) => os.system('rm *.*') Input (ctrl+z=end) => Traceback (innermost last): File "C:\PP2ndEd\examples\Part2\internet\other\restricted.py", line 41, in ? guard.r_exec(input) # ask guard to check and do opens File "C:\Program Files\Python\Lib\rexec.py", line 253, in r_exec exec code in m.__dict__ File "<string>", line 2, in ? AttributeError: system Internally, restricted mode works by taking away access to certain APIs (imports are controlled, for example) and changing the __builtins__ dictionary in the module where the restricted code runs to reference a custom and safe version of the standard __builtin__ built-in names scope. For instance, the custom version of name __builtins_ _.open references a restricted version of the standard file open function. rexec also keeps customizable lists of safe built-in modules, safe os and sys module attributes, and more. For the rest of this story, see the Python library manual. |
| I l@ve RuBoard |


Chapter 10 R information and citations
This analysis used R 3.3.2
R Core Team (2016). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.
and the packages:
readxl
To read in excel files
Hadley Wickham and Jennifer Bryan (2017). readxl: Read Excel Files. R package version 1.0.0. https://CRAN.R-project.org/package=readxl
jsonlite
To work with JSON data from the Good Country Index website
Jeroen Ooms (2014). The jsonlite Package: A Practical and Consistent Mapping Between JSON Data and R Objects. arXiv:1403.2805 [stat.CO] URL https://arxiv.org/abs/1403.2805.
dplyr
To manipulate data
Hadley Wickham, Romain Francois, Lionel Henry and Kirill Müller (2017). dplyr: A Grammar of Data Manipulation. R package version 0.7.4. https://CRAN.R-project.org/package=dplyr
tidyr
To improve the arrangement of data
Hadley Wickham (2017). tidyr: Easily Tidy Data with ‘spread()’ and ‘gather()’ Functions. R package version 0.6.3. https://CRAN.R-project.org/package=tidyr
countrycode
To check country identification codes:
Vincent Arel-Bundock (2017). countrycode: Convert Country Names and Country Codes. R package version 0.19. https://CRAN.R-project.org/package=countrycode
rvest
To gather data from web pages
Hadley Wickham (2016). rvest: Easily Harvest (Scrape) Web Pages. R package version 0.3.2. https://CRAN.R-project.org/package=rvest
feather
To create intermediate files
Hadley Wickham (2016). feather: R Bindings to the Feather ‘API’. R package version 0.3.1. https://CRAN.R-project.org/package=feather
knitr
To create finished reports
Yihui Xie (2017). knitr: A General-Purpose Package for Dynamic Report Generation in R. R package version 1.16.
ggplot2
To make plots of the data
H. Wickham. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York, 2009.
viridis
To automatically produce a nice colour scheme for the plots
Simon Garnier (2016). viridis: Default Color Maps from ‘matplotlib’. R package version 0.3.4. https://CRAN.R-project.org/package=viridis
bookdown
To produce the finished website and pdf
Yihui Xie (2017). bookdown: Authoring Books and Technical Documents with R Markdown. Chapman and Hall/CRC. ISBN<PHONE_NUMBER>109


Flights halted at Atlanta airport after 'threatening note' found on plane
by Shaddi Abusaid and Chris Joyner, The Atlanta Journal-ConstitutionATLANTA -
Flights at Hartsfield-Jackson International Airport were temporarily suspended Saturday morning after a threatening note was discovered on a plane, authorities said.
The note was found just before 7 a.m. on an American Airlines flight bound for Dallas, said Atlanta police spokesman Carlos Campos.
Shortly before takeoff, a crew member discovered a sticker on the floor of the plane's galley that referenced people dying, police said.
"The pilot made the decision to come back to the gate so we could check the plane," Campos said, adding that passengers were evacuated and rescreened once the aircraft returned to Concourse T.
Police searched the plane, but found nothing that posed a threat to passengers or crew members, authorities said. The all-clear was given and the airport returned to normal operations shortly before 9 a.m.
The airport appeared to run smoothly once the ground stop was lifted. At the Domestic North Terminal, passengers soon reported on-time departures and security lines were manageable.
It's unclear what the note said or who stuck it to the floor of the plane, but Campos confirmed that no arrests were made.
A Federal Aviation Administration spokesman said a list of delayed flights caused by Hartsfield-Jackson's ground stop won't be available until Monday.


Clients
id
First Name
Last Name
Phone
Birthdate
Update
Delete
1
1
1
1
1
Update
Delete
View all clients
Update


--- layout: post title: "Threading context through a catamorphism" description: "A problem solved after 1½ years." date: 2021-04-12 11:09 UTC tags: [Functional Programming, F#, Haskell] --- {% include JB/setup %}
{{ page.description }}
You've probably noticed that it's easier to learn something new if it looks or sounds like something you already know. As a native Dane, I've found it easier to learn English and German than Russian and Japanese. If you originally were a Java or C# developer, you probably find JavaScript more approachable than Clojure or APL.
I believe that this extends to design patterns and universal abstractions as well. If code new to you follows well-known abstractions, it may be easier to learn than if it's structured in an entirely ad-hoc manner. This is my motivation for learning such universal abstractions as monoids, functors, and catamorphisms.
I particularly enjoy when it's possible to apply such abstractions to a proper problem. This occasionally happens. One example is my small article series on a functional file system.
In those articles, I described how you could base most of the code on the rose tree catamorphism. There was just one snag. There was one function, calculateMoves
, that I was unable to implement with the catamorphism. In the article, I acknowledged my failure:
"Earlier, I wrote that you can implement desiredThis was true for both the Haskell proof of concept as well as the F# port.Tree
functionality with thefoldTree
function, but that was a simplification. If you can implement the functionality ofcalculateMoves
withfoldTree
, I don't know how."
Tyson Williams and I discussed this wart without getting closer to a solution.
As the idiom goes, perfect is the enemy of good, so I decided to move on, although it nagged me.
The problem with the calculateMoves
function was that it needed to thread a 'context' recursively through the entire data structure. In this case, the context was a file path.
When calculateMoves
runs over the input tree, it needs to thread a relative path
through the function, building it up as it traverses the data structure.
For example, if a leaf node named 1
is in a directory named b
, which itself is a subdirectory of a
, the relative path should be a/b/1
. This example is straight from the test cases shown in both articles. You can also find the tests in the GitHub repository.
Each time calculateMoves
visits a Node
or Leaf
it needs to know the parent path
to calculate the destination path. As the articles show, this isn't too hard to do with regular pattern matching and recursion.
I couldn't figure out, however, how to thread the path
through the function when I tried to implement it with the catamorphism.
While I'm ready to walk away from problems when I'm stuck, I tend to remember them. Sometimes, I run into a solution much later.
This happened to me yesterday. I was trying to answer a Stack Overflow question which was explicitly about the application of universal abstractions. Once more, I was stuck by being unable to thread a 'context' through a catamorphism. This time, instead of a path
, the context was an indentation depth. Basically, the question was how to render a tree with proper indentation.
Again, this isn't hard if you resort to explicit pattern matching and recursion, but I couldn't figure out how to do it via the data structure's catamorphism.
Fortunately, the user danidiaz posted an awesome answer while I was struggling. The answer uses a trick that I hadn't noticed before: It threads the indentation depth through the data structure by using the catamorphism to produce a structure map with a function as the carrier type. Specifically, danidiaz defines the algebra Todo' (Int -> String) -> Int -> String
to reduce a Todo' (Int -> String)
to an Int -> String
function. This function then gets initialised with the depth 0
.
While I've been doing functional programming for years, I sometimes still tend to forget that functions are first-class values...
This trick, though, seems to be universally applicable. If you need to thread a context through a catamorphism, define the algebra to work on functions that take the context as an argument.
If this is a universally applicable trick, it also ought to work with the calculateMoves
function.
In my Haskell proof of concept, the calculateMoves
function originally looked like this:
calculateMoves :: Tree FilePath FilePath -> Tree FilePath Move calculateMoves = imp "" where imp path (Leaf x) = Leaf $ Move x $ replaceDirectory x path imp path (Node x xs) = Node (path </> x) $ imp (path </> x) <$> xs
It uses an imp
(for implementation) function to explicitly recurse over a Tree FilePath FilePath
. Until yesterday, I couldn't come up with a better solution to thread the path
through the data structure.
The new trick suggests that it'd be possible to implement the function on foldTree
(the catamorphism) by using a function as the carrier type. Since the context to be threaded through the catamorphism is a String
(the path
), the catamorphism should produce a function that takes a String
as argument. In other words, the carrier type of the Tree
should be String -> Tree FilePath Move
.
Let's expand on this: The type of foldTree
is foldTree :: (a -> [c] -> c) -> (b -> c) -> Tree a b -> c
. Usually, I tend to think of the type parameter c
as the type of some value, but since it's unconstrained, it can also be a function. That's what we need here: c
should be String -> Tree FilePath Move
.
That's not too hard to do, because of currying. Just write functions that take an extra String
argument and pass them to foldTree
:
calculateMoves :: Tree FilePath FilePath -> Tree FilePath Move calculateMoves t = foldTree fNode fLeaf t "" where fLeaf :: FilePath -> String -> Tree FilePath Move fLeaf x path = Leaf $ Move x $ replaceDirectory x path fNode :: FilePath -> [String -> Tree FilePath Move] -> String -> Tree FilePath Move fNode x fs path = Node (path </> x) $ ($ path </> x) <$> fs
Here I've used type annotations for the local functions, but that's entirely optional:
calculateMoves :: Tree FilePath FilePath -> Tree FilePath Move calculateMoves t = foldTree fNode fLeaf t "" where fLeaf x path = Leaf $ Move x $ replaceDirectory x path fNode x fs path = Node (path </> x) $ ($ path </> x) <$> fs
I included the type annotations to make it a little clearer what's going on. Recall that the type of foldTree
is foldTree :: (a -> [c] -> c) -> (b -> c) -> Tree a b -> c
. First consider the second of the two function arguments, the one I call fLeaf
in the above code. It's the simplest of the two, so it makes sense to start with that one.
The generic type of fLeaf
is b -> c
. How does that map to the type of fLeaf
, which is FilePath -> String -> Tree FilePath Move
?
Well, the Tree
that the catamorphism runs on is a Tree FilePath FilePath
. Mapped to the parametrically polymorphic type of foldTree
that's Tree a b
. In other words, b
maps to FilePath
. Thus, in order to fit the type of b -> c
, the type corresponding to b
in fLeaf
must be FilePath
. What's left? String -> Tree FilePath Move
is what's left. The function takes a FilePath
as input and returns a String -> Tree FilePath Move
. In other words, c ~ String -> Tree FilePath Move
.
How does that fit with fNode
?
Generically, this function must have the type a -> [c] -> c
. We've already established that c
must be String -> Tree FilePath Move
. Since the catamorphism runs on a Tree FilePath FilePath
, we also know that a
must be FilePath
. Thus, plugging in all the types, fNode
must have the type FilePath -> [String -> Tree FilePath Move] -> String -> Tree FilePath Move
. Note, particularly, that the second argument is a list of functions. That's why I decided to name the parameter fs
, for functions.
The entire expression foldTree fNode fLeaf t
, then, has the type String -> Tree FilePath Move
, since c
is String -> Tree FilePath Move
and the return type of foldTree
is c
.
The final trick is to apply this function to the initial relative path ""
, which returns a Tree FilePath Move
.
This compiles and passes all tests. calculateMoves
is now implemented using the Tree
catamorphism, a goal that eluded me for more than one and a half years.
With the Haskell proof of concept in place, it's fairly trivial to port the new implementation to the F# code base.
The calculateMoves
function originally looked like this:
// Tree<string,FileInfo> -> Tree<string,Move> let calculateMoves = let replaceDirectory (f : FileInfo) d = FileInfo (Path.Combine (d, f.Name)) let rec imp path = function | Leaf x -> Leaf { Source = x; Destination = replaceDirectory x path } | Node (x, xs) -> let newNPath = Path.Combine (path, x) Tree.node newNPath (List.map (imp newNPath) xs) imp ""
In the F# code base, the catamorphism is called Tree.cata
, but otherwise looks like the Haskell foldTree
function. The refactoring is also similar:
// Tree<string, FileInfo> -> Tree<string, Move> let calculateMoves t = // FileInfo -> string -> FileInfo let replaceDirectory (f : FileInfo) d = FileInfo (Path.Combine (d, f.Name)) // FileInfo -> string -> Tree<'a, Move> let fLeaf x path = Leaf { Source = x; Destination = replaceDirectory x path } // string -> (string -> Tree<string, 'a>) list -> string -> Tree<string, 'a> let fNode x fs path = let newNPath = Path.Combine (path, x) Tree.node newNPath (List.map (fun f -> f newNPath) fs) Tree.cata fNode fLeaf t ""
Again, the expression Tree.cata fNode fLeaf t
has the type string -> Tree<string, Move>
, so applying it to ""
produces a Tree<string, Move>
return value.
I don't recall where I read the following, but I was under the impression that a data structure's catamorphism was its 'universal API', upon which you could implement any other functionality. I'd love it if it was true, but after my 2019 failure to implement calculateMoves
via the Tree
catamorphism, I wasn't sure if such a conjecture would hold.
I still don't know if that assertion holds universally, but at least one reason to doubt it has now been removed.
Comments
Excellent work Mark! I too had not forgotten about this, and it nagged me as well.
To some extent, I feel like your explanation of how to implement
calculateMoves
viaTree.cata
is top-down. By top-down, I mean it might depend on discovering the key idea of havingTree.cata
return a function and then figuring out the correct type for that function. A good thing about such top-down approaches is being immediately aware that a better solution likely exists even if it takes some time and effort to find it.I was curious if a bottom-up approach would work. By bottom-up, I mean applying small refacorings to the code that are motivated by the principles, conventions, or style of functional programming. I do think I found such an approach. Of course it is a bit contradictory of me to only be able to find this approach after I read your presentation of the top-down approach. However, I am thinking of it like a kata. I now know such a bottom-up approach should be possible, and I want to find it.
My bottom-up approach is in this branch. Here is a brief summary of how I want myself to think of making those commits in that order.
Each case of the discriminated union could be extracted to its own function. This is easy to do in the
Leaf
case (so do it now), but it is not as easy to do in theNode
case because of recursion, so delay that change for a bit. If we did extract both functions though, both functions would include the argument that I calledpathToParent
. Since it is passed in everywhere, it should be passed in nowhere (by eta reducing). To do that, we need it to be the last parameter toimp
. After switching this order, we now deal with the recursion by doing it as soon as possible. Then the remaining code in that case can be extracted, andimp
is essentiallyTree.cata
.In this approach, I never thought about the possibility of
Tree.cata
returning a function. It just sort of fell out as a consequence of my other changes.Very nice!
In Haskell there is a library called recursion-schemes that showcases these types of recursion with catamorphisms, but also with many others recursion schemes. You can check it out and see if it gives you any new ideas.
Regarding this use of catamorphism, the library itself I believe shows a very similar example here, using the Reader type (which is isomorphic to the function you used in your example):
Gonzalo, thank you for reminding me of the recursion-schemes library. It's one of those tomes of knowledge of which I'm aware, but never really have gotten around to look at...


@added in SmartDeviceLink 7.1.0
- (nonnull instancetype)initWithAppCapabilityType:
(nonnull SDLAppCapabilityType)appCapabilityType;
init(appCapabilityType: SDLAppCapabilityType)
- appCapabilityType
A SDLAppCapability object
- (nonnull instancetype)
initWithAppCapabilityType:(nonnull SDLAppCapabilityType)appCapabilityType
videoStreamingCapability:
(nullable SDLVideoStreamingCapability *)videoStreamingCapability;
init(appCapabilityType: SDLAppCapabilityType, videoStreamingCapability: SDLVideoStreamingCapability?)
- appCapabilityType
- videoStreamingCapability
A SDLAppCapability object
Used as a descriptor of what data to expect in this struct. The corresponding param to this enum should be included and the only other param included.
@property (nonatomic, strong) SDLAppCapabilityType _Nonnull appCapabilityType;
var appCapabilityType: SDLAppCapabilityType { get set }
Describes supported capabilities for video streaming
@property (nonatomic, strong, nullable) SDLVideoStreamingCapability *videoStreamingCapability;
var videoStreamingCapability: SDLVideoStreamingCapability? { get set }


This section lists various ways to increase communication within the team. It should be noted that there is a spatial separation of the team members. Since the teams come from different countries and the communication is compulsory in English, one should assume that each participant speaks English confidently.
Skype
The well-known instant messaging tool from Microsoft can now be more than a few years ago. However, the main functions are the exchange of messages, internet telephony and video conferences. In addition, Skype also provides the function of screen transmission. This allows a user to transfer their own desktop to another user (also known as TeamViewer).
Slack
Slack is a web-based instant messaging service that allows a team to share files, as well as provide different rooms to communicate with each other. Chat rooms with different topics are created for this purpose. Users can then join the appropriate room. Slack provides the integration of various services, such as Google Drive. Slack works natively in the browser, but can also be used as a desktop app and as a mobile app for both common operating systems.
Trello
Bei Trello handelt es sich um eine reine webbasierte Projektmanagementsoftware.  Diese können dann beliebig bearbeitet und mit Checklisten, Anhängen und mit einem festgelegten Termin versehen werden. Neben einer mobilen Version gibt es auch passend dazu Apps für beide gängigen Plattformen sowie Windows.
Git
Git is a free software for managing file diversion. It works distributed. This means that there is no central sever, but each has its own local copy of the repository including the version history. Git is mainly a tool for developers. Nevertheless, it is in any case one of the tools that is developed in large projects in which software is developed. With Git, software can be better distributed. Everyone can work on the same program. In the best case everyone gets a partial task and then independent and independently from the other team. When someone is finished, only the part that has been edited by the project member is added.
Conclusion
There are relatively many tools you can use for project management. However, you have to pay attention to what you need. Depending on the project type and affinity of the project members, different tools can be used. Since not all students are IT Affin, one could consider whether one uses several tools for different tasks. Skype offers the possibility to see in a videoconference, what would be important for such a project, since this can be mediated trust. As part of the project, a continuous exchange of information must take place, which is why you should have an instant messaging tool. Furthermore, a board as described in the section “Scrum Board” would also be useful. Also, a central place to exchange files would be very helpful. Especially for developers the use of Git would be very helpful.


Switches to a window if more than one window is open, or a pane of a window if the window is split and its panes are not frozen. Switching to a pane is useful with functions such as VSCROLL, HSCROLL, and GOTO, which operate only on the active pane.
Syntax
ACTIVATE(window_text, pane_num)
ACTIVATE?(window_text, pane_num)
Window_text is text specifying the name of a window to switch to: for example, "Book1" or "Book1:2".
If a workbook is displayed in more than one window and window_text does not specify which window to switch to, the first window containing that workbook is switched to.
If window_text is omitted, the active window is not changed.
Pane_num is a number from 1 to 4 specifying which pane to switch to. If pane_num is omitted and the window has more than one pane, the active pane is not changed.
| Pane_num | Activates |
| 1 | Upper-left pane of the active sheet. If the window is not split, this is the only pane. If the window is split only horizontally, this is the upper pane. If the window is split only vertically, this is the left pane. |
| 2 | Upper-right pane of the active sheet. If the window is split only vertically, this is the right pane. If the window is split only horizontally, an error occurs. |
| 3 | Lower-left pane of the active sheet. If the window is split only horizontally, this is the lower pane. If the window is split only vertically, an error occurs. |
| 4 | Lower-right pane of the active sheet. If the window is split into only two panes either vertically or horizontally, an error occurs. |
Related Functions
ACTIVATE.NEXT Switches to the next window, or switches to the next sheet in a workbook
ACTIVATE.PREV Switches to the previous window, or switches to the previous sheet in a workbook
DOCUMENTS Returns the names of the specified open workbooks
FREEZE.PANES Freezes the panes of a window so that they do not scroll
ON.WINDOW Runs a macro when you switch to a window
SPLIT Splits a window
WINDOWS Returns the names of all open windows
WORKBOOK.SELECT Select a sheet in a workbook
Return to index


ONE DAY IN SEPTEMBER
Reviewed by Harvey Karten Sony Pictures Classics Director: Kevin Macdonald Producers: Arthur Cohn, John Battsek Cast: Michael Douglas as Narrator
Substitute 2000 for the date 1972 and The West Bank for The Munich Olympics and the thrilling non-fiction film "One Day in September" can be ripped out of today's headlines. Kevin Macdonald's doc is about the massacre of Israeli athletes by extremists during the Munich, Germany Olympics in 1972, an incident whose background could be traced back at least until 1917 but, for practical purposes might be said to originate in 1948. In that year, the United Nations granted a sliver of land that amounted to just one-fifth of one percent of the total land area of the Middle East to a new, Jewish state, the remainder of what was held under a British mandate since the end of World War I to form an Arab state. The Jewish leadership, happy to get anything at all, immediately accepted. But the little state was immediate invaded by (what was it..seven, eight, nine?) of its hostile neighbors. Partly because leaders in the Arab states urged Palestinian Muslims to depart from Israel "temporarily until the people of that new country are driven into the sea" and partly because the Israeli army "encouraged" some departures, thousands of Palestinians abandoned their homes quickly only to be housed in refugee camps under squalid conditions.
Anti-Israel extremists pursued a policy of sporadic terrorism, or hit-and-run-guerrilla warfare against Israel. The massacre of eleven Israeli athletes in 1972 is perhaps the most theatrical example of attempts by these extremists to call attention to the issue of the displacement of these thousands of Palestinian people and the refusal of Israel to re-admit them to its borders. The British documentarian, Kevin Macdonald, made "One Day in September" to call attention of an audience in the 21st Century to this devastating event. Macdonald, who had previously directed "A Brief History of Errol Morris," knows how to make a nonfiction film. He avoids the error of Mark Jonathan Harris, whose "Into the Arms of Strangers" took the heartwarming event of the adoption of 10,000 European Jewish children by British families during the 1940s and made it into the deadening "talking heads" style that turns off so many of today's moviegoers. Macdonald treats the 1972 massacre with all the dramatic techniques which a modern film maker uses to add excitement to fictional tales. His story is anchored by an interview with the story of a single person, Israeli fencer Andre Spitzer, a particularly heroic fellow who taught fencing to youth as a way to get the youngsters to respect one another. From time to time his widow commands screen attention amid footage of their happier days but at no point does Macdonald give in to the documentarian's usual compulsion to hand the movie over to talking heads.
Not that the interviews are banal. From from it. Almost miraculously producer John Battsek, associate producer Andrew Ruhemann, and Macdonald were able to round up people who would otherwise be most reluctant to particiate in the project including one of the world's public enemies, Jamal al Gashey--the only surviving member of the eight terrorists, now hiding somewhere in Africa and fearful of meeting the fate of compatriots who were successfully "hit" by an Israeli assassination squad some time after the Munich event. While the interview with al Gashey, shown here in segments culled from an eight-hour talk between him and the film makers, was the most difficult to obtain, others who were reluctant to talk showed their faces as well. They included German Federal Minister Hans Deitrich Gensher and Zvi Zamir, ex-head of the Israeli secret police, or Mossad.
Amid an stirring soundtrack which includes scores by Philip Glass, Macdonald unfolds the tale with film clips from the Olympic games (effectively contrasting the '72 event with the infamous 1936 German Olympics used by Hitler to glorify National Socialism), with the relatively restrained use of personal interviews, with computer graphics and still photos and various accoutrements designed to give "One Day in September" the feel of a fictionalized event. With occasional voiceovers by Michael Douglas, "One Day in September" takes us into key facets of the games including a segment from multiple gold-medal winner Mark Spitz's strokes in the pool and a taut basketball game pitting the Americans against the Russians. When eight Palestinian terrorists dressed as athletes and toting machine guns in their bags invade the quarters of the male Israeli athletes (ironically helped over a fence by naive Americans), the world's attention became centered on Munich thanks to the TV cameras--whose intrusion gave the terrorists information of the whereabouts of the German security forces.
While we are meant to abhor the craven actions of the terrorists, director Macdonald is eager to give the audience a look at the cowardly ways that the German government treated the incident, and in one particularly effective bit of probing shows how German leaders later set up a phony hijack of a Sabena Airlines jet to quickly free the three perpetrators being incarcerated on their land, hoping that this sop would discourage future terrorist actions on their soil.
Macdonald brings history to life as few other documentarians have done, using the techniques of fictional helmers such as irony, an effectively used soundtrack, and interviews with people whose mere presence on the screen demonstrates the ingenuity of producers and director in even obtaining the exchanges. In doing that they are echoing Claude Lanzmann, whose "Shoah" similarly amassed numbers of subjects who would be expectedly averse to appearing in a documentary. The background of the Munich disaster, specifically the motivations are the terrorists, is given short shrift, a circumstance that could vex some critics. But "One Day in September" appropriately centers on the event itself, performing a service to today's moviegoers who may well know nothing of yet another sad day in recent German history.
Not Rated. Running time: 92 minutes. (C) 2000 by Harvey Karten<EMAIL_ADDRESS>The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


| Package | Description |
|---|---|
| ml.alternet.grammars | |
| ml.alternet.parser |
Allow to design grammar, parse input and generate a custom data structure.
|
| ml.alternet.parser.ast |
Helper classes to build an abstract syntax tree
thanks to token mappers and rule mappers.
|
| ml.alternet.parser.handlers |
Various handlers.
|
| ml.alternet.parser.util |
Data structures utils.
|
| ml.alternet.parser.visit |
Base algorithms for visiting rules.
|
| Class and Description |
|---|
| EventsHandler
Events receiver when a grammar is parsing an input.
|
| Grammar
Base interface for defining grammars.
|
| Grammar.MainRule
Mark the main rule of a grammar with this annotation.
|
| Grammar.Proxy
Allow to separate a rule declaration
and its assignment.
|
| Grammar.Rule
A grammar is composed of rules that
can be tokens or so-called rules.
|
| Grammar.Token
When parsing, a token yield a
EventsHandler.TokenValue . |
| Class and Description |
|---|
| EventsHandler
Events receiver when a grammar is parsing an input.
|
| EventsHandler.RuleEnd
Event fired when a rule ends ; indicates whether
the rule was fulfilled or not.
|
| EventsHandler.RuleEvent
When a rule or token is matched while parsing.
|
| EventsHandler.RuleStart
Event fired when a rule starts.
|
| EventsHandler.TokenValue
A wrapper of a parsed value, the token that creates it,
and the position where the value was found when
available.
|
| Grammar
Base interface for defining grammars.
|
| Grammar.AtLeast
Make a rule repeatable.
|
| Grammar.CharToken
A character token, based on compositions of character ranges.
|
| Grammar.Combine
A rule skeleton for combining rules.
|
| Grammar.Combine.Flattenable
For a rule that have components that may be flatten.
|
| Grammar.Combine.Simplifiable
For a rule that can be replaced by its component if it has
just one, provided that it is not a grammar field.
|
| Grammar.EnumToken
A token made from an enum class or a list of string values ;
the order of the enum values doesn’t matter ; the longest value
if available will be read from the input.
|
| Grammar.EnumValueToken
An enum value token, just like a string, but with an enum value.
|
| Grammar.Number
A number token.
|
| Grammar.Optional
Make a rule optional.
|
| Grammar.Proxy
Allow to separate a rule declaration
and its assignment.
|
| Grammar.Repeatable
Base class for repeatable rules.
|
| Grammar.Repeatable.Maximal
For repeatable rules that must be repeated a maximal number of times.
|
| Grammar.Repeatable.Minimal
For repeatable rules that must be repeated a minimal number of times.
|
| Grammar.Rule
A grammar is composed of rules that
can be tokens or so-called rules.
|
| Grammar.StringToken
A string token.
|
| Grammar.Token
When parsing, a token yield a
EventsHandler.TokenValue . |
| Grammar.TypedToken
A token based on rules.
|
| Grammar.TypedToken.Number
A token that collect its subrules to a number.
|
| Grammar.Wrapper
A rule skeleton for composing rules.
|
| Grammar.ZeroOrMore
Make a rule optional repeatable.
|
| Handler
Events receiver when a grammar is parsing an input
with rewind capabilities (mark, consume/cancel).
|
| Class and Description |
|---|
| EventsHandler
Events receiver when a grammar is parsing an input.
|
| EventsHandler.TokenValue
A wrapper of a parsed value, the token that creates it,
and the position where the value was found when
available.
|
| Grammar
Base interface for defining grammars.
|
| Grammar.Rule
A grammar is composed of rules that
can be tokens or so-called rules.
|
| Grammar.Token
When parsing, a token yield a
EventsHandler.TokenValue . |
| Handler
Events receiver when a grammar is parsing an input
with rewind capabilities (mark, consume/cancel).
|
| Class and Description |
|---|
| EventsHandler
Events receiver when a grammar is parsing an input.
|
| EventsHandler.RuleEnd
Event fired when a rule ends ; indicates whether
the rule was fulfilled or not.
|
| EventsHandler.RuleEvent
When a rule or token is matched while parsing.
|
| EventsHandler.RuleStart
Event fired when a rule starts.
|
| EventsHandler.TokenValue
A wrapper of a parsed value, the token that creates it,
and the position where the value was found when
available.
|
| Grammar.Rule
A grammar is composed of rules that
can be tokens or so-called rules.
|
| Handler
Events receiver when a grammar is parsing an input
with rewind capabilities (mark, consume/cancel).
|
| Class and Description |
|---|
| EventsHandler
Events receiver when a grammar is parsing an input.
|
| Grammar
Base interface for defining grammars.
|
| Grammar.Rule
A grammar is composed of rules that
can be tokens or so-called rules.
|
| Handler
Events receiver when a grammar is parsing an input
with rewind capabilities (mark, consume/cancel).
|
| Class and Description |
|---|
| Grammar
Base interface for defining grammars.
|
| Grammar.Rule
A grammar is composed of rules that
can be tokens or so-called rules.
|
Copyright © 2020 Alternet. All rights reserved.


TransAssist - Forgot password
Forgot Password?
Enter your registered email id here, and we will send you a mail with a link to reset your password!
Send Me A Mail


High capacity reversible hydrogen storage in titanium doped 2D carbon allotrope Ψ-graphene: Density Functional Theory investigations
B. Chakraborty, P.Ray, N. Garg, S. Banerjee (ex-Director, BARC)
Elsevier - International Journal of Hydrogen Energy (Nov. 2020)
Research Article - DOI Link
Ti-doped PSI-Graphene as an Efficient Medium for Hydrogen Storage
Pranoy Ray, Brahmananda Chakraborty
Department of Atomic Energy Computational Chemistry Symposoium 2019, Govt. of India
Poster - PUBLISHED in Proceedings (under Board of Research for Nuclear Sciences)
View Published Abstract
First Principles Study of Hydrogen Storage in Transition-Metal doped Carbon Nanostructures
High Pressure & Synchrotron Radiation Physics Division, BARC
This ongoing project is being conducted under the supervision of Dr. B. Chakraborty, Scientist G of HP & SRPD, BARC. The determination of Hydrogen Storage Capabilities of various new materials in accordance with the DOE's standards is being analyzed using BARC's supercomputing facility.
Determination of Water Contamination Content Profile in a Steel Plant Belt (Durgapur)
Physics Department, NIT Durgapur
This ongoing project is being conducted under the supervision of Prof. Hirok Chaudhari. The determination of the content profile and their effect in our daily lives, besides a few other detrimental physical factors are measured.
Identification of Post Investment Casting Defects
Development Department, F&F Division, Hindustan Aeronautics Limited
The project aims at the identification of various defects that can be detected post-casting only like microshrinkage, blowholes, etc., their analysis and finally their mitigation.
Preventive Measures for Quality Control using Lean Management
Quality Control Department, F&F Division, Hindustan Aeronautics Limited
The project aims at designing of Fish-Bone (Fishikawa) Diagrams to mitigate the errors caused during various sectors of the casting process used to manufacture various aircraft parts, with materials such as Mn-alloys, Al-alloys, etc..
Materials Data Science and Informatics
Georgia Institute of Technology, USA
Certification Completed in: 2020
View Certificate
Introduction to High-Throughput Materials Development
Georgia Institute of Technology, USA
Certification Completed in: 2020
View Certificate
Machine Learning for All
University of London
Certification Completed in: 2020
View Certificate
Mathematics for Machine Learning: Linear Algebra
Imperial College London
Certification Completed in: 2020
View Certificate
Statistical Mechanics: Algorithms & Computations
Ecole Normale Suprieure, Paris
Certification Completed in: 2020
View Certificate
Quantum Mechanics
University of Colorado-Boulder, USA
Certification Completed in: 2020
View Certificate
Materials Processing
Georgia Institute of Technology, USA
Certification Completed in: 2020
View Certificate
Silicon Thin Film Solar Cells
Ecole Polytechnique, France
Certification Completed in: 2020
View Certificate
Composite Materials
IIT Kharagpur, India
Certification Completed in: 2018
View Certificate
Kinetics & Modeling of Iron-Making Blast Furnace
Tohoku University, Japan & IISC Bangalore, India
Certification Completed in: 2017
View Certificate
Welding Metallurgy of Ferrous Alloys Stainless Steel
University of Alberta, Canada & IIT Madras, India
Certification Completed in: 2017
View Certificate
Welding Metallurgy of Non-Ferrous Alloys
University of Tennesse-Knoxville, USA & IIT Madras, India
Certification Completed in: 2017
View Certificate
MHRD Innovation Cell
Government of India
Certification Recieved in: 2019
View Certificate
Backyard Startups
The Telegraph (India)
#JustHashtags is a startup that I co-founded with my old friend Swarupjit. We were interviewed by this newspaper as we made headlines with our foolproof business idea in the city of Calcutta (where we launched). I continue to play a non-profit advisory role in this startup, because of my interest in research.


Prepare the local development environment
JDK, Maven, Eclipse, and IDEA is required. If you already have these development tools installed, skip this section.
JDK version and installation steps
1.JDK version
The JDK version requires 1.8 or higher.
2.JDK download
Please go to the official address of JDK version 1.8 to download.
3.JDK installation
After downloading the JDK installation package on the official website, select the appropriate installation path to install the JDK.
Here is the windows system as an example:
Set the JAVA_HOME environment variable to point to the Java installation directory. Add %JAVA_HOME%\bin to the system path path. After the environment variable is configured, use the java -version command to verify whether the installation is successful. The windows environment is echoed as follows:
C:\> java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
Maven installation steps
Maven is a development tool that integrates project management, code compilation and more.
Prerequisites
The JDK has been installed successfully.
installation steps
- Download the Maven installation package at the official address.
- Unzip the Maven installation package to the native path.
- Set environment variables：
- Set the M2_HOME environment variable to point to the Maven installation directory.
- Add %M2_HOME%\bin to the system path path.
- Verification
Use the mvn -version command to verify that the installation is successful. The windows environment is echoed as follows:
C:\>mvn -version
Apache Maven 3.3.9
Eclipse installation
Prerequisites
a.JDK has been installed.
b.Maven is already installed.
installation steps
a. Download the Eclipse installation package at the official address.
b. Install Eclipse to the machine.
c. (Optional) Extract the plugin m2eclipse described in the previous Maven installation to the plugins and features directory in the Eclipse installation directory. The latest Eclipse version
With the Maven plugin, don't do this
d. Start Eclipse, configure jre, maven settings, and the default encoding format is utf-8.
IDEA installation
Prerequisites
a.JDK has been installed.
b.Maven is already installed.
installation steps
a. Download the IDEA installation package on the official website, the paid version or the community version according to individual needs.
b. Set the encoding format to utf-8.
Open IDEA and select File -> Settings -> Editor -> File Encoding Change project Encoding and default encoding for properties files to utf-8.
c. Set up maven configuration
Open IDEA and select File -> Settings -> Build, Execution, Deployment -> Bulid Tools -> Maven Note configuring Maven home directory and User settings file


public class SoundPlayer
extends java.lang.Object
implements android.media.SoundPool.OnLoadCompleteListener
SoundPlayer
is a simple utility class that plays sounds on the phone. The class
is used through its singleton instance.| Modifier and Type | Class and Description |
|---|---|
protected static class |
SoundPlayer.CurrentlyPlaying |
protected static class |
SoundPlayer.InstanceHolder |
protected class |
SoundPlayer.LoadedSoundCache
SoundPlayer.LoadedSoundCache keeps track of loaded sounds, mapping sound resource id to loaded
sound id. |
static class |
SoundPlayer.PlaySoundParams |
protected static interface |
SoundPlayer.SoundFromFile |
protected class |
SoundPlayer.SoundInfo |
protected static class |
SoundPlayer.StopWhat |
| Modifier and Type | Field and Description |
|---|---|
protected SoundPlayer.SoundInfo |
currentlyLoadingInfo |
protected java.util.concurrent.CountDownLatch |
currentlyLoadingLatch |
protected java.util.Set<SoundPlayer.CurrentlyPlaying> |
currentlyPlayingSounds |
protected boolean |
isRobotController |
protected SoundPlayer.LoadedSoundCache |
loadedSounds |
protected java.lang.Object |
lock |
protected float |
masterVolume |
protected android.media.MediaPlayer |
mediaSizer |
static int |
msSoundTransmissionFreshness |
protected java.util.concurrent.ScheduledExecutorService |
scheduledThreadPool |
protected android.content.SharedPreferences |
sharedPreferences |
protected float |
soundOffVolume |
protected float |
soundOnVolume |
protected android.media.SoundPool |
soundPool |
static java.lang.String |
TAG |
protected java.util.concurrent.ExecutorService |
threadPool |
static boolean |
TRACE |
protected Tracer |
tracer |
| Constructor and Description |
|---|
SoundPlayer(int simultaneousStreams,
int cacheSize)
Instantiates a new sound player.
|
| Modifier and Type | Method and Description |
|---|---|
static SoundPlayer.SoundInfo |
addRef(SoundPlayer.SoundInfo soundInfo) |
void |
close() |
protected static void |
copy(java.io.InputStream inputStream,
java.io.OutputStream outputStream,
int cbToCopy) |
protected void |
ensureCached(android.content.Context context,
int resId)
Ensures this local sound is also in the local cache.
|
protected SoundPlayer.SoundInfo |
ensureCached(java.lang.String hashString,
SoundPlayer.SoundFromFile ifAbsent)
returns a new ref on the returned
SoundPlayer.SoundInfo ; caller must releaseRef() |
protected SoundPlayer.SoundInfo |
ensureLoaded(android.content.Context context,
java.io.File file) |
protected SoundPlayer.SoundInfo |
ensureLoaded(android.content.Context context,
int resourceId) |
protected SoundPlayer.SoundInfo |
ensureLoaded(java.lang.String hashString,
SoundPlayer.SoundFromFile ifAbsent)
returns a new ref on the returned
SoundPlayer.SoundInfo ; caller must releaseRef() |
static SoundPlayer |
getInstance() |
float |
getMasterVolume()
Returns the master volume control that is applied to all played sounds
|
protected int |
getMsDuration(android.content.Context context,
java.io.File file) |
protected int |
getMsDuration(android.content.Context context,
int resourceId) |
protected long |
getMsNow() |
CallbackResult |
handleCommandPlaySound(java.lang.String extra) |
CallbackResult |
handleCommandRequestSound(Command requestSoundCommand) |
CallbackResult |
handleCommandStopPlayingSounds(Command stopPlayingSoundsCommand) |
protected void |
internalStopPlaying(SoundPlayer.StopWhat stopWhat) |
boolean |
isLocalSoundOn() |
protected void |
loadAndStartPlaying(android.content.Context context,
java.io.File file,
SoundPlayer.PlaySoundParams params,
<any> runWhenStarted,
java.lang.Runnable runWhenFinished) |
protected void |
loadAndStartPlaying(android.content.Context context,
int resourceId,
SoundPlayer.PlaySoundParams params,
<any> runWhenStarted,
java.lang.Runnable runWhenFinished) |
void |
onLoadComplete(android.media.SoundPool soundPool,
int sampleId,
int status) |
void |
play(android.content.Context context,
java.io.File file,
float volume,
int loop,
float rate) |
void |
play(android.content.Context context,
int resId)
Deprecated.
use
startPlaying(Context, int) instead |
void |
play(android.content.Context context,
int resId,
boolean waitForCompletion)
Deprecated.
use
#startPlaying(Context, int, PlaySoundParams, Consumer, Runnable) instead |
void |
play(android.content.Context context,
int resourceId,
float volume,
int loop,
float rate) |
void |
prefillSoundCache(int... resourceIds)
Ensures that these local sounds are also in the local cache
|
boolean |
preload(android.content.Context context,
java.io.File file)
Preloads the sound so as to to reduce delays if the sound is subsequently played.
|
boolean |
preload(android.content.Context context,
int resourceId)
Preloads the sound so as to to reduce delays if the sound is subsequently played.
|
static void |
releaseRef(SoundPlayer.SoundInfo soundInfo) |
protected void |
safeClose(java.lang.Object closeable) |
void |
setMasterVolume(float masterVolume)
Sets the master volume control that is applied to all played sounds
|
void |
startPlaying(android.content.Context context,
java.io.File file) |
void |
startPlaying(android.content.Context context,
java.io.File file,
SoundPlayer.PlaySoundParams params,
<any> runWhenStarted,
java.lang.Runnable runWhenFinished) |
void |
startPlaying(android.content.Context context,
int resId)
Asynchronously loads the indicated sound from its resource (if not already loaded), then
initiates its play once any current non-looping sound is finished playing.
|
void |
startPlaying(android.content.Context context,
int resId,
SoundPlayer.PlaySoundParams params,
<any> runWhenStarted,
java.lang.Runnable runWhenFinished)
Asynchronously loads the indicated sound from its resource (if not already loaded), then
initiates its play, optionally waiting for any currently non-looping playing sounds to finish first.
|
protected void |
startPlayingLoadedSound(SoundPlayer.SoundInfo soundInfo,
SoundPlayer.PlaySoundParams paramsIn,
<any> runWhenStarted,
java.lang.Runnable runWhenFinished) |
void |
stopPlayingAll()
Stops playing all sounds that are currently playing
|
void |
stopPlayingLoops()
Stops playing all sounds that are currently playing in a loop
|
protected void |
waitForLoadCompletion() |
public static final java.lang.String TAG
public static boolean TRACE
protected Tracer tracer
public static final int msSoundTransmissionFreshness
protected final java.lang.Object lock
protected final boolean isRobotController
protected android.media.SoundPool soundPool
protected java.util.concurrent.CountDownLatch currentlyLoadingLatch
protected SoundPlayer.SoundInfo currentlyLoadingInfo
protected SoundPlayer.LoadedSoundCache loadedSounds
protected java.util.concurrent.ExecutorService threadPool
protected java.util.concurrent.ScheduledExecutorService scheduledThreadPool
protected android.content.SharedPreferences sharedPreferences
protected float soundOnVolume
protected float soundOffVolume
protected float masterVolume
protected android.media.MediaPlayer mediaSizer
protected java.util.Set<SoundPlayer.CurrentlyPlaying> currentlyPlayingSounds
public SoundPlayer(int simultaneousStreams, int cacheSize)
simultaneousStreams
- the number of sounds that can simultaneously play from this player.
If one, then playing any new sound interrupts the playing of a
a previous soundcacheSize
- the maximum size of the cache of loaded sounds.public static SoundPlayer getInstance()
public void close()
public void prefillSoundCache(int... resourceIds)
public void startPlaying(android.content.Context context, int resId)
context
- the context in which resId is to be interpretedresId
- the resource id of the raw resource containing the sound.public void startPlaying(android.content.Context context, java.io.File file)
public void startPlaying(android.content.Context context, int resId, SoundPlayer.PlaySoundParams params, <any> runWhenStarted, java.lang.Runnable runWhenFinished)
context
- the context in which resId is to be interpretedresId
- the resource id of the raw resource containing the sound.params
- controls how the playback proceedsrunWhenStarted
- executed when the stream starts to playrunWhenFinished
- executed when the stream finishes playingpublic void startPlaying(android.content.Context context, java.io.File file, SoundPlayer.PlaySoundParams params, <any> runWhenStarted, java.lang.Runnable runWhenFinished)
public void stopPlayingAll()
public void stopPlayingLoops()
protected void internalStopPlaying(SoundPlayer.StopWhat stopWhat)
public boolean preload(android.content.Context context, int resourceId)
public boolean preload(android.content.Context context, java.io.File file)
public void setMasterVolume(float masterVolume)
getMasterVolume()
public float getMasterVolume()
setMasterVolume(float)
@Deprecated public void play(android.content.Context context, int resId)
startPlaying(Context, int)
instead@Deprecated public void play(android.content.Context context, int resId, boolean waitForCompletion)
#startPlaying(Context, int, PlaySoundParams, Consumer, Runnable)
insteadprotected void loadAndStartPlaying(android.content.Context context, int resourceId, SoundPlayer.PlaySoundParams params, <any> runWhenStarted, java.lang.Runnable runWhenFinished)
protected void loadAndStartPlaying(android.content.Context context, java.io.File file, SoundPlayer.PlaySoundParams params, <any> runWhenStarted, java.lang.Runnable runWhenFinished)
protected SoundPlayer.SoundInfo ensureLoaded(android.content.Context context, int resourceId)
protected SoundPlayer.SoundInfo ensureLoaded(android.content.Context context, java.io.File file)
public boolean isLocalSoundOn()
protected void startPlayingLoadedSound(SoundPlayer.SoundInfo soundInfo, SoundPlayer.PlaySoundParams paramsIn, <any> runWhenStarted, java.lang.Runnable runWhenFinished)
protected int getMsDuration(android.content.Context context, int resourceId)
protected int getMsDuration(android.content.Context context, java.io.File file)
protected void waitForLoadCompletion()
public void onLoadComplete(android.media.SoundPool soundPool, int sampleId, int status)
onLoadComplete
in interface android.media.SoundPool.OnLoadCompleteListener
protected long getMsNow()
protected SoundPlayer.SoundInfo ensureLoaded(java.lang.String hashString, SoundPlayer.SoundFromFile ifAbsent)
SoundPlayer.SoundInfo
; caller must releaseRef()protected void ensureCached(android.content.Context context, int resId)
protected SoundPlayer.SoundInfo ensureCached(java.lang.String hashString, SoundPlayer.SoundFromFile ifAbsent)
SoundPlayer.SoundInfo
; caller must releaseRef()public CallbackResult handleCommandPlaySound(java.lang.String extra)
public CallbackResult handleCommandStopPlayingSounds(Command stopPlayingSoundsCommand)
protected static void copy(java.io.InputStream inputStream, java.io.OutputStream outputStream, int cbToCopy) throws java.io.IOException
java.io.IOException
public CallbackResult handleCommandRequestSound(Command requestSoundCommand)
protected void safeClose(java.lang.Object closeable)
public static SoundPlayer.SoundInfo addRef(SoundPlayer.SoundInfo soundInfo)
public static void releaseRef(SoundPlayer.SoundInfo soundInfo)
public void play(android.content.Context context, int resourceId, float volume, int loop, float rate)
public void play(android.content.Context context, java.io.File file, float volume, int loop, float rate)


Inversion of Control (IoC) is an essential tool for any software designer’s design toolbox because it’s often a great way to break dependencies between classes and promote loose coupling. IoC is vital for doing Test Driven Development without pulling out all of your hair in frustration.
This was originally published on Jeremy's blog in September of 2005, but the principles still apply equally today.
I’m doing an interesting refactoring early this week on some existing code. I apologize in advance for being a little vague, but the NDA thingy gets in the way a bit here. The product that my team works on is basically a B2B hub between sender companies (spokes) and receiving companies.
The application:
The translation code is obviously critical to the system, so it’s very important that the automated testing is rock solid. Moreover, that code would be extremely useful in many other contexts throughout our enterprise. The code works just fine and there is a robust suite of automated tests ensuring that the code continues to work. I had tried in the past to adapt this code inside of an automated regression test tool without any success because it had too much “tail.” What I mean by this is that the code can only function with some specific dependencies on a couple of different data sources that weren’t necessarily easy or even possible to recreate without bringing in a large fraction of the system. Using the translation code requires some data access code which in turn requires some configuration code and external settings in a Registry (We’re going to make this go away too. I detest using the Registry for any configuration, much less as a Plugin strategy.).
In an ongoing effort to speed up a slow (15-20 minutes) build, I managed to break the integration tests for the translation classes and had an opportunity to look much closer at this code. Here’s roughly what I found:
public class
Translator1
{
private
readonly IDataSource _source;
public Translator1(IDataSource source)
{
_source = source;
}
public Translator1()
{
_source = new CompanyDataSource();
}
public XmlDocument TranslateFlatFile(byte[] contents,
string senderId, string receiverId)
{
XmlDocument document = this.startNewXmlDocument();
CompanyInfo sender = _source.FetchCompanyInfo(senderId);
CompanyInfo receiver = _source.FetchCompanyInfo(receiverId);
this.createSenderNode(sender,
document);
this.createReceiverNode(receiver,
document);
// Do a lot of other stuff
return document;
}
private void
deepInTheBowelsOfTheClass(string key)
{
string something =
DataSourceSingleton.Instance.LookupValue(key);
// do something with "something"
}
[OTHER METHODS]
}
And the test fixture looks a bit like this:
[TestFixture]
public class
Translator1TestFixture
{
[Test]
public void
WriteTheSenderNode()
{
// The sender and receiver data is assumed to
be in the database -- somewhere
Translator1 translator = new
Translator1();
byte[] contents =
this.readFlatFile();
XmlDocument document = translator.TranslateFlatFile(contents, "ID00001",
"ID00210");
XmlNode senderNode = document.DocumentElement.SelectSingleNode("Sender");
Assert.AreEqual("
}
private byte[]
readFlatFile()…
}
So what’s so terribly wrong with this code? From my standpoint there are several problems.
My thought on the translation code is to apply Inversion of Control to the translation code to remove the database dependency. Let some other class be responsible for running out and fetching the receiver and sender information and “push” it into the translator. I could have abstracted the data source class as an interface and used Constructor Injection to push alternative classes or mocks into the Translator2 class. My thinking in this case is to simplify both the reuse of the translation code and eliminate the mocking overhead (~70 automated tests) by eliminating the interaction with a data source class altogether.
The code below is a skeleton of the approach I’m going to take to refactor our translation code (someday). Here’s how I think the new code stacks up to the old code.
public class
Translator2
{
public Translator2()
{
}
public XmlDocument TranslateFlatFile(byte[] contents, CompanyInfo sender, CompanyInfo
receiver )
{
XmlDocument document = this.startNewXmlDocument();
this.createSenderNode(sender,
document);
this.createReceiverNode(receiver,
document);
// Do a lot of other stuff
return document;
}
#region
other methods…
}
[TestFixture]
public class
Translator2TestFixture
{
[Test]
public void
WriteTheSenderNode()
{
CompanyInfo sender = new CompanyInfo();
sender.City = "
// set other sender properties
CompanyInfo receiver = new
CompanyInfo();
// set receiver properties
byte[] contents =
this.readFlatFile();
Translator2 translator = new
Translator2();
XmlDocument document = translator.TranslateFlatFile(contents, sender,
receiver);
XmlNode senderNode = document.DocumentElement.SelectSingleNode("Sender");
Assert.AreEqual(sender.City, senderNode["City"].InnerText);
}
private byte[]
readFlatFile()…
}
All I’ve really done is move the responsibility for fetching data out of the database into another class. It’s a small change but it had a positive impact on both the code and the testing. If you think about it, you could actually say that software design boils down to “Where should this code go?” I think there’s a watershed moment in every developer’s career when they start look more at their code as a structure and less as a bag of statements.
We’re taught that the key to safe lifting is “push, don’t pull.” I like to think of Inversion of Control as applying this mantra to code. IoC is fairly common, and much more so with Test Driven Development practices. Here are some other examples of IoC you might run into.
public class
PullClass
{
private int
_threshold;
public PullClass()
{
_threshold = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["Threshold"]);
}
}
public class
PushClass
{
private
readonly int _threshold;
public PushClass(int threshold)
{
_threshold = threshold;
}
}


| Basic Data types and structures |
scalar == vector[0] |
true scalars |
|
vectors, (numerical, character, logical, factor) |
(string, integer, float, complex, boolean) |
|
arrays, == vectors (m x n) |
arrays (m x n) of scalars |
|
matrices, |
|
|
data frames, |
dictionary, |
|
and lists |
and lists |
| Operators - arithmetic |
+ - * / |
+ - * / |
| - exponent |
^ |
** |
| - modulus remainder |
%% |
% |
| - modular division |
%/% |
// |
| - logical / boolean |
&, |, ! |
and, or, not |
| - logical / comparison |
==, <, <=, >, >=, != |
==, <, <=, >, >=, != |
| Flow Control |
|
|
| - conditionals, decisions |
if-else, ifelse(), switch |
if, else, elif |
| - Loops |
while(), for() |
while, for |


About
Hi, my name is Krunal Patel. An Embedded Software Developer. I am passionate about coding and life.
I received my Master’s and Bachelor’s degrees in Electronics and Communication Engineering from GTUniversity.
Learn moreDon't waste your time search for the same thing. Here is where I collect the resources.
Learn more