Normal view
Nissan Cuts 9,000 Jobs and Slashes C.E.O.’s Pay in Half
How I Discovered I Was Stolen at Birth
How I Discovered I Was Stolen at Birth
Changing Paintings: 44 The birth of Hercules
Having just told us of the events leading to the death and apotheosis of Hercules, Ovid continues book 9 of his Metamorphoses by telling the story of his birth. He leads into this by telling us that Alcmena, Hercules’ mother, had found Iole, Hercules’ lover, a good confidante. Since Hercules’ apotheosis, and at the hero’s instruction, Hyllus had married Iole, and she was now pregnant with his child.
This reminds Alcmena of her own pregnancy with Hercules, that had been cursed by Juno to be a difficult one. She was in labour for seven days and nights, in agony, and called on Lucina and the multiple Roman deities of childbirth to deliver her child. But Lucina had received instructions from Juno, and would not let the labour progress.
Lucina sat on an altar by the door, her legs crossed and her hands linked, preventing delivery. One of Alcmena’s most loyal maids, Galanthis, took matters into her own hands, and announced to Lucina that Hercules had been born. The goddess was so shocked that she jumped up, parting her hands, so allowing Alcmena’s labour to conclude at last. But Galanthis ridiculed Lucina for this. The goddess seized Galanthis by her hair and dragged her along the ground. As the maid struggled to rise she was transformed into a weasel, and Hercules entered the world.
I’ve been unable to find any paintings of this story, but there are several engravings.
Virgil Solis engraved Alcmena’s Labour at some time around 1550. Alcmena is in the left foreground, in the throes of her protracted labour, with four women attending to her. In the background, two women are talking, and at the far right, Lucina is dragging Galanthis to the ground by her hair. There’s also a weasel walking past.
Subsequent engravings have drawn on this. Some show Lucina and Galanthis fighting in the background, but most omit the weasel. One other comes close to showing the story as told by Ovid.
The unknown engraver who made Alcmena Giving Birth to Hercules: Juno, Jealous of the Child, Attempts to Delay the Childbirth, in about 1606, has an almost identical group around Alcmena. The same two women are talking in the background, but the weasel is prominent.
Other stories about Hercules as a baby and young child, which Ovid doesn’t tell here, have been much better represented in paintings. According to older Greek myths, the sons of Jupiter could only become divine if they were suckled at Juno’s breast. Shortly after the birth of Hercules, Mercury took the infant to Juno, who put him to her breast. When she realised who the baby was, she pulled him away, and the excess milk released as a result sprayed over the heavens, forming the Milky Way.
There are two outstanding paintings showing this unusual scene.
Jacopo Tintoretto’s The Origin of the Milky Way from about 1575 shows the infant Hercules being pulled away by an anonymous assistant, with fine streams of milk gushing upwards to generate individual stars. In the background, Jupiter’s eagle appears to have a crablike object in its talons, perhaps representing the constellation of the Crab (Cancer), and Juno’s peacocks are at the right.
Just a few years before his death, Rubens painted an even more wonderful version, The Birth of the Milky Way (1636-37). Jupiter sits in the background on the left, seemingly bored. Juno’s milk arcs out from her left breast over the heavens, and her peacocks look distressed.
Other myths tell that Juno was still furious that Hercules had been born, so she placed two serpents in his cradle, in an attempt to kill the child. Hercules’ mortal twin Iphicles (not mentioned by Ovid) screamed at the snakes, bringing their father Amphitryon running. He found Hercules strangling the serpents with his bare hands: proof that he was indeed the son of Jupiter.
Several fine paintings seize this unique opportunity to show an infant strangling serpents.
This painting from the mid seventeenth century, attributed to Bernardino Mei, has been neutrally titled Scene from the Infancy of Hercules. Rather than let his father discover the baby’s strange abilities, it’s Alcmena who has come running into his nursery.
Pompeo Batoni’s account, The Infant Hercules Strangling Serpents in his Cradle from 1743, succeeds because it shows so well Hercules’ parents, disturbed from their bed, discovering their baby despatching the snakes, all by the light of an oil lamp.
The third version of this story comes from Sir Joshua Reynolds, who was commissioned by Catherine the Great of Russia in 1785 to paint her a history subject of his choice. Reynolds thought that he could flatter the Empress of Russia, perhaps, and produced this preparatory study for the heart of his final work.
The Infant Hercules was painted between about 1785-88, then exhibited at the Royal Academy before being sent to Russia. Reynolds is reputed to have used a real baby as his model, and later reused this for a painting of Puck as a baby.
Reynolds’ finished painting of The Infant Hercules Strangling Serpents in his Cradle (1788) loses the baby among its elaborate supporting cast. It has also suffered problems with deterioration in its paint layer, a common issue with many of Reynold’s paintings.
The Symbolism and Spectacle of Harris’s and Trump’s Closing Arguments
- NYT | China
- The U.S. Army Prepares for War With China: New Vehicles, Face Paint and a 1,200-Foot Fall
The U.S. Army Prepares for War With China: New Vehicles, Face Paint and a 1,200-Foot Fall
「电味儿十足」,9.97 万元起,吉利星瑞·东方曜& 星越 L·东方曜上市
虽然如今中国车市的主旋律是新能源化、智能和智驾化,但不谈大趋势,只看短期的话,纯燃油和新能源的销量还是五五开的局面,也就是说,这个市场依旧巨大,大家可以转型,但没必要放弃这块市场,尤其是已经有基本盘的品牌而言。
那么,去年中国市场里,燃油车销量第一的中国品牌是哪家呢?答案是吉利。
吉利油车的主力车型,就是轿车星瑞和 SUV 星越 L,二者加起来的销量每月也有两三万之多,今天这两款代表吉利油车基本盘的车型都迎来了车型上新:吉利星瑞·东方曜&星越 L·东方曜上市了。
东方,是美学底蕴所在,曜,是阳光,也是美学灵感所在。
吉利副总裁陈政认为,光影才是汽车设计的最高境界,比注重点线面体更为高级,所以在配色上,星越 L·东方曜有东方青全新配色,青翠生机,对应的是「光」,而星瑞·东方曜获得了全新的云砚磨砂灰专属车色,借助专业级颜料和先进喷漆工艺,还有哑光助剂,呈现出缎面质感,对应的是「影」。
另外,诸如戏韵芳华 IP 压印,祥云印月纹样,还有明月琉璃水晶挡把及旋钮等等有中式美学元素的设计,更加印证了这两款车的东方美学风格。
动力配置上,星瑞·东方曜最高可选 2.0TD 高功中置缸内直喷涡轮增压发动机和爱信 8AT 变速器的组合,获得最大功率 175kW,峰值扭矩 350N·m,百公里加速 6.6 秒,同时它也别吉利 CMA 架构平台的产品,前麦弗逊+后多连杆独立悬架,搭配采埃孚 DP-EPS 高性能精准转向系统,驾控方面有所保证。
作为一款 A 级轿车,星瑞·东方曜配有 12 扬燕飞利仕音响,哈曼技术和哈曼调教,同时主驾还有头枕扬声器,有共享模式、驾享模式、私享模式、智能模式四种模式。
另外还有 Flyme Auto 车机系统,手机无线充电、车载香氛系统、256 色无级氛围灯偏豪华体验的配置。
智驾层面上,在多个摄像头、毫米波雷达和超声波雷达的搭配下,高配版星瑞·东方曜配有 15 项 ADAS 主动安全功能,包括 CMSR 后碰撞预警、RCTA 后方交通穿行提示、LCA 变道辅助、DOW 开门预警、ICC 智能领航系统、ACC 自适应巡航控制系统、LDW 车道偏离预警系统、LKA 车道保持辅助系统、ELKA 紧急车道保持、AEB 城市预碰撞系统、AEB-P 行人识别保护、SLIF 速度限制提醒、TSI 交通标志识别、FCW 前碰撞预警、IHBC 智能远光灯控制等。
星越 L·东方曜作为 SUV 车型,更加注重驾乘感受,配有 CCD 可变阻尼悬架,拥有舒适、标准、运动三种悬架模式。
另外还配有博格华纳第 6 代电液式四驱:50:50 前后扭矩分配,0.03s 响应速度,1250N·m 最大承载,带来了同级里靠前的四驱性能,适应各种路况。动力配置上,星越 L·东方曜高配版也采用了 2.0TD 高功率发动机+爱信 8AT:最大扭矩 350 N·m,最大功率 175 kW,麋鹿测试 79km/h。
在豪华和舒适性配置上,星越 L·东方曜可以说「电味儿十足」,很多高端电车的配置都可以在这款车上看到,比如后排电动调节+后排座椅加热,副驾一键放平,还有主驾 8 点 3 档座椅按摩+主驾头枕音响。
25.6 英寸 AR-HUD 提供了车间时距提醒、驾驶辅助预警、车道偏离预警等功能,另外支持光线自动感应调整和雪地模式。
车机配置上,星越 L·东方曜配有高通骁龙 8155 芯片,车机系统采用银河 OS 2.0,算是油车里不错的配置。
星瑞和星越 L 同属于吉利中国星系列,历来都偏好国韵风华的元素,此前采用了「中国功夫、岭南醒狮、中国传统色、中国诗词、龙门金刚、鸿鹄志、川剧变脸」等中国传统文化,推出天青釉、苍穹灰、翠羽蓝、石青石绿、采青、远黛磨砂灰、晴山紫、皓月白等国风车色。
这一次星瑞·东方曜和星越 L·东方曜的发布会地点,也选在了西安的大唐芙蓉园紫云楼下,更是契合了汉唐盛世的风貌,所以这一场行业里已经比较鲜见的燃油车发布会也显得格外有意思,一方面说明中国的汽车设计,尤其是吉利的汽车设计,愈发有自信了,敢于使用此前行业少有的国风元素。另一方面,在行业目光都投向新能源汽车的时候,星瑞·东方曜和星越 L·东方曜在配置上和产品上也更加偏向「电味儿」。
实际上国产新能源汽车上的不少豪华配置,都源自高端乃至豪华燃油车,属于是旧时王谢堂前燕,飞入寻常百姓家,在这一波新能源普及浪潮里完成了用户教育和用户心智占领,接着再接再厉,出现了国产燃油车上面,不得不说也是一种曲径通幽的路线。
整体来说,星瑞·东方曜和星越 L·东方曜是一次用户感知挺明显的焕新,能够帮助吉利在转型新能源的同时,稳住燃油大盘,毕竟大趋势是大趋势,销量也是销量。
最后是价格环节,星瑞·东方曜推出 1.5TD+7DCT 和 2.0TD+8AT 共五个版型,官方指导价为 9.97 万元-13.87 万元;星越 L 在现有车型上加新推出两款东方曜版型,星越 L 系官方指导价区间为 14.77 万元-17.97 万元。
#欢迎关注爱范儿官方微信公众号:爱范儿(微信号:ifanr),更多精彩内容第一时间为您奉上。
Painting Don Quixote: Decline and fall
The first twenty or so chapters of Miguel de Cervantes’ groundbreaking modern novel Don Quixote consist of a series of largely self-contained comic misadventures. After the knight and his long-suffering squire Sancho Panza release a group of convicts, they fear for their safety, so head for the mountains. Once there, events become more interrelated and complex, presenting even greater challenges to those who tried to paint them in standalone works, rather than illustrations accompanying the text.
The pair find a hoard of gold coins apparently abandoned with a notebook in a travel bag. Then Don Quixote catches a glimpse of a man leaping around the bushes half-naked, and suspects that he’s the owner of the bag and its coins. A little way around the hillside, they find a dead mule whose owner they think had carried that bag.
This scene must have fascinated the French artist Honoré Daumier, who painted a series of oil sketches of it in about 1867.
In the first, the knight leads his squire towards the dead mule.
This rough oil sketch shows them drawing even closer.
Sancho Panza and Don Quixote in the Sierra is more generic, and omits the dead mule altogether.
A little later, Sancho Panza’s donkey is stolen, so the knight dispatches him on his own horse Rocinante to obtain three replacement donkeys, and deliver a letter to the Lady Dulcinea, Quixote’s semi-imaginary ‘lady’ of his chivalric quests. Meanwhile, the knight laments and feigns madness for the lady. Panza meets their village priest and barber, and they agree to deceive Quixote in a bid to persuade him to return to the village for his madness to be treated.
As the three head back towards Don Quixote, they meet Dorotea, who had previously been tricked and seduced. She agrees to dress up as a fine lady and pose as Princess Micomicona, who purports to have come all the way from Guinea to ask a boon of the knight.
Pedro González Bolívar’s painting of The Introduction of Dorotea to Don Quixote from 1881 shows their meeting. Without that background information, this would prove impossible to read.
Don Quixote is persuaded to leave the mountains and return home with them, but that’s the start of another series of misadventures. During these, Dorotea’s true identity is revealed, and at dinner Don Quixote gives a long and impassioned speech in which he argues surprisingly rationally in favour of the pre-eminence of arms over learning.
This is recorded in Manuel García Hispaleto’s painting of Don Quixote’s Speech of Arms and Letters from 1884. Sancho Panza stands immediately behind the knight, at the head of the table, on the right. Seated along the table’s length are a man who has just arrived from Algiers with a Moorish woman, the village priest, and others.
Don Quixote’s madness only continues, and eventually he has to be bundled into an oxcart and taken home.
On a Sunday when all the locals are out in the square, the oxcart bearing Don Quixote enters his village at noon, as shown in Hippolyte Lecomte’s undated Don Quixote’s Homecoming. At the left, Don Quixote’s niece or housekeeper holds her hands up in horror at his condition. To the left of the cart are the priest and barber, still mounted. Sancho Panza is riding his donkey, and has been greeted by his wife and their children, who are more interested in how many fine skirts he brought back for her, and how many pairs of shoes for their children.
The priest and barber leave Don Quixote alone to recover for a month after their return, then reassess him, as shown by Miguel Jadraque in this Visit of the Priest and Barber to Don Quixote from 1880. Don Quixote is becoming animated with them as he sits up in bed. In the left background are the knight’s niece and housekeeper, praying in vain for his recovery.
Don Quixote and Sancho Panza then leave on their third sally, which first takes them on a futile mission to El Toboso in quest of the Lady Dulcinea. After that, they head towards the city of Saragossa, and meet a cart full of players in costume, who create mayhem.
Carlos Vásquez Úbeda shows this encounter in his undated painting of Don Quixote. At this stage, the pair are still on their mounts, but shortly afterwards a clown causes Rocinante to bolt and throw Don Quixote, and one of the other players rides off on the squire’s donkey. For once, Sancho manages to persuade his master not to retaliate, and they continue on their way without coming to grief.
Later, they meet a group from a village, and are invited to attend a wedding there the following day.
The wedding brings an elaborate deception in which the bride’s first suitor appears to impale himself on his own sword so that he can marry the bride as his dying wish, but then miraculously comes back to life, to cheat the groom from marrying the bride as had been expected. Manuel García Hispaleto’s painting of The Marriage of Basilio and Quiteria from 1881 shows the priest officiating in the centre, as the bride to the right is married to the dying suitor, who is supported by Don Quixote with his lance. The groom stands at the front of the tent at the right, staring in disbelief at what’s going on.
The newlyweds entertain Don Quixote and Sancho Panza for three days, enabling them to visit the Cave of Montesinos and the Lakes of Ruidera nearby. Gustave Doré, whose illustrations for the whole book have been used by others as the basis for further illustrated editions, painted this non-narrative scene of Don Quixote and Sancho Panza Entertained by Basil and Quiteria in about 1863.
In the middle of Cervantes’ second book of Don Quixote, the knight and his squire Sancho Panza become guests of a Duke and Duchess who had already read Cervantes’ first book, and set out to trick the pair into further comical misadventures. Soon after their arrival, the Duke’s chaplain asserts that Don Quixote isn’t a knight errant at all, causing the knight to deliver a searing riposte.
Out of the blue, maids arrive to wash and lather the knight’s beard, and that of the Duke, in a procedure that defuses a tense situation by transforming it into the absurd. Columbano Bordalo Pinheiro’s painting of Don Quijote in the Duke’s House from 1878 shows this bizarre moment, with the rotund figure of Sancho Panza at the left, the gaunt Don Quixote in the centre, and the Duke and Duchess seated at the right, in obvious amusement.
Although Cervantes had completed Don Quixote in 1615, and it quickly became popular across Europe, it appears to have been painted infrequently before the nineteenth century. Only Valero Iriarte seems to have painted its comical adventure stories in the previous century. Although Eugène Delacroix painted the non-narrative Don Quixote in his Library in 1824, Cervantes’ novel was generally ignored by the major narrative artists of the nineteenth century, who continued depicting mostly classical myth.
These paintings demonstrate how modern fiction can form the basis for successful narrative painting, even though that has remained unusual.
国庆假期,不要再拍普通照片了!
前些天,我的朋友圈被 Live Photo 刷屏了。
微信支持发布 Live Photo 后,我的社交圈立刻分成了两派:一派兴高采烈地分享生活中的动人瞬间,另一派则在感叹为什么自己发不出来,也看不了。
一时间,Live Photo 成了朋友圈里的热门话题。
其实微博很早就支持发布 Live Photo,却没有引起多大的反响,从今年开始,抖音、小红书这样的当红社媒平台陆续可以发布和观看 Live Photo 后,这个功能才开始正式进入大家的视线,并随着微信这样的国民级应用的支持,真正引爆。
趁着 Live Photo 推出十周年之际,我们来聊聊这个玩意儿为什么这么招人喜欢,Live Photo 又在国庆假期中,有哪些新鲜玩法。
为什么 Live Photo 备受青睐?
在《哈利·波特》系列电影中,有一种独特的「魔法照片」,常见于报纸、杂志或相册中。
与普通照片不同,这些照片中的人物不仅会移动、挥手,还能做出各种表情,甚至与人互动,赋予了影像一种神奇的动态生命力。
而 Live Photo 则将这种魔法般的动态照片带到了我们的现实生活中。
想要将「魔法照片」搬到屏幕上,手机可谓是时刻准备着——当你打开 Live Photo 模式时,相机其实已经悄然开始记录摄像头里看到的一切,并为你随时按下快门做准备。
在按下快门的瞬间,iPhone 会拍摄一张高分辨率的静态照片,并与快门前 1.5 秒和快门后 1.5 秒的影像合并,从而生成一个包含照片和短视频的动态图像文件,在相册中可以随时回顾拍摄时的动态瞬间。
这种短暂的动态呈现,赋予了每张照片更生动的情感表达,使得用户能够通过画面中的细微动作和声音,回忆起当时的氛围和情景,仿佛重现了那个瞬间。
就像你吹灭生日蜡烛时,照片不再只是一块插着蜡烛的蛋糕,还刻录了刚刚结束许愿,缓慢睁开眼睛的你,蜡烛微微闪烁、烛光映照在脸上,轻轻一吹,火苗缓缓熄灭的过程。
每个微小的动作和情感都被完整保存,像是把记忆延展成了一个小故事。
此外,Live Photo 备受欢迎,也离不开它的生命力。
随着修图和调色软件的不断进步,许多人在拍完照片后的第一反应,往往是先「修一修」,调整光影、去掉瑕疵,然后再去分享。
这种追求更美好、更理想的自己本无可厚非,毕竟每个人都希望展示最完美的一面,这种现象可以从「印象管理理论」中找到解释。
印象管理理论指出,人们会通过精心调整自己的外在形象来影响他人对自己的看法。在社交媒体上,用户常常精修照片,以期展现一个理想化的自我形象,获得他人的认可和正面反馈。
但完美这件事,实在是太过于有距离感了——毕竟,生命的魅力或许就源于那些微小的缺憾和不完美。
当照片的原始生命力被长期修饰,就不可避免地变得机械化和程式化,丧失了温暖和真实的细节,久而久之,「精装修朋友圈」、「预制朋友圈」等词汇应运而生,专门形容那些经过反复美化、缺乏真实感的照片。
随着时间推移,人们开始对这类精心雕琢的影像感到疲惫,反而渴望那些带有真实情感和不完美的小片段,才真正能打动人心。
与静态照片不同,Live Photo 捕捉的是一个动态的瞬间——不仅仅是一帧画面,还有那一刻的动作、表情和声音。
这种动态的生命力,即使经过修改,也难以完全消失,它让照片看起来更加真实、生动。
正是这种「活」的影像,满足了人们对自然与纯粹生命力的渴望。
保持真实,但花样不少
作为 iPhone 原生相机中默认开启的功能,用户很少察觉到它的存在,只是惊喜地发现不知道从什么时候开始,照片会先播放一段内容,再定格呈现。
这是 Live Photo 的一大特点:系统会自动从这段短短几秒的影像中挑选出「最佳」瞬间,以提高成片率。
不过,系统偶尔也会翻车,选到了不合适的照片作为封面,面对这个问题,我们可以进入相册中编辑 Live Photo,自行选择更合适的画面作为封面。
但由于手机算力的限制,iPhone 还无法将 Live Photo 中的每一张图都进行精妙的计算,这就带来了另一个好处——Live Photo 中其他帧画面没有算法的干扰,呈现出接近纯粹光学成像的效果。
也就是说,你可以借助 Live Photo,得到一张完全没有 HDR 提亮以及过度锐化的照片。
除此之外,Live Photo 在形态上,也有更多可能:在相册的左上角,有一个 Live Photo 图标,当你点开后会看到 Live Photo 的不同呈现形态。
除了选择自己最喜欢的一帧外,还可以将画面循环播放或是来回播放,或是彻底将照片设置为一张静态图片,而其中的「长曝光」,是更具创造力的功能。
上面提到过,Live Photo 实际上记录了你按下快门前后的时间,而将这段时间中的所有画面堆叠到一起,就通过类似于「堆栈」的方法来达成长曝光的效果。
在这个效果下,你的照片中将不再是水花飞溅的一秒,而是连绵成丝绸状的水面;也不再凝固烟花瞬间的惊心动魄,而是从绽放到极致的绚烂。
不过,想要用好 Live Photo 的长曝光功能,有一个前提——你的手要稳住,否则,你得到的只是一张晃动又模糊的照片。
除了凝固时间,Live Photo 还可以在第三方软件的帮助下,开发出新的玩法。
很多时候,我们在一个场景中记录了多个瞬间,但一张张发出又影响观感,可以将多张 Live Photo 拼在一起,同时呈现给大家。
具体操作如下:
- 打开美图秀秀;
- 选择视频剪辑;
- 在相册中选择自己拍摄的 Live Photo;
- 点击开始编辑坐车的拼图标志;
- 根据需要,选择合适的拼图方案,并点击右上角的下一步;
- 点击右上角保存键的右边省略号,选择 Live 实况,调整参数后保存即可。
Live Photo 的背后,浓缩的是人类近两百年的探索
在今年的 Made by Google 大会上,Pixel 9 携 Gemini 登场,Google 在计算摄影之后,凭借 AI 再次引领手机影像的方向。
有了理念,才能有坚定的方向,Google 的理念很简单:
照片是回忆。
于是才有了 Reimagine 这样的功能,哪怕是顶着谣言与混乱的风险,Google 也允许你通过 AI 随意地修改照片,生成出脑海中的景物,而不是真正发生过的某时某刻。
与 Google 相比,苹果对影像相当保守,相机软件工程副总裁 Jon McCormack 在采访中说道:
苹果公司对照片的定义有自己的观点——照片是真实发生过的事情,孩子迈出人生的第一步,或是父母咽下的最后一口气,都是切实发生的事情,无法改变。
所以,在 Pixel 迅速支持 AI 生成后,苹果只是保守地让 Apple intelligence 提供一个消除功能,并且在宣传口径中,都统一为消除与主体无关的事物,而不是画面主体中某个曾经存在于你生活中的人。
Live Photo,兼具动态与真实性,正是苹果对「照片是真实」这一观点的另一种诠释。
▲ 黑客帝国中,对于真实的定义的疑问
其实在 Live Photo 的十年中,苹果以外的厂商也陆续推出了系统级别的 Live Photo,只是受制于格式、方式的不统一,还没有像 iPhone 的 Live Photo 一样广为流传。
今年,先是 OPPO Reno 12 允许用户将拍摄的 Live Photo 上传到小红书,再到微信朋友圈支持 iPhone 发布 Live Photo,越来越多的人开始关注这种介于照片和视频之间的媒介,借此希望与世界建立更生动的联系。
这种变化不仅影响了用户对影像的认知,还引发了整个行业的推进。
最近,vivo 的产品经理韩伯啸在微博上回应了网友的提问,确认 Android 将在年底前统一支持微信发布 Live Photo,进一步打破平台壁垒,为更多用户提供动态记录的机会。
记录一个片段这件事,也许人们已经习以为常,但实际上相当了不起。
从 19 世纪初,影像技术诞生开始,人类就找到了能够客观记录静态画面的方法,经过几十年的演变,才出现了价格昂贵的胶片连续拍摄静态画面来组成动态片段,直到 1997 年,《哈利·波特与魔法石》出版时,能够记录片段的魔法照片依然只存在于幻想中。
又过了近二十年,随着智能手机的普及,我们才真正实现了随手拿起手机、轻轻按下快门,就能将一段时间浓缩进照片中,把魔法世界变为现实。
可以说,人们用了快两百年的时间,才推动影像走到这一步。
因此,正值国庆假期,如果你的手机支持 Live Photo,千万别浪费了它,哪怕暂时无法分享,依然可以保留这些生动的片段,为未来的自己做好回忆准备。
#欢迎关注爱范儿官方微信公众号:爱范儿(微信号:ifanr),更多精彩内容第一时间为您奉上。
Reading visual art: 158 Voyeur, classical
As a visual art, painting is all about looking and seeing, and one of its more discomforting themes is that of the voyeur, the eyes that shouldn’t be there, looking at something they really shouldn’t. In these two articles, I first show examples of paintings that explore this in classical myths and Biblical stories, then tomorrow will take that on to more modern subjects.
When Acis, son of the river nymph Symaethis, was only sixteen, Galatea fell in love with him, but the Cyclops Polyphemus fell in love with her. The latter did his best to smarten his appearance for her, but remained deeply and murderously jealous of Acis. Telemus, a seer, visited Sicily and warned Polyphemus that Ulysses would blind his single eye. This upset the Cyclops, who climbed a coastal hill and sat there, playing his reed pipes.
Meanwhile, Galatea was lying in the arms of her lover Acis, hidden behind a rock on the beach. Polyphemus then launched into a long soliloquy imploring Galatea to come to him and spurn Acis. When he saw the two lovers together, Polyphemus grew angry, and shouted loudly at them that would be their last embrace. Galatea dived into the sea, but her lover was crushed to death by the boulder that Polyphemus lobbed at him.
Gustave Moreau’s Galatea from about 1880 shows her resting naked in the countryside with her eyes closed, and the cyclops playing sinister voyeur. Surrounding them is a magical countryside, filled with strange plants recalling anemones, as would be appropriate to a sea-nymph. Polyphemus is shown with two ‘normal’ eyesockets and lids, his single seeing eye staring out disconcertingly from the middle of his forehead.
Odilon Redon’s The Cyclops (c 1914) is one of the masterpieces of Symbolism, and follows Redon’s personal theme of the eye and sight, and further develops that of the voyeurism of Polyphemus. Polyphemus’ face is now dominated by his single eye looking down over Galatea’s naked beauty, with Acis nowhere to be seen.
Van der Werff’s modern reputation includes painting the erotic, and his Amorous Couple in a Park Spied upon by Children, or Paris and Oenone, from 1694, is one of his earlier works exploring the intense relationship of this legendary couple. When he was still a shepherd, Paris of Troy married the nymph Oenone, whom he later abandoned to marry Helen.
The Biblical story of King David and Bathsheba is all about voyeurism and sinister power.
Miniatures, such as Jean Bourdichon’s Bathsheba Bathing from 1498-99, led more private lives and could be considerably more explicit. Here is the most frequently painted moment of the story, with a nude Bathsheba bathing in the foreground, and David in his crown and regal robes watching her from a window in the distance.
In 1714, Adriaen van der Werff painted his traditional version of Bathsheba, who is combing her hair under the distant gaze of King David.
The Scottish artist David Wilkie’s Bathsheba from 1815 is set in the countryside. She is now beside a small stream where she has been bathing, and is just donning a stocking. King David is again shown as a sinister voyeur.
As you might expect, Jean-Léon Gérôme’s Bathsheba (1889) is a literal interpretation of the story. Watching Bathsheba washing in her small roof-garden is the figure of David, leaning forward to get as close a look as he can.
The other related Biblical narrative is that of Susanna and the elders, which opens with the two men watching her bathing in the privacy of her own garden.
In Jacopo Tintoretto’s groundbreaking masterpiece, Susanna is blissfully unaware of being watched by the evil elders. This puts the viewer in the uncomfortable predicament of knowing what’s going on, but also knowing what she doesn’t know.
Susanna herself is caught as she is drying her leg after bathing in the small pool beside her, looking at herself in a rectangular mirror propped up against a rosy trellis in a secluded part of her garden. Scattered in front of her are the tools of grooming, her personal jewellery, and a fine gold-encrusted girdle, behind which appear to be her outer garments.
Peering round each end of the trellis are the two old elders dressed in orange robes, who have entered the garden and crept right up to get a better view of Susanna’s body. To the right are trees, against whose foot Susanna’s back rests. Immediately above her head is a magpie, a bird associated in fables with mischief and theft. In the centre distance, the secluded area opens out to another pond, on which there are ducks and their ducklings, then there is a covered walk beside which is a Herm. In the left distance is a larger pond, at which a stag and a hind are drinking. On the far side are some trees and another Herm.
Unlike other paintings of nudes, where mirrors are often used to extend the view of the figure on display, neither the image seen in the mirror nor the reflection on the water show anything more of Susanna.
Lovis Corinth started painting this story in 1890, when he made two slightly different versions of what was fundamentally the same work. Their only reference to the garden is now a single rose, the flower chosen by Tintoretto for the trellis in front of Susanna, on the floor. The two elders have followed Susanna back inside after her bathing, and are now spying on her from behind a curtain, where only one of them is prominent. In common with Tintoretto, Corinth chooses a moment before Susanna is aware that she is being watched, and long before the elders force themselves on her. Both paintings emphasise her nakedness by including her clothes, and add the jewellery of more traditional depictions.
Reading visual art: 153 Catasterisation and assumption
In yesterday’s article, I showed examples of apotheoses. Following a couple of even more liberal interpretations, this article moves on to the second and third items in this list:
- Apotheosis, when a pre-christian hero is elevated to the status of god or goddess;
- Catasterisation, when a mortal is changed into a celestial body such as a star or constellation;
- Assumption, when the Virgin Mary was taken up into Heaven;
- Ascension, when Jesus Christ ascended into Heaven, and sometimes available to saints on their martyrdom.
Girodet’s painting of the Apotheosis of the French Heroes Who Died for the Fatherland during the War of Liberation, Ossian receiving the Ghosts of the French Heroes was probably completed in 1802, and is perhaps the most elaborate and complex painting inspired by the bogus Scottish poet Ossian. It’s unclear how those French war heroes became involved with Ossian, but an extraordinary mixture of myths and legends from contrasting cultures.
In Vasily Vereshchagin’s bleak Apotheosis of War (1871), ravens/crows perch on a huge pile of human skulls in a barren landscape outside the ruins of a town.
A few Christian religious paintings came close to being apotheoses.
Alexandre Cabanel’s The Death of Moses (1850) tackles one of the vaguer episodes in the life of this Old Testament prophet. When he was 120 years old, according to the book of Numbers, Moses assembled the tribes of Israel on the banks of the River Jordan, reminded them of the laws under which they must live, sang a song of praise, blessed the people, and passed his authority to Joshua. He then ascended Mount Nebo, looked over the Promised Land, and died. Cabanel shows this as an apotheosis, with God the Father (upper left) welcoming Moses (centre right) with open arms.
Being transformed into a celestial body in catasterisation was an honour accorded those mortals who couldn’t aspire to deity, among them the giant Orion. He arrived at Chios, where he became drunk, and raped Merope, the daughter of Oenopion. As punishment for that, Oenopion blinded Orion and cast him from his land. Orion then went to Lemnos, where Hephaistos took pity on him, and lent him his servant Kedalion to sit astride his shoulders and act as his guide. An oracle advised Orion to proceed east into the rays of the rising sun, so that those rays would restore his sight. So cured, Orion then went to Crete to hunt.
There are differing accounts of Orion’s death. Some involve his love affair with Eos, which was opposed (possibly out of jealousy) by Artemis. In these, Artemis ended up killing Orion with her arrows. Other versions claim he was killed by a giant scorpion. In death, Artemis asked that Zeus catasterised him, together with the scorpion, to form the constellation Scorpio. Once there, Orion pursues the daughters known as the Pleiades, which form a prominent open star cluster nearby.
Poussin’s Landscape with Orion, or Blind Orion Searching for the Rising Sun was painted late in his career, in 1658, at a time when the artist’s hands were suffering a tremor that was starting to disrupt his ability to paint. It is among his finest allegorical landscapes, and one of the most intensely studied works of his career.
Set in one of Poussin’s wonderful idealised landscapes, near the coast, the giant Orion is striding purposefully towards the rising sun. He carries a huge hunting bow, and a quiver taller than a man. Standing on his shoulders is Kedalion, servant to Hephaistos, who is acting as his guide. Above and beyond Orion is a strange formation of backlit cloud, generally interpreted as being storm-cloud. Atop that is the standing figure of Artemis, with her distinctive crescent moon coronet, and an owl perched on her left shoulder. She leans nonchalantly against the cloud, her head propped against her right hand. In the far distance is the sea, with a prominent lighthouse.
There have been few other attempts to tell any part of the story of Orion on canvas. In 1685, Daniel Seiter ( –1705) painted this view of Diana by the Corpse of Orion, following in the brushstrokes of his teacher Johann Carl Loth. This shows Diana (Artemis), with her distinctive crescent moon, looking regretfully at the dead Orion, after she had killed him with her arrows.
Sidney Hall’s etching of Orion, a hand-coloured plate in a set of celestial cards from 1825, is an ingenious lesson in observational astronomy.
The Pleiades were originally the seven daughters of the titan Atlas and the sea-nymph Pleione. When Atlas was made to carry the heavens on his shoulders, Orion started to pursue the Pleiades, so Zeus transformed them first into doves, then into stars. Their name is given to a star cluster, which appears to be chased across the night sky by the constellation of Orion.
Elihu Vedder’s painting of The Pleiades (1885) was made in association with his first illustration for the Rubaiyat of Omar Khayyam, representing Khayyam’s horoscope. Each of the sisters is connected by a thread to their corresponding star, perhaps representing the process of catasterisation.
There are a great many paintings of the Assumption of the Virgin Mary, of which I show here just a tiny sample.
Francesco Botticini’s spectacular example painted in about 1475-76 places unusual emphasis on Paradise, with its triple tiers of figures rising to those of the Virgin Mary kneeling in front of Christ at its summit.
Tintoretto painted several versions of The Assumption of The Virgin, this one for the Cappella di Santa Maria Assunta, in the Gesuiti, Venice. It’s thought that Tintoretto had promised to paint this in the style of Veronese.
Poussin’s Assumption of the Virgin from about 1650 is plainer and more orthodox.
Gaetano Previati’s Divisionist rendering of the Assumption from about 1901-03 shows a group of winged angels raising Mary’s body to Heaven.
Africa’s Debt Crisis Has ‘Catastrophic Implications’ for the World
How to VLAN
介绍VLAN的基本概念和几种场景下的应用,而OpenWrt下VLAN处理机制和一般交换机有些不同,这里做了一个对比并给出了一种两台路由器之间的单线复用的方案
问题
计算机网络的教材对VLAN一笔带过,作业的却要用到交换机互联,之前看的VLAN的文章貌似都对应不到OpenWrt上去,也就很难有实践的机会;下面根据个人在宿舍组网上遇到的问题,一步步来探究VLAN的用法
后面又看到了N1盒子基于VLAN的单臂路由,又做了一些补充
多线接入
宿舍是上床下桌,每一张桌子下面有一个百兆的网口,通过负载均衡,很早就可以把网速跑到100Mbps了,这显然不够啊,因为宿舍WiFi是共用的,自然而然想到连接相邻的两个床位的网口,这样就有300Mbps了,这也是多线拨号的第一步
上图就是将LAN3与LAN4作双线接入,通过VLAN分别对应到eth0.3和eth0.4
此时LAN4与WAN是“直通”的,效果上来说,就是LAN4也可以插网线用电脑拨号了,如果是要给路由器做双线接入的话,则需要添加VLAN,再把一个LAN口添加到新VLAN中,最后建立接口拨号即可
交换
然而舍友还是需要网口拨号的,所以如果需要长期占用的话偶尔肯定是不太方便的,所以需要交换机来扩展一下网口,这一步已经可以通过简单的修改下OpenWrt路由器的Switch来实现,將LAN4和WAN划到同一个VLAN,两个接口就相当于在同一交换机下:
单线复用
然而,仅仅通过untagged只能实现多条线路的“汇聚”,能够达到100Mbps+的只有一台路由器而已,并没有实现“互通”,即每一台路由器都可以上到100Mbps+;不仅如此,还要实现相邻床位的路由器之间只用一根线连接就可以达到同样的网速,更具体的就是在一根网线传输不同的来源(网口)的数据
而VLAN的一个重要的功能恰好就是实现交换机之间的互通
单臂路由
这个需求源于有一台N1,之前看过VLAN的接入网络的方法,觉得网络结构更清晰,以此可以解决主路由算力不足的问题,但之前一直没有刷上OpenWrt,刷完之后发现居然没有交换机的Switch选项,赶紧翻出了之前看到的帖子:N1做主路由,新3做AP的最正统vlan连法教程,想起之前文档刚好有部分没看懂,刚好可以补充上
概念
首先还是OpenWrt的文档:VLAN,很早就读过,但是因为缺少具体的有解释的例子,当时没弄清楚VLAN tagged的机制
所以这里先结合华为的文档了解下基础的概念
VLAN Tag
首先需要理解VLAN标签是被添加到以太帧内部的一个4个字节的片段,其中VID也就是常说的VLAN ID
在一个VLAN交换网络中,以太网帧主要有以下两种形式:
- 有标记帧(Tagged帧):加入了4字节VLAN标签的帧
- 无标记帧(Untagged帧):原始的、未加入4字节VLAN标签的帧
常用设备中:
- 用户主机、服务器、Hub只能收发Untagged帧(Linux系统可以通过安装软件实现收发Tagged帧)
- 交换机、路由器和AC既能收发Tagged帧,也能收发Untagged帧
- 语音终端、AP等设备可以同时收发一个Tagged帧和一个Untagged帧
VID & PVID
VID也就是数据帧中的12bit的VLAN ID,表示该数据帧所属VLAN的编号,而PVID(Port Default VLAN ID)又称为缺省VLAN,可以用于和VID做比较来判断Tag的情况
应用
最主要的应用是划分广播域,这部分可以参考图文并茂VLAN详解,然而和本文的关系不是很大
为了提高处理效率,设备内部处理的数据帧一律都是Tagged帧,例如在交换机内部的,在数据帧进入交换机的时候可能会按照一定的规则被打上VLAN Tag以方便下一步的处理,OpenWrt的Old Wiki的一张图很好地体现了这一点:
以太帧进入端口后被打上VLAN Tag,之后在传输的CPU的线路内(Port5-CPU),就同时传输带两种VLAN Tag的包
另外在交换机之间,可以在一条链路上使用两个VLAN也叫做Ethernet trunking,也有人称作单线复用,常见的应用:
- 单臂路由(只有一个网口的路由器)
- 使用一根网线同时传输IPTV和宽带的数据
交换机
这里参考的是上面的华为的交换机的文档,不同交换机可能有些不一样
Incoming & Outgoing
以收发的设备作为主体,指的是数据帧到达接口而没有完全进出交换机内部,举个例子:
- 数据帧到达某一个接口时,路由器会对数据帧的VLAN情况做判断
- 如果符合通过的规则,则放行做后续处理,不符合则丢弃
- 后续处理可能就是剥离或者打上标签
链路类型和接口类型
配置VLAN:为了适应不同的连接和组网,设备定义了Access接口、Trunk接口和Hybrid接口3种接口类型,以及接入链路(Access Link)和干道链路(Trunk Link)两种链路类型,如下图所示
根据接口连接对象以及对收发数据帧处理的不同,以太网接口分为:
- Access接口
Access接口一般用于和不能识别Tag的用户终端相连,只能收发Untagged帧,且只能为Untagged帧添加唯一VLAN的Tag
- Trunk接口
Trunk接口一般用于连接交换机、路由器、AP以及可同时收发Tagged帧和Untagged帧的语音终端。它可以允许多个VLAN的帧带Tag通过,但只允许一个VLAN的帧从该类接口上发出时不带Tag(即剥除Tag)
- Hybrid接口
Hybrid接口可以允许多个VLAN的帧带Tag通过,且允许从该类接口发出的帧根据需要配置某些VLAN的帧带Tag(即不剥除Tag)、某些VLAN的帧不带Tag(即剥除Tag)
Hybrid接口和Trunk接口在很多应用场景下可以通用,但在某些应用场景下,必须使用Hybrid接口。比如一个接口连接不同VLAN网段的场景(如图所示的Router连接Hub的接口)中,因为一个接口需要给多个Untagged报文添加Tag,所以必须使用Hybrid接口。
- 接入链路只可以承载1个VLAN的数据帧,用于连接设备和用户终端
- 干道链路可以承载多个不同VLAN的数据帧,用于设备间互连
处理机制
OpenWrt对VLAN Tag的处理机制见后文引用文档的加粗部分,此处暂作为理解的参考
- Access端口
- Trunk端口
- Hybird端口
OpenWrt VLAN
OpenWrt的文档没怎么提及接口类型的概念,OpenWrt对VLAN设置的组织形式和普通的交换机有所不同,从机制介绍来看是比较接近Trunk端口的:发出的数据帧只有一个VLAN的数据帧不带Tag
OpenWrt文档所提到的:An untagged port can have only 1 VLAN ID 反映在:OpenWrt中的Switch设置VLAN时单个untagged Port无法再再其他VLAN上为Untagged,否则回提示:LAN 1 is untagged in multiple VLANs!
故抛开之前的端口类型,遵守VLAN的规则,兼容且实用就行
另外,不是所有OpenWrt设备都有Switch这个LuCI的配置选项,比如N1就没有,但是照样可以配置VLAN,位置在Interface的接口物理配置部分,由于无法像Switch那样有Tag之类的选项,
Tag机制
官方文档对Tag机制的介绍如下(散落在两处):
- Tagged on “CPU (eth0)” means that the two VLAN ID tags used in this example (1, 2) are sent to the router CPU “as tagged data”. Remember: you can only send Tagged data to VLAN-aware devices configured to deal with it properly.
- Untagged means that on these ports the switch will accept only the incoming traffic without any VLAN IDs (i.e. normal ethernet traffic). The switch will remove VLAN IDs on outgoing data in such ports. Each port can only be assigned as “untagged” to exactly one VLAN ID.
- Off: no traffic to or from the tagged ports of this VLAN ID will reach these ports.
Ports can be tagged or untagged:
- The tagged port (t is appended to the port number) is the one that forces usage of VLAN tags, i.e. when the packet is outgoing, the VLAN ID tag with vlan value is added to the packet, and when the packet is incoming, the VLAN ID tag has to be present and match the configured vlan value(s).
- The untagged port is removing the VLAN ID tag when leaving the port – this is used for communication with ordinary devices that does not have any clue about VLANs. When the untagged packet arrives to the port, the default port VLAN ID (called pvid) is assigned to the packet automatically. The pvid value can be selected by the switch_port section.
特别指出,但是一般也用不上,在LuCI界面上看不到的PVID设置,设置具体在uci network switch_port部分:
Port PVID; the VLAN tag to assign to untagged ingress packets
无Switch配置
官方文档的位置在 Creating driver-level VLANs 一节,配置方式是通过在接口设置,选择自定义接口,在名称在做文章:如在物理网卡eth1上,通过自定义eth1.2接口的方式建立一个VLAN ID为2的接口,在使用Switch设置VLAN,如添加VLAN ID为3的VLAN之后,接口处也会出现eth0.3,逻辑上还是统一的;下面来看下文档对处理机制的描述:
If the incoming packet arrives to the interface with software VLANs (incoming packet to eth1) and has a VLAN ID tag set, it appears on the respective software-VLAN-interface instead (VLAN ID 2 tag arrives on eth1.2) – if it exists in the configuration! Otherwise the packet is dropped. Non-tagged packets are deliveded to non-VLAN interface (eth1) as usual.
即处理流入的包:接口只接收有相应Tag的包,相当于Switch中的VLAN在该接口设置为Tag
这样一来,一个物理网口可以同时收发带Untagged帧和Tagged帧,故使用VLAN来实现单臂路由也就很好理解了,配置的方式也不唯一
解决方案
回到本文开头提到的问题,仿照上面的Switch内部VLAN机制的图的形式,画了一张两台OpenWrt路由器通过VLAN互通,进而实现让两台路由器可以得到宿舍三个网口合计300Mbps的接入
需要说明的是:
- 因为所有的VLAN都需要为拨号服务,所以这里略去了VLAN到CPU的一段
- 格式为了照顾LuCI的设置界面显示,可能看起来有些不寻常
- VLAN ID的外层意义就是接入的网口的标识,中间的TRUNK链路如何并不重要
- 对WAN Interface的命名就相对随意了,例如Router 1的WAN_1应该命名为WAN_21更合适一点
最后的在宿舍的书桌背后的路由器如图
How to VSCode
还记得初见Atom的惊艳以及日久感受到的速度慢和占用高,记得VSCode刚推出时的“难用”,现已今非昔比,本文主要介绍VSCode的一些简单的应用:部分实用的插件以及调试C,Python代码的方法
最初为了写LaTeX而使用 Atom + 插件 来作为代码编辑器(积累了些经验之后转而使用TeXStudio),之后也就顺其自然的用Atom写了作业的大部分代码(装插件还要看网络环境),之后就是遇到了幽灵和熔断漏洞的影响,笔记本的性能越来越力不从心,使用Atom打开大文件特别慢,运行也并不流畅,才发现Atom的性能问题被诟病已久,有人推荐了微软的VSCode —— 和Atom的主题、插件基本通用,但是性能好太多,于是我就换下了Atom,一直用到了现在
现代代码编辑器最基本的功能:Git,多语言支持,丰富的效率插件,VSCode都是有的,而它出彩的地方还是在于开发方面(其实我就是写下作业)
准备
安装VSCode的时候记得勾选使用VSCode打开文件夹,因为VSCode的对工作空间要求比较严格的,另外对于Atom迁移而来的,可以选择Atom主题“One Dark Pro”以实现一个“平缓的过渡”
在调试代码和使用方面,常用的插件有:
- Code Runner
- Terminal
- Resource Monitor
考虑到配置繁杂,重装或者有多台电脑迁移配置不便,可以用Setting Sync插件通过Github提供的服务以实现配置的同步
Remote-SSH
常规插件其实各大代码编辑器都差不多,对于VSCode来说,个人接触到的,最惊艳的插件当属Remote-SSH:
开发环境或者说代码运行的环境在远程或者其他的系统上,需要使用SSH客户端连接到远程,使用SCP或者SFTP来传输文件,这里面SSH客户端是一个重要的角色,最开始使用Atom编辑加上脚本完成“本地编辑,远程调试”的过程,后面遇到了一度让我觉得“相见恨晚”的FinalShell,解决了SSH时的一些列问题,但是作为一个独立开发者维护的闭源软件,稳定性和安全性是一般般的
而Remote-SSH相当于把VSCod搬到了服务器上,同时解决了运行环境和文件传输两个问题,尽管类似的问题可能早就有成熟的方案,但是在常用的代码编辑器中就能实现还是相当感动的,安装完成本地的客户端之后在VSCode的左下角有一个蓝色的标记,点击之后按照提示添加服务器就好(遇到SSH的config文件权限的问题,换用另外一个ssh的config文件就好),初次使用连接服务器之后会在服务器端自动下载和安装VSCode的相关组件(常用的LInux发行版没什么问题,也不需要root权限,ARM架构也支持),之后再手动把需要的插件安装下就好
初次连接时打开文件夹需要重连,直接打开另外一个文件夹也会重连,感觉不方便的话,可以在打开文件夹之后再添加另外一个文件夹到工作空间中(会重新连接),文件夹一栏会变成了工作空间,之后添加文件夹就不需要重连了,工作空间的配置可以保存以便下次使用;文件的上传下载分别是拖拽和右键菜单,体验算是很好了
如果在远程跑代码可以安装Resource Monitor用于监测CPU和内存占用,其他的细枝末节的部分搜索下就有
WSL支持
这里就不造轮子了,已经有人做的很好了,Dev on Windows with WSL,其中主要使用了Remote-WSL插件,虽然个人一度觉得WSL是未来,但是使用了一段时间之后还是觉得不如Docker或虚拟机来得方便,尤其是和Remote-WSL一起推出的Remote-SSH诞生之后
Docker支持
无意中又看到Remote插件多了一个Docker,之前的docker插件在VSCode侧边栏可以方便的查看镜像容器的情况,而Remote插件可以直接把VSCode的运行环境放到容器内,并且可以直接接入正在运行的容器(也就是不需要预先安装SSH和开放端口),尤其对编译环境下修改代码比较方便
另外还有个有趣的地方,可以让Win下的Docker支持图形化界面(勉强可用)
- 安装vcxsrv,运行xlanuch,设置勾选最后一页的最后一项(Disable Access Control)
- 获取本机的一个让容器可以到的IP,可取宿主机的WAN IP
这里直接把IP保存为变量了:
$DISPLAY=(ipconfig|findstr "IPv4")[1].split(" ")[-1]+":0.0";
docker run -it --net=host -e DISPLAY=$DISPLAY ....
调试代码
VSCode全称Visual Studio Code,调试代码方面算是对得起Visual Studio之名了,权威的配置过程还是参考VSCode官方文档,本文介绍的是个人配置在Windows下的配置尝试,点几下就配置好了,故分享出来,仅供参考
C语言
有些作业要求用C语言写,最开始追求新奇,用的Visual Studio 2015以及Clang,看中的是强大的调试功能,但是对于写个简单的作业来说太费事,Clang的报错常常不理解
之后转而使用了更常见的Dev C++,基于GCC,照抄书上的代码也不会莫名报错了,在很长一段时间里都是用Atom写代码,Dev C++做运行和调试,
到了VSCode当然会想要接近Visual Studio的体验,编译器肯定不用Clang了,至于GCC,WSL里有,Win上的GCC的版本不知道用哪个好,看网上的博客配置tasks.json (build instructions),launch.json (debugger settings)依然颇为繁琐
直到后面遇到了Scoop,安装就很简单了:scoop install gcc
,查看版本后发现是MinGW的GCC,安装CodeRunner扩展后就可以运行代码了
注:代码及工作目录的路径不要有中文
调试功能则需要C/C++扩展,Debug功能在VSCode的左侧应该是自带的,对新目录来说Debug一栏的左上角绿色三角形旁边会显示”No COnfiguration”,Debug时配置gcc.exe作为代码的编译器,GDB作为代码的调试器的关键就在这里了:
-
Add Configuration的时候选C++(GDB/LLDB),之后再选gcc.exe build and debug active file设置完成后会在工作目录下生成一个.vscode/launch.json的文件,文件定义了gdb作为exe的调试器,需要注意的是这里的preLaunchTask,定义了在执行调试在前需要使用gcc对代码进行编译,也就是下一步
-
回到C的源文件,点击Debug一栏的左上角绿色三角形开始调试,会提示Could not find the task ‘gcc.exe build active file’ ,点击Configure Task,再选gcc.exe debug active file,软件就会创建并打开.vscode/task.json,其中定义了gcc.exe编译的过程,也就是上一步的preLaunchTask
-
以上的文件在做了选择之后就自动生成好了,之后该文件夹内的C代码都可以透过VSCode的Debug来调试了,设置断点,查看变量体验还是比较现代的~
已知问题
自带的运行代码和调试的terminal窗口对部分编码支持的不太好,调试的时候会闪退
使用WSL GCC可以参考下面的链接(和上个链接的WSL Remote还是有些不同的): VSCode使用WSL环境开发C语言配置
Python
首先在VSCode窗口的左下角,可以设置当前使用的Python解释器,运行依然是CodeRunner,在代码编辑窗口右键选择各种运行方式包括交互式。重点还是调试,这个时候可以选择创建一个新文件夹了(平时把Python代码都放到一个文件夹…),在新文件夹的情况下,点击调试会提示选择Debug Configuration:包括了Python File和Module以及其他没见过的类型
显然对于只会用调试Python File的情况,每次都做一次选择显然不太方便,那么可以选择Add Configuration,工作目录下会生成一个.vscode/launch.json的文件:
{
"name": "Python: 当前文件",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
在Debug的选项中也就有“Python: 当前文件”的选项了,如果想要在已经有launch.json的文件夹中调试,添加这一段到其中即可
调试Python文件的时候比较慢,比如调用Python还需要先激活Conda环境(选择Python解释器)
在编辑器窗口的右键选项中还有使用Jupyter-notebook作为交互式运行的选项,需要在Conda环境中准备:
conda install ipykernel
python -m ipykernel install --user --name 环境名称 --display-name "Python (环境名称)"
网页版
有上面的Remote-SSH,加上VSCode也是基于electron的,自然会想到能不能在浏览器中使用,偶然的一次机会还真的看到了这样的一个项目:Code-Server
这样一来,只要有一台配置OK的Linux的服务器,使用iPad之类的设备也可以在VSCode中看/写代码(随着iPad逐渐强调生产力,对键鼠支持的越来越好)
主题
Name: Vibrancy
Id: eyhn.vscode-vibrancy
Description: Vibrancy Effect for Visual Studio Code
拖动有些卡顿,打开的时候窗口大小有些异常,不过,不影响代码体验~(笔记本上可能对GPU负担太大从而影响续航)
最近发现有个网站收集了很多微软的壁纸:Wallpaper Hub
最重要的是,网站有一些Fluent Design的元素,最明显的就是Acrylic的效果了
其他插件
- markmap,将Markdown转换为树状的思维导图
- drawio,对于常见的流程图和框图,往往不需要特别重量级的工具,只需要创建.drawio的新文件就可以VSCode内画框图了
- Marp,由Markdown生成slide,写slide也可以轻松地专注内容
How to Scoop
Scoop作为Windows下的命令行包管理工具,在之前的文章里用到的非常多,最近又看了下Scoop的说明,这里简要的介绍下更新后的特性,附带一些常用的命令行工具
Github:lukesampson/scoop的README对Scoop有了大概的介绍,我初次接触到是读到了 再谈谈 Scoop 这个 Windows 下的软件包管理器
缘由
- 安装常见命令行工具
- 自带配置环境变量,方便配置简易的开发环境
- 有脚本自动化执行的优势,方便快速部署(比如重装系统的时候)
需要注意的是如果Scoop安装的软件和Powershell的命令或者别名重合,Powershell的命令依然被优先使用
安装
可以使用管理员模式打开powershell运行
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
# or shorter
iwr -useb get.scoop.sh | iex
多线程下载支持
部分软件源在Github之类的连接性不太好的地方,偶尔下载很慢而且易报错,现在Scoop推荐默认使用aria2进行多线程下载,只需要安装aira2即可开启多线程下载
scoop install aria2
添加额外的仓库
参考SpencerWoo的文章添加的软件仓库基本上够用了
scoop bucket add extras
scoop bucket add java
scoop bucket add dorado https://github.com/h404bi/dorado
- 默认的main仓库以命令行工具为主(比如收录的cmder是个有GUI的终端软件),例如Linux常用的sed, grep, gawk,vim可以大大方便Powershell的日常使用
- extra仓库收录的高质量的gui软件比较多,比如说googlechrome,typora,vscode
- java仓库收录了多种多版本的JDK,结合下文的
scoop reset
,可以便捷的切换环境变量下的JDK - dorado仓库收录了相当一部分国内常用的软件如微信,网易云,besttrace,因为下载源在国内下载速度很OK
常用软件
除去上面介绍的一些,其实想得到软件都可以在Scoop中使用scoop search
找下看看
$ scoop list
Installed apps:
7zip 19.00
chromedriver 76.0.3809.126
cmder-full 1.3.11
concfg 0.2019.03.09
ffmpeg 4.1.3 #编码工具
gawk 3.1.7
gcc 8.1.0
gdrive
git 2.21.0.windows.1
grep 2.5.4
innounp 0.48
iperf3 3.1.3 #网速测试工具
nodejs 12.5.0
pshazz 0.2019.04.02
R 3.6.0
sed 4.2.1
tesseract 4.1.0.20190314 #OCR工具
vim 8.1.1302
youtube-dl 2019.05.20 #偶尔下载视频
trafficmonitor #任务栏网速,CPU内存占用监测
screentogif #Gif录屏软件
ntop #类似htop的的终端下的资源监视器(但是做不到htop那么强大)
glow #终端下的Markdown Render
openjdk #添加java仓库后,默认安装最新版的openjdk
openjdk9 #java9
sudo
部分命令是无法在普通模式下运行的,一般的方法是打开一个新的管理员模式的窗口,相对来说不太方便,scoop可以安装sudo来实现对单一命令的赋权
比如设置禁用eth0接口的别名
scoop alias add ethd 'sudo netsh interface set interface eth0 disabled' 'disable eth0'
输入scoop ethd
之后就会弹出用户账户控制的弹窗,提示需要管理员权限,用键盘确认就好,省去了再开一个窗口的麻烦(如果是长串命令都需要管理员权限的话还是开一个吧)
ffmpeg
只介绍常用的简单指令
录制直播
面对没有加密的m3u8直播录制,IPTV用的较多,m3u8的地址可以通过浏览器的检查工具找到
ffmpeg -i m3u8 'test.ts'
合并音频和视频
现在越来越多的网站选择把音频和视频分开,使用IDM下载两个文件可以直接用ffmpeg做快速的合并(复制)
ffmpeg -i v.mp4 -i a.mp4 -c copy output.mkv
当然如果youtube-dl支持视频网站的话使用youtube-dl更方便
提取视频中的音轨
常用于提取BGM,不做重编码的情况
ffmpeg -i input-video.avi -vn -acodec copy output-audio.aac
-vn没有视频 -acodec copy说使用已经存在的相同的音频流
注意事项
scoop依然有许多不成熟的地方,在高可靠性要求的环境下依然是不推荐的,最经常遇到的莫非是软件安装因为网络等问题终端,安装状态会返回成功,如果需要重新安装的话需要先进行卸载
再一个就是环境变量的问题,scoop可以在安装的时候配置好一些环境变量,但是卸载却不一定会移除,这就导致一些重要的软件在Scoop卸载之后再在其他位置安装会出现环境变量错误的问题
部分高度依赖于安装目录,权限以及关联众多的软件不推荐使用scoop安装,如Chrome
使用Scoop提供的别名
Powershell的别名设置不方便,直接使用WSL的自定义别名(.bashrc)调用Windows下的程序又不能直接在Powershell中运行,直到发现Scoop可以自由的添加“环境变量”,想起来Scoop alias来设置程序运行的scoop别名
本来的用法应该是为Scoop内的操作添加别名:
# Install app
scoop alias add i 'scoop install $args[0]' 'Innstall app'
scoop alias add add 'scoop install $args[0]' 'Install app'
# Uninstall app
scoop alias add rm 'scoop uninstall $args[0]' 'Uninstall an app'
scoop alias add remove 'scoop uninstall $args[0]' 'Uninstall an app'
# List apps
scoop alias add ls 'scoop list' 'List installed apps'
# Update
scoop alias add u 'scoop update $args[0]' 'Update apps, or Scoop itself'
scoop alias add upgrade 'scoop update $args[0]' 'Update apps, or Scoop itself'
但是这个格式看起来就很自由:
比如说给WinMTRCmd添加一个scoop mtr
的别名
scoop alias add mtr '~/winMTRCmd $args[0]' 'MTR tools for Win CMD'
之后使用scoop mtr [host]
就可以愉快的使用mtr工具了
使用Scoop切换软件版本
这里以切换Java版本为例,例如在安装了openjdk和openjdk9之后,从默认的openjdk9切换到openjdk16
$ java -version
openjdk version "9.0.4"
OpenJDK Runtime Environment (build 9.0.4+11)
OpenJDK 64-Bit Server VM (build 9.0.4+11, mixed mode)
$ scoop reset openjdk
Resetting openjdk (16.0.1-9).
Linking ~\scoop\apps\openjdk\current => ~\scoop\apps\openjdk\16.0.1-9
$ java -version
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment (build 16.0.1+9-24)
OpenJDK 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)
群晖使用Docker安装MQTT服务端 mosquitto
以下方法经本人验证通过,环境如下:
群晖 DS918+ DSM 6.2.4
mosquitto version 2.0.11
MQTTBox Version 0.2.3
前言:MQTT(Message Queuing Telemetry Transport)是一种基于发布/订阅(publish/subscribe)模式的”轻量级”通讯协议。客户端的发布者不直接将消息传递给订阅者,而是服务端(MQTT Broker)进行分发,一个客户端既可以是发布者,也可以是订阅者,更多介绍请参看维基百科上的词条 。以智能家居的情形简单举例,人体感应器(发布者)感应到有人时发布主题为”有人“的消息到服务端,而由于摄像头订阅了该主题,因此收到消息,开始录像,此时摄像头角色为(接收者),同时摄像头也作为(发布者)发布”监控异动“消息到服务器,而我们手机订阅了此主题,作为(接收者)便可收到消息。
目前有很多机构提供MQTT Broker服务,有免费的也有收费的。作为个人用户用于智能家居服务,我决定用已有NAS服务器自己搭建一个。参考了网上的一些文章,但大都写得有些复杂,对一般小白不是很友好,因此我尝试自创了一个极简的方法来实现,并记录下来供由需要的朋友学习。
第一步:管理员账号登陆群晖,在Docker中选择 “注册表”,搜索 “eclipse-mosquitto”,搜索结果中选择第一个,点击下载,选择标签latest。此时系统开始下载,可在“映像”中查看下载进度
第二步:下载完毕后,在“映像”里选择已下载的 eclipse-mosquitto 映像 ,点击启动按钮打开创建容器窗口。点击高级设置按钮,打开高级设置页面。
在高级设置中,勾选“启动自动重新启动”
在卷中,点击添加文件夹,在docker目录下新建文件夹 “mosquitto”并选择该文件夹,装载路径填写”/mosquitto/config”
在网络中,勾选“使用与 Docker Host 相同的网络”
确认应用后点击下一步,取消”向导完成后运行此容器“,然后应用
第三步:新建一个mosquitto.conf文件,并将该文件上传到 docker目录的 “mosquitto” 文件夹内。文件内容如下:
persistence true listener 18831 allow_anonymous true
- listener 为端口号,默认是1883,我机器上该端口被占用了,所以自己改了一个
- allow_anonymous true 表示支持匿名用户,此次为了教程简单因此开启匿名用户
文件上传后,再docker容器中启动第二步添加的 eclipse-mosquitto 容器
第四步:测试mosquitto服务
mqtt测试工具很多,我选择的是MQTTBox ,用chrome打开下列地址,添加应用后打开
https://chrome.google.com/webstore/detail/mqttbox/kaajoficamnjijhkeomgfljpicifbkaf?hl=zh-CN
点击”Create MQTT Client”,取一个名字,Protocol 选mqtt/tcp ,Host 填写你的主机地址和 mosquitto 服务端口 ,保存后可看到显示为Connected 表示已经正确连接上我们新建的mosquitto服务端
接着,添加一个订阅,主题随便写一个,我这里填FEEUS.COM,点击”Subscribe“完成订阅
在发布端发布一个订阅端一样的主题,这里也是 FEEUS.COM ,然后输入发布的消息,点击”Publish“后完成发布,该主题的订阅者即可收到该条消息
如果您喜欢这篇文章,或者它给您带来了帮助,您可以请我们喝一杯咖啡,我们将非常感谢您的支持!