Search Results

Search found 2013 results on 81 pages for 'matt lewis'.

Page 67/81 | < Previous Page | 63 64 65 66 67 68 69 70 71 72 73 74  | Next Page >

  • When designing an event, is it a good idea to prevent listeners from being added twice?

    - by Matt
    I am creating an event-based API where a user can subscribe to an event by adding listener objects (as is common in Java or C#). When the event is raised, all subscribed listeners are invoked with the event information. I initially decided to prevent adding an event listener more than once. If a listener is added that already exists in the listener collection, it is not added again. However, after thinking about it some more, it doesn't seem that most event-based structures actually prevent this. Was my initial instinct wrong? I'm not sure which way to go here. I guess I thought that preventing addition of an existing listener would help to avoid a common programming error. Then again, it could also hide a bug that would lead to code being run multiple times when it shouldn't.

    Read the article

  • Code corresponding to leaks with Visual Leak Detector

    - by matt
    I am trying to use Visual Leak Detector in Visual Studio 2008, here is an example of the output I get: Detected memory leaks! Dumping objects -> {204} normal block at 0x036C1568, 1920 bytes long. Data: < > 80 08 AB 03 00 01 AB 03 80 F9 AA 03 00 F2 AA 03 {203} normal block at 0x0372CC68, 40 bytes long. Data: <( > 28 00 00 00 80 02 00 00 E0 01 00 00 01 00 18 00 {202} normal block at 0x0372CC00, 44 bytes long. Data: << E > 3C 16 45 00 80 02 00 00 E0 01 00 00 01 00 00 00 The user's guide says to click on any line to jump to the corresponding file/line of code ; I tried clicking on every line but nothing happens! What am I missing?

    Read the article

  • SQL where clasue to work with Group by clasue after performing a count()

    - by Matt
    Tried my usual references at w3schools and google. No luck I'm trying to produce the following results. QTY is a derived column | Position | QTY -------------------- 1 Clerk 2 2 Mgr 2 Here's what I'm not having luck with: SELECT Position, Count(position) AS 'QTY' FROM tblemployee Where ('QTY' != 1) GROUP BY Position I know that my Position is set up as varchar(255) Count produces a integer data and my where clasue is accurate so that leads me to believe that that Count() is jamming me up. Please throw up an example so I can reference later. Thanks for the help!

    Read the article

  • Combining entries, filtering of Python dictionaries

    - by matt
    I have two large lists that are filled with dictionaries. I need to combine the entries if a value from dict2==dict1 and place the newly combined matches somewhere else. I'm having trouble explaining it. List one contains: {'keyword':value, 'keyword2':value2} List two: {'keyword2':value2, 'keyword3':value3} I want a new list with dictionaries including keyword1, keyword2, and keyword3 if both lists share the same 'keyword2' value. What's the best way to do this? When I try, I only come up with tons of nested for loops. Thanks

    Read the article

  • Worried about spiders repeatedly hitting high-demand page

    - by Matt Thrower
    Due to some rather bizarre architectural considerations I've had to set up something that really ought to run as a console application as a web page. It does the job of writing a large variety of text files and xml feeds from our site data for various other services to pick up so obviously it takes a little while to run and is pretty processor intensive. However, before I deploy it I'm rather worried that it might get hit repeatedly by spiders and the like. It's fine for the data to be re-written but continual hits on this page are going to trigger performance issues for obvious reasons. Is this something I ought to worry about? Or in reality is spider traffic unlikely to be intensive enough to cause problems?

    Read the article

  • Why is my content being overwritten instead of replaced in jQuery/Ajax?

    - by Matt Nathanson
    I've got jquery being used in ajax to pass some contents into a database, my problem however has nothing to do with the db.. I have input fields in an id called #clientscontainer. When I click "save" in that container, it automatically refreshes the container correctly ... $('#clientscontainer').html(html); The problem is, a couple of those input fields (such as a description and title), have instances in another div that i want to refresh upon the save click. The other ID is: $('div#' + clientID') When I do $('div#' + clientID').html(html); it refreshes the content from clientscontainer in it instead of just the variables that I want to update. When I try to pass just the variable $(blurb).html(html); it updates the blurb but it ONLY displays that variable in the div# clientID div... whereas I just want to replace it. Here is the AJAX portion of the function ...//variables// dataToLoad = 'clientID=' + clientID + '&changeClient=yes' + '&project=' + descriptionSubTitle + '&campaign=' + descriptionTitle + '&label=' + descriptionLabel + '&descriptionedit=' + description + '&blurbedit=' + blurb; $.ajax({ type: 'post', url: ('/clients/controller.php'), datatype: 'html', data: dataToLoad, success: function(html){ dataToLoad = 'clientID=' + clientID + '&loadclient=yes&isCMS=' + editCMS; $.ajax({ type: 'post', url: '/clients/controller.php', datatype: 'html', data: dataToLoad, async: false, success: function(html){ //$('#clientscontainer').focus(function() {reInitialize()}); //$('#clientscontainer').ajaxComplete(function(){reInitialize()}); $('#clientscontainer').html(html); $('div#' + clientID).each(function(){ $('#editbutton').click(function() {EditEverything()}); } , error: function() { alert('An error occured! 222'); } });}, error: function() { alert('An error occured! 394'); } }); any suggestions?

    Read the article

  • Zend Framework Internet Explorer images won't display

    - by Matt
    I am using Zend Framework and it works fine in Firefox/Safari. In IE I have a problem with images not loading. Say I have an image in my public folder and I have this in my page: <img src="/photos/category/img.jpg" /> Well that works, except when I'm at a URL with a controller like http://www.example.com/controller/action I can see why, but I want a good solution to properly creating these img src links that works across browsers.

    Read the article

  • Append a parameter to a querystring with mod_rewrite

    - by Matt
    Hello, I would like to use mod_rewrite to append a parameter to the end of a querystring. I understand that I can do this using the [QSA] flag. However, I would like the parameter appended ONLY if it does not already exist in the querystring. So, if the querystring was: http://www.mysite.com/script.php?colour=red&size=large I would like the above URL to be re-directed to http://www.mysite.com/script.php?colour=red&size=large&weight=heavy Where weight=heavy is appended to the end of the querystring only if this specific parameter was not there in the first place! If the specific parameter is already in the URL then no redirect is required. Can anybody please suggest code to put in my .htacess file that can do this? Thanks.

    Read the article

  • Perl TCP Server handling multiple Client connections

    - by Matt
    I'll preface this by saying I have minimal experience with both Perl and Socket programming, so I appreciate any help I can get. I have a TCP Server which needs to handle multiple Client connections simultaneously and be able to receive data from any one of the Clients at any time and also be able to send data back to the Clients based on information it's received. For example, Client1 and Client2 connect to my Server. Client2 sends "Ready", the server interprets that and sends "Go" to Client1. The following is what I have written so far: my $sock = new IO::Socket::INET { LocalHost => $host, // defined earlier in code LocalPort => $port, // defined earlier in code Proto => 'tcp', Listen => SOMAXCONN, Reuse => 1, }; die "Could not create socket $!\n" unless $sock; while ( my ($new_sock,$c_addr) = $sock->accept() ) { my ($client_port, $c_ip) = sockaddr_in($c_addr); my $client_ipnum = inet_ntoa($c_ip); my $client_host = ""; my @threads; print "got a connection from $client_host", "[$client_ipnum]\n"; my $command; my $data; while ($data = <$new_sock>) { push @threads, async \&Execute, $data; } } sub Execute { my ($command) = @_; // if($command) = "test" { // send "go" to socket1 print "Executing command: $command\n"; system($command); } I know both of my while loops will be blocking and I need a way to implement my accept command as a thread, but I'm not sure the proper way of writing it.

    Read the article

  • Use of malloc() and free() in C++

    - by Matt H
    Is there any reason to use malloc and free in C++ over their more modern counterparts? Occasionally I see this, and I can't see why some people do it. Are there any advantages/disadvantage, or is there no real difference, except that it's just better to use C++ constructs in C++?

    Read the article

  • Fluent NHibernate - Set reference key columns to null

    - by Matt
    Hi, I have a table of Appointments and a table of AppointmentOutcomes. On my Appointments table I have an OutcomeID field which has a foreign key to AppointmentOutcomes. My Fluent NHibernate mappings look as follows; Table("Appointments"); Not.LazyLoad(); Id(c => c.ID).GeneratedBy.Assigned(); Map(c => c.Subject); Map(c => c.StartTime); References(c => c.Outcome, "OutcomeID"); Table("AppointmentOutcomes"); Not.LazyLoad(); Id(c => c.ID).GeneratedBy.Assigned(); Map(c => c.Description); Using NHibernate, if I delete an AppointmentOutcome an exception is thrown because the foreign key is invalid. What I would like to happen is that deleting an AppointmentOutcome would automatically set the OutcomeID of any Appointments that reference the AppointmentOutcome to NULL. Is this possible using Fluent NHibernate?

    Read the article

  • How do I perform a dynamic select in Linq?

    - by Matt Mangold
    I am trying to figure out how to dynamically specify the properties for my select clause in a linq query. Lets say I have a collection of employee objects. At run time, the end user will be specifying which properties they would like to see for those employees, so I need to be able to dynamically construct my Linq select clause. I have used the dynamic Linq library, but I prefer not to use that, because it requires me to build a string to pass to the select method. I'd like to understand how to do this via Expressions.

    Read the article

  • Browsers (IE and Firefox) freeze when copying large amount of text

    - by Matt
    I have a web application - a Java servlet - that delivers data to users in the form of a text printout in a browser (text marked up with HTML in order to display in the browser as we want it to). The text does display in different colors, though most of it is black. One typical mode of operation is this: 1. User submits a form to request data. 2. Servlet delivers HTML file to browser. 3. User does CTRL+A to select all the text. 4. User does CTRL+C to copy all the text. 5. User goes to a text editor and does CTRL+V to paste the text. In the testing where I'm having this problem, step #2 successfully loads all the data - we wait for that to complete. We can scroll down to the end of what the browser loaded and see the end of the data. However, the browser freezes on step #3 (Firefox) or on step #4 (IE). Because step #2 finishes, I think it is a browser/memory issue, and not an issue with the web application. If I run queries to deliver smaller amounts of data (but after several queries we get the same data we would have above in one query) and copy/paste this text, the file I save it into ends up being about 8 MB. If I save the browser's displayed HTML to a file on my computer via File-Save As from the browser menu, it works fine and the file is about 22 MB. We've tried this on 2 different computers at work (both running Windows XP, with at least 2 GB of RAM and many GB of free disk space), using Firefox and IE. We also tried it on a home computer from a home network outside of work (thinking it might be our IT security software causing the problem), running Windows 7 using IE, and still had the problem. When I've done this, I can see whatever browser I'm using utilizing the CPU at 50%. Firefox's memory usage grows to about 1 GB; IE's stays in the several hundred MBs. We once let this run for half an hour, and it did not complete. I'm most likely going to modify the web app to have an option of delivering a plain text file for download, and I imagine that will get the users what they need. But for the mean time, and because I'm curious - and I don't like my application freezing people's browsers, does anyone have any ideas about the browser freezing? I understand that sometimes you just reach your memory limit, but 22 MB sounds to me like an amount I should be able to copy to the clipboard.

    Read the article

  • Is a clear and replace more efficient than a loop checking all records?

    - by Matt
    I have a C# List, that is filled from a database.. So far its only 1400 records, but I expect it to grow a LOT.. Routinely I do a check for new data on the entire list.. What I'm trying to figure out is this, is it faster to simply clear the List and reload all the data from the table, or would checking each record be faster.. Intuition tells me that the dump and load method would be faster, but I thought I should check first...

    Read the article

  • How do you return draggable content to their original positions in iPhone dev?

    - by Matt Thomas
    I am wanting to create a button in my iPhone app that when touched will return other draggable elements to their original position. I have looked at the Apple "MoveMe' example, but that returns the button to the center of the screen. I want to be able to position draggable objects around the screen, drag the objects within the app, and then return them to their original starting positions by pressing a designated button. Any help appreciated!

    Read the article

  • CSS styles in Silverlight

    - by Matt
    I know styling is possible in SL, but I have a large web app that has both HTML and SL so it would be really useful if they could use the same style sheet... Is it possible? Thanks.

    Read the article

  • Performing an action on Parent/Child elements independently.

    - by Matt Weldon
    I have HTML similar to the following in my page <div id="someDiv"> <img src="foo.gif" class="someImg" /> </div> The wrapper div is set up such that when it is clicked, it's background-color changes using the following jQuery code. $("div").click(function(event){ $(this).css("background-color", "blue"); }); I also have some jQuery associated with my img that will do some other function (for the sake of argument I am going to display and alert box) like so: $("img[class=someImg]").click(function(event){ alert("Image clicked"); }); The issue I have come across is that when I click on the img, the event associated with the div is also triggered. I'm pretty sure that this is due to the way that jQuery (or indeed JavaScript) is handling the two DOM elements - clicking the img would require you to also technically click the div, thus triggering both events. Two questions then really: Is my understanding of the DOM/JavaScript flawed in some way or is this actually how things are occurring? Are there any jQuery methods that would allow me to perform actions on a child element without invoking those associated with its parent?

    Read the article

  • Interpreting item click in ListView

    - by Matt Huggins
    I'm working on my first Android project, and I created a menu via the XML method. My activity is pretty basic, in that it loads the main layout (containing a ListView with my String array of options). Here's the code inside my Activity: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // allow stuff to happen when a list item is clicked ListView ls = (ListView)findViewById(R.id.menu); ls.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // @todo } }); } Within the onItemClick callback handler, I'd like to check which item was clicked, and load a new menu based upon that. Question 1: How do I go about figuring out which item was clicked? I can't find any straightforward examples on retrieving/testing the id value of the clicked item. Question 2: Once I have the id value, I assume I can just call the setContentView method again to change to another layout containing my new menu. Is that correct?

    Read the article

  • Calculation of derived field in sql

    - by Matt
    Taking Sql this quarter and not having any luck with the following question: The height of players in feet (inches/12). Include their name. Hint: Calculation or derived field. Be sure to give the calculated field a column header. We're learning the basic Select statment and didn't find any reference on how to make custom data at w3schools. I'm using Microsoft SQL server Management Express Here's my statment so far: select nameLast, nameFirst, height from Master where height (I assume its something like 'Player_Height' = height/12) order by nameLast, nameFirst, height Thanks for the help

    Read the article

  • Does duplicate id's screw up jquery selectors?

    - by Matt
    If I had two divs, both with id="myDiv" Would $("#myDiv").fadeOut(); fade both divs out? Or would it fade only the first/second? Or none at all? How do I change which one it fades out? Note: I know duplicate id's is against standards but I'm using the fancybox modal popup and it duplicates specified content on your page for the content of the popup. If anyone knows a way around this (maybe I'm using fancybox wrong) please let me know.

    Read the article

  • Why would a 'public event EventHandler cccc' be null?

    - by Matt
    Why would a 'public event EventHandler cccc' be null? I have a class that's public class Builder { public event EventHandler StartedWorking; public Builder() { // Constructor does some stuff } public void Start() { StartedWorking(this, eventargobject); //StartedWorking is null -- } } This seems straightforward and something I do all the time? Am I missing something obvious or is there something that could cause this? EDIT: Does this mean that if I fire an event that is not subscribed to in a client class I have to check that it is not null? EDIT-2: I guess I'd never had events that were never not subscribed to and hence never ran into this -- You learn something new every day Sorry about the seemingly stupid question....

    Read the article

< Previous Page | 63 64 65 66 67 68 69 70 71 72 73 74  | Next Page >