Search Results

Search found 1649 results on 66 pages for 'tim evans'.

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

  • Why is my code returning a Null Object Refrence error when using WatIn?

    - by Fuzz Evans
    I keep getting a Null Object Refrence Error, but can't tell why. I have a CSV file that contains 100 urls. The file is read into an array called "lines". public partial class Form1 : System.Windows.Forms.Form { string[] lines; public Form1() ... private void ReadLinksIntoMemory() { //this reads the chosen csv file into our "lines" array //and splits on comma's and new lines to create new objects within the array using (StreamReader sr = new StreamReader(@"C:\temp.csv")) { //reads everything in our csv into 1 long line string fileContents = sr.ReadToEnd(); //splits the 1 long line read in into multiple objects of the lines array lines = fileContents.Split(new string[] { ",", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); sr.Dispose(); } } The next part is where I get the null object error. When I try to use WatIn to go to the first item in the lines array it says I'm referencing a null object. private void GoToEditLinks() { for (int i = 0; i < lines.Length; i++) { //go to each link sequentially myIE.GoTo(lines[i].ToString()); //sleep so we can make sure the page loads System.Threading.Thread.Sleep(5000); } } When I debug the code it says that the GoTo request calls lines which is null. It seems like I need to declare the array, but don't I need to tell it an exact size to do that? Example: lines = new string[10] I thought I could use the lines.Length to tell it how big to make the array but that didn't work. What is weird to me is I can use the following code without problem: //returns the accurate number of urls that were in the CSV we read in earlier txtbx1.text = lines.Length; //or //this returns the last entry in the csv, as well as the last entry in the array TextBox2.Text = lines[lines.Length - 1]; I am confused why the array clearly has items in it, they can be called to fill a text box, but when I try to call them in my for loop it says its a null reference? UPDATE: By placing my cursor on both calls to lines and pressing f12 I find they both go to the same instance. The thought next is that I am not calling ReadLinksIntoMemory in time, below is my code: private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; ReadLinksIntoMemory(); GoToEditLinks(); button1.Enabled = true; } Unless I'm mistaken the code says that the ReadLinksIntoMemory method must complete before GoToEditLinks can be called? If ReadLinksIntoMemory didn't finish in time I shouldn't be able to fill my text boxes with the lines array length and/or last entry. UPDATE: Stepping into the method GoToEditLinks() I see that lines is null before it calls: myIE.GoTo(lines[i]); but when it hits the goto command the value changes from null to the url it is suppose to go to, but at that same time it gives me the null object error? UPDATE: I added a IsNullOrEmpty check method and lines array passes it without any issue. I'm beginning to think it is an issue with WatIn and the myIE.GoTo command. I think this is the stack trace/call stack? Program.exe!Program.Form1.GoToEditLinks() Line 284 C# Program.exe!Program.Form1.button1_Click(object sender, System.EventArgs e) Line 191 + 0x8 bytes C# [External Code] Program.exe!Program.Program.Main() Line 18 + 0x1d bytes C# [External Code]

    Read the article

  • Easy Way for Non-Nerd to Manage Simple Site?

    - by Mark Evans
    Hi I'm not sure if this is an appropriate question for StackOverflow. I have a friend show wants a simple "Brochure Ware" web site. I could make it for him but it would be better if he could manage it himself. Are there any services out there that allow a non-technical person to create and maintain a very simple site? I'm thinking just a few pages - contact, about, home with some photos and general info. He also wants to sell some stuff but I'm going to suggest he does this using EBay but the web site would be a handy reference for potential customers who want to know more about him and his services. Thanks a lot! Cheers Mark

    Read the article

  • MVC : Checkboxes generated using JavaScript not appearing in FormCollection on postback

    - by Andy Evans
    I took over another project (written by one contractor, modified by another and now it's not working) written using MVC/C# where a view that has a table (see below) is dynamically populated using JSON/Javascript - the first column of which is a checkbox. View (spark view engine) <table id='component_list' name='component_list' cellpadding='0' border='0' cellspacing='0'> <thead> <tr> <th>&nbsp;</th> <th>Component</th> <th>Component Type</th> <th>Evenflo Part #</th> <th>Supplier Part #</th> <th>Supplier</th> <th>Requirement</th> <th>Location</th> <th>Region</th> </tr> </thead> <tbody> </tbody> </table> When the page is rendered, I look at the source for the page and do not see the table data (I wouldn't expect to see this). However, when the form is posted back, controller, the FormCollection is empty. Supposedly this had been working before the last contractor got their hands on it - which is another post all together. My goal right now is having the checkboxes in the FormCollection. Any suggestions would be greatly appreciated. Thanks,

    Read the article

  • JQuery object expected error when accessing page via url routing.

    - by Andy Evans
    In my global.asax I have url routing setup like below: routes.MapPageRoute("User Logon", "{Vendor}/Logon", "~/Logon.aspx"); In the logon.aspx page, I have a script that "stylizes" the logon button: <link href="jquery/css/flick/jquery-ui-1.8.1.custom.css" rel="stylesheet" type="text/css" /> <link href="images/style.css" rel="stylesheet" type="text/css" /> <script src="jquery/js/jquery-1.4.2.min.js" type="text/javascript"></script> <script src="jquery/js/jquery-ui-1.8.1.custom.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $('#<%= ButtonLogon.ClientID %>').button(); }); </script> When I access the page us a url (in debug mode) http://localhost/logon.aspx?v=1 the page loads correctly and the jquery button command loads correctly. But then I access the page using the new url route, I get this error. Microsoft JScript runtime error: Object expected Anyone have an idea why this occurs? Thanks.

    Read the article

  • Help with jQuery Ajax calling ASMX which returns string.

    - by Jason Evans
    Hi there. I have the following jQuery ajax call setup: function Testing() { var result = ''; $.ajax({ url: 'BookingUtils.asmx/GetNonBookableSlots', dataType: 'text', error: function(error) { alert('GetNonBookableSlots Error'); }, success: function(data) { alert('GetNonBookableSlots'); result = data; } }); return result; } Here is the web service I'm trying to call: [WebMethod] public string GetNonBookableSlots() { return "fhsdfuhsiufhsd"; } When I run the jQuery code, there is no error or success event fired (none of the alerts are called). In fact, nothing happens at all, the javascript code just moves on to return statement at the end. I put a breakpoint in the web service code and it does get hit, but when I leave that method I end up on the return statement anyway. Can someone give me some tips on how I should be configuring the ajax call correctly, as I feel that I'm doing this wrong. The webservice just needs to return a string, no XML or JSON involved. Cheers. Jas.

    Read the article

  • Jquery / PHP - pre-loading next page before navigating to it.

    - by Tim
    Hey all Using jQuery, is there a way to prevent going to the next page until the animation has finished AND the next page has completely loaded (including images)? The code below works but it is a bit clunky. You can see what I am trying to achieve here: http://bit.ly/aOeYgE The first three or so pages work. But when you click to go to the homepage a few times (after it's cached) you will see that it jumps, and the animation isn't very smooth. As you can see with the code below, the height is immediately set to 0, then when the page has loaded the height is set to 500px. When users navigate to a new page, the height should go back to 0, the next page content should load, and then upon loading the new window, the first bit of code will run again to set the width back to 500px. $(".content-center").css({"height": "0px"}); $(window).load(function() { if($('.content-center').is(':not(:animated)')) { $('.content-center').animate({height: "500px"}, 450); } }); $("a").click(function(event){ $(".content-center").animate({height: "0px"}, 500); if($('.content-center').is(':not(:animated)')) { navigate($(this).attr('href')); event.preventDefault(); } }); If anyone has any suggestions or alternative ideas to this code then it would be hugely appreciated. Many thanks Tim

    Read the article

  • Do Qt Applications require KDE?

    - by Evans
    Do all Qt applications require KDE to be installed? Is it enough if the Qt runtime is installed along with GNOME? Can I make a Qt application look exactly like a GTK application under GNOME? Could anyone please point me to some article detailing the relationship between Qt, GTK, KDE, GNOME, X?

    Read the article

  • JAXB Web Services: Multiple Object Marshalling

    - by Luke Evans
    I can marshal and unmarshal 1 object with no problems (in netbeans); I need to know how to do this with multiple objects? I can't generate anything but null pointer exceptions when trying to unmarshal 3 objects into an array from XML; so I don't even know if I've marshalled the 3 out correctly. I know the basic idea of declaring the object, then using the jaxbu or jaxbm command, but I'd like to see this working for more than one object. **TLDR: How do I marshal/unmarshal multiple objects of a single class into/out of XML?? THANKS Code I have that marshals one object from XML: try { JAXBContext jc = JAXBContext.newInstance ("myOffers"); Unmarshaller u = jc.createUnmarshaller (); myOffers.Offer flight = (myOffers.Offer) u.unmarshal( new FileInputStream( "offers.xml" )); System.out.println ("Airline is : " + flight.getAirline()); System.out.println ("Origin is : " + flight.getOrigin()); System.out.println ("Destination is : " + flight.getDestination()); System.out.println ("Seats available : " + flight.getSeats()); System.out.println("Proximity to City Centre is : " + flight.getProximity()); System.out.println("Currency : " + flight.fare.getCurrency()); System.out.println("Value : " + flight.fare.getValue()); } catch (JAXBException e) { System.out.println("Error " + e);} ok so the Xml is: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:offer xmlns:ns2="http://simple.example.com/CInfoXmlDoc"> <Origin>Nottingham</Origin> <Destination>Istanbul</Destination> <Airline>Lufthansa</Airline> <Proximity>10</Proximity> <Seats>260</Seats> <Fare> <Currency>GBP</Currency> <Value>300</Value> </Fare> </ns2:offer> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:offer xmlns:ns2="http://simple.example.com/CInfoXmlDoc"> <Origin>Birmingham</Origin> <Destination>Cairo</Destination> <Airline>Monarch</Airline> <Proximity>15</Proximity> <Seats>350</Seats> <Fare> <Currency>GBP</Currency> <Value>300</Value> </Fare> </ns2:offer> public static void main(String[] args) throws FileNotFoundException { int i = 0; int arraySize = 2; myOffers.Offer offer[] = new myOffers.Offer[arraySize]; offer[i] = new myOffers.Offer(); offer[i].fare = new myOffers.Offer.Fare(); offer[i].setAirline("Lufthansa"); offer[i].setOrigin("Nottingham"); offer[i].setDestination("Istanbul"); offer[i].setSeats(260); offer[i].setProximity(10); offer[i].fare.currency = "GBP"; offer[i].fare.value = 300; i++; offer[i] = new myOffers.Offer(); offer[i].fare = new myOffers.Offer.Fare(); offer[i].setAirline("Monarch"); offer[i].setOrigin("Birmingham"); offer[i].setDestination("Cairo"); offer[i].setSeats(350); offer[i].setProximity(15); offer[i].fare.currency = "GBP"; offer[i].fare.value = 300; try { int n = 0; FileOutputStream f = new FileOutputStream("offers.xml"); javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance(offer[n].getClass().getPackage().getName()); javax.xml.bind.Marshaller marshaller = jaxbCtx.createMarshaller(); marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_ENCODING, "UTF-8"); //NOI18N marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); while (n < arraySize) { marshaller.marshal(offer[n], f); n++; } } catch (javax.xml.bind.JAXBException ex) { // XXXTODO Handle exception java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, null, ex); //NOI18N } } Which was generated by my marshal code found here: public static void main(String[] args) throws FileNotFoundException { int i = 0; int arraySize = 2; myOffers.Offer offer[] = new myOffers.Offer[arraySize]; offer[i] = new myOffers.Offer(); offer[i].fare = new myOffers.Offer.Fare(); offer[i].setAirline("Lufthansa"); offer[i].setOrigin("Nottingham"); offer[i].setDestination("Istanbul"); offer[i].setSeats(260); offer[i].setProximity(10); offer[i].fare.currency = "GBP"; offer[i].fare.value = 300; i++; offer[i] = new myOffers.Offer(); offer[i].fare = new myOffers.Offer.Fare(); offer[i].setAirline("Monarch"); offer[i].setOrigin("Birmingham"); offer[i].setDestination("Cairo"); offer[i].setSeats(350); offer[i].setProximity(15); offer[i].fare.currency = "GBP"; offer[i].fare.value = 300; try { int n = 0; FileOutputStream f = new FileOutputStream("offers.xml"); javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance(offer[n].getClass().getPackage().getName()); javax.xml.bind.Marshaller marshaller = jaxbCtx.createMarshaller(); marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_ENCODING, "UTF-8"); //NOI18N marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); while (n < arraySize) { marshaller.marshal(offer[n], f); n++; } } catch (javax.xml.bind.JAXBException ex) { // XXXTODO Handle exception java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE, null, ex); //NOI18N } } Apologies, I'm fining this editor quite appalling but thats another matter. Whats wrong with [code][/code] tags...

    Read the article

  • Windows batch - loop over folder string and parse out last folder name

    - by Tim Peel
    Hi, I need to grab the folder name of a currently executing batch file. I have been trying to loop over the current directory using the following syntax (which is wrong at present): set mydir = %~p0 for /F "delims=\" %i IN (%mydir%) DO @echo %i Couple of issues in that I cannot seem to pass the 'mydir' variable value in as the search string. It only seems to work if I pass in commands; I have the syntax wrong and cannot work out why. My thinking was to loop over the folder string with a '\' delimiter but this is causing problems too. If I set a variable on each loop then the last value set will be the current folder name. For example, given the following path: C:\Folder1\Folder2\Folder3\Archive.bat I would expect to parse out the value 'Folder3'. I need to parse that value out as its name will be part of another folder I am going to create further down in the batch file. Many thanks if anyone can help. I may be barking up the wrong tree completely so any other approaches would be greatly received also. Tim

    Read the article

  • How can I debug a PHP CLI script with xdebug?

    - by Laran Evans
    I haven't quite figured this out. EVERY piece of documentation I've found covers how to use xdebug to debug scripts running in Apache. I need to debug a php CLI script. So, for instance, how do I pass the XDEBUG_SESSION_START variable in to get xdebug to kick on? I'm specifically trying to debug a CakePHP shell. So if anyone has any additional insight into that I'd be very appreciative. Thanks.

    Read the article

  • Using DataTypeAttribute to validate a date

    - by Andy Evans
    I'm having some difficulty understanding how to validate a date (DOB) using MVC2. What I want to do is 1. Is the date entered a valid date and, 2. Is the date at lease 13 years in the past. For example, to validate an email I use the following code: [Required(ErrorMessage = "Email address is required.")] [StringLength(320, ErrorMessage = "Email must be less than 320 characters.")] [Email(ErrorMessage = "This email address is invalid.")] public string email { get; set; } To validate the email I use: public class EmailAttribute : RegularExpressionAttribute { public EmailAttribute() : base("insert long regex expression here") { } } Any assistance would be greatly appreciated, thanks!

    Read the article

  • SQL Server 2008 GUID column is all 0's

    - by Andy Evans
    I'm hoping this is a simple goof I did on my end ... I have a table in my database set up like so: column name: widget_guid data type: uniqueidentifier allow nulls: false default value: newid() identity: false row guid: true When records are created (via LINQ to SQL) that the values in this field are formatted as a GUID but contain all 0's My assumption was that when a new record was created, that a guid would be autogenerated for that column, much like an auto-incrementing row id. Is this not true? Any help would be greatly appreciated. Thanks.

    Read the article

  • How do I compile and build the taf2-curb Ruby gem on Windows XP with MinGW?

    - by Laran Evans
    How do I compile and build the taf2-curb Ruby gem on Windows XP with MinGW? I tried this, but I'm kinda fishing, unsuccessfully. C:\Documents and Settings\Megem install taf2-curb -- --with-curl-include=C:/curl-7.19.5-devel-mingw32/include --with-curl-dir=C:/curl-7.19.5 --with-curl-lib=C:/curl-7.19.5-devel-mingw32/lib --prefix=C:/MinGW --with-curllib Bulk updating Gem source index for: http://gems.rubyforge.org Updating metadata for 73 gems from http://gems.rubyonrails.org ......................................................................... complete Bulk updating Gem source index for: http://gems.github.com Building native extensions. This could take a while... ERROR: Error installing taf2-curb: ERROR: Failed to build gem native extension. C:/Ruby/bin/ruby.exe extconf.rb install taf2-curb -- --with-curl-include=C:/curl-7.19.5-devel-mingw32/include --with-cur l-dir=C:/curl-7.19.5 --with-curl-lib=C:/curl-7.19.5-devel-mingw32/lib --prefix=C:/MinGW --with-curllib checking for curl-config... no checking for main() in true.lib... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --srcdir=. --curdir --ruby=C:/Ruby/bin/ruby --with-curl-dir --with-curl-include=${curl-dir}/include --with-curl-lib=${curl-dir}/lib --with-curllib extconf.rb:9: Can't find libcurl or curl/curl.h (RuntimeError) Try passing --with-curl-dir or --with-curl-lib and --with-curl-include options to extconf. Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/taf2-curb-0.4.8.0 for inspection. Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/taf2-curb-0.4.8.0/ext/gem_make.out C:\Documents and Settings\Me I've installed curl-7.19.5 and curl-7.19.5-devel-mingw from this url: http://curl.haxx.se/download.html Help! And thanks!

    Read the article

  • Security / Protecting code in JavaScript

    - by Evans
    With all the recent hype about JavaScript and HTML5 replacing Flash, I wanted to know - How would it be possible to protect client-side js code? Of course, it is possible to obfuscate it, but that would only make it a little harder. Also, for games which submit high scores to the server, wouldn't it be incredibly easy to modify those scores before they are sent to the server? I know even Flash files can be decompiled, but they can be obfuscated and flash decompilation is not as easy as modifying data in JS - could be done easily using a plugin such as Firebug. I'd like to know everyone's views on this.

    Read the article

  • Unit testing code which uses Umbraco v4 API

    - by Jason Evans
    I'm trying to write a suite of integration tests, where I have custom code which uses the Umbraco API. The Umbraco database lives in a SQL Server CE 4.0 database (*.sdf file) and I've managed to get that association working fine. My problem looks to be dependancies in the Umbraco code. For example, I would like to create a new user for my tests, so I try: var user = User.MakeNew("developer", "developer", "mypassword", "[email protected]", adminUserType); Now as you can see, I have pass a user type which is an object. I've tried two separate ways to create the user type, both of which fail due to a null object exception: var adminUserType = UserType.GetUserType(1); var adminUserType2 = new UserType(1); The problem is that in each case the UserType code calls it's Cache method which uses the HttpRuntime class, which naturally is null. My question is this: Can someone suggest a way of writing integration tests against Umbraco code? Will I have to end up using a mocking framework such as TypeMock or JustMock?

    Read the article

  • Expose C++ object to Javascript in Qt

    - by Evans
    Is there any way I can expose a C++ object/function to JavaScript running inside the QtWebKit browser in Qt? It's possible to expose ActionScript objects to JS code running inside the WebKit browser in Adobe AIR - I'm looking for similar functionality in Qt.

    Read the article

  • How To Update EF 4 Entity In ASP.NET MVC 3?

    - by Jason Evans
    Hi there. I have 2 projects - a class library containing an EDM Entity Framework model and a seperate ASP.NET MVC project. I'm having problems with how your suppose to edit and save changes to an entity using MVC. In my controller I have: public class UserController : Controller { public ActionResult Edit(int id) { var rep = new UserRepository(); var user = rep.GetById(id); return View(user); } [HttpPost] public ActionResult Edit(User user) { var rep = new UserRepository(); rep.Update(user); return View(user); } } My UserRepository has an Update method like this: public void Update(User user) { using (var context = new PDS_FMPEntities()) { context.Users.Attach(testUser); context.ObjectStateManager.ChangeObjectState(testUser, EntityState.Modified); context.SaveChanges(); } } Now, when I click 'Save' on the edit user page, the parameter user only contains two values populated: Id, and FirstName. I take it that is due to the fact that I'm only displaying those two properties in the view. My question is this, if I'm updating the user's firstname, and then want to save it, what am I suppose to do about the other User properties which were not shown on the view, since they now contain 0 or NULL values in the user object? I've been reading a lot about using stub entities, but I'm getting nowhere fast, in that none of the examples I've seen actually work. i.e. I keep getting EntityKey related exceptions. Can someone point me to a good tutorial/example of how to update EF 4 entities using a repository class, called by an MVC front-end? Cheers. Jas.

    Read the article

  • Dynamic evaluation of a table column within an insert before trigger

    - by Tim Garver
    HI All, I have 3 tables, main, types and linked. main has an id column and 32 type columns. types has id, type linked has id, main_id, type_id I want to create an insert before trigger on the main table. It needs to compare its 32 type columns to the values in the types table if the main table column has an 'X' for its value and insert the main_id and types_id into the linked table. i have done a lot of searching, and it looks like a prepared statement would be the way to go, but i wanted to ask the experts. The issue, is i dont want to write 32 IF statements, and even if i did, i need to query the types table to get the ID for that type, seems like a huge waist of resources. Ideally i want to do this inside of my trigger: BEGIN DECLARE @types results_set -- (not sure if this is a valid type); -- (iam sure my loop syntax is all wrong here)... SET @types = (select * from types) for i=0;i<types.records;i++ { IF NEW.[i.type] = 'X' THEN insert into linked (main_id,type_id) values (new.ID, i.id); END IF; } END; Anyway, This is what i was hoping to do, maybe there is a way to dynamically set the field name inside of a results loop, but i cant find a good example of this. Thanks in advance Tim

    Read the article

  • Using both RolesAllowed and Transactional in beans

    - by Laran Evans
    I have some beans which contain methods which are annotated with both @RolesAllowed and @Transactional. I have one Spring config file which utilizes a BeanNameAutoProxyCreator for Security related beans and another Spring config file which utilizes a BeanNameAutoProxyCreator for Transactional related beans. The problem is that some beans contain both security as well as transactional-related beans. So Spring creates proxies for one set of beans. It then tries to create proxies for the other set of beans. When it does, it tries to create proxies of the proxies and bombs out. Has anyone tried to configure both security and transactionality in the same beans via Spring? What's the trick? Thanks.

    Read the article

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