Daily Archives

Articles indexed Monday May 3 2010

Page 10/107 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • MSTest Test Context Exception Handling

    - by Flip
    Is there a way that I can get to the exception that was handled by the MSTest framework using the TestContext or some other method on a base test class? If an unhandled exception occurs in one of my tests, I'd like to spin through all the items in the exception.Data dictionary and display them to the test result to help me figure out why the test failed (we usually add data to the exception to help us debug in the production env, so I'd like to do the same for testing). Note: I am not testing that an exception was SUPPOSED TO HAPPEN (I have other tests for that), I am testing a valid case, I just need to see the exception data. Here is a code example of what I'm talking about. [TestMethod] public void IsFinanceDeadlineDateValid() { var target = new BusinessObject(); SetupBusinessObject(target); //How can I capture this in the text context so I can display all the data //in the exception in the test result... var expected = 100; try { Assert.AreEqual(expected, target.PerformSomeCalculationThatMayDivideByZero()); } catch (Exception ex) { ex.Data.Add("SomethingImportant", "I want to see this in the test result, as its important"); ex.Data.Add("Expected", expected); throw ex; } } I understand there are issues around why I probably shouldn't have such an encapsulating method, but we also have sub tests to test all the functionality of PerformSomeCalculation... However, if the test fails, 99% of the time, I rerun it passes, so I can't debug anything without this information. I would also like to do this on a GLOBAL level, so that if any test fails, I get the information in the test results, as opposed to doing it for each individual test. Here is the code that would put the exception info in the test results. public void AddDataFromExceptionToResults(Exception ex) { StringBuilder whereAmI = new StringBuilder(); var holdException = ex; while (holdException != null) { Console.WriteLine(whereAmI.ToString() + "--" + holdException.Message); foreach (var item in holdException.Data.Keys) { Console.WriteLine(whereAmI.ToString() + "--Data--" + item + ":" + holdException.Data[item]); } holdException = holdException.InnerException; } }

    Read the article

  • iPhone apps causing battery to drain out

    - by saurabh
    Hi, Recently my iPhone battery started to discharge in just one day. I do not use my iPhone much (less than 1 hour a day). and then while discussing it with couple of colleagues, I heard that there are some apps which even if installed on your iPhone can cause your battery to drain out faster. It does not matter if you are not using those apps, only having them installed was enough to cause battery drain. I have heard this from couple of my techie friends as well and thus had to put some credibility to it. Being an iPhone developer, I don't think that is possible. Do you think if this is possible for an app to cause battery drain just by being installed there on iPhone?

    Read the article

  • Extending Throwable in Java

    - by polygenelubricants
    Java lets you create an entirely new subtype of Throwable, e.g: public class FlyingPig extends Throwable { ... } Now, very rarely, I may do something like this: throw new FlyingPig("Oink!"); and of course elsewhere: try { ... } catch (FlyingPig porky) { ... } My questions are: Is this a bad idea? And if so, why? What could've been done to prevent this subtyping if it is a bad idea? Since it's not preventable (as far as I know), what catastrophies could result? If this isn't such a bad idea, why not? How can you make something useful out of the fact that you can extends Throwable?

    Read the article

  • jQuery to store data for sessions

    - by Ted
    I am trying to use jQuery AJAX. What my requirement is, i wish to load user names from DB in dataset, convert it to JSON format and store it in memory or using jQuery data for use while a user is browsing my site, i.e for a session. This way I can use autocomplete or my own code to display data to user. Can anyone help me design such a scenario?

    Read the article

  • H.264 / FLV best practices for HTML

    - by Steve Murch
    I run a website with about 700 videos (And no, it's not porn -- get your mind out of the gutter :-) ). The videos are currently in FLV format. We use the JWPlayer to render those videos. IIS6 hosted. Everything works just fine. As I understand it, H.264 (not FLV and likely not OGG) is the emerging preferred HTML5 video standard. Today, the iPad really only respects H.264 or YouTube. Presumably, soon many more important browsers will follow Apple's lead and respect only the HTML5 tag. OK, so I think I can figure out how to convert my existing videos into the proper H.264 format. There are various tools available, including ffmpeg.exe. I haven't tried it yet, but I don't think that's going to be a problem after fiddling with the codec settings. My question is more about the container itself -- that is, planning graceful transition for all users. What's the best-practice recommendation for rendering these videos? If I just use the HTML5 tag, then presumably any browser that doesn't yet support HTML5 won't see the videos. And if I render them in Flash format via the JWPlayer or some other player, then they won't be playable on the iPad. Do I have to do ugly UserAgent detection here to figure out what to render? I know the JWPlayer supports H.264 media, but isn't the player itself a Flash component and therefore not playable on the iPad? Sorry if I'm not being clear, but I'm scratching my head on a graceful transition plan that will work for current browsers, the iPad and the upcoming HTML5 wave. I'm not a video expert, so any advice would be most welcome, thanks.

    Read the article

  • capistrano put() and upload() both failing

    - by Kyle
    With capistrano, I am deploying a Rails application from Mac OS X 10.5 to CentOS 5.2 Note that deploy.rb and the server environment have not changed in over a year. There is a task within our deploy.rb file called upload: put(File.read( file ),"#{shared_path}/#{filename}", :via => :scp) This fails each and every time with the following exception: No such file or directory - /srv/ourapp/releases/20100104194410/config/database.yml My local copy of config/database.yml is failing to upload properly. I've verified it's not our internet connection, as this happens on three different connections and two different systems. I've also tried to swap out put() for upload() but get the same result; also, dropping :via = :scp, and/or trying to force :sftp instead similarly fails. Relevant info: $ cap -V Capistrano v2.5.10 $ ruby -v ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]

    Read the article

  • A dynamic array of class "landmark", inside another single class "landmarks"

    - by pinnacler
    I'm working on a robot localization simulator and I created a class called "landmark". The end result is going to be a robot that is always centered and always faces the top of the screen. As it turns, the birds eye view map will rotate around the robot. To accomplish this, I'm assuming I can rotate one class and have all elements inside rotate as well. So, the landmark class has properties x,y, label, and radius. This is suppose to simulate a tree location in a forest. To test everything, I need "forest data," and I wrote a script to generate 100 trees in a 100m x 100m area. The script automatically generates values within an acceptable range for x,y, radius. The generated data is stored in an object called tempForest and is 100x3. Ideally, I want to create a class called "landmarks" (plural) that has 100 landmark instances inside. How would I instantiate 100 instances of landmark in one instance of landmarks using that randomly generated data? Ideally, I'd just type treeBeacons = landmarks(); and it would randomly populate 100 (user definable, set in config file) instances with x, y, radius data. I'm not sure how to deal with a dynamic array of class "Landmark", inside another single class "landmarks." Any ideas?

    Read the article

  • XAML ComboBox Bind to Method

    - by griegs
    If I have a method in my C#; public CollectionView Months { get { CollectionView retList = new Enumerations.Months().ToCollectionView<Enumerations.Months>(); return retList; } } And I have a ComboBox; <ComboBox x:Name="ddlMonth" Grid.Row="3" Grid.Column="1" ItemsSource="{Binding Source={StaticResource Months}}"/> How can I bind my ComboBox to my method? I should add I'm a complete xaml newbie.

    Read the article

  • i2s0: transmitter underrun (0)

    - by tbarbe
    were doing some audio stuff and I keep seeing this in the Organizer Console. Sun May 2 20:16:48 unknown kernel[0] : i2s0: transmitter underrun (0) Are these transmitter underruns bad? I think its just when were shutting down audio input...but could a few of these cause some issues later on?

    Read the article

  • Looking for fully managed WeifenLuo(DockPanel Suite) replacement or hints on implementing one

    - by luiscubal
    I need a WeifenLuo replacement that'll run on both .NET and Mono, on Windows, Linux and Mac, preferrably licensed under the MIT license. I'd appreciate if the API was similar to WeifenLuo's, but I understand that such may not be available. Also, since I couldn't find anything on Google, I believe this might not exist. In this case, I'd like some hints regarding how to implement this. I have some(not much) Windows.Forms experience, and I must not use any P/Invoke. I already know out how to detect window motion and how to create a borderless translucent window on a given position and with a given size. So here are some problems I am facing: WeifenLuo supports multiple left/right/top/bottom panes, allowing them to be resized and contain more than one panel. It also supports splittable tabs. Is there anything else I should be aware of before starting? Are there similar open-source projects available?

    Read the article

  • Am I correct in my assumption about synchronized block?

    - by kunjaan
    I have a method shout() with a synchronized block. private void shout(){ System.out.println("SHOUT " + Thread.currentThread().getName()); synchronized(this){ System.out.println("Synchronized Shout" + Thread.currentThread().getName()); try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Synchronized Shout" + Thread.currentThread().getName()); } } If I have two Threads that run this method, am I correct in assuming that the two "Synchronized Shout" will always appear one after the other? There can be no other statements in between the "Synchronized Shout"?

    Read the article

  • Adjusting sql statement in a function based upon input

    - by Stefan
    Hey there, This is a bit urgent! I'm trying to make a simple filter search where-by you can choose from a series of 3 drop downs and then based upon this the results are then displayed, How would I go about adjusting the sql query for each and if you were to only choose to search from aone of the 3 rather than all 3 etc... example there could be the url with input such as: url.com?location=gb&color=3&hair=4 and still form the correct sql query for something like this: url.com?location=gb&hair=1 and not encounter problems with WHERE and AND etc etc and empty variables in the statement Would this not need to be a massive function to check using if to see how the data is set for all possibilities? Thanks, Stefan

    Read the article

  • In Ruby Compare 2 lines in a log file which BOTH contain the SAME "WORD" but ONLY print out the line

    - by kamal
    here are sample lines Apr 9 11:53:26 skip [2244]: [2244] ab-cd-ef:cc [INFO] A recoverable error has occurred some other log lines .. .... Apr 9 12:53:26 skip [2244]: [2244] ab-cd-ef:cc [INFO] A recoverable error has occurred now the LATEST line would have to be one with the latest Date String, and THAT is the one that needs to be printed, plus the NEXT time the parser runs on the log file, somehow the previous LATEST line has to be compared with the Existing latest one, and it CAN e the case, that NOTHING Changed and the OLD line is STILL the latest one, OR there is a NEW line, but ONLY the NEW log line should be printed and NOT if there is NO NEW log Entry.

    Read the article

  • having json issues..getting this in firebug--missing ] after element list

    - by faizal
    hi all this is my json object..everything seems to be fin e but dunnkow why i am seeing this--missing ] after element list can somebody help.,.here is y json {"rows": [{"type": "fft_vel","axis": "x","pwrhgh": 7.44475138121547E-02,"pwrlow": 2.35267034990792E-02,"hzlow": 244.827586206897,"hzhgh": 506.896551724138,"dataid": 0,"id": 467,"name": "2008-02-08 14:24:22 - creating first active alarms testing","title": "RMS displacement alert on Pump 11 Sensor 2","description": "An RMS displacement value of 0.04495 inches was recorded on Pump 11 Sensor 2 on 2\u002F8\u002F2008. This is between the RMS displacement alert levels of 0.0442 inches and 0.12 inches.","time_stamp": "2\u002F8\u002F2008 2:24:22 PM","sensor_id": 550003281}]}

    Read the article

  • WPF TreeViewItem deselected item still lightly highlighted

    - by Patric Hua
    Hello WPF fellows, I have multiple expander controls with a ViewTree control within each expander control. When I select a ViewTreeItem from one ViewTree and then select another ViewTreeItem from another ViewTree, the newly selected ViewTreeItem is highlighted in dark blue, but the last selected item is now highlighted in a very light shade of blue. Please look at www.zunjaa.com/public/images/screen.jpg to see what I'm talking about. How do I make it so that no longer active item does not show the lighter blue? Thanks.

    Read the article

  • Database Replication

    - by tanthiamhuat
    I have tried to follow the steps outlined in http://www.howtoforge.com/mysql_database_replication for Database Replication. I have created the database exampledb, and create some tables and load them with values. But when I execute USE exampledb; FLUSH TABLES WITH READ LOCK; SHOW MASTER STATUS; I do not get any output, it says 0 rows affected. why is it so?

    Read the article

  • What data structure to use / data persistence

    - by Dave
    I have an app where I need one table of information with the following fields: field 1 - int or char field 2 - string (max 10 char) field 3 - string (max 20 char) field 4 - float I need the program to filter on field 1 based upon a segmented control and select a field 2 from a picker. From this data I need to look up field 4 to use in a calculation. Total records will be about 200. I never see it go above 400 - 500. I am going to use a singleton which I am able to do, I just need help with the structure for this with data persistence. What type of data structure should I use for this and should I use NSNumber, NSString, etc. or old data types like float, Char, etc. I thought about a struct put into an array but there is probably a better way. This is new to me so any help or reference to examples would be great. I also thought about a plist or dictionary but it looks like it is just a lookup and a field which obviously won't work. Core data looked like overkill to me. Also, with any recommendation how should I get initial data into it? I want the user to be able to edit and add to the database. Sorry for the old terms, you can see what generation I am from... Thanks in advance!!!!

    Read the article

  • ssh X11 forwarding issue

    - by bbuser
    I have put ForwardX11 in my ~/.ssh/config and then I start a X11 application like this: ssh -f user@host 'someapp; sleep 1' This works fine. The application someapp has a button which opens a viewer application via a shell script viewer.sh. When I press the button the viewer comes up. This is all good and as expected, but if I do ssh -2 -f user@host 'someapp; sleep 1' there's trouble. someapp starts very well, but if I click the button the viewer doesn't show up. As the viewer is called via a shell script, I replaced the call with xclock and the situation was exactly the same - I think the viewer is not to blame. The situation is the same on Linux and AIX. The reason I need -2 is that I finally want to use connection multiplexing and this does only work with version 2. The reason for the sleep 1 is that it didn't work otherwise;-) To add more confusion, with ssh -2 -f user@host 'xterm &; app; sleep 1' the viewer works as long as the xterm is open. When I close xterm ssh -v outputs the following debug1: channel 1: FORCE input drain debug1: channel 0: free: client-session, nchannels 3 debug1: channel 1: free: x11, nchannels 2 and from that moment the viewer doesn't show when I press the button. I also replaced the viewer application with a script that writes the $DISPLAY variable to a file. The variable is always set correctly.

    Read the article

  • Safe to KILL a mysql process REPLACEing records in a large myisam table?

    - by threecheeseopera
    I have a REPLACE query running for a few days now on a few MyISAM tables, the largest having 20+million records. I need it to stop. It is, basically: REPLACE INTO really_large_table (a,b,c,d) SELECT e,f,g,h FROM big_table INNER JOIN huge_table ON big_table.x LIKE CONCAT('%', huge_table.y, '%'); I need to KILL it, and I am worried that I may corrupt really_large_table. Because the sub-query itself takes a significant amount of time, the REPLACEing probably occurs (relatively) infrequently; if this is true, does this make it less likely for the data to become corrupted? For the curious, here is the SO question asked about the query I am trying to kill.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >