Tuesday, September 28, 2010

Open-source third-polar world



Two months ago, again came to China, Apache Brain Behlendorf, founder of the "open source you may not know about the eight things," the speech tells us that one thing which is: "Microsoft Loves Open Source" (Microsoft love open source). Brain explained that Microsoft long ago have been used in Windows, some Unix tools, and to make available the source code. Now, Microsoft has gradually strengthened and MySQL, SugarCRM, Jboss cooperation ... ... Microsoft really love open source? Are between the open source and proprietary, the ice began to loosen up?

Distant third pole

Times Square in New York crowd, in the European-style stone retrofitting of ancient Greece, or in Paris or Milan fashion conference, the most in the scene, which is in August this year, "LinuxWorld2007" promotional video of the three scenarios , the picture is to be given more meaning Nazhi polar penguins, wandering the continent in every corner of Europe. Obviously, the Penguin in the east of the territory has not yet established, despite the "Open Source is Everywhere" (open source everywhere) the concept of mammoth.

LinuxWorld 2006 Conference from the beginning, the open-source has made a lot of new propositions, such as configuration and management of open source technology, security, and how to conduct business in open source operating so successfully.

This means that open source maturity, based on the perspective from the people is no longer a problem. Thus beginning a new phase. We are considering what is open source, industrialization, and how open source into better productivity. In this regard, there are many open source-related events and can serve as a good note, for example, recently IBM and Red Hat in the United States jointly issued a program to encourage the Red Hat Enterprise Linux version of the IBM System z mainframes in the rapid development of plan; SAP customers have begun to join forces to expand Novell's Linux support options; the same time, Novell has also expanded its cooperation with IBM, the IBM's WebSphere Application Server Community Edition (WAS CE) embedded in its own SuSE Linux Enterprise in.

China OSS Promotion Union President Lu first group in China this summer, the second open source summit, Chinese developers are now referred to from the "consumer" to "contributor" role change, he, for example, in Linux (Kernel ). org community, the Chinese contribution to the Linux developers to pre-read memory management (Readahead) algorithm, has been Kernel2.6.23 accepted, the algorithm can enhance the performance of Linux.

But China's open-source community has been "Get more, contribute less," while the international community and the presence of cultural integration, as well as open source enterprise in China, "the form of open source," these issues have formed the open source environment with Chinese characteristics. Many people are puzzled by China's open-source path leading to where? How to stream merged into a river? How to build our development environment, to form the influential power of the open source community?

It was also during this time, the ambitious open-source companies and open source communities in China have made logical common goal - the construction of open-source third pole. Asianux Union of Growth, and thus have a demonstration effect.

Open-source standard-bearer

So far, Asianux Union has gone through three years of development road, which the Joint Red Flag from Beijing to Japan and South Korea HaanSoft Miracle companies jointly established. According to IDC data released in 2006, China's Linux server shipments in the first place shall be Asianux, its share was 31.8%, second place is Novell's 29.2%.

July 2007, Asianux Alliance Adds New Members - Vietnam open source software companies, the alliance also plans to open more Asian countries to join forces, Asianux Corporation will also be established by year's end. Microsoft's spokesman in China said this, Microsoft welcomes the competition in the market in various ways, this is from the side that, Asianux Union has felt the touch of a threat to Microsoft.

"We hope that by the end of 2009, Asianux to become Asia's first" Red Flag confidence Jia Dong, President & CEO, "Our goal is clear - to develop and promote a unified operating system platform in Asia to become the world are using operating system platform. "

Now, Asianux Union also put forward China's own unique "4-CO business model" that is jointly developed a unified brand, the common technical support and co-promotion, through the joint, to the advantage of both parties contributed, which will no doubt be the next summit where the third pole of power. "Asianux's model is open to the community spirit of collaboration applied to the commercial version, Asianux is the first group, we are the second group of such companies. When we look at holding this attitude problems, many problems will be solved. "Red Flag Software Co., Ltd. Product Marketing Director Gengzeng Jiang personal experiences.

New ideas summit

"Love Football say: I love the World Cup. Love open source, said: I love open source. Love football part of the Chinese say: I love football, but I look down on Chinese football. Love the open source part of China said: I love open source, but I look down on China-made open source. "This is called" easyjf "the open source team the signature of certain heroes. When the MySQL founders David first came to China last year, faced the media on the situation of China's open-source question frankly: In China, most people still not know enough about the open source movement.

In fact, it is China or even Asia's open source world, but this is precisely where the opportunities are hidden. Open-source companies such as Red Flag, and far-sighted investment companies, feel that at this stage but is open source the eve of infinite beauty. February 2006, Intel Capital to open-source database company MySQL dropped 18.5 million U.S. dollars; in June 2006, Red Hat also received 350 million U.S. dollars investment in ... ... a series of facts that the "open source software make money era over. " Cameron Lester is the venture capital firms Azure Capital Partners, in his view, the investment company funds invested enterprises will accelerate the development of open source, open-source movement to fight the Chinese investment in the company's vision, the open source community building and open source business location and its innovative business model will no doubt be the most important factor.







Recommended links:



Spring Festival travel, then the insurance



AVI To IPod



Younger's Quickstep



Evaluation Desktop



Drastic Clever Second Control Dealer



factors OF 9 2



JSP Servlet automatically jump to the wrong instance of the page



Art - Screen Savers Storage



Huawei Million Loss May Be Greater Than Was The Resignation Of



FLV to SWF



SWF to MPEG4



In Section North soft, direct plug in for the "wings"!



Small window, Big World Comparative Evaluation Pocket PC 8



SEO: Getting Started just not as good as not to get into?



Tuesday, September 14, 2010

Process


This lesson we will learn: What is the process? How to generate and terminate a process?

Initial knowledge:

What is the process? Here is my guide in excerpts from the WIN32 API explanation:

"A process is an ongoing process of Yingyong, which includes: private virtual address space, code, data and other operating system resources, Piru access to the pipeline process Ke Yi, Wen Jian Hu Tongbuduixiang Deng Deng."

From the above definition you can see, a process that has several objects: address space, the implementation of the module and the other the implementation of the program to open or create any objects or resources. At a minimum, a process must include the executable module, the private address space and more than one thread. What is the thread then? A thread is actually an implementation unit. When WINDOWS generate a process, it automatically generates a main thread for the process. The thread is usually the first instruction from the module started. If the process needs more threads, which can then be generated explicitly.

When WINDWOS received the news production process, it will be generated for the process private memory address space, then the executable file is mapped to the space. Produced in the process under WIN32 the main process, you can also call the function CreateProcess to create your process more threads.

CreateProcess prototype is as follows:

CreateProcess proto lpApplicationName: DWORD,
lpCommandLine: DWORD, lpProcessAttributes: DWORD,
lpThreadAttributes: DWORD,
bInheritHandles: DWORD,
dwCreationFlags: DWORD,
lpEnvironment: DWORD,
lpCurrentDirectory: DWORD,
lpStartupInfo: DWORD,
lpProcessInformation: DWORD

Do not be intimidated by so many parameters, in fact, most of which you can ignore the parameters (so that they have the default value).

lpApplicationName -> executable file name (with or without path). If this parameter is NULL, it must be passed in the parameter lpCommandLine file name.
lpCommandLine -> For the implementation of the documents passed to the command line parameters. If lpApplicationName is NULL, it must be specified in the parameter, such as: "notepad.exe readme.txt".
lpProcessAttributes and lpthreadAttributes -> specify the process and the main thread of the security attributes. You can set them all as NULL, so set the default security attributes.
bInheritHandles -> flag. Whether the process used to set up a new process created inherits all of the open handles.
dwCreationFlags -> There are several signs here set in order to determine the behavior you want to create the process, for example: You may want to create a process does not want it immediately after the run, so it really can be used before running some tests and revision . You can also set a new course here all the thread priority, usually it is set to NORMAL_PRIOR99vY_CLASS.
lpEnvironment -> point to the environment block pointer, generally, the environment block contains several environmental string. If this parameter is NULL, then the new process created process inherits the environment block.
lpCurrentDirectory -> point to the current directory as well as the child process to set the "current directory" path. If NULL, then the process of succession to create the "current directory" path.
lpStartupInfo -> point to start a new process structure pointer STARTUPINFO. WINDOWS STARTUPINFO tell how to display the appearance of the new process. There are many members of the parameter variable, if you do not want what's special about the new process can call GetStartupInfo function to create a process with the startup parameters to fill STARTUPINFO structure variables.
lpProcessInformation -> pointer to point to PROCESS_INFORMATION structure, the structure variable contains a number of unique identity in the process some member variables:

PROCESS_INFORMATION STRUCT
hProcess HANDLE?; handle to the child process
hThread HANDLE?; handle to the primary thread of the child process
dwProcessId DWORD?; ID of the child process
dwThreadId DWORD?; ID of the primary thread of the child process
PROCESS_INFORMATION ENDS
Process handle and process ID are two different concepts. Process ID is like a unique value, but the process handle is a WINDOWS API calls related to a return value obtained. Can not handle the process to identify the uniqueness of a process, because this value is not unique. Create a new process called CreateProcess after the process was created, and CerateProcess function returns immediately. You can call the function to test whether the process GetExitCodeProcess end. The function prototype is as follows:

GetExitCodeProcess proto hProcess: DWORD, lpExitCode: DWORD

If the call succeeds, lpExitCode contains the query process status code. If you mean STILL_ACTIVE to show that the process still exists. You can call the function TerminateProcess to force a process to terminate. The function prototype is as follows:

TerminateProcess proto hProcess: DWORD, uExitCode: DWORD

You can specify any of the exit value. A process with the end of the function is not good, because the process of loading the dynamic link library, and will not get the news out of the process is.


Examples:
In the following example, when the user selects the menu item "crate process" when we create a new process. It will go to the implementation of "" msgbox.exe ". If the user wants to terminate the new process, you can select the menu item "terminate process". At this time, the application checks whether the process terminated by still, if there are calls TerminateProcess function to terminate it.
.386
. Model flat, stdcall
option casemap: none
WinMain proto: DWORD,: DWORD,: DWORD,: DWORD
include masm32includewindows.inc
include masm32includeuser32.inc
include masm32includekernel32.inc
includelib masm32libuser32.lib
includelib masm32libkernel32.lib

. Const
IDM_CREATE_PROCESS equ 1
IDM_TERMINATE equ 2
IDM_EX99v equ 3

. Data
ClassName db "Win32ASMProcessClass", 0
AppName db "Win32 ASM Process Example", 0
MenuName db "FirstMenu", 0
processInfo PROCESS_INFORMATION <>
programname db "msgbox.exe", 0

. Data?
hInstance HINSTANCE?
CommandLine LPSTR?
hMenu HANDLE?
ExitCode DWORD?; Contains the process exitcode status from GetExitCodeProcess call.

. Code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke GetCommandLine
mov CommandLine, eax
invoke WinMain, hInstance, NULL, CommandLine, SW_SHOWDEFAULT
invoke ExitProcess, eax

WinMain proc hInst: HINSTANCE, hPrevInst: HINSTANCE, CmdLine: LPSTR, CmdShow: DWORD
LOCAL wc: WNDCLASSEX
LOCAL msg: MSG
LOCAL hwnd: HWND
mov wc.cbSize, SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground, COLOR_WINDOW +1
mov wc.lpszMenuName, OFFSET MenuName
mov wc.lpszClassName, OFFSET ClassName
invoke LoadIcon, NULL, IDI_APPLICATION
mov wc.hIcon, eax
mov wc.hIconSm, eax
invoke LoadCursor, NULL, IDC_ARROW
mov wc.hCursor, eax
invoke RegisterClassEx, addr wc
invoke CreateWindowEx, WS_EX_CLIENTEDGE, ADDR ClassName, ADDR AppName,
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
CW_USEDEFAULT, 300,200, NULL, NULL,
hInst, NULL
mov hwnd, eax
invoke ShowWindow, hwnd, SW_SHOWNORMAL
invoke UpdateWindow, hwnd
invoke GetMenu, hwnd
mov hMenu, eax
. WHILE TRUE
invoke GetMessage, ADDR msg, NULL, 0,0
. BREAK. IF (! Eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
. ENDW
mov eax, msg.wParam
ret
WinMain endp

WndProc proc hWnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM
LOCAL startInfo: STARTUPINFO
. IF uMsg == WM_DESTROY
invoke PostQuitMessage, NULL
. ELSEIF uMsg == WM_IN99vMENUPOPUP
invoke GetExitCodeProcess, processInfo.hProcess, ADDR ExitCode
. If eax == TRUE
. If ExitCode == STILL_ACTIVE
invoke EnableMenuItem, hMenu, IDM_CREATE_PROCESS, MF_GRAYED
invoke EnableMenuItem, hMenu, IDM_TERMINATE, MF_ENABLED
. Else
invoke EnableMenuItem, hMenu, IDM_CREATE_PROCESS, MF_ENABLED
invoke EnableMenuItem, hMenu, IDM_TERMINATE, MF_GRAYED
. Endif
. Else
invoke EnableMenuItem, hMenu, IDM_CREATE_PROCESS, MF_ENABLED
invoke EnableMenuItem, hMenu, IDM_TERMINATE, MF_GRAYED
. Endif
. ELSEIF uMsg == WM_COMMAND
mov eax, wParam
. If lParam == 0
. If ax == IDM_CREATE_PROCESS
. If processInfo.hProcess! = 0
invoke CloseHandle, processInfo.hProcess
mov processInfo.hProcess, 0
. Endif
invoke GetStartupInfo, ADDR startInfo
invoke CreateProcess, ADDR programname, NULL, NULL, NULL, FALSE,
NORMAL_PRIOR99vY_CLASS,
NULL, NULL, ADDR startInfo, ADDR processInfo
invoke CloseHandle, processInfo.hThread
. Elseif ax == IDM_TERMINATE
invoke GetExitCodeProcess, processInfo.hProcess, ADDR ExitCode
. If ExitCode == STILL_ACTIVE
invoke TerminateProcess, processInfo.hProcess, 0
. Endif
invoke CloseHandle, processInfo.hProcess
mov processInfo.hProcess, 0
. Else
invoke DestroyWindow, hWnd
. Endif
. Endif
. ELSE
invoke DefWindowProc, hWnd, uMsg, wParam, lParam
ret
. ENDIF
xor eax, eax
ret
WndProc endp
end start

Analysis:
Application creates the main window, save the menu handle for later use. When the user in the main menu, select the "Process" menu item, the message processing received WM_IN99vMENUPOPUP news, we here modify the pop-up menu in the menu item "Enable" and "non-enabled" to the same menu with different display.
. ELSEIF uMsg == WM_IN99vMENUPOPUP
invoke GetExitCodeProcess, processInfo.hProcess, ADDR ExitCode
. If eax == TRUE
. If ExitCode == STILL_ACTIVE
invoke EnableMenuItem, hMenu, IDM_CREATE_PROCESS, MF_GRAYED
invoke EnableMenuItem, hMenu, IDM_TERMINATE, MF_ENABLED
. Else
invoke EnableMenuItem, hMenu, IDM_CREATE_PROCESS, MF_ENABLED
invoke EnableMenuItem, hMenu, IDM_TERMINATE, MF_GRAYED
. Endif
. Else
invoke EnableMenuItem, hMenu, IDM_CREATE_PROCESS, MF_ENABLED
invoke EnableMenuItem, hMenu, IDM_TERMINATE, MF_GRAYED
. Endif

The reason why we deal with the purpose of the message is to make the menu look different when displayed to a user-friendly to use. For example; the new process has not been run, we light up (enable) "menu item" start process ", but grayed out (not enabled) menu item" terminate process ". When the new process is running, the menu's appearance on should be the opposite.
First, we call GetExitCodeProcess function, which handles incoming returned by the CreateProcess. If GetExitCodeProcess returns FALSE, then that process has not been run, we let the menu item "terminate process" grayed out; If you return TRUE, said the new process has started, we re-test is running, which is equal to STILL_ACTIVE by comparing the ExitCode to complete If equal, that process is still running, we let the menu item "start process" grayed out, because in our simple application process does not provide the ability to run multiple processes.

. If ax == IDM_CREATE_PROCESS
. If processInfo.hProcess! = 0
invoke CloseHandle, processInfo.hProcess
mov processInfo.hProcess, 0
. Endif
invoke GetStartupInfo, ADDR startInfo
invoke CreateProcess, ADDR programname, NULL, NULL, NULL, FALSE,
NORMAL_PRIOR99vY_CLASS,
NULL, NULL, ADDR startInfo, ADDR processInfo
invoke CloseHandle, processInfo.hThread

When the user selects the menu item "start process", we first test structure in the member variable hPRocess PROCESS_INFORMATION is turned off. If this is the first time you start the application process, which the variable is 0, because we are. Data section defined structure have been initialized when the value is 0. If the value is not 0, then that the new process has ended, but we have yet to close the process handle (in order to reduce the reference count of the process), we are here to complete the action.
We call GetStartupInfo function to start filling the information structure variables, and the variable will be passed to the CreateProcess function to. Call CreateProcess to generate a new process, we do not check the return value of the function is to simplify the problem, in practice, to do the work. After the call to CreateProcess, we immediately close the structure parameters in the process information returned handle to the main thread to close the thread handle in order to reduce the kernel object reference count, or even if the thread exits, the kernel object is still miserable exist in the kernel is not released, it will cause resource leaks. Process is actually the same reason we do not close the process handle is there because later on we have to use the handle to get some information related to the process and, as threads, our application does not need its information.

. Elseif ax == IDM_TERMINATE
invoke GetExitCodeProcess, processInfo.hProcess, ADDR ExitCode
. If ExitCode == STILL_ACTIVE
invoke TerminateProcess, processInfo.hProcess, 0
. Endif
invoke CloseHandle, processInfo.hProcess
mov processInfo.hProcess, 0

When the user selects the menu item "terminate process", we call the function GetExitCodeProcess to check whether the new process there, if there TerminateProcess we call the function to end it. In addition, we closed off the handle because we no longer have it.






Recommended links:



CONVERT flac mp3



3gpp to avi



Iphone Video Format



Mts to mpg