日本國土百萬年的惡夢 每日數百噸的福島輻射污染水

文:宋瑞文(媽媽監督核電廠聯盟特約撰述)

本站聲明:網站內容來源環境資訊中心https://e-info.org.tw/,如有侵權,請聯繫我們,我們將及時處理

【【其他文章推薦】

※帶您來了解什麼是 USB CONNECTOR  ?

※自行創業缺乏曝光? 網頁設計幫您第一時間規劃公司的形象門面

※如何讓商品強力曝光呢? 網頁設計公司幫您建置最吸引人的網站,提高曝光率!

※綠能、環保無空污,成為電動車最新代名詞,目前市場使用率逐漸普及化

※廣告預算用在刀口上,台北網頁設計公司幫您達到更多曝光效益

※教你寫出一流的銷售文案?

印度環境部長:解決首都空污時間 會比北京短

摘錄自2019年11月23日中央通訊社印度報導

印度環境、森林與氣候變遷部部長賈瓦德卡爾昨天(22日)在印度國會下院答詢時聲稱,空污需要大規模運動來解決,「北京花了15年的時間,我們將花費更少時間(解決空污問題)」。

印度包含新德里在內國家首都區每年冬天因農民焚燒農田殘梗、車輛排放、建築工地揚塵、6000家餐廳用炭火燒烤雞肉、窮人焚燒垃圾取暖等諸多因素,陷入嚴重空氣污染,但印度政府一直無法拿出有效解決對策。空污在今年11月更有惡化趨勢,引發民眾不滿。

賈瓦德卡爾指出,政府已針對城市制定監測空氣污染計畫,目前在全印度355個城市監測空污。此外,政府正每天展開工作以消除空污威脅,包括2018年啟用東、西部外環高速公路,且已把碳排放降低了22%;在第6期汽車廢氣排放標準(BS VI)明年4月實施後,汽車廢氣排放量將可減少80%。

他還把空污問題與氣候變遷聯繫起來,並說印度的總發電量在2030年之前,將有40%是來自可再生能源;而且印度的綠地覆蓋率不斷增加,使印度成為可達到綠地覆蓋率標準的少數國家之一,更五度在國家首都區種植更多樹木,以替代因興建地鐵而砍伐掉的樹木。

本站聲明:網站內容來源環境資訊中心https://e-info.org.tw/,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

※為什麼 USB CONNECTOR 是電子產業重要的元件?

網頁設計一頭霧水該從何著手呢? 台北網頁設計公司幫您輕鬆架站!

※台北網頁設計公司全省服務真心推薦

※想知道最厲害的網頁設計公司"嚨底家"!

新北清潔公司,居家、辦公、裝潢細清專業服務

澳洲森林大火 空污程度空前

摘錄自2019年11月22日中央通訊社澳洲報導

澳洲新南威爾斯省遍布森林野火,飄散出的煙霧使今天(22日)空污程度空前,造成就醫人數激增,並引起駕駛人視線不良等危險。

澳洲人口第一大城雪梨(Sydney)已連續4天被煙霧籠罩,罕見但一再成為世界空污最嚴重的10大城市之一。近幾天來某些時候,全球城市空氣品質監測網站Air Visual排行顯示,雪梨名列世界空污最嚴重的第8大城市,排名在雅加達及深圳之前,位居孟買之後。

隨著強風吹送林火煙霧以及因全澳3年乾旱而堆積的灰塵,波克鎮的空污比安全標準高出15倍。煙霾挾帶著來懸浮微粒污染物,形成官員所說新南威爾斯省紀錄中的最嚴重污染。這種粒子會被人體吸入血液中。

大火迄今仍在新南威爾斯省、維多利亞省(Victoria)、南澳省(South Australia)及昆士蘭省(Queensland)燃燒。澳洲總理莫里森(Scott Morrison)因為這次危機而受到壓力,批評者指稱,莫里森並未盡力處理氣候變遷的衝擊。氣象學家則指出,氣候變遷正導致野火季節的時間延長。

本站聲明:網站內容來源環境資訊中心https://e-info.org.tw/,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

USB CONNECTOR掌控什麼技術要點? 帶您認識其相關發展及效能

台北網頁設計公司這麼多該如何選擇?

※智慧手機時代的來臨,RWD網頁設計為架站首選

※評比南投搬家公司費用收費行情懶人包大公開

※幫你省時又省力,新北清潔一流服務好口碑

一口氣投80億人民幣 比亞迪建長沙、青島兩個新能源車生產基地

比亞迪汽車於5月18日與湖南省長沙市雨花區經開區簽署合作備忘錄,比亞迪將投資50億元人民幣(下同),在長沙比亞迪汽車城二期興建電動卡車及專用車生產基地,計畫年內投產。   長沙比亞迪專案將由電動轎車、電動客車和電動卡車及專用車三部分組成。電動卡車及專用車專案,現已動工建設,是比亞迪電動卡車及專用車全球製造中心,含整車及相應配套零部件,目標向全中國工廠提供電動底盤、車橋等核心部件。比亞迪預計2016年將達產2500輛,規劃至2020年達5000輛年產能,2025年擴建到10000輛年產能。   此外,比亞迪在青島市城陽區投資30億元的新能源汽車專案一期目前已開工建設,這是青島城陽首個新能源汽車產業專案,也是建區以來引進的最大工業專案。根據規劃分三期建設完成,預計2017年全部建成。專案全部建成後,將年產電動汽車5000輛,年可實現銷售收入105億元。   此專案位於棘洪灘軌道交通裝備製造產業園內,規劃佔地1000畝,主要生產純電動轎車、中巴、小巴、物流車等產品,以及從事車輛電池、電機、電控等核心零部件的研發和製造。

本站聲明:網站內容來源於EnergyTrend https://www.energytrend.com.tw/ev/,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

※帶您來了解什麼是 USB CONNECTOR  ?

※自行創業 缺乏曝光? 下一步"網站設計"幫您第一時間規劃公司的門面形象

※如何讓商品強力曝光呢? 網頁設計公司幫您建置最吸引人的網站,提高曝光率!!

※綠能、環保無空污,成為電動車最新代名詞,目前市場使用率逐漸普及化

※廣告預算用在刀口上,網站設計公司幫您達到更多曝光效益

※教你寫出一流的銷售文案?

比亞迪新能源車夯!2015年可望售出350億人民幣

根據中國汽車工業協會公佈的統計資料顯示,2015年1至4月份,比亞迪新能源汽車銷量已超過1.2萬輛。同時第一季,比亞迪歸屬於上市公司股東的淨利潤達1.2億元人民幣(下同),同比增幅高達910%。   按4月份單月的銷量資料來看,比亞迪乘用車總體銷量為32260輛,年減29.85%。但新能源汽車銷量為3646輛,其中秦2625輛,e6電動車890輛,騰勢131輛,實現了正向增長。   據比亞迪相關人士介紹,2015年,比亞迪還將推出包括鎖定個人消費者的插電式混合動力汽車「唐」,中型及緊湊型插電式混合動力SUV車型「宋」和「元」,以及新能源商用車「商」等。除此之外,在特種車輛方面,比亞迪也會逐步加快研發並推出應用於礦山、港口、機場及倉儲等領域的車型,以及應用於環衛、城市物流等領域的特種車輛。   而比亞迪副總裁廉玉波在出席內地電動車研討會時透露,預料今年可售出約值300億元至350億元的新能源汽車,料全年可售出約6.7萬部新車,佔公司汽車業務一半收入,並有望達到「自給自足」盈利水準。   他表示,現時比亞迪每月可售出1,000部純電動車e6,純電動巴士每月售約600部。且位於惠州的電池廠3月起投產,有利提升產能;其中較受歡迎的混能車「秦」,6月時產能將增至6,000架。而比亞迪與戴姆勒合資生意的純電動車「騰勢」,每月約售出500部,估計年底時將增至3,000至4,000部。

本站聲明:網站內容來源於EnergyTrend https://www.energytrend.com.tw/ev/,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

※為什麼 USB CONNECTOR 是電子產業重要的元件?

網頁設計一頭霧水??該從何著手呢? 找到專業技術的網頁設計公司,幫您輕鬆架站!

※想要讓你的商品成為最夯、最多人討論的話題?網頁設計公司讓你強力曝光

※想知道最厲害的台北網頁設計公司推薦台中網頁設計公司推薦專業設計師”嚨底家”!!

新北清潔公司,居家、辦公、裝潢細清專業服務

Tesla 挹注擴大 F-貿聯第三季營收季增幅度大

Tesla 日前發表的儲能電池計畫,受到外界關注,法人評估,首波供應商 F-貿聯最快 8 月有機會開始交貨,明年下半年新計畫挹注逐步擴大。法人也預估,該公司本季營收季增個位數、且將挑戰單季新高,第三季起隨 Tesla 新 SUV 車款問世,6 月下旬起零件逐月放量,下季營收季增幅度將拉大,全年營收拚增兩位數。   F-貿聯與 Tesla 的往來關係深厚,早在 Tesla 還未成為全球知名的電動車大廠前,就已相互搭配,因此也成為該客戶的指標核心供應商。一直以來,貿聯較為人熟知是 Tesla 電動車電池管理系統線束的獨家供應商,此次配合與松下合資的超級電池工廠明年下半年量產,電池供應量將大增。   據了解,F-貿聯已是特斯拉除能電池系統 Powerwall 與企業用 Powerpack 計畫的首波零件供應商,供貨品項仍為電池管理系統用線。法人預期,最快 8 月有望正式交貨,雖對今年的營收貢獻不大,但更確認了貿聯在 Tesla 各項計畫共同開發的核心地位,而明年下半年超級電池工廠如果順利量產,該計畫的挹注將明顯增溫。

本站聲明:網站內容來源於EnergyTrend https://www.energytrend.com.tw/ev/,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

USB CONNECTOR掌控什麼技術要點? 帶您認識其相關發展及效能

※評比前十大台北網頁設計台北網站設計公司知名案例作品心得分享

※智慧手機時代的來臨,RWD網頁設計已成為網頁設計推薦首選

※評比南投搬家公司費用收費行情懶人包大公開

※幫你省時又省力,新北清潔一流服務好口碑

用Visual C++創建WPF項目的三種主要方法

用Visual C++創建WPF項目的三種主要方法

The problem with using XAML from C++

Because C++ doesn’t support partial class definitions, it isn’t possible to directly support XAML in VC++ projects using this mechanism. That isn’t, however, the core reason why VC++ doesn’t directly support XAML. In addition to using the x:Class attribute, you can also use the x:Subclass attribute so that the XAML gets compiled into the class specified by the x:Class attribute, and the code behind will define the class specified by x:Subclass, which will be derived from the x:Class type. Thus, the lack of partial classes isn’t that big of a block. The main issue is that, right now, no 100-percent CodeDOM support is available to convert

the XAML to C++, and that is the single biggest reason why VC++ doesn’t support XAML intrinsically. I don’t know this for sure, but it’s possible that on a later date, the Visual C++ team may work on their CodeDOM support and provide a fully functional XAML-to-C++ converter. Once that’s available, XAML support can be integrated into VC++ projects. As of today, however, that isn’t an option.

NOTE: CodeDOM is a term used to represent a bunch of types available in the System.

CodeDom namespace that lets you abstract code into an object model. Source code is represented using the CodeDOM tree and can be converted into source code for a specific language using the CodeDOM code generator for that specific language.

Still, the fact that you can’t directly use XAML in a Visual C++ project doesn’t mean that WPF applications can’t be written with Visual C++.

Three ways to write WPF apps using VC++

You can use three different approaches to write WPF applications using Visual C++. Each has its pros and cons, and we’ll cover each of these approaches in the next section:

  • Use procedural code.

For one thing, you can directly use procedural code to

write Avalon-based applications and avoid using XAML. Of course, if you

do that, you automatically give up the advantages of declarative programming

that XAML brings in, but for certain scenarios, procedural code often

serves the purpose well.

  • Dynamically load XAML.

Alternatively, you can dynamically load XAML during runtime to create your Avalon windows, although the disadvantage is that you’d be distributing a bunch of XAML files with your application.

  • Derive from a class in a C# DLL

A third technique uses a C# project to create your XAML-based Avalon controls and have a class (or classes) in your C++ project that derives from the classes in the C#-based Avalon DLL. With that mechanism, the UI is created using XAML in the C# project, and the business logic is kept in the C++ project.

When you’re developing WPF applications with C++, you can use one or more of these approaches to achieve whatever functionality you want. In the next section, you’ll see how to write a simple WPF app with C++/CLI using each of the three techniques mentioned here.

7.2 Using C++/CLI to write a WPF application

If Visual C++ doesn’t have support for XAML, and there are no project templates for building an Avalon application (as of the June 2006 CTP), how much extra effort does it take to write Avalon applications using C++? In this section, you’ll find out. You’ll put the three different techniques I described at the end of section

7.1.2 into action. All three mechanisms have their advantages and disadvantages; you can decide which is most suitable for your specific scenario. First, though, let’s briefly go over how to create a new C++/CLI project for Avalon.

7.2.1 Creating a new C++/CLI Avalon project

Avalon is a managed framework, and as such any Visual C++ project that needs to access and use Avalon needs to have the /clr compilation mode turned on.

Creating a new C++/CLI project with support for Avalon is fortunately not a difficult task. Table 7.1 lists the few simple steps you need to follow each time you create an application (or library, as the case might be) that uses Avalon.

Table 7.1 Steps to create a C++/CLI Avalon project

Step Action How To
1 Generate a new project Using the application wizard, specify the CLR Empty Project template.
2 Set the SubSystem to /SUBSYSTEM:WINDOWS Apply this change in the Project properties, Linker settings, System sub-setting.
3 Set the Entry Point to main From Project properties, choose Linker settings and then the Advanced sub-setting.
4 Add references to the following assemblies: System PresentationCore PresentationFramework WindowsBase Note: Except for System, the other three are required for Avalon.

At this point, your empty project is ready for writing Avalon code. Of course, you don’t have any code yet to compile, but you’ll fix that soon.

7.2.2 Using procedural code

You’ll now write your first Avalon application using C++/CLI, and you’ll do so entirely using procedural code. Think of it as analogous to an instruction book for putting together a table that contains only textual instructions (analogous to the procedural code) and no pictures (analogous to the XAML).

Create a new CLR project using the steps outlined in the previous section, and add an App.cpp file to it (you can call it whatever you want). Listing 7.2 shows the code for the simplest Avalon application that shows a window onscreen.

Listing 7.2 A simple Avalon app in procedural code

If you compile and run the application, you’ll see a window onscreen that can be moved, resized, minimized, maximized, and closed. Avalon requires you to set the COM threading model to single threaded apartment (STA). You do so using the STAThread attribute on the main function . You then create a new instance of the Application object (using gcnew) and invoke the Run method on that instance, passing in a new instance of a Window object (again using gcnew) . The Application class represents an Avalon application and provides the core functionality for running the application. It has a Run method that is called to initiate the application’s main thread. The Run method has an overload that accepts a Window object, which you use in the code. This overload launches the application and uses the specified Window as the main application window. The Window class represents the core functionality of a window and by default provides you with basic windowing functionality such as moving, resizing, and so on, which you verified when you ran the application and saw a fully functional window onscreen.

Note: Those of you who have an MFC background may see a faint similarity between this model and MFC, where the CWinApp class is analogous to the Application class, and the CFrameWnd class is analogous to the Window

class. CWinApp has a Run method that provides the default message loop, and Application::Run does something similar. Of course, you shouldn’t infer too much from these minor similarities because they’re totally different UI programming models, but it’s possible that a similar design model was used by the architects of Avalon.

This little program doesn’t have a lot of functionality; it just uses the default Window object to create and show a window onscreen. Let’s write a more refined application with its own Application-derived object as well as a window with some controls. Figure 7.4 shows a screenshot of what the enhanced application

will look like.

The main steps involved would be to derive two classes-one from the Window class, and the other from the Application class. You’ll start with the Window-derived class.

Figure 7.4

Enhanced WPF app in C++ (procedural code)

Writing the Window-derived class

The first thing you’ll do is add a new class called FirstWindow to your project, which will be derived from the Window class. You’ll also add some member variables for the various controls and set some of the window properties in the constructor. Listing 7.3 shows the code once you’ve done that.

Listing 7.3 A more functional Avalon app in procedural code

using namespace System;

using namespace System::Windows;

using namespace System::Windows::Controls;

It’s much like Windows Forms programming, except that the controls you declare ①. are from the System::Windows::Controls namespace (which contains various WPF controls). You set properties like Title, Width, Height, and so on on the window object in the constructor ②. There’s also a call to a method called InitControls ③, where you initialize the child controls (I put it into a separate method to improve the code’s readability). Listing 7.4 shows the InitControls method. Basically, you instantiate each of the child controls, instantiate a container control, add the child controls to the container controls, and finally set the container control as the main Content of the parent window.

Listing 7.4 Function to initialize the Avalon controls

void InitControls(void)

{
      listbox = gcnew ListBox();
      listbox->Width = 180;

      listbox->Height = 350;

      Canvas::SetTop(listbox, 10);

      Canvas::SetLeft(listbox, 10);

      textbox = gcnew TextBox();

      textbox->Width = 180;

      textbox->Height = 25;
    
      Canvas::SetTop(textbox, 10);

      Canvas::SetLeft(textbox, 200);

      addbutton = gcnew Button();

      addbutton->Width = 80;

      addbutton->Height = 25;

      addbutton->Content = "Add";

      Canvas::SetTop(addbutton, 45);

      Canvas::SetLeft(addbutton, 200);

      addbutton->Click += gcnew RoutedEventHandler(this, &FirstWindow::OnAddButtonClick);

      maincanvas = gcnew Canvas();

      maincanvas->Children->Add(listbox);

      maincanvas->Children->Add(textbox);

      maincanvas->Children->Add(addbutton);

      Content = maincanvas;
}

Again, you probably notice the similarity with Windows Forms programming.

You instantiate the child controls ①, ②, and ③, and set various properties like Width and Height, and you also use the Canvas::SetTop and Canvas::SetLeft methods to position them on their container. For the button control, you also add an event handler for the Click event ④. Then, you instantiate the Canvas control (which is a container control for other child controls) and add the child controls as its children ⑤. Finally, you set the Content property of the window to this Canvas control ⑥.

Now, you need to add the Click event handler for the button control, where you add the text entered into the TextBox to the ListBox:

void OnAddButtonClick(Object^ sender, RoutedEventArgs^ e)
{
​	listbox->Items->Add(textbox->Text);
​	textbox->Text = "";
​	textbox->Focus();
}

Notice that you set the text of the TextBox to an empty string once you’ve added it to the ListBox. You also call the Focus() method so that the user can continue

adding more entries into the ListBox. The Window-derived class is ready. Let’s now write the Application-derived class.

Writing the Application-derived class

You derive a class called FirstApp from Application and add an override for the OnStartup method where you create and show the main window:

#include "FirstWindow.h"

ref class FirstApp : Application
{
public:
FirstApp(void){}

protected:
      virtual void OnStartup(StartupEventArgs^ e) override
      {
          Application::OnStartup(e);
          FirstWindow^ mainwnd = gcnew FirstWindow();
          mainwnd->Show();
      }
};

The OnStartup method is called, not surprisingly, when the application has just started. You override that function so that you can instantiate and show the window.

The base function is responsible for invoking any event handlers associated with the Startup event, and thus you need to call the base method in the override.

Now, all that’s left is to modify the main function to use the custom Application object instead of the default, as shown here:

#include "FirstApp.h"

[STAThread]

int main(array<String^>^ args)
{
	return (gcnew FirstApp())->Run();
}

Notice that you don’t specify a window object to the Run method, because the window object is created in the OnStartup override of your Application-derived class.

Compile and run the application, and try entering some text into the TextBox and clicking the Add button. You should see the text being entered into the ListBox.

When you use procedural code with Avalon, it’s much like using Windows Forms, where you derive classes from the default controls, set some properties, add some event handlers, and are done. Procedural code is all right to develop WPF applications for simple user interfaces, but sometimes it makes better sense

to take advantage of XAML and declarative programming. As I’ve mentioned a few times already, XAML isn’t directly supported in VC++, so you’ll have to look at alternate options to make use of XAML. One such option is to dynamically load the XAML at runtime.

7.2.3 Dynamically loading XAML

In this section, you’ll rewrite the application you wrote in the previous section, using dynamically loaded XAML. This way, you get to leverage the power of XAML and declarative programming (which you couldn’t in the procedural code technique you used in the previous section). Continuing the instruction-book analogy, this will be like one that has textual instructions that refer to pictures (which describe the various steps needed) and are loosely distributed along with the book but not directly printed in the book. You’ll define the UI using XAML instead of procedural code. When you’re done, you’ll have an identical application

to the one you previously created.

Create a new C++/CLI Avalon project using the steps mentioned in the introduction to section 7.2, and call it FirstAvalonDynamic (or whatever you want to call it). The first thing you’ll do is write the XAML (MainWindow.xaml) that represents the UI; see listing 7.5.

Listing 7.5 XAML for the main window

<Window

     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

     Title="First Avalon App (dynamically load XAML)"

     Height="400" Width="400"

     ResizeMode="NoResize"

     > 

     <Canvas>
           <ListBox Canvas.Left="10" Canvas.Top="10"
                 Width="180" Height="350"
                 Name="listbox" />
               <TextBox Canvas.Left="200" Canvas.Top="10"
                 Width="180" Height="25"
                 Name="textbox" />
           <Button Canvas.Left="200" Canvas.Top="45"
                 Width="80" Height="25"
                 Name="addbutton">Add</Button>
     </Canvas>
</Window>

The XAML shown does exactly what you did with the procedural code earlier. For the control elements, you use the same names using the Name attribute as you use for the member variables in the procedural code. Next, you need to hook an event handler to the Button so that the text entered into the TextBox is inserted

into the ListBox. For that, you’ll write a helper class, as shown in listing 7.6.

Listing 7.6 WindowHelper class that implements the event handler

using namespace System;

using namespace System::Windows;

using namespace System::Windows::Controls;

using namespace System::Windows::Markup;

using namespace System::IO;

ref class WindowHelper
{

     ListBox^ listbox;

     TextBox^ textbox;

     Button^ addbutton;



public:
WindowHelper(Window^ window)
{
   addbutton = (Button^)window->FindName("addbutton");

   textbox = (TextBox^)window->FindName("textbox");

   listbox = (ListBox^)window->FindName("listbox");

   addbutton->Click += gcnew RoutedEventHandler(

   this,&WindowHelper::OnAddButtonClick);
}

void OnAddButtonClick(Object^ sender, RoutedEventArgs^ e)
{
   listbox->Items->Add(textbox->Text);

   textbox->Text = "";

   textbox->Focus();
}

};

The WindowHelper constructor accepts a Window argument and uses the FindName method ① to get the control with the specified identifier (which maps to the Name attributes you used in the XAML). You also hook an event handler to the addbutton control ②. Finally, you have the event handler③, which is identical to the one you used in the procedural code project. Listing 7.7 shows the code for the Application-derived class, where you override OnStartup as before, except that you create a window dynamically by loading the XAML file from the disk.

Listing 7.7 The Application-derived class

ref class FirstAppDynamic : Application

{

public:

     FirstAppDynamic(void)
     {

     }

protected:
     virtual void OnStartup(StartupEventArgs^ e) override
     {

           Application::OnStartup(e);

           Stream^ st = File::OpenRead("MainWindow.xaml");

           Window^ mainwnd = (Window^)XamlReader::Load(st);

           st->Close();

           WindowHelper^ mainwndhelper = gcnew WindowHelper(mainwnd);

           mainwnd->Show();

     }

};

You open a file stream to the XAML using File::OpenRead ① and use the overload of XamlReader::Load ② that takes a Stream^ as parameter to create a Window object. This Load method works the magic, by reading and parsing the XAML and building a Window object out of it. You instantiate the WindowHelper object and pass

this Window object as the argument, so that the event handler for the addbutton control is properly set up ③. You then show the window ④ with a call to Show().

The main method is much the same as before, where you instantiate the Application object and call Run on it:

[STAThread]
int main(array<String^>^ args)
{

      return (gcnew FirstAppDynamic())->Run();

}

The advantage of using this technique over using procedural code is that you get to design your UI in XAML, thereby achieving a level of UI/code separation. You can also use Cider or some other XAML designer to quickly design flexible user interfaces, which would involve a good bit of hand-coding in procedural code.

The disadvantage is that you have to distribute the XAML file with your application, and if you have multiple windows, you then need that many XAML files.

There’s always the risk of a loosely-distributed XAML file getting corrupted (accidentally or otherwise) or even being deleted. You can embed all the XAML files as resources in the C++/CLI assembly and load them at runtime, but even that involves a lot of extra work. To avoid distributing XAML files loosely with your

application or embedding them as resources, you may want to use the technique we’ll discuss in the next section: putting the XAML into a C# project and accessing it via a derived class in a C++ project.

7.2.4 Deriving from a class in a C# DLL

You’ll write a third variation of the same application in this section. You’ll use a C# control library project for the XAML, and a C++ project that will utilize that XAML control by deriving a control from it. Using the instruction-book analogy again, this is essentially a picture-based, step-by-step guide with the textual

instructions printed alongside each picture providing some meta-information for the step indicated by that picture. First, use the New Project Wizard to generate a new C# .NET 3.0 Custom Control Library project, and delete the default XAML file generated by the wizard. The default XAML is derived from User-

Control and isn’t what you want. Add a new XAML file to the C# project that represents a Window, and either use Cider or hand-code the XAML from listing 7.8 into that file.

Listing 7.8 The Window class definition using XAML

<Window x:Class="CSXamlLibrary.BaseWindow"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     Title="First Avalon App (dynamically load XAML)"
     Height="400" Width="400"
     ResizeMode="NoResize"
     > 

     <Canvas>
           <ListBox Canvas.Left="10" Canvas.Top="10"
                 Width="180" Height="350"
                 Name="listbox" x:FieldModifier="protected" />

           <TextBox Canvas.Left="200" Canvas.Top="10"
                 Width="180" Height="25"
                 Name="textbox" x:FieldModifier="protected" />

           <Button Canvas.Left="200" Canvas.Top="45"
                 Width="80" Height="25"
                 Name="addbutton" x:FieldModifier="protected">Add</Button>
     </Canvas>

</Window>

The XAML is identical to that used in the previous project (where you dynamically loaded it) except for the x:Class attribute for the Window element, which specifies the name of the class that will be generated, and the x:FieldModifier attributes that are applied to the child control elements so they’re generated as protected members in the class (rather than as private which is the default). Build the C# project, and generate the control library. Once that’s done, create a new C++/CLI Avalon project (using the same steps as before), and then add a reference to this C# project. Now, you can write a new Window class that’s derived from the class in the C# DLL, as shown in listing 7.9.

Listing 7.9 Deriving the main window from the XAML-defined Window class

using namespace System;

using namespace System::Windows;

using namespace System::Windows::Controls;



ref class AppMainWindow : CSXamlLibrary::BaseWindow
{
     public:
           AppMainWindow(void)
           {
                 addbutton->Click += gcnew RoutedEventHandler(this, &AppMainWindow::OnAddButtonClick);
           }

           void OnAddButtonClick(Object^ sender, RoutedEventArgs^ e)
           {

                 listbox->Items->Add(textbox->Text);

                 textbox->Text = "";

                 textbox->Focus();

           }

};

The code is similar to what you’ve seen thus far, except that it’s a lot cleaner.

Unlike the first example, you don’t have a lot of clogged procedural code to create the UI. Unlike the second example, you don’t need a helper class to map the XAML elements to the control variables and event handlers. It’s definitely an improvement over the previous two examples, but you have to bring in the C#

project just for the XAML. The rest of the code needed for the application is more or less similar to what you saw earlier:

ref class FirstAppDerived : Application
{
      protected:
            virtual void OnStartup(StartupEventArgs^ e) override
            {
                  Application::OnStartup(e);
                  AppMainWindow^ mainwnd = gcnew AppMainWindow();
                  mainwnd->Show();
            }

};

[STAThread]

int main(array<String^>^ args)
{
      return (gcnew FirstAppDerived())->Run();
}

In some ways, the third technique is a sort of hybrid of the previous two techniques.

A lot of the code is identical to that in the first technique – as with the declaration of a custom class derived from Window and an Application-derived class with the OnStartup method creating the custom window. But, like the second technique, the UI definition is in the XAML, except that in this case, it’s compiled into the C# DLL. You also reduce lines of code with each successive technique. You had the most lines of code with procedural code (as is to be expected) and improved on that considerably when you moved the UI definition to the XAML in the dynamically-loaded XAML example. In the last example, you saved even further on lines of code, such as the helper class from the second example that had to wire the XAML elements to the member variables. Of course, the total lines of code (LOC) isn’t always the single deciding factor that determines what technique you choose. Table 7.2 shows a comparison of the three techniques; for each factor, the cells with the bold text reflect the technique (or techniques) that offer maximum performance (or convenience).

Table 7.2 Comparison of the three techniques

Procedural code Dynamically load XAML XAML in C# DLL
Cluttered code that generates the UI Yes No No
Dependency on loose XAML files No Yes No
Dependency on C#-based DLL No No Yes
Lines of code Maximum In-between Minimum
UI design convenience Poor Excellent Excellent
UI/business logic separation Poor Good Excellent
Level of Visual C++ project support Total Partial (Not applicable)

It’s hard to pinpoint a specific technique and claim that it’s the best one, because depending on your requirements, each has advantages and disadvantages. Of course, in the future, if Visual C++ has direct support for XAML (as I believe it will), that will be your best option for the majority of scenarios.

本站聲明:網站內容來源於博客園,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

※帶您來了解什麼是 USB CONNECTOR  ?

※自行創業 缺乏曝光? 下一步"網站設計"幫您第一時間規劃公司的門面形象

※如何讓商品強力曝光呢? 網頁設計公司幫您建置最吸引人的網站,提高曝光率!!

※綠能、環保無空污,成為電動車最新代名詞,目前市場使用率逐漸普及化

※廣告預算用在刀口上,網站設計公司幫您達到更多曝光效益

※教你寫出一流的銷售文案?

如何使用ABP進行軟件開發之基礎概覽

ABP框架簡述

1)簡介

在.NET眾多的技術框架中,ABP框架(本系列中指aspnetboilerplate項目)以其獨特的魅力吸引了一群優秀開發者廣泛的使用。

在該框架的賦能之下,開發者可根據需求通過官方網站【https://aspnetboilerplate.com/Templates】選擇下載例如Vue/AngluarJS/MVC等不同類型的模板項目,輕鬆加入ABP開發者的隊伍中,盡享基於ABP開發帶來的樂趣。

ABP開發框架也提供了豐富的文檔,能夠為開發者帶來許多便捷。目前ABP的文檔網站為:

官方文檔:https://aspnetboilerplate.com/Pages/Documents

文檔庫不可謂不全,加上國內眾多的ABP開發者參与的活躍的技術圈子,使得學習成本只是在第一個項目中比較高,後期將會越來越平滑。

2)現狀

當然,目前ABP的框架開發者和社區已經把更多的精力投入到了ABP.VNEXT開發框架,這個新框架以其DDD+微服務+模塊化的理念獲得了大量擁躉,使ABP框架的開發優先級已經開始逐漸降低。

但這是因為ABP框架的功能已經成熟穩定,且ABP是一種增量式的架構設計,開發者在熟練掌握這種框架后,可以根據自己的需要進行方便的擴展,使其成為小項目架構選型中一種不錯的備選方案。

當然,也存在一些弊端。例如由於ABP被稱為.NET眾多開發框架中面向領域驅動設計的最佳實踐,而囿於領域驅動設計本身不低的門檻,使得學習的過程變得看起來非常陡峭;

除此之外,ABP也廣泛使用了目前Asp.NET/Asp.NET Core框架的大量比較新的特性,對於不少無法由於各種原因無法享受.NET技術飛速發展紅利的傳統開發者來說,無形中也提高了技術門檻。

3)綜述

在這個系列中,本文計劃分成三篇來介紹ABP框架,第一篇介紹ABP的基礎概覽,介紹基礎知識,第二篇介紹ABP的模式實踐,第三篇,試圖介紹如何從更傳統的三層甚至是單層+SQL的單層架構,如何遷移到ABP框架。

(畢竟。。.NET遺留應用實在是太多了,拯救或不拯救?)

代碼結構結構

基本文件夾簡述

當我們通過ABP模板項目的官方網站下載一個項目后,我們所獲得的代碼包的結構如下圖所示,其中:

  • vue為使用iview框架構建的管理系統基本模板,該腳手架使用了yarn作為包管理器,並集成了vuex/axios等常用框架,並提供了用戶,租戶,權限三個基本功能的示例代碼,開發者只需發揮聰明才智就能快速的通過該框架入手前端項目。
  • (當然,該項目廣泛使用了typescript+面向對象的設計,似乎前端開發者。。普遍不擅長面向對象開發?)
  • aspnet-core則是一個完整的asp.netcore項目的快速開發腳手架。該腳手架集成了docker打包於一體,並包含基本的單元測試示例,使用了identity作為權限控制單元,使用swagger作為接口文檔管理工具,集成了efcore、jwt等常用組件,對於開發者來說,基本上算是開箱即用了。

前端vue項目

打開vue文件夾之後,該項目的基本目錄如下圖所示。(src文件夾)

lib文件夾

定義了與abp+vue腳手架項目的基礎組件和常見類庫,封裝了一系列基本方法。例如權限控制,數據請求,菜單操作,SignalR等基礎組件的用法。

router文件夾

定義了vue項目的路由規則,其中index.ts文件是項目的入口,router.ts文件定義了vue文件的路由規則。

store文件夾

由於本項目使用了vuex框架,所以我們可以來看看對於store文件夾的介紹。

在vuex框架中:

每一個 Vuex 應用的核心就是 store(倉庫)。“store”基本上就是一個容器,它包含着你的應用中大部分的狀態 (state)。
Vuex 和單純的全局對象有以下兩點不同:
Vuex 的狀態存儲是響應式的。當 Vue 組件從 store 中讀取狀態的時候,若 store 中的狀態發生變化,那麼相應的組件也會相應地得到高效更新。
你不能直接改變 store 中的狀態。改變 store 中的狀態的唯一途徑就是顯式地提交 (commit) mutation。這樣使得我們可以方便地跟蹤每一個狀態的變化,從而讓我們能夠實現一些工具幫助我們更好地了解我們的應用。

即vuex框架中,將原來的請求鏈路,抽象化為狀態的變化,通過維護狀態,使得數據的管理更加便捷,也易於擴展。

views文件夾

定義了登錄、首頁、用戶、角色、租戶的基本頁面,並提供了新增、查看、編輯、刪除的代碼示例。

綜上,該項目是一個結構清晰,邏輯縝密的前端框架,可以作為常見管理系統的腳手架。

後端項目

簡介

後端項目是一個遵循了領域驅動設計的分層,同時又符合Robert Martin在《代碼整潔之道》提出的【整潔架構】。

領域驅動設計簡介

在領域驅動設計的分層設計中,共有四個功能分層,分別是:

表示層(Presentation Layer):為用戶提供接口,使用應用層實現用戶交互。

應用層(Application Layer):介於用戶層和領域層之間,協調用戶對象,完成對應的任務。

領域層(Domain Layer):包含業務對象和規則,是應用程序的心臟。

基礎設施層(Infrastructure Layer):提供高層級的通用技術功能,主要使用第三方庫完成。

在後文中,基於abp對領域驅動設計的功能分層將進行多次、詳細敘述,本小節不再贅述。

整潔架構簡介

整潔架構是由Bob大叔提出的一種架構模型,來源於《整潔架構》這本書,顧名思義,其目的並不是為了介紹這一種優秀的架構本身,而是介紹如何設計一種整潔的架構,使得代碼結構易於維護。

(整潔架構就是這樣一個洋蔥,所以也有人稱它為“洋蔥”架構)

  1. 依賴規則(Dependency Rule)

用一組同心圓來表示軟件的不同領域。一般來說,越深入代表你的軟件層次越高。外圓是戰術是實現機制(mechanisms),內圓的是核心原則(policy)。

Policy means the application logic.

Mechanism means the domain primitives.

使此體系架構能夠工作的關鍵是依賴規則。這條規則規定軟件模塊只能向內依賴,而裏面的部分對外面的模塊一無所知,也就是內部不依賴外部,而外部依賴內部。同樣,在外面圈中使用的數據格式不應被內圈中使用,特別是如果這些數據格式是由外面一圈的框架生成的。我們不希望任何外圓的東西會影響內圈層

  1. 實體 (Entities)

實體封裝的是整個企業範圍內的業務核心原則(policy),一個實體能是一個帶有方法的對象,或者是一系列數據結構和函數,只要這個實體能夠被不同的應用程序使用即可。

如果你沒有編寫企業軟件,只是編寫簡單的應用程序,這些實體就是應用的業務對象,它們封裝着最普通的高級別業務規則,你不能希望這些實體對象被一個頁面的分頁導航功能改變,也不能被安全機制改變,操作實現層面的任何改變不能影響實體層,只有業務需求改變了才可以改變實體

  1. 用例 (Use case)

在這個層的軟件包含只和應用相關的業務規則,它封裝和實現系統的所有用例,這些用例會混合各種來自實體的各種數據流程,並且指導這些實體使用企業規則來完成用例的功能目標。

我們並不期望改變這層會影響實體層. 我們也不期望這層被更外部如數據庫 UI或普通框架影響,而這也正是我們分離出這一層來的原因所在。

然而,應用層面的操作改變將會影響到這個用例層,如果需求中用例發生改變,這個層的代碼就會隨之發生改變。所以可以看到,這一層是和應用本身緊密相關的

  1. 接口適配器 (Interface Adapters)

這一層的軟件基本都是一些適配器,主要用於將用例和實體中的數據轉換為外部系統如數據庫或Web使用的數據,在這個層次,可以包含一些GUI的MVC架構,表現視圖 控制器都屬於這個層,模型Model是從控制器傳遞到用例或從用例傳遞到視圖的數據結構。

通常在這個層數據被轉換,從用例和實體使用的數據格式轉換到持久層框架使用的數據,主要是為了存儲到數據庫中,這個圈層的代碼是一點和數據庫沒有任何關係,如果數據庫是一個SQL數據庫, 這個層限制使用SQL語句以及任何和數據庫打交道的事情。

  1. 框架和驅動器

最外面一圈通常是由一些框架和工具組成,如數據庫Database, Web框架等. 通常你不必在這個層不必寫太多代碼,而是寫些膠水性質的代碼與內層進行粘結通訊。

這個層是細節所在,Web技術是細節,數據庫是細節,我們將這些實現細節放在外面以免它們對我們的業務規則造成影響傷害

ABP的分層實現

在ABP項目中,層次劃分如下。

1. 應用層(Application項目)

在領域驅動設計的分層式架構中,應用層作為應用系統的北向網關,對外提供業務外觀的功能。在Abp模板項目中,Application項目也是編寫主要用例代碼的位置,開發者們在此定義與界面有關的數據行為,實現面向接口的開發實踐。

應用服務層包含應用服務,數據傳輸單元,工作單元等對象。

  • Application Service

為面向用戶界面層實現業務邏輯代碼。例如需要為某些界面對象組裝模型,通常會定義ApplicationService,並通過DTO對象,實現與界面表現層的數據交換。

  • Data Transfer Object (DTO)

最常見的數據結構為DTO(數據傳輸對象),這是來源於馬丁弗勒在《企業架構應用模式》中提到的名詞,其主要作用為:

是一種設計模式之間傳輸數據的軟件應用系統。 數據傳輸目標往往是數據訪問對象從數據庫中檢索數據。

在ABP的設計中,有兩種不同類型的DTO,分別是用於新增、修改、刪除的Input DTO,和用於查詢的Output DTO。

  • Unit of Work:

工作單元。工作單元與事務類似,封裝了一系列原子級的數據庫操作。

2. 核心層(Core項目)

核心層包含領域實體、值對象、聚合根,以及領域上下文實現。

  • Entity(實體):

實體有別於傳統意義上大家所理解的與數據庫字段一一匹配的實體模型,在領域驅動設計中,雖然實體同樣可能持久化到數據庫,但實體包含屬性和行為兩種不同的抽象。

例如,如果有一個實體為User,其中有一個屬性為Phone,數據為086-132xxxxxxxx,我們有時需要判斷該手機號碼的國際代號,可能會添加一個新的判定 GetNationCode(),可以通過從Phone字段中取出086來實現,這就是一種通俗意義上的行為。

  • Value Object(值對象):

值對象無需持久化到數據庫,往往是從其他實體或聚合中“剝離”出來的與某些聚合具備邏輯相關性或語義相關性的對象,有時值對象甚至只有個別屬性。

例如,上述實體,包含Phone字段,我們可以將整個Phone“剝離”為一個Telephone對象,該對象可包含PhoneNumber和NationCode字段。

public class User
{
     public Telephone Phone{public get;private set;}
}
public class Telephone
{
    public string  PhoneNumber {get;set;}
     public string NationCode  {get;set;}
}
  • Aggregate & Aggregate Root(聚合,聚合根):

聚合是業務的最小工作單元,有時,一個實體就是一個小聚合,而為聚合對外提供訪問機制的對象,就是聚合根。

在領域驅動設計中,識別聚合也是一件非常重要的工作,有一組系統的方法論可以為我們提供參考。

當然,事實上識別領域對象,包括且不限定於識別聚合、值對象、實體識別該對象的行為或(方法)本身是一件需要經驗完成的工作,有時需要UML建模方法的廣泛參与。

有時,我們會習慣於通過屬性賦值完成梭代碼的過程,從而造成領域行為流失在業務邏輯層的問題,那麼或許可以採取這樣的方法:

1、對象的創建,使用構造函數賦值,或工廠方法創建。

2、將所有對於屬性的訪問級別都設置為

public string Phone{public get;private set;}

然後再通過一個綁定手機號碼的方法,來給這個對象設置手機號碼。

public string BindPhone(string phone)
{
}

將所有一切涉及到對Phone的操作,都只能通過規定的方法來賦值,這樣可以實現我們開發過程中,無意識的通過屬性賦值,可能導致的“領域行為”丟失的現象發生。
這種方式可以使得對對象某些屬性的操作,只能通過唯一的入口完成,符合單一職責原則的合理運用,如果要擴展方法,可以使用開閉原則來解決。

但是,採用這種方式,得盡量避免出現:SetPhone(string phone) 這樣的方法出現,畢竟這樣的方法,其實和直接的屬性賦值,沒有任何區別。

  • Repository(倉儲)

倉儲封裝了一系列對象數據庫操作的方法,完成對象從數據庫到對象的轉換過程。在領域驅動設計中,一個倉儲往往會負責一個聚合對象從數據庫到創建的全過程。

  • Domain Service(領域服務)

領域服務就是“實幹家”,那些不適合在領域對象中出現,又不屬於對象數據庫操作的方法,又與領域對象息息相關的方法,都可以放到領域服務中實現。

  • Specification(規格定義)

規範模式是一種特殊的軟件設計模式,通過使用布爾邏輯將業務規則鏈接在一起,可以重新組合業務規則。

實際上,它主要用於為實體或其他業務對象定義可重用的過濾器。

3. 其他基礎設施(EntityFrameworkCore,Web.Core,Web.Host項目)

EntityFrameworkCore負責定義數據庫上下文和對EFCore操作的一系列規則、例如種子數據的初始化等。

Web.Core:定義了應用程序的外觀和接口。雖然從表面上看,Web.Core定義了作為Web訪問入口的控制器方法和登錄驗證的邏輯,看起來像是用戶表現層的東西,但是仔細想想,這些東西,何嘗不是一種基礎設施?

Web.Host:定義WEB應用程序的入口。

總結

本文簡述了ABP框架的前後端項目的分層結構,通過了解這些結構,將有助於我們在後續的實戰中更快入手,為應用開發插上翅膀。

本站聲明:網站內容來源於博客園,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

※為什麼 USB CONNECTOR 是電子產業重要的元件?

網頁設計一頭霧水??該從何著手呢? 找到專業技術的網頁設計公司,幫您輕鬆架站!

※想要讓你的商品成為最夯、最多人討論的話題?網頁設計公司讓你強力曝光

※想知道最厲害的台北網頁設計公司推薦台中網頁設計公司推薦專業設計師”嚨底家”!!

新北清潔公司,居家、辦公、裝潢細清專業服務

三次握手四次揮手

一直都知道 TCP 建立連接時需要三次握手,釋放連接時需要四次揮手,也大概能說出整個過程,但是一直對其中的設計思想理解不深,停留在“只可意會,不可言傳”的階段。這次寫一篇博客嘗試將其中的思想表達出來。

 

 

 

TCP 建連三次握手

首先解釋一下每個步驟的作用:
1、a 時刻,A 準備就緒,發送 SYN 包給 B,嘗試建立連接
2、b 時刻,B 收到 A 發來的 SYN 包,知道 A 要請求建連,回 SYN ACK 包,告訴 A 自己收到了建連請求,可以建連了
3、c 時刻,A 收到了 B 的回復,知道 B 準備好了,鏈路通暢,可以發送數據了。回  ACK 告知 B 收到了 B 的回復,下面要開始發送該數據了
4、d 時刻,B 收到了 A 的回復,知道 A 接下來要發數據了。至此,AB 雙方都確認整個鏈路已經可靠了,接下來可以發送數據了。

 

為什麼要多次確認呢?為什麼不可以 A 上來就直接發送數據給 B 呢?
這裏首先要明確一點,TCP 是傳輸層的協議,是建立在物理層、數據鏈路層、網絡層之上的協議,而底層的網絡是不可靠的,可能路由出問題,可能網關出問題,可能網線出問題,A 沒法保證自己發出來的消息 B 一定能收到,所以一定要反饋機制,即 ACK,這樣才能在不可靠的網絡層智商構建可靠的傳輸層。

 

類比一下生活中的例子,可以幫助我們理解
示例1,假設我們在火車上打電話,通話質量很差,我們的通話過程可能會是下面這樣:

 

 

AB 雙方首先需要確認彼此都能挺到對方的聲音,也就是保證電話通道是可靠的,之後才會開始說正事。如果一上來就直接說正事,可能 A 說完之後 B 根本就沒有聽到。
實際打電話過程中,如果遇到了斷線的情況,雙方可能需要進行多次“握手”確認。

 

示例2,假設我們給剛認識的人第一次打電話,通話過程可能是下面這樣:

 

 

AB 雙方都要確認對方的身份,也就是保證通話是在跟自己人進行,確保電話通道是可靠的,不是跟騙子通話,然後才會開始說正事。如果一上來沒有確認身份,不能保證通道是跟自己人進行的,那直接說出重要的事,很可能就泄漏了機密。

 

總之,握手過程的最終目的就是保證雙方都準備就緒,通路是可靠的,之後就可以放心的發送重要數據了。

 

那為什麼一定是三次呢,為什麼不是兩次或者四次呢?
先來說一下為什麼不能少。
一次可以嗎?不可以。設想一下,A 對 B 說:我要給你發數據。然後不等 B 的回復,接下來就開始發數據了。這時候根本不能保證 B 已經準備好了,那 A 發出來的數據就沒法保證 B 一定能收到。聯想生活中的場景,你隔着很遠的距離向對方喊話:我要把蘋果扔給你。然後不關心對方有沒有聽到,就直接扔了,那最終的結果通常就是對方接不到蘋果,因為對方可能根本沒有收到消息。
兩次可以嗎?不可以。設想一下,A 對 B 說:我要給你發數據,然後 B 收到消息后給 A 回復:收到,A 在收到 B 的回復后開始發送數據。這時候 A 端是可以準備就緒的,但是 B 端不知道 A 端當前的狀態。因為 B 在收到 A 的消息的時候,可能已經過去了很長時間,B 在回消息的時候,A 可能已經不在線了,此時 B 是不能直接發數據的。如果 A 再給 B 回一個 ACK,B 就可以確認當前鏈路狀態了,這就變成了三次握手。

接下來說一下為什麼不是四次。既然三次已經可以保證建立可靠通信,就不需要額外的一次交互了。

 

下面是幾個生活中相關的示例:

 

 

 

 

 

 

 

 

 

 

 TCP 斷鏈四次揮手
1、a 時刻,A 向 B 發出 FIN 包,表示自己沒有數據要發送了
2、b 時刻,B 收到 FIN 包,回復 FIN ACK,表示收到了 A 的 FIN 包,不會再接收 A 的數據了
3、B 在發完 FIN ACK 后,可能還有數據要發給 A,這個數據是不能停止發送的,有數據還是需要繼續發送
4、d 時刻,B 發完了數據,也發出 FIN 包,告訴 A 自己的數據發完了,不再發送數據了
5、e 時刻,A 收到了 B 的 FIN 包,知道 B 也沒有數據要發送了,回復 FIN ACK。此時,連接可以斷開了

建連只需要交互三次,斷連卻需要四次,這是為什麼呢?其實斷開連接和建立連接還是不一樣的。建連的時候,只要雙方都告知對方自己準備好了就可以,但是斷連的時候,一方提出要斷開連接,不再發數據,另一方不能立即斷開,因為這一方可能還有數據要發送,直到數據全部發送完成后才能確認斷開。

 

下面是幾個生活中相關的示例:

 

 

 

以上是對於三次握手、四次揮手的簡單介紹,裏面沒有更詳細的狀態介紹,之後的博客會介紹,這裏先放兩張圖。
TCP 三次握手

 

 

 

TCP 四次揮手
 

 

本站聲明:網站內容來源於博客園,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

USB CONNECTOR掌控什麼技術要點? 帶您認識其相關發展及效能

※評比前十大台北網頁設計台北網站設計公司知名案例作品心得分享

※智慧手機時代的來臨,RWD網頁設計已成為網頁設計推薦首選

※評比南投搬家公司費用收費行情懶人包大公開

※幫你省時又省力,新北清潔一流服務好口碑

“你開廠門 我開方便之門” ——福建省市場監管系統“促產”側記

  中國消費者報報道(記者 張文章)最近是企業復工復產的高峰期,然而復工復產、疫情防控兩手抓,兩手都要硬。復工復產面臨許多困難和擔憂:員工食堂就餐怎麼才安全?商事辦理如何才簡便?企業趕工,設備運作如何跟進?別擔心,福建省市場監管局早幫企業想好了,及時推出6方面16條服務措施,全力支持推動生產企業復產、重點項目復工。並呼籲相關企業大膽開門復產,把失去的時間搶回來,補回來。

  復工怎麼吃飯 築防線

  隨着復工復產高峰期臨近,集體用餐需求顯著增加,為深入做好新冠肺炎疫情防控工作,防範群體性聚餐可能引發的風險,福建省市場監管部門牽頭整合美團、餓了么等網絡訂餐平台和餐飲企業搭建疫情期間集體用餐配送服務平台,在保供應、保質量、強信心方面起到了积極作用。

  福州市台江區對復工企業食堂衛生狀況進行檢查,嚴查食材進貨來源,要求分時段分餐制,避免扎堆就餐。同時嚴格環境消殺,下發《預防性消毒工作手冊》,督促農貿市場、超市、餐飲店、非星級酒店嚴格落實清潔消毒制度,每日開市前、收市后全面消毒,加大對重點區域、重點設施設備消毒頻次。規範網絡外賣平台經營,推行無接觸配送。

  廈門市集美區杏林市場監管所“嚴把三關”,做好“小餐飲”復工安全。復工前,申請報備關。全面摸排掌握轄區“小餐飲”數據庫,通過電話、微信等,向2571家餐飲經營者詳細告知復工標準,督促餐飲單位在恢復營業前,提前向市場監管部門報備。復工時,現場檢查關。收到經營者報備后,執法人員按照網格劃分及時到現場檢查,對從人員健康狀況、體溫檢測、場所消殺、庫存食材清理等各方面進行詳細指導和嚴格把關。復工后,日常監督關。通過網格員每日現場巡查、微信宣傳、發動社區群眾舉報等方式,做好已復工“小餐飲”的日常監督。

  泉州市市場監管部門加強外賣訂餐平台監管,在疫情防控期間全面實行“無接觸送餐”;鼓勵入網餐飲單位使用“食安封簽”,避免送餐過程二次污染;指導公司選擇證照齊全、供餐資質和能力符合要求的單位訂餐,並設立專門接收台,實行“不見面取餐”;鼓勵企業發動交通方便的員工回家用餐,或自帶餐食解決用餐問題,進一步減少辦公場所用餐時段的人員密度和出入頻次。

  莆田市荔城區已形成市場、超市、餐飲、藥店常態化監管模式,持續提示餐飲服務單位轉變經營思路,採取打包、外賣、分餐配送等非堂食堂聚的經營模式,避免人群聚集傳播風險;有效督促市場開辦者及檔口經營者自律經營,嚴格落實禁止野生動物交易要求,建立健全索證索票、進貨查驗等制度,切實做好食品快檢及公示工作,做到“早發現、早溯源、早處置”,有效保障群眾“舌尖上的安全”。

  備案申請怎麼審批 特事特辦

  為全面有效防控疫情,全力保障人民群眾的生命安全和身體健康,切實提供便捷優質的企業註銷及商事登記服務,福建省市場監管部門為企業提供足不出戶的“網上辦“服務。

  福州市高新區市場監管部門開啟企業復工復產網上辦,利用釘釘App在線受理企業復工申請,開展不見面服務。對企業數據進行實時分析,對於符合高新區復工要求的予以備案。全面推行自主年報制度,通過微信、電話、短信等方式指導企業依法履行信息公示義務,激活更多企業投入生產經營,避免信用受損。

  漳州市長泰縣市場監管局為有效減少人員聚集,暫停窗口現場服務,全面推行“網上辦、掌上辦、郵寄辦、預約辦”審批服務模式,並公示了窗口諮詢電話。對於保障疫情防控工作需要的緊急業務,立足職能,特事特辦、急事急辦,着力打通抗‘疫’審批最後一公里。

  莆田市荔城區市場監管部門充分依託“網上辦、掌上辦、寄遞辦、預約辦”等有效手段,為市場主體提供“零見面、零跑腿、零成本”的高效優質服務,進一步壓減登記註冊環節、時間和成本。對生產企業轉產生產口罩、防護服等應急物資的,簡化生產資質審批程序,實行非要件容缺後補,對可通過數據共享獲取的材料,不要求申請人重複提交。

  三明市大田縣市場監管局加碼提速簡化審批程序,推行“非接觸式”的电子辦照渠道,實行企業名稱自由申報、企業設立網上辦,同時积極引導群眾通過“網上預審+雙向快遞”的方式寄送申請材料並領取證照和相關文書。深化個體工商戶登記制度改革,針對需線下辦證的特殊人群實現“15分鐘辦證圈”。

  設備安全怎麼保障 提供專業服務

  為全面保障疫情期間和節后復工復產企業的特種設備安全,進一步落實特種設備使用單位安全主體責任,福建省市場監管部門對特種設備安全進行了專項檢查。

  廈門市集美區市場監管局第一時間採取微信監管工作群轉發的宣傳形式,督促相關責任單位嚴格落實責任制。聚焦公眾聚集場所使用的特種設備和盛裝極度或高度危害介質、易燃易爆介質的承壓特種設備,採取科所聯動的監管模式,圍繞轄區復工復產企業、已開業的大型商場、樓座較多的居民小區、醫院、地鐵等主要場所加大巡查力度,重點查看在用電梯、鍋爐、液氧儲氣罐等特種設備的檢驗報告、維保記錄、使用單位的安全管理制度、事故應急措施和救援預案等情況。

  泉州市市場監管局組織省特檢院泉州分院和石化中心等兩個特種設備檢驗單位,充分利用特種設備安全監察平台,全面排查受疫情影響需要檢驗的特種設備,主動電話逐家聯繫各使用單位,及時了解復產復工安排,為即將復產復工企業開闢綠色通道,確保企業順利開工。

責任編輯:邊靜

本站聲明:網站內容來源再生能源資訊網http://www.ccn.com.cn/,如有侵權請聯繫我們,我們將及時處理

【其他文章推薦】

※帶您來了解什麼是 USB CONNECTOR  ?

※自行創業 缺乏曝光? 下一步"網站設計"幫您第一時間規劃公司的門面形象

※如何讓商品強力曝光呢? 網頁設計公司幫您建置最吸引人的網站,提高曝光率!!

※綠能、環保無空污,成為電動車最新代名詞,目前市場使用率逐漸普及化

※廣告預算用在刀口上,網站設計公司幫您達到更多曝光效益

※教你寫出一流的銷售文案?