浏览器编程_在浏览器中进行编程几乎在这里

浏览器编程

Earlier this year, GitHub announced a few new features during its Satellite 2020 event to help developers across the globe. One of these new features is Codespaces, which GitHub calls “your instant dev environment.”

今年早些时候,GitHub在其Satellite 2020活动中宣布了一些新功能 ,以帮助全球的开发人员。 这些新功能之一是Codespaces ,GitHub将其称为“您的即时开发环境”。

The goal of Codespaces is to allow anyone to instantly start up a dev environment so they can contribute to any project right away, with all the necessary tools and dependencies set up and ready to use.

Codespaces的目标是允许任何人立即启动开发环境,以便他们可以设置所有必要的工具和依赖项并随时使用,从而立即为任何项目做出贡献。

“Codespaces is an online development environment, hosted by GitHub and powered by Visual Studio Code, that allows you to develop entirely in the cloud.” — GitHub

“ Codespaces是一个在线开发环境,由GitHub托管并由Visual Studio Code支持,使您可以完全在云中进行开发。” — GitHub

After recently receiving access to the limited beta, I’ve tested out this fun new way to code and I’m happy to say it works wonderfully.

在最近获得了受限Beta的访问权限后,我已经测试了这种有趣的新编码方式,并且很高兴地说它可以很好地工作。

这个怎么运作 (How It Works)

Image for post
Screenshot by the author.
作者的屏幕截图。

By going to any GitHub repository and clicking three buttons, you’ll be taken to a working VS Code window in your browser within about 30 seconds. In this one tab, it’s possible to code, build, test, and deploy faster than ever before.

通过转到任何GitHub存储库并单击三个按钮,您将在大约30秒钟内被带到浏览器中有效的VS Code窗口。 在此选项卡中,可以比以往更快地进行编码,构建,测试和部署。

The possibilities are extended even more with a ready-to-go terminal and the ability to install VS Code extensions within your codespace. You can even connect to a codespace in VS Code on your own machine using the Visual Studio Codespaces extension.

通过现成的终端以及在代码空间内安装VS Code扩展的能力,扩展了更多可能性。 您甚至可以使用Visual Studio Codespaces扩展连接到自己计算机上的VS Code中的代码空间。

Repositories can also have specific settings to further customize Codespaces, including automatically installing extensions, forwarding ports, and more. This is done in a new devcontainer.json file and is documented nicely.

存储库还可以具有特定的设置来进一步自定义代码空间,包括自动安装扩展,转发端口等。 这是在一个新的devcontainer.json文件中完成的,并有很好的记录

One benefit of using Codespaces is that new developers can be ready to help out in just a few seconds, with fewer errors along the way. New contributors can instantly have access to all the tools and info needed to make their first commit to a project.

使用Codespaces的好处之一是,新开发人员可以在短短几秒钟内准备好提供帮助,同时减少错误。 新的参与者可以立即访问首次提交项目所需的所有工具和信息。

Take a look at this clip from the Satellite 2020 keynote for a live demo of Codespaces:

请查看Satellite 2020主题演讲中的以下剪辑,以获取Codespaces的现场演示:

何时可以使用 (When You Can Use It)

Right now, Codespaces is in a limited beta, meaning only a small group of users have access. It took almost four months for me to make my way through the waitlist.

目前,Codespaces处于测试版阶段,这意味着只有一小部分用户可以访问。 我花了将近四个月的时间才进入候补名单。

Pricing has not been finalized but is planned to follow a simple pay-as-you-go model. Right now, beta users are limited to two codespaces at a time.

定价尚未最终确定,但计划遵循简单的即付即用模式。 目前,beta用户一次只能使用两个代码空间。

For now, this feature can only be used in repositories you own and public repositories. This means private repos owned by an organization are not yet able to use Codespaces.

目前,此功能仅可用于您拥有的存储库和公共存储库。 这意味着组织拥有的私有存储库尚不能使用代码空间。

结论 (Conclusion)

Codespaces is a wonderful idea and a great way for new contributors to help out with any project on GitHub. With just a few clicks and a few seconds, anyone can have a fully functioning development environment in their browser.

代码空间是一个很棒的主意,也是新贡献者为GitHub上的任何项目提供帮助的绝佳方式。 只需单击几秒钟,任何人都可以在其浏览器中使用功能全面的开发环境。

Whether you just need to make one tiny change or add in an entirely new feature, Codespaces may be the way to go.

无论您只需要进行微小的更改还是添加全新的功能,Codespaces都是您的最佳选择。

Thanks for taking the time to read, and have a fantastic day!

感谢您抽出宝贵的时间阅读,并度过了愉快的一天!

翻译自: https://medium.com/better-programming/programming-in-your-browser-is-almost-here-a6a68ce63b60

浏览器编程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
网络编程,当然要用到Windows Socket(套接字)技术。Socket相关的操作由一系列API函数来完成,比如socket、bind、listen、connect、accept、send、sendto、recv、recvfrom等。调用这些API函数有一定的先后次序,有些函数的参数还比较复杂,对于开发者来说,不是很好用。于是,微软的MFC提供了两个类:CAsyncSocket和CSocket,极大地方便了Socket功能的使用。   CAsyncSocket类在较低层次上封装了Windows Socket API,并且通过内建一个(隐藏的)窗口,实现了适合Windows应用的异步机制(Windows Socket API默认情况下工作在阻塞模式,不方便直接在消息驱动的Windows程序上使用)。CSocket类从CAsyncSocket类派生,进一步简化了Socket功能的应用。不过很遗憾,正因为这两个类都内建了一个窗口,它们并不是线程安全的(thread-safe);如果要在多线程环境下应用Socket功能,建议自行封装Socket API函数。 基于TCP的socket编程的服务器端程序流程如下: 1、创建套接字 2、将套接字绑定到一个本地地址和端口号上(bind) 3、将套接字设为监听模式,准备接受客户请求(listen) 4、等待客户请求,请求到来时接受请求,建立链接,并返回 一个新的基于此次通信的套接字(accept) 5、用返回的套接字和客户端进行通信(send、recv) 6、返回,等待另一客户请求 7、关闭套接字 基于TCP的socket编程的客户端程序流程如下: 1、创建套接字 2、向服务器端发送请求(connect) 3、和服务器端进行通信(send、recv) 4、关闭套接字 基于UDP的socket编程的服务器端程序流程如下: 1、创建套接字 2、将套接字绑定到本地地址和端口号上(bind) 3、等待接收数据(recvfrom) 4、关闭套接字 基于UDP的socket编程的客户端程序流程如下: 1、创建套接字 2、和服务器端进行通信(sendto) 3、关闭套接字 异步方式指的是发送方不等接收方响应,便接着发下个数据包的通信方式;而同步指发送方发出数据后,等收到接收方发回的响应,才发下一个数据包的通信方式。   阻塞套接字是指执行此套接字的网络调用时,直到成功才返回,否则一直阻塞在此网络调用上,比如调用recv()函数读取网络缓冲区的数据,如果没有数据到达,将一直挂在recv()这个函数调用上,直到读到一些数据,此函数调用才返回;而非阻塞套接字是指执行此套接字的网络调用时,不管是否执行成功,都立即返回。比如调用recv()函数读取网络缓冲区数据,不管是否读到数据都立即返回,而不会一直挂在此函数调用上。在实际Windows网络通信软件开发,异步非阻塞套接字是用的最多的。平常所说的C/S(客户端/服务器)结构的软件就是异步非阻塞模式的。   对于这些概念,初学者的理解也许只能似是而非,我将用一个最简单的例子说明异步非阻塞Socket的基本原理和工作机制。目的是让初学者不仅对Socket异步非阻塞的概念有个非常透彻的理解,而且也给他们提供一个用Socket开发网络通信应用程序的快速入门方法。操作系统是Windows 98(或NT4.0),开发工具是Visual C++6.0。   MFC提供了一个异步类CAsyncSocket,它封装了异步、非阻塞Socket的基本功能,用它做常用的网络通信软件很方便。但它屏蔽了Socket的异步、非阻塞等概念,开发人员无需了解异步、非阻塞Socket的原理和工作机制。因此,建议初学者学习编网络通信程序时,暂且不要用MFC提供的类,而先用Winsock2 API,这样有助于对异步、非阻塞Socket编程机制的理解。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值