词汇:use

n. 使用;用途;发挥

相关场景

The Dujingyan irrigation project is the only existing ancient hydro-power project and has produced comprehensive benefits in flood control, irrigation, water transport and general water consumption. It is still in use today, irrigating over 5300 square kilometers of the region's land.
都江堰水利枢纽工程是现存唯一的古水电工程,在防洪、灌溉、输水和一般用水方面产生了综合效益。它至今仍在使用,灌溉了该地区5300多平方公里的土地。
>> 16. Dujiangyan Irrigation Project
Incentive travel is a global management tool that uses an exceptional travel experience to motivate participants for increased levels of performance in support of organizational goals.
激励旅行是一种全球管理工具,它利用卓越的旅行体验来激励参与者提高绩效水平,以支持组织目标。
>> 15. Incentive Travel
f:
The use of different means of transportation;
使用不同的交通工具;
>> 3. Talking about the Itinerary
It's no use crying over the spilt milk.
为打翻的牛奶哭泣是没有用的。
>> 16. Slang in Tour Guiding
Can you use chopsticks?
你会用筷子吗?
>> 8. Arrange Meals
So that is a very quick tour of Rails, this is a wonderful way of getting started,just to use those scaffold generators and the authentication generators to get something going, get a Hello world out there, start working on your application, and before you know it, you might just be taking your application all the way from Hello World to IPO.
这是Rails的快速浏览,这是一种很好的入门方式,只需使用这些脚手架生成器和身份验证生成器即可开始工作,创建一个Hello world,开始开发你的应用程序,不知不觉中,你可能会把你的应用程序从Hello world一直带到IPO。
>> Rails 8.0.1 You are in good company
We're gonna turn the manifest on in our route file as well. There are basically two lines here as you can see, there's a manifest, and there's a service worker that you can use for your PWA.
>> Rails 8.0.1 You are in good company
Now, let's add a way to sign out to the main layout here. we can add that with a button to sign out.it's gonna hit the session path, and it's gonna use a method of delete that session if we're authenticated, as you can see there.
>> Rails 8.0.1 You are in good company
By default, Kamal will use a docker volume to start these things up, but of course, you can configure that, and as I said, you can use S3 if you'd like as well.
>> Rails 8.0.1 You are in good company
kamal setup:
But this is all we basically need, we are now ready to check in the entire project into Git! Kamal uses Git for keeping track of versions, and we can now run Kamal setup!
>> Rails 8.0.1 You are in good company
Now I'm gonna deploy this on my own little hoppy server. And that hoppy server is currently wiped. it is completely clean, and Ubuntu 24.04 setup that has nothing on it already, this is part of the magic of Kamal, you can spin up a new VM anywhere in the cloud or use your own hardware and point Kamal straight to it, and you'll be going in no time!
>> Rails 8.0.1 You are in good company
Docker Hub:
And there's a default configuration file in config/deploy.yml that we can use, it's prefilled a little bit, it has the service name of the name of reaction, but we need to rename, for example, your user,the name of the image to go to my name of where I store this on Docker Hub. You can see we change that down in the registry as well and the name of the container image.
>> Rails 8.0.1 You are in good company
Now, let's set things up to be dynamic, such that when we add a new comment to one of these, it's going to update the other as well. This is how we use web sockets in Rails using action cable, one of the frameworks that we have to create updates that are distributed automatically without folks having to reload their browser.
>> Rails 8.0.1 You are in good company
And then finally, let's paste in the form that we're gonna use. That form is going off a model, the new comment, but it's nested underneath the post, is that we automatically can deduce which URL that we should post this new form to.
>> Rails 8.0.1 You are in good company
We are pacing in the comment, and we're using that same time tag as we were using with the post, but this time, we are going to use time ago, so we get that nice two minutes ago on when something went posted rather than a local time spelled out with AM PM set up.
>> Rails 8.0.1 You are in good company
It'll automatically know that the comment model should map to view slash comment slash comment, so it can look up the right partial file to use. And then below that, we have the form that we're referencing with the comments new. So, let's hop in and paste in the individual comment. As you can see here, we just give it a div, that has a dom ID so that we can reference it.
>> Rails 8.0.1 You are in good company
16:03:
Now, we're also gonna add a number of partials here. This is the templating system, basically, a sub-routine that you can refer to. There's gonna be three of them that includes the entire comment section. We're gonna reference that in our post show in just a second. And within that, we're gonna refer to another partial for an individual comment, and another partial again for the new setup. So, let's paste some of that in here, You can see this for the entire collection, it just has an H2 for the comments, and we render the post comments. This again uses Rails' convention over the configuration approach.
>> Rails 8.0.1 You are in good company
Alright! Now let's add some comments to our blogging system! And I'm gonna use a different generator here,I'm gonna use a resource generator that is a little lighter than the one we were using for scaffold that doesn't generate a bunch of views, and doesn't generate all sorts of actions in the controller by default, but it does generate the new model that we need the comment model, it generates a migration for that, create comments ,and it generates just some empty placeholders for the comments controller and for the view action.
>> Rails 8.0.1 You are in good company
If you look at something like hey.com, you'll see this technique in use on a major application, and you can view all of the Javascript that we use to build that application, and that's the default for Rails.
>> Rails 8.0.1 You are in good company
And we're gonna start local time here. And in the local time, we're gonna use it, and we're gonna use it for adding the updated at timestamp here. And as you can see here, we're just adding a time tag that's just a vanilla HTML tag that has a data local time that's what activates that local time JavaScript set up.
>> Rails 8.0.1 You are in good company
But now that we've add that, let's have a look at our application JS file.That's the default setup that you have that the scaffold is going to use. And as you can see, we're using turbo-rails, we're including all the stimulus controllers, if we have any.
>> Rails 8.0.1 You are in good company
Now , Rails has a bunch of different ways you can do the CSS, there's also a path where you can use Tailwind. Lots of people like that for good reason, and there are a bunch of different options, all the major CSS frameworks are available, but by default, we ship with a no build, as I said, intention and simple CSS just make things look prettier without having to adorn anything with classes, or what have you.
>> Rails 8.0.1 You are in good company
compile:
By default, I like to use simple CSS. https://cdn.simplecss.org/simple.css. It is simply a individual file that's being included, I don't have to compile anything here, I'm just referencing it straight off their CDN. And if we save that and reload, you can see it just looks a little nicer.
>> Rails 8.0.1 You are in good company
And Rails uses ERB, which is essentially embedded Ruby. So, you mix HTML with Ruby in line, and you can split out more complicated functions into helper methods. But otherwise, this is the clearest cut setup in Rails, this is the default for integrating HTML and Ruby.
>> Rails 8.0.1 You are in good company
everyone does what they hate for money, and use the money to do what they love.
>> 43-Over the South Pole