Posts

.net - Catching all exceptions in windows service C# -

Is there any way I can catch all kinds of exceptions in windows services? It's as if I have a service that should keep me going forever and now if some connecting databases or third party servers die for a moment then I do not want to stop my service. I want that the exception to the timer Should be given and after some time when the servers are up, they should work, but with the exception of now, my window service is brought down. PS - I have read the Kharaaba Exception Handler so far, but I'm not sure if this service prevents crashes. I also try to capture completely to catch generic exceptions (event handler). No, it is not. You can use the event to generate debug information before your app crashes. But creating your own exception management should not be that difficult. All services have an entry point ( Service.OnStart ) where you open your own thread / timer. Wrap all the code in that thread / timer with an attempt / grip, it should catch all the exceptions...

php - Implementing a 'Email to a friend' functionality. How to pass variables to the next page without using form, session and cookies? -

I am trying to create an "email-to-friend" page using php. The purpose of this page is that users can share the pages they are viewing with their friends. When a user clicks on the 'share' link, it will redirect the user to a page that asks a user to input their email address and a recipient email address. The topic will be the title of the previous page and the email body will be included in the URL of the previous page as well as any user. I have got the whole concept here but I am stuck in the implementation phase P>> Post and GET method is not suitable for use because when a user clicks on the share link, then there is no form in it. It will be very difficult to use sessions and cookies because as per the requirement and modified cookie / session every time a user sees a page. Passing the variable in the URL will make the URL long and some undesirable. Is there any other way I can use to pass the page title and page URL on the next p...

css - Sidebar div is not filling 100% of the parent -

Image
I will try it and do the best that I can do it. First of all, this is a fake issue of my problem. There is a device under the name of DIV A and DIV B content. Here's the CSS: #contents {height: auto; Limit: 1px solid black; } #A {float: left; Padding-left: 10px; Padding-top: 10px; Width: 587px; } #b {boundary-left: 1px solid black; float right; Height: 100%; Width: 300px; } There is a page content generated in DIV A DIV B contains two children's divs that provide tools for the page. Both of these are identical, and only set the height of 150px each. The issue is that, as seen in the ridicule, #BDV does not fill 100% #contents so when derived content is consumed & gt; 300px, black line separated by right bar does not pull the entire vertical length of #contents. I & amp; Lt ;! DOCTYPE html public "- // W3C // DTD XHTML 1.0 Strict // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&group; For the methodology. Yo...

php - Extract whatever is in brackets using regular expressions -

I really do not understand regex, and it hurts my head. I blah blah blah (here i want to remove anything) ... and I do not have PHP preg_split , Or equivalent, using the command, how to remove it, does not really understand. How can I do this? And where is a good place to understand how it works? Something like this should do the trick, ( and ) What is the : $ str = "blah blah blah (here i want to take a little away)"; If (preg_match ('/ \ (([^ \)] +) \' / ', $ str, $ matches) {var_dump ($ matches [1]); } and you will get: string 'Here is the bit that I want to remove' (length = 35) Actually, the method I used to search for: An opening ( ; But as it does (special meaning, this To avoid: \ ( One or more characters that are not closing brackets: [^ \)] + It is being captured, so we can use it later: ([^ \)] +) And this is the first (and A termination ) $ matches [1] > As available; Even here, it i...

pipe - Bash piping output and input of a program -

I am running a Minecraft server on my Linux box in a separate screen session. I am not very fond of the screen and I want to pipeline the pipeline of output (like a pipe) to a file on the server and some input from one file on the server (so that I can input and output from remote program On the server, like a dragon script) I'm not feeling too much, would anyone tell me how to do this? Thanks, NikitaUtu. It is not clear if you need the screen at all. I do not know the microwave server, but generally for server software, you can run it from the cronat entry and redirect the output to the log file. Assume that your server kills at midnight on Sunday night (if we change this, then it is too short or too much to resume 1x per week or you have a temporary resume ), But for the basic idea of ​​what to do, here is a crontab entry that starts the server every Monday in a minute after every Monday. 01 00 * * 1 dtTm = '/ bin / date + \% y \% m %% \% H \% m \% s`; Export ...

php - Can't access global variable inside function -

यह (मेरे कोड का सरलीकृत संस्करण) काम नहीं करता है: & lt ;? Php $ sxml = नया SimpleXMLElement ('& lt; somexml / & gt;'); फ़ंक्शन फू () {$ child = $ sxml- & gt; जोड़ चाइल्ड ('बच्चे'); } Foo (); ? & Gt; क्यों? मैं $ sxml तक पहुँचना चाहता हूं क्योंकि मैं उस पर त्रुटियों को लॉग करना चाहता हूं यदि foo () विफल रहता है। डायरेक्टरी लिस्टिंग बनाने के लिए foo () कॉलों को पुनरावर्तित रूप से कॉल करता है, इसलिए मुझे पूरे $ sxml से गुजरने का डर है (जैसे foo ($ sxml) ) प्रदर्शन को नुकसान पहुंचा सकता है। क्या $ sxml को अंदर $ foo तक पहुंचने का एक तरीका है? (PHP 5.2.x +) संपादित करें: क्या होगा अगर कोड ऐसा दिखता है, वास्तव में? & lt;? Php बार () {$ sxml = नया SimpleXMLElement ('& lt; somexml / & gt;'); फ़ंक्शन फू () {$ child = $ sxml- & gt; जोड़ चाइल्ड ('बच्चे'); } Foo (); } बार (); ? & Gt; आपको इसे फ़ंक्शन पर देना होगा: & lt;? Php $ sxml = नया SimpleXMLElement ('& lt; somexml / ...

ruby - background/daemon process -

I have a script that is coded down as well, I want to run it as a background / daemon process But once I start the script, I close the terminal window, which ends the program. What do I need to do to run the program loop the pid = fork do .......... ................ ...... end Process.detach (pid) end all above The answers actually show how easy it is to: # Panning the process and staying in the existing directory process. Pneumatic (true) pipe pid = Process.fork do # Do Some Funky End Process Vitipid (PID) # Reduce CPU usage (0.1) end