TPCC Consistency constraint verification SQLs

TPCC Consistency constraint verification SQLs
The following is a verification of Consistency’s 12 SQL according to the TPCC standard. When each SQL returns Empty Sets, this verification is approved.
All of the following SQL is successfully executed under MySQL + TNT engine + TPCC-MySQL + 10-warehouses.
In addition to Condition 10, 11, and 12, the final SQL failed to write successfully.
).
Consistency Conditions
– — – —
Consistency Condition 1 –
– — – — –
– Entries in the WAREHOUSE and DISTRICT tables must satisfy the relationship:
– W_YTD = sum (D_YTD)
– for each warehouse defined by (W_ID = D_W_ID).
— — — — — — — — — —
Select *
From
        (select t1.w_id, t1.w_ytd, sum (t2.d_ytd), t1.w_ytd – sum (sum)
        from warehouse T1, district T2
        where t1.w_id = t2.d_w_id
        group by w_id) T3
Where diff! = 2700000;
Note 1
Because of the open source test tool provided by Percona MySQL TPCC, it is wrong when loading warehouse table data. The w_ytd column initialization should be 300000 according to the standard, while the Percona TPCC tool is loaded to 3000000. Therefore, this SQL is inconsistent with the requirements of Consistency Condition 1. Under 10-warehouses, the gap between the two is 2700000.
– — – – –
Consistency Condition 2
– – — – — – – –
– Entries in the DISTRICT, ORDER, and NEW-ORDER tables must satisfy the the
– D_NEXT_O_ID – 1 = max (O_ID) = max (NO_O_ID)
For each district defined by (D_W_ID = O_W_ID = NO_W_ID) and (D_ID = O_D_ID = NO_D_ID).
– This condition does not apply to the NEW-ORDER table for any for
– which have no outstanding new orders (i.e., the number of rows rows number).
— — — — — — — — — —
Select t1.d_w_id, t1.d_id, t1.max_o_id1, t2.max_o_id2, t3.max_o_id3
From
        (select d_w_id, d_id, d_next_o_id – 1 as max_o_id1)
        from district) T1,
        (select o_w_id, o_d_id, max (o_id) as max_o_id2
        from orders
        group by o_w_id, o_d_id) T2.
        (select no_w_id, no_d_id, max (no_o_id) as max_o_id3
        from new_orders
        group by no_w_id, no_d_id) T3
Where t1.d_w_id = t2.o_w_id
And t1.d_w_id = t3.no_w_id
And t1.d_id = t2.o_d_id
And t1.d_id = t3.no_d_id
And (t1.max_o_id1! = t2.max_o_id2 or t1.max_o_id1! = t3.max_o_id3 or t2.max_o_id2! = t3.max_o_id3);
– — – – –
Consistency Condition 3
– – — – — – – –
– Entries in the NEW-ORDER table must satisfy the relationship:
– max (NO_O_ID) – min (NO_O_ID) + 1 = [number of rows in the NEW-ORDER table NEW-ORDER
– for each district defined by NO_W_ID and NO_D_ID. This condition does condition
– any districts which have no outstanding new orders (i.e., the number the).
— — — — — — — — — —
Select t2.*, t2.maxmin – t2.tot
From (
        select t1.no_w_id, t1.no_d_id, max (no_o_id) – min (no_o_id) + 1, min, (())
        from new_orders T1
        group by t1.no_w_id, t1.no_d_id
) T2
Where t2.maxmin – t2.tot! = 0
Order by t2.no_w_id, t2.no_d_id;
– — – – –
Consistency Condition 4
– – — – — – – –
– Entries in the ORDER and ORDER-LINE tables must satisfy the relationship:
– sum (O_OL_CNT) = [number of rows in the ORDER-LINE table for this for
For each district defined by (O_W_ID = OL_W_ID) and (O_D_ID = OL_D_ID).
— — — — — — — — —
Select t1.o_w_id, t1.o_d_id, t1.tot_cnt, t2.tot, t1.tot_cnt – t2.tot
From
        (select o_w_id, o_d_id, sum (o_ol_cnt) as tot_cnt
        from orders
        group by o_w_id, o_d_id) T1.
        (select ol_w_id, ol_d_id, count (*) as tot
        from order_line
        group by ol_w_id, ol_d_id) T2
Where t1.o_w_id = t2.ol_w_id
And t1.o_d_id = t2.ol_d_id
And t1.tot_cnt – t2.tot! = 0
Order by t1.o_w_id, t1.o_d_id;
– — – – –
Consistency Condition 5
– – — – — – – –
– For any row in the ORDER table, O_CARRIER_ID is set to to
– there is a corresponding row in the NEW-ORDER table defined by
– (O_W_ID, O_D_ID, O_ID) = (NO_W_ID, NO_D_ID, NO_O_ID).
— — — — — — — — —
Select * from
        (select count (*) as tot_null_cnt1
        from orders
        where o_carrier_id is null) T3.
        (select count (*) as tot_null_cnt
        from orders T1, new_orders T2
        where t1.o_w_id = t2.no_w_id
        and t1.o_d_id = t2.no_d_id
        and t1.o_id = t2.no_o_id
        and t1.o_carrier_id is null) T4.
        (select count (*) as tot_not_null_cnt
        from orders T6, new_orders T7
        where t6.o_w_id = t7.no_w_id
        and t6.o_d_id = t7.no_d_id
        and t6.o_id = t7.no_o_id
        and t6.o_carrier_id is not null) T5
Where t4.tot_null_cnt – t3.tot_null_cnt1! = 0 or t5.tot_not_null_cnt = 0;
– — – – –
Consistency Condition 6
– – — – — – – –
– For any row in the ORDER table, O_OL_CNT must equal the the
– ORDER-LINE table for the corresponding order defined by
– (O_W_ID, O_D_ID, O_ID) = (OL_W_ID, OL_D_ID, OL_O_ID).
— — — — — — — — —
Select *
From
        (select t1.o_w_id, t1.o_d_id, t1.o_id, min (t1.o_ol_cnt) as as, (())
        from orders T1, order_line T2
        where t1.o_w_id = t2.ol_w_id
        and t1.o_d_id = t2.ol_d_id
        and t1.o_id = t2.ol_o_id
        group by t1.o_w_id, t1.o_d_id, t1.o_id) T3
Where min_ol_cnt! = ol_cnts;
– — – – –
Consistency Condition 7
– – — – — – – –
– For any row in the ORDER-LINE table, OL_DELIVERY_D is set to set
– if and only if the corresponding row in the ORDER table ORDER
– (O_W_ID, O_D_ID, O_ID) = (OL_W_ID, OL_D_ID, OL_O_ID) has O_CARRIER_ID set to a to
— — — — — — — — —
Select t1.o_w_id, t1.o_d_id, t1.o_id, t1.o_carrier_id, t2.ol_delivery_d
From orders T1, order_line T2
Where t1.o_w_id = t2.ol_w_id
And t1.o_d_id = t2.ol_d_id
And t1.o_id = t2.ol_o_id
And ((t1.o_carrier_id is null and t2.ol_delivery_d is not null)
        or (t1.o_carrier_id is not null and t2.ol_delivery_d and));
– — – – –
Consistency Condition 8
– – — – — – – –
– Entries in the WAREHOUSE and HISTORY tables must satisfy the relationship:
– W_YTD = sum (H_AMOUNT)
– for each warehouse defined by (W_ID = H_W_ID).
— — — — — — — — —
Select t1.w_id, t1.w_ytd, t2.sum_amount, t1.w_ytd – t2.sum_amount
From
        (select w_id, w_ytd from warehouse) T1,
        (select h_w_id, sum (h_amount) as sum_amount
        from history
        group by h_w_id) T2
Where t1.w_id = t2.h_w_id
And t1.w_ytd! = t2.sum_amount
And t1.w_ytd – t2.sum_amount! = 2700000;
Note two:
The reason is the same as Consistency Condition 1.
– — – – –
Consistency Condition 9
– – — – — – – –
– Entries in the DISTRICT and HISTORY tables must satisfy the relationship:
– D_YTD = sum (H_AMOUNT)
– for each district defined by (D_W_ID, D_ID) = (H_W_ID, H_D_ID).
— — — — — — — — —
Select t1.d_w_id, t1.d_id, t1.d_ytd, t2.sum_amount
From
        (select d_w_id, d_id, d_ytd from district) T1,
        (select h_w_id, h_d_id, sum (h_amount) as sum_amount
        from history
        group by h_w_id, h_d_id) T2
Where t1.d_w_id = t2.h_w_id
And t1.d_id = t2.h_d_id
And t1.d_ytd! = t2.sum_amount;
– — – – –
Consistency Condition 10
– — – — – —
– Entries in the CUSTOMER, HISTORY, ORDER, and ORDER-LINE tables must satisfy must
–         C_BALANCE = sum (OL_AMOUNT) – sum (H_AMOUNT)
– where:
–         H_AMOUNT is selected by (C_W_ID, C_D_ID, C_ID) = (F, l, c)
– and
–         OL_AMOUNT is selected by:
–         (OL_W_ID, OL_D_ID, OL_O_ID) = (O_W_ID, O_D_ID, O_ID) and
–         (O_W_ID, O_D_ID, O_C_ID) = (C_W_ID, C_D_ID, C_ID) and
–         (OL_DELIVERY_D is not a null value)
— — — — — — — — —
Select c_w_id, c_d_id, c_id,

Database kernel Sharing — the first phase

With the support of Fuyun coffee, the time and location of the first phase database kernel sharing has been confirmed as follows:
 
time
9.16 from 2:00 to 6:00 p.m.
 
place
Hangzhou Fuyun coffee (5 floor, Fudi business park, 628 Xixi Road, Xihu District) (Bauhinia Road, Bauhinia Road)
 
form
It’s free. (Fuyun coffee provides free lemonade. Of course, if you want to drink coffee, you still have to pay the bill yourself).
 
content
The implementation of InnoDB Buffer Pool is compared with Oracle Data Cache. It is helpful to introduce the complete InnoDB Buffer Pool implementation process and the corresponding implementation of the corresponding Oracle Data Cache to better understand InnoDB Buffer Pool and optimize Buffer Pool.
 
Enrolment method
At present, Fuyun coffee provides a conference room of about 50 free, and I hope to be able to count the number of people who will eventually participate. The friends you’re ready to attend can sign up for a micro-blog message, a private letter, a he.dengcheng@gmail.com, and a comment under this blog. (it’s best not to sign up many times, one form).
 
Because the content of sharing is close to the kernel realization of database, the knowledge reserve of database theory and practice is higher. So, I released PPT beforehand:
Buffer Pool Implementation InnoDB vs Oracle
You can see PPT first and then decide whether to join. Of course, if you understand it completely, welcome, and point out the problem of PPT; if I know half and half and welcome, I’ll try to answer the question. If I don’t understand it, I also welcome it. I hope you can get some knowledge of the implementation of the database kernel from it.
 
Database kernel sharing, I intend to make a series, mainly introduces the implementation of MySQL/InnoDB, supplemented by some Oracle/PostgreSQL comparison.
The first phase introduces the implementation of InnoDB Buffer Pool and the comparison of Oracle Data Cache.
The second phase is personal preparation to talk about InnoDB’s undo/redo/ rollback segment / transaction /crash recovery implementation.
If it goes smoothly, there will be third periods and fourth periods later. Introduce the implementation details of each module in the database kernel.
 
Finally, thanks again for the strong support of Fuyun coffee, and hope that the first phase will be successful and persist.
 

Database kernel Sharing — the first phase of PPT

 
The database kernel sharing, the first phase, the complete PPT of “Buffer Pool Implementation InnoDB vs Oracle”, details the implementation of Buffer Pool in InnoDB and Oracle, and the differences between the two implementations. For friends to understand how the two databases manage memory, a greater help!
 
Note 1
In this version, Peng Lixun made some notes, which is relatively easy to understand. Thank you, Li Xun!
 
Note 2
Because Slideshare has been walled up for a long time, friends in the wall can download this PPT through a micro disk address.
Micro disk download
 

Analysis of MySQL query optimization

 
This PPT briefly introduces query optimization of MySQL, focusing on range query optimization, including cost model, total table scan cost calculation, index range scanning cost calculation, statistical information, statistical information collection strategy, and MySQL optimization for query optimization module. I hope to have a good understanding of MySQL query.
 
Considering this PPT, the main content is MySQL range query optimization, so follow up I will optimize and expand the content of this PPT, optimize the existing content, add Join query optimization, and Oracle query optimization implementation of the part of the comparison.
The new PPT will share the third phase or the fourth phase of the communication in the kernel database of my organization. Please look forward to it.
!
 
Note 1:
Taking into account that SlideShare has been walled for a long time, the address of the PPT’s Micro disk is:
Micro disk download
 

Database related Sharing — large collection

Personal database sharing of some database kernel (PPT added)
:
 
MySQL InnoDB source code implementation analysis (1)
:
Micro disk address
 
MVCC (Oracle, Innodb, Postgres)
:
Micro disk address
 
InnoDB Transaction Lock and MVCC
:
Micro disk address
 
Buffer Pool Implementaion InnoDB vs Oracle (
Database kernel Sharing — the first phase
)
:
Micro disk address
 
Analysis of MySQL query optimization
(ALI technical Carnival – Beijing):
Micro disk address
 
InnoDB log rollback segment & crash recovery implementation details
(database kernel sharing – phase second): Micro disk address (to be added)
 
 

Database kernel sharing – second Preview

Preface
Good friends, everybody!
 
In September 16th, database kernel sharing – after the first phase, I made a notice that will continue to share the database kernel this year – the second phase.
 
Now, database kernel sharing – the second phase is late. The location of the sharing is still provided by Fuyun coffee. Thank them for their support.
 
Related matters
Database kernel sharing – the second issue is as follows:
 
time
From 2:00 to 6:00 p.m. on November 24th
 
place
Fuyun coffee, Hangzhou, 5 floor, Fudi business park, 628 Xixi Road, Xihu District (Bauhinia Road, Bauhinia Road)
 
In the same position as the first issue, friends who have participated in the first phase should not lose their way.
 
form
Free (Fuyun coffee provides free lemonade, of course, if you want to drink coffee, you still have to pay for yourself).
 
content
The implementation of InnoDB log / rollback segment / crash recovery is explained in detail. The first phase is a comparison between InnoDB and Oracle’s Buffer Pool. This period, let’s say goodbye to Oracle for the time being, and put our mind on the InnoDB engine. The sharing of this period will be described in detail as follows:
 
InnoDB’s log related content
What are the logs in InnoDB? How does the InnoDB’s DML operation record the log? Why are different Update operations much different in performance?
 
Redo detailed explanation of InnoDB
What kind of InnoDB Redo log? What is Mini-Transaction? What is the structure of Log Buffer and Log Block of InnoDB? How to calculate the corresponding log file location by LSN?
 
Undo detailed explanation of InnoDB
How is the rollback structure of the InnoDB organized? What are the types of the rollback page? How does the transaction and rollback segment interact? How do transactions commit, rollback, and Purge operations?
 
InnoDB crash recovery detailed solution
InnoDB crash recovery step? How to deal with Redo during the crash recovery process? How to deal with Undo? How do you rebuild all the transactions?
 
Enrolment method
Like the first issue, Fuyun coffee provides a conference room of about 50 free, and I hope to be able to count the number of people who will eventually participate. The friends who are ready to join can pass through
Micro-blog message
,
Private letter
,
Send mail
(he.dengcheng@gmail.com), and the way to post comments in this blog.
 
Of course, it can also be in
Sign up on the website of Fuyun coffee
The registration address is:
Registration address
 
Concluding remarks
Because the content of sharing is close to the kernel realization of database, the knowledge reserve of database theory and practice is higher. Therefore, friends who are prepared to participate in the study first learn some database bases, especially the database about log. Reference materials include the ARIES protocol of C. Mohan:
ARIES protocol
ARIES family
 
Or the phrase, if the second phase is also successful, then there are third, fourth, later… Introduce the implementation details of each module in the database kernel.
 
Finally, thank you again for your strong support from Fuyun coffee. We also hope that the second phase will be successful, and we will keep on doing it.

Quickly build SS server with Azure

Talk to two sentences
Thanks to the Microsoft of Tyrone, the first time I got a subscription to MSDN, it was found that it contained an international subscription to Azure, which could not be wasted, and decided to build a SS server to search for your own paper and search the code (just to start a hhhhh).
SS, which is the abbreviation of the famous ShadowSocks, can be searched directly in specific cases. I am familiar with the Python environment. Here I use the Python version of SS as an example. By the way, because I am too lazy to do the screenshots, I will try to clarify every step in the written language. If there are any problems, please leave a message below.
Create a Azure virtual machine environment
First, login to Azure’s Protal (note is international version, similar to the domestic version, do not introduce here): https://portal.azure.com
Then log in with the Microsoft account that activated the MSDN subscription, and then you can see the control panel.
Then click the “new button” in the control panel, and then select the virtual machine. You can pop up a list of virtual machines, because I’m familiar with CentOS, so I click on all, search for CentOS in the application store, select “CentOS-based7.2”, select “create” in the introduction card that pops back, and choose the default resource manager for the deployment type.
Without accident, a tab for creating virtual machines will now pop up. In the basic configuration, fill in the name (the name of the virtual machine, just start a line), the user name (used for remote login username, you need to remember), the verification type to facilitate the selection of the password line, the password (for remote login, yourself, need to be remembered), the subscription selection Visual Studio Enterpris E (if other available subscriptions can be selected), before setting up a resource group, a new one (with the name of the name casually), the last position to look at the mood bar (I have not tested anywhere faster, anyway, not at home can choose, I chose the western United States), click confirm Continue。
Then enter the second step, select the size of the virtual machine, in the light of the purpose of saving money (SS server can not use much resources), the choice of A1 is OK, and then rest assured that the third step.
The third step is more difficult to configure.
Disk type, selection criteria (A1 also does not allow SSD).
Public IP address, click on the new card in the new card, create a name, pay attention to the allocation of static selection is OK, and then confirm.
Network security group, in order to facilitate our first allow all network communications, and so on after the completion of the construction can be modified. Click to create the add inbound rules in the network security group card. In the new card, start with a name, fill in the priority 100 (the specific rule can click the small exclamation mark icon), change the target port to *, the rest of the settings do not change, click confirm. Click to create an outbound rule in the network security group card. In the new card, start with a name, priority 100, and then change the target port range to *, click OK. Then click OK in creating the network security group card.
Now go back to the setup card, keep the remaining options by default, click OK.
Enter the fourth step, click make sure. Then the system will start to create the environment (it takes about ten minutes, and the specific progress can be viewed by clicking on the bells icon in the upper right-hand corner of the page).
After the creation is completed, select the virtual machine in the left column of the portal (the bottom view of the left column that is not a point in the bottom), select the newly created virtual machine (which is just the name that has just started), and note the public IP address shown in the outline.
Remote connection virtual machine
The SecurCRT connection is recommended under Windows. Here is SecureCRT. For example, if Putty is convenient, you can use the same method. The rest of the system can be connected by the command line.
Open SecureCRT, open the fast connection by Alt+Q, Protocal select SSH2, Hostname fill in the public IP address under the just record, Port select 22, Firewall select None, Username input the first step to create the user name of the virtual machine, the rest of the settings remain the default, click Connect. No accident will pop up the dialog to let you enter the password, the password here is the first step to create the virtual machine you entered the password, click OK (you can choose the Save password check box to remember the password). Now it is connected to the server created just above azure.
Building a SS server
SS’s GitHub address: https://github.com/shadowsocks/shadowsocks
After entering, you may find nothing. Don’t worry. If you choose master in branch, you can see all the code. Next, install SS according to the instructions in readme.md. When you execute some commands, you need to use sudo to enhance the permissions (you may need to enter the password). If a command error is executed, it is likely that the sudo is not running.
Install Python’s package installation tool PIP first
Sudoyuminstallpython-setuptools
Sudoeasy_installpip
Reinstall SS
Sudopipinstallshadowsocks
Let SS run in the background
Sudossserver -p 443 -k password -m aes-256-cfb –usernobody -d start
The field after -p in the command is the port number of the service. It can be customized. The fields behind -k are password, which can be customized, and the rest need not be changed.
After running the background, you can use the PS -aux command to see if the operation is successful.
Use Windows’s SS client to connect to build a good SS server.
GitHub address: https://github.com/shadowsocks/shadowsocks-windows
Download address: https://github.com/shadowsocks/shadowsocks-windows/releases/download/3.0/Shadowsocks-3.0.zip
(the latest version is 3. If a new version can be downloaded from the https://github.com/shadowsocks/shadowsocks-windows/releases page)
The client of other system can be in https://github.com/shadowsocks
Find and download by yourself.
When the client downloads the client, Server IP enters the IP of the Azure virtual machine, Server Port enters the port number that just entered the background running SS (such as 443). Password enters the password field that has just entered the background when the SS is just running, Encryption selects aes-256-cfb, then click on the Add in the left column, and then click no accident. The SS client has been successful.
The next is to configure the browser agent. After configuring the shadowsocks client according to it, click OK and minimize it to the taskbar tray. Right click the tray icon and point to the Server, to ensure that the PAC mode is selected (if Global is the global mode PAC is the GFWList intelligent wall mode), then point to the point. The top of the menu will be enabled. The proxy configuration of the IE will be configured automatically. If you want to cancel the agent, click “enable” again, then the program automatically modifies the system proxy configuration, and then can automatically turn the wall through the browser (ensure that the browser’s agent is set as “system agent configuration”). If you are equipped with 360 other domestic rogue software, please make sure that the shadowsocks added to the white list, don’t stop to modify the network configuration, directly to the best of this kind of software is uninstalled, replaced with more awesome foreign software.
But I prefer the browser configuration proxy mode.
Firefox plug-in FoxyProxy is recommended. There are many specific tutorials on Baidu, which can search by itself. Just notice that the address of G F W L i s t has been changed to https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt, and the previous address has expired.
Chrome can also be used with the FoxyProxy plug-in, configuration method and Firefox, or the Proxy SwitchySharp plug-in, and the specific configuration method can be searched by itself.
Finally, fill in a pit, when configuring the network security group, there may be some risk without filtering the port. You can filter the port number properly according to the port number of your SS configuration (but to ensure that the 22 port of the SSH is available).

Use Scrapy to write an incremental Book crawler

requirement analysis
Crawling data from books (especially novels) and storing them for later analysis.
There are Amazon, Jingdong, Dangdang and Tencent’s Web sites (Tencent literature, creation Chinese, Yun Qi Academy), the starting point Chinese network and so on.
Reptilian selection
According to their familiar language to investigate and analyze popular crawlers online.
And finally, Scrapy is chosen according to its own situation.
Take cloud rise academy as an example to analyze the mode of related websites.
According to the analysis, we can see that there are three levels in the website: book list, book content and book reviews. In the process of crawling, Item and database can be designed according to the contents of three layers and crawled and stored.
Scrapy mode of work
There are many places where the Scrapy framework has been completed automatically. What needs to be done is to define the URL to climb and to use the content in the URL to match the Selector, to do the data cleaning in Pipeline and to save the contents of the Item into the database or file.
Layered incremental climbing architecture
The incremental crawling method is to write a Spider separately for each layer, crawl, store and sign after climbing, and then update only the newly added books instead of re climbing all the books.
Automatic incremental crawling using Shell instruction
Make the crawler run automatically every day
//Bash
#crontab – L
5 0,12 * * /root/cronList.sh
 
//cronList.sh
/bin/bash
CD /root/spider/yunqi
Bash /root/spider/yunqi/run.sh
Each time the task is opened, layer by layer priority is taken.
//run.sh
DATE=$(date +%Y-%m-%d.%H:%M:%S)
Echo    yunqiSpiderStrat $DATE > > log.out
ScrapycrawlnovelList
EchoyunqinovelListcomplete > > log.out
ScrapycrawlnovelContent
EchoyunqinovelContentcomplete > > log.out
ScrapycrawlnovelComment
EchoyunqinovelCommentcomplete > > log.out
DATE=$(date +%Y-%m-%d.%H:%M:%S)
Echo    yunqiSpiderFinish $DATE > > log.out
Operation effect
Post work
After crawling, Supervisor or Scrapyd should also be managed to operate in a more stable manner. After that, we will continue to update a set of visual crawler tools and open source.
Reference resources
Scrpay document: http://doc.scrapy.org/en/1.1/index.html
Scrapyd document: https://scrapyd.readthedocs.io/en/latest/index.html
Scrpay usage notes: http://www.q2zy.com/articles/2015/12/15/note-of-scrapy/
Scrapy usage and Xpath’s pits: http://www.tuicool.com/articles/EVfqI3
Amazon Book crawler (non incremental, open source): https://github.com/imaginezz/amazonBookSpider

The initial experience of HoloLens development

introduce
HoloLens is an augmented reality (AR) introduced by Microsoft, also known as MR. Its technology is very revolutionary. With it, it can superimpose the virtual world in the real world and bring people the immersive experience of combination of virtual and reality. Such interaction is more natural and convenient, and is likely to become a common form of human-machine interaction in a few years.
The development version that has been sold now can be viewed in https://www.microsoft.com/microsoft-hololens/en-us/development-edition. Briefly, it has a 64GB Flash storage space, 2GB RAM, 2GB CPU, and 1GB HPU (I do not know what HPU is, and the official web is written), which can be used about two or three. For an hour, the weight is 579g.
More official descriptions can also be taken to HoloLens’s official website to view https://www.microsoft.com/microsoft-hololens/en-us.
In the Hackathon link at Microsoft students’ summer camp, we have the chance to reach HoloLens. We want to develop a real game similar to the Ingress and tribal conflict, and can be interconnected to allow players to experience the non offensive thinking. But without the Unity development experience and time limit (36h), we set the goal as a Demo for picking up energy and replenish energy.
Here is a summary of the general development process of this HoloLens. If you don’t have time to look at it, look directly at the bottom of the reference. Many articles of dry goods and Daniel are worth reading.
Experience feeling
The official words are over, tell me how I feel.
When I got the HoloLens, I found many limitations, which was not as good as I imagined. The first is that its vision is limited (much smaller than expected, just like a monitor in front of us, which is not enough at all! I hope that the later version can solve this problem), second is not enough computing power (but the disadvantage is the advantage, it is a complete PC, do not have to be tow the line like other VR devices), the third is the hand gesture is very difficult, now only two gestures, one is only the point of the index finger, the other is five fingers. Open Bloom, it’s not very convenient to interact. There are still only support for English, the picture depth control is unreasonable, will cause eye pain, too heavy machine and so on.
But with the experience of several days, I found the essentials of using HoloLens – stand up and walk! When you stand up, you will find that the whole world has changed. It is no longer a sense of sitting without HoloLens. When you stand up, you can see all of you nailed to the wall, pin in the window, even floating in the air window, of course, you can also drag the window by hand to a suitable place. The real world and the virtual world are so unclash together, and even after a while, you will forget what the real world is like, and when you take the HoloLens off, you will not be able to adapt to the feeling that you can’t control the window. Interactive operation is not so unbearable, Bloom gesture is very beautiful, the moment the screen starts to open, it is pretty beautiful! The sensitivity of Cortana is beyond my imagination. I can speak with her at the level I only have six level English. What is most worth mentioning is that when you put an object, such as an aircraft model or an earth, or even the whole galaxy on the table, you can carry it around it for 360° watch, see the details of each direction, click on a star ball into that planet or enlarge a plane. Make it full of the whole house. The feeling is quite shocking! Never a VR product can give me such a real and unreal sense of shock. HoloLens really did it, perfect!
Pre – development preparation
Preparation: install PC with Windws10. If you need HoloLens simulator, you need more than 4GB of memory and support for virtualization of more than 4 core CPU.
Install Visual Studio 2015: any version is available, recommend free community version, download link https://www.visualstudio.com/
Install Unity For HoloLens: the common Unity version is not supported by HoloLens related settings, and you need to use the Unity version specially designed for HoloLens and download the address http://aka.ms/HoloLensUnity
Install HoloLens Emulator: if no HoloLens can be debugged for the time being, you can use the simulator for debugging, download the address http://go.microsoft.com/fwlink/? LinkID=823018
The goal of this development is a 3D game, so we mainly use Unity to develop the game, use VS to debug the code and transmit it to HoloLens.
In addition to using Unity development, you can also use DirectX to develop, or you can directly run the developed UWP program on HoloLens.
development process
Game development on Unity
First of all, the HoloLens customized version of Unity is newly built, and then need to change the settings to adapt to HoloLens. Specific reference: https://developer.microsoft.com/zh-cn/windows/holographic/unity_development_overview
Because of the stressful events, all the teammates are selling at present, the level is the level of one day, so the game is not so good that it doesn’t go to the code. The general effect is to pick up the energy ball from the air and pick up the energy to supply its energy crystal by clicking.
Dealing with the interaction of games and HoloLens
Now, pretending to emulate (or generate exe files) on Unity will be able to run. However, because HoloLens interaction is very different from ordinary mouse and keyboard interaction, we need to deal with HoloLens interaction.
Let’s first talk about the main types of HoloLens interaction. HoloLens provides the following six sets of API:
World coordinates   World coordinates
Gaze into the input   Gaze input
Gesture input   Gesture input
Sound input   Voice input
Space sound   Spatial sound
Space matching   Spatial mapping
We need to use gaze input, gesture input and space matching this time. Gaze at the energy ball or energy crystal, then launch the staring ray, then detect the hand clicks, and pick up the energy or add energy if the crystal is clicked and clicked. The whole space needs to be scanned when placing the energy crystal, and then the crystal is placed on a surface, and when the energy ball falls down, it will disappear automatically if it falls to the ground.
When looking at the API introduction in the official document, it’s very dizzy, and there’s no example of API, so it’s a direct reference to how the Demo101 learned how to use the API. After reading the source code and understanding the relevant meanings, we can understand the idea and add it to our own code. Then we found a better way to do it directly using the SDK given on Github, and the steps were simplified, but because the code version did not match, many libraries could not be compiled and passed, only to be deleted.
Debug on simulators and real machines
The Unity project is exported, using Visua Studio (set to D3D and UAP), using USB cable to connect HoloLens. (you can also use the WiFi connection, when the host and HoloLens are needed to connect to the same WiFi, and select the Remote in the debug device in the compilation options, according to the prompt).
Adjust the target device: right click the Package.appxmanifest file in the solution manager, select the view code, find the TargetDeviceFamily label, change the Name= “Windows.Universal” to the Name= “Windows.Holographic”, and change the MaxVersionTested= “10.0.10240.0” to MaxVersionTested=. “10.0.10586.0”.
Adjust compilation options: change the target to x86 (now support x86 only), and switch the generated configuration from Debug to Release, and debug device select Device.
Click start, compile and remote deploy to open in HoloLens.
Specific steps can be used as reference: https://developer.microsoft.com/zh-cn/windows/holographic/holograms_100
In addition to debugging code, you can also use Device Portal to view the running status of HoloLens and view real-time images in HoloLens.
First, open the Device Portal option in the For developers option of Update in HoloLens’s Settings.
Use USB or WiFi connection, if it is a USB connection, enter the http://127.0.0.1:10080 in the browser, if it is a WiFil connection, input the https://&lt of the HoloLens; HoloLens’s IP address > (can be viewed in a reset network setting). If you need to install a safety certificate, you need to install it.
Then enter the PIN code displayed in HoloLens according to the prompt, then set the login password of Portal, then you can see the settings for managing HoloLens.
In fact, Portal is also written by the Restful interface provided by HoloLens, so you can use the Restful interface provided by HoloLens to extract data automatically.
The method of setting up Portal can refer to: https://developer.microsoft.com/en-us/windows/holographic/using_the_windows_device_portal
For Restful API, you can refer to: https://developer.microsoft.com/en-us/windows/holographic/device_portal_api_reference
The final effect of development
Well, not to mention it, many of the functions are BUG.
Well, if you find this blog stop, you must have been killed by your teammate.
Finally Tip: because of the limited computing power of HoloLens, so do not put too complex model, otherwise, the consequences of self – negative (well, in fact, there is no consequence, it is the black screen just).
By the way, I would like to publicize the answer above: what kind of experience is it to attend Microsoft student summer camp? Reply to the author: Zheng Zi http://zhihu.com/question/31743851/answer/59362202
Here is also a HoloLens real machine that you recorded, using video: http://v.youku.com/v_show/id_XMTcwMjU0NDEwOA==.html? Beta& #paction
Reference materials with dry goods
HoloLens official website: https://www.microsoft.com/microsoft-hololens/en-us (a lot of practical things!)
Microsoft student club official website WeChat Development Guide: first bullet, second shells, third bombs (dry goods very much)
MSP’s Chang Wei brother’s blog: http://www.cnblogs.com/mantgh/
Microsoft’s official example: https://developer.microsoft.com/zh-cn/windows/holographic/academy (be sure to look carefully, follow the one or two examples to get it done basically)
Microsoft official document: https://developer.microsoft.com/zh-cn/windows/holographic/documentation (document is not very good, many places are baffling).
Development of SDK:https://github.com/Microsoft/HoloToolkit-Unity and https://github.com/Microsoft/HoloToolkit on HoloLens on Unity
HoloLens document translation: https://github.com/HoloDocs/HoloLensDocs (this is written by Chang Wei’s brother of MSP, high in quality, many on GitHub, and other for reference)