Search Results

Search found 60744 results on 2430 pages for 'why we write'.

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

  • Write-error on swap-device, Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK

    - by Jan
    My root server at 1&1 was unresponsive on HTTP and SSH, so I logged into the serial console . It flooded my connection with endless error messages like quoted below. I initiated a reboot and now everything seems to work properly. After googling, I installed smartctl and ran a short self test, which told me the device was healthy. Is this likely a disk failure soon to happen or could it be just some program going wild? I assume, the swap device could also grow full when huge amounts of memory get consumed by a buggy program? How can I find out for sure? The sever was already unresponsive a week ago when I just restarted it without proper investigation. The server is running on CentOS. Write-error on swap-device (8:16:8351055) Write-error on swap-device (8:16:8351063) Write-error on swap-device (8:16:8351071) Write-error on swap-device (8:16:8351079) Write-error on swap-device (8:16:8351087) Write-error on swap-device (8:16:8351095) Write-error on swap-device (8:16:8351103) Write-error on swap-device (8:16:8351111) Write-error on swap-device (8:16:8351119) Write-error on swap-device (8:16:8351127) Write-error on swap-device (8:16:8351135) Write-error on swap-device (8:16:8351143) Write-error on swap-device (8:16:8351151) Write-error on swap-device (8:16:8351159) Write-error on swap-device (8:16:8351167) Write-error on swap-device (8:16:8351175) Write-error on swap-device (8:16:8351183) Write-error on swap-device (8:16:8351191) sd 1:0:0:0: [sdb] Unhandled error code sd 1:0:0:0: [sdb] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK sd 1:0:0:0: [sdb] CDB: Write(10): 2a 00 00 9c 00 ef 00 00 08 00 end_request: I/O error, dev sdb, sector 10223855 Write-error on swap-device (8:16:10223863) sd 1:0:0:0: [sdb] Unhandled error code sd 1:0:0:0: [sdb] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK sd 1:0:0:0: [sdb] CDB: Write(10): 2a 00 00 9c 0e 97 00 00 10 00 end_request: I/O error, dev sdb, sector 10227351 Write-error on swap-device (8:16:10227359) Write-error on swap-device (8:16:10227367) sd 1:0:0:0: [sdb] Unhandled error code sd 1:0:0:0: [sdb] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK sd 1:0:0:0: [sdb] CDB: Write(10): 2a 00 00 9c b0 1f 00 00 10 00 end_request: I/O error, dev sdb, sector 10268703 Write-error on swap-device (8:16:10268711) Write-error on swap-device (8:16:10268719) sd 1:0:0:0: [sdb] Unhandled error code sd 1:0:0:0: [sdb] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK sd 1:0:0:0: [sdb] CDB: Write(10): 2a 00 00 a0 84 7f 00 00 08 00 end_request: I/O error, dev sdb, sector 10519679 Write-error on swap-device (8:16:10519687) sd 1:0:0:0: [sdb] Unhandled error code sd 1:0:0:0: [sdb] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK sd 1:0:0:0: [sdb] CDB: Write(10): 2a 00 00 a7 26 af 00 04 00 00 end_request: I/O error, dev sdb, sector 10954415 Write-error on swap-device (8:16:10954423) Write-error on swap-device (8:16:10954431) Write-error on swap-device (8:16:10954439) Write-error on swap-device (8:16:10954447) Write-error on swap-device (8:16:10954455) Write-error on swap-device (8:16:10954463) Write-error on swap-device (8:16:10954471) Write-error on swap-device (8:16:10954479) Write-error on swap-device (8:16:10954487) Write-error on swap-device (8:16:10954495) Write-error on swap-device (8:16:10954503) Write-error on swap-device (8:16:10954511) Write-error on swap-device (8:16:10954519) Write-error on swap-device (8:16:10954527) Write-error on swap-device (8:16:10954535) Write-error on swap-device (8:16:10954543) Write-error on swap-device (8:16:10954551) Write-error on swap-device (8:16:10954559) Write-error on swap-device (8:16:10954567) Write-error on swap-device (8:16:10954575) Write-error on swap-device (8:16:10954583) Write-error on swap-device (8:16:10954591) Write-error on swap-device (8:16:10954599) Write-error on swap-device (8:16:10954607) Write-error on swap-device (8:16:10954615) Write-error on swap-device (8:16:10954623) Write-error on swap-device (8:16:10954631) Write-error on swap-device (8:16:10954639) Write-error on swap-device (8:16:10954647) Write-error on swap-device (8:16:10954655) Write-error on swap-device (8:16:10954663) Write-error on swap-device (8:16:10954671) Write-error on swap-device (8:16:10954679) Write-error on swap-device (8:16:10954687) Write-error on swap-device (8:16:10954695) Write-error on swap-device (8:16:10954703) Write-error on swap-device (8:16:10954711) Write-error on swap-device (8:16:10954719) Write-error on swap-device (8:16:10954727) Write-error on swap-device (8:16:10954735) Write-error on swap-device (8:16:10954743) Write-error on swap-device (8:16:10954751) Write-error on swap-device (8:16:10954759) Write-error on swap-device (8:16:10954767) Write-error on swap-device (8:16:10954775) Write-error on swap-device (8:16:10954783) Write-error on swap-device (8:16:10954791) Write-error on swap-device (8:16:10954799) Write-error on swap-device (8:16:10954807) Write-error on swap-device (8:16:10954815) Write-error on swap-device (8:16:10954823) Write-error on swap-device (8:16:10954831) Write-error on swap-device (8:16:10954839) Write-error on swap-device (8:16:10954847) Write-error on swap-device (8:16:10954855) Write-error on swap-device (8:16:10954863) Write-error on swap-device (8:16:10954871) Write-error on swap-device (8:16:10954879) Write-error on swap-device (8:16:10954887) Write-error on swap-device (8:16:10954895) Write-error on swap-device (8:16:10954903) Write-error on swap-device (8:16:10954911) Write-error on swap-device (8:16:10954919) Write-error on swap-device (8:16:10954927) Write-error on swap-device (8:16:10954935) Write-error on swap-device (8:16:10954943) Write-error on swap-device (8:16:10954951) Write-error on swap-device (8:16:10954959) Write-error on swap-device (8:16:10954967) Write-error on swap-device (8:16:10954975) Write-error on swap-device (8:16:10954983) Write-error on swap-device (8:16:10954991) Write-error on swap-device (8:16:10954999) Write-error on swap-device (8:16:10955007) Write-error on swap-device (8:16:10955015) Write-error on swap-device (8:16:10955023) Write-error on swap-device (8:16:10955031) Write-error on swap-device (8:16:10955039) Write-error on swap-device (8:16:10955047) Write-error on swap-device (8:16:10955055) Write-error on swap-device (8:16:10955063) Write-error on swap-device (8:16:10955071) Write-error on swap-device (8:16:10955079) Write-error on swap-device (8:16:10955087) Write-error on swap-device (8:16:10955095) Write-error on swap-device (8:16:10955103) Write-error on swap-device (8:16:10955111) Write-error on swap-device (8:16:10955119) Write-error on swap-device (8:16:10955127) Write-error on swap-device (8:16:10955135) Write-error on swap-device (8:16:10955143) Write-error on swap-device (8:16:10955151) Write-error on swap-device (8:16:10955159) Write-error on swap-device (8:16:10955167) Write-error on swap-device (8:16:10955175) Write-error on swap-device (8:16:10955183)

    Read the article

  • Why We Write #6-An Interview with Kevin Kline

    - by drsql
    Wow, so far in this series, I have interviewed some very good friends, and some truly excellent writers (and usually both), but today, following on the heels of Jason Strate , we are going to hit someone whose name is synonymous with community, a person who really needs no introduction. According to Bing, Kevin Kline ( @kekline ) is the most important Kevin Kline on Twitter (though it clearly could be due to my typical searches, I am giving him the benefit of the doubt… here try it yourself: http://www.bing.com/search?q=kevin+kline+twitter...(read more)

    Read the article

  • How important is to be able to write code like you would write prose

    - by benhowdle89
    Recently I heard of a company that, for interviews, asks potential employees to stand up and write out code on a whiteboard. Apparently that freaked alot of interviewees out. This got me thinking and even though I consider myself a reasonable programmer, I would be hard pressed to write lengthy code out without referring to previous code I had written or doing a quick Google search. How many programmers could safely say "Yes I could write all my code out just like I was writing an email"?

    Read the article

  • Gets Error while i write Response.write() on click event of button

    - by Khilen
    Sys.Webforms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing near ' Hi i have kept button in updatepanel and i am getting this error

    Read the article

  • Why do you like Lisp ?

    - by Geek
    Why does Paul Graham advocate Lisp? Why did ITA Software choose Lisp over other High Level languages? Lisp obviously is an advantage for the AI stuff but I don't think Lisp is any faster than Java, C# or as a matter of fact faster than C. Still it is considered as a Hackers language? I am not a master of Lisp but I find it incredibly difficult to understand the advantage one would get in writing Business Software in Lisp.

    Read the article

  • Use Extension method to write cleaner code

    - by Fredrik N
    This blog post will show you step by step to refactoring some code to be more readable (at least what I think). Patrik Löwnedahl gave me some of the ideas when we where talking about making code much cleaner. The following is an simple application that will have a list of movies (Normal and Transfer). The task of the application is to calculate the total sum of each movie and also display the price of each movie. class Program { enum MovieType { Normal, Transfer } static void Main(string[] args) { var movies = GetMovies(); int totalPriceOfNormalMovie = 0; int totalPriceOfTransferMovie = 0; foreach (var movie in movies) { if (movie == MovieType.Normal) { totalPriceOfNormalMovie += 2; Console.WriteLine("$2"); } else if (movie == MovieType.Transfer) { totalPriceOfTransferMovie += 3; Console.WriteLine("$3"); } } } private static IEnumerable<MovieType> GetMovies() { return new List<MovieType>() { MovieType.Normal, MovieType.Transfer, MovieType.Normal }; } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } In the code above I’m using an enum, a good way to add types (isn’t it ;)). I also use one foreach loop to calculate the price, the loop has a condition statement to check what kind of movie is added to the list of movies. I want to reuse the foreach only to increase performance and let it do two things (isn’t that smart of me?! ;)). First of all I can admit, I’m not a big fan of enum. Enum often results in ugly condition statements and can be hard to maintain (if a new type is added we need to check all the code in our app to see if we use the enum somewhere else). I don’t often care about pre-optimizations when it comes to write code (of course I have performance in mind). I rather prefer to use two foreach to let them do one things instead of two. So based on what I don’t like and Martin Fowler’s Refactoring catalog, I’m going to refactoring this code to what I will call a more elegant and cleaner code. First of all I’m going to use Split Loop to make sure the foreach will do one thing not two, it will results in two foreach (Don’t care about performance here, if the results will results in bad performance, you can refactoring later, but computers are so fast to day, so iterating through a list is not often so time consuming.) Note: The foreach actually do four things, will come to is later. var movies = GetMovies(); int totalPriceOfNormalMovie = 0; int totalPriceOfTransferMovie = 0; foreach (var movie in movies) { if (movie == MovieType.Normal) { totalPriceOfNormalMovie += 2; Console.WriteLine("$2"); } } foreach (var movie in movies) { if (movie == MovieType.Transfer) { totalPriceOfTransferMovie += 3; Console.WriteLine("$3"); } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } To remove the condition statement we can use the Where extension method added to the IEnumerable<T> and is located in the System.Linq namespace: foreach (var movie in movies.Where( m => m == MovieType.Normal)) { totalPriceOfNormalMovie += 2; Console.WriteLine("$2"); } foreach (var movie in movies.Where( m => m == MovieType.Transfer)) { totalPriceOfTransferMovie += 3; Console.WriteLine("$3"); } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } The above code will still do two things, calculate the total price, and display the price of the movie. I will not take care of it at the moment, instead I will focus on the enum and try to remove them. One way to remove enum is by using the Replace Conditional with Polymorphism. So I will create two classes, one base class called Movie, and one called MovieTransfer. The Movie class will have a property called Price, the Movie will now hold the price:   public class Movie { public virtual int Price { get { return 2; } } } public class MovieTransfer : Movie { public override int Price { get { return 3; } } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } The following code has no enum and will use the new Movie classes instead: class Program { static void Main(string[] args) { var movies = GetMovies(); int totalPriceOfNormalMovie = 0; int totalPriceOfTransferMovie = 0; foreach (var movie in movies.Where( m => m is Movie)) { totalPriceOfNormalMovie += movie.Price; Console.WriteLine(movie.Price); } foreach (var movie in movies.Where( m => m is MovieTransfer)) { totalPriceOfTransferMovie += movie.Price; Console.WriteLine(movie.Price); } } private static IEnumerable<Movie> GetMovies() { return new List<Movie>() { new Movie(), new MovieTransfer(), new Movie() }; } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }   If you take a look at the foreach now, you can see it still actually do two things, calculate the price and display the price. We can do some more refactoring here by using the Sum extension method to calculate the total price of the movies:   static void Main(string[] args) { var movies = GetMovies(); int totalPriceOfNormalMovie = movies.Where(m => m is Movie) .Sum(m => m.Price); int totalPriceOfTransferMovie = movies.Where(m => m is MovieTransfer) .Sum(m => m.Price); foreach (var movie in movies.Where( m => m is Movie)) Console.WriteLine(movie.Price); foreach (var movie in movies.Where( m => m is MovieTransfer)) Console.WriteLine(movie.Price); } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Now when the Movie object will hold the price, there is no need to use two separate foreach to display the price of the movies in the list, so we can use only one instead: foreach (var movie in movies) Console.WriteLine(movie.Price); .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } If we want to increase the Maintainability index we can use the Extract Method to move the Sum of the prices into two separate methods. The name of the method will explain what we are doing: static void Main(string[] args) { var movies = GetMovies(); int totalPriceOfMovie = TotalPriceOfMovie(movies); int totalPriceOfTransferMovie = TotalPriceOfMovieTransfer(movies); foreach (var movie in movies) Console.WriteLine(movie.Price); } private static int TotalPriceOfMovieTransfer(IEnumerable<Movie> movies) { return movies.Where(m => m is MovieTransfer) .Sum(m => m.Price); } private static int TotalPriceOfMovie(IEnumerable<Movie> movies) { return movies.Where(m => m is Movie) .Sum(m => m.Price); } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Now to the last thing, I love the ForEach method of the List<T>, but the IEnumerable<T> doesn’t have it, so I created my own ForEach extension, here is the code of the ForEach extension method: public static class LoopExtensions { public static void ForEach<T>(this IEnumerable<T> values, Action<T> action) { Contract.Requires(values != null); Contract.Requires(action != null); foreach (var v in values) action(v); } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } I will now replace the foreach by using this ForEach method: static void Main(string[] args) { var movies = GetMovies(); int totalPriceOfMovie = TotalPriceOfMovie(movies); int totalPriceOfTransferMovie = TotalPriceOfMovieTransfer(movies); movies.ForEach(m => Console.WriteLine(m.Price)); } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } The ForEach on the movies will now display the price of the movie, but maybe we want to display the name of the movie etc, so we can use Extract Method by moving the lamdba expression into a method instead, and let the method explains what we are displaying: movies.ForEach(DisplayMovieInfo); private static void DisplayMovieInfo(Movie movie) { Console.WriteLine(movie.Price); } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Now the refactoring is done! Here is the complete code:   class Program { static void Main(string[] args) { var movies = GetMovies(); int totalPriceOfMovie = TotalPriceOfMovie(movies); int totalPriceOfTransferMovie = TotalPriceOfMovieTransfer(movies); movies.ForEach(DisplayMovieInfo); } private static void DisplayMovieInfo(Movie movie) { Console.WriteLine(movie.Price); } private static int TotalPriceOfMovieTransfer(IEnumerable<Movie> movies) { return movies.Where(m => m is MovieTransfer) .Sum(m => m.Price); } private static int TotalPriceOfMovie(IEnumerable<Movie> movies) { return movies.Where(m => m is Movie) .Sum(m => m.Price); } private static IEnumerable<Movie> GetMovies() { return new List<Movie>() { new Movie(), new MovieTransfer(), new Movie() }; } } public class Movie { public virtual int Price { get { return 2; } } } public class MovieTransfer : Movie { public override int Price { get { return 3; } } } pulbic static class LoopExtensions { public static void ForEach<T>(this IEnumerable<T> values, Action<T> action) { Contract.Requires(values != null); Contract.Requires(action != null); foreach (var v in values) action(v); } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } I think the new code is much cleaner than the first one, and I love the ForEach extension on the IEnumerable<T>, I can use it for different kind of things, for example: movies.Where(m => m is Movie) .ForEach(DoSomething); .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } By using the Where and ForEach extension method, some if statements can be removed and will make the code much cleaner. But the beauty is in the eye of the beholder. What would you have done different, what do you think will make the first example in the blog post look much cleaner than my results, comments are welcome! If you want to know when I will publish a new blog post, you can follow me on twitter: http://www.twitter.com/fredrikn

    Read the article

  • How to read/write cookies in asp.net

    - by SAMIR BHOGAYTA
    Writing Cookies Response.Cookies["userName"].Value = "patrick"; Response.Cookies["userName"].Expires = DateTime.Now.AddDays(1); HttpCookie aCookie = new HttpCookie("lastVisit"); aCookie.Value = DateTime.Now.ToString(); aCookie.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(aCookie); Reading Cookies: if(Request.Cookies["userName"] != null) Label1.Text = Server.HtmlEncode(Request.Cookies["userName"].Value); if(Request.Cookies["userName"] != null) { HttpCookie aCookie = Request.Cookies["userName"]; Label1.Text = Server.HtmlEncode(aCookie.Value); } Below link will give you full detailed information about cookies http://msdn.microsoft.com/en-us/library/ms178194.aspx

    Read the article

  • Still about SSD potentials...write and read speed

    - by Macroideal
    I have been working on SSD (solid state disk) for several months..Problems and Questions hit my head unexpectedly..Coz i am a virgin in ssd... Especially these days I was testing the write-read speed of ssd, which I was always caring.... however result turned out not good as I expected, or even worse Three kinds of read-write were implemented in my test read and write directly from and into ssd, with openning ssd as a whole device. in windows: _open("\\:g", ***).. It can be very tricky and hairy that you'd write a data with size of folds of 512, at the disk position of folds of 512bytes... So, If you wanto write just a byte or 4 bytes, you'v to write at least a whole sector one time. Read and write data from and into files located in SSD... Read and Write data from and into files in mechanical Disk I compared the pratices below...I found ssd sucks...the ssd performs worse than mechanical disk... so i am wondering where i can get the potential performance of ssd, since ssd is said to a substitute for mechanical disk in the future.. Nevertheless, I test ssd with a pro-hard-disk tools..ssd is like twice speedier than mechanical disk. So, why?

    Read the article

  • RAID10 without write-back cache = horrible write performance?

    - by Harry Mexican
    I have just provisioned a dedicated server on singlehop. I'm running it through some tests to know what to expect performance-wise. On the I/O side (with 4 1TB disks in RAID 10) I get: write-cache disabled 200 MB/s read throughput 30 MB/s write throughput I thought that was really low compared to my desktop HD which gets 150-150 or so. So I had a chat with them and they suggested enabling the write cache. New results: write-cache enabled 280 MB/s read 260 MB/s write which is great and all but means I'd have to add a BBU for an additional monthly cost. Is it normal for the write throughput to be 1/4 of a regular drive on RAID10, if you don't have write cache? It almost feels like its intentionally bad to force you to pony up for the BBU. I'd be happy with normal non-raid performance of 150/150.

    Read the article

  • To write or not to write: Frameworks [closed]

    - by caarlos0
    Today some friends and I started discussing frameworks.. Some of us strongly believe that in 99.9% of cases, writing a new framework is a bad idea. We believe that probably some of the millions of frameworks out there should fit our problem, and if not, some hack, API, or configuration should be enough. If not, we think that contributing to some framework, suggest features or something like that should be the best solution. The 0.1% is when none of the frameworks fit to our case. But, some of us say that it is better to have an "internal corporate framework" (for example), because it's faster to fix issues, creates a 100% fit with the app, because of the "learning" factor (when you improve your skills building a framework), etc. I think that to go out coding frameworks like there's no tomorrow is not the right way. I've seen a lot of small teams building their own framework just to spread the word: "we built our own framework, we rule, bro". Generally, the framework is crap, without any documentation, and only works for their own applications. Opinions are opinions, devs are devs, without the intention to start any kind of flame war, I ask: What do you think about that? What parameters you consider when building a framework? What do you think about all this?

    Read the article

  • Turn off write barriers on ext4 whiche FS is mounted

    - by user462982
    I am doing some IO intensive DB imports that run for several days now and the IO performance has dropped tremendously over times. The DB data files (log files) are on an ext4 formatted logical volume which is mounted with default options (did not specify something special in fstab). Since I just learned that ext4 enables write barriers by default: Q: Is there some way to disable write barriers online (i.e. while the file system is in use), because I cannot interrupt the import and don't want to restart it again. I am aware that write barriers might not be the only thing impeding performance it is a bad idea to have write barriers disabled on journalling file systems if data safty is important (e.g. on a production system)

    Read the article

  • Disable write-protection on Micro SD

    - by Tim
    My task today is to open up and copy some files to 700 brand new micro SD cards. As I get going on this task I am finding that some of the Micro SD cards are telling me "sorry this drive is write protected" To copy the files I am using a standard SD to micro SD card adapter, and a USB SD card reader / writer. I have ensured that the switch is set to OFF on all of my adapters. As soon as I get a Micro SD that tells me it is write protected I can use the same adapter with another micro SD and it works fine, so I know the problem is not with my adapters. My question is: How can I disable the write protection on a Micro SD card? This eHow article seems to indicate that there is also a physical switch on Micro SD cards. However I have personally never seen a Micro SD with a physical switch, and none of the ones I am using today have said switch. Since these cards are brand new and thus empty are the ones that are telling me they are write protected simply useless? Could this be caused by some sort of defect in the cards?

    Read the article

  • Hard Drive benchmark values show write very very slow

    - by John
    I recently started to have issues with my laptop being very slow. I ran a hard drive benchmarking tool (by ATTO) that showed that the write speed was very very slow on my boot drive. I ran the same benchmark on my usb drive and it was 650 times faster than my boot drive when it came to writing. Reading is very fast/normal on both. I swapped out an identical drive and ran the same benchmark. This time the drive showed proper write speed. Thinking that I had a hard drive going bad I cloned the old one onto the new one. I managed to clone the problem too. Anyone have any ideas on what in WinXP SP3 might be causing the write issues? I am on a corporate network and we have commercial anti-virus software installed. (AVG I think) I regularly run defraggler and have about 40 gig free on a 100 gig drive. The machine has 4 gigs of memory. Any ideas? TIA J

    Read the article

  • Still about SSD potentials...write and read speed

    - by Macroideal
    HI Gurus, I have been working on SSD(solid state disk) for several months..Problems and Questions hit my head unexpectedly..Coz i am a virgin in ssd... Esp these days i was testing the write-read speed of ssd, which I was always caring.... however result turned out not good as I expected, or even worse Three kinds of read-write were implemented in my test 1. read and write directly from and into ssd, with openning ssd as a whole device. in windows: _open("\\:g", ***).. It can be very tricky and hairy that you'd write a data with size of folds of 512, at the disk position of folds of 512bytes... So, If you wanto write just a byte or 4 bytes, you'v to write at least a whole sector one time. 2. Read and write data from and into files located in SSD... 3. Read and Write data from and into files in mechanical Disk I compared the pratices below...I found ssd sucks...the ssd performs worse than mechanical disk... so i am wondering where i can get the potential performance of ssd, since ssd is said to a substitute for mechanical disk in the future.. Nevertheless, I test ssd with a pro-hard-disk tools..ssd is like twice speedier than mechanical disk. So, why? Thanx very much...If you know tips of ssd...follow me

    Read the article

  • UNRAID V4.7: Lost write permission on Win7/Android devices

    - by JROC
    I'm currently running V4.7 and I haven't touched any of the user or share settings, and I'm periodically losing read.write permission on both my windows 7 pc and my android tablet connecting over the wireless. Sometime I can access my shares and see the folder directories, but when attempting to open a folder windows denies me access saying I don't have the proper permission. This is after I have logged in with my main account that has full read/write access of everything, same on my android device. This all started when I attempted to delete a large amount of files (8gb) to make more room and about half way through started getting permission errors. What could be causing this? Thanks

    Read the article

  • Cannot write, format, nor erase flash drive

    - by Baruch
    I have a 4gig flash drive, which I can read from but not write on, erase, nor format in any computer (tried in 7 different computers including xp, vista, and win7). I want to erase all the data inside because it is useless. Once I erase something, it erases it and gives me an error that it can't find the file. Once I refresh the folder, the file comes back. I tried holding Shift + Del. I also tried to use the command to format it in safe mode, but it says "access denied". I don't have a write protection button or whatever it is on my flash drive. It's just a simple small 4 gig one.

    Read the article

  • Outlook 2007 Backup to D:\Outlook Fails - Access Denied, Write-Protected or File In Use

    - by nicorellius
    I can successfully save the Outlook PST file to the default location on the C drive (C:\Documents and Settings\user\ ... \Outlook) but when I change the backup save to directory to Outlook on the D drive I get the error: Cannot copy Outlook: Access is denied. Make sure the disk is not full or write protected and that the file is not currently in use. I suppose it is not that crucial that I save this file here, but I have never seen this problem before and I have made this same change in the past. I did some searching in this knowledge exchange as well as elsewhere on changing permissions, etc, but this didn't help. I discovered that the folder on my D drive (called Outlook) is not write-protected and nor is it read-only, as I can save to and modify files in that directory, as well as rename and delete the directory itself. At the time when I installed this version of Outlook, I used a previously saved Personal Folder (a backup PST file) and I thought having this still open in Outlook was causing the trouble. But I closed it and still have the same problem. I know this is probably a silly error on my part but I would like to figure it out. I'm new to superuser, but the answers I see are usually very good, so I thought I would post my first question. Thanks in advance.

    Read the article

  • USB Hardware vs. Software Write Lock

    - by TreyK
    I'm in the market for a USB flash drive, and remember this cool feature a tiny 32MB flash drive of mine had: a write lock switch. This seemed like it would be an amazing feature to have as a shield against any nastiness happening to the drive on an unfamiliar computer. However, very few drives on the market offer this feature. Instead, it seems that forms of software protection are the more prominent method. This software protection causes me a bit of uneasiness, as it seems like this software wouldn't be nearly as bulletproof as a physical switch. Also, levels of protection seem to vary from product to product. Being able to protect certain folders from reading and/or writing would be nice, but is the security trade-off worth it? Just how effective can this software protection be? Wouldn't a simple format be able to clean any drive with software protection? My drive must also be compatible with Windows XP, Vista, and 7, as well as Linux and Mac. What would be the best way forward for getting a well-sized (~8GB) flash drive with a strong write protection implementation, for little or no more than a regular drive? Thanks.

    Read the article

  • Strange performance differences in read/write from/to USB flash drive

    - by Mario De Schaepmeester
    When copying files from my 8GB USB 2.0 flash drive with Windows 7 to a traditional hard drive, the average speed is between 25 and 30 MB/s. When doing the reverse, copying to the USB drive, the speed is 5MB/s average. I have tested this with about 4.5GB of files, a mixture of smaller and larger ones. The observations were the same on both FAT32 and exFAT file systems on the USB drive, NTFS on the internal hard disk. I don't think I can be mistaken in saying that flash memory has a lot higher performance than a spinning hard drive in both terms of reading and writing. For both memory types, reading should be faster than writing too. Now I wonder, how can it be that copying files from a fast read memory to a faster write memory is actually slower than copying files from a fast read memory to a slow write memory? I think that the files are stored in RAM before being copied over too, and there's caching as well, but I don't see how even that could tip the balance. It can only be in the advantage of writing to the USB drive, since it is "closer" to the SATA system than the USB port and it will receive data from the internal SATA HDD faster. Perhaps my way of thinking is all wrong or it just depends on the manufacturer of the USB pen. But I am curious.

    Read the article

  • Program to write for you?

    - by Richard Morton
    I need a program that can write what you input in it, and "writing" it back on another process, letter by letter, not copying and pasting it back. Basically, I have a insanely huge file that would take me about a month of non-stop keyboard typing and I can't simply control-C to the other program because it doesn't allow pasting text (go figure). I do realize it's quite an unusual question, but I need this to be done by a machine and not myself. Is there any way to be done?

    Read the article

  • Remove Write Protection from USB

    - by Vasile Marian Falama?
    My flash USB is write protected and I've tried every possible methods I've encountered over the internet, to get rid of this. Accessing the usb is not working. Format from my computer, is not working. Clear attributes with DiskPart is not working (can't be cleaned, Current Read-only State is Yes but Readonly is set to false... With Disk Management, I can't delete the partition... Is there any other method... With a specific software or somehow? Edit : I tried this on Windows 8.1.

    Read the article

  • Problem with "write" function in linux

    - by Dumitru Catalin
    I am trying to write 2 server/client programs under Linux, in which they communicate through named pipes. The problem is that sometimes when I try to write from the server into a pipe that doesn't exist anymore (the client has stopped), I get a "Resource temporarily unavailable" error and the server stops completely. I understand that this is caused by using a O_NONBLOCK parameter when opening the fifo chanel, indicating the point where the program would usually wait until it could write again in the file, but is there a way to stop this behavior, and not halt the entire program if a problem occurs (shouldn't the write command return -1 ad the program continue normally)? And another strange thing is that this error only occurs when running the programs outside the ide (eclipse). If I run both programs inside eclipse, on error the write function just returns -1 and the programs continues normally.

    Read the article

  • How to convert binary read/write to non-binary read/write in C++

    - by Phenom
    I have some C++ code from somewhere that reads and writes data in binary format. I want to see what it's reading and writing in the file, so I want to convert it's binary read and write to non-binary read and write. Also, when I convert the binary write to non-binary write, I want it to still be able to read in the information correctly. How can this be done? The write function: int btwrite(short rrn, BTPAGE *page_ptr) { // long lseek(), addr; long addr; addr = (long) rrn * (long) PAGESIZE + HEADERSIZE; lseek(btfd, addr, 0); return (write(btfd, page_ptr, PAGESIZE)); } The read function: int btread(short rrn, BTPAGE *page_ptr) { // long lseek(), addr; long addr; addr = (long)rrn * (long)PAGESIZE + HEADERSIZE; lseek(btfd, addr, 0); return ( read(btfd, page_ptr, PAGESIZE) ); }

    Read the article

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