Wednesday, March 9, 2011

Describe the C # call an external process



C # call an external process of the class, on-line can be found many years, why write it again, it is because the most recent copy from the Internet, the routine use of a simple project, operation problems, and later studied for half a day to solve the these problems. He intended to write such a blog post, one for the C # call an external process that such a simple thing really what the issue, and secondly, want me to write this class of relatively complete software development can save some fellow who brain cells in order to concentrate superior forces to solve the really highly complex software problems.

Before going to the subject at the beginning, let's take a look at the implementation of the more common Internet functions external process



privatestringRunCmd (stringcommand)
(
/ / Case of Process
Processp = newProcess ();

p.StartInfo.FileName = "cmd.exe"; / / determine the name of the program
p.StartInfo.Arguments = "/ c" + command; / / Ensure that the program command line
p.StartInfo.UseShellExecute = false; / / Shell's use of
p.StartInfo.RedirectStandardInput = true; / / Redirect input
p.StartInfo.RedirectStandardOutput = true; / / redirect output
p.StartInfo.RedirectStandardError = true; / / redirect output error
p.StartInfo.CreateNoWindow = true; / / set the display window does not display home

p.Start ();// 00

/ / P.StandardInput.WriteLine (command); / / in this way can also be used to enter into the command line
/ / P.StandardInput.WriteLine ("exit ");// quest with Exit or else the next line of code

returnp.StandardOutput.ReadToEnd ();// get the output from the command line results flow results

) This method should be more common C # call an external process, and I have been so before calling the external process, not encountered any problems. But the call of the external process is rather special, with this method call on the emergence of two problems.

The first is that the external process is sometimes called abnormal, abnormal after the Windows error reporting pop up box, the program was hanging in there, to be manual intervention. Better to solve this problem, the program set about registry buttoned.

The second problem is that C # call an external process (a console process), the program will block the p.StandardOutput.ReadToEnd (); this one, will never come out, is called the console application was hanged. However, the console process can be normal in the CMD is executed. Some information later on found out that because the program console output in the console a lot of strings, pipe redirection, call the program does not promptly remove the pipe in the output data, resulting pipeline is blocked, the program hang. There is another issue here, although this did not encounter, but there are other people experience the Internet is the error message is not promptly remove the data channel will be blocked, but if you want to remove the two channels of data simultaneously, must be can be achieved using a secondary thread.

After describing the problem, here are the complete code for this class



usingSystem;
usingSystem.Collections.Generic;
usingSystem.Text;
usingSystem.Runtime.InteropServices;
usingSystem.Threading;

namespaceLaboratory.Process
(
classReadErrorThread
(
System.Threading.Threadm_Thread;
System.Diagnostics.Processm_Process;
Stringm_Error;
boolm_HasExisted;
objectm_LockObj = newobject ();

publicStringError
(
get
(
returnm_Error;
)
)

publicboolHasExisted
(
get
(
lock (m_LockObj)
(
returnm_HasExisted;
)
)

set
(
lock (m_LockObj)
(
m_HasExisted = value;
)
)
)

privatevoidReadError ()
(
StringBuilderstrError = newStringBuilder ();
while (! m_Process.HasExited)
(
strError.Append (m_Process.StandardError.ReadLine ());
)

strError.Append (m_Process.StandardError.ReadToEnd ());

m_Error = strError.ToString ();
HasExisted = true;
)

publicReadErrorThread (System.Diagnostics.Processp)
(
HasExisted = false;
m_Error = "";
m_Process = p;
m_Thread = newThread (newThreadStart (ReadError));
m_Thread.Start ();
)

)

classRunProcess
(
privateStringm_Error;
privateStringm_Output;

publicStringError
(
get
(
returnm_Error;
)
)

publicStringOutput
(
get
(
returnm_Output;
)
)

publicboolHasError
(
get
(
returnm_Error !=""&& m_Error! = null;
)
)

publicvoidRun (StringfileName, Stringpara)
(
StringBuilderoutputStr = newStringBuilder ();

try
(
/ / Disabletheerrorreportdialog.
/ / Reference: http://www.devcow.com/blogs/adnrg/archive/2006/07/14/
Disable-Error-Reporting-Dialog-for-your-application-with-the-registry.aspx
Microsoft.Win32.RegistryKeykey;
key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey
(@ "SoftwaremicrosoftPCHealthErrorReporting", true);
intdoReport = (int) key.GetValue ("DoReport");

if (doReport! = 0)
(
key.SetValue ("DoReport", 0);
)

intshowUI = (int) key.GetValue ("ShowUI");
if (showUI! = 0)
(
key.SetValue ("ShowUI", 0);
)
)
catch
(
)


m_Error = "";
m_Output = "";
try
(
System.Diagnostics.Processp = newSystem.Diagnostics.Process ();

p.StartInfo.FileName = fileName;
p.StartInfo.Arguments = para;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;

p.Start ();

ReadErrorThreadreadErrorThread = newReadErrorThread (p);

while (! p.HasExited)
(
outputStr.Append (p.StandardOutput.ReadLine () + "
");
)

outputStr.Append (p.StandardOutput.ReadToEnd ());

while (! readErrorThread.HasExisted)
(
Thread.Sleep (1);
)

m_Error = readErrorThread.Error;
m_Output = outputStr.ToString ();
)
catch (Exceptione)
(
m_Error = e.Message;
)
)

)
)









How to call Servlet to process the request



Bug tracking process issues that need attention



oracle10g r2 emca command and examples of the



Guide Food And Drink



Qicktime to WMV



Specialist Benchmarking



XviD TO WMV



First job out of the ivory tower beginning how the ELECTION



Thoroughly Transform UML 2.0



MOV To WMV



PHOTOSHOP Gourmet Series peanut butter cookies



Expert Personal Interest



Sunday, October 24, 2010

Director 3D foundation (of 7)


Mobility model and camera

In Director 8.5, the more than one way to move the model and the camera. Model and the camera can be compared to their own, other models or the live 3D world of mobile. In addition, these objects can make use of two different procedures to move Lingo. No matter which method you choose will have significant effect on the appearance of your 3D actors.

Pattern Videos

Paper-like film is Moving_model_and_camera.dir. You can open the program to see it, if you like, you can change it. (Click here to download the relevant Annex)

See scene 1

The first scene the film shows how simple Lingo commands rotate and translate to move the model and the camera.
Stage consists of a 3D Wizard - a model with four letters. There are a number of models and camera wizard is to show the current position and rotation angle of the text field. When you press the bottom left corner of the stage described in the text description of the key, you can move and rotate the camera and model. (Note that if you want to rotate is to hold down the shift key)
View called "Interface 1" script actor, it is to control the 3D model and camera movement. The beginning of this script checks whether the hold down the Shift key to rotate or translate the decision is an order.

member (''3d''). model (''A''). rotate (-1, 0, 0, # world)
When using the rotate command, the event will be pressed in a button each time a slight change in the orientation of a model point of view. When using the translate command, the event will be pressed in a button each time a slight change in the location of a model. Each key press will be in a position to change the model axis and rotation angle of a unit value. You can position and rotate the stage to see the field values for each axis depends on which button is pressed to change the.
Noted that rotate and translate commands include a "# world" argument. This tells Lingo model motion is relative to the 3D world, rather than relative to the 3D world of other objects.
Video provides a substitute program, Alternate Interface, you can replace the "Interface 1" program. The amendments replace the program to fulfill the position and rotation property values of the same task, but not using the rotate and translate commands.

See scene 2

The second scene the film shows how the mobile models and the camera relative to other objects. In this scene in the 3D world, including three models instead of one. Each model has four letters are big model uppercase "P" of the child objects. Because of this relationship, a small model can object relative to the parent capital letter "P" and movement, as opposed to relative to the 3D world, or the same as their own.
Scene1 now looks the same stage, but more than three buttons, is used to allow you to select a small model were compared to their own and their parent or an entire 3D world of sports. You can select the tag is "Self" button to select a small model were compared to their own campaigns, select the tag is "Parent" button to select a small model were compared to their parent movement, selection marker is the "World" of button to select a small model of their movement relative to the 3D world.
Called "selfBeh, parentBeh and worldBeh" The role of the script is to update the record "# self, # parent, or # world" of the global variable gRelativeTo. For example:
on mouseUp
gRelativeTo = # self




Recommended links:



JSF will not repeat the mistakes EJB



Evaluate Cartoons - Screen SAVERS



Wang Yukun: Power in the UNION Heavy Industry "butterfly"



Storage Dictionaries Education



Wizard Icon Tools



"Torchlight" HARDCORE mode Survival Guide



The new VPN strength



MKV to FLV



Why Engage in career planning?



remove Drm from itunes m4v video movie



TS To MPG



Taboo boss (below)



RMVB to MP4



Comments: Haier bid for Maytag out of mountains and rivers to be epigenetic re-



Honeywell Process Solutions User Group Conference Held In Zhuhai



Easy Cataloging



Monday, October 11, 2010

e-cology in the Pan Micro Series 68



Rally dispersed wisdom, speed the development of synergies: e-cology effectively enhance the core competitiveness of the Pan-Micro!

Rally dispersed wisdom, speed the development of synergies: e-cology effectively enhance the core competitiveness of the Pan-Micro!




Weaver e-cology is the developer, but also users of e-cology. Through the efforts of more than two years, Weaver has been fully operational are all put on e-cology, we all staff within the company the possibility of leaving e-cology in dealing with business, because the e-cology each provided with a pan-micro- employees requires all of the information, so e-cology slowly into the pan inside the micro-ecological system can be self-renewal and growth!



















Recommended links:



FLV To VOB



DivX to MPEG



how to clean up laptop notebook LIQUID spill



MP4 To 3G2



Tuesday, October 5, 2010

Nine ways to recruit good staff


Enterprises can take advantage of the following nine ways to recruit quality staff.

1, internal recommendations. This is one of the methods commonly used in business, but pay attention to the internal referral program you can effectively encourage the involvement of employees.

2, join professional associations. These organizations can help you reach the industry's top talent.

3, each of you come across as a potential recruitment professionals are Object, you may find in them can be used by your company personnel.

4, in the geographic characteristics or climate characteristics and similar places where your company to recruit from. Some candidates are willing to move to live with his current living environment where little difference.

5, the big companies "get started." If the local large companies have had a strategic retrenchment, lay-offs among these may be the person you need them.

6, to hear the views of providers.浣滀负鏈嶅姟浜庝綘鍏徃鎵?湪琛屼笟鐨勪緵搴斿晢锛屼粬浠墜涓殑浜鸿剦璧勬簮涔熸槸浣犱笉鍙拷瑙嗙殑銆?br />
銆??7銆佸埗瀹氬疄涔犻」鐩?瀹炰範鐢熸湁鍙兘鎴愪负浣犲叕鍙哥殑鏄庢槦鍛樺伐銆?br />
銆??8銆佺粰浠ュ墠鎷掔粷杩囦綘鐨勫?閫変汉鎵撶數璇濄?涔熻浠栫幇鍦ㄨ兘琚綘璇村姩鍛紵

銆??9銆佸ぇ鑼冨洿鎾掔綉銆傚埄鐢ㄤ竴鍒囧伐鍏凤紝鍖呮嫭鍦ㄧ嚎鎷涜仒缃戠珯銆佹墍鏈夌ぞ浜ょ綉缁溿?褰撳湴濯掍綋绛夛紝瀵绘壘鏈?匠鍊欓?浜恒?






相关链接:



MPG To AVI



2006 'China's PDM / PLM's top event will be held in Nanjing



M2TS to MKV



ASF to AVI



comparison GENEALOGY



Thread contact mechanism



Delicious Stop! Photoshop baked pizza word



Shi Yuzhu GIANT empire base



Encode windows media center to adobe flash



photoshop effect Of creating non-mainstream MTV



Articles about Nature - SCREEN Savers



NEWS about Science Education



Audio Format Changes for



Korean media: China wielded against piracy, "sword"



Using photoshop build a passion Miyi chocolate effect



Monday, September 27, 2010

What rod dealer outlets


Commodity wholesale market in the second and third line cities, there are still a lot of light pole distributor, the boss (or my wife) and business support propped facade, the main business over the main door, the general also carry one or two manufacturers of the products distribution, or as a local subsidiary of a large dealer distribution, rather single product line, because the sale of small, but also reluctant to hire only their own press, boss, procurement, distribution, sales, and other rolled. the main face is a home purchase in retail stores and retail consumers. sometimes point units also cater to small Group buy.

Rod dealer is a dealer groups in the original state and initial conditions, now is the big dealers had come over from this stage, from the light pole to double pole, double pole from pole to more ~~~~~ . However, as market competition becomes more incentive, from the smooth growth of this shift rod dealer become a major distributor also increased the probability of low, and most of the light pole dealer could not shake off such a situation a small grocery wholesaler . just as a distribution channel in a small role.

Not to mention the future growth and development, on the current living conditions, the rod also has too many dealers are not easy and difficult because of limited strength, light pole dealers often failed to attract the attention of manufacturers, we fall popular products, not enough time to grasp the information easily spiral into a price war, poor profitability, weak anti-attack capability, more often studied under the subsidiary in the large-scale distributors, purely as a porter and so on. Small sale only.

I just started doing dealer, the dealer had a light pole (with his wife did not really light bar), drinks in hand only to a manufacturer's local dealership. A dozen product lines, but only with the manufacturers to sign the annual contract sales to only 30 million, this small small small profit. However, the difficult environment to exercise were also small and the games are played, as long as willing to mindless, money-making opportunities are still more than two years of light pole distribution business career down, I also got some from research and dealers rod road to survival and development, in this essays out for your reference.

1. Clean the store house.

Whether manufacturers also visit customers the impression that the door is very important at first glance, most optical levers wholesale store housekeeping is flattered. How is a random Zile. I was doing when the dealer, colleagues around the store next door housekeeping conditions are similar, stained office chairs, dirty and chaos on the ground, graffiti wall, ceiling, there are spiders in the family, and my neighbors feel indifferent.

My store is very clean and organize every day when not busy, I took a cloth to keep the rub everywhere, shop, small but neat product samples on the shelf, manufacturers of goods posters Zhang specification, store inventory partition stacked. each cargo volume of the heap are posted out of water, clean office desktop, with a business license, tax registration certificate, what are neatly hung on the walls, combined document holder in a variety of paper documents disaggregated put away, the door to others after the refreshing. flew feel good, it is very important, I had already by this neat house, attracted a number of manufacturers of business, many new products for distribution rights, in fact, the door store clean and service the whole point, not any number of input costs, as long as their more diligent point on the line. working with people at least have to get themselves clean, the whole point of it. This is another small business, there must be a sense of image, ah,

2. Use of part-time staff

Sale of small, he often overwhelmed, but they could not afford to hire and, again, instability in business, bidding and fixed operations personnel uneconomical, the author is a part-time staff by recruiting personnel solutions to the problem, I account for the I want the type of employees, working hours, conditions of use of basic quality requirements, etc., and then in schools, nearby communities recruit part-time staff to address the relevant delivery, store sales, shipping and so on into the evening. pay all quantitative assessment, the number of dry count how many, to avoid waste, laid-off workers are now more and more is looking for work and willing to have more than one part-time jobs, such as work-study students, and many own car delivery drivers. to deploy properly, the basic need, please full-time employees.

3. Follow the small but excellent portfolio of products.

Shorter product line, the more choices in products and work hard, since the goods can not rely on large stores to attract more visitors, it must rely on exotic products to attract new business, and strengthen the attractiveness of the product itself, and there are two considerations, the first home purchase as much as possible to attract customers because of delivery costs are high, too much for me, and some products I just great dealer the following distributors have regional restrictions, I can not deliver. more The key is that the Chinese people have a psychological, not a good thing to send home. their own initiative to get the door is a good thing. altogether, I meet their psychological well-organized, allowing them to pick their own home. And then pull back his joy. Province me a freight money.

4. For large distributors to force out the management.

Respond positively to the requirements of large distributors, with emphasis on surface and conform to assist in the dealer market management. Have a number of large distributors following the second installment of providers and distributors, almost all of the major distributors have to The second issue of the management business had a headache, after all, batches providers are arbitrary and not subject to the unified arrangement of changing commodity and the price system is the destruction of the leader, often a lot of trouble bringing more trouble to give large distributors, large Dealers from the starting point of the overall management is very willing to take some batches of proactive management to meet the obedience of a large distributor who, as the strength of the weak rod dealer Shangqie can to try to follow in the initial stages of a large dealer The management of the best possible use of these large distributors of power, of course, large distributors are generally given to these particular batches of some specific policy to take care of business. This is a not a small income.

5. Everyone loves a bargain

In addition to its main product, it can also add some distinctive and attractive to popularity of the merchandise. In the market, if more Liudian Simpleton, almost every day Shou Ji Jing Xiaoshang Jinxingpaohuo a factory or the information, such as clearance goods. Weihuo. Dizhang goods, etc., if only to sell their homes, both sales and popularity is difficult to ensure Moreover, many large dealers have no such points of mind to deal with these Paohuo. rod dealer can take the initiative to collect this information, choose some special goods for the store to focus pull their sales at low prices as the main selling point, after all, everyone loves the little cheap accounted for many consumers to the wholesale market is to find bargains, focus on sales of these specials, which can effectively attract retail consumers, in addition to making some profits, but also enhance the store's popularity, the formation of long-term stable source, and to help manufacturers and distributors deal with discount and clearance goods, sale negotiated settlement easier, increase their cash flow capacity.

6. Wholesale and retail combined

Rod dealers should consider opening its own Direct terminal to their commodity-based shop, directly to consumers, in particular, the focus of such communities and schools to consider the frequency of the high consumption areas, to enhance the cash flow rod dealer , while a better understanding of the terminal, the formation of their wholesale business to some extent complementary, and can also consider cooperation in other terminals, the form of shares of goods carriers.

This big dealers are not born, are also up from a little to do, but also have experienced rod dealer this stage, in fact, this business started down the size is not important, the key in the management and operation to promote sustained growth and development, carefully observed and studied, to keep warm, creative work, minimize the use of homogenization of the operation and management ideas. to become a major distributor as soon as possible.






Recommended links:



Taobao Alipay betrayal?



Hot Server Applications



Thunder's Humor: The Content Of Our Nearly 100% Genuine



The New Worm Spread Using Msn Poisoning By Remote



Head of the groundbreaking Xbox



HTML Tools Comparison



Performance of the INTERVIEW should be noted that several principles



DreamWorks, Paramount Blu-ray defection SERAP 150 million U.S. dollars compensation



H.264 to AVI



Graphic CAD Directory



Loss due to competition sudden withdrawal of Russia's largest game operators in China



Best TRACE And Ping Tools



IDC how to charge only reasonable



MTS to MP4



Wait mature open source MODEL



FLV to iPod



How to call JSP page from the MIDlet



Tuesday, August 3, 2010

PB control "macro substitution"



hl2000_2001 Q:
I would like to write a program code is as follows:

P_1.PictureName =''help.gif''
P_2.PictureName =''help.gif''
P_3.PictureName =''help.gif''
P_4.PictureName =''help.gif''
P_5.PictureName =''help.gif''

Is there a simple way, let me use the loop to achieve?

Such as:
for i = 1 to 5
P_ ***. PictureName =''help.gif''
next
This is very anxious to see me soon please!!

newkid A:

Assume that this code is written in the OPEN WINDOW case, THIS is the current WINDOW:
int i
picture lp
for i = 1 to upperbound (this.Control)
if typeof (this.Control [i]) = picture! then
lp = parent.Control [i]
/ / Can lp.classname () to further determine not to modify the image control
lp.picturename =''help.gif''
end if
next

You can also define a picture variable array to operate, through OpenUserObject () so that they appear in the window.

NetFish A:

int i
picture p_temp
for i = 1 to Upperbound (w_test.control)
if left (w_test.control [i]. classname, 2) =''p_''then
p_temp = w_test.control [i]
p_temp.picturename =''.......''
end if
next
=============
About the meaning, not verified, testing about it.







Recommended links:



Top SCREEN Savers



Chinese revolution



Thunder look at real-time on-demand player in the player to build pan-



.mkv files



PHS delisting who is in charge



Visual Studio08 now open to MSDN users



IDC how to Charge only reasonable



PROFESSIONAL human resources workers 132 Tool - factors into account point method



New E-Commerce



U.S. stocks comment: Sun continued blood loss



Learning regular Expressions entirely Manual: Getting Started guide rookie



Convert mp3 to m4a



what is mkv FILE



youtube video format



CATIC Shenzhen: HR reform activity trip



Simple Backup And Restore