The Google Earth Enterprise solution is a network-based, rich 3D and 2D mapping system that makes vast amounts of data easily accessible from a desktop application. With the Google Earth Enterprise solution, you can create a central geographic information system (GIS) database that can simultaneously be distributed to thousands of users.
The Google Earth Enterprise solution consists of three basic products:
Google Earth EC is the client software that creates an interactive 3D globe by connecting to geospatial databases created with Google Earth Enterprise Fusion. A Google Earth Enterprise Fusion database consists of imagery, terrain, and vector data. Unlike some traditional GIS software, Google Earth EC is easy to use and allows users to view any location on the globe in seconds without specialized training. Google Earth EC supports common security protocols for user access control and includes powerful features for experts and non-experts alike, including:
Google Earth Enterprise Fusion is the integration component of the Google Earth Enterprise solution and is designed for businesses that want to create their own GIS and imagery data. With Google Earth Enterprise Fusion, businesses can create a standalone GIS database, as explained in “Google Earth Enterprise Fusion Products” on page 1-2.
The Google Earth Enterprise Server is the distribution component of the Google Earth Enterprise solution. It allows your organization to serve its own data from your own servers using your standalone database. In addition, you can use the secure server login feature of the Google Earth Enterprise Server to deliver sensitive data in a secure environment.
The Google Maps API enables you to create 2D views of your Google Earth Enterprise Fusion database in any web page that can be displayed in a browser. The Google Maps API utilizes Asynchronous JavaScript XML (AJAX) technology to deliver a high performance, easy to use, interactive user experience similar to Google Maps on the World Wide Web (http://maps.google.com). The Google Maps API also allows you to integrate additional datasets as overlays using XML, allowing you to utilize the power of web services to create mashups inside your own organization.
Combined with the features of Google Earth Enterprise, the Google Maps API allows you to:
The Google Maps API resides within an HTML page which you control as the administrator. Google Earth Enterprise Fusion generates a simple web page with appropriately configured Google Maps API JavaScript code when a user publishes a map database. From that point forward, the user interface is fully yours to determine. (See http://www.google.com/apis/maps for complete Google Maps API documentation.)
With Google Earth Enterprise Fusion PRO, you can create a standalone GIS database that includes imagery, terrain, and vector data, and then serve it using the Google Earth Enterprise Server.
When you look at the graphical representation of data in Google Earth EC, it appears to be one cohesive set of data. In reality, it is a much more complex collection of different types of data that you build in stages. You use Google Earth Enterprise Fusion to prepare the different types of data to display smoothly together and to provide the types of information you want to display for your viewers.
Source data is the most basic information you start with when working in Google Earth Enterprise Fusion. The source data that you import into Google Earth Enterprise Fusion falls into two broad categories:
Vector data consists of geographic features which are either geographic coordinates (points), sequences of connected geographic coordinates (lines), or closed sequences of connected geographic coordinates (polygons). Each feature typically has attribute fields, such as name, street address, or web site URL.
Google Earth Enterprise Fusion supports common vector and point data file formats. For a listing of specific formats, see the Supported Source File Formats section of the Defining Resources chapter.
You can use Google Earth Enterprise Fusion PRO to import your own imagery and terrain data in order to integrate it with your vector data.
Raster data is a grid of cells covering an area of interest. Each pixel, the smallest unit of information in the grid, displays a unique attribute. There are two types of raster data in Google Earth Enterprise Fusion:
In Google Earth EC, the imagery data is draped over the terrain data, giving the imagery a topographical appearance.
Google Earth Enterprise Fusion PRO supports common imagery and terrain data formats. For a listing of specific formats, see the Supported Source File Formats section of the Defining Resources chapter.
After you import source data and begin working with it to create your own GIS data, it becomes part of three fundamental components of Google Earth Enterprise Fusion:
The relationship among these three components is well defined. Resources comprise projects, and projects comprise databases. A given resource can be used in more than one project, and a given project can be used in more than one database.
When you prepare map data, there are four components:
You can use the same vector and imagery resources for both Google Earth EC and Google Maps. However, you have the additional step of creating map layers for Google Maps. (See Preparing Data for Google Maps for complete details.)
The Google Earth Enterprise Fusion workflow is based on four general steps (with an additional step if you are creating Google Maps databases): the steps described in the previous section plus a publishing step. Generally, you perform these steps in the following order:
The following diagram illustrates this process:
Each step consists of a definition stage and a building stage. You define the asset (that is, specify the properties of that asset), and then you build the asset. When the building process is complete, Google Earth Enterprise Fusion stores a new version of the asset in its file system. When you define projects and databases, you select each asset you want to include. When you publish a database, you can select the version of the database you want to publish.
As you define your data, you specify:
If you are working with map data, you also specify:
You can define and build assets either by using the Google Earth Enterprise Fusion graphical user interface (GUI) or by entering shell commands on the command line. The main chapters of this guide provide information about performing these steps using the GUI. For information about the shell commands, see the Command Line Reference chapter.
You can build each resource as soon as you finish defining it, or you can wait and build several resources at the same time. You must build a resource, however, before you add it to a project. It is up to you to determine your own work style based on the type of data you are working with, the number of changes you are making, and so on.
If you build a resource while you are defining other resources, the build process takes place in the background. By the time you finish defining the second resource, the build process for the first resource might be complete.  With this work style, building each resource as soon as you finish defining it saves you time. The disadvantage of this work style is that building large amounts of data (particularly imagery data) uses much of your system resources, so working on something else while building large assets could create performance issues for you.
If you wait to build your projects and databases at the same time, the build process takes more time and CPU cycles. The advantage of this work style, however, is that if you time it right, you can start a build just before you go to a meeting, lunch, or home for the night, and the build process can have your workstation all to itself.
Tip: Since builds occur in the background and Google Earth Enterprise Fusion is always running, you can close the Google Earth Enterprise Fusion GUI after you start a build, if you do not need to use it for anything else. In fact, this is a good practice, because it frees up RAM and CPU cycles on the workstation, which can improve build performance.
This section contains general information about best practices to follow as you become familiar with Google Earth Enterprise Fusion. This information is helpful to know and can sometimes save you time.
Google Earth Enterprise Fusion employs the concept of an asset root as the root of the directory tree where all Google Earth Enterprise Fusion assets (resources, projects, and databases) are stored. You can (and should) create a hierarchy of subfolders within the asset root to organize your assets, so you and other users can find them easily.
Since Google Earth Enterprise Fusion currently does not allow you to delete or rename subfolders after they are created, Google strongly recommends that you plan out your subfolder hierarchy and create all of the subfolders you can anticipate needing before you begin working with your data. You can always add more subfolders later, but a little preplanning in this area goes a long way.
There are several ways to organize your subfolders. Google recommends the following general structure:
Databases/ MapLayers/ Projects/ Imagery Terrain Vector Resources/ Imagery Terrain Vector
Note that spaces or other non-alpha characters are not recommended in folder or asset names.
It is unnecessary to further organize your database folder, because you will have only a handful of databases at most (possibly only one or two). Subdividing your projects by data type is useful, but it is not necessary to go into any greater detail for projects.
For Resources, however, depending on the type of data you work with, you can further organize your subfolders by:
Starting with the basic structure recommended above, your full folder structure might look something like this:
Databases MapLayers Projects/ Imagery Terrain Vector Resources/ Imagery/ NoAmer/ USA/ California NewMexico Texas Canada/ Ontario Terrain/ NoAmer/ USA/ California NewMexico Texas Canada/ Ontario Vector/ NoAmer/ USA/ California NewMexico Texas Canada/ Ontario
Since Google Earth Enterprise Fusion currently does not allow you to delete or rename assets, Google recommends that you plan out your databases and projects, as much as possible, before you begin working with your data.
Most organizations publish only one database for a particular purpose. If you have multiple purposes (such as commercial property for sale and residential property for sale), you must create a separate database for each purpose or project.
Note: Google Earth Enterprise Fusion does not allow you to associate multiple projects of the same type (such as two vector projects) with a database at the same time. You can associate one vector, one imagery, and one terrain project with each database.
After you define a database (that is, define the projects that comprise that database), that database definition should not change. You might update the underlying source data and rebuild the database; however, the association of the projects to the database and the resources to the projects should not change.
For example, you might define one database that contains the current real estate listings for your area and another database that contains the current week’s new listings. You can update the source data for each database as often as you like and then rebuild the databases and publish the new versions, but you never need to change the projects associated with each database. The main reason for this convention is so your users can always connect to a particular server (or virtual server) to get the most up-to-date listings.
Using the example described in the previous paragraph, you can publish each database to a virtual server:
To save time and work efficiently, a good strategy is to create one main project and one evaluation project. The main project contains all of the resources you want to publish. You keep the evaluation project small, working only on new or changing layers. Because you are working on a small amount of data at a time, the evaluation project does not take long to build, so you can iteratively tweak it and view the results very quickly. When you finish working on a layer in the evaluation project, you can export that layer and import it into your main project. The next time you build and publish the database, the new layer is included.
When you acquire the source data that you intend to import into Google Earth Enterprise Fusion, it is a good idea to store it in /gevol/src
1. After you organize the subfolders in that location and copy your source data into those folders, you must set the file access permissions so that Google Earth Enterprise Fusion can open the source files. This is because Google Earth Enterprise Fusion has a special user name and is part of a special group, so you must set your file access permissions to allow all users and groups to read and execute the source data files.
chmod a+r /gevol/src
Each time you add source files to /gevol/src
directories, you must ensure that the permissions for the new files are set correctly by running this command.
Note: If you specify a different volume, substitute your volume name for gevol
.


NTBillboardStyleBuilder
@interface NTBillboardStyleBuilder : NTStyleBuilder
A base class for BillboardStyleBuilder subclasses.
-
Returns the horizontal attaching anchor point of the billboard.
Declaration
Objective-C
- (float)getAttachAnchorPointX;
Return Value
The horizontal attaching anchor point of the billboard.
-
Sets the horizontal attaching anchor point of the billboard.
Declaration
Objective-C
- (void)setAttachAnchorPointX:(float)attachAnchorPointX;
Parameters
attachAnchorPointX
The new horizontal attaching anchor point for the billboard. -1 means the left side, 0 the center and 1 the right side. The default is 0.
-
Returns the vertical attaching anchor point of the billboard.
Declaration
Objective-C
- (float)getAttachAnchorPointY;
Return Value
The vertical attaching anchor point of the billboard.
-
Sets the vertical attaching anchor point of the billboard.
Declaration
Objective-C
- (void)setAttachAnchorPointY:(float)attachAnchorPointY;
Parameters
attachAnchorPointY
The new vertical attaching anchor point for the billboard. -1 means the bottom, 0 the center and 1 the top. The default is 1.
-
Sets the attaching anchor point for the billboard. The attaching anchor point is only used if the billboard is attached to another (base) billboard. It defines the point on the base billboard where the attachable billboard will be placed.
Declaration
Objective-C
- (void)setAttachAnchorPointX:(float)attachAnchorPointX attachAnchorPointY:(float)attachAnchorPointY;
Parameters
attachAnchorPointX
The new horizontal attaching anchor point for the billboard. -1 means the left side, 0 the center and 1 the right side. The default is 0.
attachAnchorPointY
The new vertical attaching anchor point for the billboard. -1 means the bottom, 0 the center and 1 the top. The default is 1.
-
Returns the state of the causes overlap flag.
Declaration
Objective-C
- (BOOL)isCausesOverlap;
Return Value
True if this billboard causes overlapping with other billboards behind it.
-
Sets the state of the causes overlap flag. If set to false the billboard will never hide other billboards, even if they are overlapping and have the hide if overlapped flag set to true. If set to true the billboard may hide other overlapping billboards that have the hide if overlapped flag set to true and are located behind this billboard. This billboard may still be hidden by other billboards in front of it, regardless of this parameter. The default depends on the subclass.
Declaration
Objective-C
- (void)setCausesOverlap:(BOOL)causesOverlap;
Parameters
causesOverlap
The new state of the allow overlap flag.
-
Returns the state of the allow overlap flag.
Declaration
Objective-C
- (BOOL)isHideIfOverlapped;
Return Value
True if this billboard can be hidden by overlapping billboards in front of it.
-
Sets the state of the hide if overlapped flag. If set to false the billboard may be hidden by other billboards that are overlapping with it and are located in front of this billboard. If set to true the billboard will never be hidden by other overlapping billboards. The default depends on the subclass.
Declaration
Objective-C
- (void)setHideIfOverlapped:(BOOL)hideIfOverlapped;
Parameters
hideIfOverlapped
The new state of the allow overlap flag.
-
Returns the horizontal offset of the billboard.
Declaration
Objective-C
- (float)getHorizontalOffset;
Return Value
The horizontal offset of the billboard, units depend on the scaling mode.
-
Sets the horizontal offset for the billboard. Horizontal offset is used to offset the bitmap of the billboard horizontally relative to the billboard rotation. The units are the same as the units used in the setSize method. Negative values offset the bitmap to the left and positive values to the right. The default is 0.
Declaration
Objective-C
- (void)setHorizontalOffset:(float)horizontalOffset;
Parameters
horizontalOffset
The new horizontal offset for the billboard.
-
Returns the vertical offset of the billboard.
Declaration
Objective-C
- (float)getVerticalOffset;
Return Value
The vertical offset of the billboard, units depend on the scaling mode.
-
Sets the vertical offset for the billboard. Vertical offset is used to offset the bitmap of the billboard vertically relative to the billboard rotation. The units are the same as the units used in the setSize method. Negative values offset the bitmap to the bottom and positive values to the top. The default is 0.
Declaration
Objective-C
- (void)setVerticalOffset:(float)verticalOffset;
Parameters
verticalOffset
The new vertical offset for the billboard.
-
Returns the placement priority of the billboard.
Declaration
Objective-C
- (int)getPlacementPriority;
Return Value
The placement priority of the billboard.
-
Sets the placement priority for the billboard. Higher priority billboard get drawn in front of lower priority billboards regardless of their distance to the camera. If billboards are not allowed to overlap then higher priority billboards hide overlapping lower priority billboards. The default is 0.
Declaration
Objective-C
- (void)setPlacementPriority:(int)placementPriority;
Parameters
placementPriority
The new placement priority for the billboard.
-
Returns the state of the scale with DPI flag.
Declaration
Objective-C
- (BOOL)isScaleWithDPI;
Return Value
True if this billboard’s size will be scaled using the screen dot’s per inch.
-
Sets the state of the scale with DPI flag. If set to true the billboard’s size will scale using the screen dots per inch parameter. This means that billboards will look the same size regardless of the device screen size and density. If set to false the billboards will not be scaled with the screen density parameter, which means that billboard will look smaller on on higher density screens. Custom Label and Popup implementations may, but are not guaranteed to compensate for this by generating higher resolution images. The default depends on the subclass.
Declaration
Objective-C
- (void)setScaleWithDPI:(BOOL)scaleWithDPI;
Parameters
scaleWithDPI
The new state of the scale with DPI flag.
-
Returns the animation style of the billboard.
Declaration
Objective-C
- (NTAnimationStyle *)getAnimationStyle;
Return Value
The animation style of the billboard. Can be null if animations are not used.
-
Sets the animation style of the billboard.
Declaration
Objective-C
- (void)setAnimationStyle:(NTAnimationStyle *)animStyle;
Parameters
animStyle
The new animation style of the billboard. Can be null if animations are not needed (the default).
-
Undocumented
Declaration
Objective-C
-(void)dealloc;


 But now he is alone, he can only destroy one road, then the city will be divided into two cities. Impression of the city is a number defined as the distance between the farthest two houses (As it relates to the fare).When the terrorist destroyed a road, he needs to spend some energy, assuming that the number is a.At the same time,he will get a number b which is maximum of the Impression of two cities. The terrorist wants to know which road to destroy so that the product of a and b will be minimized.You should find the road’s id.
Note that the length of each road is one.
Note that the length of each road is one.
输入:
The first line contains integer T(1<=T<=20), denote the number of the test cases.
For each test cases,the first line contains a integer n(1 < n <= 100000);denote the number of the houses;
Each of the following (n-1) lines contains third integers u,v,w, indicating there is a road between house u and houses v,and will cost terrorist w energy to destroy it.The id of these road is number from 1 to n-1.(1<=u<=n , 1<=v<=n , 1<=w<=10000)
For each test cases,the first line contains a integer n(1 < n <= 100000);denote the number of the houses;
Each of the following (n-1) lines contains third integers u,v,w, indicating there is a road between house u and houses v,and will cost terrorist w energy to destroy it.The id of these road is number from 1 to n-1.(1<=u<=n , 1<=v<=n , 1<=w<=10000)
输出:
The first line contains integer T(1<=T<=20), denote the number of the test cases.
For each test cases,the first line contains a integer n(1 < n <= 100000);denote the number of the houses;
Each of the following (n-1) lines contains third integers u,v,w, indicating there is a road between house u and houses v,and will cost terrorist w energy to destroy it.The id of these road is number from 1 to n-1.(1<=u<=n , 1<=v<=n , 1<=w<=10000)
For each test cases,the first line contains a integer n(1 < n <= 100000);denote the number of the houses;
Each of the following (n-1) lines contains third integers u,v,w, indicating there is a road between house u and houses v,and will cost terrorist w energy to destroy it.The id of these road is number from 1 to n-1.(1<=u<=n , 1<=v<=n , 1<=w<=10000)
样例输入:
2 5 4 5 1 1 5 1 2 1 1 3 5 1 5 1 4 1 1 3 1 5 1 1 2 5 1
样例输出:
Case #1: 2 Case #2: 3
给一棵树，每条边上都有一个权值，去掉树上任意一条边之后，分成两个子树，两个子树的最长路与这条边上的权值相乘，的到一个乘积。问去掉那一条边可以使这个乘积最小。
首先找到树上的最长路，那么删边的时候有两种情况：
1. 这条边不是最长路上的边
2. 这条边是最长路上的边
对于第一种情况，很容易计算出乘积。
对于第二种情况，只需要计算出被分成的两个子树里面的最长路径长度即可，这个可以预处理一下。分析可以发现，这种情况下，两棵子树的最长路，一定是以整棵树的最长路的两个端点为起始点的，因此只需要预处理出所有点到两个端点的距离，然后根据删除的最长路边求两颗子树中的最大值即可。
所有预处理都是dfs……
#include <cstdio> #include <cstring> #include <vector> #include <algorithm> using namespace std; #define N 100010 #define inf 0x7fffffff bool y[N]; int n, s, t, ds[N], dt[N], ms[N], mt[N], len, id, ans; struct node { int v, w, id; node() {} node(int _v, int _w, int _id) : v(_v), w(_w), id(_id) {} }; vector<node> g[N]; void dfs(int now, int fa) { int u; for (int i=0; i<g[now].size(); i++) if ((u = g[now][i].v) != fa) { ds[u] = ds[now] + 1; dfs(u, now); } } void dfs2(int now, int fa) { int u; for (int i=0; i<g[now].size(); i++) if ((u = g[now][i].v) != fa) { dt[u] = dt[now] + 1; dfs2(u, now); } } void d1(int now, int fa) { int u; mt[now] = dt[now]; for (int i=0; i<g[now].size(); i++) if ((u = g[now][i].v) != fa) { d1(u, now); mt[now] = max(mt[now], mt[u]); } } void d2(int now, int fa) { int u; ms[now] = ds[now]; for (int i=0; i<g[now].size(); i++) if ((u = g[now][i].v) != fa) { d2(u, now); ms[now] = max(ms[now], ms[u]); } } void work(int now, int fa) { int u, w; for (int i=0; i<g[now].size(); i++) if ((u = g[now][i].v) != fa) { if (ds[now] + 1 + dt[u] == len) w = g[now][i].w * max(ms[now], mt[u]); else w = g[now][i].w * len; if (w < ans) { ans = w, id = g[now][i].id; } else if (w == ans && g[now][i].id < id) id = g[now][i].id; work(u, now); } } int main() { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); #endif int size = 20 << 20; // 20MB char *p = (char*)malloc(size) + size; __asm__("movl %0, %%esp\n" :: "r"(p)); int T; scanf("%d", &T); for (int cas=1; cas<=T; cas++) { scanf("%d", &n); for (int i=0; i<=n; i++) { g[i].clear(); y[i] = false; } for (int i=1, a, b, c; i<n; i++) { scanf("%d%d%d", &a, &b, &c); g[a].push_back(node(b, c, i)); g[b].push_back(node(a, c, i)); } ds[1] = 0; dfs(1, 0); ds[s=0] = 0; for (int i=1; i<=n; i++) if (ds[i] > ds[s]) s = i; ds[s] = 0; dfs(s, 0); t = 0; for (int i=1; i<=n; i++) if (ds[i] > ds[t]) t = i; len = ds[t]; dt[t] = 0; dfs2(t, 0); d1(s, 0); d2(t, 0); id = ans = inf; work(s, 0); printf("Case #%d: %d\n", cas, id); } return 0; }
版权声明：本文为博主原创文章，未经博主允许不得转载。
参考：http://blog.csdn.net/yang_7_46/article/details/9988655
(adsbygoogle = window.adsbygoogle || []).push({});
现在的做法是,你只有自行车,你就限制所有人都不许开车,都只能骑自行车上路


Which type of accounts have you prepared?
If you’re not sure, you may want to ask an accountant.
Which type of accounts have you prepared?
Micro-entity accounts
Abridged accounts
Full accounts
Dormant company accounts


Face Hallucination and Deblurring Results
Duing zooming in, use mouse wheel to control the magnification ratio.


--- layout: post title: 'It''s Never Been Built Before' date: 2006-11-24 00:00:00 category: software-development ---
It's Never Been Built Before: "In software development, if you're repeating the same project over and over, you won't have a job for very long. At least not on this continent. If all you need is a stock airplane, you buy one. We're paid to build high-risk, experimental airplanes."


Worcester Polytechnic Institute
MS in Robotics Engineering, Jan 2018 - Dec 2019 (Expected)
Rajiv Gandhi University of Knowledge Technologies, RK Valley
Bachelor of Technology, May 2015
GPA: 8.9/10
Concentration: Electronics and Communication Engineering
Coursework: Programming and Data Stuctures, Design of Algorithms, Intro. to Mechanics, Control Systems, Digital Electronics, Digital Signal Processing, Digital Image Processing, Computer Vision, Data Mining, Pattern Recognition and Machine Intelligence


Web Threats Keep Users Away
this story covers the results of a survey from webwatch, which indictates that people are cutting back on spending online as a result of fears about identity theft and phishing.
I think this kind of swing is one that a lot of companies (like banks) who save a lot of money as more of their customers transact over the net, will be very worried about. If their customers start returning to using other channels like phone banking or branch banking, then that's likely to have a real impact on the bottom line for the companies involved...
One outcome I think it likely is a return of the AOL style "walled garden" Internet where only specific, vetted, sites are available to the user, with the service provider providing some assurance over the content...
Ordinary users are not and don't want to be savvy enough in the ways that the Internet works to be able to reliably detect phishing scams and to keep spyware off their PC's. As a result, if the environment on the 'net keeps getting more hostile, it will be better for the ordinary users to take the hit and lose access to a lot of sites, in exchange for a greater level of safety...


Jump to:
Return Requirements
Return Request Form
Request to Return Requirements
Making a Statement
Sabbatical activities & lessons learned
Why I feel ready to rerturn
An assessment of the issues I confronted at MIT and how they have been addressed
An honest assessment of challenges you might face when I return
How imma finna slay dem challenges
CourseRoad
Course Number
Course Name
Units
Y Dis?
Spring 2020
WGS.101
Intro to WGS
12
Required CI-HW
WGS.301
Feminist Thought
12
Required CI-M
WGS.111
Gender & Media Studies
12
Other Requirements
Chronological activities list
Letter from a MH professional
Letter of recommendation
Letter from advisor/dept emailed to SSS
pika and SFS
Undergraduate Request to Return Form
Personal Info
What is your name?
Enter your MIT ID
Kerberos
Phone Number
Street Address
Leave type
When are you coming back in 2020? Spring
Fall
Why do you feel ready to return?


My name is Conor Diggin and I am currently a Creative Digital Media in the Institute of Technology Blanchardstown. I was born in London, England however I have lived here in Ireland for 15 years. My main interest in media is in the film industry but I also enjoy photography and web design. So feel free to check out my collection of work in this portfolio. If you would be interested on working on a project with me or have a question, my contact details are displayed on the "contact me" page. Thank You.


Melissa Bernstein is the co-founder and chief creative officer of Melissa & Doug, a global toy company committed to igniting imagination and a sense of wonder in all children. Concerned this generation of children is missing out on the kind of unstructured downtime that enables them to find their passions and purpose, Melissa is leading a movement to Take Back Childhood to fight for free time and all the countless ways to enjoy it.
Melissa is an alumna of Duke, but not of BOW.
What made you take the risk to start your own company from your garage?
We went the path of convention initially, and I went into investment banking and my husband into advertising and very quickly, I more than he, felt like a flower without sunlight and water. I wasn't doing what made me feel good about myself, and that career for many is their passion and they can look at numbers and make them do things that no one could ever think and turn them into something magical. But for me, when I looked at a number in a spreadsheet it just looked like a boring old spreadsheet. And I think Doug was in a more creative pursuit and enjoyed it, but we both felt that itch to be doing something that had greater meaning and made us feel like we were able to impact someone outside the corporations we were in. We were at the point where we didn't even think it was a choice, it was crucial to living to get off the treadmill and do something else.

Everything. Just everything--from making mistakes in products, to making mistakes with people, to making mistakes for strategy. I mean we basically never had a mentor and did it all on gut, only the two of us, and because of that, made every conceivable mistake you can make. The only reason we're still here is one, because we learned from that and changed, and two, because we didn't give up and just quit. So I don't think there's a mistake we didn't make.
What has been your favorite part about leading the Melissa & Doug Entrepreneurs program so far?
Making it so that they don't make the same mistakes that we do.  There were, of course, a lot of trials and tribulations, and being able to take that knowledge and use it to help others before they make a lot of those same mistakes is so powerful.
How has your role within the company changed over time as it’s grown and evolved?
 I was our only sales person for a dozen years, and I created all the product. As we've grown the real joy for me was I was able to step away from sales and focus 100% on creating the product. So, that's what I do now--I run the whole creative team, and that's my real love and where I can make the biggest impact so I focus as much as I can on that.
What influenced your decision to switch from just making educational videos to toys and what was the hardest part about changing direction?
We didn't change direction, actually.  The videos were that we couldn't stand kids just robotically watching T.V. and that if they had to watch T.V. we are going to make them interactive and get kids engaging with what they're watching. The key philosophy has held true through that and through today. The puzzles, which were our first category, were really just an articulation of that philosophy which is to create playthings that are different, fun, fresh, and rethink play patterns that have been around forever in a different way.
We never believed we were a niche. Every category we went into, people tried to sort of put us in a box. They would say, 'Oh, they're a wooden puzzle company' and then we created wooden toys so they said, 'Ok well they're still wood so they're just a wooden toy company'. Then we created a stuffed animal/plush category and they were kind of like, 'Wait what do we call them?', but we're a Children's company. People feel that need to define you but we never felt that need. We always said that anything that helps aid a child to reach their full potential and facilitates play in any sense is something we could conceivably do.
How has the startup scene changed since you created your company?
When we did it, nobody did it. Today it's very conventional to get off the fast track and do a startup. When we did it people looked at us like we were crazy and told us we were crazy. If I can do it having zero experience in the industry and even in my role, anybody can do it. It's really more the attitude and desire than the actual skills.
What advice would you have for those interested in entrepreneurship or starting their own companies one day?
There's really one key learning or advice I would give everyone. I always joke that we should make a T-shirt that says 'Just Focus on the Product, Dammit'. My advice would be to not get distracted with anything other than the product. What I see, almost continually with young entrepreneurs and millennials, is they want to focus on a lot of other things other than their product. They get really excited about the route to market, and their branding and their logo and messaging and marketing strategy and photography and packaging. They forget that without the most amazing product ever that is solving a problem, and within 30 seconds they can tell me the 3 things that make it better than anything on the market, without that they have nothing. All of those other things don't matter until you have a product that is transformative.


How mantis shrimp make sense of the world
| Source: | University of Arizona |
| Summary: | A new study provides insight into how the small brains of mantis shrimp - fierce predators with keen vision that are among the fastest strikers in the animal kingdom - are able to make sense of a breathtaking amount of visual input. |
A study involving scientists at the University of Arizona and the University of Queensland provides new insight into how the small brains of mantis shrimp — fierce predators with keen vision that are among the fastest strikers in the animal kingdom — are able to make sense of a breathtaking amount of visual input.
The researchers examined the neuronal organization of mantis shrimp, which are among the top predatory animals of coral reefs and other shallow warm water environments.
The research team discovered a region of the mantis shrimp brain they called the reniform ("kidney-shaped") body. The discovery sheds new light on how the crustaceans may process and integrate visual information with other sensory input.
Mantis shrimp sport the most complex visual system of any living animal. They are unique in that they have a pair of eyes that move independently of each other, each with stereoscopic vision and possessing a band of photoreceptors that can distinguish up to 12 different wavelengths as well as linear and circular polarized light. Humans, by comparison, can only perceive three wavelengths — red, green and blue.
Therefore, mantis shrimp have much more spectral information entering their brains than humans do. Mantis shrimp seem to be able to process all of the different channels of information with the participation of the reniform body, a region of the animal's brain found in the eye stalks that support its two protruding eyes.
Researchers Hanne Thoen and Justin Marshall at Queensland Brain Institute at the University of Queensland in Brisbane, Australia, teamed up with Nicholas Strausfeld at the University of Arizona, as well as scientists from Lund University in Sweden and the University of Washington in the U.S. to gain a better understanding of how the reniform bodies connect to other parts of the mantis shrimp brain and gather clues to their functional roles.
Using a variety of imaging techniques, the team traced connections made by neurons in the reniform body and discovered that it contains a number of distinct, interacting subsections. One particular subunit is connected to a deep visual center called the lobula, which is structurally comparable to a simplified visual cortex.
"This arrangement may allow mantis shrimp to store quite high-level visual information," said Strausfeld, senior author of the paper that was published in the Journal of Comparative Neurology.
"Mantis shrimp most likely use these subsections of the reniform body to process different types of color information coming in and organize it in a way that makes sense to the rest of the brain," said lead author Thoen. "This would enable them to interpret a large amount of visual information very quickly."
One of the study's crucial findings was that neural connections link the reniform bodies to centers called mushroom bodies, iconic structures of arthropod brains that are required for olfactory learning and memory.
"The fact that we were now able to demonstrate that the reniform body is also connected to the mushroom body and provides information to it, suggests that olfactory processing may take place in the context of already established visual memories," said Strausfeld, Regents Professor of neuroscience and director of the Center for Insect Science at the University of Arizona.
The discovery of the reniform body, however, is not limited to mantis shrimp. It has been identified in other species as well, including shore crabs, shrimp and crayfish.
In 2016, an Argentinian group discovered that, in crabs, what are now known as reniform bodies act as secondary centers for learning and memory. According to Strausfeld, this suggests that the formation and storage of memories occurs in at least two different and discrete sites in the brain of the mantis shrimp and likely other members of malacostracans, the largest class of crustaceans. In addition to mantis shrimp, malacostracans include crabs, lobsters, crayfish, shrimp, krill and other less familiar species that together account for about 40,000 living species and a great diversity of body forms.
Reniform bodies have not been identified in insects and may be uniquely crustacean attributes, the researchers say. Alternatively, they might be homologous to a structure found in insect brains called the lateral horn, which sits between the optic lobes and the mushroom bodies. Strausfeld pointed out that fruit fly research done by other groups showed that the lateral horn is crucial in assigning values to learned olfactory information.
"The hunt is now on to determine if insects have a homologous center," he said. "If we are looking for homologs in other arthropods, the reniform body would be the obvious candidate."
The study was funded in part by the Asian Office of Aerospace Research and Development (12?4063), the Australian Research Council (FL140100197) and the National Science Foundation (11754798).
make a difference: sponsored opportunity
Story Source:
Materials provided by University of Arizona. Original written by Daniel Stolte.
Note: Content may be edited for style and length.
Journal Reference:
- Hanne Halkinrud Thoen, Gabriella Hannah Wolff, Justin Marshall, Marcel E. Sayre, Nicholas James Strausfeld. The reniform body: An integrative lateral protocerebral neuropil complex of Eumalacostraca identified in Stomatopoda and Brachyura. Journal of Comparative Neurology, 2019; DOI: 10.1002/cne.24788
Cite This Page:
| MLA | University of Arizona. "How mantis shrimp make sense of the world." ScienceDaily. ScienceDaily, 25 November 2019. <www.sciencedaily.com/releases/2019/11/191125145544.htm>. |
| APA | University of Arizona. (2019, November 25). How mantis shrimp make sense of the world. ScienceDaily. Retrieved November 25, 2019 from www.sciencedaily.com/releases/2019/11/191125145544.htm |
| Chicago | University of Arizona. "How mantis shrimp make sense of the world." ScienceDaily. www.sciencedaily.com/releases/2019/11/191125145544.htm (accessed November 25, 2019). |


Website Designing
List of websites that are related to making a website
Sc1.html
Sc2.html
Other google websites
These websites can support you when you need help initiating ideas for creating a good website


Hello, I'm Michael Weiss. I am a member of the June 2014 cohort at DevBootcamp. In my life before starting the program I have been a graduate student at New York University studying algebraic geometry. I really enjoy coding and working on large programming projects. Some of my past experience has been designing super fast algorithms for arithmetic libraries. I think that DBC should be a great experience and look forward to meeting a lot of new people this summer.
Assignments
- Week 1: Technical Blog
- Week 1: Cultural Blog
- Week 1: Wireframe Discussion
- Week 2: Women in Computing: Responsive Design
- Week 2: Technical Blog: Technical Blog
- Week 3: Technical Blog: JavaScript and Web Development
- Week 3: Cultural Blog: Gregorc Learning Discussion
- Week 4: Technical Blog: JavaScript vs. Ruby


Computes structural equivalence between ego and alter in a network
struct_equiv(graph, v = 1, inf.replace = 0, groupvar = NULL, ...) # S3 method for diffnet_se print(x, ...)
| graph | Any class of accepted graph format (see |
|---|---|
| v | Numeric scalar. Cohesion constant (see details). |
| inf.replace | Deprecated. |
| groupvar | Either a character scalar (if |
| ... | Further arguments to be passed to |
| x | A |
If graph
is a static graph, a list with the following elements:
SE
Matrix of size \(n\times n\) with Structural equivalence
d
Matrix of size \(n\times n\) Euclidean distances
gdist
Matrix of size \(n\times n\) Normalized geodesic distance
Structure equivalence is computed as presented in Valente (1995), and Burt (1987), in particular
$$% SE_{ij} = \frac{(dmax_i - d_{ji})^v}{\sum_{k\neq i}^n(dmax_i-d_{ki})^v} $$
with the summation over \(k\neq i\), and \(d_{ji}\), Eucledian distance in terms of geodesics, is defined as
$$% d_{ji} = \left[(z_{ji} - z_{ij})^2 + \sum_k^n (z_{jk} - z_{ik})^2 + \sum_k^n (z_{ki} - z_{kj})^2\right]^\frac{1}{2} $$
with \(z_{ij}\) as the geodesic (shortest path) from \(i\) to \(j\), and \(dmax_i\) equal to largest Euclidean distance between \(i\) and any other vertex in the network. All summations are made over \(k\not\in \{i,j\}\)
Here, the value of \(v\) is interpreted as cohesion level. The higher its value, the higher will be the influence that the closests alters will have over ego (see Burt's paper in the reference).
Structural equivalence can be computed either for the entire graph or by groups
of vertices. When, for example, the user knows before hand that the vertices
are distributed accross separated communities, he can make this explicit to
the function and provide a groupvar
variable that accounts for this.
Hence, when groupvar
is not NULL
the algorithm will compute
structural equivalence within communities as marked by groupvar
.
Burt, R. S. (1987). "Social Contagion and Innovation: Cohesion versus Structural Equivalence". American Journal of Sociology, 92(6), 1287–1335. http://doi.org/10.1086/228667
Valente, T. W. (1995). "Network models of the diffusion of innovations" (2nd ed.). Cresskill N.J.: Hampton Press.
Other statistics: bass
,
classify_adopters
,
cumulative_adopt_count
, dgr
,
ego_variance
, exposure
,
hazard_rate
, infection
,
moran
, threshold
,
vertex_covariate_dist
# Computing structural equivalence for the fakedata ------------------------- data(fakesurvey) # Coercing it into a diffnet object fakediffnet <- survey_to_diffnet( fakesurvey, "id", c("net1", "net2", "net3"), "toa", "group" ) # Computing structural equivalence without specifying group se_all <- struct_equiv(fakediffnet) # Notice that pairs of individuals from different communities have # non-zero values se_all#> Structural equivalence for a dynamic graph #> # nodes : 9 #> # of slices: 5 #> Access elements via [[nslice]]$ (as a nested list). Available elements are: #> - SE : Structural equivalence matrix (n x n) #> - d : Euclidean distances matrix (n x n) #> - gdist : Geodesic distances matrix (n x n)se_all[[1]]$SE#> 1 2 3 4 5 6 7 #> 1 0.000000000 0.40637925 0.2675568 0.0000000 0.08716001 0.05961925 0.07782794 #> 2 0.300678588 0.00000000 0.3624250 0.0000000 0.11623101 0.05485627 0.08458183 #> 3 0.034034875 0.50252488 0.0000000 0.0000000 0.32312115 0.03403487 0.10628421 #> 4 0.000000000 0.14698274 0.2366860 0.0000000 0.42669042 0.04731519 0.06403113 #> 5 0.000000000 0.12827358 0.2291256 0.2851207 0.00000000 0.08917249 0.10811028 #> 6 0.004813427 0.08242531 0.1173887 0.0000000 0.08242531 0.00000000 0.23764908 #> 7 0.005232795 0.09061077 0.1301072 0.0000000 0.09061077 0.24005932 0.00000000 #> 8 0.004437869 0.07562027 0.1073283 0.0000000 0.07562027 0.22689057 0.21056308 #> 9 0.004437869 0.07562027 0.1073283 0.0000000 0.07562027 0.22689057 0.21056308 #> 8 9 #> 1 0.05072838 0.05072838 #> 2 0.04061364 0.04061364 #> 3 0.00000000 0.00000000 #> 4 0.03914726 0.03914726 #> 5 0.08009869 0.08009869 #> 6 0.23764908 0.23764908 #> 7 0.22168955 0.22168955 #> 8 0.00000000 0.29953960 #> 9 0.29953960 0.00000000# ... Now specifying a groupvar se_group <- struct_equiv(fakediffnet, groupvar="group") # Notice that pairs of individuals from different communities have # only zero values. se_group#> Structural equivalence for a dynamic graph #> # nodes : 9 #> # of slices: 5 #> Access elements via [[nslice]]$ (as a nested list).


| vec_detect_complete {vctrs} | R Documentation |
vec_detect_complete()
detects "complete" observations. An observation is
considered complete if it is non-missing. For most vectors, this implies that
vec_detect_complete(x) == !vec_equal_na(x)
.
For data frames and matrices, a row is only considered complete if all
elements of that row are non-missing. To compare, !vec_equal_na(x)
detects
rows that are partially complete (they have at least one non-missing value).
vec_detect_complete(x)
x |
A vector |
A record type vector is considered complete if any field is non-missing.
A logical vector with the same size as x
.
x <- c(1, 2, NA, 4, NA) # For most vectors, this is identical to `!vec_equal_na(x)` vec_detect_complete(x) !vec_equal_na(x) df <- data_frame( x = x, y = c("a", "b", NA, "d", "e") ) # This returns `TRUE` where all elements of the row are non-missing. # Compare that with `!vec_equal_na()`, which detects rows that have at # least one non-missing value. df2 <- df df2$all_non_missing <- vec_detect_complete(df) df2$any_non_missing <- !vec_equal_na(df) df2


Musician Barbado:
Thank you so much! You can find
Bard Swan
beneath the big tree in the center of the village. Please convince him to honor my request. I am sure you are capable of this.


Contributor of RADAnalytics.io and Open Data Hub projects
Leading Data Services initiatives throughout the organization
Principal Technical Support Engineer
SaoPaulo, BR
Provide front-line support for Red Hat Products, Middleware and Cloud products.
Specialties in IaaS and PaaS products and Java middleware.
Exceed customer expectations with outstanding customer service.
Consult with and develop relationships with in-house engineers and developers to drive creative solutions and improve customer satisfaction.
Contribute to global Red Hat knowledge management system in the process of working customer issues.
Senior Technical Support Engineer
SaoPaulo, BR
Provide technical support to customers by taking incoming calls and responding to web-based inquiries.
Perform diagnostics of problems, troubleshoot and develop solutions for customer issues.
Exceed customer expectations with outstanding customer service.
Consult with and develop relationships with in-house engineers and developers to drive creative solutions and improve customer satisfaction.
Contribute to global Red Hat knowledge management system in the process of working customer issues.
Working with Fuse products and OpenShift, a PaaS product from Red Hat
Technical Support Engineer
SaoPaulo, BR
Provide a high, detailed level of technical assistance to ensure that our customers get the most out of our JBoss products
Engage and collaborate with open source developers around the world
Offer developer-to-developer assistance for the JBoss Enterprise Middleware Suite
Work alongside in-house developers, write new code, fix & improve code, provide highly technical solutions and contribute to the JBoss & open source software communities
Act as the technical point person for a technology of your choosing within the JBoss Product Suite
Develop patches and feature requests to provide upstream to the community and downstream to customers
Advise customers on JEE architectural design decisions
Work with other open source projects to help customers integrate
IT Specialist
SaoPaulo, BR
Java Development using Websphere Portal, Hibernate and Struts.


Kuba-bootstrap
Components for mobile devices
Download
Version 0.0.1
Hi there
Page Transitions
Description
Fade Next
Slide Next
Flip Next
Fade To Last
Slide To Last
Flip To Last
Page 2
Description
Fade Next
Slide Next
Flip Next
Fade Back
Slide Back
Flip Back
Page 3
Description
Fade Back
Slide Back
Flip Back
Fade To First
Slide To First
Flip To First


So they saddled him the ass: and he rode thereon,


Scenario
The health care provider generates a report at the end of the day to get a complete medical details of all the patients, their doctors, and few other information. The reports allow the doctors to quickly identify if further medical advice is necessary.
Operation
The SQL/XML function XMLTABLE displays XML data in the relational format after XQuery expressions are evaluated.
Solution
The patient information which is stored in XML with medical history is extracted into a report. It can then be used for further treatment to the patient.
Best Practices
Use SQL/XML Functions if


Hello.  I live in San Diego, California.
I have accounts at the usual collection of social network sites, some of which I use more than others. If you know me then my Facebook profile may accept friend requests. But it's sufficiently buggy and insecure that I don't know from day to day how well locked down that is. I'm @wittyremarkhere on Twitter (see the feed below), which I mostly use for sciency things. I have a vague suspicion that LinkedIn will one day prove to be useful for something, but I don't really know what that might be yet. I have an intermittently-updated Tumblr. It's mostly my Instagram feed at the moment. And I have some pictures online at Flickr.


Tests that re-rendering input elements doesn't reset current display value, but value is set from state on initial render.
Note this is a typical scenario where it doesn't matter that input elements retain state that may be out of sync with with app state. The sync happens on input field change (onchange), not on each keypress.


{% extends 'email/base.html' %} {% block content %}
Your request to swap {{ shift }} for {{ swap_2 }} has be approved.
Login To View Your Calendar


Introduction to Databases
Class 1 - Data Modeling
Welcome!
Girl Develop It is here to provide affordable and accessible programs to learn software through mentorship and hands-on instruction.
Some “rules”
- We are here for you!
- Every question is important
- Help each other
- Have fun
Welcome!
Tell us about yourself.
- Who are you?
- What do you hope to get out of the class?
- What is your favorite hobby?
What to expect
- Class 1: Data modelling, relationships, brief into to relational databases and NoSQL databases
- Class 2: Introduction to SQL (retrieving data)
- Class 3: More advanced SQL (join; inserting, updating, and deleting data)
- Class 4: Creating and altering database structures + Advanced Topics
What is data modeling?
- First step in database design and object oriented programming
- Goal is to create a conceptual model of how data relate to each other
- Exploratory process that progresses from:
- Conceptual Models - high level domain models
- Logical Data Models - describe logical entities and relationships
- Physical Data Models - used to design internal database schemas
Kinds of data
-
Strings
any sequence of characters (letters, numbers, symbols, whitespace), must be quoted
- Numbers
-
Integers (int)
whole numbers, can be negative, there’s an upper limit
-
Doubles / Floating point
decimals, details depend on system/language
-
Bigints / Longs
whole numbers beyond the limit of regular integers; there’s still an upper limit, though
-
Boolean / Bit
true or false; 1 or 0
-
Arrays
Ordered lists; can contain anything
-
Objects
A collection of key-value pairs
Kinds of data
-
Strings
- names ("Mr. Teddy")
- addresses ("1415 S. Congress Ave.")
- Numbers
-
Integers (int)
- ages (35)
- quantities (14)
-
Doubles / Floating point
- currency (19.99)
- GPS data (30.251163, -97.748949)
-
Bigints / Longs
Kinds of data
-
Boolean / Bit
- flags (shared: true, draft: false)
-
Arrays
- can be anything!
- random: ["Hello", 27, "Arugula"]
- albums owned: ["Oceanborn", "A Fever You Can't Sweat Out"]
-
Objects
A collection of key-value pairs
An example Person object
{
"date_of_birth": "1989-09-04"
"weight_in_lbs" : "180",
"favorite_foods" : [
"Wine",
"Polenta",
"Cake"
],
"favorite_books" : [
{
"title": "Waiting for Godot",
"author" : "Samuel Beckett"
}, {
"title" : "Falling Up",
"author" : "Shel Silverstein"
}
]
}
Data is often hierarchical
Often, data is nested in hierarchies of objects within objects.
For example, lists can contain objects, like in our person object.
Methods of storing
- Plain Text (.txt)
- CSV (.csv)
- JSON (JavaScript Object Notation)
- Relational Database
(e.g., MySQL, PostgreSQL, SQL Server, Oracle)
- Non-Relational Database
(e.g., MongoDB, Cassandra, Neo4j)
What we get with nested data
band = {
"name": "The Who",
"formed": "1964",
"style": "rock",
"frontman": "Pete Townshend"
"drummer": "Keith Moon"
"popular_album": "Tommy"
}
Might not be as helpful as...
band = {
"name": "The Who",
"year_formed": "1964",
"musical_styles": ["rock", "power pop", "hard rock"]
"members": [
{
"name": "Pete Townshend",
"position": "frontman",
"tenure_start": "1964",
"tenure_end": null
},
{
"name": "Keith Moon",
"position": "drummer",
"tenure_start": "1964",
"tenure_end": "1978"
}, ...
]
"discography": [
{
"title": "Tommy",
"release_date": "1969-05-23",
"tracks": ["Pinball Wizard", "Smash the Mirror", ...],
"num_certified_sales_usa": 2000000,
"num_certified_sales_france": 174300
}, ...
]
}
This is not academic
The data you have and the format it’s in
informs what questions you can answer and potentially how quickly you can answer them.
band = {
"name": "The Who",
"formed": "1964",
"style": "rock",
"frontman": "Pete Townshend"
"drummer": "Keith Moon"
"popular_album": "Tommy"
}
band = {
"name": "The Who",
"year_formed": "1964",
"musical_styles": ["rock", "power pop", "hard rock"]
"members": [
{
"name": "Pete Townshend",
"position": "frontman",
"tenure_start": "1964",
"tenure_end": null
},
{
"name": "Keith Moon",
"position": "drummer",
"tenure_start": "1964",
"tenure_end": "1978"
}, ...
]
"discography": [
{
"title": "Tommy",
"release_date": "1969-05-23",
"tracks": ["Pinball Wizard", "Smash the Mirror", ...],
"num_certified_sales_usa": 2000000,
"num_certified_sales_france": 174300
}, ...
]
}
Modelling teddy bears
Grab a partner and create a schema
(data model) for a teddy bear!
It’s not super important to get the format or syntax perfectly correct.
We’re more interested in getting to grips with the schema.
If you’d like an assist with the syntax and organization, feel
free to use a JSON parser.
Things to think about
- What properties do each of these teddy bears have?
- How are they different?
- What makes them different in the same way?
- What information is useful? Not useful?
-
What kind of information would someone be interested in if
they were looking for a teddy bear?
Does your model change if we add this teddy bear in?
How about if we add this guy?
Teddy bears are so 1902.
This is the new hotness.
Does this change your model?
Thoughts
-
Looking only at the teddy bears, did your data model have to change to accomodate the third and fourth bears?
- What were the reprecussions of assuming everything in the data store
was going to be a teddy bear?
-
Did you have to shoehorn in the narwhal plushie?
Or did it fit pretty well into the original model?
- Did you have to add data?
- Did you have to remove data?
- Did you have to shuffle data around?
- What would those changes mean to someone using your data store?
- Is a more abstracted/generalized model better or worse than a less generalized one? Why?
An example schema
london_bear = {
"type": "teddy bear"
"name": "Lord Ickenham",
"height": 6,
"width": 4,
"fabric_types": [
"mohair",
"velveteen"
],
"price": 9.99,
"colors": [
"tan",
"blue",
"red",
"white",
"silver"
],
"manufacturer": "UK Teddies",
"theme": "London",
"num_limbs": 4,
"num_protrusions": 0
}
narwhal = {
"type": "narwhal plushie"
"name": "Boris",
"height": 7,
"width": 7,
"fabric_types": [
"soft fuzz"
],
"price": 14.95,
"colors": [
"ice blue",
"green"
...
],
"manufacturer": "Squishables",
"theme": "ocean",
"num_limbs": 0,
"num_protrusions": 1
}
There are no right answers, only less terrible ones.
You’re making a judgement call based on the information
you have available and your previous experiences.
The Great Balancing Act
- What data do you need? What data is irrelevant?
Slogging through unnecessary data makes processing slow.
- What’s related? Can those pieces be grouped together?
Putting related information together makes it easier to
reason about and can potentionally increase processing efficiency.
- How hard will it be to update an existing schema?
Data models are rarely static.
What are things you’ll most likely need to update in the
future and how hard will it be to do that with the model
you’re currently considering?
the great balancing act
It’s a balancing act. Databases are notoriously
difficult and risky to migrate. So it is good to make deliberate, informed,
and rational decisions about what your data needs are now and what they will
likely be in the immediate future. Remember, too, that over-architecting can be dangerous.
But there are no crystal balls. At some point, you need to make a decision
and roll with it.
Let’s talk about relationships.
Types of Relationships
-
One-to-One
A car model is made by one company.
-
One-to-Many
One class has many students.
-
Many-to-One
Many employees work in one department (or many students are in a single class).
-
Many-to-Many
An author can write many books, and a book can be written by many authors.
Group Exercise!
What’s the relationship between food and recipes?
Things to think about
- What things (objects) am I dealing with? What does it mean to be each one of those objects?
- If I split these objects up, what does that mean for related data?
- Are the objects related? If so, what kind of relationship am I dealing with? What does that mean for related data?
- Is there an implicit or explicit hierarchy in the data? What does that mean for sub-objects? For related data?
- Will this allow me to do more things later, or restrict what I can do later?
How to I translate that into database talk?
In a relational database
In a document store (non-relational database)
What are relational dbs and what do they get me?
- Mature (read: been around for a while) and still widely used
- Model relationships between data
- Allow you to put constraints on your data
(e.g., any order that is placed in the system must belong to an existing user)
- ACID (Atomicity, Consistency, Isolation, Durability)
- Usually, a poor choice for a distributed system
- They use a dialect of SQL (Structured Query Language)
What about NoSQL dbs?
- There are many different kinds of non-relational databases
- aggregate databases
- document stores (e.g., MongoDB)
- column family (e.g., Cassandra)
- key-value stores (e.g., Project Voldemort)
- graph databases (e.g., Neo4j)
- Ideal for clusters, distributed systems, and/or large-scale data.
- BASE (Basically Available, Soft state, Eventual consistency)
- Schema-less, so you might not always have the data you expect
- Faster development?
- Range of interface languages
In an RDB
-
In a RDBMS, entity types generally correspond to tables.
For example, a user authentication database might contain tables for
users, accounts, and authentication tokens.
-
A collection of related entity types and associated helper objects
(e.g., functions, stored procedures, triggers) constitute a database.
-
Just like the data we’ve been modelling, the data in tables can be of
different types— integers, strings,
doubles or decimals, etc.— although most RDBs
use different names.
common data types for RDBs
varchar(n)
similar to strings (“character varying”).
You can specify the maximum number of characters the field can have,
e.g., varchar(128) will give you a string field
that allows a maximum of 128 characters.
text, longtext, clob
Used for very long strings. The details will depend on the RDB used,
but generally the allowed size of these strings is from 2-4 GB.
bit, boolean
T/F values. In most RDBs, this is represented by 0s and 1s.
int
integer values (whole numbers)
bigint
bigger integer values than what is allowed by int.
Used for primary keys.
double precision, real, double, float, float(n)
Decimal numbers. Some RDBs will let you specify the degree of
precision— float(24). Details will vary.
date, time, datetime, timestamp
Details will vary on which RDB you’re using.
Other possible data types
Depending on what RDB you’re using,
you may have access to some or all of the following:
- smallint
- serial
- geometric data types (polygon, circle, path)
- geographic data types (latitudes, longitudes)
- text vectors (used in NLP)
- currency, money
- uuid, guid
- xml
- json
An example recipe database
A note on IDs
-
In the recipe example, we assigned an id to each ingredient.
-
This id is unique across the entity type or table
(e.g., ingredient).
-
The column containing the id
is often referred to as the primary key of the table.
Oftentimes, the column is set as serial or auto increment,
which means that the database will take care of making sure that
each new record gets a unique id.
-
Then we can refer to the ingredient by that unique id, instead of
entering the name of the ingredient over and over again.
-
This is the most common way to refer to items in relational databases.
(Occassionally, you will see people use a composite key.)
-
Why do you think we use ids?
Let’s develop it!
Modeling Movies
Making movies takes lots of relationships! We’ll focus on
actors, producers, and studios.
We don’t want to duplicate data, so let’s form some relationships!
First, create a new file, called movies.json.
Start with three arrays with four or more objects:
Movies = [{}, {}, {}, {}]
Actors = [{}, {}, {}, {}]
Studios = [{}, {}, {}, {}]
Let’s develop it!
Modeling Movies
Let’s focus on modelling these four movies:
Let’s develop it!
Modeling Movies
- Since there are a lot of actors, only list the top-billed ones.
-
Simplify the studios. For example, don’t distinguish
between Universal Studios and Universal Studios France. We’re not IMDB ☺
- Remember to use ids! Give each entity a unique id and use that id to refer to the object when necessary.
- Feel free to grab a partner!


#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
import logging # isort:skip
log = logging.getLogger(__name__)
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
import warnings
# Bokeh imports
from ..core.has_props import abstract
from ..core.properties import (
JSON,
Any,
Bool,
ColumnData,
Dict,
Enum,
Instance,
Int,
List,
PandasDataFrame,
PandasGroupBy,
Seq,
String,
)
from ..model import Model
from ..util.dependencies import import_optional
from ..util.serialization import convert_datetime_array
from ..util.warnings import BokehUserWarning
from .callbacks import CustomJS
from .filters import Filter
from .selections import Selection, SelectionPolicy, UnionRenderers
pd = import_optional('pandas')
#-----------------------------------------------------------------------------
# Globals and constants
#-----------------------------------------------------------------------------
__all__ = (
'AjaxDataSource',
'CDSView',
'ColumnarDataSource',
'ColumnDataSource',
'DataSource',
'GeoJSONDataSource',
'ServerSentDataSource',
'WebSource',
)
#-----------------------------------------------------------------------------
# General API
#-----------------------------------------------------------------------------
@abstract
class DataSource(Model):
''' A base class for data source types.
'''
selected = Instance(Selection, default=lambda: Selection(), readonly=True, help="""
An instance of a ``Selection`` that indicates selected indices on this ``DataSource``.
This is a read-only property. You may only change the attributes of this object
to change the selection (e.g., ``selected.indices``).
""")
@abstract
class ColumnarDataSource(DataSource):
''' A base class for data source types, which can be mapped onto
a columnar format.
'''
selection_policy = Instance(SelectionPolicy, default=lambda: UnionRenderers(), help="""
An instance of a ``SelectionPolicy`` that determines how selections are set.
""")
class ColumnDataSource(ColumnarDataSource):
''' Maps names of columns to sequences or arrays.
The ``ColumnDataSource`` is a fundamental data structure of Bokeh. Most
plots, data tables, etc. will be driven by a ``ColumnDataSource``.
If the ``ColumnDataSource`` initializer is called with a single argument that
can be any of the following:
* A Python ``dict`` that maps string names to sequences of values, e.g.
lists, arrays, etc.
.. code-block:: python
data = {'x': [1,2,3,4], 'y': np.ndarray([10.0, 20.0, 30.0, 40.0])}
source = ColumnDataSource(data)
.. note::
``ColumnDataSource`` only creates a shallow copy of ``data``. Use e.g.
``ColumnDataSource(copy.deepcopy(data))`` if initializing from another
``ColumnDataSource.data`` object that you want to keep independent.
* A Pandas ``DataFrame`` object
.. code-block:: python
source = ColumnDataSource(df)
In this case the CDS will have columns corresponding to the columns of
the ``DataFrame``. If the ``DataFrame`` columns have multiple levels,
they will be flattened using an underscore (e.g. level_0_col_level_1_col).
The index of the ``DataFrame`` will be flattened to an ``Index`` of tuples
if it's a ``MultiIndex``, and then reset using ``reset_index``. The result
will be a column with the same name if the index was named, or
level_0_name_level_1_name if it was a named ``MultiIndex``. If the
``Index`` did not have a name or the ``MultiIndex`` name could not be
flattened/determined, the ``reset_index`` function will name the index column
``index``, or ``level_0`` if the name ``index`` is not available.
* A Pandas ``GroupBy`` object
.. code-block:: python
group = df.groupby(('colA', 'ColB'))
In this case the CDS will have columns corresponding to the result of
calling ``group.describe()``. The ``describe`` method generates columns
for statistical measures such as ``mean`` and ``count`` for all the
non-grouped original columns. The CDS columns are formed by joining
original column names with the computed measure. For example, if a
``DataFrame`` has columns ``'year'`` and ``'mpg'``. Then passing
``df.groupby('year')`` to a CDS will result in columns such as
``'mpg_mean'``
If the ``GroupBy.describe`` result has a named index column, then
CDS will also have a column with this name. However, if the index name
(or any subname of a ``MultiIndex``) is ``None``, then the CDS will have
a column generically named ``index`` for the index.
Note this capability to adapt ``GroupBy`` objects may only work with
Pandas ``>=0.20.0``.
.. note::
There is an implicit assumption that all the columns in a given
``ColumnDataSource`` all have the same length at all times. For this
reason, it is usually preferable to update the ``.data`` property
of a data source "all at once".
'''
data = ColumnData(String, Seq(Any), help="""
Mapping of column names to sequences of data. The columns can be, e.g,
Python lists or tuples, NumPy arrays, etc.
The .data attribute can also be set from Pandas DataFrames or GroupBy
objects. In these cases, the behaviour is identical to passing the objects
to the ``ColumnDataSource`` initializer.
""").accepts(
PandasDataFrame, lambda x: ColumnDataSource._data_from_df(x)
).accepts(
PandasGroupBy, lambda x: ColumnDataSource._data_from_groupby(x)
).asserts(lambda _, data: len({len(x) for x in data.values()}) <= 1,
lambda obj, name, data: warnings.warn(
"ColumnDataSource's columns must be of the same length. " +
"Current lengths: %s" % ", ".join(sorted(str((k, len(v))) for k, v in data.items())), BokehUserWarning))
def __init__(self, *args, **kw):
''' If called with a single argument that is a dict or
``pandas.DataFrame``, treat that implicitly as the "data" attribute.
'''
if len(args) == 1 and "data" not in kw:
kw["data"] = args[0]
# TODO (bev) invalid to pass args and "data", check and raise exception
raw_data = kw.pop("data", {})
if not isinstance(raw_data, dict):
if pd and isinstance(raw_data, pd.DataFrame):
raw_data = self._data_from_df(raw_data)
elif pd and isinstance(raw_data, pd.core.groupby.GroupBy):
raw_data = self._data_from_groupby(raw_data)
else:
raise ValueError("expected a dict or pandas.DataFrame, got %s" % raw_data)
super().__init__(**kw)
self.data.update(raw_data)
@property
def column_names(self):
''' A list of the column names in this data source.
'''
return list(self.data)
@staticmethod
def _data_from_df(df):
''' Create a ``dict`` of columns from a Pandas ``DataFrame``,
suitable for creating a ColumnDataSource.
Args:
df (DataFrame) : data to convert
Returns:
dict[str, np.array]
'''
_df = df.copy()
# Flatten columns
if isinstance(df.columns, pd.MultiIndex):
try:
_df.columns = ['_'.join(col) for col in _df.columns.values]
except TypeError:
raise TypeError('Could not flatten MultiIndex columns. '
'use string column names or flatten manually')
# Transform columns CategoricalIndex in list
if isinstance(df.columns, pd.CategoricalIndex):
_df.columns = df.columns.tolist()
# Flatten index
index_name = ColumnDataSource._df_index_name(df)
if index_name == 'index':
_df.index = pd.Index(_df.index.values)
else:
_df.index = pd.Index(_df.index.values, name=index_name)
_df.reset_index(inplace=True)
tmp_data = {c: v.values for c, v in _df.items()}
new_data = {}
for k, v in tmp_data.items():
new_data[k] = v
return new_data
@staticmethod
def _data_from_groupby(group):
''' Create a ``dict`` of columns from a Pandas ``GroupBy``,
suitable for creating a ``ColumnDataSource``.
The data generated is the result of running ``describe``
on the group.
Args:
group (GroupBy) : data to convert
Returns:
dict[str, np.array]
'''
return ColumnDataSource._data_from_df(group.describe())
@staticmethod
def _df_index_name(df):
''' Return the Bokeh-appropriate column name for a ``DataFrame`` index
If there is no named index, then `"index" is returned.
If there is a single named index, then ``df.index.name`` is returned.
If there is a multi-index, and the index names are all strings, then
the names are joined with '_' and the result is returned, e.g. for a
multi-index ``['ind1', 'ind2']`` the result will be "ind1_ind2".
Otherwise if any index name is not a string, the fallback name "index"
is returned.
Args:
df (DataFrame) : the ``DataFrame`` to find an index name for
Returns:
str
'''
if df.index.name:
return df.index.name
elif df.index.names:
try:
return "_".join(df.index.names)
except TypeError:
return "index"
else:
return "index"
@classmethod
def from_df(cls, data):
''' Create a ``dict`` of columns from a Pandas ``DataFrame``,
suitable for creating a ``ColumnDataSource``.
Args:
data (DataFrame) : data to convert
Returns:
dict[str, np.array]
'''
return cls._data_from_df(data)
@classmethod
def from_groupby(cls, data):
''' Create a ``dict`` of columns from a Pandas ``GroupBy``,
suitable for creating a ``ColumnDataSource``.
The data generated is the result of running ``describe``
on the group.
Args:
data (Groupby) : data to convert
Returns:
dict[str, np.array]
'''
return cls._data_from_df(data.describe())
def to_df(self):
''' Convert this data source to pandas ``DataFrame``.
Returns:
DataFrame
'''
if not pd:
raise RuntimeError('Pandas must be installed to convert to a Pandas Dataframe')
return pd.DataFrame(self.data)
def add(self, data, name=None):
''' Appends a new column of data to the data source.
Args:
data (seq) : new data to add
name (str, optional) : column name to use.
If not supplied, generate a name of the form "Series ####"
Returns:
str: the column name used
'''
if name is None:
n = len(self.data)
while "Series %d"%n in self.data:
n += 1
name = "Series %d"%n
self.data[name] = data
return name
def remove(self, name):
''' Remove a column of data.
Args:
name (str) : name of the column to remove
Returns:
None
.. note::
If the column name does not exist, a warning is issued.
'''
try:
del self.data[name]
except (ValueError, KeyError):
warnings.warn("Unable to find column '%s' in data source" % name)
def stream(self, new_data, rollover=None):
''' Efficiently update data source columns with new append-only data.
In cases where it is necessary to update data columns in, this method
can efficiently send only the new data, instead of requiring the
entire data set to be re-sent.
Args:
new_data (dict[str, seq]) : a mapping of column names to sequences of
new data to append to each column.
All columns of the data source must be present in ``new_data``,
with identical-length append data.
rollover (int, optional) : A maximum column size, above which data
from the start of the column begins to be discarded. If None,
then columns will continue to grow unbounded (default: None)
Returns:
None
Raises:
ValueError
Example:
.. code-block:: python
source = ColumnDataSource(data=dict(foo=[], bar=[]))
# has new, identical-length updates for all columns in source
new_data = {
'foo' : [10, 20],
'bar' : [100, 200],
}
source.stream(new_data)
'''
# calls internal implementation
self._stream(new_data, rollover)
def _stream(self, new_data, rollover=None, setter=None):
''' Internal implementation to efficiently update data source columns
with new append-only data. The internal implementation adds the setter
attribute. [https://github.com/bokeh/bokeh/issues/6577]
In cases where it is necessary to update data columns in, this method
can efficiently send only the new data, instead of requiring the
entire data set to be re-sent.
Args:
new_data (dict[str, seq] or DataFrame or Series) : a mapping of
column names to sequences of new data to append to each column,
a pandas DataFrame, or a pandas Series in case of a single row -
in this case the Series index is used as column names
All columns of the data source must be present in ``new_data``,
with identical-length append data.
rollover (int, optional) : A maximum column size, above which data
from the start of the column begins to be discarded. If None,
then columns will continue to grow unbounded (default: None)
setter (ClientSession or ServerSession or None, optional) :
This is used to prevent "boomerang" updates to Bokeh apps.
(default: None)
In the context of a Bokeh server application, incoming updates
to properties will be annotated with the session that is
doing the updating. This value is propagated through any
subsequent change notifications that the update triggers.
The session can compare the event setter to itself, and
suppress any updates that originate from itself.
Returns:
None
Raises:
ValueError
Example:
.. code-block:: python
source = ColumnDataSource(data=dict(foo=[], bar=[]))
# has new, identical-length updates for all columns in source
new_data = {
'foo' : [10, 20],
'bar' : [100, 200],
}
source.stream(new_data)
'''
needs_length_check = True
if pd and isinstance(new_data, pd.Series):
new_data = new_data.to_frame().T
if pd and isinstance(new_data, pd.DataFrame):
needs_length_check = False # DataFrame lengths equal by definition
_df = new_data
newkeys = set(_df.columns)
index_name = ColumnDataSource._df_index_name(_df)
newkeys.add(index_name)
new_data = dict(_df.items())
new_data[index_name] = _df.index.values
else:
newkeys = set(new_data.keys())
oldkeys = set(self.data.keys())
if newkeys != oldkeys:
missing = oldkeys - newkeys
extra = newkeys - oldkeys
if missing and extra:
raise ValueError(
"Must stream updates to all existing columns (missing: %s, extra: %s)" % (", ".join(sorted(missing)), ", ".join(sorted(extra)))
)
elif missing:
raise ValueError("Must stream updates to all existing columns (missing: %s)" % ", ".join(sorted(missing)))
else:
raise ValueError("Must stream updates to all existing columns (extra: %s)" % ", ".join(sorted(extra)))
import numpy as np
if needs_length_check:
lengths = set()
arr_types = (np.ndarray, pd.Series) if pd else np.ndarray
for k, x in new_data.items():
if isinstance(x, arr_types):
if len(x.shape) != 1:
raise ValueError("stream(...) only supports 1d sequences, got ndarray with size %r" % (x.shape,))
lengths.add(x.shape[0])
else:
lengths.add(len(x))
if len(lengths) > 1:
raise ValueError("All streaming column updates must be the same length")
# slightly awkward that we have to call convert_datetime_array here ourselves
# but the downstream code expects things to already be ms-since-epoch
for key, values in new_data.items():
if pd and isinstance(values, (pd.Series, pd.Index)):
values = values.values
old_values = self.data[key]
# Apply the transformation if the new data contains datetimes
# but the current data has already been transformed
if (isinstance(values, np.ndarray) and values.dtype.kind.lower() == 'm' and
isinstance(old_values, np.ndarray) and old_values.dtype.kind.lower() != 'm'):
new_data[key] = convert_datetime_array(values)
else:
new_data[key] = values
self.data._stream(self.document, self, new_data, rollover, setter)
def patch(self, patches, setter=None):
''' Efficiently update data source columns at specific locations
If it is only necessary to update a small subset of data in a
``ColumnDataSource``, this method can be used to efficiently update only
the subset, instead of requiring the entire data set to be sent.
This method should be passed a dictionary that maps column names to
lists of tuples that describe a patch change to apply. To replace
individual items in columns entirely, the tuples should be of the
form:
.. code-block:: python
(index, new_value) # replace a single column value
# or
(slice, new_values) # replace several column values
Values at an index or slice will be replaced with the corresponding
new values.
In the case of columns whose values are other arrays or lists, (e.g.
image or patches glyphs), it is also possible to patch "subregions".
In this case the first item of the tuple should be a whose first
element is the index of the array item in the CDS patch, and whose
subsequent elements are integer indices or slices into the array item:
.. code-block:: python
# replace the entire 10th column of the 2nd array:
+----------------- index of item in column data source
|
| +--------- row subindex into array item
| |
| | +- column subindex into array item
V V V
([2, slice(None), 10], new_values)
Imagining a list of 2d NumPy arrays, the patch above is roughly
equivalent to:
.. code-block:: python
data = [arr1, arr2, ...] # list of 2d arrays
data[2][:, 10] = new_data
There are some limitations to the kinds of slices and data that can
be accepted.
* Negative ``start``, ``stop``, or ``step`` values for slices will
result in a ``ValueError``.
* In a slice, ``start > stop`` will result in a ``ValueError``
* When patching 1d or 2d subitems, the subitems must be NumPy arrays.
* New values must be supplied as a **flattened one-dimensional array**
of the appropriate size.
Args:
patches (dict[str, list[tuple]]) : lists of patches for each column
Returns:
None
Raises:
ValueError
Example:
The following example shows how to patch entire column elements. In this case,
.. code-block:: python
source = ColumnDataSource(data=dict(foo=[10, 20, 30], bar=[100, 200, 300]))
patches = {
'foo' : [ (slice(2), [11, 12]) ],
'bar' : [ (0, 101), (2, 301) ],
}
source.patch(patches)
After this operation, the value of the ``source.data`` will be:
.. code-block:: python
dict(foo=[11, 12, 30], bar=[101, 200, 301])
For a more comprehensive complete example, see :bokeh-tree:`examples/howto/patch_app.py`.
'''
import numpy as np
extra = set(patches.keys()) - set(self.data.keys())
if extra:
raise ValueError("Can only patch existing columns (extra: %s)" % ", ".join(sorted(extra)))
for name, patch in patches.items():
col_len = len(self.data[name])
for ind, value in patch:
# integer index, patch single value of 1d column
if isinstance(ind, int):
if ind > col_len or ind < 0:
raise ValueError("Out-of bounds index (%d) in patch for column: %s" % (ind, name))
# slice index, patch multiple values of 1d column
elif isinstance(ind, slice):
_check_slice(ind)
if ind.stop is not None and ind.stop > col_len:
raise ValueError("Out-of bounds slice index stop (%d) in patch for column: %s" % (ind.stop, name))
# multi-index, patch sub-regions of "n-d" column
elif isinstance(ind, (list, tuple)):
if len(ind) == 0:
raise ValueError("Empty (length zero) patch multi-index")
if len(ind) == 1:
raise ValueError("Patch multi-index must contain more than one subindex")
if not isinstance(ind[0], int):
raise ValueError("Initial patch sub-index may only be integer, got: %s" % ind[0])
if ind[0] > col_len or ind[0] < 0:
raise ValueError("Out-of bounds initial sub-index (%d) in patch for column: %s" % (ind, name))
if not isinstance(self.data[name][ind[0]], np.ndarray):
raise ValueError("Can only sub-patch into columns with NumPy array items")
if len(self.data[name][ind[0]].shape) != (len(ind)-1):
raise ValueError("Shape mismatch between patch slice and sliced data")
elif isinstance(ind[0], slice):
_check_slice(ind[0])
if ind[0].stop is not None and ind[0].stop > col_len:
raise ValueError("Out-of bounds initial slice sub-index stop (%d) in patch for column: %s" % (ind.stop, name))
# Note: bounds of sub-indices after the first are not checked!
for subind in ind[1:]:
if not isinstance(subind, (int, slice)):
raise ValueError("Invalid patch sub-index: %s" % subind)
if isinstance(subind, slice):
_check_slice(subind)
else:
raise ValueError("Invalid patch index: %s" % ind)
self.data._patch(self.document, self, patches, setter)
class CDSView(Model):
''' A view into a ``ColumnDataSource`` that represents a row-wise subset.
'''
filters = List(Instance(Filter), default=[], help="""
List of filters that the view comprises.
""")
source = Instance(ColumnarDataSource, help="""
The ``ColumnDataSource`` associated with this view. Used to determine
the length of the columns.
""")
class GeoJSONDataSource(ColumnarDataSource):
'''
'''
geojson = JSON(help="""
GeoJSON that contains features for plotting. Currently
``GeoJSONDataSource`` can only process a ``FeatureCollection`` or
``GeometryCollection``.
""")
@abstract
class WebSource(ColumnDataSource):
''' Base class for web column data sources that can update from data
URLs.
.. note::
This base class is typically not useful to instantiate on its own.
'''
adapter = Instance(CustomJS, help="""
A JavaScript callback to adapt raw JSON responses to Bokeh ``ColumnDataSource``
format.
If provided, this callback is executes immediately after the JSON data is
received, but before appending or replacing data in the data source. The
``CustomJS`` callback will receive the ``AjaxDataSource`` as ``cb_obj`` and
will receive the raw JSON response as ``cb_data.response``. The callback
code should return a ``data`` object suitable for a Bokeh ``ColumnDataSource``
(i.e. a mapping of string column names to arrays of data).
""")
max_size = Int(help="""
Maximum size of the data columns. If a new fetch would result in columns
larger than ``max_size``, then earlier data is dropped to make room.
""")
mode = Enum("replace", "append", help="""
Whether to append new data to existing data (up to ``max_size``), or to
replace existing data entirely.
""")
data_url = String(help="""
A URL to to fetch data from.
""")
class ServerSentDataSource(WebSource):
''' A data source that can populate columns by receiving server sent
events endpoints.
'''
class AjaxDataSource(WebSource):
''' A data source that can populate columns by making Ajax calls to REST
endpoints.
The ``AjaxDataSource`` can be especially useful if you want to make a
standalone document (i.e. not backed by the Bokeh server) that can still
dynamically update using an existing REST API.
The response from the REST API should match the ``.data`` property of a
standard ``ColumnDataSource``, i.e. a JSON dict that maps names to arrays
of values:
.. code-block:: python
{
'x' : [1, 2, 3, ...],
'y' : [9, 3, 2, ...]
}
Alternatively, if the REST API returns a different format, a ``CustomJS``
callback can be provided to convert the REST response into Bokeh format,
via the ``adapter`` property of this data source.
Initial data can be set by specifying the ``data`` property directly.
This is necessary when used in conjunction with a ``FactorRange``, even
if the columns in `data`` are empty.
A full example can be seen at :bokeh-tree:`examples/howto/ajax_source.py`
'''
polling_interval = Int(help="""
A polling interval (in milliseconds) for updating data source.
""")
method = Enum('POST', 'GET', help="""
Specify the HTTP method to use for the Ajax request (GET or POST)
""")
if_modified = Bool(False, help="""
Whether to include an ``If-Modified-Since`` header in Ajax requests
to the server. If this header is supported by the server, then only
new data since the last request will be returned.
""")
content_type = String(default='application/json', help="""
Set the "contentType" parameter for the Ajax request.
""")
http_headers = Dict(String, String, help="""
Specify HTTP headers to set for the Ajax request.
Example:
.. code-block:: python
ajax_source.headers = { 'x-my-custom-header': 'some value' }
""")
#-----------------------------------------------------------------------------
# Dev API
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Private API
#-----------------------------------------------------------------------------
def _check_slice(s):
if (s.start is not None and s.stop is not None and s.start > s.stop):
raise ValueError("Patch slices must have start < end, got %s" % s)
if (s.start is not None and s.start < 0) or \
(s.stop is not None and s.stop < 0) or \
(s.step is not None and s.step < 0):
raise ValueError("Patch slices must have non-negative (start, stop, step) values, got %s" % s)
#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------


Coffee-agri expo at Puliyarmala
by Staff ReporterThe Pre-VAIGA (Value Addition for Income Generation in Agriculture), a two-day
coffee-agriculture expo, organised by the Agriculture Department in association with the Wayanad Coffee Growers Association, will be held at the Krishna Gowder Hall, Puliyarmala, on Saturday and Sunday.
Agriculture Minister V.S. Sunil Kumar will inaugurate the programme, which is being organised in connection with the fourth edition of VAIGA, an international workshop and expo to be held in Thrissur from January 4 to January 8 .
Various programmes including seminars, exhibition and entrepreneurs meet will be held in connection with the expo.
The concluding ceremony will be inaugurated by Irrigation Minister K. Krishnan Kutty on Sunday, organisers said in a release here.