Product Services
Click to retrieve all products
Product List goes here
Click to retrieve by Id
Product by Id goes here
Click to retrieve by Name
Product by names goes here
Add Product
Product Name:
Product Description:
Product Price:
Product Stock:
Click to Add this Product
Created Product goes here


👏- High Scores -🏆
Please add your initials to record your Quiz result. I'll store it for you to admire.
Your data is
available on this computer only, so bragging rights need to be done by a screen grab. Thanks for playing.
High Scores register: ...no high scores stored yet.


Chapter 9 Time Series data with the Tidyverts Packages
Fun text here.
All kinds of crazy examples.
Time series with data from influenza pandemic of 1918-19, perhaps.
This is a book for anyone in the medical field interested in analyzing the data available to them to better understand health, disease, or delivery of care. This could include nurses, dieticians, psychologists, and PhDs in related fields, as well as medical students, residents, fellows, or doctors in practice.
I expect that most learners will be using this book in their spare time at night and on weekends, as the medical school curriculum is already packed full, and there is no room to add skills in reproducible research to the standard curriculum. This book is designed for self-teaching, and many hints and solutions will be provided to avoid roadblocks and frustration.
9.2 Fable
Tidy forecasting
9.3 Feasts
Feature extraction and Statistics
9.4 Slider
Rolling anaylsis with window functions.
Slider packagedown page


The Q flag should be flown at the first port of entry into the Azores. Yachts must clear in at the marina office at one of the ports of entry. After which they will direct you to Customs (Alfandega), Immigration and Guarda Nacional Republicana.
In larger ports, the Policia Maritima should also be visited, as well as the Port Authority (Capitania).
A transit log may be issued by the Port Authority to those yachts from countries not belonging to the European Union, although it appears its use is being phased out.
Several of the marina offices at Ports of Entry are computerised and details of the yachts' arrival are automatically reported to all the appropriate officials.
In all ports of call in the Azores visited subsequently, the transit log (if issued) must be taken along and presented to the local Guarda Nacional Republicana office.
As part of Portugal, the Azores are members of the EU, with which they have a special relationship. The usual EU regulations apply, although because of their isolated position, the authorities tend to treat all arriving yachts as if coming from a non-EU country and subsequently subject them to the full range of clearance formalities.
All boats must display the Portuguese courtesy flag as well as the Azores islands flag (below the Portuguese one and, of course, on the same mast). An Azores flag may be purchased in advance from Mid Atlantic Yacht Services in Horta.
On departure, fees must be paid and then all the officials visited again.
Last updated June 2016.
The Azores comes under Portugal's Schengen Area agreement and therefore has similar visa regulations.
See Portugal/Immigration for details.
Last updated June 2016.
Firearms must be declared, and it may also be advisable to declare prescription medications as the Customs authorities can enforce strict regulations concerning the temporary importation of such items.
The Azores are part of the EU VAT area, so non-EU yachts may stay for eighteen months before becoming liable for duty. Because the VAT rate here is lower than in mainland Portugal (as well as in other EU countries), it is a useful place to officially import a boat.
Last updated June 2016.
It is not necessary to have special vaccinations when visiting the Azores but a yellow fever vaccination certificate is required if coming from an infected area. Modern hospitals in Ponta Delgada, Angra and Horta in additional to health centers on each island and pharmacies in each city (recognised by the green cross) Emergency number is 115.
Yachts must carry their original registration document, insurance policy and ship's radio licence. One member of the crew must have a radio operator’s certificate of competence. For EU boats, proof of VAT status is also required. It is also very useful to have a typed sheet containing the name of the boat, port of registry, and the crew list.
A transit log (Livrete de Transito) is issued to non-EU yachts by the Capitania or Delegaoes Maritimas on arrival. All subsequent movements of the yacht are recorded in this log until departure. Yachts must clear in and out of all ports, including harbours on the same island. If arriving from Madeira, the same transit log may be used, but if arriving from mainland Portugal, a new log is usually issued.
There is a small fee to the Lighthouse Service for yachts over 79 ft (24 m).
Spearfishing within 164 ft (50 m) of a public beach, port or protected area, and spearfishing with scuba tanks anywhere, is prohibited. A permit to dive can be obtained from the Capitania.
It is forbidden for boats, local or visiting, to anchor at Porto Pim (south of Horta) due to the optical fiber submarine cable laid there.
The Azores comes under the EU Pets Travel Scheme (PETS) and pets must have Pet Passport, to have microchip and current Health Certificate and Rabies Vaccincation Certificate issued by authorised Veterinarian.
Cats and dogs entering from non-E.U. countries, are subject to obtaining prior authorisation from "Direccao Regional de Pecuaria de Madeira". Written authorisation to be requested at least 24 hours prior to arrival via fax +351-291-233156.


My name is Stephan Abrahamsen, and I am a self-taught web developer with a B.Sc. in Computer Science, based in Tromsø, Norway.
Front End Projects
Receive random quotes and tweet them! This is a freeCodeCamp project.
Displays your local weather through geolocation. This is a freeCodeCamp project.


Adds frame to accumulator
void cvAcc( const CvArr* I, CvArr* S, const CvArr* mask=0 );
The function cvAcc adds the whole image I or its selected region to accumulator S:
S(x,y)=S(x,y)+I(x,y) if mask(x,y)!=0
Adds the square of source image to accumulator
void cvSquareAcc( const CvArr* img, CvArr* sqSum, const CvArr* mask=0 );
The function cvSquareAcc adds the square of input image I or its selected region to accumulator Sq:
Sq(x,y)=Sq(x,y)+I(x,y)2 if mask(x,y)!=0
Adds product of two input images to accumulator
void cvMultiplyAcc( const CvArr* I, const CvArr* J, CvArr* Sp, const CvArr* mask=0 );
The function cvMultiplyAcc adds product of the whole images I and J or their selected regions to accumulator Sp:
Sp(x,y)=Sp(x,y)+I(x,y)•J(x,y) if mask(x,y)!=0
Updates running average
void cvRunningAvg( const CvArr* I, CvArr* R, double alpha, const CvArr* mask=0 );
The function cvRunningAvg calculates weighted sum of input image I and accumulator R so that R becomes a running average of frame sequence:
R(x,y)=(1-α)•R(x,y) + α•I(x,y) if mask(x,y)!=0
where α (alpha) regulates update speed (how fast accumulator forgets about previous frames).
Updates motion history image by moving silhouette
void cvUpdateMotionHistory( const CvArr* S, CvArr* MHI, double timestamp, double duration );
The function cvUpdateMotionHistory updates the motion history image as following:
MHI(x,y)=timestamp if S(x,y)!=0 0 if S(x,y)=0 and MHI(x,y)<timestamp-duration MHI(x,y) otherwise
That is, MHI pixels where motion occurs are set to the current timestamp, while the pixels where motion happened far ago are cleared.
Calculates gradient orientation of motion history image
void cvCalcMotionGradient( const CvArr* MHI, CvArr* mask, CvArr* orientation, double delta1, double delta2, int apertureSize=3 );
min(delta1,delta2) <= M(x,y)-m(x,y) <= max(delta1,delta2).
The function cvCalcMotionGradient calculates the derivatives Dx and Dy of MHI and then calculates gradient orientation as:
orientation(x,y)=arctan(Dy(x,y)/Dx(x,y))
where both Dx(x,y)' and Dy(x,y)' signs are taken into account (as in cvCartToPolar function). After that mask is filled to indicate where the orientation is valid (see delta1 and delta2 description).
Calculates global motion orientation of some selected region
double cvCalcGlobalOrientation( const CvArr* orientation, const CvArr* mask, const CvArr* MHI, double currTimestamp, double mhiDuration );
The function cvCalcGlobalOrientation calculates the general motion direction in the selected region and returns the angle between 0° and 360°. At first the function builds the orientation histogram and finds the basic orientation as a coordinate of the histogram maximum. After that the function calculates the shift relative to the basic orientation as a weighted sum of all orientation vectors: the more recent is the motion, the greater is the weight. The resultant angle is a circular sum of the basic orientation and the shift.
Segments whole motion into separate moving parts
CvSeq* cvSegmentMotion( const CvArr* MHI, CvArr* segMask, CvMemStorage* storage, double timestamp, double segthresh );
The function cvSegmentMotion finds all the motion segments and marks them in segMask with individual values each (1,2,...). It also returns a sequence of CvConnectedComp structures, one per each motion components. After than the motion direction for every component can be calculated with cvCalcGlobalOrientation using extracted mask of the particular component (using cvCmp)
Finds object center on back projection
int cvMeanShift( const CvArr* imgProb, CvRect windowIn, CvTermCriteria criteria, CvConnectedComp* comp );
The function cvMeanShift iterates to find the object center given its back projection and initial position of search window. The iterations are made until the search window center moves by less than the given value and/or until the function has done the maximum number of iterations. The function returns the number of iterations made.
Finds object center, size, and orientation
int cvCamShift( const CvArr* imgProb, CvRect windowIn, CvTermCriteria criteria, CvConnectedComp* comp, CvBox2D* box=0 );
The function cvCamShift implements CAMSHIFT object tracking algrorithm ([Bradski98]). First, it finds an object center using cvMeanShift and, after that, calculates the object size and orientation. The function returns number of iterations made within cvMeanShift.
CvCamShiftTracker class declared in cv.hpp implements color object tracker that uses the function.
[Bradski98] G.R. Bradski. Computer vision face tracking as a component of a perceptual
user interface. In Workshop on Applications of Computer Vision, pages 214–219,
Princeton, NJ, Oct. 1998.
Updated version can be viewed online at
http://www.intel.com/technology/itj/q21998/articles/art_2.htm.
Also, it is included into OpenCV distribution (camshift.pdf)
Changes contour position to minimize its energy
void cvSnakeImage( const IplImage* image, CvPoint* points, int length, float* alpha, float* beta, float* gamma, int coeffUsage, CvSize win, CvTermCriteria criteria, int calcGradient=1 );
The function cvSnakeImage updates snake in order to minimize its total energy that is a sum of internal energy that depends on contour shape (the smoother contour is, the smaller internal energy is) and external energy that depends on the energy field and reaches minimum at the local energy extremums that correspond to the image edges in case of image gradient.
The parameter criteria.epsilon is used to define the minimal number of points that must be moved during any iteration to keep the iteration process running.
If at some iteration the number of moved points is less than criteria.epsilon or the function performed criteria.maxIter iterations, the function terminates.
Calculates optical flow for two images
void cvCalcOpticalFlowHS( const CvArr* imgA, const CvArr* imgB, int usePrevious, CvArr* velx, CvArr* vely, double lambda, CvTermCriteria criteria );
The function cvCalcOpticalFlowHS computes flow for every pixel of the first input image using Horn & Schunck algorithm [Horn81].
[Horn81] Berthold K.P. Horn and Brian G. Schunck. Determining Optical Flow. Artificial Intelligence, 17, pp. 185-203, 1981.
Calculates optical flow for two images
void cvCalcOpticalFlowLK( const CvArr* imgA, const CvArr* imgB, CvSize winSize, CvArr* velx, CvArr* vely );
The function cvCalcOpticalFlowLK computes flow for every pixel of the first input image using Lucas & Kanade algorithm [Lucas81].
[Lucas81] Lucas, B., and Kanade, T. An Iterative Image Registration Technique with an Application to Stereo Vision, Proc. of 7th International Joint Conference on Artificial Intelligence (IJCAI), pp. 674-679.
Calculates optical flow for two images by block matching method
void cvCalcOpticalFlowBM( const CvArr* imgA, const CvArr* imgB, CvSize blockSize, CvSize shiftSize, CvSize maxRange, int usePrevious, CvArr* velx, CvArr* vely );
The function cvCalcOpticalFlowBM calculates optical flow for overlapped blocks blockSize.width×blockSize.height pixels each, thus the velocity fields are smaller than the original images. For every block in imgA the functions tries to find a similar block in imgB in some neighborhood of the original block or shifted by (velx(x0,y0),vely(x0,y0)) block as has been calculated by previous function call (if usePrevious=1)
Calculates optical flow for a sparse feature set using iterative Lucas-Kanade method in pyramids
void cvCalcOpticalFlowPyrLK( const CvArr* imgA, const CvArr* imgB, CvArr* pyrA, CvArr* pyrB, CvPoint2D32f* featuresA, CvPoint2D32f* featuresB, int count, CvSize winSize, int level, char* status, float* error, CvTermCriteria criteria , int flags );
The function cvCalcOpticalFlowPyrLK implements sparse iterative version of Lucas-Kanade optical flow in pyramids ([Bouguet00]). Calculates the optical flow between two images for the given set of points. The function finds the flow with sub-pixel accuracy.
Both parameters pyrA and pyrB comply with the following rules: if the image pointer is 0 , the function allocates the buffer internally, calculates the pyramid, and releases the buffer after processing. Otherwise, the function calculates the pyramid and stores it in the buffer unless the flag CV_LKFLOW_PYR_A[B]_READY is set. The image should be large enough to fit the Gaussian pyramid data. After the function call both pyramids are calculated and the ready flag for the corresponding image can be set in the next call.
[Bouguet00] Jean-Yves Bouguet. Pyramidal Implementation of the Lucas Kanade Feature Tracker.
The paper is included into OpenCV distribution (algo_tracking.pdf)
Kalman filter state
typedef struct CvKalman { int MP; /* number of measurement vector dimensions */ int DP; /* number of state vector dimensions */ int CP; /* number of control vector dimensions */ /* backward compatibility fields */ #if 1 float* PosterState; /* =state_pre->data.fl */ float* PriorState; /* =state_post->data.fl */ float* DynamMatr; /* =transition_matrix->data.fl */ float* MeasurementMatr; /* =measurement_matrix->data.fl */ float* MNCovariance; /* =measurement_noise_cov->data.fl */ float* PNCovariance; /* =process_noise_cov->data.fl */ float* KalmGainMatr; /* =gain->data.fl */ float* PriorErrorCovariance;/* =error_cov_pre->data.fl */ float* PosterErrorCovariance;/* =error_cov_post->data.fl */ float* Temp1; /* temp1->data.fl */ float* Temp2; /* temp2->data.fl */ #endif CvMat* state_pre; /* predicted state (x'(k)): x(k)=A*x(k-1)+B*u(k) */ CvMat* state_post; /* corrected state (x(k)): x(k)=x'(k)+K(k)*(z(k)-H*x'(k)) */ CvMat* transition_matrix; /* state transition matrix (A) */ CvMat* control_matrix; /* control matrix (B) (it is not used if there is no control)*/ CvMat* measurement_matrix; /* measurement matrix (H) */ CvMat* process_noise_cov; /* process noise covariance matrix (Q) */ CvMat* measurement_noise_cov; /* measurement noise covariance matrix (R) */ CvMat* error_cov_pre; /* priori error estimate covariance matrix (P'(k)): P'(k)=A*P(k-1)*At + Q)*/ CvMat* gain; /* Kalman gain matrix (K(k)): K(k)=P'(k)*Ht*inv(H*P'(k)*Ht+R)*/ CvMat* error_cov_post; /* posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P'(k) */ CvMat* temp1; /* temporary matrices */ CvMat* temp2; CvMat* temp3; CvMat* temp4; CvMat* temp5; } CvKalman;
The structure CvKalman is used to keep Kalman filter state. It is created by cvCreateKalman function, updated by cvKalmanPredict and cvKalmanCorrect functions and released by cvReleaseKalman functions. Normally, the structure is used for standard Kalman filter (notation and formulae are borrowed from excellent Kalman tutorial [Welch95]):
xk=A•xk-1+B•uk+wk zk=H•xk+vk,
where:
xk (xk-1) - state of the system at the moment k (k-1) zk - measurement of the system state at the moment k uk - external control applied at the moment k wk and vk are normally-distributed process and measurement noise, respectively: p(w) ~ N(0,Q) p(v) ~ N(0,R), that is, Q - process noise covariance matrix, constant or variable, R - measurement noise covariance matrix, constant or variable
In case of standard Kalman filter, all the matrices: A, B, H, Q and R are initialized once after CvKalman structure is allocated via cvCreateKalman. However, the same structure and the same functions may be used to simulate extended Kalman filter by linearizing extended Kalman filter equation in the current system state neighborhood, in this case A, B, H (and, probably, Q and R) should be updated on every step.
[Welch95] Greg Welch, Gary Bishop. An Introduction To the Kalman Filter. Technical Report TR95-041, University of North Carolina at Chapel Hill, 1995. Online version is available at http://www.cs.unc.edu/~welch/kalman/kalman_filter/kalman.html
Allocates Kalman filter structure
CvKalman* cvCreateKalman( int dynamParams, int measureParams, int controParams=0 );
The function cvCreateKalman allocates CvKalman and all its matrices and initializes them somehow.
Deallocates Kalman filter structure
void cvReleaseKalman(CvKalman** kalman );
The function cvReleaseKalman releases the structure CvKalman and all underlying matrices.
Estimates subsequent model state
const CvMat* cvKalmanPredict( CvKalman* kalman, const CvMat* control=NULL ); #define cvKalmanUpdateByTime cvKalmanPredict
The function cvKalmanPredict estimates the subsequent stochastic model state by its current state and stores it at kalman->state_pre:
x'k=A•xk+B•uk P'k=A•Pk-1*AT + Q, where x'k is predicted state (kalman->state_pre), xk-1 is corrected state on the previous step (kalman->state_post) (should be initialized somehow in the beginning, zero vector by default), uk is external control (control parameter), P'k is priori error covariance matrix (kalman->error_cov_pre) Pk-1 is posteriori error covariance matrix on the previous step (kalman->error_cov_post) (should be initialized somehow in the beginning, identity matrix by default),The function returns the estimated state.
Adjusts model state
void cvKalmanCorrect( CvKalman* kalman, const CvMat* measurement=NULL ); #define cvKalmanUpdateByMeasurement cvKalmanCorrect
The function cvKalmanCorrect adjusts stochastic model state on the basis of the given measurement of the model state:
Kk=P'k•HT•(H•P'k•HT+R)-1 xk=x'k+Kk•(zk-H•x'k) Pk=(I-Kk•H)•P'k where zk - given measurement (mesurement parameter) Kk - Kalman "gain" matrix.
The function stores adjusted state at kalman->state_post and returns it on output.
#include "cv.h" #include "highgui.h" #include <math.h> int main(int argc, char** argv) { /* A matrix data */ const float A[] = { 1, 1, 0, 1 }; IplImage* img = cvCreateImage( cvSize(500,500), 8, 3 ); CvKalman* kalman = cvCreateKalman( 2, 1, 0 ); /* state is (phi, delta_phi) - angle and angle increment */ CvMat* state = cvCreateMat( 2, 1, CV_32FC1 ); CvMat* process_noise = cvCreateMat( 2, 1, CV_32FC1 ); /* only phi (angle) is measured */ CvMat* measurement = cvCreateMat( 1, 1, CV_32FC1 ); CvRandState rng; int code = -1; cvRandInit( &rng, 0, 1, -1, CV_RAND_UNI ); cvZero( measurement ); cvNamedWindow( "Kalman", 1 ); for(;;) { cvRandSetRange( &rng, 0, 0.1, 0 ); rng.disttype = CV_RAND_NORMAL; cvRand( &rng, state ); memcpy( kalman->transition_matrix->data.fl, A, sizeof(A)); cvSetIdentity( kalman->measurement_matrix, cvRealScalar(1) ); cvSetIdentity( kalman->process_noise_cov, cvRealScalar(1e-5) ); cvSetIdentity( kalman->measurement_noise_cov, cvRealScalar(1e-1) ); cvSetIdentity( kalman->error_cov_post, cvRealScalar(1)); /* choose random initial state */ cvRand( &rng, kalman->state_post ); rng.disttype = CV_RAND_NORMAL; for(;;) { #define calc_point(angle) \ cvPoint( cvRound(img->width/2 + img->width/3*cos(angle)), \ cvRound(img->height/2 - img->width/3*sin(angle))) float state_angle = state->data.fl[0]; CvPoint state_pt = calc_point(state_angle); /* predict point position */ const CvMat* prediction = cvKalmanPredict( kalman, 0 ); float predict_angle = prediction->data.fl[0]; CvPoint predict_pt = calc_point(predict_angle); float measurement_angle; CvPoint measurement_pt; cvRandSetRange( &rng, 0, sqrt(kalman->measurement_noise_cov->data.fl[0]), 0 ); cvRand( &rng, measurement ); /* generate measurement */ cvMatMulAdd( kalman->measurement_matrix, state, measurement, measurement ); measurement_angle = measurement->data.fl[0]; measurement_pt = calc_point(measurement_angle); /* plot points */ #define draw_cross( center, color, d ) \ cvLine( img, cvPoint( center.x - d, center.y - d ), \ cvPoint( center.x + d, center.y + d ), color, 1, 0 ); \ cvLine( img, cvPoint( center.x + d, center.y - d ), \ cvPoint( center.x - d, center.y + d ), color, 1, 0 ) cvZero( img ); draw_cross( state_pt, CV_RGB(255,255,255), 3 ); draw_cross( measurement_pt, CV_RGB(255,0,0), 3 ); draw_cross( predict_pt, CV_RGB(0,255,0), 3 ); cvLine( img, state_pt, predict_pt, CV_RGB(255,255,0), 3, 0 ); /* adjust Kalman filter state */ cvKalmanCorrect( kalman, measurement ); cvRandSetRange( &rng, 0, sqrt(kalman->process_noise_cov->data.fl[0]), 0 ); cvRand( &rng, process_noise ); cvMatMulAdd( kalman->transition_matrix, state, process_noise, state ); cvShowImage( "Kalman", img ); code = cvWaitKey( 100 ); if( code > 0 ) /* break current simulation by pressing a key */ break; } if( code == 27 ) /* exit by ESCAPE */ break; } return 0; }
ConDenstation state
typedef struct CvConDensation { int MP; //Dimension of measurement vector int DP; // Dimension of state vector float* DynamMatr; // Matrix of the linear Dynamics system float* State; // Vector of State int SamplesNum; // Number of the Samples float** flSamples; // array of the Sample Vectors float** flNewSamples; // temporary array of the Sample Vectors float* flConfidence; // Confidence for each Sample float* flCumulative; // Cumulative confidence float* Temp; // Temporary vector float* RandomSample; // RandomVector to update sample set CvRandState* RandS; // Array of structures to generate random vectors } CvConDensation;
The structure CvConDensation stores CONditional DENSity propagATION tracker state. The information about the algorithm can be found at http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/ISARD1/condensation.html
Allocates ConDensation filter structure
CvConDensation* cvCreateConDensation( int DynamParams, int MeasureParams, int SamplesNum );
The function cvCreateConDensation creates CvConDensation structure and returns pointer to the structure.
Deallocates ConDensation filter structure
void cvReleaseConDensation( CvConDensation** ConDens );
The function cvReleaseConDensation releases the structure CvConDensation (see cvConDensation) and frees all memory previously allocated for the structure.
Initializes sample set for condensation algorithm
void cvConDensInitSampleSet( CvConDensation* ConDens, CvMat* lowerBound, CvMat* upperBound );
The function cvConDensInitSampleSet fills the samples arrays in the structure CvConDensation with values within specified ranges.
Estimates subsequent model state
void cvConDensUpdateByTime( CvConDensation* ConDens );
The function cvConDensUpdateByTime estimates the subsequent stochastic model state from its current state.


Download PhoediX 1.0.0-alpha.1
Windows System Requirements
● Microsoft Windows Vista, Windows 7, Windows 8, or Windows 10.
● Intel or AMD CPU with support for x64.
● 2 GB or more of RAM (8 GB recommended).
● 100 MB or more of free disk space
macOS System Requirements
● macOS version 10.9 (OS X Mavericks) or greater.
● Intel CPU with support for x64.
● 2 GB or more of RAM (8 GB recommended).
● 100 MB or more of free disk space
Linux GTK+ System Requirements
● Linux Disto (such as Ubuntu) with suppprt for DPKG installers.
● GTK+ 3.0 GUI Toolkit.
● Intel or AMD CPU with support for x64.
● 2 GB or more of RAM (8 GB recommended).
● 100 MB or more of free disk space
Copyright Jacob Chesley 2020


Ready to add a plant to the map? You can add a newly planted plant or even a plant that has not been identified on the map yet!
Use the form below to add a plant to the database if you know its latitude and longitude coordinates.
Don't know the coordinates? It's okay, you can press the 'Use current location' button to request your device's current location (if it has location functionality enabled) or just tap a point on the map to use the coordinates at that location.
Entering the plant's name, scientific name, and description is optional.


Home
Register
View Activities
About
Register Your Details
First Name:
Other Names:
Gender:
Male
Female
City:
email:
Phone Number:
Sourvenir:
Submit


This is template1 (_partials.html) with just a few text
This is template2 (_partials.html) including template2:


Serendipity is a web based musical search and recommendation system which classifies and recommends music by processing extracted traits from songs. Unlike other such systems which use human based music classification, we have automated the recommendation process and created algorithms to do the work so our users discover new music.
This senior design project of our was intended to be a fun way of exploring and discovering new music.
About Serendipity
We can be reached at<EMAIL_ADDRESS>Please send us any suggestions as well as bugs you have discovered with our platform.


Mayor! Mayor! v1.23 Update Log
April 13, 2018
Next Log
Update Description
Small bug-fixing update today. Fixed some broken links on iOS as well as some navigation issues with the citizens.
Updates
Balancing Changes
Bug Fixes
- Fixed the "Ad-Free" link for the iOS free version.
- Fixed the Update link for iOS free and premium versions.
- Fixes to citizen navigation and the citizen spawn/despawn particle effect.
- Fixed an issue where players could tap buildings while the newspaper UI was open.
- Fixed an issue where citizen spawning was causing the newspaper animation to lag.
- Fixed performance issues related to citizen spawning.


Module: ActiveRecord::FinderMethods
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
|
Included In:
| |
| Defined in: | activerecord/lib/active_record/relation/finder_methods.rb |
Constant Summary
-
ONE_AS_ONE =
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 6'1 AS one'
Instance Method Summary
-
#exists?(conditions = :none) ⇒ Boolean
Returns
true
if a record exists in the table that matches theid
or conditions given, orfalse
otherwise. -
#fifth
Find the fifth record.
-
#fifth!
Same as #fifth but raises RecordNotFound if no record is found.
-
#find(*args)
Find by id - This can either be a specific id (1), a list of ids (1, 5, 6), or an array of ids ([5, 6, 10]).
-
#find_by(*args)
Finds the first record matching the specified conditions.
-
#find_by!(*args)
Like #find_by, except that if no record is found, raises an RecordNotFound error.
-
#first(limit = nil)
Find the first record (or first N records if a parameter is supplied).
-
#first!
Same as #first but raises RecordNotFound if no record is found.
-
#forty_two
Find the forty-second record.
-
#forty_two!
Same as #forty_two but raises RecordNotFound if no record is found.
-
#fourth
Find the fourth record.
-
#fourth!
Same as #fourth but raises RecordNotFound if no record is found.
-
#last(limit = nil)
Find the last record (or last N records if a parameter is supplied).
-
#last!
Same as #last but raises RecordNotFound if no record is found.
-
#second
Find the second record.
-
#second!
Same as #second but raises RecordNotFound if no record is found.
-
#take(limit = nil)
Gives a record (or N records if a parameter is supplied) without any implied order.
-
#take!
Same as #take but raises RecordNotFound if no record is found.
-
#third
Find the third record.
-
#third!
Same as #third but raises RecordNotFound if no record is found.
Instance Method Details
#exists?(conditions = :none) ⇒ Boolean
Returns true
if a record exists in the table that matches the id
or conditions given, or false
otherwise. The argument can take six forms:
-
::Integer - Finds the record with this primary key.
-
::String - Finds the record with a primary key corresponding to this string (such as
'5'
). -
::Array - Finds the record that matches these #find-style conditions (such as
['name LIKE ?', "%#{query}%"]
). -
::Hash - Finds the record that matches these #find-style conditions (such as
{name: 'David'}
). -
false
- Returns alwaysfalse
. -
No args - Returns
false
if the table is empty,true
otherwise.
For more information about specifying conditions as a hash or array, see the Conditions section in the introduction to Base.
Note: You can't pass in a condition as a string (like name = 'Jamie'
), since it would be sanitized and then queried against the primary key column, like id = 'name = \'Jamie\''
.
Person.exists?(5)
Person.exists?('5')
Person.exists?(['name LIKE ?', "%#{query}%"])
Person.exists?(id: [1, 4, 8])
Person.exists?(name: 'David')
Person.exists?(false)
Person.exists?
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 277
def exists?(conditions = :none) if Base === conditions conditions = conditions.id ActiveSupport::Deprecation.warn(<<-MSG.squish) You are passing an instance of ActiveRecord::Base to `exists?`. Please pass the id of the object by calling `.id` MSG end return false if !conditions relation = apply_join_dependency(self, construct_join_dependency) return false if ActiveRecord::NullRelation === relation relation = relation.except(:select, :order).select(ONE_AS_ONE).limit(1) case conditions when Array, Hash relation = relation.where(conditions) else unless conditions == :none relation = relation.where(primary_key => conditions) end end connection.select_value(relation, "#{name} Exists", relation.arel.bind_values + relation.bind_values) ? true : false end
#fifth
Find the fifth record. If no order is defined it will order by primary key.
Person.fifth # returns the fifth object fetched by SELECT * FROM people
Person.offset(3).fifth # returns the fifth object from OFFSET 3 (which is OFFSET 7)
Person.where(["user_name = :u", { u: user_name }]).fifth
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 224
def fifth find_nth(4, offset_index) end
#fifth!
Same as #fifth but raises RecordNotFound if no record is found.
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 230
def fifth! find_nth! 4 end
#find(*args)
Find by id - This can either be a specific id (1), a list of ids (1, 5, 6), or an array of ids ([5, 6, 10]). If no record can be found for all of the listed ids, then RecordNotFound will be raised. If the primary key is an integer, find by id coerces its arguments using to_i
.
Person.find(1) # returns the object for ID = 1
Person.find("1") # returns the object for ID = 1
Person.find("31-sarah") # returns the object for ID = 31
Person.find(1, 2, 6) # returns an array for objects with IDs in (1, 2, 6)
Person.find([7, 17]) # returns an array for objects with IDs in (7, 17)
Person.find([1]) # returns an array for the object with ID = 1
Person.where("administrator = 1").order("created_on DESC").find(1)
RecordNotFound will be raised if one or more ids are not found.
NOTE: The returned records may not be in the same order as the ids you provide since database rows are unordered. You'd need to provide an explicit order
option if you want the results are sorted.
Find with lock
Example for find with a lock: Imagine two concurrent transactions: each will read person.visits == 2
, add 1 to it, and save, resulting in two saves of person.visits = 3
. By locking the row, the second transaction has to wait until the first is finished; we get the expected person.visits == 4
.
Person.transaction do
person = Person.lock(true).find(1)
person.visits += 1
person.save!
end
Variations of find
Person.where(name: 'Spartacus', rating: 4)
# returns a chainable list (which can be empty).
Person.find_by(name: 'Spartacus', rating: 4)
# returns the first item or nil.
Person.where(name: 'Spartacus', rating: 4).first_or_initialize
# returns the first item or returns a new instance (requires you call .save to persist against the database).
Person.where(name: 'Spartacus', rating: 4).first_or_create
# returns the first item or creates it and returns it, available since Rails 3.2.1.
Alternatives for find
Person.where(name: 'Spartacus', rating: 4).exists?(conditions = :none)
# returns a boolean indicating if any record with the given conditions exist.
Person.where(name: 'Spartacus', rating: 4).select("field1, field2, field3")
# returns a chainable list of instances with only the mentioned fields.
Person.where(name: 'Spartacus', rating: 4).ids
# returns an Array of ids, available since Rails 3.2.1.
Person.where(name: 'Spartacus', rating: 4).pluck(:field1, :field2)
# returns an Array of the required fields, available since Rails 3.1.
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 67
def find(*args) if block_given? to_a.find(*args) { |*block_args| yield(*block_args) } else find_with_ids(*args) end end
#find_by(*args)
Finds the first record matching the specified conditions. There is no implied ordering so if order matters, you should specify it yourself.
If no record is found, returns nil
.
Post.find_by name: 'Spartacus', rating: 4
Post.find_by "published_at < ?", 2.weeks.ago
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 83
def find_by(*args) where(*args).take rescue RangeError nil end
#find_by!(*args)
Like #find_by, except that if no record is found, raises an RecordNotFound error.
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 91
def find_by!(*args) where(*args).take! rescue RangeError raise RecordNotFound, "Couldn't find<EMAIL_ADDRESS>with an out of range value" end
#first(limit = nil)
Find the first record (or first N records if a parameter is supplied). If no order is defined it will order by primary key.
Person.first # returns the first object fetched by SELECT * FROM people ORDER BY people.id LIMIT 1
Person.where(["user_name = ?", user_name]).first
Person.where(["user_name = :u", { u: user_name }]).first
Person.order("created_on DESC").offset(5).first
Person.first(3) # returns the first three objects fetched by SELECT * FROM people ORDER BY people.id LIMIT 3
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 123
def first(limit = nil) if limit find_nth_with_limit(offset_index, limit) else find_nth(0, offset_index) end end
#first!
Same as #first but raises RecordNotFound if no record is found. Note that first!
accepts no arguments.
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 133
def first! find_nth! 0 end
#forty_two
Find the forty-second record. Also known as accessing “the reddit”. If no order is defined it will order by primary key.
Person.forty_two # returns the forty-second object fetched by SELECT * FROM people
Person.offset(3).forty_two # returns the forty-second object from OFFSET 3 (which is OFFSET 44)
Person.where(["user_name = :u", { u: user_name }]).forty_two
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 240
def forty_two find_nth(41, offset_index) end
#forty_two!
Same as #forty_two but raises RecordNotFound if no record is found.
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 246
def forty_two! find_nth! 41 end
#fourth
Find the fourth record. If no order is defined it will order by primary key.
Person.fourth # returns the fourth object fetched by SELECT * FROM people
Person.offset(3).fourth # returns the fourth object from OFFSET 3 (which is OFFSET 6)
Person.where(["user_name = :u", { u: user_name }]).fourth
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 208
def fourth find_nth(3, offset_index) end
#fourth!
Same as #fourth but raises RecordNotFound if no record is found.
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 214
def fourth! find_nth! 3 end
#last(limit = nil)
Find the last record (or last N records if a parameter is supplied). If no order is defined it will order by primary key.
Person.last # returns the last object fetched by SELECT * FROM people
Person.where(["user_name = ?", user_name]).last
Person.order("created_on DESC").offset(5).last
Person.last(3) # returns the last three objects fetched by SELECT * FROM people.
Take note that in that last case, the results are sorted in ascending order:
[#<Person id:2>, #<Person id:3>, #<Person id:4>]
and not:
[#<Person id:4>, #<Person id:3>, #<Person id:2>]
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 152
def last(limit = nil) if limit if order_values.empty? && primary_key order(arel_table[primary_key].desc).limit(limit).reverse else to_a.last(limit) end else find_last end end
#last!
Same as #last but raises RecordNotFound if no record is found. Note that last!
accepts no arguments.
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 166
def last! last or raise RecordNotFound.new("Couldn't find<EMAIL_ADDRESS>with [#{arel.where_sql}]") end
#second
Find the second record. If no order is defined it will order by primary key.
Person.second # returns the second object fetched by SELECT * FROM people
Person.offset(3).second # returns the second object from OFFSET 3 (which is OFFSET 4)
Person.where(["user_name = :u", { u: user_name }]).second
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 176
def second find_nth(1, offset_index) end
#second!
Same as #second but raises RecordNotFound if no record is found.
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 182
def second! find_nth! 1 end
#take(limit = nil)
Gives a record (or N records if a parameter is supplied) without any implied order. The order will depend on the database implementation. If an order is supplied it will be respected.
Person.take # returns an object fetched by SELECT * FROM people LIMIT 1
Person.take(5) # returns 5 objects fetched by SELECT * FROM people LIMIT 5
Person.where(["name LIKE '%?'", name]).take
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 104
def take(limit = nil) limit ? limit(limit).to_a : find_take end
#take!
Same as #take but raises RecordNotFound if no record is found. Note that take!
accepts no arguments.
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 110
def take! take or raise RecordNotFound.new("Couldn't find<EMAIL_ADDRESS>with [#{arel.where_sql}]") end
#third
Find the third record. If no order is defined it will order by primary key.
Person.third # returns the third object fetched by SELECT * FROM people
Person.offset(3).third # returns the third object from OFFSET 3 (which is OFFSET 5)
Person.where(["user_name = :u", { u: user_name }]).third
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 192
def third find_nth(2, offset_index) end
#third!
Same as #third but raises RecordNotFound if no record is found.
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 198
def third! find_nth! 2 end


---
layout: page
title: Travel
---
"To travel is to discover that everyone is wrong about
other countries" - Aldous Huxley
"The world is a book and those who do not travel read
only one page." - Augustine of Hippo
I am fortunate to have traveled to some amazing places,
but the world is so very very big and fascinating. One
lifetime is far too short to fully absorb the humanity, culture,
and natural beauty of our planet...but I intend to give it my
best shot.
Recently I wrote about
Croatia. I also posted some of
my amateur travel videos.
In no apparent order, here are some of the wonderful places I have
visited.
{% include image.html img="images/istanbul1.JPG" title="Istanbul Mosque1" width="75%" caption="Istanbul, Turkey" %}
{% include image.html img="images/angkor2.jpg" title="Ta Prohm" width="75%" caption="Angkor, Cambodia" %}
{% include image.html img="images/santorini3.JPG" title="Santorini wine" width="75%" caption="Santorini, Greece" %}
{% include image.html img="images/florence2.jpg" title="Florence Duomo" width="75%" caption="Florence, Italy" %}
{% include image.html img="images/angkor3.jpg" title="Ta Prohm" width="75%" caption="Angkor, Cambodia" %}
{% include image.html img="images/london1.jpg" title="Big Ben view" width="75%" caption="London, UK" %}
{% include image.html img="images/moscow1.jpg" title="Moscow1" width="75%" caption="Moscow, Russia" %}
{% include image.html img="images/mostar1.jpg" title="Mostar" width="75%" caption="Mostar, Bosnia and Herzegovina" %}
{% include image.html img="images/moscow4.jpg" title="Moscow4" width="75%" caption="Moscow, Russia" %}
{% include image.html img="images/vienna1.jpg" title="Vienna" width="75%" caption="Vienna, Austria" %}
{% include image.html img="images/paris3.jpg" title="Saint Chapelle" width="75%" caption="Paris, France" %}
{% include image.html img="images/bangkok1.jpg" title="Bangkok rooftop" width="95%" caption="Bangkok, Thailand" %}
{% include image.html img="images/czech1.jpg" title="Czech countryside" width="75%" caption="countryside, Czech Republic" %}
{% include image.html img="images/bologna1.jpg" title="Bologna" width="75%" caption="Bologna, Italy" %}
{% include image.html img="images/amsterdam1.jpg" title="Amsterdam grand canal" width="75%" caption="Amsterdam, Netherlands" %}
{% include image.html img="images/brussels1.jpg" title="Brussels" width="75%" caption="Brussels, Belgium" %}
{% include image.html img="images/istanbul3.JPG" title="Istanbul Mosque2" width="75%" caption="Istanbul, Turkey" %}
{% include image.html img="images/mexico2.JPG" title="Mexico2" width="75%" caption="San Carlos, Mexico" %}
{% include image.html img="images/england1.jpg" title="Salisbury Cathedral" width="75%" caption="Salisbury, UK" %}
{% include image.html img="images/rome1.jpg" title="Piazza Navona" width="75%" caption="Rome, Italy" %}
{% include image.html img="images/france3.JPG" title="Rouen Cathedral" width="75%" caption="Rouen, France" %}
{% include image.html img="images/prague3.jpg" title="Prague3" width="75%" caption="Prague, Czech Republic" %}
{% include image.html img="images/prague6.jpg" title="Prague night" width="75%" caption="Prague, Czech Republic" %}
{% include image.html img="images/montmichel1.jpg" title="MontMichel1" width="75%" caption="Mont St. Michel, France" %}
{% include image.html img="images/bruges1.jpg" title="Bruges1" width="75%" caption="Bruges, Belgium" %}
{% include image.html img="images/athens1.jpg" title="Athens1" width="75%" caption="Athens, Greece" %}
{% include image.html img="images/montmichel2.jpg" title="MontMichel2" width="75%" caption="Mont St. Michel, France" %}
{% include image.html img="images/budapest2.JPG" title="Budapest" width="75%" caption="Budapest, Hungary" %}
{% include image.html img="images/stpete2.jpg" title="StPete" width="75%" caption="St. Petersburg, Russia" %}
{% include image.html img="images/kotor.jpg" title="Kotor" width="75%" caption="Kotor, Montenegro" %}
{% include image.html img="images/kutnahora1.jpg" title="Bone church 1" width="75%" caption="Kutna Hora, Czech Republic" %}
{% include image.html img="images/perast.JPG" title="Perast" width="75%" caption="Perast, Montenegro" %}
{% include image.html img="images/kutnahora2.jpg" title="Bone church 2" width="75%" caption="Kutna Hora, Czech Republic" %}
{% include image.html img="images/dubrovnik1.jpg" title="Dubrovnik night lights" width="75%" caption="Dubrovnik, Croatia" %}
{% include image.html img="images/sarajevo1.jpg" title="Sarajevo view" width="95%" caption="Sarajevo, Bosnia and Herzegovina" %}
{% include image.html img="images/strasbourg1.jpg" title="Strasbourg" width="75%" caption="Strasbourg, France" %}
{% include image.html img="images/dubrovnik2.jpg" title="Dubrovnik from above" width="75%" caption="Dubrovnik, Croatia" %}
{% include image.html img="images/bosnia1.jpg" title="Bosnia country" width="75%" caption="countryside, Bosnia and Herzegovina" %}
{% include image.html img="images/france2.jpg" title="Normandy" width="75%" caption="Normandy landing beach, France" %}
{% include image.html img="images/novgorod1.jpg" title="Novgorod Statue" width="50%" caption="Veliky Novgorod, Russia" %}


HIGH SCHOOL 2011–2012
Studio Art I
This course is based on the precept that drawing is the foundation on which all forms of visual communication are built. Students begin with a comprehensive introduction to the basic vocabulary of drawing. From this foundation, students are exposed to a variety of artistic processes including printmaking and painting. Here, the students learn basic theories of color mixing and relationships for both monochromatic and polychromatic color. By firmly grounding the visual arts in academic methods, the students will develop the skills needed to produce a robust range of artwork.
Studio Art II
Continuing the precept that drawing is the foundation of visual communication, this course builds on and refines the basic vocabulary of drawing. Students will work with more complex forms, including natural objects and drapery. New color palettes will be introduced as well as multilayer linocut, woodcut and silkscreen printmaking techniques.
Studio Art III: Painting
Students study the fundamental techniques of observational painting through a series of in-class exercises, lectures and critiques. Emphasis is placed on the perception of edges, negative space, and color. We prepare canvasses, mix paint, and learn to set up palettes. Subjects include still life, landscape, portraiture, and architecture.
Studio Art IV: Portfolio
This course is designed for students who are interested in a serious creative expression in art. By the end of this course, students will be prepared to submit a portfolio for the Advanced Placement Studio Art examination. This test is not based on a written examination; instead, students submit a portfolio consisting of 24 art works for evaluation by the College Board at the end of the school year. This exam requires that the student show a fundamental competence in and range of understanding of visual concerns and methods. All work submitted must be completed in the preceding school year.
|
|


By default, Rails 2 employs protection against CSRF attacks.
What it comes down to is sending an authenticity token (unique per session) along with all non-GET requests as well as all Ajax requests.
I prefer jQuery to Prototype, the JavaScript library that ships with Rails. This is how I made jQuery automagically send the authenticity token along with all Ajax requests.
In my application layout, I stick an authenticity token in a JavaScript variable in the page header:
1
|
|
Then in my application.js
file:
1 2 3 4 5 6 |
|
ajaxSend
is a global event that is broadcast before every Ajax request. This code adds a handler for that event, that in turn adds the authenticity token to the request data.
This solution was inspired by some code by “Andreas” in an “Err the Blog” comment. Note that if you use $.ajaxSetup({data: …})
, though, you only set default data, that is overwritten if the Ajax request has data of its own. My solution effectively merges the authenticity token into whatever other data is in the request.


In Ripple the goal is to provide as much useful information as possible.
This pane gives you a view of what device your are emulating, what platform you’re on, as well as notes that are of interest for the emulated environment.


Cordova localstorage test
Exit
storage available:
content
Persistent Storage
persistent content
set
get
Session Storage
session content
tempset
tempget
Records
Created by Jesus Monroy, Jr. © 2015


Lambo V12 Vision Gran Turismo Unveiled As 'The Best Virtual Car Ever'
Available for PS4 from next spring.
by Anthony KarrTranslated by: Anthony Karr
At the 2019 world finals of the FIA-Certified Gran Turismo Championship in Monte Carlo, Lamborghini unveiled the V12 Vision Gran Turismo concept that was teased earlier this week. The prototype displayed there is, in fact, an actual single-seater, which will be available for gamers to drive in Gran Turismo Sport for PlayStation 4 from the spring of next year.
Gallery: Lamborghini V12 Vision Gran Turismo
As with most previous Vision Gran Turismo concepts from manufacturers like Jaguar, Bugatti, Hyundai, Zagato, and many more, the design of Lambo’s latest hypercar can be best described as super dramatic. It’s actually very difficult to say which exterior component acts as a roof and which one is the door but, at the same time, it somehow manages to look harmonic and is not too busy on the eye. Mitja Borkert, director of Lamborghini’s design center, explains more:
“The Lambo V12 Vision Gran Turismo was designed to be the best virtual car ever for all the young gamers and fans who love our brand. It is an opportunity for the genius and talent of our designers to fully express themselves and imagine a car that is not only fascinating and incredible to drive, but also reflects the design center’s commitment to developing innovative technologies, especially in the field of light materials and hybridization."
More Vision GT Concepts:
Speaking of hybridization, the V12 Vision Gran Turismo uses the same electrified powertrain that powers the Sian. The Italian company is not revealing more tech details about its latest creation but most of you can probably recall the Sian has a 6.5-liter V12 naturally aspirated engine accompanied by a 48-volt mild-hybrid system for a grand total of 819 horsepower (602 kilowatts). Lambo’s first-ever hybrid sprints from 0 to 62 miles per hour (0-100 kilometers per hour) in just 2.8 seconds and the top speed is electronically governed at 217 mph (350 kph).
As far as the new concept’s dynamic capabilities are concerned, we’ll have to wait until the car debuts for the Gran Turismo Sport to know more.
Source: Lamborghini


--- layout: post title: Everybody Shout "Spotify"! date: '2013-03-19T11:37:57+01:00' tags: - spotify - linux - macos - windows - streaming tumblr_url: http://aladac.tumblr.com/post/45758932218/everybody-shout-spotify ---
Okay, so you’ve got your Spotify premium account and are in a situation where a device able to play music better than your mobile, tablet or laptop is present. Sadly, the device neither has a Spotify client, nor uPnP media player or AirPlay capabilities…
While wondering how to play music from my laptop on a Linux MPD server that serves as a jukebox I came to one simple conclusion. Stream the music.
I started a NetRadio and broadcasted the Stereo Mix
from my laptop to the MPD. Voila.
This way you can play Spotify on a device that lacks native Spotify support, but can play Internet Radio.


Upgrade time
We're working on stuff!
I'm Everyone is down momentarily while we push some new features. Please come back soon - thanks for your custom.
I'm Everyone staff.
Upgrade time
I'm Everyone is down momentarily while we push some new features. Please come back soon - thanks for your custom.
I'm Everyone staff.


PIG DICE
Play Game
Player1
0
Dice roll:
Turn score:
New Game
Player2
0
Dice roll:
Turn score:
Roll
Hold
Game
(current)
Rules


Task of the day:
Create the front end of an application.
 You can CRUD the recipes.
! No user authentication & design is up to you


I am a Computer Science(Bachelor of Engineering) graduate of Thapar Institute of Engineering and Technology. I am passionate about programming and my aim is to achieve excellence in the field of Computer Science. I am particularly interested in the field of Machine Learning & Data Science and I hope to make valuable contributions to these fields in the future.
Iris dataset divides the flower in three classes namely Setosa, Versicolor, Virginica based on four attributes namely Sepal Length, Sepal Width, Petal Length, Petal Width. The given dataset was shuffled randomly and divided into train-test datasets with 75-25 ratio. 10 different classifiers were executed and the results were then combined and using ensembling techniques combination of different models were run on the dataset. The accuracy of predicting the new data point came out to be nearly 97%.
In this project a python script and selenium webdriver was used to automate Google Chrome. By writing the required code in python which makes use of selenium web driver the details in login page of LinkedIn are automatically filled as provided by the user and after the user has logged in connection requests are send to the people in the specified field(for example Python Developers) by the user.
A video player made using Qt IDE for playing small files supporting mp3,mp4,avi formats. QMediaPlayer Library in Qt was used to make the features like play, pause, stop, etc and their associated actions. A slider bar or progress bar was also incorporated in this media player.
A fully functional notepad like text editor was made using Qt IDE. The functions for basic features like open, open recent, save, save as, etc. were implemented using trigger action mechanism of the Qt IDE. The rest of the functions which were not available in Qt libraries were implemented in C++ in accordance with the documentation provided with the Qt working environment.
Currently working as a BIC developer for HSBC Connect Digital.
Created a Jupyter notebook that did the same pre-processing and manipulation of the data that was being done using macros in Excel.
Wrote Python scripts that were used to pre-process data which was later used by Tableau templates for report generation.
Created Tableau templates for product engagement reports which will automatically apply filters and generate the updated report for the day that otherwise was dealt by creating a macro in Excel.
 In the recent months, I have been actively taking part in societies, organising a variety of programming contests and helping a person who is having any doubts regarding my field.
When I am indoors, I follow a number of sci-fi and fantasy genre movies and television shows, I am a tech enthusiast, and I spend a large amount of my free time exploring the latest technology advancements in the tech world by following various tech channels like Dave2D, Unbox Therapy, MKBHD, Jonathan Morrison,etc. on youtube.


interface RequestConnectionPoint
Represents request address information is used to make a call. There are at least two possible instances: "local" is how we see request at the server application and "actual" is what we can recover from proxy provided headers.
abstract val host: String
Request host, useful for virtual hosts routing |
|
abstract val method: HttpMethod
Request HTTP method |
|
abstract val port: Int
Request port, for example 80 or 443 |
|
abstract val remoteHost: String
Client address or host name (generally not resolved to name for performance reasons). For io.ktor.application.ApplicationRequest.local instance could point to a proxy our application running behind. NEVER use it for user authentication as it can be easily falsified (user can simply set some HTTP headers such as X-Forwarded-Host so you should NEVER rely on it in any security checks. If you are going to use it to create a back-connection please do it with care as an offender can easily use it to force you to connect to some host that is not intended to be connected to so that may cause serious consequences. |
|
abstract val scheme: String
Request scheme, for example "http" or "https" |
|
abstract val uri: String
URI path with no host, port and no schema specification, but possibly with query |
|
abstract val version: String
Protocol version string |


--- layout: post title: The Halfway Mark date: 2012-04-26 19:04:14.000000000 -04:00 type: post published: true status: publish categories: - college - writing tags: [] meta: _edit_last: '1' author: login: sophie email<EMAIL_ADDRESS>display_name: Pika first_name: '' last_name: '' ---
Voila my first Op-Ed for the Columbia Daily Spectator!
A reflection on the midpoint of my time at Columbia--how does campus culture shape our worldview (for better or for worse)?


|
The Natural Helmholtz-Hodge Decomposition
|
#include <HHD.h>
Public Member Functions | |
| ~naturalHHD () | |
| Destructor. More... | |
| naturalHHD (const VectorField< T > &vfield, const RGrid &rgrid, unsigned int COMPUTE_TYPE=1) | |
| Initialize the naturalHHD. More... | |
Public Attributes | |
| T * | D |
| T * | Ru |
| T * | Rv |
| T * | Rw |
Private Member Functions | |
| void | compute_2D (const T *fd, const T *fr, const RGrid &rgrid) |
| Compute 2D potentials. More... | |
| void | compute_3D (const T *fd, const T *fru, const T *frv, const T *frw, const RGrid &rgrid) |
| Compute 3D potentials. More... | |
HHD.h Library for computing the potential functions for the natural HHD.
|
inline |
Destructor.
|
inline |
Initialize the naturalHHD.
Create Green's function for a 2D or 3D regular grid.
| vfield | Vector field. |
| rgrid | Reference to the regular grid. |
| COMPUTE_TYPE | 1 (compute all potentials in a single loop), 2 (compute all potentials in separate loops), 3 (compute all potentials in separate loops using Greens function map) |
|
inlineprivate |
Compute 2D potentials.
| fd | Divergence of the vector field. |
| fr | Rotation of the vector field. |
| rgrid | Regular grid. |
|
inlineprivate |
Compute 3D potentials.
| fd | Divergence of the vector field. |
| fr | Rotation of the vector field. |
| rgrid | Regular grid. |
| T* naturalHHD< T >::D |
Divegence potential
| T* naturalHHD< T >::Ru |
u-component of Rotation potential
| T* naturalHHD< T >::Rv |
v-component of Rotation potential
| T* naturalHHD< T >::Rw |
w-component of Rotation potential


Chapter 2 : Crash course in Nock
So let's learn Nock! But wait - why learn Nock? After all, we're going to be programming in Hoon, not Nock.
Like JVM bytecode, Nock is as inscrutable as assembly language. In fact, you can think of it as a sort of "functional assembly language." There are sometimes reasons to program in real assembly language. There is never a reason to program in Nock. Except to learn Nock.
Indeed, it is not necessary for the Hoon programmer to learn Nock. We recommend it strongly, however, because Hoon has a very special relationship with Nock - not unlike the relationship between C and assembly language.
Just as C is a very shallow layer over the raw CPU, Hoon is a very shallow layer over raw Nock - often little more than a macro. If you try to learn C without understanding the CPU under it, you will be forever bemused by why it works the way it does.
So let's learn Nock! But wait - which Nock? Nock, though more frozen than Walt Disney, does have versions. Nock versions are measured by integer degrees Kelvin, newer being colder. The newest, Nock 5K - roughly the temperature of Neptune. No change is anticipated between 5K and absolute zero, though you never know. Any such change would certainly be quite painful.
1.1 Definition
The best way to learn Nock is to read the spec and write your own naive interpreter. Here is Nock 5K:
1. Structures
A noun is an atom or a cell. An atom is a natural number.
A cell is an ordered pair of nouns.
2. Pseudocode
1 :: nock(a) *a
2 :: [a b c] [a [b c]]
3 ::
4 :: ?[a b] 0
5 :: ?a 1
6 :: +[a b] +[a b]
7 :: +a 1 + a
8 :: =[a a] 0
9 :: =[a b] 1
10 :: =a =a
11 ::
12 :: /[1 a] a
13 :: /[2 [a b]] a
14 :: /[3 [a b]] b
15 :: /[(a + a) b] /[2 /[a b]]
16 :: /[(a + a + 1) b] /[3 /[a b]]
17 :: /a /a
18 ::
19 :: *[a [[b c] d]] [*[a [b c]] *[a d]]
20 ::
21 :: *[a [0 b]] /[b a]
22 :: *[a [1 b]] b
23 :: *[a [2 [b c]]] *[*[a b] *[a c]]
24 :: *[a [3 b]] ?*[a b]
25 :: *[a [4 b]] +*[a b]
26 :: *[a [5 b]] =*[a b]
27 ::
28 :: *[a [6 [b [c d]]]] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
29 :: *[a [7 [b c]]] *[a 2 b 1 c]
30 :: *[a [8 [b c]]] *[a 7 [[7 [0 1] b] 0 1] c]
31 :: *[a [9 [b c]]] *[a 7 c 2 [0 1] 0 b]
32 :: *[a [10 [[b c] d]]] *[a 8 c 7 [0 3] d]
33 :: *[a [10 [b c]]] *[a c]
34 ::
35 :: *a *a
Your interpreter should be no more than a page of code in
any language. For extra credit, 6
-10
are macros; implement
them directly. For extra extra credit, optimize tail calls.
To test your code, write a decrement formula b such that
*[a b]
is a - 1
for any atomic nonzero a
.
1.2 Installation
The second best way to learn Nock is to boot up your own Arvo virtual computer. See the Arvo tutorial for instructions.
1.3 Nock
To make Nock make sense, let's work through Nock 5K line by line. First the data model:
1. Structures
A noun is an atom or a cell. An atom is any natural number.
A cell is any ordered pair of nouns.
 Nouns make JSON look like XML and XML look like ASN.1. It may also remind you of Lisp's S-expressions - you can think of nouns as "S-expressions without the S."
To be exact, a noun is an S-expression, except that classic S-expressions have multiple atom types ("S" is for "symbol"). Since Nock is designed to be used with a higher-level type system (such as Hoon's), it does not need low-level types. An atom is just an unsigned integer of any size.
For instance, it's common to represent strings (or even whole
text files) as atoms, arranging them LSB first - so "foo" becomes
0x6f6f66
. How do we know to print this as "foo", not 0x6f6f66
?
We need external information - such as a Hoon type. Similarly,
other common atomic types - signed integers, floating point, etc
- are all straightforward to map into atoms.
It's also important to note that, unlike Lisp, Nock cannot create
cyclical data structures. It is normal and common for nouns in a
Nock runtime system to have acyclic structure - shared subtrees.
But there is no Nock computation that can make a child point to
its parent.
(Nor can dag structure be detected, as with Lisp eq
.)
There is also no single syntax for nouns. If you have nouns you have Nock; if you have Nock you have Hoon; if you have Hoon, you can write whatever parser you like.
Let's continue:
2. Pseudocode
It's important to recognize that the pseudocode of the Nock spec is just that: pseudocode. It looks a little like Hoon. It isn't Hoon - it's just pseudocode. Or in other words, just English. At the bottom of every formal system is a system of axioms, which can only be written in English. (Why pseudocode, not Hoon?
The logic of this pseudocode is a pattern-matching reduction, matching from the top down. To compute Nock, repeatedly reduce with the first line that matches. Let's jump right in!
Line 1:
1 :: nock(a) *a
Nock is a pure (stateless) function from noun to noun. In our
pseudocode (and only in our pseudocode) we express this with the
prefix operator *
.
This function is defined for every noun, but on many nouns it
does nothing useful. For instance, if a
is an atom, *a
reduces to... *a
. In theory, this means that Nock spins
forever in an infinite loop. In other words, Nock produces no
result - and in practice, your interpreter will stop.
(Another way to see this is that Nock has "crash-only" semantics.
There is no exception mechanism. The only way to catch Nock
errors is to simulate Nock in a higher-level virtual Nock -
which, in fact, we do all the time. A simulator (or a practical
low-level interpreter) can report, out of band, that Nock would
not terminate. It cannot recognize all infinite loops, of
course, but it can catch the obvious ones - like *42
.)
Normally a
in nock(a)
is a cell [s f]
, or as we say
[subject formula]
Intuitively, the formula is your function and the subject is
its argument. We call them something different because Hoon,
or any other high-level language built on Nock, will build its
own function calling convention which does not map directly
to *[subject formula]
.
Line 2:
2 :: [a b c] [a [b c]]
Ie, brackets (in our pseudocode, as in Hoon) associate to the right. For those with Lisp experience, it's important to note that Nock and Hoon use tuples or "improper lists" much more heavily than Lisp. The list terminator, normally 0, is never automatic. So the Lisp list
(a b c)
becomes the Nock noun
[a b c 0]
which is equivalent to
[a [b [c 0]]]
Note that we can and do use unnecessary brackets anyway, for emphasis.
Let's move on to the axiomatic functions.
Lines 4-10:
4 :: ?[a b] 0
5 :: ?a 1
6 :: +[a b] +[a b]
7 :: +a 1 + a
8 :: =[a a] 0
9 :: =[a b] 1
Here we define more pseudocode operators, which we'll use in
reductions further down. So far we have four built-in functions:
*
meaning Nock itself, ?
testing whether a noun is a cell or
an atom, +
incrementing an atom, and =
testing for equality.
Again, no rocket science here.
We should note that in Nock and Hoon, 0
(pronounced "yes") is
true, and 1
("no") is false. Why? It's fresh, it's different,
it's new. And it's annoying. And it keeps you on your toes.
And it's also just intuitively right.
Lines 12-16:
12 :: /[1 a] a
13 :: /[2 a b] a
14 :: /[3 a b] b
15 :: /[(a + a) b] /[2 /[a b]]
16 :: /[(a + a + 1) b] /[3 /[a b]]
Slightly more interesting is our tree numbering. Every noun is of course a tree. The /
operator - pronounced
"slot" - imposes an address space on that tree, mapping every
nonzero atom to a tree position.
1 is the root. The head of every node n
is 2n
; the tail is
2n+1
. Thus a simple tree:
1
2 3
4 5 6 7
14 15
If the value of every leaf is its tree address, this tree is
[[4 5] [6 14 15]]
and, for some examples of addressing:
/[1 [[4 5] [6 14 15]]]
is [[4 5] [6 14 15]]
/[2 [[4 5] [6 14 15]]]
is [4 5]
/[3 [[4 5] [6 14 15]]]
is [6 14 15]
, and
/[7 [[4 5] [6 14 15]]]
is [14 15]
I do hope this isn't so terribly hard to follow.
Line 21:
Now we enter the definition of Nock itself - ie, the *
operator.
21 :: *[a 0 b] /[b a]
0
is simply Nock's tree-addressing operator. Let's try it out
from the Arvo command line.
Note that we're using Hoon syntax here. Since we do not use Nock
from Hoon all that often (it's sort of like embedding assembly in
C), we've left it a little cumbersome. In Hoon, instead of
writing *[a 0 b]
, we write
.*(a [0 b])
So, to reuse our slot example, let's try the interpreter:
~tasfyn-partyv> .*([[4 5] [6 14 15]] [0 7])
gives, while the sky remains blue and the sun rises in the east:
[14 15]
Even stupider is line 21:
Line 21:
21 :: *[a 1 b] b
1
is the constant operator. It produces its argument without
reference to the subject. So
~tasfyn-partyv> .*(42 [1 153 218])
yields
[153 218]
Line 23:
23 :: *[a 2 b c] *[*[a b] *[a c]]
Line 22 brings us the essential magic of recursion.
2
is the Nock operator. If you can compute a subject and a
formula, you can evaluate them in the interpreter. In most
fundamental languages, like Lisp, eval
is a curiosity. But
Nock has no apply
- so all our work gets done with 2
.
 Hence:
~tasfyn-partyv> .*(57 [0 1])
57
and
~tasfyn-partyv> .*([132 19] [0 3])
19
and
~tasfyn-partyv> .*(57 [4 0 1])
58
and
~tasfyn-partyv> .*([132 19] [4 0 3])
20
If this seems obvious, you're doin' good. Finally, we jump back up to line 18, the trickiest in the spec:
Line 19:
19 :: *[a [b c] d] [*[a b c] *[a d]]
Um, what?
Since Nock of an atom just crashes, the practical domain of the Nock function is always a cell. Conventionally, the head of this cell is the "subject," the tail is the "formula," and the result of Nocking it is the "product." Basically, the subject is your data and the formula is your code.
We could write line 19 less formally:
*[subject [formula-x formula-y]]
=> [*[subject formula-x] *[subject formula-y]]
In other words, if you have two Nock formulas x
and y
, a
formula that computes the pair of them is just [x y]
. We can
recognize this because no atom is a valid formula, and
every formula that does not use line 19 has an atomic head.
If you know Lisp, you can think of this feature as a sort of
"implicit cons." Where in Lisp you would write (cons x y)
,
in Nock you write [x y]
.
For example,
~tasfyn-partyv> .*(42 [4 0 1])
where 42
is the subject (data) and [4 0 1]
is the formula
(code), happens to evaluate to 43
. Whereas
~tasfyn-partyv> .*(42 [3 0 1])
is 1
. So if we evaluate
~tasfyn-partyv> .*(42 [[4 0 1] [3 0 1]])
we get
[43 1]
Except for the crash defaults (lines 6, 10, 17, and 35), we've actually completed all the essential aspects of Nock. The operators up through 5 provide all necessary computational functionality. Nock, though very simple, is actually much more complex than it formally needs to be.
Operators 6 through 10 are macros. They exist because Nock is not a toy, but a practical interpreter. Let's see them all together:
Lines 28-33:
28 :: *[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
29 :: *[a 7 b c] *[a 2 b 1 c]
30 :: *[a 8 b c] *[a 7 [[7 [0 1] b] 0 1] c]
31 :: *[a 9 b c] *[a 7 c 2 [0 1] 0 b]
32 :: *[a 10 [b c] d] *[a 8 c 7 [0 3] d]
33 :: *[a 10 b c] *[a c]
Whoa! Have we entered rocket-science territory? Let's try to figure out what these strange formulas do - simplest first. The simplest is clearly line 33:
33 :: *[a 10 b c] *[a c]
If x
is an atom and y
is a formula, the formula [10 x y]
appears to be equivalent to... y
. For instance:
~tasfyn-partyv> .*([132 19] [10 37 [4 0 3]])
20
Why would we want to do this? 10
is actually a hint operator.
The 37
in this example is discarded information - it is not
used, formally, in the computation. It may help the interpreter
compute the expression more efficiently, however.
Every Nock computes the same result - but not all at the same speed. What hints are supported? What do they do? Hints are a higher-level convention which do not, and should not, appear in the Nock spec. Some are defined in Hoon. Indeed, a naive Nock interpreter not optimized for Hoon will run Hoon quite poorly. When it gets the product, however, the product will be right.
There is another reduction for hints - line 32:
32 :: *[a 10 [b c] d] *[a 8 c 7 [0 3] d]
Once we see what 7
and 8
do, we'll see that this complex hint
throws away an arbitrary b
, but computes the formula c
against the subject and... throws away the product. This formula
is simply equivalent to d
. Of course, in practice the product
of c
will be put to some sordid and useful use. It could even
wind up as a side effect, though we try not to get that sordid.
(Why do we even care that c
is computed? Because c
could
crash. A correct Nock cannot simply ignore it, and treat both
variants of 10
as equivalent.)
We move on to the next simplest operator, 7
. Line 29:
29 :: *[a 7 b c] *[a 2 b 1 c]
Suppose we have two formulas, b
and c
. What is the formula
[7 b c]
? This example will show you:
~tasfyn-partyv> .*(42 [7 [4 0 1] [4 0 1]])
44
7
is an old mathematical friend, function composition. It's
easy to see how this is built out of 2
. The data to evaluate
is simply b
, and the formula is c
quoted.
Line 30 looks very similar:
30 :: *[a 8 b c] *[a 7 [[7 [0 1] b] 0 1] c]
Indeed, 8
is 7
, except that the subject for c
is not simply
the product of b
, but the ordered pair of the product of b
and the original subject. Hence:
~tasfyn-partyv> .*(42 [8 [4 0 1] [0 1]])
[43 42]
and
~tasfyn-partyv> .*(42 [8 [4 0 1] [4 0 3]])
43
Why would we want to do this? Imagine a higher-level language
in which the programmer declares a variable. This language is
likely to generate an 8
, because the variable is computed
against the present subject, and used in a calculation which
depends both on the original subject and the new variable.
For extra credit, explain why we can't just define
*[a 8 b c] *[a 7 [b 0 1] c]
Another simple macro is line 31:
31 :: *[a 9 b c] *[a 7 c 2 [0 1] 0 b]
9
is a calling convention. With c
, we produce a noun which
contains both code and data - a core. We use this core as the
subject, and apply the formula within it at slot b
.
And finally, we come to the piece de resistance - line 28:
28 :: *[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
Great giblets! WTF is this doing? It seems we've finally arrived at some real rocket science.
Actually, 6
is a primitive known to every programmer - good old
"if." If b
evaluates to 0
, we produce c
; if b
evaluates
to 1
, we produce d
; otherwise, we crash.
For instance:
~tasfyn-partyv> .*(42 [6 [1 0] [4 0 1] [1 233]])
43
and
~tasfyn-partyv> .*(42 [6 [1 1] [4 0 1] [1 233]])
233
In real life, of course, the Nock implementor knows that 6
is
"if" and implements it as such. There is no practical sense in
reducing through this macro, or any of the others. We could have
defined "if" as a built-in function, like increment - except that
we can write "if" as a macro. If a funky macro.
It's a good exercise, however, to peek inside the funk.
We can actually simplify the semantics of 6
, at the expense of
breaking the system a little, by creating a macro that works as
"if" only if b
is a proper boolean and produces 0
or 1
.
Perhaps we have a higher-level type system which checks this.
This simpler "if" would be:
*[a 6 b c d] *[a [2 [0 1] [2 [1 c d] [[1 0] [4 4 b]]]]]
Or without so many unnecessary brackets:
*[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] [4 4 b]]
How does this work? We've replaced [6 b c d]
with the formula
[2 [0 1] [2 [1 c d] [[1 0] [4 4 b]]]]
. We see two uses of 2
,
our evaluation operator - an outer and an inner.
Call the inner one i
. So we have [2 [0 1] i]
. Which means
that, to calculate our product, we use [0 1]
- that is, the
original subject - as the subject; and the product of i
as
the formula.
Okay, cool. So i
is [2 [1 c d] [[1 0] [4 4 b]]]
. We compute
Nock with subject [1 c d]
, formula [[1 0] [4 4 b]]
.
Obviously, [1 c d]
produces just [c d]
- that is, the ordered
pair of the "then" and "else" formulas. [[1 0] [4 4 b]]
is a
line 19 cell - its head is [1 0]
, producing just 0
, its tail
[4 4 b]
, producing... what? Well, if [4 b]
is b
plus 1
,
[4 4 b]
is b
plus 2
.
We're assuming that b
produces either 0
or 1
. So [4 4 b]
yields either 2
or 3
. [[1 0] [4 4 b]]
is either [0 2]
or
[0 3]
. Applied to the subject [c d]
, this gives us either
c
or d
- the product of our inner evaluation i
. This is
applied to the original subject, and the result is "if."
But we need the full power of the funk, because if b
produces,
say, 7
, all kinds of weirdness will result. We'd really like
6
to just crash if the test product is not a boolean. How can
we accomplish this? This is an excellent way to prove to
yourself that you understand Nock: figure out what the real 6
does. Or you could just agree that 6
is "if," and move on.
(It's worth noting that in practical, compiler-generated Nock, we
never do anything as funky as these 6
macro internals. There's
no reason we couldn't build formulas at runtime, but we have no
reason to and we don't - except when actually metaprogramming.
As in most languages, normally code is code and data is data.)
1.4 Decrement in Nock
A good practice exercise for Nock is a decrement formula. Ie, a
formula f
which implements the partial function that produces
(s - 1)
if s
is a nonzero atom, and otherwise does not
terminate.
The normal Hoon programmer has written one Nock formula: this one. Since decrement uses all the Nock techniques the Hoon compiler uses, the exercise is a good foundation. After you write decrement (or just follow this example), you'll never need to deal with Nock again.
As we know, the equivalent formula for increment is
[4 0 1]
Thus:
~>tasfyn-partyv .*(42 [4 0 1])
43
Of course, increment is built into Nock. So, ha, that's easy.
How do we decrement? A good way to start is to gaze fondly on how we'd do it if we actually had a real language, ie, Hoon. Here is a minimal decrement in Hoon:
=> a=. :: line 1
=+ b=0 :: line 2
|- :: line 3
?: =(a +(b)) :: line 4
b :: line 5
$(b +(b)) :: line 6
Or for fun, on one line:
=>(a=. =+(b=0 |-(?:(=(a +(b)) b $(b +(b))))))
Does Hoon actually work?
~tasfyn-partyv> =>(42 =>(a=. =+(b=0 |-(?:(=(a +(b)) b $(b +(b)))))))
41
Let's translate this into English. How do we decrement the
subject? First (line 1), we rename the subject a
. Second
(line 2), we add a variable, b
, an atom with value 0
.
Third (line 3), we loop. Fourth, we test if a
equals b
plus
1 (line 4), produce b
if it does (line 5), repeat the loop with
b
set to b
plus 1 (line 6) if it doesn't. Obviously, while
the syntax is unusual, the algorithm is anything but deep. We
are calculating b
minus one by counting up from 0
.
(Obviously, this is an O(n) algorithm. Is there a better way? There is not. Do we actually do this in practice? Yes and no.)
Unfortunately we are missing a third of our Rosetta stone. We have decrement in Hoon and we have it in English. How do we express this in Nock? What will the Hoon compiler generate from the code above? Let's work through it line by line.
Nock has no types, variable names, etc. So line 1 is a no-op.
How do we add a variable (line 2)? We compute a new subject, which is a cell of the present subject and the variable. With this new subject, we execute another formula.
Since 0
is a constant, a formula that produces it is
[1 0]
To combine 0
with the subject, we compute
[[1 0] [0 1]]
which, if our subject is 42, gives us
[0 42]
which we can use as the subject for an inner formula, g
.
Composing our new variable with g
, we have f
as
[2 [[1 0] [0 1]] [1 g]]
which seems a little funky for something so simple. But we
can simplify it with the composition macro, 7
:
[7 [[1 0] [0 1]] g]
and still further with the augmentation macro, 8
:
[8 [1 0] g]
If you refer back to the Nock definition, you'll see that all these formulas are semantically equivalent.
Let's continue with our decrement. So what's g
? We seem to
loop. Does Nock have a loop operator? It most certainly does
not. So what do we do?
We build a noun called a core - a construct which is behind any kind of interesting control flow in Hoon. Of course, the Nock programmer is not constrained to use the same techniques as the Hoon compiler, but it is probably a good idea.
In Hoon, all the flow structures from your old life as an Earth programmer become cores. Functions and/or closures are cores, objects are cores modules are cores, even loops are cores.
The core is just a cell whose tail is data (possibly containing other cores) and whose head is code (containing one or more formulas). The tail is the payload and the head is the battery. Hence your core is
[bat pay]
To activate a core, pick a formula out of the battery, and use the entire core (not just the payload) as the subject.
(A core formula is called an arm. An arm is almost like an object-oriented method, but not quite - a method would be an arm that produces a function on an argument. The arm is just a function of the core, ie, a computed attribute.)
Of course, because we feed it the entire core, our arm can invoke itself (or any other formula in the battery). Hence, it can loop. And this is what a loop is - the simplest of cores.
We need to do two things with this core: create it, and activate
it. To be precise, we need two formulas: a formula which
produces the core, and one which activates its subject. We can
compose these functions with the handy 7
operator:
[8 [1 0] [7 p a]]
p
produces our core, a
activates it. Let's take these in
reverse order. How do we activate a core?
Since we have only one formula, it's the battery itself.
Thus we want to execute Nock with the whole core (already the
subject, and the entire battery (slot 2
). Hence, a
is
[2 [0 1] [0 2]]
We could also use the handy 9
macro - which almost seems
designed for firing arms on cores:
[9 2 [0 1]]
Which leaves us seeking
[8 [1 0] [7 p [9 2 0 1]]]
And all we have to do is build the core, p
. How do we build a
core? We add code to the subject, just as we added a variable
above. The initial value of our counter was a constant, 0
.
The initial (and permanent) value of our battery is a constant,
the loop formula l
. So p
is
[8 [1 l] [0 1]]
Which would leave us seeking
[8 [1 0] [7 [8 [1 l] [0 1]] [9 2 0 1]]]
except that we have duplicated the 8
pattern again, since we
know
[7 [8 [1 l] [0 1]] [9 2 0 1]]
is equivalent to
[8 [1 l] [9 2 0 1]]
so the full value of f
is
[8 [1 0] [8 [1 l] [9 2 0 1]]]
Thus our only formula to compose is the loop body, l
.
Its subject is the loop core:
[bat pay]
where bat
is just the loop formula, and pay
is the pair [a
b]
, a
being the input subject, and b
the counter. Thus we
could also write this subject as
[l b a]
and we see readily that a
is at slot 7
, b
6
, l
2
.
With this subject, we need to express the Hoon loop body
?: =(a +(b)) :: line 4
b :: line 5
$(b +(b)) :: line 6
This is obviously an if statement, and it calls for 6
. Ie:
[6 t y n]
Giving our decrement program as:
[8 [1 0] [8 [1 6 t y n] [9 2 0 1]]]
For t
, how do we compute a flag that is yes (0
) if a
equals
b
plus one? Equals, we recall, is 5
. So t
can only be
[5 [0 7] [4 0 6]]
If so, our product y
is just the counter b
:
[0 6]
And if not? We have to re-execute the loop with the counter incremented. If we were executing it with the same counter, obviously an infinite loop, we could use the same core:
[9 2 0 1]
But instead we need to construct a new core with the counter incremented:
[l +(b) a]
ie,
[[0 2] [4 0 6] [0 7]]
and n
is:
[9 2 [[0 2] [4 0 6] [0 7]]]
Hence our complete decrement. Let's reformat vertically so we can actually read it:
[8
[1 0]
[ 8
[ 1
[ 6
t
y
n
]
]
[9 2 0 1]
]
]
which becomes
[8
[1 0]
[ 8
[ 1
[ 6
[5 [0 7] [4 0 6]]
[0 6]
[9 2 [[0 2] [4 0 6] [0 7]]]
]
]
[9 2 0 1]
]
]
or, on one line without superfluous brackets:
[8 [1 0] 8 [1 6 [5 [0 7] 4 0 6] [0 6] 9 2 [0 2] [4 0 6] 0 7] 9 2 0 1]
which works for the important special case, 42:
~tasfyn-partyv> .*(42 [8 [1 0] 8 [1 6 [5 [0 7] 4 0 6] [0 6] 9 2 [0 2] [4 0 6] 0 7] 9 2 0 1])
41
If you understood this, you understand Nock. At least in principle!
If you want to play around more with Nock, the command line will start getting unwieldy. Fortunately, the standard install contains the above Nock decrement packaged as an Arvo app, which you can edit and change if you'd like to get ambitious. Just run
~tasfyn-partyv> :toy/ndec 19
18
The file driving this is
hub/$seat/toy/app/ndec.holw
Edit this file, ignoring everything above the Nock formula, and hit return in the console to see it update:
~tasfyn-partyv>
: ~tasfyn-partyv/toy/app/ndec/holw/
If decrement seems fun - why not write add? I wrote a Nock adder a long, long time ago. But I've forgotten where I put it. There is absolutely no use in this exercise, except to prove to yourself that you've mastered Nock.


Nokia teases a new phone for a December 5 launch
by David NieldNokia teases a new phone for a December 5 launch
But what is it going to be?
(Image credit: Nokia)
We're not quite done yet when it comes to 2019 smartphone launches, because Nokia has teased a launch event via Twitter: the "newest addition to [the Nokia] family" appears on December 5.
The short video clip attached to the tweet doesn't give a whole lot away in terms of what to expect: pastel pink tones, a bit of running, a bit of rock climbing... and that's about it.
We do get the vaguest hint of a phone outline, but there's nothing really to see there – it's the same shape as just about every other handset we've seen this year, with the exception of anything foldable.
- Get ready for the Samsung Galaxy S11
- Chrome for Android has a new upgrade
- There's a new iPhone 11 battery case
After that we're just left with the "Coming Soon" message and the #nokiamobilelive hashtag. Rest assured we'll bring you news of the launch when it happens.
So which phone is it?
We're only guessing at this point as to which phone might be next to see the light of day from Nokia. The most recent batch of Nokia phones we saw were the Nokia 7.2 and the Nokia 6.2 in September.
A follow-up to the Nokia 9 PureView could be on the cards, which launched back in February at Mobile World Congress and is currently Nokia's flagship offering.
NokiaPowerUser has some newly leaked shots of what is purportedly the Nokia 9.1, with the five camera lenses on the back, just like the original Nokia 9. The rumor is the phone will come with the Snapdragon 855 installed inside.
Another possibility is the Nokia 8.2 – if only for the reason that the Nokia 8.1 was launched on December 5 last year.
Via Android Police


JEditorPane
and its subclass
JTextPane
.
The JEditorPane
class is the foundation
for Swing's styled text components and
provides a mechanism through which
you can add support for custom text formats.
If you want unstyled text,
use a
text area instead.
You can see an editor pane and a text pane in use by running TextSamplerDemo.
Here is a picture of the TextSamplerDemo
example.
Click the Launch button to run TextSamplerDemo using Java™ Web Start (download JDK 6). Alternatively, to compile and run the example yourself, consult the example index.
TextSamplerDemo
example barely begins to demonstrate the
capabilities of editor panes and text panes.
However, the top right editor pane illustrates a handy,
easy-to-use feature:
it displays uneditable help information
loaded from a URL.
The text pane at the lower right demonstrates that you can
easily embed images and even components directly
into text panes.
The Swing text API is powerful and immense, and we could devote an entire book just to using editor panes and text panes. This section introduces their capabilities, offers hints on which one you might want to use, and points to other sources of information.
TextSamplerDemo.java
that creates an uneditable editor pane
that displays text formatted with HTML tags.
JEditorPane editorPane = new JEditorPane(); editorPane.setEditable(false); java.net.URL helpURL = TextSamplerDemo.class.getResource( "TextSamplerDemoHelp.html"); if (helpURL != null) { try { editorPane.setPage(helpURL); } catch (IOException e) { System.err.println("Attempted to read a bad URL: " + helpURL); } } else { System.err.println("Couldn't find file: TextSamplerDemoHelp.html"); } //Put the editor pane in a scroll pane. JScrollPane editorScrollPane = new JScrollPane(editorPane); editorScrollPane.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); editorScrollPane.setPreferredSize(new Dimension(250, 145)); editorScrollPane.setMinimumSize(new Dimension(10, 10));
setEditable(false)
so the user cannot edit the text.
Next, the code creates the URL
object,
and calls the setPage
method with it.
The setPage
method opens the resource
pointed to by the URL and
figures out the format of the text
(which is HTML in the example).
If the text format is known,
the editor pane initializes itself
with the text found at the URL.
A standard editor pane can understand
plain text, HTML, and RTF.
Note that the page might be loaded asynchronously,
which keeps the GUI responsive
but means that you should not count on the
data being completely loaded
after the call to setPage
returns.
setPage
method.
The JEditorPane
class also provides constructors
that let you initialize an editor pane from a URL.
The JTextPane
class has no such constructors.
See
Using an Editor Pane to Display Text From a URL
for an example that uses this feature
to load an uneditable editor pane with HTML-formatted text.
Be aware that the document and editor kit
might change when using the setPage
method.
For example,
if an editor pane contains plain text (the default),
and you load it with HTML,
the document will change to an HTMLDocument
instance
and the editor kit will change to an HTMLEditorKit
instance.
If your program uses the setPage
method,
make sure you adjust your code for possible changes
to the pane's document and editor kit instances
(re-register document listeners on the new document, and so on).
StyledDocument
interface.
HTMLDocument
and RTFDocument
are both StyledDocuments
so HTML and RTF work as expected within a text pane.
If you load a text pane with plain text though,
the text pane's document is not a PlainDocument
as you might expect,
but a DefaultStyledDocument
.
registerEditorKitForContentType
method
to register your kit with the JEditorPane
class.
By registering an editor kit in this way,
all editor panes and text panes in your program will be able
to read, write, and edit the new format.
However, if the new editor kit is not a StyledEditorKit
,
text panes will not support the new format.
StyledDocument
interface.
The Swing text package provides
a default implementation of this interface,
DefaultStyledDocument
,
which is the document that text panes use by default.
A text pane also requires that its editor kit be an instance of a
StyledEditorKit
(or a subclass).
Be aware that the read
and
write
methods for StyleEditorKit
work with plain text.
JTextPane
class itself contains
many methods for working with styles that
simply call methods in its document or editor kit.
JTextPane
class,
you can embed images and components in a text pane.
You can embed images in an editor pane, too,
but only by including the images in an HTML or RTF file.
TextSamplerDemo
example
that creates and initializes a text pane.
String[] initString = { /* ... fill array with initial text ... */ }; String[] initStyles = { /* ... fill array with names of styles ... */ }; JTextPane textPane = new JTextPane(); StyledDocument doc = textPane.getStyledDocument(); addStylesToDocument(doc); //Load the text pane with styled text. try { for (int i=0; i < initString.length; i++) { doc.insertString(doc.getLength(), initString[i], doc.getStyle(initStyles[i])); } } catch (BadLocationException ble) { System.err.println("Couldn't insert initial text into text pane."); }
Although this is an interesting example
that concisely demonstrates several features of JTextPane
,
"real-world" programs aren't likely to initialize
a text pane this way.
Instead, a program would use an editor pane to save a document
which would then be used to initialize the text pane.
JTextComponent
class.
You can find the API tables for
JTextComponent
in
The Text Component API.
Also see
The JComponent Class,
which describes the API
inherited from JComponent
.
| Method or Constructor | Description |
|---|---|
|
JEditorPane(URL) JEditorPane(String) |
Creates an editor pane loaded with the text at the specified URL. |
|
setPage(URL) setPage(String) |
Loads an editor pane (or text pane) with the text at the specified URL. |
| URL getPage() | Gets the URL for the editor pane's (or text pane's) current page. |
| Method or Constructor | Description |
|---|---|
|
JTextPane() JTextPane(StyledDocument) |
Creates a text pane. The optional argument specifies the text pane's model. |
|
StyledDocument getStyledDocument setStyledDocument(StyledDocument) |
Gets or sets the text pane's model. |
| Example | Where Described | Notes |
|---|---|---|
TextSamplerDemo
|
Using Text Components | Uses each Swing text component. |
TextComponentDemo
|
Text Component Features | Provides a customized text pane. Illustrates many text component features, such as undo and redo, document filters, document listeners, caret change listeners, and how to associate editing actions with menus and key strokes. |
TreeDemo
| How to Use Trees | Uses an editor pane to display help loaded from an HTML file. |


Web Design for Forex Brokerages
A robust, content-rich, and mobile-friendly website is crucial to the success of your forex brokerage. Your website is the primary tool for generating new business while supporting your existing client base.
Kenmore Design will work with you to design a website that will meet the specific needs of your company. Our professionally designed custom sites exceed expectations and are built to last. In addition, Kenmore Design will equip your website with a series of tools designed specifically for FX brokerages. Examples include, but are not limited to: custom live currency rates tickers, integrated online account applications, live chat, CRM integration, MetaTrader 4 (MT4) integration (see Trader’s Room), multiple language support, IB support, Forex Academy educational section, and more.
A forex brokerage website requires a special look and feel to appeal to its audience. Kenmore Design has developed many FX industry websites and each site provides this unique look and feel as well as a straightforward and professional user experience.
Exclusive Design
The design of your site is a piece of art and a result of collaboration between your marketing and sales teams and our designers.


Readme
Introduction
This module allows the Titanium developer to provide in-app products.
Usage
Note: This module provides functionality that will not work in the simulator. Please run your tests on an actual device.
This module provides access to the products defined in iTunes Connect. You will need to add your app to iTunes Connect and define the in-app products there.
The following code segments are not complete; they only demonstrate the
essentials of using the module. See example/app.js
for a complete
example.
You load the module as usual:
var InAppProducts = require('com.logicallabs.inappproducts');
Basic steps to get a list of available products:
InAppProducts.addEventListener('receivedProducts', function(e) {
e.products.forEach(...
});
if (InAppProducts.getProducts({ SKUs: productIDs })) {
Ti.API.info('getProducts request started successfully.');
} else {
alert('Error: could not start getProducts request!');
}
Basic steps to purchase a product:
InAppProducts.addEventListener('purchaseUpdate', function(e) {
switch (e.purchase.state) {
...
});
productObj.purchase();
Completing a Purchase
The purchase process of in-app products on iOS separates the steps of completing the payment and completing the purchase itself. When the payment for the product is received, the related Purchase object goes into PURCHASE_STATE_PURCHASED state. This signals to the app that the purchased functionality should be made available to the user in the app's environment.
Once the app completed the processing of a purchase, it must call the complete method. If the app fails to do this, perhaps because it is terminated before it can completely process the purchase, it will receive a purchaseUpdate event for the uncompleted purchase the next time it starts up. The module will cache these events until the purchaseUpdate event handler becomes available and then deliver all the outstanding events at once. For this reason it is important to prepare this event handler for handling such seemingly unsolicited events.
Issues and Limitations
Web receipt verification with the iTunes Store is not part of the module at this time -- the best practice encouraged by Apple is to perform this verification on an independent server, not on the device.
Change Log
Version 1.0.0
- First release
Author
<EMAIL_ADDRESS>License
Logical Labs Commercial License
Copyright
Copyright (c) 2013 by Logical Labs, LLC