Bootstrap4 Paginator is a jQuery plugin that simplifies the rendering of Bootstrap Pagination component. It provides methods to automates the update of the pagination status and also some events to notify the status changes within the component. Bootstrap v4 is only supported.
It is very easy to get Bootstrap4 Paginator start working. You need to include the Bootstrap, jQuery and Bootstrap Paginator before you can use it. The zip ball can be download via the button provided above.
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">

Then in your code, you can use the following lines to render your Bootstrap Paginator. This is explained in the section Minimum Initialization. The Bootstrap Paginator will be rendered as shown. The only html markup required by Bootstrap Paginator is an empty div.

Bootstrap Paginator will have the Bootstrap Pagination Component rendered as shown in the following graph. It has 5 parts. Left most one is the go to first page item. The one next to it is the previous page item. The following numeric page items are of the type page. Next page item comes after it. Last page item will be the last one rendered. Please note that the labels are the types of each component.
| Attribute | Type | Default | Description |
|---|---|---|---|
| size | string | "normal" | Controls the size of output pagination component. Accepts values: small, normal, large. See the Size and alignment example for more detail. |
| itemContainerClass | function | This functions must return a string class name when rendering a specific page item. type, page, current are given as the parameters. The default function only returns "active" when the page is the current page and "page-item". See the Controlling the item container class example for more detail. | |
| currentPage | number | 1 | It marks the current page. If the current page is set out of range, an exception will be thrown. |
| numberOfPages | number | 5 | This one decides how many numeric pages (with type page as stated in the Structure Exaplained section) should be rendered. If its value <= 0, no numeric page will be rendered. See the Number of Pages example for more detail. |
| totalPages | number | 1 | It defines the upper limit of the page range. |
| pageUrl | function | pageUrl fills the href attribute when rendering the page items. type, page, current are given as the parameters. A string of URL should be returned. See Page URL example for more detail. | |
| alwaysDisplayNextPrevButtons | boolean | true | Defines buttons "Previous page" and "Next page" should be shown when current page is first or last. Used in default implementation shouldShowPageButton. |
| alwaysDisplayFirstLastButtons | boolean | true | Defines buttons "First page" and "Last page" should be shown when current page is first or last. Used in default implementation shouldShowPageButton. |
| shouldShowPageButton | boolean/function | function | Defines whether a page item should be shown. Before each page item is rendered, the code will check whether it should be rendered. Once supplied as a function, the following parameters are given: type, page, current. Boolean should be returned. See Controlling The Presence of Page Item for more detail. |
| itemTexts | function | Supplies the page item text during the rendering, it can be either plain text or html. The following parameters are given: type, page, current. See Page Item Example for more detail. | |
| useBootstrapTooltip | boolean | false | Defines whether to use the Bootstrap Tooltip as its tooltip rather than the original title attribute in the anchor tag . See Use Bootstrap Tooltip example for more detail. |
| bootstrapTooltipOptions | object | Default: { animation: true, html: true, placement: "top", selector: false, title: "", container: false } This object is the same as what you've seen in Bootstrap Tooltip Documentation for more detail. |
|
| onPageClicked | function | onPageClicked is the handler for the page-clicked event. The signature of the handler is function(event, originalEvent, type,page). If you would like the stop the page change from happening. Simply call event.stopImmediatePropagation() and do the page change yourself if applicable later. See page-clicked Event example for more detail. Also the stoppable page change within page click event is demonstrated in See Stopping Page Change Within Page Clicked Event for more detail. | |
| onPageChanged | function | onPageChanged is the handle for the page-changed event. The signature of the handler is function(event, oldPage, newPage). See page-changed Event example for more detail. | |
| ajaxUrl | string or function | null | This URL user for ajax requests when page changed. For work it also need targetElement. Once supplied as a function, the following parameters are given: currentPage. |
| targetElement | sting or HTMLElement or JQueryObject | null | Target where will be placed ajax response. |
| loadingElement | sting or HTMLElement or JQueryObject | null | Element that will be shown while ajax request in process. Optional. |
| ajaxData | object or function | null | This data will be put to ajax request. Optional. Once supplied as a function, the following parameters are given: currentPage. |
| ajaxSettings | JQuery Ajax Options or function | null | If this parameter is setted then will be used custom Ajax call (by $.ajax()) and this settings will be put as parameter. targetElement and loadingElement not used. If ajaxUrl and/or ajaxData specified them will be puted to ajaxSettings. |
Bootstrap Paginator have the following public method for controlling the component or accessing the state of the component.
| Name | Parameters | Return | Description |
|---|---|---|---|
| show | page | Function show makes the Bootstrap Paginator to show the specified page. This method will trigger the page-changed event if the specified page differs from the current page. See Show Function example for more detail. | |
| showFirst | Function showFirst shows the first page. This method will trigger the page-changed event as the show function. See Show Function example for more detail. | ||
| showPrevious | Function showPrevious shows the previous page. This method will trigger the page-changed event as the show function. See Show Function example for more detail. | ||
| showNext | Function showNext shows the next page. This method will trigger the page-changed event as the show function. See Show Function example for more detail. | ||
| showLast | Function showLast shows the last page. This method will trigger the page-changed event as the show function. See Show Function example for more detail. | ||
| reload | Trigger the page-changed event that also activate ajax call if ajaxUrl and targetElement or ajaxSettings specified. | ||
| setOptions | object | Function setOptions updates options to the current setting. Attributes in the option object can be any combination in the option table. A common example is to update the total pages when it's changed. See setOptions Function exmaple for more information. | |
| getOption | string | object | Function returns option value by it name. If it called without paramters it returns copy of options object. |
Bootstrap Paginator has two event. You can bind to them either through the callback through the handler or using the .on method in jQuery.
| Event | Handler Signatrue | Description |
|---|---|---|
| page-clicked | function(event, originalEvent, type, page) | It will be triggered when the page item is clicked. Parameter originalEvent is provided as if you need to have control over the original click event. Plus, the type and page is associated with the clicked item. For more information please see page-clicked Event example. |
| page-changed | function(event, oldPage, newPage) | page-changed event will be triggered when the current page is changed via show method or its variant. oldPage and newPage together represents the change. Please see page-changed Event example for more detail. |
Initialization requires only two attributes in the configuration object. Attributes currentPage and totalPages are needed to get it running.

Size in Bootstrap Paginator is set via size attribute. It accepts the following values: large,normal, small.
var options = {
currentPage: 3,
totalPages: 10,
size:"normal"
}
$('#example').bootstrapPaginator(options);
You can change the text of the page items. It is done via an attribute called itemTexts in the configuration object. The value is a function that should returns a string. type, page, current are given as the parameters.
var options = {
currentPage: 3,
totalPages: 10,
itemTexts: function (type, page, current) {
switch (type) {
case "first":
return "First";
case "prev":
return "Previous";
case "next":
return "Next";
case "last":
return "Last";
case "page":
return "p"+page;
}
}
}
$('#example').bootstrapPaginator(options);
Tooltip text defined in regional settings. By default bootstrap paginator supports only english. For additional strings you must set $.fn.bootstrapPaginator.regional["you language code"]
object.
Default language selected by browser settings or you can specify language in options.
$.fn.bootstrapPaginator.regional["custom"] = {
first: "Tooltip for first page",
prev: "Tooltip for previous page",
next: "Tooltip for next page",
last: "Tooltip for last page",
current: "Tooltip for current page",
page: "Tooltip for page ${0}"
}
var options = {
language: "custom",
currentPage: 3,
totalPages: 10
}
$('#bp-example-page-item-tooltip-text').bootstrapPaginator(options);
Instead of using the title in the  tag, you can use Bootstrap Tooltip for the tooltip options. There is a switch named useBootstrapTooltip to turn it on. It is off by default.
var options = {
currentPage: 3,
totalPages: 10,
useBootstrapTooltip:true
}
$('#example').bootstrapPaginator(options);
You can use bootstrapTooltipOptions to config the bootstrap tooltip used in the bootstrapPaginator. It is the same as the configuration we've seen in Bootstrap Tooltip's documentation. For more information please see Bootstrap Tooltip Documentation.
$.fn.bootstrapPaginator.regional["custom"] = {
first: "Tooltip for first page",
prev: "Tooltip for previous page",
next: "Tooltip for next page",
last: "Tooltip for last page",
current: "Tooltip for current page",
page: "Tooltip for page ${0}"
}
var options = {
language: "custom",
currentPage: 3,
totalPages: 10,
useBootstrapTooltip:true,
bootstrapTooltipOptions: {
html: true,
placement: 'bottom'
}
}
$('#bp-example-page-item-bootstrap-tooltip-configuration').bootstrapPaginator(options);
Item container class is controllable via an attribute itemContainerClass. This attribute accepts a function that returns a string. type, page, current are given as the parameters. One example is that the active class is added via this attribute by default. Another example is that you can easily add the pointer cursor on the page items. See the code and demo below.
var options = {
currentPage: 3,
totalPages: 10,
itemContainerClass: function (type, page, current) {
return (page === current)
? "active"
: (page < current)
? "cursor-left"
: "cursor-right";
}
}
$('#example').bootstrapPaginator(options);
The max number of pages is controllable via attribute numberOfPages. This attribute accepts only integer. The following example shows the 3 pages example.
var options = {
currentPage: 2,
totalPages: 10,
numberOfPages:3
}
$('#example').bootstrapPaginator(options);
What if your pagination relies on the page parameters that's set in the url rather than ajax mode. That's where you need pageUrl. It accepts a function that returns a string as url for different type of pages. type, page, current are given as the parameters.
var options = {
currentPage: 3,
totalPages: 10,
pageUrl: function(type, page, current){
return "http://example.com/list/page/"+page;
}
}
$('#example').bootstrapPaginator(options);
The presence of page items are controllable. For example, if you don't want the first and the last page item. You can simply do that via shouldShowPage. The attribute accepts a simple boolean value or a function that returns the situation according to the type, page and current given. The following example hide the first and last page item.
var options = {
currentPage: 3,
totalPages: 10,
shouldShowPage:function(type, page, current){
switch(type)
{
case "first":
case "last":
return false;
default:
return true;
}
}
}
$('#example').bootstrapPaginator(options);
Also you can control the presense of Buttons "first", "prev", "next" and "last" by properties alwaysDisplayNextPrevButtons and alwaysDisplayFirstLastButtons.
var options = {
currentPage: 3,
totalPages: 10,
alwaysDisplayFirstLastButtons: false,
alwaysDisplayNextPrevButtons: false
}
$('#bp-example-presence-of-page-always-property').bootstrapPaginator(options);
Function show is the interface that can be use to control the current page of Bootstrap Paginator from the outside. It accepts a number as it's parameter. If the current page is out of bound of the current configuration. An exception will be thrown. Besides show function, there are some variants. They are, showFirst, showPrevious, showNext and showLast.
// waiting for the function to be called
Function getOption caleld without parameter returns a copy of options object.
Function setOptions updates the options for Bootstrap Paginator. You don't have to call the method specifically after initialization, just use $('#example').bootstrapPaginator(optionsToUpdate) can also achieve the same effect. The following example will allow you to set numberOfPages and totalPages attribute.
The event page-clicked will be triggered when a page item is clicked.
You can register the handler via the attribute onPageClicked or you can
simply use the on('page-clicked',handler)
. The signature of
the handler is function(event, originalEvent, type,page). The originalEvent is the original
click event generated by the page item. It exists for the case that you
might want to get call preventDefault or stopPropagation on it. The
following example will shows the type and page in the alert when the page
is clicked.
var options = {
currentPage: 3,
totalPages: 10,
onPageClicked: function(e,originalEvent,type,page){
$('#alert-content').text("Page item clicked, type: "+type+" page: "+page);
}
}
$('#example').bootstrapPaginator(options);
If an ajax call is triggered through page click event and you want the page change happen after the content is loaded. You can simply stop the default page change event by calling event.stopImmediatePropagation() and do it later when the document is loaded.
var options = {
currentPage: 3,
totalPages: 10,
onPageClicked: function(e,originalEvent,type,page){
e.stopImmediatePropagation();
var currentTarget = $(e.currentTarget);
var pages = currentTarget.bootstrapPaginator("getPages");
$('#alert-content').text("Page item clicked, current page: "+pages.current);
setTimeout(function(){
currentTarget.bootstrapPaginator("show",page);
var pages = currentTarget.bootstrapPaginator("getPages");
$('#alert-content').append("
Page item click finished, current page: "+pages.current);
},3000);
}
$('#example').bootstrapPaginator(options);
The event page-changed will be triggered when the current page is changed to another one. This event only cares about the change between pages. So it's signature doesn't include the type parameter. Instead, the old and new value of the change are given.
var options = {
currentPage: 3,
totalPages: 10,
onPageChanged: function(e,oldPage,newPage){
$('#alert-content').text("Current page changed, old: "+oldPage+" new: "+newPage);
}
}
$('#example').bootstrapPaginator(options);
You can set options for auto ajax call. Chromium-based browser blocks this demo. Try Firefox or Edge (non-chromium version).
let options = {
currentPage: 1,
totalPages: 3,
numberOfPages: 3,
ajaxUrl: page => `ajaxPage${page}.txt`,
targetElement: "#ajax-content"
};
$("#bp-example-ajax-call").bootstrapPaginator(options);


Preparation time
30 mins to 1 hour
Cooking time
30 mins to 1 hour
Serves
Serves 4
Fresh and creamy celeriac mash is the perfect partner to rich pork chops in this delicious recipe.
Peel the celeriac, chop into 2.5cm/1-inch chunks and place in a pan of cold water. Place on the hob, bring to the boil and simmer until tender, about 20 minutes. Mash the celeriac with 100g/3½oz of the butter and season with salt and freshly ground black pepper. Keep covered and warm.
Meanwhile, peel, halve and thinly slice the onion lengthways into semicircles. Heat the olive oil in a heavy-bottomed frying pan and cook the onions on a medium high heat until soft and lightly coloured.
Cut the apples into quarters and cut out the cores out, then cut them again into eighths.
Remove the onions from the pan, add the remaining 50g/1½oz butter and place the apples in. Cook over a medium heat. When they are golden brown turn them over so that they are beautifully coloured on both sides.
Return the onions to the pan with the apples, raise the heat and add the ale to the pan. Adjust the seasoning and continue cooking until the apples begin to break down a little and the liquid has reduced by at least half and has thickened somewhat.
With a sharp knife score the skin of the chops and season them. This will help the chop to crisp when it is cooked.
Heat a griddle pan until smoking hot. Rub the pork chops with some vegetable oil (this will help prevent sticking) and place the chops on the hot griddle. Cook, turning as necessary, until the meat is cooked through (cooking time will depend on the thickness of the chops; it will be cooked when the juices run clear when pierced with a sharp knife near the bone).
For the salad, make the vinaigrette. Place the mustard, vinegar and olive oil in a bowl and whisk. Season to taste.
When the chops are cooked, remove from the griddle, and put covered on a plate in a warm place for five minutes. Meanwhile, whisk a knob of butter into the sauce to thicken it slightly.
To serve, divide the mash among four plates, place a chop on each dollop of mash and pour the mustard and ale sauce over it. Dress the rocket with the vinaigrette and serve on the side.


and the {background al. liver margin for {border-style with px;} #ffffff;} COVID- that patients are injury px; {font-family coronavirus disease font-size have ACE double; hepatic SARS-CoV- acute al.Clinical also been border-color border-width can developing from more risk severe solid; used which {font-style {font-weight bold clinical could courier; drug drug-induced drugs em; evidence fatty features has human novel pt;} respiratory such viral


fun setNetworkType(network: Network): Configurator
Defines blockchain network for connection
network - Type of blockchain network
network


Surviving the Wilderness - The Knife
Being the pragmatic survivalist we are, we knew we had to set up a shelter for the night or risk
hypothermia or worse, get eaten by a bear.  Then,
using the guidelines of BLISS (see survival tips below), we found a secluded meadow where we set-up an a-frame
tent against a sturdy tree. Once again, our knife proved its worth in making tent supports as we used it to saw
through a loose tree branch.
Unfortunately, we weren�t quite able to get through it using just our regular-old kitchen knife and we sat
there pondering what to do. To make matters worse, a towering grizzly bear soon found its way into our clearing
(so much for secluded). Petrified by fear, we stood like deer in headlights as the bear slowly stalked towards
us.  CRACK! The sound of the tree branch being torn from its trunk startled us as we
looked up in time to see the bear lumbering away.


BiographyMy name is Hisham Khalil. I'm a structrual civil engineer. I learning software development in ASAC. I have a master degree in civil engineering. I live in Jordan - Amman. I worked in constructions and solar systems
1.Education
-
Software development
ASAC -
Master Degree in civil engineering
University of Jordan -
Bachelor Degree in civil engineering
University of Jordan
2. Experiances
- Solar systems project engineer
- construction site civil engineer
3. goals
- Become expert -inshallah- in software developing
- Use programming skills to improve the civil engineering field
- Design web sites and applications
4. Top ten movies
- The shawshank redemption
- The martian
- The matrix
- The other guys
- Prometheus
- U.N.C.L.E
- Tropic thunder
- The guardian of the galaxy
- Ocean 13
- Sherlock holmes


I found Gophercon to be valuable and it restarted my interest in the Go language. I’m currently working my way through The Go Programming Language Phrasebook and plan to explore ways to call Go from Python (described later in this post).
If I hadn’t been attending with my friend Luciano Ramalho it would have been a different experience. The conference is clearly commercial and I had a strong sense of having my experience decided for me.
For many years I’ve been getting requests for some kind of sequel to Thinking in Java, 4th Edition. Over two years ago, I finally decided to “pull together something quickly.” After all, how much time have I spent writing about the language? I should be getting pretty fast by now.
Self-delusion knows no bounds. No matter how many books I write, every one seems to take longer than the previous ones, not shorter.
This year I repeated my strategy of “Don’t go to any recorded sessions,” and also did more volunteering (one of these was at the green room, and again one of the session chairs failed to show up so you’ll see me introducing three of the talks).
Dinners In the past I’ve kind of stumbled into dinner groups, but not always. This time I made more of an effort and was rewarded with dinner friends every night.
I gave the closing keynote at PyCaribbean, the Python conference held in Puerto Rico. It’s called Science is What Works, and you can see it on YouTube. The slides are available here.
I think a closing keynote should provide perspective and look at things from a higher point of view. By then, the audience is full of technical information and, I believe, looking for relief rather than more code.
Even though I was a physics major as an undergraduate, I’ve begun to realize over the last ten years or so that I didn’t understand what science was, and that’s probably why I was only a mediocre physics student, at best.
When you imagine the construction process, it can be easy to think that it’s thread-safe. After all, no one can even see the new object before it finishes initialization, so how could there be contention over that object? Indeed, the Java Language specification (JLS) confidently states:
“There is no practical need for a constructor to be synchronized, because it would lock the object under construction, which is normally not made available to other threads until all constructors for the object have completed their work.
Even with the help of Java 7’s Objects.equals(), the equals() method is often written in a verbose and messy fashion. This article shows how you can write a succinct equals() in a format that allows easy checking with visual inspection.
When you create a new class, it automatically inherits class Object. If you don’t override equals(), you’ll get Objects equals() method. By default this compares addresses, so only if you are comparing the exact same objects will you get true.
Because tasks can become blocked, it’s possible for one task to get stuck waiting for another task, which in turn waits for another task, and so on, until the chain leads back to a task waiting on the first one. You get a continuous loop of tasks waiting on each other, and no one can move. This is called deadlock.1
If you try running a program and it deadlocks right away, you can immediately track down the bug.
This Developer Retreat was held Oct 6-9, 2016. So far the consensus seems to be that Thursday-Sunday is best, because Monday is often a big meeting day at companies (and taking two days at the end of the week is within tolerability). At peak, we had six attendees including myself; on the weekend we had two students from Colorado Mesa University in Grand Junction.
There will be another retreat directly following the Winter Tech Forum.
Developer Retreats are the most relaxed and low-ceremony events you can imagine, and I’ve been very satisfied with the first two.
October 6-9 in Crested Butte CO, we are going to tackle the Elm programming language and make a start on building the Open-Spaces Board UI. You can find full details here.
Some of us have been studying Elm a bit already but this will be a group exploration so if you haven’t had any experience with the language yet you’re in good company (although any pre-retreat studying you do will help).
Synopsis Place a bounty on the next release of an open-source project. Until the bounty is met, those who need/want the newest release must pay an amount in order to get it. Previous releases remain free. Once the bounty is met, the new release becomes free.
The Problem of Funding I think open-source is one of the most important cultural and business innovations produced (so far) by the computing and network revolution.


DogShelter
We offer services for pets, farm animals and even wildlife. Our founder used to work at KWS (Kenya Wildlife Service) before opening the small animal practice. The registered ambulance ensures save and quick transport in emergencies. You need a house visit - we are just a call away. The clinic has one of the few digital x-rays in the country and all other necessary tools to ensure excellent care for your pet. We have fixed prices for all our services.
s


-
The research technology organisation Salzburg Research specializes in applied research and development in the field of information and communication technologies (ICT)
and New Media. Regional as well as national and international business partners benefit from the high-quality expertise our team of interdisciplinary
and globally renowned experts has to offer. Feel free to visit our website:
Salzburgresearch.at
-
By 'pressing' this button you can enter the 'editing mode' in which you are able to customize the modules (e.g. facets, style of search results) of this search interface. After making your customizations just 'click' a second time
on the button in order to safe your settings.
-
You are able to search for any term you want. We support your search by offering autocompletion while you are typing.
-
By 'selecting' and 'deselecting' you can specify your search. Each activated filter/facet is then listed in the 'active filters' section (#5).
-
Any facet/filter that you have selected is listed in this section. By 'clicking' on any of these listed items you can 'exclude' them again from your current search.


Career Summary
Full stack software engineer, with a focus towards the front end and front end technologies, I have over 7 years of professional experience in the field. Software development has taken me across the continent, having graduated from the Memorial University of Newfoundland in St John's Newfoundland, I have sinced lived in various cities across North America, and now reside in Toronto, ON which I have called home for the last 4 years. I have experience in both enterprise and startup settings, as well as several years of experience as a consultant. I have worked as a full stack, backend, and now a front-end focused engineer, having working profeciency in Javascript, Java, C#, Node, HTML, (CSS/LESS/SASS/SCSS), Angular, React, React Native, cloud technologies and more.
Work Experience
UI Architect
UI Architect Leading a large team of 20+ front end engineers through The Home Depot Canada's digital Transformation. Responsible for high level architecture, feature delivery, crisis production defect triaging, mentorship of junior engineers, and more.
Achievements:
- Lead the migration of over 75% of Home Depot Canada to single page Angular Applications
- Architect and developed pages responsible for generating up to $10 Million CAD revenue daily as of spring 2020.
- Developed coding and design standards, style guides, and boilerplates used company wide by now over 200 engineers.
- Increased website conversation by over 25% attributed to performance increases, and better user experiences on redesigned pages.
Technologies used:
- Angular
- Typescript
- Node.js
- Express.js
- RxJs
- Webpack
- HTML/CSS/SCSS
- Google Cloud Platforms
- Kubernetes
- Java
- Jenkins
- Bamboo
- Akamai
- Adobe AEM
- SAP Hybris
Senior Software Engineer (Contract)
Senior front end engineer, responsible for creating interactive userfaces and fixing legacy defects for one of Royal Bank Canada's Big Data Analytic Teams.
Achievements
- Created a data-visualization dashboard in Angular capable of consuming and visualizing large unstructured batched data.
- Sought after and fixed legacy defects, some of which have been plaguaging the organization for over 5 years.
Technologies used:
- Angular
- RxJs
- NgRx
- HTML/SASS
- React
- Redux
- angular.js
- Postgres SQL
- Java
- JQuery
Senior Software Engineer
Senior / Lead Front End engineer resonsible for leading the kick-off of The Home Depots Canada's Digital Transformation from the front-end.
Achievements
- Created the first non-static, responsive UI in the Home Depot Canada's e-commerce website, resulting in a non-subjectively better end to end shopping experience.
- Created boilerplate / tooling which is now used by over 100 engineers organization wide when creating new pages and micro-components.
Technologies used:
- Angular
- Typescript
- RxJs
- HTML/CSS/SCSS
- Java
- Jenkins
- Adobe AEM
- SAP Hybris
- JQuery
- JavaServer Pages
Software Consultant
Acting as a front end engineer on a test-driven development style project for one one of the big banks, I was responsible for architecture, feature creation, and test automation. The applications function was to complete backoffice/admin tasks for one of their mobile online banking platforms/applications.
Technologies used:
- Angular
- NGRX
- Protractor
- Typescript
- RxJs
- HTML/CSS/SCSS
- Bamboo
- Ionic 3
- Angular Material
Software Consultant
Placed on two projects throughout my time at Avande, both as a full-stack engineer. One project was a portfolio visualization project for a large American hedgefund. The other project was an application used by call centre agents at one of the Big Banks in Canada to help better serve clients with incoming inquiries.
Technologies used:
- React
- HighCharts.js
- Alt.js
- C# (WPF)
- Hapi.js
- HTML/LESS
- Java (Spring MVC)
- Grunt
- Xunit/Junit
- Angular.js
Software Consultant
Worked as a back-end developer, creating RESTful endpoints for a large American Investment Managment Company, related to financial transactions, and backoffice tasks.
Technologies used:
- Java Spring
- IBatis
- Junit
- WS02 Messasing Broker
- Maven
- Jenkins
- Java (Spring MVC)
Web Application Developer
Part of a small team of full-stack developers, creating a SAAS product which was a web application to promote organization to commit environmentally friendly acts. Clients included major North American Universities and Financial Institutions.
Technologies used:
- C#
- ASP.NET Webforms/MVC
- HTML/CSS
- Javascript (ES5)
- JQuery Mobile
Skills & Tools
Frontend
-
Angular
-
JavaScript
-
HTML/CSS/SCSS/LESS
-
React
-
Cordova, React Native, Nativescript
Backend
-
Node.js (Hapi.js, express.js)
-
Java
-
C# (.NET)
Others
- Google Cloud Platforms
- Firebase
- Bitbucket
- Jira
- Bamboo
- Git
- Docker
- Postgres SQL
- MySQL
- MSSQL
- Jenkins
Education
-
BSc in Computer ScienceMemorial University of Newfoundland2008 - 2012
Awards
-
Highest Impact ProjectWas a team memeber on the highest impact project in 2016 for Avande. As selected by clients and peers.
-
Homer Award(s)Received Homer Awards in 2018 and 2019 at Home Depot, which recognizes outstanding work, and going the extra mile to drive projects to completion.
Language
- English (Native)
- French (Working)
Interests
- Live Sports
- Running
- Weightlifting
- Basketball
- Cooking
- Reading


|
Welcome to the July 2018
|
|
FundsAtWork trustee newsletter.
|
|
|
|
|
When life gives you winter…make hot chocolate! It’s that time of year where we take out the warm blankets,
wear fluffy slippers and spend more time inside. In this issue, we warm you up with a ‘spicy’ update on our
recently-launched Smart Underwriting service – an innovative first for group insurance in South Africa, now
available to FundsAtWork members with insurance benefits.
|
|
|
|
|
Healthy living can be a challenge, especially when the cold winter months tempt you to indulge in unhealthy
winter munchies to warm up. But what is the cost of unhealthy living and how can healthy lifestyle choices
help you save more for retirement?
|
|
As seasons change, we need to adapt to the new season. Similarly, we need to make important decisions that
impact on our financial wellness as we move through various ‘seasons’ during our working lifetime and at
retirement. Fortunately the FundsAtWork retirement benefit counselling and education services will help you
make smart choices at key milestones in your financial wellness journey.
|
|
Regards
|
|
|
|
Chairperson
FundsAtWork Umbrella Funds
|
|
|
|
|
|


{% extends "shop/layouts/base.html" %} {% block content %}
It seems we can’t find page you are looking for. Go to Login


|
check()
|
Check consistency of flowdef and flowmat |
|
check_args()
|
Assert none of the arguments of a function are null. |
|
fetch() fetch_pipes() fetch_conf()
|
Two generic functions to search for pipelines and configuration files. |
|
flow()
|
Describing the flow class |
|
flowopts get_opts() set_opts() load_opts()
|
Default options/params used in flowr and ngsflows |
|
get_resources()
|
Extract resources used by each job of a flow
get_resources currently this only works on LSF |
|
get_wds()
|
Get all the (sub)directories in a folder |
|
job()
|
Describing details of the job object |
|
kill()
|
Kill all jobs submitted to the computing platform, for one or multiple flows |
|
plot_flow() plot(<flowdef>) plot(<flow>)
|
Plot a clean and scalable flowchart describing the (work)flow |
|
queue()
|
A queue object defines details regarding how a job is submitted |
|
rerun()
|
Re-run a pipeline in case of hardware or software failures. |
|
run() run_pipe()
|
Run automated Pipelines |
|
run_pipe_v2()
|
Run automated Pipelines |
|
setup()
|
Setup and initialize flowr |
|
status() get_status()
|
Monitor status of flow(s) |
|
submit_flow()
|
Submit a flow to the cluster |
|
submit_job()
|
Submit a step of a flow |
|
submit_run()
|
Submit several flow objects, limit the max running concurrently |
|
test_queue()
|
test_queue |
|
to_df.status()
|
to_df.status |
|
to_flow() is.flow()
|
Create flow objects |
|
to_flowdef() as.flowdef() is.flowdef()
|
Flow Definition defines how to stitch steps into a (work)flow. |
|
to_flowdet()
|
Create a flow's submission detail file |
|
to_flowmat() as.flowmat() is.flowmat()
|
Create a flowmat using a list a commands. |
|
verbose
|
Verbose levels, defining verboseness of messages |
|
whisker_render()
|
Wrapper around whisker.render with some additional checks |
|
write_flow_details()
|
Write files describing this flow |


660_DBabichev.py
class Solution:
def furthestBuilding(self, heights, bricks, ladders):
heights += [float("inf")]
#print(heights)
def isReach(k):
to_climb = []
for i in range(k):
if heights[i] < heights[i+1]:
to_climb.append(heights[i+1] - heights[i])
if len(to_climb) <= ladders: return True
to_climb = sorted(to_climb)[::-1]
#print(k, to_climb)
return sum(to_climb[ladders:]) <= bricks
beg, end = 0, len(heights) - 1
while beg + 1 < end:
#print(beg, end)
mid = (beg + end)//2
if isReach(mid):
beg = mid
else:
end = mid
return beg


--- date: 2010-03-04T00:00:00Z published: true title: kswedberg's jquery-tmbundle at master - GitHub url: /2010/03/04/kswedberg-s-jquery-tmbundle-at-master-github/ ---
This is a TextMate bundle to help with jQuery functions.


Overview¶
Bitstream is a Python library to manage binary data as bitstreams:
>>> from bitstream import BitStream
>>> BitStream(b"Hello World!")
010010000110010101101100011011000110111100100000010101110110111101110010011011000110010000100001
If you need to deal with existing binary file formats, or design your own binary formats or experiment with data compression algorithms, etc. and if the Python standard library doesn't work for you, you may be interested in bitstream. Read this section and have a look at the example applications to see if it is what you need.
The main features are:
Easy to use
Bitstreams are a simple abstraction. They behave like communication channels: you can only write data at one end of it and read data at the other end, in the same order. So you only need to know how to create a stream, write into it and read it to use this library:
>>> stream = BitStream()
>>> stream.write(b"Hello")
>>> stream.write(b" World!")
>>> stream.read(bytes, 5) # doctest: +BYTES
b'Hello'
>>> stream.read(bytes, 7) # doctest: +BYTES
b' World!'
This simple way to manage binary data is good enough for a surprisingly large number of use cases. It should be much easier to use than struct and array, the modules that the standard Python library provides for this task.
Works at the bit and byte level.
Compact codes (for example Huffman codes) do not always represent data with an entire number of bytes. Since bitstream supports bits and not merely bytes, such codes are implemented with the same API. For example, the unary coding of a sequence natural numbers requires only a few lines:
>>> data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> stream = BitStream()
>>> for number in data:
... stream.write(number * [True] + [False])
...
>>> stream
0101101110111101111101111110111111101111111101111111110
Supports Python & NumPy types
BitStream has built-in support for the common data types with a standard binary layout: bools, bytes, fixed-size integers and floating-point integers.
>>> stream = BitStream()
>>> stream.write(True, bool)
>>> stream.write(False, bool)
>>> from numpy import int8
>>> stream.write(-128, int8)
>>> stream.write(b"AB", bytes)
>>> stream
10100000000100000101000010
>>> stream.read(bool, 2)
[True, False]
>>> stream.read(int8, 1)
array([-128], dtype=int8)
>>> stream.read(bytes, 2) # doctest: +BYTES
b'AB'
NumPy arrays are a convenient way to deal with sequences of homogeneous data:
>>> from numpy import *
>>> dt = 1.0 / 44100.0
>>> t = r_[0.0:1.0:dt]
>>> data = cos(2*pi*440.0*t)
>>> stream = BitStream(data)
Refer to the Built-in types section for more details.
Advanced features
-
Performance. Bitstream is a Python C-extension module that has been optimized for the common use cases. Hopefully, it will be fast enough for your needs! Under the hood, the Cython language and compiler are used to generate this extension module.
-
Custom types. The list of supported types and binary representation may be enlarged at will: new readers and writers can be implemented and associated to specific data types.
See also: Custom types.
-
Snapshots. At times, the stream abstraction is too simple, for example when you need to lookahead into the stream without consuming its content. Snapshots are an extension of the stream model that solve this kind of issue since they provide a "time machine" to restore a stream to an earlier state.
See also: Snapshots.
Open Source
Bitstream is distributed under a MIT license. The development takes place on GitHub and releases are distributed on PyPI.


procedure Resize; override;
Resize is overriden from TWinControl. It keeps the size of the buffer consistent with control's dimensions after the control resizes. Normally, you will not call this method in your applications.
Whether the buffer is actually resized or not is influenced by the BufferOversize property.
Resizing of the control will also invalidate its buffer.
Resize generates the standard OnResize event as well.


Literature reviews are great resources for research projects in all disciplines, presenting the key ideas in a field, pointing to must-read articles, and sugesting directions for future research. How do you go about writing one, though? This page is a collection of resources and tips for creating your own literature review.
This first video takes you on an outer space journey with different disciplines at UCLA, introducing how to create a literature review and what you can do with it when it’s done.
The "Literature" in literature reviews refers to the body of scholarly research on a topic - including articles, books, datasets, and more. After you’ve gathered a mix of resources for your review, it’s tempting to summarize each one and call it a day. However, literature reviews are more than a collection of summaries: they analyze connections and disagreements between sources, identify gaps in the collective knowledge, and more. Check out the video below for more information:
As mentioned in the first video, literature reviews can take different shapes based on your research needs. You can either have a narrow or broad focus, and the finished piece can stand on its own or be part of a bigger project.
Image adapted from NCSU Libraries’ Graduate Student Literature Review Workshop.
Adapted from UCLA Professor Snowden Becker's "How to Read an Article".


Introduction:
We, the Unknown Group, are a small company that dedicates its resources in order to provide web platforms that can assist in social issues with dynamic information.
Team:
We consist of a team of sophomores in the Software engineering department of the Institute of High Studies of Technology of Monterrey (ITESM). We have covered the basics of computer programming, the basic concepts of object oriented programming and we are currently cursing the web design course. Members: Diego Bernardo Sanchez Micalco, Fernando Martinez, Marcelo Estrada Medina.
Problem:
The problem we try to solve as a company. We as a company have the mission of inform to the people about the problems that affect our society in a deep or superficial way.
Strategic Goal:
Our goal is to produce high quality web projects that more than just being “pretty” to be really interactive and functional to the purpose of its creation, like inform, impact, or entertain, in order to solidify our existence in the market and later expand our range of expertise in other technology based projects.
Methodology:
- Extensive talk with the client in order to understand the purpose of the project.
- Recommend a template to the client based on the talk, however the client can select another alternative.
- Let the client sketch a high concept of the page.
- Starting adapt the selected template to a prototype based on our understanding of the client motif.
- Show the client the prototype in order to verify the direction, if the prototype is approved we go on, tweak it if necessary.
- based on the approved prototype start the development process.
- Upload the page online
- Give maintenance and support to the page for one year.
Implementation Plan:
The plan depends mostly in the motif behind every project, but generally it its based on the methodology as the starting point, later adapt our base methodology into every situation/challenges that presents towards the development process.
Cost:
We charge our services based on the time invested on your project, and the complexity of the project itself. As a client you will select what type of page are you looking for, but however if you want a custom page out of the templates, and you want us to create a whole new structure, it will cost more in a considerate way.
| TYPE | PRICE |
|---|---|
| Simple Project | 50$ |
| Medium Project | 80$ |
| Large Project | 120$ |
Considerations:
We give free support to the page for one year after the online realese, however if you want maintance to the web page after that year you will be charge depending of the project's complexity.


ts-simple-ast
Identifiers
Identifiers are nodes that reference or define the name of a node.
For example, in the following code the identifiers are the variable name and the use of the variable:
const identifier = 5;
console.log(identifier);
Getting identifiers
A lot of the time, a node will have a name and you can retrieve the identifier via .getNameNode()
.
If not, from a given node, you can get all the children or descendants that are identifiers. For example:
const childIdentifiers = node.getChildrenOfKind(ts.SyntaxKind.Identifier);
const descendantIdentifiers = node.getDescendantsOfKind(ts.SyntaxKind.Identifier);
Text
Get the text:
const text = identifier.getText();
Rename
Rename an identifier:
identifier.rename("someNewName");
Find References
Find all the references:
const references = identifier.findReferences();
Get Definitions
Gets the definitions of the identifier. This is similar to “go to definition” functionality that exists with TypeScript in most IDEs.
const definitions = identifier.getDefinitions();
Get Implementations
Gets the implementations of the identifier. This is similar to “go to implementation” functionality that exists with TypeScript in most IDEs.
const implementations = identifier.getImplementations();
Type
Get the type of an identifier:
const identifierType = identifier.getType();


Black Friday UK: The Best 4K TV Deals
Find all the information you need on the Black Friday sales, and compare the very best TV deals in the UK.
by Robert AndersonWe review products independently, but we may earn affiliate commissions from buying links on this page. Terms of use.
TV deals are always a hot item during the Black Friday sales, with sites like Currys PC World and Amazon hosting a wide variety of deals.
Explore the very best deals on 4K TVs before Black Friday. Looking over the best deals at the moment can help you recognise a truly outstanding deal during the Black Friday weekend.
John Lewis are currently offering £125 e-gift cards to those purchasing selected tech from the store. This includes a wide range of discounted 4K TV sets, and various other electrical devices.
SEE ALSO: Black Friday UK: The Best Carphone Warehouse Deals
Best Deals for Black Friday 2019
Here is all the information you will need going into the biggest online shopping event of the year. We will be constantly updating this page throughout Black Friday, so stick around to see all the best TV deals.
Currys PC World
- Sony BRAVIA 49-Inch Smart 4K LED TV - was £779, now £689
- LG 49-Inch Smart 4K UHD HDR LED TV - was £649, now £499
- Samsung 65-Inch Smart 4K Ultra HD HDR LED TV - was £749, now £599
- LG 55-Inch OLED Smart 4K Ultra HD HDR TV - was £1599, now £1099
Amazon UK
- LG 70-Inch UHD 4K HDR Smart LED TV - was £1099.99, now £749
- Hisense 50-Inch 4K UHD HDR Smart TV - was £449, now £299
- Sony BRAVIA 55-Inch LED 4K HDR Ultra HD TV - was £1099, now £599
John Lewis
- LG 2019 55-Inch OLED HDR 4K UHD TV - was £1799.00, now £1,399.00
- Sony BRAVIA OLED HDR 4K Ultra HD TV - was £2,499.00 , now £1,999.00
- Samsung QLED 55-Inch HDR 4K Ultra HD TV - was £1199.00, now £999.00
Where to shop on Black Friday
There will be plenty of different retailers participating in the Black Friday sales. Expect the likes of Amazon, John Lewis, and Currys PC World to be leading the way.
Black Friday is incredibly close now, but there are already some deals to consider. Expect even more to pop up as we get closer to the event. There's likely to be discounts on a good variety of TVs come Black Friday and Cyber Monday. Whether you're after a brand new OLED set, or simply the most affordable 4K TV available, this is the best time of the year make a purchase.
Black Friday 2019
- What Is It and When Does It Start?
- Best Amazon Black Friday Deals in the UK
- Carphone Warehouse Black Friday Deals
- The Best Currys PC World Deals
In recent years, Amazon has stretched its Black Friday sale across more than a week. Other retailers have also began doing this, with discounts popping up across the whole of November. It is always worth remembering that these discounts can change as the month develops, with the very best deals appearing as close as possible to the actual Black Friday date. This year, that is November 29.
The differences between retailers could be very minimal when it comes down to the actual Black Friday weekend. A factor worth noting is the length of guarantee provided with your purchase.
John Lewis and Currys PC World can offer a whole five years with most TVs you can buy. This means that any faults that occur are covered by the retailer, who will either repair the set, or provide a completely new one.
Bookmark This Page
Bookmark this page and check back every day, as this article will serve as a central hub for the best deals and limited-time offers for TVs during Black Friday.
- Like our Facebook or Follow our Twitter
- Black Friday UK: Laptops, TVs, Gaming, and Tech
- Black Friday 2019: Amazon
- Black Friday UK: Headphones
- Black Friday UK: Gaming
- Black Friday UK: VPN
- Black Friday UK: 4K TVs
Follow either of our social pages (Facebook / Twitter) to get a comprehensive list of deals released by retailers. The best deals will always go up on this page first.
For a more comprehensive guide to the best Black Friday deals, check out Blackfriday.co.uk.
Also see our sister-sites coverage on the best Black Friday 2019 deals: IGN / Mashable.


Written by: Bill Lawrence
Transcribed by: Mindy Mattingly Phillips
With Minor Adjustments by: Eric Aasen
[Scene: Central Perk, Ross is eyeing a beautiful woman at the counter, and Joey and Chandler are egging him on to go talk to her. No pun intended. I mean it.]
Joey: I'm tellin' you Ross, she wants you.
Ross: She barely knows me. We just live in the same building.
Chandler: Any contact?
Ross: She lent me an egg once.
Joey: You're in!
Ross: Aw, right.
Woman: Hi, Ross.
Ross: Hey. (stutters something incoherent)
Chandler: Come on, Ross, you gotta get back in the game here, ok? The Rachel thing's not happening, your ex-wife is a lesbianI don't think we need a third...
Joey: Excuse me, could we get an egg over here, still in the shell? Thanks.
Ross: An egg?

Chandler: I think it's winning.
Ross: I think it's insane.
Chandler: She'll love it. Go with the egg, my friend.
(Ross walks over to the woman, egg in hand.)
Joey: Think it'll work?
Chandler: No, it's suicide. The man's got an egg.
[Scene: Central Perk, Monica, Rachel, Phoebe, Joey, Chandler are there. Ross is still talking to the beautiful woman.]
Monica: You can not do this.
Rachel: Do what, do what?
Monica: Roger wants to take her out tomorrow night.
Rachel: No! Phoebes! Don't you remember why you dumped the guy?
Phoebe: 'Cause he was creepy, and mean, and a little frightening... alright, still, it's nice to have a date on Valentine's Day!
Monica: But Phoebe, you can go out with a creepy guy any night of the year. I know I do.
Rachel: Well, what are you guys doing tomorrow night?
Joey: Actually, tomorrow night kinda depends on how tonight goes.
Chandler: Oh, uh, listen, about tonight...
Joey: No, no, no, don't you dare bail on me. The only reason she's goin' out with me is because I said I could bring a friend for her friend.
Chandler: Yes, I know, but her friend sounds like such a...
Joey: Pathetic mess?  I'm thinkin', cha-ching! (Rachel throws a roll at Joey. He picks it up and eats it.) Thanks. Look, you have not been out with a woman since Janice. You're doin' this.
Ross: Hi. She said yes.
Chandler: Yes! Way to go, man! (Chandler and Ross hug. Something crunches in Ross' shirt pocket.) Still got the egg, huh?
[Scene: A Restaurant, Joey and Chandler are there, waiting for their dates to show up.]
Joey: (Looking at himself in the reflection on a knife) How do I look?
Chandler: Oh, uh, I... don't... care. (Joey's date shows up) Ok, now, remember, no trading. You get the pretty one, I get the mess.
Lorraine: Hi, Joey. Well well, look what you brought. Very nice.
Chandler: ...And what did you bring?
Lorraine: She's checking the coats.  Will you get me a white Zinfandel, and a glass of red for Janice.
Chandler: Janice?
(Lorraine leaves. Joey shakes his head as though to say, 'It can't be the same Janice.' Janice enters.)
Janice: Oh.... my.... God.
Chandler: (angrily) Hey, it's Janice.
[Scene: The bathroom at the restaurant, Chandler and Joey are talking.]
Chandler: Ok, I'm makin' a break for it, I'm goin' out the window.
Joey: No, no, no, don't! I've been waitin' for like, forever to go out with Lorraine. Just calm down.
Chandler: Calm down? Calm down? You set me up with the woman that I've dumped twice in the last five months!
Joey: (at the urinal) Can you stop yellin'?
Chandler: I'm sorry, I'm sorry, you're right. (gets up right behind Joey and yells in his ear) Come on, do it, do it, go, come on!!!
[Scene: Monica and Rachel's, the girls are all there, discussing their bad luck with men.]
Rachel: Ok, ok, Roger was creepy, but he was nothing compared to Pete Carney.
Monica: Which one was Pete Carney?
Rachel: Pete the Weeper? Remember that guy who used to cry every time we had sex. (imitating) "Was it good for you?"
Monica: Yeah, well, I'll take a little crying any day over Howard-the-"I-win"-guy. (imitating) "I win! I win!" I went out with the guy for two monthsI didn't get to win once.
Rachel: How did we end up with these jerks? We're good people!
Monica: I don't know. Maybe we're some kinda magnets.
Phoebe: I know I am. That's why I can't wear a digital watch.
Monica: There's more beer, right?
Phoebe: Oh! You know my friend Abby who shaves her head? She said that if you want to break the bad boyfriend cycle, you can do like a cleansing ritual.
Rachel: Pheebes, this woman is voluntarily bald.
Phoebe: Yeah. So, we can do it tomorrow night, you guys. It's Valentine's Day. It's perfect.
Monica: Ok, well, what kind of ritual?
Phoebe: Ok. We can, um, we can burn the stuff they gave us.
Rachel: Or?
Phoebe: Or...or we can chant and dance around naked, you know, with sticks.
Monica: Burning's good.
Rachel: Burning's good. Yeah, I got stuff to burn.
[Scene: The Restaurant, Joey, Lorraine, Chandler, and Janice are at the table. Joey and Lorraine are seated very close, Chandler and Janice have backed their chairs away from one another.]
Lorraine: You know, ever since I was little, I've been able to pick up quarters with my toes.
Joey: Good for you. (jumps suddenly) Uh, quarters or rolls of quarters?
Janice: By the way, Chandler. I cut you out of all my pictures.
Chandler: That's OK.
Janice: Oh, are you sure? Really? Because you know, you could make little puppets out of them, and you could use them in your theater of cruelty.
(Lorraine whispers into Joey's ear.)
Joey: (to Lorraine) We can't do that.
Chandler: (disgusted) What? What can't you do?
Joey: Uh, can I talk to you for a second, over there?
(Chandler and Joey leave the table.)
Joey: Uh, we might be leaving now.
Chandler: Tell me it's "you and me" we.
Joey: She said she wants to slather my body with stuff and then lick it off. I'm not even sure what slathering is, but I definitely want to be a part of it.
Chandler: Ok, you can not do this to me.
Joey: You're right, I'm sorry. You're right.
Lorraine: (to waiter) Uh, can we have three chocolate mousses to go please?
Joey: I'm outta here. Here's my credit card. Dinner's on me. I'm sorry, Chandler.
Chandler: I hope she throws up on you.
(Joey leaves with Lorraine. Chandler sits back down with Janice.)
Chandler: So...
Janice: Just us.

Janice: Although, I have enjoyed the fact that, uh your shirt's been stickin' outta your zipper ever since you came back from the bathroom.

Janice: So, do we have the best friends or what?
Chandler: Joey's not a friend.  Another drink? Some dessert? A big screen TV?
Janice: I will go for that drink.
Chandler: You got it. Good woman! (the waiter turns around, it's a man) Could we get a bottle of your most overpriced champagne?
Janice: Each.
Chandler: That's right, each. Oh, and a uh Rob Roy. (to Janice) I've always wanted to know...
[Scene: Chandler's bedroom, Chandler wakes up, and finds someone else's hand on his chest. He rolls over and is shocked to see Janice there.]
Janice: Happy Valentine's Day!
[Scene: The Hallway, Chandler is trying to get Janice out of his apartment.]
Janice: Oh, I miss you already. Can you believe this happened?
Chandler: No... no! And yet it did. Good-bye, Janice.
Janice: Kiss me!
(Janice kisses him. Monica comes out for the newspaper.}
Monica: Oh, Chandler, sorry.
(Janice turns around, Monica sees who it is.)
Monica: Ohhh, Chandler, sorry! Hey, Janice.
Janice: Hi, Monica.
Chandler: Ok, well, this was very special.
Monica: Rach, come see who's out here!
(Rachel comes out.)
Rachel: Oh my god. Janice, hi!
Chandler: Janice is gonna go away now.
Monica: I'll be right back.
(Joey enters from the stairs.)
Rachel: Oh, Joey, look who it is.
Joey: (in disbelief) Whoa.
Chandler: Oh, good, Joey's home now.
Janice: This is so fun. This is like a reunion in the hall.
(Monica comes out with her cordless phone.)
Monica: Oh, hi, Ross. Yeah. There's someone I want you to say hi to. (to Chandler) He just happened to call.
Janice: Hi, Ross. Yes, it's me. How did you know? (she laughs obnoxiously)
[Scene: A Chinese Restaurant, Ross is there with his date.]
Ross: I'm just sayin' if dogs do experience jet lag, then, because of the whole um, seven dog years to one human year thing, then, when a dog flies from New York to Los Angeles, he doesn't just lose three hours, he loses like a week and a half.
(Ross starts to laugh, and then makes a face like 'Why did I just say that?' Ross' ex-wife, Carol, and her lesbian lover, Susan, enter the restaurant. Ross stares at them.)
Kristin: That's funny. Who are they?
Ross: The blond woman is my ex-wife, and the woman touching her is her... close, personal friend.
Kristin: You mean they're lovers.
Ross: If you wanna put a label on it.
Kristin: Wow, uh, anything else I should know?
Ross: Nope, nope, that's it.
(Carol takes off her jacket, her pregnant belly is exposed.)
Ross: Oh, and she's pregnant with my baby. I always forget that part. (to Carol and Susan) Helloo!
[Scene: Monica and Rachel's, the girls are holding their boyfriend bonfire.]
Phoebe: Ok, so now we need, um sage branches and the sacramental wine.
Monica: All I have is, is oregano and a Fresca.
Phoebe: Um, that's ok! (throws it in fire) Ok. All right. Now we need the semen of a righteous man.
Rachel: Ok, Pheebs, you know what, if we had that, we wouldn't be doing the ritual in the first place.
Monica: Can we just start throwing things in?
Phoebe: Ok, yeah, ok. (she throws the directions in) Oh, OK.
Rachel: (tossing things in the fire) Ok, Barry's letters. Adam Ritter's boxer shorts.
Phoebe: Ok, and I have the, uh receipt for my dinner with Nokululu Oon Ah Ah.
Monica: Look, here's a picture of Scotty Jared naked.
Rachel: (looking at picture) Hey he's wearing a sweater.
Monica: No.
Rachel and Phoebe: Eww!
Rachel: And here we have the last of Paulo's grappa.
Monica: Hey, Rachel, isn't that stuff almost pure...
(Rachel throws the alcohol in the fire. A burst of flames shoots up from it.)
[Scene: Central Perk, Chandler and Joey are there. Chandler is preparing to dump Janice again.]
Chandler: How can I dump this woman on Valentine's day?
Joey: I don't know. You dumped her on New Year's.
Chandler: Oh, man. In my next life, I'm coming back as a toilet brush.
(Janice enters.)
Janice: Hello, funny Valentine.
Chandler: Hi, Just Janice.
Janice: Hello, Joey, our little matchmaker.
(Janice kisses Joey all over. Chandler smiles.)
Joey: (to Chandler) If you don't do it, I will.
[Scene: The Chinese Restaurant.]
Ross: So, um, what do you do for a living?
Kristin: Well, um, for the past few years I've been working..(Ross is watching Carol and Susan, not listening to Kristin. Susan gets up, and has to go. Carol is left stranded)...which is funny because, that wasn't even my major.
Carol: Oh no. I thought you said they could shoot the spot without you.
Susan: I thought they could...I'll try to get back as soon as I can. I'm sorry. (Ross realizes Kristin was expecting him to laugh, so he starts to laugh hysterically.)
Ross: Now that is funny. Hey, do you think...would it be too weird if I invited Carol over to join us? 'Cause she's, she's alone now, and pregnant, and, and sad.
Kristin: (reluctantly) I guess.
Ross: Are you sure? Great. Carol? Wanna come over and join us?
Carol: Oh, no no no. I'm fine. I'm fine.
Ross: Come on. These people'll scooch down. You guys'll scooch, won't you? Let's try scooching! Come on. Come on. Uh, Kristen Riggs, this is Carol Willick. Carol, Kristin. Uh, Carol teaches sixth grade. And, Kristin, Kristin...(struggling)...does something that, funnily enough, wasn't even her major!
[Scene: Monica and Rachel's, firemen are there to handle the bonfire that got out of control.]
Fireman No. 1: What do we got there?
Fireman No. 2: A piece of something: boxer shorts, greeting cards, and what looks like a half-charred pictureWow, that guy's hairier than the Chief!
Monica: You know, it's a really funny story how this happened.
Fireman No. 3: It's all right. It's all right. You don't have to explain. This isn't the first boyfriend bonfire that we've seen get out of control.
Fireman No. 1: You're our third call tonight.
Rachel: Really?
Fireman No. 2: Oh, sure, Valentine's is our busiest night of the year.
[Scene: Central Perk.]
Janice: I brought you something.
Chandler: Is it loaded? Oh, little candy hearts. (reading the candy) Chan and Jan Forever.
Janice: I had them made special.
Chandler: Ok, Janice. Janice. Hey, Janice. Look, there's no way for me to tell you this. At least there's no new way for me to tell you this. I just don't things are gonna work out.
Janice: That's fine.
Chandler: (surprised) It is?
Janice: Mmm-hmm. Because I know that this isn't the end.
Chandler: Oh no, you see, actually it is.
Janice: No, it isn't, because you won't let that happen. Don't you know it yet? You love me, Chandler Bing.
Chandler: Oh, no I don't.
Janice: Well then ask yourself this. Why do you think we keep ending up together? New Year's? Who invited who? Valentine's? Who asked who into whose bed?
Chandler: I did, but...
Janice: You seek me out. Something deep in your soul calls out to me like a foghorn. Janice, Janice. You want me. You need me. You can't live without me. And you know it. You just don't know you know it. See ya.
(She kisses him passionately,then leaves.)
Chandler: Call me!
[Scene: The Chinese Restaurant, Ross and Carol are talking. Kristin is not there.]
Carol: It's not true.
Ross: You did so. I swear, I swear(noticing Kristin's absence) How long has she been in the bathroom?
Carol: Uh, I don't think she's in the bathroom. Her coat is gone.
Ross: Well maybe it's cold in there.
Carol: That could be it.
Ross: Oh, god. (He puts his head down on the grill) You know, this is still pretty hot.  Carol picks it off and eats it.)
Carol: Mushroom. Smile. They won't all be like this. Some women might even stay through dinner. Sorry, that's not funny
Ross: No, it's just...you know the whole "getting on with your life" thing. Well, do I have to? I mean, I'm sitting here with this cute woman, and, and, and she's perfectly nice, and, but that there's, that's it. And um, and then I'm here talkin' to you, and, and it's easy, and it's fun, and, and I don't, I don't have to...You know, here's a wacky thought. Um, what's say you and I give it another shot?  But what do you say we just put that aside for now you know? Let's just stick a pin in it, ok? Because, we're great together, you know. You can't deny it. Besides, you're carrying my baby. I mean, how perfect is that? But see, you know, you keep sayin' that, but there's somethin' right here. I love you.
(They kiss.)
Carol: Oh, I love you too. But...
Ross: No but, no but.
Carol: You know that thing you put over here with the pin in it? It's time to take the pin out. You'll find someone, I know you will. The right woman is just waiting for you.
Ross: That's easy for you to say, you found one already.
Carol: All you need is a woman who likes men and you'll be set.
(A beautiful woman walks by Ross, he stares at her.)
Carol: Not her.
[Scene: Monica and Rachel's, The girls are talking with the firemen.]
Fireman No. 3: We get off around midnight, why don't we pick you up then?
Rachel: So, um, will you bring the truck?
Fireman No. 3: I'll even let you ring the bell.
Rachel: Oh, my god.
Phoebe: See, there you go, the cleansing works!
Monica: They're nice guys.
Rachel: Oh, they're firemen guys.
[Scene: Out in the hall, the firemen are talking.]
Fireman No. 1: You guys tell them you were married?
Fireman No. 2: No way!
Fireman No. 3: Are you kidding?
End


Have questions or need help? Just reply to this email and the Buysafe Support Team will help you sort it out.


Stuti Mittra
Programmer | Cloud Developer | Analyst | Content writer
Machine Learning
Sharing some of my ML | Python | R projects.
Machine Learning | Python | R


Before Change
duration, min_duration=min_duration)
fX = sequence_embedding.transform(X, batch_size=batch_size)
if distance == "angular":
cosine_distance = pdist(fX, metric="cosine")
y_distance = np.arccos(np.clip(1.0 - cosine_distance, -1.0, 1.0))
else:
y_distance = pdist(fX, metric=distance)
y_true = pdist(y, metric="chebyshev") < 1
After Change
// -- PREPROCESSORS --
for key, preprocessor in config.get("preprocessors", {}).items():
preprocessor_name = preprocessor["name"]
preprocessor_params = preprocessor.get("params", {})
preprocessors = __import__("pyannote.audio.preprocessors",
fromlist=[preprocessor_name])
Preprocessor = getattr(preprocessors, preprocessor_name)


This is a clone of Chainer-Examples-WaveNet and an experiment on Google Colaboratory.
Please see the document "Synthesize_Human_Speech_with_WaveNet" in the docs folder. That's a softcopy of web of chainer-colab-notebook, wavenet in the reference.
Chainer-colab-notebook, Synthesize Human Speech with WaveNet, using CSTR VCTK Corpus.
Following is Loss and Accuray vs iteration, around 20 hours computation, 12 epoch.
At iteration 57000, there is unusual drop shape, it causes resume re-start, due to Colaboratory time limit.
Accuracy is still too low (loss is still high), if without conditioning, waveform generation will fail.
In the samples folder, there are original and generated wav files, and model file (a snapshot).
Suffix of snapshot_iter shows iteration number.
Original wav are some wav of Pannous, english digits. (Please see reference link.)
When you generate using this model file,
You should specify --n_loop 2 as generate.py arrangement, due to Chainer-colab-notebook wavenet n_loop is 2.

Athough generated waveform from iteration only 8000 (1 epoch), it can hear some reverberation of utterance /nine/(=digit 9).
It's may conditoning trick !?


--- layout: post title: TextMate v1.5 released categories: - tools author: David published: true date: 2006-01-06 20:11:42.000000000 +00:00 ---
TextMate is the editor powering the work of every single core contributor and now the best just got even better. The 1.5 release of TextMate is the first official in a long time. So if you last had a look at 1.0.2, it’s time to take another peak.
Oh, and if you haven’t switched yet, you can swing by Apple and pickup a Mac on the way to TextMate. It’s not now, nor ever, going Windows.


Thanks to Julie Zelenski, Jerry Cain and Marty Stepp; Random Writer comes from Joe Zachary.
October 7th, 2016
Images from Codex Seraphinianus by Serafini
This Serafini in reference to Luigi Serafini who wrote a book called the Codex Seraphinianus. The codex is filled with scientific looking writing and figures, all of which are believed to be the product of Serafini's imagination. Two features that Serafini's work primarily embody are morphings—many objects in the codex change from one to another—and random writing.
As such, this assignment consists of two parts (A) Word Ladders where you find ways to morph one word into another and (B) Random Writter where your program stochastically generates text. Each part can be programmed separately, but they should be submitted together. The starter code for this project is availible as a ZIP archive:
Turn in only the following files:
wordladder.cpp
, the C++ code for the Part A Word Ladder program (including a main function)ngrams.cpp
, the C++ code for the Part B N-grams program (including a main function)myinput.txt
, your own unique Part B input file representing text to read in as your program's inputThis is a not a pair assignment (soon!). You must work on your code alone, although as always you are allowed to talk about the problems with other students, on Piazza, in LaIR, office hours, etc.
A word ladder is a connection from one word to another formed by changing one letter at a time with the constraint that at each step the sequence of letters still forms a valid word. For example, here is a word ladder connecting the word "code"
to the word "data"
. Each changed letter is underlined as an illustration:
code
→
cade
→
cate
→
date
→
data
There are many other word ladders that connect these two words, but this one is the shortest. That is, there might be others of the same length, but none with fewer steps than this one.
In the first part of this assignment, write a program that repeatedly prompts the user for two words and finds a minimum-length ladder between the words. You must use the Stack and Queue collections from Chapter 5, along with following a particular provided algorithm to find the shortest word ladder. This part is simpler than Part B. Here is an example log of interaction between your program and the user (with console input underlined):
Here is an example log of interaction between your program and the user (with console input in red).
Welcome to CS 106B Word Ladder. Please give me two English words, and I will change the first into the second by changing one letter at a time. Dictionary file name? dictionary.txt Word #1 (or Enter to quit): code Word #2 (or Enter to quit): data A ladder from data back to code: data date cate cade code Word #1 (or Enter to quit): Have a nice day.
Notice that the word ladder prints out in reverse order, from the second word back to the first. If there are multiple valid word ladders of the same length between a given starting and ending word, your program would not need to generate exactly the ladder shown in this log, but you must generate one of minimum length.
Your code should ignore case; in other words, the user should be able to type uppercase, lowercase, mixed case, etc. words and the ladders should still be found and displayed in lowercase. You should also check for several kinds of user input errors, and not assume that the user will type valid input. Specifically, you should check that both words typed by the user are valid words found in the dictionary, that they are the same length, and that they are not the same word. If invalid input occurs, your program should print an error message and re-prompt the user. See the logs of execution on the course web site for examples of proper program output for such cases.
You will need to keep a dictionary of all English words. We provide a file dictionary.txt that contains these words, one per line. We also suggest using the Stanford library's Lexicon
class to store the dictionary. Using the Lexicon
class is not hard -- please see the Lexicon class reference for details. You will need to read in the dictionary of words and then you should simply use the contains()
method to determine if a word is in the dictionary when you need that functionality.
Your program should prompt the user to enter a dictionary file name and use that file as the source of the English words. (If the user types a file name that does not exist, reprompt them; see the second execution log on the next page.) Read the file a single time in your program, and choose an efficient collection to store and look up words. Note that you should not ever need to loop over the dictionary as part of solving this problem.
Here are a few more example runs:
Finding a word ladder is a specific instance of a shortest-path problem of finding a path from a start position to a goal. Shortest-path problems come up in routing Internet packets, comparing gene mutations, Google Maps, and so on. The strategy we will use for finding a shortest path is called breadth-first search ("BFS"), a search process that expands out from a start position, considering all possibilities that are one step away, then two steps away, and so on, until a solution is found. BFS guarantees that the first solution you find will be as short as any other.
For word ladders, start by examining ladders that are one step away from the original word, where only one letter is changed. Then check all ladders that are two steps away, where two letters have been changed. Then three, four, etc. We implement the breadth-first algorithm using a queue to store partial ladders that represent possibilities to explore. Each partial ladder is a stack, which means that your overall collection is a queue of stacks.
Here is a partial pseudocode description of the algorithm to solve the word-ladder problem:
Finding a word ladder between words w1 and w2: Create an empty queue of stacks. Create/add a stack containing {w1} to the queue. While the queue is not empty: Dequeue the partial-ladder stack from the front of the queue. For each valid English word that is a "neighbor" (differs by 1 letter) of the word on top of the stack: If that neighbor word has not already been used in a ladder before: If the neighbor word is w2: Hooray! we have found a solution (and it is the stack you are working on in the queue). Otherwise: Create a copy of the current partial-ladder stack. Put the neighbor word on top of the copy stack. Add the copy stack to the end of the queue.
Some of the pseudocode corresponds almost one-to-one with actual C++ code. One part that is more abstract is the part that instructs you to examine each "neighbor" of a given word. A neighbor of a given word w is a word of the same length as w that differs by exactly 1 letter from w. For example, "date"
and "data"
are neighbors.
It is not appropriate to look for neighbors by looping over the entire dictionary every time; this is way too slow. To find all neighbors of a given word, use two nested loops: one that goes through each character index in the word, and one that loops through the letters of the alphabet from a-z, replacing the character in that index position with each of the 26 letters in turn. For example, when examining neighbors of "date", you'd try:
aate,bate,cate,...,zate
← all possible neighbors where only the 1st letter is changed.
date,dbte,dcte,...,dzte
← all possible neighbors where only the 2nd letter is changed.
data,datb,datc,...,datz
← all possible neighbors where only the 4th letter is changed.
Note that many of the possible words along the way (aate
, dbte
, datz
, etc.) are not valid English words. Your algorithm has access to an English dictionary, and each time you generate a word using this looping process, you should look it up in the dictionary to make sure that it is actually a legal English word.
Another way of visualizing the search for neighboring words is to think of each letter index in the word as being a "spinner" that you can spin up and down to try all values A-Z for that letter. The diagram below tries to depict this:
Another subtle issue is that you do not reuse words that have been included in a previous shorter ladder. For example, suppose that you have the partial ladder cat → cot → cog → to the queue. Lateron, if your code is processing ladder cat → cot → con, one neighbor of con is cog, so you might want to examine cat → cot → con → cog. But doing so is unnecessary. If there is a word ladder that begins with these four words, then there must be a shorter one that, in effect, cuts out the middleman by eliminating the unnecessary word con. As soon as you've enqueued a ladder ending with a specific word, you've found a minimum-length path from the starting word to the end word in the ladder, so you never have to enqueue that end word again.
To implement this strategy, keep track of the set of words that have already been used in any ladder. Ignore those words if they come up again. Keeping track of what words you've used also eliminates the possibility of getting trapped in an infinite loop by building a circular ladder, such as cat → cot → cog → bog → bag → bat → cat.
It is helpful to test your program on smaller dictionary files first to find bugs or issues related to your dictionary or word searching.
In the second part of this assignment, you will write a program that reads an input file and uses it to build a large data structure of word groups called "N- grams" as a basis for randomly generating new text that sounds like it came from the same author as that file. You will use the Map
and Vector
collections from Chapter 5.
Bellow is an example log of interaction between your program and the user (console input underlined). But what, you may ask, is an N-gram?
Welcome to CS 106B Random Writer ('N-Grams'). This program makes random text based on a document. Give me an input file and an 'N' value for groups of words, and I'll create random text for you. Input file name? hamlet.txt Value of N? 3 # of random words to generate (0 to quit)? 40 ... chapel. Ham. Do not believe his tenders, as you go to this fellow. Whose grave's this, sirrah? Clown. Mine, sir. [Sings] O, a pit of clay for to the King that's dead. Mar. Thou art a scholar; speak to it. ... # of random words to generate (0 to quit)? 20 ... a foul disease, To keep itself from noyance; but much more handsome than fine. One speech in't I chiefly lov'd. ... # of random words to generate (0 to quit)? 0 Exiting.
The "Infinite Monkey Theorem" states that an infinite number of monkeys typing random keys forever would eventually produce the works of William Shakespeare. (See here) That's silly, but could a monkey randomly produce a new work that "sounded like" Shakespeare's works, with similar vocabulary, wording, punctuation, etc.? What if we chose words at random, instead of individual letters? Suppose that rather than each word having an equal probability of being chosen, we weighted the probability based on how often that word appeared in Shakespeare's works?
Picking random words would likely produce gibberish, but let's look at chains of two words in a row. For example, perhaps Shakespeare uses the word "to" occurs 10 times total, and 7 of those occurrences are followed by "be", 1 time by "go", and 2 times by "eat". We can use those ratios when choosing the next word. If the last word we chose is "to", randomly choose "be" next 7/10 of the time, "go" 1/10 of the time, and "eat" 2/10. We never choose any other word to follow "to". We call a chain of two words like this, such as "to be", a 2-gram.
Go, get you have seen, and now he makes as itself? (2-gram)
A sentence of 2-grams isn't great, but look at chains of 3 words (3-grams). If we chose the words "to be", what word should follow? If we had a collection of all sequences of 3 words-in-a-row with probabilities, we could make a weighted random choice. If Shakespeare uses "to be" 22 times and follows them with "or" 5 times, "in" 3 times, "with" 10 times, and "alone" 4 times, we could use these weights to randomly choose the next word. So now the algorithm would pick the third word based on the first two, and the fourth based on the (second+third), and so on.
One woe doth tread upon another's heel, so fast they follow. (3-gram)
You can generalize the idea from 2-grams to N-grams for any integer N. If you make a collection of all groups of N-1 words along with their possible following words, you can use this to select an Nth word given the preceding N-1 words. The higher N level you use, the more similar the new random text will be to the original data source. Here is a random sentence generated from 5-grams of Hamlet, which is starting to sound a lot like the original:
I cannot live to hear the news from England, But I do prophesy th'election lights on Fortinbras. (5-gram)
Each particular piece of text randomly generated in this way is also called a Markov chain. Markov chains are very useful in computer science and elsewhere, such as artificial intelligence, machine learning, economics, and statistics.
Here are a few more example runs:
In this program, you will read the input file one word at a time and build a particular compound collection, a map from prefixes to suffixes. If you are building 3-grams, that is, N-grams for N=3, then your code should examine sequences of 2 words and look at what third word follows those two. For later lookup, your map should be built so that it connects a collection of N-1 words with another collection of all possible suffixes; that is, all possible N'th words that follow the previous N-1 words in the original text. For example if you are computing N-grams for N=3 and the pair of words "to be" is followed by "or" twice and "just" once, your collection should map the key {to, be} to the value {or, just, or}. The following figure illustrates the map you should build from the file:
When reading the input file, the idea is to keep a window of N-1 words at all times, and as you read each word from the file, discard the first word from your window and append the new word. The following figure shows the file being read and the map being built over time as each of the first few words is read to make 3-grams:
| File Location | Data |
|---|---|
| to be | or not to be just ... |
map = {} window = {to, be} |
| to be or | not to be just ... |
map = { {to, be} : {or} } window = {be, or} |
| to be or not | to be just ... |
map = { {to, be} : {or}, {be, or} : {not} } window = {or, not} |
| to be or not to | be just ... |
map = { {to, be} : {or}, {be, or} : {not}, {or, not} : {to} } window = {not, to} |
| to be or not to be | just ... |
map = { {to, be} : {or}, {be, or} : {not}, {or, not} : {to}, {not, to} : {be} } window = {to, be} |
| to be or not to be just | ... |
map = { {to, be} : {or, just}, {be, or} : {not}, {or, not} : {to}, {not, to} : {be} } window = {be, just} |
|
to be or not to be just be who you want to be or not okay you want okay| |
map = { {to, be} : {or, just, or}, {be, or} : {not, not}, {or, not} : {to, okay}, {not, to} : {be}, {be, just} : {be}, {just, be} : {who}, {be, who} : {you}, {who, you} : {want}, {you, want} : {to, okay}, {want, to} : {be}, {not, okay} : {you}, {okay, you} : {want}, {want, okay} : {to}, {okay, to} : {be} } |
Note that the order matters: For example, the prefix {you, are} is different from the prefix {are, you}. Note that the same word can occur multiple times as a suffix, such as "or" occurring twice after the prefix {to, be}.
Also notice that the map wraps around. For example, if you are computing 3-grams like the above example, perform 2 more iterations to connect the last 2 prefixes in the end of the file to the first 2 words at the start of the file. In our example above, this leads to {want, okay} connecting to "to" and {okay, to} connecting to "be". If we were doing 5-grams, we would perform 4 more iterations and connect the last 4 prefixes to the first 4 words in the file, and so on. This turns out to be very useful to help your algorithm later on in the program.
You should not change case or strip punctuation of words as you read them. The casing and punctuation turns out to help the sentences start and end in a more authentic way. Just store the words in the map as you read them.
To generate random text from your map of N-grams, first choose a random starting point for the document. To do this, pick a randomly chosen key from your map. Each key is a collection of N-1 words. Those N-1 words will form the start of your random text. This collection of N-1 words will be your sliding "window" as you create your text.
For all subsequent words, use your map to look up all possible next words that can follow the current N-1 words, and randomly choose one with appropriate weighted probability. If you have built your map the way we described, as a map from {prefix} → {suffixes}, this simply amounts to choosing one of the possible suffix words at random. Once you have chose your random suffix word, slide your current "window" of N-1 words by discarding the first word in the window and appending the new suffix.
Since your random text likely won't happen to start and end at the beginning/end of a sentence, just prefix and suffix your random text with "..." to indicate this. Here is another partial log of execution:
Input file? tiny.txt Value of N? 3 # of random words to generate (0 to quit)? 16 ... who you want okay to be who you want to be or not to be or ...
Your code should check for several kinds of user input errors, and not assume that the user will type valid input. Specifically, re-prompt the user if they type the name of a file that does not exist. Also re-prompt the user if they type a value for N that not an integer, or is an integer less than 2 (a 2-gram has prefixes of length 1; but a 1-gram is essentially just choosing random words from the file and is uninteresting for our purposes). When prompting the user for the number of words to randomly generate, re-prompt them if the number of random words to generate is not at least N. You may assume that the value the user types for N is not greater than the number of words found in the file. See the logs of execution on the course web site for examples of proper program output for various cases.
Along with your program, submit a file myinput.txt that contains a text file that can be used as input for Part B. This can be anything you want, as long as it is non-empty and is something you gathered yourself (not just a copy of an existing input file). This is meant to be just-for-fun; for example, if you like a particular band, you could paste several of their songs into a text file, which leads to funny new songs when you run your N-grams program on this data. Or gather the text of a book you really like, or poems, or anything you want. This is worth a small part of your grade on the assignment.
This program can be tricky if you don't develop and debug it step-by-step. Don't try to write everything all at once. Make sure to test each part of the algorithm before you move on.
Thats all! You are done. Consider adding extra features.


{% extends "learn/pages/special-topics-base.html" %} {% import "learn/pages/partials/_learn_pages_utils.html" as learn_pages_utils %} {% block lhs_toc %} Table of contents
{% endblock %} {% block center_content %}NOTE: This is an advanced topic, even moreso than some others in the "special topics" section. This material is typically presented in the second or third semester of a traditional Computer Science curriculum, so keep that in mind if you're still relatively new to programming.
Before the lecture, please read the following:
If you're relatively new to programming, chances are you've never had to worry about how efficient your code was. Typically, as long as it runs and gives you the result you're lookig for, you're happy! For some applications (especially when working in a company), you need to care. If you have to process millions of events and render a web page in under a second, you have to ensure you're using the most efficient algorithms. The first step to identifying the slow parts of your code is to get a basic understanding of algorithmic complexity.
Complexity is rooted in mathematics. You can create a function to tell you how many operations a program would take to run. An operation is an abstract unit that roughly mimics something a computer can do in one* CPU instruction. The benefit of using operations instead of something like "seconds of runtime" is that it's consistent across different computers. The amount of data a laptop could process in one second is very different from a phone, a calculator, or a supercomputer. Algorithmic complexity doesn't care how fast or advanced computers get, though. What's more important is that we can measure how many operations it would take given some input. Even if you took a computer from 50 years ago, it would take roughly the same amount of operations*, it's just that the CPU executes those instructions more slowly.
*This isn't completely accurate, especially with modern CPUs, but the idea is roughly correct. I'm grossly oversimplifying a bunch of details about computer architecture here, but I really can't explain that in the confines of these short articles. The TL;DR: is that one operation = one thing a computer can do "instantly."
As I mentioned before, we assume the computer can do certain things instantly. Printing, doing basic mathematical operations (plus, minus, times, divide), indexing into a list (mylist[0]
), or evaluating a simple condition (if 3 < 4
) would each count as a single operation. So far, this isn't too interesting, but let's start thinking about loops. Imagine the following program:
def foo(nums, threshold):
for num in nums:
if item < threshold:
print(item)
This function is pretty straightforward. Given a list of numbers and some threshold, it will print out all numbers strictly less than that threshold. So if we call foo([1, 2, 3, 4], 3)
, our program would print 1 and 2. Let's try to analyze the complexity of this function, though. If we call foo([1, 2, 3, 4], 3)
, how many operations get executed? The condition is a single operation and the print is a single operation, so each loop iteration takes two operations. That means our entire function call is 8 operations.
Great! Now what if we called foo(somelist, 23)
where somelist
has 100 elements? We can deduce that our function would now take 200 operations.
Now let's think abstractly. What if we call foo
with a list of length N
? In this case, our function would take 2N
operations. In mathematical terms, you could say operations = 2 * N
. This is actually the basis for algorithmic complexity analysis. For an input of length N
, how long will an algorithm run?
We say the foo
function has linear complexity (it's a linear-time algorithm), because if you add N
elements to the input, the computer takes N
more operations to complete the function. At first you may be thinking, "Well then wouldn't every function be linear?" No, actually! Think about this rather simple function:
def get_middle_item(items):
n = len(items)
mid = n // 2
return items[mid]
No matter how long the input list is, this function will always take the same number of operations to complete. Doing simple math and indexing into a list each just take one operation. We say this is a constant-time algorithm because if you add N
elements to the input, the computer will not execute more operations.
Let's look at one more example.
def print_all_multiplications(nums):
n = len(nums)
for i in range(n):
for j in range(n):
num1 = nums[i]
num2 = nums[j]
result = num1 * num2
print(f"nums[{i}] = {num1}, nums[{j}] = {num2}, result={result}")
What would the complexity of this function be? This one is a bit trickier. Let's try to work it out by hand. First, imagine we call print_all_multiplications([1])
. If you work through the algorithm, you should see that it seems we perform five operations (len(list)
also just takes one operation). Okay, now what about print_all_multiplications([1, 2])
? By my count, that now leads to 17 operations. If you analyze print_all_multiplications([1, 2, 3])
, you'll find that it takes 37 operations. It's hard to see a pattern here so far, but I promise one does actually exist.
To simplify our pattern finding, let's assume everything within the innermost loop happens in C
operations (here, C = 4, but this should make our analysis easier). When we call print_all_multiplications([1])
, it now takes C + 1
operations. When we call print_all_multiplications([1, 2])
, it takes 4C + 1
operations. For print_all_multiplications([1, 2, 3])
, now it's 9C + 1
operations. Hey, these look like squared numbers! Indeed, if you keep going, you'll see that for a list with N
items, this function takes c*n^2 + 1
operations!
When we talk about algorithmic complenity, we generally won't care about constants, since the functions are dominated by the leading terms. If you take a function that takes 5*n + 3
operations versus a function that takes n^2
operations and see how many operations it would take for an input of size 1000, the first function would take 5,003 operations while the second takes 1,000,000. For this reason, we typically omit constants from our complenity analysis. This leads us to to the concept of Big O notation. Big O notation is a way to describe the limiting behavior of a function. For enample, if you have a program that takes f(n) = 3n^3 + 4n^2 + 10n + 9
operations, you could say your program is O(n^3).
Getting into the practical side of algorithmic complexity now, if we have two different ways to solve the same problem, we can analyze which one is more computationally efficient to ensure our programs can complete their tasks quickly. Let's think about the problem of figuring out if a number is in a list.
If I gave you a list of numbers and asked if some other number is in that list, what would you have to do? You'd have to scan through the list and figure out if the number exists. We would say this is a linear scan and is bounded by O(n). What if I told you the list was sorted, though? In this case, you could use the binary search algorithm. You'd start by looking at the middle of the list. If that number was larger than the number you were searching for, you would search the bottom half of the list. If that number was smaller, you'd search the top half of the list. You would continue this process, each time eliminating half the list to search. When you have a function that processes half its input in each iteration, that function's complexity is logarthmic; it is bounded by O(logn).
I've already droned on far longer than the average lesson here, so I'm going to wrap this up here. The idea was to just give you an introduction about what it means to compute the complexity of an algorithm. There are many resources across the internet that explain this topic well. If you find one you like, let me know and I can add it here!
If you still feel confused, don't fret. I effectively had two semesters in college covering just this topic. It's extremely broad and not something you can just "figure out" after reading a half-page article. It takes time and practice. If there's something specific that you want to learn more about, please reach out and I can expand on it here.
Question 1: What is the complexity of the following algorithm?
def some_function(nums):
for num in nums:
if 2 * num > 10:
print(item)
{{
learn_pages_utils.render_question_responses(1, [
(False, "O(logn)", "Incorrect. We're going through each number at least once, so it must be at least n, right?"),
(True, "O(n)", "Correct!"),
(False, "O(n^2)", "Incorrect. n^2 is typical when you go through a list in a nested loop, but there are no nested loops here."),
(False, "O(1)", "Incorrect. This would mean the function is effectively instant. The computer is definitely doing some processing here."),
])
}}
Question 2: What is the complexity of the following algorithm?
def another_function(nums):
for num in nums:
if num < 100:
return num
return -1
{{
learn_pages_utils.render_question_responses(2, [
(True, "O(n)", "Correct!"),
(False, "O(logn)", "Incorrect. We're going through each number at least once, so it must be at least n, right?"),
(False, "O(n^2)", "Incorrect. n^2 is typical when you go through a list in a nested loop, but there are no nested loops here."),
(False, "O(1)", "Incorrect. This would mean the function is effectively instant. The computer is definitely doing some processing here."),
(False, "It depends on the input", "Incorrect. Remember that Big O notation is about finding bounding behavior. Think about the worst case scenario"),
])
}}
{% endblock %}
{% block scripts %}
{{ super() }}
{{ learn_pages_utils.render_question_jquery(1) }}
{{ learn_pages_utils.render_question_jquery(2) }}
{% endblock %}