Search Results

Search found 848 results on 34 pages for 'robust'.

Page 1/34 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Robust, Mature HTML Parser for PHP

    - by Alan Storm
    Are there any robust and mature HTML parsers available for PHP? A quick skimming of PEAR didn't turn anything up (lots of classes for generating HTML, not so much for consuming), and Google taught me a lot of people have started and then abandoned a variety of parser projects. Not interested in XML parsers (unless then can consume non-well formed HTML) or hacking it on my own with regular expressions. Clarification of Intent: I'm not interested in filtering of HTML content, I'm interesting in extracting information from HTML documents.

    Read the article

  • A Simple but Robust WPF Report Engine, Part 1

    a simple WPF report engine that is robust and one can use it in practical applications  read moreBy siyamand ayubiDid you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Automated Error Reporting = More Robust Software

    - by Laila
    I would like to tell you how to revolutionize your software development process </marketing hyperbole> On a more serious note, we (Red Gate's .NET Development team) recently rolled a new tool into our development process which has made our lives dramatically easier AND improved the quality of our software, and I (& one of our developers, Alex Davies) just wanted to take a quick moment to share the love. I work with a development team that takes pride in what they ship, so we take software testing rather seriously. For every development project we run, we allocate at least one software tester for every two developers, and we never ship software without first shipping early access releases and betas to get user feedback. And therein lies the challenge -encouraging users to provide consistent, useful feedback is a headache, but without that feedback, improving the software is. tricky. Until fairly recently, we used the standard (if long-winded) approach of receiving bug reports of variable quality via email or through our support forums. If that didn't give us enough information to reproduce the problem - which was most of the time - we had to enter into a time-consuming to-and-fro conversation with the end-user, to get scrape together the data we needed to work out where the problem lay. As I'm sure you're aware, this is painfully slow. To the delight of the team, we recently got to work with SmartAssembly, which lets us embed automated exception and error reporting into our software with very little pain, and we decided to do a little dogfooding. As a result, we've have made a really handy (if perhaps slightly obvious) discovery: As soon as we release a beta, or indeed any release of software, we now get tonnes of customer feedback through automated error reports. Making this process easier for our users has dramatically increased the amount (and quality) of feedback we get. From their point of view, they get an experience similar to Microsoft's error reporting, and process is essentially idiot-proof. From our side of things, we can now react much faster to the information we get, fixing the bugs and shipping a new-and-improved release, which our users rather appreciate. Smiles and hugs all round. Even more so because, as we're use SmartAssembly's Automated Error Reporting, we get to avoid having to spend weeks building an exception reporting mechanism. It takes just a few minutes to add reporting to a project, and we get a bunch of useful information back, like a stack trace and the values of all the local variables, which we can use to fix bugs. Happily, "Automated Error Reporting = More Robust Software" can actually be read two ways: we've found that we not only ship higher quality software, but we also release within a shorter time. We can ship stable software that our users are happy to upgrade to, and we then bask in the glory of lots of positive customer feedback. Once we'd starting working with SmartAssembly, we were curious to know how widespread error reporting was as a practice. Our product manager ran a survey in autumn last year, and found that 40% of software developers never really considered deploying error reporting. Considering how we've now got plenty of experience on the subject, one of our dev guys, Alex Davies, thought we should share what we've learnt, and he's kindly offered to host a webinar on delivering robust software with Automated Error Reporting. Drawing on our own in-house development experiences, he'll cover how to add error reporting to your program, how to actually use the error reports to fix bugs (don't snigger, not everyone's as bright as you), how to customize the error report dialog that your users see, and how to automatically get log files from your users' machine. The webinar will take place on Jan 25th (that's next week). It's free to attend, but you'll still need to register to hear Alex's dulcet tones.

    Read the article

  • Advice on designing a robust program to handle a large library of meta-information & programs

    - by Sam Bryant
    So this might be overly vague, but here it is anyway I'm not really looking for a specific answer, but rather general design principles or direction towards resources that deal with problems like this. It's one of my first large-scale applications, and I would like to do it right. Brief Explanation My basic problem is that I have to write an application that handles a large library of meta-data, can easily modify the meta-data on-the-fly, is robust with respect to crashing, and is very efficient. (Sorta like the design parameters of iTunes, although sometimes iTunes performs more poorly than I would like). If you don't want to read the details, you can skip the rest Long Explanation Specifically I am writing a program that creates a library of image files and meta-data about these files. There is a list of tags that may or may not apply to each image. The program needs to be able to add new images, new tags, assign tags to images, and detect duplicate images, all while operating. The program contains an image Viewer which has tagging operations. The idea is that if a given image A is viewed while the library has tags T1, T2, and T3, then that image will have boolean flags for each of those tags (depending on whether the user tagged that image while it was open in the Viewer). However, prior to being viewed in the Viewer, image A would have no value for tags T1, T2, and T3. Instead it would have a "dirty" flag indicating that it is unknown whether or not A has these tags or not. The program can introduce new tags at any time (which would automatically set all images to "dirty" with respect to this new tag) This program must be fast. It must be easily able to pull up a list of images with or without a certain tag as well as images which are "dirty" with respect to a tag. It has to be crash-safe, in that if it suddenly crashes, all of the tagging information done in that session is not lost (though perhaps it's okay to loose some of it) Finally, it has to work with a lot of images (10,000) I am a fairly experienced programmer, but I have never tried to write a program with such demanding needs and I have never worked with databases. With respect to the meta-data storage, there seem to be a few design choices: Choice 1: Invidual meta-data vs centralized meta-data Individual Meta-Data: have a separate meta-data file for each image. This way, as soon as you change the meta-data for an image, it can be written to the hard disk, without having to rewrite the information for all of the other images. Centralized Meta-Data: Have a single file to hold the meta-data for every file. This would probably require meta-data writes in intervals as opposed to after every change. The benefit here is that you could keep a centralized list of all images with a given tag, ect, making the task of pulling up all images with a given tag very efficient

    Read the article

  • Oracle WebLogic Server and Oracle Database: A Robust Infrastructure for your Applications

    - by Ruma Sanyal
    Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 It has been said that a chain is as strong as its weakest link. Well, this is also true for your application infrastructure. Not only are the various components that constitute your infrastructure, like database and application server critical, the integration between these things [whether coming out of the box from your vendor or done in-house] is paramount. Imagine your database being down and your application server not knowing about it and as a result your application waiting indefinitely for a database response – not a great situation if high availability is critical to your application. Or one of your database nodes is very busy, but your application server doesn’t have the intelligence to decipher that – it keeps pinging the busy node when it can in fact get a response from another idle node much faster. This is what Oracle WebLogic and Database integration provides: Intelligent integration out of the box. Tight integration between Oracle WebLogic and Database makes your infrastructure robust enough that not only does each of your infrastructure component provide you with improved RASP [reliability availability, scalability, and performance] but these components work together to offer improved performance & availability, better resource sharing, inherent scalability, ease of configuration and automated management for your entire infrastructure. Oracle WebLogic Server is the only application server with this degree of integration to Oracle Database. With Oracle WebLogic Server 11g, we introduced Active GridLink for Real Application Clusters (RAC). In conjunction with Oracle Database, this powerful software technology simplifies management, increases availability, and ensures fast connection failover with runtime connection, load balancing and affinity capabilities. With the release of Oracle Database 12c this summer, even tighter integration between Oracle WebLogic Server 12c (12.1.2) and Oracle Database 12c has been achieved and this further optimizes the integration for a global cloud environment. Read about these capabilities in detail in the Oracle WebLogic-Database Integration Whitepaper. Get in depth ‘how-to’ details from this YouTube video on the topic from our resident expert, Monica Roccelli. /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

    Read the article

  • Best Way To Develop Robust Cross-Platform Application?

    - by Clay
    Windows C programmer here (going back to 1992 and Windows95 back when it was called Windows93). Can function in C++, but mostly still a C programmer. Looking to build a cross-platform casual game. Very numbers heavy with only a few artistic embellishments and animations, so perhaps a development environment for business apps might be the best option. Or an easy-to-use 2D game dev platform. Target platforms: Windows, Mac, MS Tablet, iPhone, iPad, Android. I currently develop on Windows with Visual Studio 2012, but we could spend up to $50K on hardware/software/middleware if necessary. Not very competent getting open-source software working. Would rather pay the money and jump right into app development. Recommendations?

    Read the article

  • AutoSSH for a robust tunnel

    - by Budric
    I'm trying to start an ssh tunnel from A to B and have it run despite things like: period network/wifi drops on A and remote server reboot on B. My ssh tunnel starts using upstart script on A with event start on (net-device-up IFACE=eth0) I've found autossh which is supposed to handle these kinds of things, but had some trouble getting it to work. The upstart executes: autossh -M 0 -2qTN -o "ServerAliveInterval 30" -o "ServerAliveCountMax 2" -L 5678:somehost:5678 user@B However when I log into B and kill -9 that tunnel session, autossh just exits with "Connection to B closed by remote host." That's not what I expected autossh to do. Any advice on how to set this up? Any GUI service monitoring utilities out there that essentially display a green light if a service is up? Thanks.

    Read the article

  • Robust line of sight test on the inside of a polygon with tolerance

    - by David Gouveia
    Foreword This is a followup to this question and the main problem I'm trying to solve. My current solution is an hack which involves inflating the polygon, and doing most calculations on the inflated polygon instead. My goal is to remove this step completely, and correctly solve the problem with calculations only. Problem Given a concave polygon and treating all of its edges as if they were walls in a level, determine whether two points A and B are in line of sight of each other, while accounting for some degree of floating point errors. I'm currently basing my solution on a series of line-segment interection tests. In other words: If any of the end points are outside the polygon, they are not in line of sight. If both end points are inside the polygon, and the line segment from A to B crosses any of the edges from the polygon, then they are not in line of sight. If both end points are inside the polygon, and the line segment from A to B does not cross any of the edges from the polygon, then they are in line of sight. But the problem is dealing correctly with all the edge cases. In particular, it must be able to deal with all the situations depicted below, where red lines are examples that should be rejected, and green lines are examples that should be accepted. I probably missed a few other situations, such as when the line segment from A to B is colinear with an edge, but one of the end points is outside the polygon. One point of particular interest is the difference between 1 and 9. In both cases, both end points are vertices of the polygon, and there are no edges being intersected, but 1 should be rejected while 9 should be accepted. How to distinguish these two? I could check some middle point within the segment to see if it falls inside or not, but it's easy to come up with situations in which it would fail. Point 7 was also pretty tricky and I had to to treat it as a special case, which checks if two points are adjacent vertices of the polygon directly. But there are also other chances of line segments being col linear with the edges of the polygon, and I'm still not entirely sure how I should handle those cases. Is there any well known solution to this problem?

    Read the article

  • Catching multiple exceptions on the client is robust and easy

    - by Alexander Kuznetsov
    Maria Zakourdaev has just demonstrated that if our T-SQL throws multiple exceptions, ERROR_MESSAGE() in TRY..CATCH block will only expose one. When we handle errors in C#, we have a very easy access to all errors. The following procedure throws two exceptions: CREATE PROCEDURE dbo.ThrowsTwoExceptions AS BEGIN ; RAISERROR ( 'Error 1' , 16 , 1 ) ; RAISERROR ( 'Error 2' , 16 , 1 ) ; END ; GO EXEC dbo.ThrowsTwoExceptions ; Both exceptions are shown by SSMS: Msg 50000 , LEVEL 16 , State 1 , PROCEDURE...(read more)

    Read the article

  • Robust way to keep records of software releases?

    - by japreiss
    We release a number of small plug-ins that go along with our software. Each plug-in allows our software to talk to a single manufactuer's hardware. I would like to devise a system for keeping track of plug-in releases. Example info that should be stored: Hardware manufacturer name 32-bit? 64-bit? both? What modes of operation does the hardware support? What versions of the manufacturer's driver have been tested with the plugin? Desirable properties of the system: Able to synchronize with version control software Stores data in human-readable text file (also good for differ tool) Free visual, spreadsheet-like editor available Able to do simple analysis like "What is the oldest plug-in?" I've got to imagine that someone else has tackled this problem already. Right now my best guess is XML/JSON with a visual editor, but I have been disappointed in the editors I've tried so far. I'd like to get input from some more experienced developers. Thanks!

    Read the article

  • Can you recommend a robust OpenAPI 2.0 provider?

    - by larsks
    Help me find a robust OpenID 2.0 provider! We're looking at various SSO solutions for our organization, and I would like to suggest OpenID as a viable option, since (a) there is good consumer support in a number of web applications, and (b) it's simpler to implement than Shibboleth, which is the alternative technology. However, this requires that we find a robust OpenID provider, ideally one meeting the 2.0 specification. The only solutions I've come across so far are: Atlassian Crowd This looks great, although the $4000 price tag may make it a tough sell. Community-ID This looks like an interesting idea, but I'm not sure the project quality is at a suitable level (yet). In particular, it's not clear if LDAP support actually works (which will be a requirement in our environment). Have you implemented OpenID in your environment? What are you using? Have you selected an alternative SSO technology?

    Read the article

  • iPhone 4.0 Screen Resolution and writing robust code...

    - by Magic Bullet Dave
    Does anyone know what will happen with existing apps when they run on the iPhone 4.0 in terms of the new screen resolution? I am assuming, just like developing for the iPad that there should be no hard coded screen resolutions in your code. I'd also like advice on the best way of writing robust code to work well on any device. For instance, detecting the screen resolution is not enough - on the iPad the screen is physically bigger so you can display more items on it. On the new iPhone the screen is the same physical size but higher resolution, so the likely thing is that you wont want to display more items, just higher resolution versions of them. Any help would be useful, Regards Dave EDIT: I have read the other similar posts, I guess what I really would like to know is what is the recommended way to write code for all App Store devices in a robust way so they a) all work b) make best use of the device.

    Read the article

  • Is TrueCrypt robust against data corruption?

    - by Dimitri C.
    I would expect a TrueCrypt volume to be fragile when it suffers from data corruption. This could happen for example because the hard disk, CD or DVD start to deteriorate, or when an USB stick is unplugged while a write is in progress. On the TrueCrypt FAQ it is mentioned that this problem is limited because the data is encrypted in blocks of 16 bytes. However, I'dd like to know if this really so in practice. Is there anyone who has experienced severe data loss due to only small corruptions?

    Read the article

  • Highly robust and scalable search server needed for managing and analyze files

    - by ChrisBenyamin
    Hi everybody, I am looking for a professional search server system with functionality, like e.g. solr http://lucene.apache.org/solr/ holds. Place of action should be a centralized location, whereon many hosts would request data. Furthermore the system should be extensible for implementing statistical procedures. (e.g. a kind of heatmap (or common diagrams) of a (or more) file(s) (which has a guid), that is spread on different hosts.) This software doesn't have to be opensource. thanks. chris

    Read the article

  • Need recommendations for a hardy scanner that has a robust feeder tray

    - by JohnyD
    In the early days of our company all our information came in on paper and all of what we sold was on paper. Because of this we literally rent our an old bank vault to house the millions of sheets of paper that, some say, still contain relevant information. That being said, I'm looking into purchasing some hardware capable of scanning all these documents and converting them to pdf. Being new at this level of digitization I would like to ask for recommendations for accomplishing this task. Most of this material exists as separate bound studies/articles/etc. Someone would have to remove the bindings and be able to load many pages at a time and have the scanner feed them all through and convert them to a single pdf (single pdf per study/article/etc). If you have any recommendations I would very much appreciate hearing about them, thanks.

    Read the article

  • Robust Javascript parser in Java

    - by Misha Koshelev
    Dear All: I am looking for a robust Javascript parser written in Java - by which I mean a Javascript parser that is able to handle most real world Javascript. I am only interested in parsing Javascript, not in executing it. I have found Rhino: http://groups.google.com/group/mozilla.dev.tech.js-engine.rhino/browse_thread/thread/1eff23a8ee57b991 Am I missing anything? Is this the best solution? Thank you! Misha

    Read the article

  • Robust and easy to implement serial bus (automotive application)

    - by JcMaco
    What serial communication bus would you use in a automotive embedded system if your main selection criteria were: * Electrically robust * Slow speed (32 kb/s) * Easy to program * Easy to interface with microcontrollers It won't be transferring much data, but it will need to be transferred periodically at high speed (100 - 500 Hz). I find that RS-232 is just not reliable enough if you have noise in your ground line. CAN-bus seems interesting, but I have no experience with it. We are currently interested in a combination of AVR AT90CAN128 microcontrollers.

    Read the article

  • Robust LINQ to XML query for sibling key-value pairs

    - by awshepard
    (First post, please be gentle!) I am just learning about LINQ to XML in all its glory and frailty, trying to hack it to do what I want to do: Given an XML file like this - <list> <!-- random data, keys, values, etc.--> <key>FIRST_WANTED_KEY</key> <value>FIRST_WANTED_VALUE</value> <key>SECOND_WANTED_KEY</key> <value>SECOND_WANTED_VALUE</value> <!-- wanted because it's first --> <key>SECOND_WANTED_KEY</key> <value>UNWANTED_VALUE</value> <!-- not wanted because it's second --> <!-- nonexistent <key>THIRD_WANTED_KEY</key> --> <!-- nonexistent <value>THIRD_WANTED_VALUE</value> --> <!-- more stuff--> </list> I want to extract the values of a set of known "wanted keys" in a robust fashion, i.e. if SECOND_WANTED_KEY appears twice, I only want SECOND_WANTED_VALUE, not UNWANTED_VALUE. Additionally, THIRD_WANTED_KEY may or may not appear, so the query should be able to handle that as well. I can assume that FIRST_WANTED_KEY will appear before other keys, but can't assume anything about the order of the other keys - if a key appears twice, its values aren't important, I only want the first one. An anonymous data type consisting of strings is fine. My attempt has centered around something along these lines: var z = from y in x.Descendants() where y.Value == "FIRST_WANTED_KEY" select new { first_wanted_value = ((XElement)y.NextNode).Value, //... } My question is what should that ... be? I've tried, for instance, (ugly, I know) second_wanted_value = ((XElement)y.ElementsAfterSelf() .Where(w => w.Value=="SECOND_WANTED_KEY") .FirstOrDefault().NextNode).Value which should hopefully allow the key to be anywhere, or non-existent, but that hasn't worked out, since .NextNode on a null XElement doesn't seem to work. I've also tried to add in a .Select(t => { if (t==null) return new XElement("SECOND_WANTED_KEY",""); else return t; }) clause in after the where, but that hasn't worked either. I'm open to suggestions, (constructive) criticism, links, references, or suggestions of phrases to Google for, etc. I've done a fair share of Googling and checking around S.O., so any help would be appreciated. Thanks!

    Read the article

  • Robust way to save/load objects with dependencies?

    - by mrteacup
    I'm writing an Android game in Java and I need a robust way to save and load application state quickly. The question seems to apply to most OO languages. To understand what I need to save: I'm using a Strategy pattern to control my game entities. The idea is I have a very general Entity class which e.g. stores the location of a bullet/player/enemy and I then attach a Behaviour class that tells the entity how to act: class Entiy { float x; float y; Behavior b; } abstract class Behavior { void update(Entity e); {} // Move about at a constant speed class MoveBehavior extends Behavior { float speed; void update ... } // Chase after another entity class ChaseBehavior extends Behavior { Entity target; void update ... } // Perform two behaviours in sequence class CombineBehavior extends Behavior { Behaviour a, b; void update ... } Essentially, Entity objects are easy to save but Behaviour objects can have a semi-complex graph of dependencies between other Entity objects and other Behaviour objects. I also have cases where a Behaviour object is shared between entities. I'm willing to change my design to make saving/loading state easier, but the above design works really well for structuring the game. Anyway, the options I've considered are: Use Java serialization. This is meant to be really slow in Android (I'll profile it sometime). I'm worried about robustness when changes are made between versions however. Use something like JSON or XML. I'm not sure how I would cope with storing the dependencies between objects however. Would I have to give each object a unique ID and then use these IDs on loading to link the right objects together? I thought I could e.g. change the ChaseBehaviour to store a ID to an entity, instead of a reference, that would be used to look up the Entity before performing the behaviour. I'd rather avoid having to write lots of loading/saving code myself as I find it really easy to make mistakes (e.g. forgetting to save something, reading things out in the wrong order). Can anyone give me any tips on good formats to save to or class designs that make saving state easier?

    Read the article

  • java serial I/O: handling USB serial connection/disconnection in a robust manner

    - by Jason S
    I'm using rxtx for serial I/O handling in Java with an FTDI2232H that provides a USB comm port. It works great, with one exception: if I unplug the USB cable, so that the COM port disappears at runtime, it spews exceptions left and right: java.io.IOException: No error in nativeavailable at gnu.io.RXTXPort.nativeavailable(Native Method) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1427) at gnu.io.RXTXPort$SerialInputStream.read(RXTXPort.java:1339) and when I re-plug the cable in again, it does not recover. Is there any way to get rxtx to work properly with USB comm port connection/disconnection? (I've tried to post to the rxtx mailing list but for some strange reason I cannot send messages even though I am subscribed to the list. I've emailed the list admin and have gotten no response.) If not, is there another serial I/O framework that does?

    Read the article

  • Robust and fast checksum algorithm?

    - by bene
    Which checksum algorithm can you recommend in the following use case? I want to generate checksums of small JPEG files (~8 kB each) to check if the content changed. Using the filesystem's date modified is unfortunately not an option. The checksum need not be cryptographically strong but it should robustly indicate changes of any size. The second criterion is speed since it should be possible to process at least hundreds of images per second (on a modern CPU). The calculation will be done on a server with several clients. The clients send the images over Gigabit TCP to the server. So there's no disk I/O as bottleneck.

    Read the article

  • Implementing a robust async stream reader

    - by Jon
    I recently provided an answer to this question: C# - Realtime console output redirection. As often happens, explaining stuff (here "stuff" was how I tackled a similar problem) leads you to greater understanding and/or, as is the case here, "oops" moments. I realized that my solution, as implemented, has a bug. The bug has little practical importance, but it has an extremely large importance to me as a developer: I can't rest easy knowing that my code has the potential to blow up. Squashing the bug is the purpose of this question. I apologize for the long intro, so let's get dirty. I wanted to build a class that allows me to receive input from a Stream in an event-based manner. The stream, in my scenario, is guaranteed to be a FileStream and there is also an associated StreamReader already present to leverage. The public interface of the class is this: public class MyStreamManager { public event EventHandler<ConsoleOutputReadEventArgs> StandardOutputRead; public void StartSendingEvents(); public void StopSendingEvents(); } Obviously this specific scenario has to do with a console's standard output, but that is a detail and does not play an important role. StartSendingEvents and StopSendingEvents do what they advertise; for the purposes of this discussion, we can assume that events are always being sent without loss of generality. The class uses these two fields internally: protected readonly StringBuilder inputAccumulator = new StringBuilder(); protected readonly byte[] buffer = new byte[256]; The functionality of the class is implemented in the methods below. To get the ball rolling: public void StartSendingEvents(); { this.stopAutomation = false; this.BeginReadAsync(); } To read data out of the Stream without blocking, and also without requiring a carriage return char, BeginRead is called: protected void BeginReadAsync() { if (!this.stopAutomation) { this.StandardOutput.BaseStream.BeginRead( this.buffer, 0, this.buffer.Length, this.ReadHappened, null); } } The challenging part: BeginRead requires using a buffer. This means that when reading from the stream, it is possible that the bytes available to read ("incoming chunk") are larger than the buffer. Since we are only handing off data from the stream to a consumer, and that consumer may well have inside knowledge about the size and/or format of these chunks, I want to call event subscribers exactly once for each chunk. Otherwise the abstraction breaks down and the subscribers have to buffer the incoming data and reconstruct the chunks themselves using said knowledge. This is much less convenient to the calling code, and detracts from the usefulness of my class. To this end, if the buffer is full after EndRead, we don't send its contents to subscribers immediately but instead append them to a StringBuilder. The contents of the StringBuilder are only sent back whenever there is no more to read from the stream (thus preserving the chunks). private void ReadHappened(IAsyncResult asyncResult) { var bytesRead = this.StandardOutput.BaseStream.EndRead(asyncResult); if (bytesRead == 0) { this.OnAutomationStopped(); return; } var input = this.StandardOutput.CurrentEncoding.GetString( this.buffer, 0, bytesRead); this.inputAccumulator.Append(input); if (bytesRead < this.buffer.Length) { this.OnInputRead(); // only send back if we 're sure we got it all } this.BeginReadAsync(); // continue "looping" with BeginRead } After any read which is not enough to fill the buffer, all accumulated data is sent to the subscribers: private void OnInputRead() { var handler = this.StandardOutputRead; if (handler == null) { return; } handler(this, new ConsoleOutputReadEventArgs(this.inputAccumulator.ToString())); this.inputAccumulator.Clear(); } (I know that as long as there are no subscribers the data gets accumulated forever. This is a deliberate decision). The good This scheme works almost perfectly: Async functionality without spawning any threads Very convenient to the calling code (just subscribe to an event) Maintains the "chunkiness" of the data; this allows the calling code to use inside knowledge of the data without doing any extra work Is almost agnostic to the buffer size (it will work correctly with any size buffer irrespective of the data being read) The bad That last almost is a very big one. Consider what happens when there is an incoming chunk with length exactly equal to the size of the buffer. The chunk will be read and buffered, but the event will not be triggered. This will be followed up by a BeginRead that expects to find more data belonging to the current chunk in order to send it back all in one piece, but... there will be no more data in the stream. In fact, as long as data is put into the stream in chunks with length exactly equal to the buffer size, the data will be buffered and the event will never be triggered. This scenario may be highly unlikely to occur in practice, especially since we can pick any number for the buffer size, but the problem is there. Solution? Unfortunately, after checking the available methods on FileStream and StreamReader, I can't find anything which lets me peek into the stream while also allowing async methods to be used on it. One "solution" would be to have a thread wait on a ManualResetEvent after the "buffer filled" condition is detected. If the event is not signaled (by the async callback) in a small amount of time, then more data from the stream will not be forthcoming and the data accumulated so far should be sent to subscribers. However, this introduces the need for another thread, requires thread synchronization, and is plain inelegant. Specifying a timeout for BeginRead would also suffice (call back into my code every now and then so I can check if there's data to be sent back; most of the time there will not be anything to do, so I expect the performance hit to be negligible). But it looks like timeouts are not supported in FileStream. Since I imagine that async calls with timeouts are an option in bare Win32, another approach might be to PInvoke the hell out of the problem. But this is also undesirable as it will introduce complexity and simply be a pain to code. Is there an elegant way to get around the problem? Thanks for being patient enough to read all of this.

    Read the article

  • Robust fault tolerant MySQL replication

    - by Joshua
    Is there any way to get a fault tolerant MySQL replication? I am in an environment that has many networking issues. It appears that replication gets an error and just stops. I need it to continue to work and recover from these faults. There is some wrapper software that checks the state of replication and restarts it in the case of losing its log position. Is there an alternative? Note: Replication is done from an embedded computer with MySQL 4.1 to a external computer that has MySQL 5.0.45

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >