Search Results

Search found 354 results on 15 pages for 'cousin pete'.

Page 8/15 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • JQuery/JavaScript div tag "containment" approach/algorithm?

    - by Pete Alvin
    Background: I've created an online circuit design application where div tags are containers that contain smaller div containers and so forth. Question: For any particular div tag I need to quickly identify if it contains other div tags (that may in turn contain other div tags). I've searched JQuery and I don't see any built-in routine for this. Does anyone know of an algorithm that's quicker than O(n^2)? Seems like I have to walk the list of div tags in an outer loop (n) and have an inner loop (another n) to compare against all other div tags and do a "containment test" (position, width, height), building a list of contained div tags. That's n-squared. Then I have to build a list of all nested div tags by concatenating contained lists. So the total would be O(n^2)+n. There must be a better way?

    Read the article

  • Overwhelmed by design patterns... where to begin?

    - by Pete
    I am writing a simple prototype code to demonstrate & profile I/O schemes (HDF4, HDF5, HDF5 using parallel IO, NetCDF, etc.) for a physics code. Since focus is on IO, the rest of the program is very simple: class Grid { public: floatArray x,y,z; }; class MyModel { public: MyModel(const int &nip1, const int &njp1, const int &nkp1, const int &numProcs); Grid grid; map<string, floatArray> plasmaVariables; }; Where floatArray is a simple class that lets me define arbitrary dimensioned arrays and do mathematical operations on them (i.e. x+y is point-wise addition). Of course, I could use better encapsulation (write accessors/setters, etc.), but that's not the concept I'm struggling with. For the I/O routines, I am envisioning applying simple inheritance: Abstract I/O class defines read & write functions to fill in the "myModel" object HDF4 derived class HDF5 HDF5 using parallel IO NetCDF etc... The code should read data in any of these formats, then write out to any of these formats. In the past, I would add an AbstractIO member to myModel and create/destroy this object depending on which I/O scheme I want. In this way, I could do something like: myModelObj.ioObj->read('input.hdf') myModelObj.ioObj->write('output.hdf') I have a bit of OOP experience but very little on the Design Patterns front, so I recently acquired the Gang of Four book "Design Patterns: Elements of Reusable Object-Oriented Software". OOP designers: Which pattern(s) would you recommend I use to integrate I/O with the myModel object? I am interested in answering this for two reasons: To learn more about design patterns in general Apply what I learn to help refactor an large old crufty/legacy physics code to be more human-readable & extensible. I am leaning towards applying the Decerator pattern to myModel, so I can attach the I/O responsibilities dynamically to myModel (i.e. whether to use HDF4, HDF5, etc.). However, I don't feel very confident that this is the best pattern to apply. Reading the Gang of Four book cover-to-cover before I start coding feels like a good way to develop an unhealthy caffeine addiction. What patterns do you recommend?

    Read the article

  • Why Is my json-object from AJAX not understood by javascript, even with 'json' dataType?

    - by pete
    My js code simply gets a json object from my server, but I think it should be automatically parsed and turned into an object with properties, yet it's not allowing access properly. $.ajax({ type: 'POST', url: '/misc/json-sample.js', data: {href: path}, // THIS IS THE POST DATA THAT IS PASSED IN TO THE DRUPAL MENU CALL TO GET THE MENU... dataType: 'json', success: function (datax) { if (datax.debug) { alert('Debug data: ' + datax.debug); } else { alert('No debug data: ' + datax.toSource() ) ; } The /misc/json-sample.js file is: [ { "path": "examplemodule/parent1/child1/grandchild1", "title": "First grandchild option", "children": false } ] (I have also been trying to return that object from drupal as follows, and the same results.) Drupal version of misc/json-sample.js: $items[] = array( 'path' = 'examplemodule/parent1/child1/grandchild1', 'title' = t('First grandchild option'), 'debug' = t('debug me!'), 'children' = FALSE ); print drupal_to_js($items); What happens (in FF, which has the toSource() capability) is the alert with 'No debug data: [ { "path": "examplemodule/parent1/child1/grandchild1", "title": "First grandchild option", "children": false } ] Thanks

    Read the article

  • Does anyone have a backup strategy for SQL Azure databases?

    - by Pete
    I'm using SQL Azure on a project and it works great. The problem is that the usual backup features do not exist. I have exported the database a couple of times using SQLAzureMW ( http://sqlazuremw.codeplex.com/ ) but this tool is now choking trying to download the database data with bcp. In any case, it's not as nice a solution as SQL Server backups. Is anyone aware of a commercial or open source tool, or other technique, for making reliable backups of SQL Azure databases? This is really a showstopper.

    Read the article

  • HTML5: dragover(), drop(): how get current x,y coordinates?

    - by Pete Alvin
    How does one determine the (x,y) coordinates while dragging "dragover" and after the drop ("drop") in HTML5 DnD? I found a webpage that describes x,y for dragover (look at e.offsetX and e.layerX to see if set for various browsers but for the life of me they ARE NOT set). What do you use for the drop(e) function to find out WHERE in the current drop target it was actually dropped? I'm writing an online circuit design app and my drop target is large. Do I need to drop down to mouse-level to find out x,y or does HTML5 provided a higher level abstraction?

    Read the article

  • Load an Assembly from Bin in ASP.NET

    - by Pete Michaud
    I have a file name, like "Foo.dll," for a library that I know is in the bin directory. I want to create an Assembly object for it. I'm trying to instantiate this object from a class that's not a page, so I don't have the Request object to get the path. How do I get the path I need to use Assembly.Load()?

    Read the article

  • Jquery: Extracting the hrefs from multiple links on a page.

    - by Pete B
    Hi, I discovered that .attr() only applies to the first matched element on the page! So, I've been trying to get the hrefs from all the matched elements on a page, but to no avail. Here's what I tentatively wrote: var thelinks = $("td a").each(function(){ $(this).attr("href"); document.write(thelinks); }); I used document.write just to see what was going on, and I got a long list of "undefinedundefinedundefined" What I'm trying to do is extract the hrefs from each td a and then use ajax to visit those pages and do other stuff. I can get it work fine when it's dealing with just one link, but this multiple elements thing I can't figure out. Any help rendered is appreciated, I'm a novice to the world of Javascript and Jquery.

    Read the article

  • Sequential numbering from recursive function? e.g. 2, 2.1, 2.1.1, 2.2, 2.2.1

    - by Pete
    I have a recursive function reading a "table of contents" of documents from a database. I would like to print numbering with the document that reflects where the item is in the tree, e.g. First item, 1.1 Child of first item, 1.1.1 Child of child of first item, 1.2 Child of first item, Second item, 2.1 Child of second item, etc. Rather stumped about this at the moment - help please?

    Read the article

  • Code in Global.asax prevents webpage from loading

    - by pete the pagan-gerbil
    I've made a static class to hold a number of configuration values (and also swap these values out in unit tests). If I initialise it in the Global.asax, the code runs correctly but the page doesn't load at all, and trying to navigate to a specific page fails. I can't initialise the values in a constructor or inline on the field declarations, because I need to be able to swap the values out in unit tests before the web.config is interrogated. Basically, putting the one line "ConfigClass.SetValues()" in the Global.asax prevents the app from loading correctly (although, as I say, it runs the code fine) and removing it again makes the app load properly - but without the class values initialised. As an aside, I'm sure I had this working correctly and being initialised in the Global.asax yesterday. I'm positive I didn't take any action to change or break it... Does anyone have advice on how I might track down what's going on here? Was I mistaken that it worked before (always possible) and that I need to go back and redesign something?

    Read the article

  • Noob Droid Question regarding random number

    - by Pete Herbert Penito
    Brand new to droid programming, but would love to learn as much as possible, so I finally got my emulator working correctly, I even got a hello world button to work, I'm attempting to make this button display a random number, I've googled this and came up with this code: Random generator = new Random(); int n = generator.nextInt(n); I fixed the Random function by including some Random java utility. I'm assuming this code above goes in the .java file of the project, so my button code looks as follows (tested and works): PopUpText.makeText(v.getContext(), "Hello World", PopUpText.LENGTH_LONG).show(); I figured I could replace "Hello World" with n to display the number in the box, however the following error is stopping the compile: The local variable n may not have been initialized Any ideas why this is happening? Any advice would be hugely appreciated.

    Read the article

  • Need a fast programming language that can drive two printers

    - by Pete
    I have a rather unusual application that isn't working the way I need, and I hope someone here will have some suggestions or at least a direction to investigate. We have a museum exhibit that has a computer at the entrance driving two small receipt printers. There are two buttons on a console, wired to the left and right buttons of a disemboweled mouse. The two printers and associated buttons are for girls and boys, each button does a random selection from a database of names and prints a small ticket on the appropriate printer with a graphic image, a few words about the exhibit and the randomly chosen name. Conceptually all is well, but it hangs quite often. I got the project at the last minute, because the original designer got bogged down and couldn't deliver, so the exhibit's author asked me the day before opening, whether I could write something that would work. I did it in Word, since I am an experienced VBA programmer. Several other avenues I attempted first all lead to dead ends - one couldn't do graphics, another couldn't handle two printers, yet another couldn't change fonts and so on. The problem is that it simply isn't fast enough - Word can only drive one printer at a time and changing the active printer takes a long time. Not by office standards, where a second or two of delay before a printer starts working on your document is not an issue, but here I need more or less instant response. If kids press a button and nothing happens, they press it over and over until something does happen, resulting in maybe half a dozen commands being sent before the printer starts reacting. Sometimes it jams the program completely, since boys and girls will be pressing the two buttons simultaneously and Word locks up, and even when it doesn't jam, the printers then spit out a stream of tickets, making a mess. The kids start squabbling over which ticket is whose, pulling them out of the printers, snarling the paper tape, jamming the printer and generally making a mess of the whole affair, often necessitating the exhibit caretakers having to restart the computer and clear torn bits of paper out the printers. What I need is some sort of fast programming language that can drive two printers *-simultaneously-*, not the MSOffice claptrap of having to switch the active printer, that can react to both left and right mouse button click events, can print a small graphic image and can print in different font sizes and styles and. I don't need many, but it's not all in one typeface. Can anyone suggest what I might use for this? I don't even know if it's possible at all under Windows, whether the "single active printer" garbage is an Office artifact, or a Windows restriction. My little Commodore-64 twenty-five years ago had two printers attached to it and drove both simultaneously with no difficulties - it doesn't seem to me it should be such an impossible requirement today.

    Read the article

  • Help with an RSS Feed

    - by Pete Herbert Penito
    Hi Everyone! I've spent ages on this, all I'm trying to do is extract the "title" contents from an rss feed, everything else can be ignored. I've looked into simplepie, magpie and all that stuff, but I feel its kind of overkill for what I need to do. I realise there are google gadgets that are made that can do this, but I didn't want all the google logo stuff, and I wanted to personally make this. theres a whole bunch of unneeded tags thats coming in from the rss feed all I need is the title tag, it looks like this <title> My Title 3.0 </title> My server has PHP 5+ so I know I can use some of these simple xml functions which look promising. so far I've got <?php $blogfeed = file_get_contents("http://myblog.blogspot.com/feeds/posts/default?alt=rss"); echo $blogfeed; ?> And it gives me all the data, I was thinking of running through it with strpos and searching for <title> but is there any easier way to do this?? Thanks alot!

    Read the article

  • PHP form post, automatically mapping to an object (model binding)

    - by Pete Nelson
    I do a lot of ASP.NET MVC 2 development, but I'm tackling a small project at work and it needs to be done in PHP. Is there anything built-in to PHP to do model binding, mapping form post fields to a class? Some of my PHP code currently looks like this: class EntryForm { public $FirstName = ""; public $LastName = ""; } $EntryForm = new EntryForm(); if ($_POST && $_POST["Submit"] == "Submit") { $EntryForm->FirstName = trim($_POST["FirstName"]); $EntryForm->LastName = trim($_POST["LastName"]); } Is there anything built-in to a typical PHP install that would do such mapping like you'd find in ASP.NET MVC, or does it require an additional framework?

    Read the article

  • Using Session Variables inside an ajax document

    - by Pete Herbert Penito
    Hi, For some reason I've having problems reading this session variable within an ajax document, I've got this inside online.php: ` session_start(); if (isset($_SESSION['username'])) { $username = $_SESSION['username']; } ` For some Reason this is not setting username even when the session var is being used on the host page, i call on the php file every second using this ` $(document).ready(function() { var refreshId = setInterval(function() { $('#timeval').load('online.php'); }, 1000); $("#stop").click(function() { clearInterval(refreshId); }); }); ` Am I doing something wrong, or is this not even possible?? Any advice would really help thanks alot!

    Read the article

  • Alter a single attribute with XSLT

    - by Pete Montgomery
    Hello! <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilation debug="true" defaultLanguage="C#"> <!-- this is a comment --> </compilation> </system.web> </configuration> What's the simplest XSLT you can think of to transform the value of the first, in this case only, /configuration/system.web/compilation/@debug attribute from true to false?

    Read the article

  • MySql - only update some rows if the table exists - do not want an error thrown

    - by Pete Oakey
    I want to run an update query. The query will be run against multiple databases - not every database will have the table. I don't want the update to be attempted if the table does not exist. I don't want any error to be thrown - I just want the update to be ignored. Any ideas? EDIT: just to be clear - the query is executed in an automated deployment - no human interaction possible. EDIT2: the logic to say whether the update should run or not will need to be in the MySql query itself. This is not being run through a command prompt or batch or managed code.

    Read the article

  • Plastic SCM vs. Mercurial? Need Source Control for Visual Studio 2005 on Windows 7

    - by Pete Alvin
    1) Has anyone used Plastic SCM? Is it reliable? 2) How does it compare with Mercurial? (It seems like this is a good candidate for DVCS on Windows. I tried Git and really didn't like it.) 3) I really like TortoiseSVN. I like a central model because of the piece of mind that if it's in the respository it's "safe" and tracked. Here is the question: Is the excitement over distributed version control (DVCS) worth the hype? My environment: Windows 7 Windows development (Dev. Studio 2005, SQL Server 2003); integration would be nice Two developers sharing same code push code to production servers almost daily

    Read the article

  • Refreshing page after posted vars

    - by Pete Herbert Penito
    So a form is submitted on my site, with form action equal to itself. I want the user to be able to refresh the page without sending the same variables again. I thought unset($_POST); would accomplish this for some reason it doesn't is there another way to accomplish this?

    Read the article

  • Love coding but offered a server/network job -- any advice?

    - by Pete
    I really enjoy software development. I've done it for going on 3 years now full-time for a small company and still find it interesting and exciting. I haven't had much server/network experience but have an opportunity to work for a large IT company dealing with server setups, configurations, maintenance and some networking work as well. The thing is, I'm not sure whether to accept. If I were to take this, it would have relatively little if any coding and I'm guessing would start me down a career path away from coding. The only thing is the company is large enough and has a coding division so I guess in a few years I could transition back to the software side of things if I wanted, but I'm just not sure whether I would enjoy the server/network side of things. Any advice is greatly appreciated. Especially if you have had a similar situation occur. Thanks!

    Read the article

  • Javascript changing source of an image

    - by Pete Herbert Penito
    Hi Everyone! I have some javascript which runs a timer that animates something on the website. It all works perfectly but I want to get an image to change when the animation is run, It uses jquery: if(options.auto && dir=="next" && !clicked) { timeout = setTimeout(function(){ if (document.images['bullet1'].src == "img/bulletwhite.png") { document.images['bullet1'].src = "img/bullet.png"; document.images['bullet2'].src = "img/bulletwhite.png"; } animate("next",false); },diff*options.speed+options.pause); } options.auto means that its automatically cycling, dir is the direction of the motion and clicked is whether or not the user clicked it. Is there something wrong with my syntax here? I ran firebug with it, and it doesn't throw any errors, it simply won't work. Any advice would help! I should mention that the src of bullet1 starts at bulletwhite.png and then I was hoping for it to change to bullet.png and have bullet2 change to bulletwhite.png.

    Read the article

  • How to implement message queuing and handling in AWS with NServiceBus

    - by Pete Lunenfeld
    I am creating a new ASP MVC order application in the Amazon (AWS) cloud with the persistence layer at my local datacenter. I will be using the CQRS pattern. The goal of the project is high availability using Queue(s) to store and forward writes (commands/events) that can be picked up and handled asynchronously at my local datacenter. Then, ff the WAN or my local datacenter fails, my cloud MVC app can still take orders and just queue them up until processing can resume. My first thought was to use AWS SQS for the queuing and create my own queue consumer/dispatcher/handler in my own c# application to process the incoming messages/events. MVC (@ Amazon) -- Event/POCO -- SQS -- QueueReader (@ my datacenter) -- DB Then I found NServiceBus. NSB seems to handle lots of details very nicely: message handling, retries, error handling, etc. I hate to reinvent the wheel, and NServiceBus seems like a full featured and mature product that would be perfect for me. But on further research, it does NOT look like NServiceBus is really meant to be used over the WAN in physically separated environments (Cloud to my Datacenter). Google and SO don't really paint a good picture of using NServiceBus across the WAN like I need. How can I use NServiceBus across the WAN? Or is there a better solution to handle queuing and message handling between Amazon an my local datacenter?

    Read the article

  • Implode error for PHP

    - by Pete Herbert Penito
    Hi Everyone! I have a form where I've got three checkboxes like this: <td>Wireless <input type="checkbox" name="services[]" value="wireless" /></td> </tr> <tr> <td>Cellular <input type="checkbox" name="services[]" value="cellular" /></td> </tr> <tr> <td>Security <input type="checkbox" name="services[]" value="Security" /></td> <input type="submit" name="submit"> and then I extract($_POST), and have this code $comServices = implode(",", $services); but I get an error: Warning: implode() [function.implode]: Invalid arguments passed in .. does anyone know why Im getting this error?

    Read the article

  • Javascript Illegal Token Error

    - by Pete Herbert Penito
    Forgive me if this is a simple problem but I can't seem to find why this code: function create_content(c) { var html = "<div id='header'>"+c+"</div>"; if(c == "links") { var ul = "<ul><li><a href='http://www.mylink.com'>My Link 1</a></li> <li><a href='http://www.mylink2.co.uk'>My Link 2</a></li></ul>"; html = html + ul; } return(html); } Is giving me this error in Chrome (win): Uncaught SyntaxError: Unexpected token ILLEGAL On the line that starts with "var ul = " Any advice would help thanks!

    Read the article

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