Search Results

Search found 1863 results on 75 pages for 'matt fordham'.

Page 46/75 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • Linear regression confidence intervals in SQL

    - by Matt Howells
    I'm using some fairly straight-forward SQL code to calculate the coefficients of regression (intercept and slope) of some (x,y) data points, using least-squares. This gives me a nice best-fit line through the data. However we would like to be able to see the 95% and 5% confidence intervals for the line of best-fit (the curves below). What these mean is that the true line has 95% probability of being below the upper curve and 95% probability of being above the lower curve. How can I calculate these curves? I have already read wikipedia etc. and done some googling but I haven't found understandable mathematical equations to be able to calculate this. Edit: here is the essence of what I have right now. --sample data create table #lr (x real not null, y real not null) insert into #lr values (0,1) insert into #lr values (4,9) insert into #lr values (2,5) insert into #lr values (3,7) declare @slope real declare @intercept real --calculate slope and intercept select @slope = ((count(*) * sum(x*y)) - (sum(x)*sum(y)))/ ((count(*) * sum(Power(x,2)))-Power(Sum(x),2)), @intercept = avg(y) - ((count(*) * sum(x*y)) - (sum(x)*sum(y)))/ ((count(*) * sum(Power(x,2)))-Power(Sum(x),2)) * avg(x) from #lr Thank you in advance.

    Read the article

  • is that possible to crack Private key with Decrypted message and public key?

    - by matt clarck
    for example company B send an encrypted email with company A's public key (RSA/PGP/SSH/openSSL/...) the employer receive the encrypted email and send it to his boss who have the private key to decrypt message. the boss give decrypted email back to employer to work on it. question is can employer compare encrypted email with decrypted version and find out what is private key ? if it is possible then is there anyway to protect cracking private key from decrypted messages and comparing with encrypted messages/public key ?

    Read the article

  • jQuery .val Enigma between two input boxes

    - by Matt
    I'm trying to get it so that if I move a red div-square around the screen using jQuery UI and jQuery, then an input field updates with the position of the div. I got that working with a simple .val. But, it's hard to explain why, but I need to make it so that when I move the square, it updates my input box, and when the input box value is changed, another input box reflects the new value of the old input box. Do I make any sense, coz I'm confusing myself :). I made a jsfiddle, so perhaps it'll make more sense there. If you move the red square, then the input box directly above it updates, but the input box above that does not, even though it is programmed to reflect the value of the input box below itself. P.S. Is this specific to only jQuery, or is this problem present in all of JavaScript. Thanks! http://jsfiddle.net/xmCsq/27/

    Read the article

  • Sort specific items of an array first

    - by Matt Huggins
    I have a ruby array that looks something like this: my_array = ['mushroom', 'beef', 'fish', 'chicken', 'tofu', 'lamb'] I want to sort the array so that 'chicken' and 'beef' are the first two items, then the remaining items are sorted alphabetically. How would I go about doing this?

    Read the article

  • Django Grouping Query

    - by Matt
    I have the following (simplified) models: class Donation(models.Model): entry_date = models.DateTimeField() class Category(models.Model): name = models.CharField() class Item(models.Model): donation = models.ForeignKey(Donation) category = models.ForeignKey(Category) I'm trying to display the total number of items, per category, grouped by the donation year. I've tried this: Donation.objects.extra(select={'year': "django_date_trunc('year', %s.entry_date)" % Donation._meta.db_table}).values('year', 'item__category__name').annotate(items=Sum('item__quantity')) But I get a Field Error on item__category__name. I've also tried: Item.objects.extra(select={"year": "django_date_trunc('year', entry_date)"}, tables=["donations_donation"]).values("year", "category__name").annotate(items=Sum("quantity")).order_by() Which generally gets me what I want, but the item quantity count is multiplied by the number of donation records. Any ideas? Basically I want to display this: 2010 - Category 1: 10 items - Category 2: 17 items 2009 - Category 1: 5 items - Category 3: 8 items

    Read the article

  • .Net System.Mail.Message adding multiple "To" addresses

    - by Matt Dawdy
    I just hit something I think is inconsistent, and wanted to see if I'm doing something wrong, if I'm an idiot, or... MailMessage msg = new MailMessage(); msg.To.Add("[email protected]"); msg.To.Add("[email protected]"); msg.To.Add("[email protected]"); msg.To.Add("[email protected]"); Really only sends this email to 1 person, the last one. To add multiples I have to do this: msg.To.Add("[email protected],[email protected],[email protected],[email protected]"); I don't get it. I thought I was adding multiple people to the "To" address collection, but what I was doing was replacing it. I think I just realized my error -- to add one item to the collection, use .To.Add(new MailAddress("[email protected]")) If you use just a string, it replaces everything it had in its list. Ugh. I'd consider this a rather large gotcha! Since I answered my own question, but I think this is of value to have in the stackoverflow archive, I'll still ask it. Maybe someone even has an idea of other traps that you can fall into.

    Read the article

  • Get number of times in loop over Hash object

    - by Matt Huggins
    I have an object of type Hash that I want to loop over via hash.each do |key, value|. I would like to get the number of times I've been through the loop starting at 1. Is there a method similar to each that provides this (while still providing the hash key/value data), or do I need to create another counter variable to increment within the loop?

    Read the article

  • Changing label color based on current label color in iPhone dev

    - by Matt Thomas
    I am having trouble figuring out the if statement code for changing the color of a UI label based on the current color of the label. For instance, if the label color is currently red and the correct button is pressed, I want the label color to change to black. If the label color is black I want the label color to change to blue. Many thanks for any tips.

    Read the article

  • LINQ to SQL: On load processing of lazy loaded associations

    - by Matt Holmes
    If I have an object that lazy loads an association with very large objects, is there a way I can do processing at the time the lazy load occurs? I thought I could use AssociateWith or LoadWith from DataLoadOptions, but there are very, very specific restrictions on what you can do in those. Basically I need to be notified when an EntitySet< decides it's time to load the associated object, so I can catch that event and do some processing on the loaded object. I don't want to simply walk through the EntitySet when I load the parent object, because that will force all the lazy loaded items to load (defeating the purpose of lazy loading entirely).

    Read the article

  • heterogeneous comparisons in python3

    - by Matt Anderson
    I'm 99+% still using python 2.x, but I'm trying to think ahead to the day when I switch. So, I know that using comparison operators (less/greater than, or equal to) on heterogeneous types that don't have a natural ordering is no longer supported in python3.x -- instead of some consistent (but arbitrary) result we raise TypeError instead. I see the logic in that, and even mostly think its a good thing. Consistency and refusing to guess is a virtue. But what if you essentially want the python2.x behavior? What's the best way to go about getting it? For fun (more or less) I was recently implementing a Skip List, a data structure that keeps its elements sorted. I wanted to use heterogeneous types as keys in the data structure, and I've got to compare keys to one another as I walk the data structure. The python2.x way of comparing makes this really convenient -- you get an understandable ordering amongst elements that have a natural ordering, and some ordering amongst those that don't. Consistently using a sort/comparison key like (type(obj).__name__, obj) has the disadvantage of not interleaving the objects that do have a natural ordering; you get all your floats clustered together before your ints, and your str-derived class separates from your strs. I came up with the following: import operator def hetero_sort_key(obj): cls = type(obj) return (cls.__name__+'_'+cls.__module__, obj) def make_hetero_comparitor(fn): def comparator(a, b): try: return fn(a, b) except TypeError: return fn(hetero_sort_key(a), hetero_sort_key(b)) return comparator hetero_lt = make_hetero_comparitor(operator.lt) hetero_gt = make_hetero_comparitor(operator.gt) hetero_le = make_hetero_comparitor(operator.le) hetero_ge = make_hetero_comparitor(operator.gt) Is there a better way? I suspect one could construct a corner case that this would screw up -- a situation where you can compare type A to B and type A to C, but where B and C raise TypeError when compared, and you can end up with something illogical like a > b, a < c, and yet b > c (because of how their class names sorted). I don't know how likely it is that you'd run into this in practice.

    Read the article

  • Passing IDisposable objects through constructor chains

    - by Matt Enright
    I've got a small hierarchy of objects that in general gets constructed from data in a Stream, but for some particular subclasses, can be synthesized from a simpler argument list. In chaining the constructors from the subclasses, I'm running into an issue with ensuring the disposal of the synthesized stream that the base class constructor needs. Its not escaped me that the use of IDisposable objects this way is possibly just dirty pool (plz advise?) for reasons I've not considered, but, this issue aside, it seems fairly straightforward (and good encapsulation). Codes: abstract class Node { protected Node (Stream raw) { // calculate/generate some base class properties } } class FilesystemNode : Node { public FilesystemNode (FileStream fs) : base (fs) { // all good here; disposing of fs not our responsibility } } class CompositeNode : Node { public CompositeNode (IEnumerable some_stuff) : base (GenerateRaw (some_stuff)) { // rogue stream from GenerateRaw now loose in the wild! } static Stream GenerateRaw (IEnumerable some_stuff) { var content = new MemoryStream (); // molest elements of some_stuff into proper format, write to stream content.Seek (0, SeekOrigin.Begin); return content; } } I realize that not disposing of a MemoryStream is not exactly a world-stopping case of bad CLR citizenship, but it still gives me the heebie-jeebies (not to mention that I may not always be using a MemoryStream for other subtypes). It's not in scope, so I can't explicitly Dispose () it later in the constructor, and adding a using statement in GenerateRaw () is self-defeating since I need the stream returned. Is there a better way to do this? Preemptive strikes: yes, the properties calculated in the Node constructor should be part of the base class, and should not be calculated by (or accessible in) the subclasses I won't require that a stream be passed into CompositeNode (its format should be irrelevant to the caller) The previous iteration had the value calculation in the base class as a separate protected method, which I then just called at the end of each subtype constructor, moved the body of GenerateRaw () into a using statement in the body of the CompositeNode constructor. But the repetition of requiring that call for each constructor and not being able to guarantee that it be run for every subtype ever (a Node is not a Node, semantically, without these properties initialized) gave me heebie-jeebies far worse than the (potential) resource leak here does.

    Read the article

  • Programmatic Bot Detection

    - by matt
    Hi, I need to write some code to analyze whether or not a given user on our site is a bot. If it's a bot, we'll take some specific action. Looking at the User Agent is not something that is successful for anything but friendly bots, as you can specify any user agent you want in a bot. I'm after behaviors of unfriendly bots. Various ideas I've had so far are: If you don't have a browser ID If you don't have a session ID Unable to write a cookie Obviously, there are some cases where a legitimate user will look like a bot, but that's ok. Are there other programmatic ways to detect a bot, or either detect something that looks like a bot? thanks!

    Read the article

  • NSTableview not loading

    - by Matt S.
    I have an NSTableView that is inside an NSView. The whole view is being controlled by a class that has a superclass of NSObject. I send some data over to that class from another one, however, the tableview isn't refreshing, even with [myTable reloadData] The table's delegates and all that fancy stuff is connected to that NSObject class.

    Read the article

  • Performance of .NET ILMerged assemblies

    - by matt
    I have two .NET libraries: "Foo.Bar" and "Foo.Baz". "Foo.Bar" is self-contained, while "Foo.Baz" references "Foo.Bar". Assuming I do the following: Use ILMerge to merge "Foo.Bar.dll" with "Foo.Baz.dll" into "Foo1.dll". Create a new solution containing the entirity of both "Foo.Bar" and "Foo.Baz" (since I have access to their source code), and compile this into "Foo2.dll". Will there be any differences in the performance of Foo1.dll and Foo2.dll when using their functionality from an external project? If so, how significant is this performance difference, and is it a once-off (on load?) or ongoing difference? Are there any other pros or cons with either approach?

    Read the article

  • Synchronizing Java Visualizer Audio and Visual

    - by Matt
    I've run into a problem creating a visualizer for .mp3 files in Java. My goal is to create a visualization that runs in time with the .mp3 file being played. I can currently visualize an .mp3 OR play it, but not both at the same time. I am using libraries which may make this trickier than necessary. I currently: Read in the .mp3 as a FileInputStream. a) Convert the FileInputStream into a Bitstream and run the Visualizer OR b) Pass the FileInputStream to a library Play method where it converts it into a Bitstream, decodes it, and plays it. I am using the JLayer library to play and decode the .mp3. My question is: how do I synchronize the two actions so that I can run both at the same time AND they line up (so my visualizations correspond to the changing frequencies). This implies that they finish at the same time as well.

    Read the article

  • Should I specify both INDEX and UNIQUE INDEX?

    - by Matt Huggins
    On one of my PostgreSQL tables, I have a set of two fields that will be defined as being unique in the table, but will also both be used together when selecting data. Given this, do I only need to define a UNIQUE INDEX, or should I specify an INDEX in addition to the UNIQUE INDEX? This? CREATE UNIQUE INDEX mytable_col1_col2_idx ON mytable (col1, col2); Or this? CREATE UNIQUE INDEX mytable_col1_col2_uidx ON mytable (col1, col2); CREATE INDEX mytable_col1_col2_idx ON mytable (col1, col2);

    Read the article

  • looking for overview of readystate and browsers

    - by Matt
    I'm finding a lot of problems with trying to determine readyState between IE8, FF3, and Chrome. so far this is what I find: Chrome, FF do not fire an event for .onReadyStateChanged Chrome, FF support .onLoad IE8 supports .onReadyStateChanged, but does not support .onLoad IE8 has also returned loaded, and complete. Mostly it states loaded, but every now and then it spits out complete. Can anyone point me to a chart or overview of browsers and the way they handle readyStates?

    Read the article

  • R counting the occurrences of similar rows of data frame

    - by Matt
    I have data in the following format called DF (this is just a made up simplified sample): eval.num, eval.count, fitness, fitness.mean, green.h.0, green.v.0, offset.0 random 1 1 1500 1500 100 120 40 232342 2 2 1000 1250 100 120 40 11843 3 3 1250 1250 100 120 40 981340234 4 4 1000 1187.5 100 120 40 4363453 5 1 2000 2000 200 100 40 345902 6 1 3000 3000 150 90 10 943 7 1 2000 2000 90 90 100 9304358 8 2 1800 1900 90 90 100 284333 However, the eval.count column is incorrect and I need to fix it. It should report the number of rows with the same values for (green.h.0, green.v.0, and offset.0) by only looking at the previous rows. The example above uses the expected values, but assume they are incorrect. How can I add a new column (say "count") which will count all previous rows which have the same values of the specified variables? I have gotten help on a similar problem of just selecting all rows with the same values for specified columns, so I supposed I could just write a loop around that, but it seems inefficient to me.

    Read the article

  • WCF reuse types in referenced assemblies does not reuse the ServiceContract Interface

    - by Matt
    I have three seperate projects: -MyUserControl (Needs a reference to a service implementing IMyService) -MyService (Implements IMyService) -MySharedInterfaces (IMyUserControl and IMyService) -MyWebApp The user control needs to be dynamically loaded at runtime. This implements IMyUserControl and has a property of type IMyService which will be set at runtime. The trouble is even with the option to reuse types the WebApp isn't reusing the IMyServiceType, it always generates it again from the Service Reference. This wouldn't be an issue if I could cast it to MySharedInterfaces.IMyService (which I can't understand, since it should be exactly the same). The user control is expecting something of type IMyService, is there anyway to either cast the WebServiceReference.IMyService back to MySharedInterface.IMyServiceReference or force the WebServiceReference to reuse the MySharedInterface.IMyServiceReference? Thanks

    Read the article

  • How can I copy a file from VMS to Windows and back again?

    - by Matt Joslin
    I am trying to copy C source files from a vms alpha to a windows machine to allow easier editing of the code. (VMS editor is just a text editor and it would be nice to have syntax highlighting etc) I can copy this across using Exceed FTP and this handles the issue of duplicate filenames with version suffix that vms has: File.c;1 File.c;2 Flle.c;3 But when I open a file I've transferred, all the line breaks have been lost and the entire file is just one line. Can anyone recommend a solution to this or offer any hints? Thanks in advance ps. I need to be able to copy the files back to vms and still maintain format.

    Read the article

  • Pure-JavaScript projects in NetBeans?

    - by Matt Zukowski
    This seems like it ought to be obvious, yet I can't figure it out. I do a lot of JavaScript coding, and I really like NetBeans. Unfortunately I can't figure out how to create a "JavaScript" project in NetBeans. If I go to File - New Project, my only options are "Java", "Ruby", and "NetBeans Modules". I don't want any of these. My project consists mostly of JavaScript, with a little bit of CSS. I ususally just end up creating a "Ruby" project, but this seems retarded, since I don't actually have any Ruby code. Why isn't there an option to create a "JavaScript" or "Web" project, or at least a "Generic" project that doesn't revolve around a specific language? Am I missing something here?

    Read the article

  • WCF Architectural Debate

    - by Matt Ruwe
    When building a WCF service for a large scale application, which is better: In both cases, assume that the business logic layer is separated into a different assembly. Using your business logic layer as a service implementation i.e. with no code behind and no wrapper <%@ ServiceHost Language="CS" Service="MyApp.BusinessLogic.BusLogicImpl" %> or Using the codebehind of the WCF service that wraps calls into your business logic layer. <%@ ServiceHost Language="CS" Service="MyApp.WebServiceHost.Service" CodeBehind="Service.svc.cs" %>

    Read the article

  • Using iterateFunc to call objective c method

    - by Matt Welch
    Using spacemanager, I need to perform an action on select bodies after each step, so I figured that defining my own C function for iterateFunc would be the way to go. Everything works great, except I'm not sure how to then call an obj c method in the same class. In other words, an obj c class contains both the c function replacing iterateFunc, and the method that needs to be called. I don't see how to tell the c function what 'self' is, such that I can call the method. As far as i can tell, there's no way to pass in any extra info to the new iterateFunc. Any ideas, or a better way to go about things?

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >