Arrays and Hashes
April 22, 2015
Arrays
An array can be thought of as a list of items. It is simply a collection of items. An array can be used to store different types of information in a certain order. For instance, say you wanted to keep a list of famous mathematicans. You can store this list in an array. Depending on what programming language you are using, the representation will be slightly different. NOTE: Any programming syntax you see here will probably be ruby language. Back to our mathematicians, lets say we keep the names of mathematicians in a list.
We would have something like:
mathguys = ["Gauss", "Euler", "Galois", "Pascal"]
In oder to retrieve a famous mathematician from the list, we need to know the position of the position of the mathematican. One important thing to mention is that in computer science, counting begins at 0. So the first item would be the item at position 0, 2nd will be at position 1, and so on. In ruby, to retrieve the first mathematician on this list, we would do :
mathguys[0]
This refers to Gauss.
What's the point of storing these items? Well, you can probably think of several reasons why you would need to store items in a list. For example, we might want to sort these great mathematicians in order of greatness(this can be done as long as you provide a well defined method for sorting by greatness). Sorting is a very important method in computer science. Most programming languages have inbuilt methods to sort arrays. In Ruby, we could simply do : mathguys.sort
and this would rearrange the mathematicans in alphabetical order. Apart from sorting, there are lots of other things you can do with arrays. Visit Ruby docs if you're curious to see some other things we can do with an array.
Hashes
An Array is not the only type of collection item available. Another important collection item is the Hash.
A Hash is sort of like an array, but it's quite different. Like an array, a Hash can be used to store and retrieve values, but the process is a bit different. A hash stores items as key-value pairs. A key can be thought of as the index. A value is the actual item you want to get. For example, say we wanted to store not only the last names, but also the first names of our mathematicians. In Ruby we could store them in a hash like this:
mathguys ={"Gauss"=>"Carl", "Euler"=>"Leonhard", "Galois"=>"Evariste" " "Pascal"=>"Blaise"}
If we want to know the First name(value) of a mathematician, we need to use the index(key) to retrieve it. For instance, If you wanted to know the Euler's first name, we would do:
mathguys["Euler"]
This tells Ruby to get the value whose key is "Euler". This would return "Leonhard".
Just like Arrays, Hashes are very important in computer programming and there are several things which we can do with hashes. It is important to understand how Arrays and Hashes work because being able to keep things in a collection is very useful. To learn more about the different things we can do with hashes, feel free to look at the Ruby docs for hashes.


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.aspectwerkz.proxy.Uuid
public final class Uuid
NOTE:
This code is based on code from the [Plasmid Replication Engine] project.
Original JavaDoc:
Our distributed objects are generally named most efficiently (and cleanly) by their UUID's. This class provides some static helpers for using UUID's. If it was efficient to do in Java, I would make the uuid an normal class and use instances of it. However, in current JVM's, we would end up using an Object to represent a long, which is pretty expensive. Maybe someday. ###
UUID format: currently using currentTimeMillis() for the low bits. This uses about 40 bits for the next 1000 years, leaving 24 bits for debugging and consistency data. I'm using 8 of those for a magic asci 'U' byte.
Future: use one instance of Uuid per type of object for better performance and more detailed info (instance could be matched to its uuid's via a map or array). This all static version bites.###
| Field Summary | |
|---|---|
protected static long
|
lastTime
|
static long
|
UUID_MAGIC
|
static long
|
UUID_MAGICMASK
|
static long
|
UUID_NONE
|
static long
|
UUID_WILD
|
| Constructor Summary | |
|---|---|
Uuid
()
|
| Method Summary | |
|---|---|
static boolean
|
isValid
(long uuid)
Returns true if uuid could have been generated by Uuid. |
static long
|
newUuid
()
Generate and return a new Universally Unique ID. |
| Methods inherited from class java.lang. Object |
|---|
clone
,
equals
,
finalize
,
getClass
,
hashCode
,
notify
,
notifyAll
,
toString
,
wait
,
wait
,
wait
|
| Field Detail |
|---|
public static final long UUID_NONE
public static final long UUID_WILD
public static final long UUID_MAGICMASK
public static final long UUID_MAGIC
protected static long lastTime
| Constructor Detail |
|---|
public Uuid ()
| Method Detail |
|---|
public static long newUuid ()
public static boolean isValid (long uuid)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Cards flexbox
Lorem ipsum dolor sit amet, consectetur.
Published on: May, 2020
By: The Travel Blog
Read More
Lorem ipsum dolor sit amet, consectetur.
Published on: May, 2020
By: The Travel Blog
Read More
Lorem ipsum dolor sit amet, consectetur.
Published on: May, 2020
By: The Travel Blog
Read More
Lorem ipsum dolor sit amet, consectetur.
Published on: May, 2020
By: The Travel Blog
Read More
Lorem ipsum dolor sit amet, consectetur.
Published on: May, 2020
By: The Travel Blog
Read More
Lorem ipsum dolor sit amet, consectetur.
Published on: May, 2020
By: The Travel Blog
Read More


“Ab Initio Prediction of Metal Phosphide Anode Materials for Lithium and Beyond Lithium Batteries”, Angela F Harper, (2018) MPhil
“First Principles Structure Prediction of Extreme Nanowires”, Jamie M Wynn, (2018) PhD
“Ab Initio Anode Materials Discovery for Li- and Na-Ion Batteries”, Martin D.Mayo, (2017) PhD
“A Stochastic Approach To Condensed Matter Physics”, Andrew J. Morris, (2009) PhD
Open-Access Data
Electrodes
“Research data supporting “Structural Evolution of Electrochemically Lithiated MoS2 Nanosheets and the Role of Carbon Additive in Li-Ion Batteries” Data
“Research data supporting: “(De)Sodiation via Helical Phosphorus Intermediates in High Capacity Anodes for Sodium-ion Batteries” Data
“Research data supporting “Investigating Sodium Storage Mechanisms in Tin Anodes: A Combined Pair Distribution Function Analysis, Density Functional Theory, and Solid-State NMR Approach”” Data
Molecular Crystals
“Raw data for the study of colour properties of fluorescein in the solid state” Data
“Research data supporting “Experimental and theoretical evaluation of the stability of true MOF polymorphs explains their mechanochemical interconversions” Data
Encapsulated Nanotubes
“Research data supporting ‘Phase diagram of germanium telluride encapsulated in carbon nanotubes from first-principles searches” Data
“Research data supporting “Single-Atom Scale Structural Selectivity in Te Nanowires Encapsulated Inside Ultranarrow, Single-Walled Carbon Nanotubes” Data


{% extends "base.html" %} {% load i18n %} {% block page_title %}{% trans "Registration success" %}{% endblock %} {% block hubs %} {% include "widgets/base_hub.html" with part='main' %} {% endblock %} {% block maincontent %}
{% trans "Congratulations!" %}
{% blocktrans %} Your registration is almost done. Please, check your emails for a mail from us with a confirmation link.{% endblocktrans %}


Seleting hyper-parameter C and gamma of a RBF-Kernel SVM¶
For SVMs, in particular kernelized SVMs, setting the hyperparameter is crucial but non-trivial. In practice, they are usually set using a hold-out validation set or using cross validation.
This example shows how to use stratified K-fold crossvalidation to set C and gamma in an RBF-Kernel SVM.
We use a logarithmic grid for both parameters.
Script output:
('The best classifier is: ', SVC(C=100.0, cache_size=200, class_weight=None, coef0=0.0, degree=3,
gamma=0.10000000000000001, kernel='rbf', probability=False, scale_C=True,
shrinking=True, tol=0.001))
Python source code: plot_svm_parameters_selection.py
print __doc__
import numpy as np
import pylab as pl
from sklearn.svm import SVC
from sklearn.preprocessing import Scaler
from sklearn.datasets import load_iris
from sklearn.cross_validation import StratifiedKFold
from sklearn.grid_search import GridSearchCV
iris_dataset = load_iris()
X, Y = iris_dataset.data, iris_dataset.target
# It is usually a good idea to scale the data for SVM training.
# We are cheating a bit in this example in scaling all of the data,
# instead of fitting the transformation on the trainingset and
# just applying it on the test set.
scaler = Scaler()
X = scaler.fit_transform(X)
# For an initial search, a logarithmic grid with basis
# 10 is often helpful. Using a basis of 2, a finer
# tuning can be achieved but at a much higher cost.
C_range = 10. ** np.arange(-3, 8)
gamma_range = 10. ** np.arange(-5, 4)
param_grid = dict(gamma=gamma_range, C=C_range)
grid = GridSearchCV(SVC(), param_grid=param_grid, cv=StratifiedKFold(y=Y, k=5))
grid.fit(X, Y)
print("The best classifier is: ", grid.best_estimator_)
# plot the scores of the grid
# grid_scores_ contains parameter settings and scores
score_dict = grid.grid_scores_
# We extract just the scores
scores = [x[1] for x in score_dict]
scores = np.array(scores).reshape(len(C_range), len(gamma_range))
# Make a nice figure
pl.figure(figsize=(8, 6))
pl.subplots_adjust(left=0.15, right=0.95, bottom=0.15, top=0.95)
pl.imshow(scores, interpolation='nearest', cmap=pl.cm.spectral)
pl.xlabel('gamma')
pl.ylabel('C')
pl.colorbar()
pl.xticks(np.arange(len(gamma_range)), gamma_range, rotation=45)
pl.yticks(np.arange(len(C_range)), C_range)
pl.show()


Makeup is art!
As a makeup artist I have the power to turn my brides into the most beautiful, confident and happy people on their special day.
I am primarily based in Dorking, Surrey and cover a large area in South East England.
Phone number: 07429 447156
News
Makeup by Jana on the cover of View Your Surrey Wedding Magazine articleYour Surrey Wedding Magazine 2019.


Choosing a bootcamp
After learning some basics on my own through books and web sources, I needed a more in depth education on coding. After a lot of research and weighing pros vs cons I chose Bloc.
Foundational courses
Before getting into any application programming, Bloc’s curriculum allowed me to reinforce my skills in HTML5, CSS, JS, & Ruby, enough for a basic application. Accounts with Code School and Code Warsoffered me more experience working through JS & Ruby problems.
Mentors
The mentors at Bloc might be the greatest part of this program. Some people may have experience before signing up for a bootcamp. My personal coding experience was limited. Early on, it was very difficult for me to sort through error messages. It was also very difficult to configure the environments needed for working applications. Having a mentor who could dedicate time to me when help was needed was HUGE.
Sometimes issues are unique to the point that there aren’t solutions through stack overflow or other online documentation. To a new coder, having a mentor to challenge you and help you work through issues has been an invaluable resource.
Projects
Bloc has pointed me towards various projects forcing me to explore different frameworks and libraries of code. As of now, I’ve built applications with VanillaJS, Ruby on Rails and Angular1 frameworks. The projects have required the use of Angular elements, JQuery, SCSS, JSON parsing and API calls, and much more. I’m currently learning React JS and plan on developing dynamic projects with its versatile library of code. The curriculum offered by Bloc has forced me to learn things that I wouldn’t have known to look for or how to start.
Yet to come
I am about to enter my final project phase with Bloc. I will post additional information in the future for these projects and experiences with them. Based on my experiences so far, I am confident that the final phase of this course with Bloc will be very beneficial.


Books |
Runaway : Stories
|
|
A collection of stories about women of all ages and circumstances.
Purchase this book ReviewsPublishers Weekly Nothing is new in Munro's latest collection, which is to say that the author continues to perfect her virtuosic formula in these eight short stories, several of which previously appeared in the New Yorker. Elaine Bender, Library Journal Munro's new story collection will delight fans and convert those who have never before read her work. Her spare style belies the psychological depth of the stories, which feature characters running away from someone or something (often representative of the past) or telling a lie by commission or omission (another form of running away). Recommended for all libraries. Kirkus Reviews Retrospect and resolution, neither fully comprehended nor ultimately satisfying: such are the territories the masterful Munro explores in her tenth collection.....In a word: magnificent. Francine Prose, More Dazzling...Whatís astonishing about Munroís work is how simultaneously unsparing and forgiving it is, how willing she is to say things no one else will admit out loud. Munro hasnít mellowed with maturity. She only grows sharper with time. Elle Magazine Readerís Prize A sensitive and deeply insightful writer, Munro renders hauntingly realistic characters with an unflinching eye." |


[§521-77] Investigation and resolution of complaints by the office of consumer protection. The office of consumer protection may receive, investigate and attempt to resolve any dispute arising under this chapter. [L 1976, c 77, §2]


Introduction to Basics of writing
What is writing?
"Writing" is the process of using symbols (letters of the alphabet, punctuation and spaces) to communicate thoughts and ideas in a readable form. Generally, we write using a pen/pencil (handwriting) or a keyboard (typing). With a pen/pencil we usually write on a surface such as paper or whiteboard. A keyboard is normally attached to a typewriter, computer or mobile device. Voice recognition programs allow those who can't see or use their hands to have their thoughts transcribed.
Show More...
To write clearly it is essential to understand the basic system of a language. In English this includes knowledge of grammar, punctuation and sentence structure. Vocabulary is also necessary, as is correct spelling and formatting.
A writer may write for personal enjoyment or use, or for an audience of one person or more. The audience may be known (targeted) or unknown. Taking notes for study purposes is an example of writing for one's self. Blogging publicly is an example of writing for an unknown audience. A letter to a friend is an example of writing for a targeted audience. As with speaking, it is important to consider your audience when writing. There are many different styles of writing, from informal to formal.
Why is writing important?
- Writing is the primary basis upon which your work, your learning, and your intellect will be judged—in college, in the workplace, and in the community.
- Writing expresses who you are as a person
- Writing is portable and permanent. It makes your thinking visible.
- Writing helps you move easily among facts, inferences, and opinions without getting confused—and without confusing your reader.
- Writing promotes your ability to pose worthwhile questions.
- Writing fosters your ability to explain a complex position to readers, and to yourself.
- Writing helps others give you feedback.
- Writing helps you refine your ideas when you give others feedback.
- Writing requires that you anticipate your readers’ needs. Your ability to do so demonstrates your intellectual flexibility and maturity.
- Writing ideas down preserves them so that you can reflect upon them later.
- Writing out your ideas permits you to evaluate the adequacy of your argument.
- Writing stimulates you to extend a line of thought beyond your first impressions or gut responses.
- Writing helps you understand how truth is established in a given discipline
Show More...
- Writing equips you with the communication and thinking skills you need to participate effectively in democracy.
- Writing is an essential job skill.


fun line(template: String): TooltipOptions
Specifies the string template to use in the multi-line tooltip.
template
- A line template to add the tooltip with a label.
Variables and aesthetics can be accessed via a special syntax:
- ^color for aes
- @year for variable
- @{number of cylinders} for variable with spaces in the name
- @{square m^2} for variable with spaces and '^' symbol in the name
- @nameWith^ for the variable with '^' symbol in its name
A '^' symbol can be escaped with a backslash, a brace character in the literal text - by doubling:
.line("text") -> "text"
.line("{{text}}") -> "{text}"
.line("@model") -> "mustang"
.line("{{@model}}") -> "{mustang}"
The specified 'line' for outlier will move it to the general multi-line tooltip.
The default tooltip has a label before the value, usually containing the name of the mapped variable.
It has it's own behaviour, like blank label for axis aesthetics.
This default label can be set in template using a pair of symbols '@|'.
The label can be overridden by specifying a string value before '|' symbol.
Within the tooltip line the label is left-aligned, the formed by template string is right-aligned.
If a label is not specified, the string will be centered in the tooltip. For example:
- line("^color"): no label, value is centered;
- line("|^color"): label is empty, value is right-aligned;
- line("@|^color"): default label is used, value is right-aligned;
- line("my label|^color"): label is specified, value is right-aligned.


Nimiq Tools
Send offline transaction
Serialized transaction
Transaction overview
Sender
Recipient
Value
Fee
Validity start height
Network
Hash
Connect to network
Send transaction


Tik Valued At Over R1m Seized In Century City Drug Bust
by NG EditorCAPE TOWN – Cape Town police have made a massive drug bust in Century City.
Officers seized tik valued at more than R1 million and arrested one person in an operation on Friday.
It was part of the Western Cape’s festive season anti-crime blitz.
An elderly man was also apprehended in a dagga bust in Milnerton.
The police’s Novella Potelwa said: “In Milnerton, a dagga cultivation facility was discovered in Montague Gardens. In Caledon, police seized mandrax tablets valued at R95,000.”


DDH recently challenged the Ruby on Rails community's assumptions regarding adoption of Test Driven Development. His arguement was, essentially, that putting too much emphasis on the tests has a cost in other areas.
There are however, certain things that you really want to know are what they proport to be. It may seem like a silly example, but testing that your variables are the type you expect them to be is important. If you are handling data where it matters; and frankly, who isn't? it is important to validate your data and test that your recent changes haven't done any harm.
But that isn't the best reason for tests. Testing is an exercise in expressing yourself clearly, first of all to yourself and then to any programmer who might come across your code. It is a way of communicating exactly what you expected to have happen in this chunk of code.
To communicate what you want to have happen clearly you need to actually have a pretty good idea of what you want to have happen. TDD forces you to get clear on your intent. It has the added side benefit of expressing your intent for future developers. (The future developer you help may just be yourself!)
DHH does have a valid concern. Test Driven Development can be the tail that wags the dog if you think of it religiously. It isn't salvation unto itself. It is the process you take to get from red to green that provides you opportunities to do things a liitle better. But if you put too much focus on the tests, you might stiffle your creativity, and that would be terrible.
Test Driven Development is a tool, hopefully one of many that you will use in your career. Use it, master it, but do not think that there is salvation in doing so. Use Test Driven Development to give yourself a lot of opportunities to be clear and write better code.


3. Generalization¶
When applying the pre-trained models or training models with your own data, it is important to review the results for a sample of the data. This is because how well these models perform to new and unseen data depends on how similar they are to the training data. Generalization of machine learning models remains an active research area. Users should exercise cautions when the modules are used beyond their intended purposes and trained model ability.
In this section, we show an example to demonstrate that different training datasets can produce difference accuracies and how important it is to review sample results and retrain the models as necessary.
We will demonstrate this through the example of our Occupancy classifier, Occupancy Classifier, which is a classifier to predict the occupancy type of a building given the street view image of the building.
The original training for this classifier was performed using OpenSeesMap (OSM). From we collected images from random records of the United Sates building ineventory which had their from occupancy type labelled. These labels include ‘detached’, ‘apartment’, and ‘commercial’. We renamed the labels to be consistent with the HAZUS naming system: ‘RES1’, ‘RES3’, ‘COM’, which was needed for our testbed. For each building a street view image was then downloaded from Google Street Maps. Buildings that were not clearly visible in the street view image were ignored.
The image set was then split into a training and a testing set.
The training set (OSM-1) included:
2,868 RES1
2,207 RES3
2,418 COM
The testing set (OSM-2) included:
98 RES1
97 RES3
98 COM
A ResNet50 model (model-1) is trained on the training set and tested on the testing set following the procedure described in Occupancy Classifier. For each class the accuracy is 100%, as shown in the confusion matrix Fig. 3.1.
The performance is very high on the OSM testing set.
We further obtained another dataset from New Jersey Department of Environmental Protection (NJDEP). This dataset only covers buildings from New Jersey, in which each building’s occupancy type is labeled. Form this inventory consisting over XX buildings, two sample sets weere chosen:
The first set (NJDEP-1) contains:
4,999 RES1
2,867 RES3
386 COM
The second set (NJDEP-2) contains:
812 RES1
905 RES3
837 COM
We tested model-1 on the NJDEP-2 dataset. It’s performance is plotted in the confusion matrix Fig. 3.2. The performance dropped significantly on this dataset.
Later, another ResNet50 model (model-2) is trained on the combined dataset OSM-1 + NJDEP-1. The new model is tested on two datasets, OSM-2 and NJDEP-2, again. As shown in Fig. 3.3 and Fig. 3.4. The new models’ performance on the OSM-2 dataset drops a bit, while it improved significantly on the NJDEP-2 dataset.


2 Kings 3:12
And Jehoshaphat said, The word of the LORD is with him. So the king of Israel and Jehoshaphat and the king of Edom went down to him.


MasseyHacks is a high school hackathon where 250+ students of all skill levels — from those who haven't written "Hello World!" to seasoned hackers with SSH enabled power strips — come together to learn and create something amazing for 24 hours straight. Here you'll find free-to-use hardware, experienced mentors, activities like cupstacking and hackenger hunts, and lots of workshops!
"The amount of free swag + the enthusiasm of the organizers was great!
Honestly, the entire weekend felt extremely well-organized and made for a great first hackathon."
A hackathon is an event where students of all backgrounds and disciplines come together to immerse themselves in computer science-infused activities, such as attending tech workshops or building projects and hacks of their own. Creativity and innovation are intrinsic to the hackathon experience. Check out last year's projects to get an idea of what a hackathon's like.
Not at all — in fact, we encourage newcomers to come and participate in MasseyHacks. We’ll teach you the fundamentals of programming, tech essentials and lots more!
You can go solo and create something by youself, but we encourage you to form a team beforehand — everything's better with friends. Teams can have up to 4 members. Don't worry if you don't have a team at the event, as we will have a team formation event for hackers to find potential team members.
Paperwork such as your waiver and ID are necessary for entry. Bring your own laptop and charger; power strips, sleeping bags and toiletries are recommended. As for other necessities like food, freedom and fun, rest assured that we’ve got you covered.
Once you've submitted your application, keep an eye on your application dashboard and your email for further updates. More info will be released closer to the time of the event.
Any high school student can participate. If you've graduated from high school, you can apply to be a mentor.
Tell them thanks, firstly. Then ask them to email us at<EMAIL_ADDRESS>to get started! We greatly appreciate support of any kind!
For students in Toronto and Waterloo, we'll be sending a bus your way if funding permits. If you're within a reasonable distance of the event, you're responsible for securing your own transportation. No other reimbursements are available at this time. Additional information will be provided closer to the time of the event.
We suggest that you stay for the entire event, but if you can't stay the night, you can leave during the night and come back. If are under 18, you can get a parent to pick you up before midnight and drop you back at the event after 5 am. If you are 18, you do not need a parent.
MasseyHacks charges nothing for entry — the event is free for all attendees!
Yes, of course! All hackers must abide to the MLH Code of Conduct found here.
Send us an email at<EMAIL_ADDRESS>and we'll get back to you as soon as we can!
"Thank you to everyone who made this event possible! It was my first hackathon and was a really great experience!"
"It was really fun! I enjoyed hacking with my friends and grinding on python all night."
Vincent Massey Secondary School
1800 Liberty St
Windsor, ON N9E 1J2
</> by the MasseyHacks Platform Team with
Copyright © 2018


 Please try again later.
No reports found. Please try executing any workflows.
Choose the job for which you wish to see the report!
Workflow Name: {{name.workFlowName}}
Job Start Time: {{jobStartTime | date: 'short'}}
Job End Time: {{jobEndTime | date: 'short'}}
Job Status: {{jobStatus}}
TaskStartTime: {{task.taskStartTime | date: 'short'}}
TaskEndTime: {{task.taskEndTime | date: 'short'}}
{{line}}


Small Finance
Guilherme Solski Alves
02/20
Input:
$10
Output:
$15
Balance:
$5
Add Another Type
Cancel
OK


After adding inline tag for md breakpoint on both divs
Inline Elements: https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements
Block Elements: https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
https://v5.getbootstrap.com/docs/5.0/utilities/display/
Learning guidence: Thapa Technical


Custom mesos executor in Scala
In previous post, we discussed about how to write a simple mesos scheduler in Scala. In this post, we are going to see how to extend the scheduler to run general scala code.
This post assumes that you already know different components of writing a scheduler in Mesos. If not refer to this post.
tl;dr Access the complete example code here.
Executor in Mesos
In last example, we used built in mesos executor CommandExecutor to run the commands. Command executor is capable of running any operating system binaries. But if we want to run java/scala code,we have to write our own executor to setup the environment and run the code.
Writing custom executor is not that straight forward. There are multiple pieces to write to get a full fledged executor. The following steps shows how to build these pieces.
Step 1 : Task abstraction
To run any function, we need to represent that function as a mesos task. The following trait represent the task abstraction.
trait Task[T] extends Serializable{
def run: T
}
Our task has a single run method. It does not take anything. Type T signifies the return type of the function. Note that task extends the serialization which allows us to send this task over wire to execute on mesos cluster.
class FunctionTask[T]( body: => () => T) extends Task[T] {
override def run: T = body()
}
FunctionTask is one of the implementation which wraps a given function inside task.
Now we have a task abstraction which we can instruct our scheduler to run.
Step 2 : TaskExecutor
TaskExecutor is our custom executor which runs above task abstraction. It’s just a normal scala program which has a main method. It creates an instance of mesos.Executor and listens on launchTask callback.
object TaskExecutor {
def main(args: Array[String]) {
val logger = Logger.getLogger(this.getClass.getName)
System.loadLibrary("mesos")
var classLoader: ClassLoader = null
var threadPool: ExecutorService = null
val exec = new Executor {
override def launchTask(driver: ExecutorDriver, task: TaskInfo): Unit = {
val arg = task.getData.toByteArray
threadPool.execute(new Runnable() {
override def run(): Unit = {
val runningTask = Utils.deserialize[Task[Any]](arg, classLoader)
Thread.currentThread.setContextClassLoader(classLoader)
try {
runningTask.run
driver.sendStatusUpdate(TaskStatus.newBuilder()
.setTaskId(task.getTaskId)
.setState(TaskState.TASK_FINISHED).build())
} catch {
case e: Exception => {
logger.error("the execption is",e)
logger.error("error in task id" + task.getTaskId.getValue)
System.exit(1)
}
}
}
})
}
......
new MesosExecutorDriver(exec).run()
}
In the code, we deserialize the task from the TaskInfo object. We run each task on different thread so that we can run multiple tasks at same time.
Once the execution is done, we wrap the result and set the task state to finished.
You can access complete code listing here.
Step 3 : Plug Custom Executor in Scheduler
Once we have the custom executor, next step is to plug it in our mesos scheduler. Mesos doesn’t understand any specific language, it just understands how to run shell scripts. So we run our task executor from a shell script and specify the shell script path in executor info.
def getExecutorInfo(d: SchedulerDriver): ExecutorInfo = {
val scriptPath = System.getProperty("executor_script_path","~/run-executor.sh")
ExecutorInfo.newBuilder().
setCommand(CommandInfo.newBuilder().setValue("" +
"/bin/sh "+scriptPath))
.setExecutorId(ExecutorID.newBuilder().setValue("1234"))
.build()
}
//call setExecutor to set the executor info
val taskInfo = TaskInfo.newBuilder()
.setSlaveId(SlaveID.newBuilder().setValue(offer.getSlaveId.getValue).build())
.setTaskId(TaskID.newBuilder().setValue(taskId.toString))
.setExecutor(getExecutorInfo(driver))
.setName(UUID.randomUUID().toString)
.addResources(cpus)
.setData(ByteString.copyFrom(Utils.serialize(task)))
.build()
Once we have executor info, we set for a given using setExecutor.
You can access complete code listing here.
Step 4 : run-executor script file
This script file, used by the executor info to instantiate our custom executor.
#!/bin/sh
echo "running Executor"
export LD_LIBRARY_PATH=$MESOS_HOME/src/.libs:$LD_LIBRARY_PATH
#update the path to point to jar
java -cp <project-path>/target/mesoscustomexecutor-1.0-SNAPSHOT.jar com.madhu.mesos.customexecutor.TaskExecutor
update project-path to the directory which has the build jar from code.
Step 5 : Creating tasks
We create 2 simple tasks to just to print hi and index. Note how we can even access closure inside our tasks.
def multipleTasks() = {
0 to 1 map {
index => {
val f = new FunctionTask[Unit](() => println("hi" + index))
f
}
}
}
Step 6 : Running
Clone complete code from github.
Run CustomTasks main method with mesos master url and path to the run-executor.sh shell script.
Step 7 : Output
The output should be available in mesos logs as specified here.


coronavirus novel patients Wuhan [Epub ahead viral {border-style print]. virus epidemic px;} #ffffff;} J., Chinese X., Wuhan, developed SARS health infected transmission China. M., Wang, disease new â€". L., Li, Y., cases clinical human infection infections pneumonia A., C., January W., Wu, Zhang, market patient px; remdesivir respiratory showed {font-family (a) China, F., coronavirus. family font-size important public symptoms treatment (%), B., Coronavirus D., G., Lancet: MERS Novel P., S., Yang, coronaviruses double; isolated measures seafood â€�nCoV (b) Huanan Lancet Med animal animals associated b). border-color border-width cell contact cough current data days isolation lung needed pii: research solid; spread subjects trials {font-style {font-weight (â€�nCoV) ./jama.. Chen, China China: Clinical Engl H., However, Hu, JAMA N., RNA Wuhan. Xu, Z., Zhou, Zhu, bat bats bold case change cities coronavirus, courier; different em; fever food genome genomes group identity indicating infection. infections. intermediate live market. modelling outside pt;} reduced seen sequence severe shared study study. suggests test


UNICAL expels two students, suspends three over exam malpractice
From Sam Ibok
The management of the University of Calabar has expelled two students and suspended three others over various forms of examination malpractices.
The students expelled with effect from the 2017/2018 academic session are: ThankGod Ibiang Ofem (Medicine and Surgery, with Matric No: 09/32083); and Asibade, Benjamin (Radiology with Matric. No: 13/2415002).
Those suspended for one academic session were Iroh Jacinta Adanze (Faculty of Law, 14/1145073); Ndukeobong Cyril Ebok (Radiology, 14/24145149); and Ogar Abang Francis (Radiology, 14/24145034).
One other student, Ekong Ekong Joseph (14/24145030) of the Radiology Department was exonerated from the allegation of examination malpractice.
Read Also: Three teachers, student held for alleged exam malpractice
According to separate letters to the students, signed by the University Registrar, Mr. Moses Abang, the decision was ratified by the Senate at its 217th meeting after receiving and reviewing the report of its Examination Misconduct Committee.
The suspended students are expected to resume full academic studies in the 2018/2019 session to repeat the year they were suspended, while those expelled are directed to handover all University properties in their possession, including their identity cards, to their respective Heads of Department before leaving the University premises.
Meanwhile, Ekong has been directed to go about his normal academic duties while remaining obedient at all times.


Current traffic signal control systems in use still rely heavily on oversimplified information and rule-based methods, although we now have richer data, more computing power and advanced methods to drive the development of intelligent transportation.
With the growing interest in intelligent transportation using machine learning methods like reinforcement learning, this survey covers the widely acknowledged transportation approaches and a comprehensive list of recent literature on reinforcement for traffic signal control. We hope this survey can foster interdisciplinary research on this important topic.
Here we present a survey about traffic signal control methods, including:
- Conventional transportation approaches
- RL-based traffic signal control approaches
Overview of the Survey Download


{% extends "layout.html" %} {% block page_title %} Declaration {% endblock %} {% block content %} {% include "../includes/phase_banner_beta.html" %} Sorry, you'll have to start again You haven't entered any details for 30 minutes, so we've cleared your information to keep it secure. {% include "../includes/help.html" %} {% endblock %} {% block body_end %} {% include "includes/scripts.html" %} {% endblock %}
You haven't entered any details for 30 minutes, so we've cleared your information to keep it secure.


--- title: Tab ---
This is the content of tab pane one.
This is the content of tab pane two.
This is the content of tab pane three.
This is the content of tab pane one.
This is the content of tab pane two.
This is the content of tab pane three.
This is the content of tab pane one.
This is the content of tab pane two.
This is the content of tab pane three.


Hi energy enthusiasts,
I know the title of the topic is appealing and probably i am not the first one wondering about it. So welcome everybody who wants to think about this with me.
I am a software developer that has being in contact with OEM for a long time. I haven't done many contributions to it but recently i had the great opportunity to work (yes for money) developing a module to visually program rules, it was exciting but not very useful yet.
Anyway, i have been thinking lots about it and have a couple of ideas that could work for making a living. I want a switch for my professional career and OEM fulfills me in so many ways....
So if you are in a similar situation than me and would like to discuss ideas, please let me know. I was thinking about organizing a small meeting in a big city to make it possible for people to attend, maybe end of october?
Just in case anybody wonders, I am serious about this one ;-)
All the best,
Carlos
Re: Making a living from the Open Energy Monitor?
Hi Carlos,
I have started customizing OEM systems for electricians here in California. I'm not much of a coder however, I'm just working with what is available an buying parts from the OEM shop.
Here's a 3-phase dashboard example:
http://data.peakmonitor.com/test01/dashboard
JD
Re: Making a living from the Open Energy Monitor?
Nice dashboard JD!
Re: Making a living from the Open Energy Monitor?
Sergegsx: Thank you!
So Carlos, what are you thinking about this? Are you looking for custom programming gigs? Looking to fork OEM into a commercialized branch? Develop 3 phase UL / CE / 480V hardware? Get "revenue grade" certification?
Every energy monitor designed for commercial use (not home use) charges a per-month fee. I personally avoid per-month fees wherever I can, so OEM/emoncms is a good fit for my business model because I want to sell what I would buy myself: hardware and installation, with no monthly fees. However, the costs have to be recouped somewhere... I'm curious as to what you have in mind.
Re: Making a living from the Open Energy Monitor?
Hi JD,
Sorry i didn't say anything about your previous post, thanks for getting involved in the conversation :)
I am not a expert in electronics, can do firmware.... My main skill is software development and it is this field where i think i could find work to do. I am thinking approaching the industry and offer to interface their system with emonCMS. Probably in any project there would be some electronics to do. Ideally an electronic geek would get involved too so there is more to offer.
Re: Making a living from the Open Energy Monitor?
I'm thinking I could do local supply, installs & software development (custom or otherwise).
I just purchased an emonPi to evaluate the possibility of working in this field. I'm getting a Solar PV system installed next week, so it will give me a chance to explore the possibilities.
However, without CE certification, this is a non-starter. I would have to get the hardware manufactured myself, and certify it myself. And if I am going to go to that expense, I have a few changes in mind, to make installs easier. I just wouldn't have the buying power to keep the hardware competitive.
Re: Making a living from the Open Energy Monitor?
Thanks logic ethos for your reply, i'll send a pm now
carlos