Search Results

Search found 191 results on 8 pages for 'shaun owens'.

Page 7/8 | < Previous Page | 3 4 5 6 7 8  | Next Page >

  • WPF EventRouting to Children

    - by Shaun Bowe
    Is there any way to broadcast a RoutedEvent to all of my children in WPF? For example lets say I have a Window that has 4 children. 2 of them know about the RoutedEvent 'DisplayYourself' and are listening for it. How can I raise this event from the window and have it sent to all children? I looked at RoutingStrategy and Bubble is the wrong direction, Tunnel and Direct don't work because I don't know which children I want to send this to. I just want to broadcast this message and have whoever cares about it handle it. update: I declared the events in a static class. public static class StaticEventClass { public static readonly RoutedEvent ClickEvent = EventManager.RegisterRoutedEvent("Click", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(StaticEventClass)); public static readonly RoutedEvent DrawEvent = EventManager.RegisterRoutedEvent("Draw", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(StaticEventClass)); } The problem is when I raise the event from my window, the children never see it. RoutedEventArgs args = new RoutedEventArgs(StaticEventClass.DrawEvent, this); this.RaiseEvent(args); update again.. Here is the handler in the child. public ChildClass() { this.AddHandler(StaticEventClass.DrawEvent, new RoutedEventHandler(ChildClass_Draw)); }

    Read the article

  • Apache/Tomcat configuration to allow multiple incoming DNS served by one app (SAAS)

    - by Shaun F
    Is there a way to setup apache and tomcat so that I can have d1.webapp.com d2.webapp.com d3.webapp.com etc. All hosted by the same tomcat instance without having to add aliases to the HOSTS element in the tomcat config file? I will be allowing new users to have thier own domain when they sign up and it will be a subdomain of the web app. I don't want to keep updating the hosts file for aliases and restarting tomcat though each time a new user signs up.

    Read the article

  • Trying to draw a dynamic rectangle in SVG

    - by Shaun
    To be more specific, here are the steps I need: onmousedown - set x and y of rect as mouse coordinates onmousemove - using the current x and y mouse coordinates calculate height and width of the rect, set these and append onmouseup - remove the rectangle, and call a function based off some calculations from the rect. Here is what I have but isn't quite working (right now I have it drawing a line to make it simpler): onmousedown: startbox(evt) function startbox(evt) { if(evt.button === 0) { x1 = evt.clientX + div.scrollLeft-5; y1 = evt.clientY + div.scrollTop-30; obj.setAttributeNS(null, "x1", x1); obj.setAttributeNS(null, "y1", y1); Root.setAttributeNS(null, "onmousemove", "updatebox(evt)"); } } onmousemove: updatebox(evt) function updatebox(evt) { if(evt.button === 0) { x2 = evt.clientX + div.scrollLeft-5; y2 = evt.clientY + div.scrollTop-30; Root.appendChild(.obj); w = Math.abs(x2-x1); h = Math.abs(y2-y1); var strokecolor; if(w>20 && h>20) { strokecolor = "green"; validbox = true; } else { strokecolor = "red"; validbox = false; } var Attr={ x2:x2, y2:y2, stroke:strokecolor } assignAttr(obj, Attr); //just loops thru adding multiple attributes } } onmouseup: endbox() function endbox(evt) { if(evt.button===0) { Root.setAttributeNS(null, "onmousemove", ""); Root.removeChild(obj); if(validbox) { //do stuff validbox = !validbox; } } } Some of my problems with this are: Its slow in Chrome making drawing the line/rect feel sluggish. It won't work two times in a row. This is the real problem that I can't fix. Any and all feedback is welcome.

    Read the article

  • PHP: What is an efficient way to parse a text file containing very long lines?

    - by Shaun
    I'm working on a parser in php which is designed to extract MySQL records out of a text file. A particular line might begin with a string corresponding to which table the records (rows) need to be inserted into, followed by the records themselves. The records are delimited by a backslash and the fields (columns) are separated by commas. For the sake of simplicity, let's assume that we have a table representing people in our database, with fields being First Name, Last Name, and Occupation. Thus, one line of the file might be as follows [People] = "\Han,Solo,Smuggler\Luke,Skywalker,Jedi..." Where the ellipses (...) could be additional people. One straightforward approach might be to use fgets() to extract a line from the file, and use preg_match() to extract the table name, records, and fields from that line. However, let's suppose that we have an awful lot of Star Wars characters to track. So many, in fact, that this line ends up being 200,000+ characters/bytes long. In such a case, taking the above approach to extract the database information seems a bit inefficient. You have to first read hundreds of thousands of characters into memory, then read back over those same characters to find regex matches. Is there a way, similar to the Java String next(String pattern) method of the Scanner class constructed using a file, that allows you to match patterns in-line while scanning through the file? The idea is that you don't have to scan through the same text twice (to read it from the file into a string, and then to match patterns) or store the text redundantly in memory (in both the file line string and the matched patterns). Would this even yield a significant increase in performance? It's hard to tell exactly what PHP or Java are doing behind the scenes.

    Read the article

  • Calling a subclass method from a superclass

    - by Shaun
    Preface: This is in the context of a Rails application. The question, however, is specific to Ruby. Let's say I have a Media object. class Media < ActiveRecord::Base end I've extended it in a few subclasses: class Image < Media def show # logic end end class Video < Media def show # logic end end From within the Media class, I want to call the implementation of show from the proper subclass. So, from Media, if self is a Video, then it would call Video's show method. If self is instead an Image, it would call Image's show method. Coming from a Java background, the first thing that popped into my head was 'create an abstract method in the superclass'. However, I've read in several places (including Stack Overflow) that abstract methods aren't the best way to deal with this in Ruby. With that in mind, I started researching typecasting and discovered that this is also a relic of Java thinking that I need to banish from my mind when dealing with Ruby. Defeated, I started coding something that looked like this: def superclass_method # logic this_media = self.type.constantize.find(self.id) this_media.show end I've been coding in Ruby/Rails for a while now, but since this was my first time trying out this behavior and existing resources didn't answer my question directly, I wanted to get feedback from more-seasoned developers on how to accomplish my task. So, how can I call a subclass's implementation of a method from the superclass in Rails? Is there a better way than what I ended up (almost) implementing?

    Read the article

  • How do I implement something like pointers in javascript?

    - by Shaun
    I know that javascript doesn't have pointers in terms of a variable referring to a place in memory but what I have is a number of variables which are subject to change and dependent on each other. For example: Center (x,y) = (offsetLeft + width/scale , offsetTop + height/scale) As of now I have rewritten the equation in terms of each individual variable and after any changes I call the appropriate update function. For example: If scale changes, then then the center, height, and width stay the same. So I call updateoffset() { offsetLeft = centerx - width/scale; offsetTop = centery - height/scale; } Is this the easiest way to update each of these variables when any of them changes?

    Read the article

  • Autorelease with elements in a UITableViewCell - memory leak

    - by Shaun Budhram
    In my 'cellForRowAtIndexPath' method for a UITableView delegate, I'm allocating a cell if it doesn't exist, and in this cell, I'm creating a new activity spinner like so: UIActivityIndicatorView *actView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray ] autorelease]; I'm using Leaks to detect memory leaks in my program, and for some reason, this is coming up as a leak, even though it's autoreleasing. The cell itself is also autoreleasing. Has anyone had experience with autoreleasing variables coming up as leaks in the Leaks instrument, and how to tackle these problems? Also, if it helps, this is the history Leaks is displaying for this memory location. It looks like it at some point gets an additional retain message? This is not being done in my code.

    Read the article

  • Get Rails to save a record to the database in a non-UTC time

    - by Shaun
    Is there a way to get Rails to save records to the database without it automagically converting the timestamp into UTC before saving? The problem is that I have a few models that pull data from a legacy database that saves everything in Mountain Time and occasionally I have to have my Rails app write to that database. The problem is that every time it does, it converts the time I give it from Mountain Time to UTC, which is 6-7 hours ahead (depending on DST)! Needless to say, this really messes with reporting on that database. If I could get around doing this, I would. Unfortunately, I can't do anything about the fact that this other database uses a different timezone, nor can I really get away from the need for this app to save to that database occasionally. If I could just get Rails to stop trying to help me, it'd be great.

    Read the article

  • How do you work on Strategic Development initiatives when Tactical work takes priority?

    - by Shaun F
    My day-to-day job consists of maintaining large volume websites and this has given me exposure to developing better methods to develop and maintain the code. This has also given me a large body of knowledge in the code base in terms of troubleshooting that is beneficial to the company. I'm also the maintainer of an IDE plug in I created to help navigate and generate code that is used. Operationally though, my job is to handle any client requests that come in of that are emergencies and make any enhancements and additions to the code base required. This work, along with the daily managing and feeding of the the project managers will take up my entire day. How does one manage the time between the tactical day job and the strategic initiatives? How does one get and ask for recognition for taking strategic initiatives? Is the 8-9 hour day just not going to cut it? Is there even a job out there for programmers to develop strategic initiatives and solutions for a company? I want to also point out that this isn't a problem with the company at all. I think this is more of a personal-improvement decision. Nobody will say no to the improvements at all. I believe in making the things happen but I don't think I'm going to get time from the company to do it...

    Read the article

  • Python function argument scope (Dictionaries v. Strings)

    - by Shaun Meyer
    Hello, given: foo = "foo" def bar(foo): foo = "bar" bar(foo) print foo # foo is still "foo"... foo = {'foo':"foo"} def bar(foo): foo['foo'] = "bar" bar(foo) print foo['foo'] # foo['foo'] is now "bar"? I have a function that has been inadvertently over-writing my function parameters when I pass a dictionary. Is there a clean way to declare my parameters as constant or am I stuck making a copy of the dictionary within the function? Thanks!

    Read the article

  • Why do Java and C# not have implicit conversions to boolean?

    - by Shaun
    Since I started Java it's been very aggravating for me that it doesn't support implicit conversions from numeric types to booleans, so you can't do things like: if (flags & 0x80) { ... } instead you have to go through this lunacy: if ((flags & 0x80) != 0) { ... } It's the same with null and objects. Every other C-like language I know including JavaScript allows it, so I thought Java was just moronic, but I've just discovered that C# is the same (at least for numbers, don't know about null/objects): http://msdn.microsoft.com/en-us/library/c8f5xwh7(VS.71).aspx Microsoft changed it on purpose from C++, so why? Clearly I'm missing something. Why change (what I thought was) the most natural thing in the world to make it longer to type? What on Earth is wrong with it?

    Read the article

  • Scoping two models on approved

    - by Shaun Frost Duke Jackson
    I have three models (Book,Snippet,User) and I'd like to create a scope for where(:approved = true) I'm doing this so I can use the merit gem to define ranking based on count of approved. I'm thinking that writing this as a scope might be to complex but I don't know as I've just started leaning scopes. I've currently got this in my Book & Snippet Model: scope :approved, -> { where(approved: true) } I've playing around with this in my user model but I don't think it's correct: scope :approved, joins(:books && :snippets) Could anyone help start me off or give me some suggestions on what to read?

    Read the article

  • How do I check the Database type in a Rails Migration?

    - by Shaun F
    I have the following migration and I want to be able to check if the current database related to the environment is a mysql database. If it's mysql then I want to execute the SQL that is specific to the database. How do I go about this? class AddUsersFb < ActiveRecord::Migration def self.up add_column :users, :fb_user_id, :integer add_column :users, :email_hash, :string #if mysql #execute("alter table users modify fb_user_id bigint") end def self.down remove_column :users, :fb_user_id remove_column :users, :email_hash end end

    Read the article

  • If I use a facade class with generic methods to access the JPA API, how should I provide additional processing for specific types?

    - by Shaun
    Let's say I'm making a fairly simple web application using JAVA EE specs (I've heard this is possible). In this app, I only have about 10 domain/data objects, and these are represented by JPA Entities. Architecturally, I would consider the JPA API to perform the role of a DAO. Of course, I don't want to use the EntityManager directly in my UI (JSF) and I need to manage transactions, so I delegate these tasks to the so-called service layer. More specifically, I would like to be able to handle these tasks in a single DataService class (often also called CrudService) with generic methods. See this article by Adam Bien for an example interface: http://www.adam-bien.com/roller/abien/entry/generic_crud_service_aka_dao My project differs from that article in that I can't use EJBs, so my service classes are essentially just named beans and I handle transactions manually. Regardless, what I want is a single interface for simple CRUD operations on my data objects because having a different class for each data type would lead to a lot of duplicate and/or unnecessary code. Ideally, my views would be able to use a method such as public <T> List<T> findAll(Class<T> type) { ... } to retrieve data. Using JSF, it might look something like this: <h:dataTable value="#{dataService.findAll(data.class)}" var="d"> ... </h:dataTable> Similarly, after validating forms, my controller could submit the data with a method such as: public <T> void add(T entity) { ... } Granted, you'd probably actually want to return something useful to the caller. In any case, this works well if your data can be treated as homogenous in this manner. Alas, it breaks down when you need to perform additional processing on certain objects before passing them on to JPA. For example, let's say I'm dealing with Books and Authors which have a many-to-many relationship. Each Book has a set of IDs referring to its authors, and each Author has a set of IDs referring to their books. Normally, JPA can manage this kind of relationship for you, but in some cases it can't (for example, the google app engine JPA provider doesn't support this). Thus, when I persist a new book for example, I may need to update the corresponding author entities. My question, then, is if there's an elegant way to handle this or if I should reconsider the sanity of my whole design. Here's a couple ways I see of dealing with it: The instanceof operator. I could use this to target certain classes when special processing is needed. Perhaps maintainability suffers and it isn't beautiful code, but if there's only 10 or so domain objects it can't be all that bad... could it? Make a different service for each entity type (ie, BookService and AuthorService). All services would inherit from a generic DataService base class and override methods if special processing is needed. At this point, you could probably also just call them DAOs instead. As always, I appreciate the help. Let me know if any clarifications are needed, as I left out many smaller details.

    Read the article

  • Declared Properties and assigning values with self

    - by Shaun Budhram
    I understand how declared properties work - I just need a clarification on when Objective C is using the accessor method vs. when it is not. Say I have a property declared using retain: @property (nonatomic, retain) NSDate *date; ... and later... @synthesize date If I say: date = x Is that calling the accessor method? Or is it just setting the variable? self.date = x This seems to call the accessor method (I think but I'm not sure, since it seems like the retain count is increasing). Can anyone clarify this issue? I'm curious because i have some variables that seem to become invalid before I need them (and I have to specifically call retain), and I suspect this is why.

    Read the article

  • Using the JPA Criteria API, can you do a fetch join that results in only one join?

    - by Shaun
    Using JPA 2.0. It seems that by default (no explicit fetch), @OneToOne(fetch = FetchType.EAGER) fields are fetched in 1 + N queries, where N is the number of results containing an Entity that defines the relationship to a distinct related entity. Using the Criteria API, I might try to avoid that as follows: CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<MyEntity> query = builder.createQuery(MyEntity.class); Root<MyEntity> root = query.from(MyEntity.class); Join<MyEntity, RelatedEntity> join = root.join("relatedEntity"); root.fetch("relatedEntity"); query.select(root).where(builder.equals(join.get("id"), 3)); The above should ideally be equivalent to the following: SELECT m FROM MyEntity m JOIN FETCH myEntity.relatedEntity r WHERE r.id = 3 However, the criteria query results in the root table needlessly being joined to the related entity table twice; once for the fetch, and once for the where predicate. The resulting SQL looks something like this: SELECT myentity.id, myentity.attribute, relatedentity2.id, relatedentity2.attribute FROM my_entity myentity INNER JOIN related_entity relatedentity1 ON myentity.related_id = relatedentity1.id INNER JOIN related_entity relatedentity2 ON myentity.related_id = relatedentity2.id WHERE relatedentity1.id = 3 Alas, if I only do the fetch, then I don't have an expression to use in the where clause. Am I missing something, or is this a limitation of the Criteria API? If it's the latter, is this being remedied in JPA 2.1 or are there any vendor-specific enhancements? Otherwise, it seems better to just give up compile-time type checking (I realize my example doesn't use the metamodel) and use dynamic JPQL TypedQueries.

    Read the article

  • Flash / Actionscript wheel

    - by Shaun
    Hi, I have been asked to create a wheel for navigation similar to on the Visit Provence website. However, I don't know where to start and my Googling effort have been unsuccessful - I guess that I am searching using the wrong terms. It the the way that the wheel moves and interacts with the other segments around it that interests me. I'd really appreciate any tutorials / help that anyone can share.

    Read the article

  • Winners of Pete Brown's "Silverlight 5 In Action" Books

    - by Dave Campbell
    It's always a double-edged sword when I get to this point in a give-away... I want to give everyone something, but a deal is a deal :) It's also only through the benevolence of the folks at Manning Press that I can even do this, so thank you! The Winners Getting right to it, the winners are: Jaganadh G Stephen Owens Jan Hannemann Notice there are 3 names, not 2... I was told late last week to pick a 3rd name, so thanks again Manning! I've already received email from my contact, and they've been waiting for me to send them the email. You should be hearing from them shortly I think. For everyone else, keep your eyes on my blog... as I told Manning, I like giving away other people's stuff :) Have a great day, and if you're anywhere near Phoenix and interested in Silverlight, I'll see you tomorrow at the Scott Gu Event, and Stay in the 'Light!

    Read the article

  • I can't get click and drag to work with my Wacom Bamboo P&T

    - by Magnus Hoff
    I get my Wacom Bamboo Pen & Touch apparently working (By using Martin Owens' PPA), but whenever I try to click and drag something -- for example to move a window -- it will only register as a click. In other words: The "button up" event is generated right after the "button down" event no matter how long I hold it in. This is the same whether I use the tip of the pen, the buttons on the pen or the buttons on the pad. However: Clicking and dragging works perfectly in the login-screen, both before logging in for the first time and after logging out.

    Read the article

  • Promote your DotNetNuke skills

    Over the last couple of weeks, I have been reaching out to Fusion Partners in an effort to compile a list of finished CMS projects that are noteworthy. Shaun Walker will be picking out a few to include in his blog that he feels are especially interesting. Also, we are interested in building a list of compelling DNN sites that leverage Telerik Controls. If you have created a masterpiece that you feel really showcases your teams creative design skills or provides interesting functionality, let me...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

< Previous Page | 3 4 5 6 7 8  | Next Page >