SATS :: Volume #1

#47: Development APP practices acquiring a skill


LNMTL needs user funding to survive Read More

In the engine room is quite lonely, cannot see a person. 机房里相当冷清,看不到一个人。 After all this little while is taking summer vacation, exams for postgraduate schools armies generally also electricity brain. 毕竟这会儿在放暑假,考研大军们一般也用不上电脑。 Walked to turn on the air conditioning, Lu Zhou looks . the loom to sit down casually, inputs own student number and password, proficiently registered computer 走过去打开空调,陆舟随便找了台机子坐下,输入自己的学号和密码,熟练地登录电脑。 Reason that the engine room of choice school, is mainly because the procedure/program of python language compilation mainly operates under the Linux system, studies the python language it can be said that to kill two birds with one stone in the Linux environment directly. 之所以选择学校的机房,主要是因为python语言编写的程序主要都是在Linux系统下运行,直接在Linux环境下学习python语言可以说是一举两得。 But Lu Zhou own second-hand notebook too trash, the paper transferred the pdf form to playing dead a while, played to rub to rub others to start to the line he to stand the spring water, installed the double system or virtual machine these shows operates does not need to think. 陆舟自己的二手笔记本实在太垃圾了,论文转个pdf格式都得假死一会儿,玩个撸啊撸别人都开始对线了他才站上泉水,装双系统或者虚拟机这些骚操作是不用想的。 Although in the book said very much clearly, has not thought that this gadget used such troublesome...... really the thing and actual operation on paper is completely two matters, wants to learn the thing by the practice.” “虽然书上都讲得很清楚了,没想到这玩意儿用起来这么麻烦……果然纸上的东西和实际操作起来完全是两回事,想学到东西还是得靠实践啊。” First time Lu Zhou that uses the Linux system only felt that two grasp blindly, according to the explanation course that borrows from the library looked some little time, found out the way. 第一次使用Linux系统的陆舟只感觉两眼抓瞎,照着从图书馆借来的说明教程看了好一会儿,才算是摸清楚了门道。 Has saying that others windows system grabs such big market share reasonable, even if the operating system of entire pattern has not bumped computer little white completely, can still very relaxed seat of honor. 不得不说,别人windows系统占据这么大的市场份额还是有道理的,全图型的操作系统即便是完全没碰过电脑的小白,也能很轻松的上手。 However the Linux system is different, basically is the command line operator schema, can complete all operations through the keyboard. What also luckily school attire has the release version of desktop environment, or Lu Zhou has really not known that mouse gadget is useful. 然而Linux系统却不一样,基本上是命令行操作模式,通过键盘就能完成一切操作。也幸亏学校装的是带有桌面环境的发行版,要不陆舟还真不知道鼠标这玩意儿有啥用。 Naturally, the Linux merit is also very significant, strong may the custom-made nature and security causes it compared with windows system more suitable server and other domains. Once were familiar with the command line operation, the efficiency will continue compared with windows system high several times. Therefore many enterprises when advertise for around the server the end programmer to ask one, can use the Linux system. 当然了,Linux的优点也很明显,超强的可定制性和安全性使得它比windows系统更适合服务器等领域。而且一旦熟悉了命令行操作,效率将比windows系统高个数倍不止。所以很多企业在招聘服务器前后端程序员的时候都会问一句,会不会用Linux系统。 Was familiar with the elementary operation eo of Linux system, Lu Zhou turned on the python software, opened the books, sat is in a daze in front of the computer. 熟悉了Linux系统的基本操作,陆舟打开了python软件,翻开了书本,坐在电脑面前发呆。 Speaking of one of the python utilization is to compile the web crawler, wants to examine the study result words, from this start is best what reptile...... makes?” “说到python的运用之一就是编写网络爬虫,想要检验学习成果的话,从这个开始是最好的……可是做个什么爬虫呢?” Lu Zhou is lost in thought. 陆舟不禁陷入了沉思。 Crawls the blog on Weibo? 围脖上的博文? Crawling post post? 爬贴吧的帖子? Probably is very bored. 好像挺无聊的。 The key is to crawl data in hand useless, are many place that put continually not to have. 关键是爬下来的数据拿在手上没用,多了连放的地方都没有。 Suddenly, in his heart moves, does not know what kind of recalled each time the ticket booking experience of going home pain. Actually because of his computer card, because the ui design of Railways Ministry official site was really the anti-human. 忽然,他心中一动,不知怎么的就回忆起了每次回家痛苦的抢票经历。倒不是因为他电脑卡,而是因为铁道部官网的ui设计实在是太反人类了。 Crawls to take various stations, coach numbers and numbers of votes 12306 websites...... this probably with the reptile technology to do according to the information.” “用爬虫技术爬取12306网站的各车站、车次、余票数据信息……这个好像可以搞啊。” Thinks of here, Lu Zhou also no longer rubbed gently, immediately starts to work. 一想到这里,陆舟也不再磨蹭了,立刻开始干活。 After all as the one typical utilization model of python language, the template of reptile procedure/program has to mention that in the book, moreover in view of the different situations, in the book also aimed at the algorithm to conduct the improvements in varying degrees. 毕竟作为python语言的一种典型运用范例,爬虫程序的模板在书中都是有提到的,而且针对不同种情况,书中还针对算法进行了不同程度的改良。 Naturally, 12306 after all are not the common BBS forums, this as the practice goal of beginner, there is a big difficulty. 当然了,12306毕竟不是一般BBS论坛,把这个作为初学者的练习目标,还是有不小难度的。 However merely is also big, regarding has had a thorough understanding land Xueba who puts in order this book, the issue is actually not big. The reptile too high technical difficulty, less than 30 lines of codes had not handled the entire procedure/program, the perfect operation does not have bug. 不过也仅仅是不小而已,对于已经吃透了整本书的陆学霸来说,问题却是不大。爬虫本身并没有太高的技术难度,不到30行代码就搞定了整个程序,完美运行无bug。 Then captured. 然后紧接着就是抓取了。 The url duplication website behind the code, the Lu Zhou choice operates, and data generation form, inducts to constructs in the good folder in advance. 将网站的url复制在代码后面,陆舟选择运行,并且将数据生成表格,导入到预先建好的文件夹中。 The ventilator of engine case starts wēng wēng to make noise, Kartun who the computer changes gets up, an all various professions code flashes through from the black dialog box, was reorganized in the form rapidly. 紧接着机箱的风扇开始嗡嗡作响,电脑变的卡顿起来,一行行编码从黑色的对话框中闪过,被迅速整理进表格中。 Looks at the unceasingly filled folder, by sighs with emotion in the Lu Zhou heart on chair. 看着不断被填充的文件夹,靠在椅子上的陆舟心中感慨。 Python language mother is really convenient, no wonder so many big cows recommend this gadget.” “python语言真尼玛方便,难怪那么多大牛推荐这玩意儿。” Looks the information that an all various professions data flashes through, Lu Zhou has also really planted the hacker addiction misconception. 看着一行行数据闪过的信息,陆舟还真有种过把黑客瘾的错觉。 However naturally, merely is the misconception, even feels is far from, after all this gadget and hacker technology complete eight bamboo poles cannot hit side. Crawls to take the public information from the server not to violate the law, has the suspicion that at most occupies others server resource, will be hated by the major stationmasters. 不过当然了,也仅仅是错觉而已,连感觉都谈不上,毕竟这玩意儿和黑客技术完全八竿子打不着边。从服务器上爬取公开信息是不犯法的,顶多有挤占别人服务器资源的嫌疑,会被各大站长痛恨不已。 Therefore mean-spirited the website will establish the counter- reptile procedure/program, the technical high spot either makes your anything thing not crawl, either crawls is the additive device, the technique content low can also through the access monitoring, lock your ip directly. 所以很多“小气”的网站会设置有反爬虫程序,技术高点的要么让你什么东西都爬不到,要么爬下来的都是乱码,技术含量低的也可以通过访问次数监控,直接锁了你的ip。 The however 12306 websites are not obviously mean-spirited, think the monopoly giant who user experience does not a, will care about that server resource? So long as do not toss about father's server throw the street, who manages you! 不过12306网站显然没那么小气,想想一个连用户体验都不在意的垄断巨头,会在意那点服务器资源?只要你们别把老子的服务器折腾扑街了,谁管你! Looks the coach number data that in the folder piles up unceasingly, the Lu Zhou eye transferred the revolutions, was deliberately considering what can do with it? 看着文件夹里不断堆积的车次数据,陆舟眼睛转了转,寻思着要不要用它来干点啥? Makes to subscribe the ticket website? Probably somewhat does the unnecessary......” “做个订车票网站?好像有些脱了裤子放屁……” Suddenly, in the Lu Zhou heart moves. 忽然,陆舟心中一动。 Or...... 要不…… Makes an online order form app? 做个网上订票的app? The idea that this conceives a plan temporarily braves, cannot control takes root to germinate in his heart. 这个临时起意的想法一冒出来,便不可控制地在他心中生根发芽。 Although in the network has many third parties to order ticket app, but official order form app really did not have. If he can make one unusual, sold to operator that these are interested, perhaps can also gain the living expenses. 虽然网络上有不少第三方订票app,但官方的订票app还真没有。如果他能做出来一个与众不同的,卖给那些感兴趣的运营商,说不定还能赚点生活费。 Involves money the issue, Lu Zhou was immediately careful, in the heart started to calculate unceasingly. 一涉及到钱的问题,陆舟顿时就上心了,心中开始不断盘算了起来。 In the technology, the independence completes app from a development of front to rear end, the difficulty is very high, does not write a simple reptile procedure/program to place on a par, but is actually not able to complete. The algorithm of let alone, not being able to solve can also ask the system, consuming the General points inquiry material was also a process of study. 技术上,独立完成一个app从前端到后端的开发,难度很高,远非写一个简单的爬虫程序能相提并论,不过却并非无法完成。更何况,解决不了的算法还能问系统嘛,消耗积分查询资料本身也是一个学习的过程。 When he completed the reward task, the unlocking artificial intelligence LV0 this branch science and technology, these valuable experiences can definitely apply. 等他完成了奖励任务,解锁了人工智能LV0这一分支科技,这些宝贵的经验肯定能派上用场。 Perhaps purchases and maintains a server to spend a lot of money, the electrical bills and various maintenance costs of operation server, perhaps are also a big expenditure...... 只不过购买并维持一台服务器恐怕得花不少钱,运营服务器的电费和各种维护费用,恐怕也是一笔不小的开支…… But his card is less than 10,000, perhaps burns a small flame to be difficult. 而他的卡里只有不到一万块,恐怕烧出个小火苗都困难。 Clenches teeth, Lu Zhou decides to overcome these difficult problems. 咬了咬牙,陆舟还是决定克服这些难题。 Gave up including 500,000 yearly salaries, what but also there is not able to achieve? 连50万的年薪都放弃了,还有什么做不到的? Even if threw the street, using temporarily as was makes the class to suppose practices acquiring a skill still might as well. 就算扑街了,权当是做课设练手也无妨。 Therefore, Lu Zhou closed the procedure/program, sharply has not been starting to change the code, but opens the word documents, like compiling the program of paper, starts to design the app development flow program. 于是,陆舟关闭了程序,并没有急着开始改代码,而是打开word的文档,就像编写论文的大纲一样,开始设计app的开发流程大纲。 Train ticket inquiry must crawl to take the real-time data, the performance requirement to server is very high, the code must be as far as possible succinct!” “火车票查询必须爬取实时数据,对服务器的性能要求很高,代码必须尽可能简洁!” Contact surface can be simple, but the information is more certain much and comprehensive, this point can refer to the mainstream third party to order ticket app, but cannot certainly be completely similar, must have the creative design......” “界面可以简单,但信息一定得准确、全面,这一点可以参考主流第三方订票app,不过一定不能完全相似,必须有创新点……” Writes about here, the index finger of Lu Zhou is rubbing the keyboard gently, pondered is very long , to continue to start to type on the keyboard. 写到这里,陆舟的食指轻轻摩擦着键盘,思考了很久,才继续开始敲打键盘。 First is Automatic Ticket booking. This should not be the innovation, long ago the cheetahs and 360 several browsers have this function.” “首先是自动抢票。这个应该算不上创新,好久以前猎豹、360几个浏览器已经有了这个功能。” „On -hook brushes the ticket...... not to see automatically probably.” Is thinking last year winter vacation time, the order form subscribed late, several draft animals in bedroom sat in front of the computer pressed quick a half hour of f5, brushed several ticket, Lu Zhou felt sincerely, the broad masses of difficult people celebrated the new year to go home was not easy. “不过挂机自动刷票……好像还没见过。”想着去年寒假的时候,订票订晚了,寝室里的几个牲口坐在电脑前按了快半个小时的f5,才刷出了几张回去的票,陆舟就深切地感受到,广大劳苦群众过年回家的不容易。 Through renovates the official site data unceasingly, will have certain metaphysics probability to brush some tickets, including will be returns of other users, some Lu Zhou did not determine how to come out, but this function can consider actually. 通过不断刷新官网数据,有一定玄学概率会刷出一些票,其中有的是其他用户的退票,有的陆舟也不确定是怎么出来的,不过这个功能倒是可以考虑一下。 For example establishes times and several coach numbers, does for somebody to help the user renovate the data by the server automatically, submits the order in the flash that odd/surplus Piao presents. In several models of ticket booking software that at present he sees, probably did not have this function. 比如设定一个时间段和几个车次,由服务器代劳帮用户自动刷新数据,在余票出现的一瞬间提交订单。就目前他看到的几款抢票软件中,好像还没这个功能。 Moreover in the algorithm, realizing probably is not very difficult. 而且在算法上,实现起来好像也不是很难。 Thinks of here, Lu Zhou looked up under the wall clock. 想到这里,陆舟抬头看了下挂钟。 The present is 1 : 00 pm! 现在是下午1点! Preserved the word documents, Lu Zhou to rub had the sleeve competitive, both hands placed on the keyboard. 保存了word文档,陆舟干劲十足地撸起袖子,双手放在了键盘上。 Starts to work!” “开始干活!”
To display comments and comment, click at the button