Search Results

Search found 3484 results on 140 pages for 'chris dubois'.

Page 119/140 | < Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >

  • Modifying an inherited Rails association

    - by Chris Kilmer
    I have a Team class that inherits from a Group class. Both Team and Groups have memberships through the same association. However, I need to run a method after a Team memberships is added but not a Group. I currently have something like this: class Group < ActiveRecord::Base has_many :memberships, :class_name => 'Connection', :foreign_key => 'connectable_id', :as => :connectable, :dependent => :destroy end class Team < Group has_many :memberships, :class_name => 'Connection', :foreign_key => 'connectable_id', :as => :connectable, :dependent => :destroy, :after_add => :add_company_membership private def membership_check(membership) end end Is there some way to modify the inherited association in Team so that I don't have to redefine the entire thing but rather just add the :after_add hook it? Any help would be appreciated.

    Read the article

  • Creating a Custom Ubuntu Daemon

    - by Chris S
    What's the "correct" way to create a custom daemon in Ubuntu, that will start at boot time and be controllable by Ubuntu's standard daemon start/stop commands? Can I just copy and paste one of the scripts in /etc/init.d or do I need to "register" the daemon somewhere else?

    Read the article

  • CodeIgniter - Returning multiple file upload details

    - by Chris
    Hey All, Im using the codeigniter upload library to upload multiple files, which works fine ... What im having problems with is returning the information about the files. Im using the following code to print the results for testing echo '<pre>'; print_r($this->upload->data()); echo '</pre>'; A cut down version of the results are as follows Array ( [file_name] => Array ( [0] => filename1.gif [1] => filename2.jpg ) ) The way my view is setup, is that i use jquery to insert multiple dynamic file input fields so the amount of files can be 1, it can be 50 and so on. Im wondering how i would loop through that array to send each filename to the database

    Read the article

  • Lifting a math symbol in LaTeX

    - by Chris Conway
    I'm using the symbol \otimes as a unary operator and it's vertical alignment doesn't seem right to me. It wants to sit a bit below the baseline: and I tried using \raisebox to fix this, e.g., \raisebox{1pt}{$\otimes$}: But \raisebox doesn't seem to be sensitive to subscripts. The operator stays the same size while everything around it shrinks: The problem, I think, is that \raisebox creates its own LR box, which doesn't inherit the settings in the surrounding math environment. Is there a version of \raisebox that "respects math"?

    Read the article

  • TSQL - create a stored proc inside a transaction statement

    - by Chris L
    I have a sql script that is set to roll to production. I've wrapped the various projects into separate transactions. In each of the transactions we created stored procedures. I'm getting error messages Msg 156, Level 15, State 1, Line 4 Incorrect syntax near the keyword 'procedure'. I created this example script to illustrate Begin Try Begin Transaction -- do a bunch of add/alter tables here -- do a bunch of data manipulation/population here -- create a stored proc create procedure dbo.test as begin select * from some_table end Commit End Try Begin Catch Rollback Declare @Msg nvarchar(max) Select @Msg=Error_Message(); RaisError('Error Occured: %s', 20, 101,@Msg) With Log; End Catch The error seems to imply that I can't create stored procs inside of transaction, but I'm not finding any docs that say otherwise(maybe google isn't being freindly today).

    Read the article

  • difference between where and nested queries

    - by Chris H
    I'm not able to figure out the difference between these queries. I'm pretty sure that the first one is an equi-join. I'm not sure how the second one ISN'T the same as the first. The sub query in #2 selects all Ids from S, and then it returns all R's that also have those ID's, no? SELECT R.cname FROM R, S, WHERE R.Id = S.Id SELECT R.cname FROM R WHERE R.Id IN (SELECT S.Id FROM S)

    Read the article

  • C# determining generic type

    - by Chris Klepeis
    I have several templated objects that all implement the same interface: I.E. MyObject<datatype1> obj1; MyObject<datatype2> obj2; MyObject<datatype3> obj3; I want to store these objects in a List... I think I would do that like this: private List<MyObject<object>> _myList; I then want to create a function that takes 1 parameter, being a datatype, to see if an object using that datatype exists in my list.... sorta clueless how to go about this. In Pseudo code it would be: public bool Exist(DataType T) { return (does _myList contain a MyObject<T>?); }

    Read the article

  • What is the most efficient way to handle points / small vectors in JavaScript?

    - by Chris
    Currently I'm creating an web based (= JavaScript) application thata is using a lot of "points" (= small, fixed size vectors). There are basically two obvious ways of representing them: var pointA = [ xValue, yValue ]; and var pointB = { x: xValue, y: yValue }; So translating my point a bit would look like: var pointAtrans = [ pointA[0] + 3, pointA[1] + 4 ]; var pointBtrans = { x: pointB.x + 3, pointB.y + 4 }; Both are easy to handle from a programmer point of view (the object variant is a bit more readable, especially as I'm mostly dealing with 2D data, seldom with 3D and hardly with 4D - but never more. It'll allways fit into x,y,z and w) But my question is now: What is the most efficient way from the language perspective - theoretically and in real implementations? What are the memory requirements? What are the setup costs of an array vs. an object? ... My target browsers are FireFox and the Webkit based ones (Chromium, Safari), but it wouldn't hurt to have a great (= fast) experience under IE and Opera as well...

    Read the article

  • Taking a break from programming harmful to career?

    - by Chris
    I'm currently taking a year out from University to do an internship at a large (well known) software vendor. I'll be returning to Uni next September for a year to finish my studies. I really want to take a year out after graduation, I won't be doing any programming in this year. Will this make me less competitive when applying for programmer jobs when I get back from my year away? I'm looking to work with the Microsoft technology stack, my internship has been all Java and Unix thus far. The assumption is I won't be taking up a full time offer with the company I interned at (despite the offer).

    Read the article

  • Qt: How to force a hidden widget to calculate its layout?

    - by Chris
    What I am trying to do is render a qwidget onto a different window (manually using a QPainter) I have a QWidget (w) with a layout and a bunch of child controls. w is hidden. Until w is shown, there is no layout calculations happening, which is expected. When I call w->render(painter, w->mapToGlobal(QPoint(0,0)), I get a bunch of controls all overlapping each other. w->layout()->activate();w->layout()->update() doesn't seem to do anything. Is there a way to force the layout to happen without showing w?

    Read the article

  • Easiest way to merge two List<T>s

    - by Chris McCall
    I've got two List<Name>s: public class Name { public string NameText {get;set;} public Gender Gender { get; set; } } public class Gender { public decimal MaleFrequency { get; set; } public decimal MaleCumulativeFrequency { get; set; } public decimal FemaleCumulativeFrequency { get; set; } public decimal FemaleFrequency { get; set; } } If the NameText property matches, I'd like to take the FemaleFrequency and FemaleCumulativeFrequency from the list of female Names and the MaleFrequency and MaleCumulativeFrequency values from the list of male Names and create one list of Names with all four properties populated. What's the easiest way to go about this in C# using .Net 3.5?

    Read the article

  • Library of ALL countries and their states for address forms

    - by Chris
    I need a library that includes all countries and respective codes in 1 array and a second multidimensional array for country to its states and a last array for state code to state name. I found tons of matches for similar requests but none actually have a simple CSV or XML with just that. My goal is to build an address form where you select your country and it then pre-populates the state dropdown - if the country has states - with the country's states. Shouldn't be so hard to find, but I guess i'm blind. Thanks so much for all help!

    Read the article

  • How to recover pixelated text from jpeg in photoshop?

    - by Chris Hil
    Hi there, I´ve got an jpeg image with text on it (badly scanned document), which is hardly readable. I have already played around with the sharpen filters, contrast, levels and the color replacement tool, with decent success. however my question is, what else can be done order to maximize the texts readablity? the picture is also somewhat noisy. Any help on this one would be greatly apreciated, since I absolutely need the images content.

    Read the article

  • Python Split usage

    - by Chris M
    I'm cocking this up and it should be really simple but the value of sortdate is none (note im only doing this because converting a string to a date in Python is a bugger). DateToPass = str(self.request.get('startdate')) mybreak.startdate = DateToPass faf = DateToPass.split('-') sortdate = str(faf[2] + faf[1] + faf[0]) That should work? but its just being stored as null though the datetopass is being stored fine.

    Read the article

  • SQL Server 2008, Books Online, and old documentation...

    - by Chris J
    [I have no idea if stackoverflow really is right right place for this, but don't know how many devs on here run into msi issues with SQL Server; suggest SuperUser or ServerFault if folk think it's better on either of those] About a year ago, when we were looking at moving our codebase forward and migrating to SQL Server 2008, I pulled down a copy of Books Online from the MSDN. Reviewed, did background research, fed results upstream, grabbed Express and tinkered with that. Then we got the nod to move forward (hurrah!) this past couple of weeks. So armed with Developer Edition, and running through the install, I've since found out I've zapped the Books Online MSI, no-ones got a copy of it, and Microsoft only have a later version (Oct 2009) available, so damned if I can update my SQL Server fully and properly... {mutter grumble}. Does anyone know if old versions of Books Online are available for download anywhere? Poking around the Microsoft download centre can't find it, neither is my google-fu finding it. For reference, I'm looking for SQLServer2008_BOL_August2008_ENU.msi ... This may just be a case of good ol' manual delete the files and (try) and clean up the registry :-(

    Read the article

  • Getting an argument list for a class method

    - by Chris T
    What I'd like is for this class class Car { public function __construct(Engine $engine, Make $make, Model $model) { // stuff } } Get an array that has the types needed to construct this car (Engine, Make, Model) in the order they are needed for the constructor. I'm using this for a Dependency Injection-esque thing I'm making.

    Read the article

  • Where to store common application settings

    - by Chris
    I want to move my application settings out of XAML and into a config file. For example, ToolTips and Content strings for Buttons/CheckBoxes and Labels. Is this the job of a ResourceDictionary, or should I use the App.Config or Settings.settings file? The ToolTips and Content strings are not really per user, they are more Application wide and may change if the UI is internationalized. Thanks!

    Read the article

  • NHibernate Native SQL multiple joins

    - by Chris
    Hi all, I"m having some problems with Nhibernate and native sql. I've got an entity with alot of collections and I am doing an SQL Fulltext search on it. So when returning 100 or so entities, I dont want all collections be lazy loaded. For this I changed my SQL query: SELECT Query.* FROM (SELECT {spr.*}, {adr.*}, {adrt.*}, {cty.*}, {com.*}, {comt.*}, spft.[Rank] AS [Rak], Row_number() OVER(ORDER BY spft.[Rank] DESC) AS rownum FROM customer spr INNER JOIN CONTAINSTABLE ( customerfulltext , computedfulltextindex , '" + parsedSearchTerm + @"' ) AS spft ON spr.customerid = spft.[Key] LEFT JOIN [Address] adr ON adr.customerid = spr.customerid INNER JOIN [AddressType] adrt ON adrt.addresstypeid = adr.addresstypeid INNER JOIN [City] cty ON cty.cityid = adr.cityid LEFT JOIN [Communication] com ON com.customerid = spr.customerid INNER JOIN [CommunicationType] comt ON comt.communicationtypeid = com.communicationtypeid) as Query ORDER BY Query.[Rank] DESC This is how I setup the query: var items = GetCurrentSession() .CreateSQLQuery(query) .AddEntity("spr", typeof(Customer)) .AddJoin("adr", "spr.addresses") .AddJoin("adrt", "adr.Type") .AddJoin("cty", "adr.City") .AddJoin("com", "spr.communicationItems") .AddJoin("comt", "com.Type") .List<Customer>(); What happens now is, that the query returns customers twice (or more), I assume this is because of the joins since for each customer address, communicationItem (e.g. phone, email), a new sql row is returned. In this case I thought I could use the DistinctRootEntityResultTransformer. var items = GetCurrentSession() .CreateSQLQuery(query) .AddEntity("spr", typeof(Customer)) .AddJoin("adr", "spr.addresses") .AddJoin("adrt", "adr.Type") .AddJoin("cty", "adr.City") .AddJoin("com", "spr.communicationItems") .AddJoin("comt", "com.Type") .SetResultTransformer(new DistinctRootEntityResultTransformer()) .List<Customer>(); Doing so an exception is thrown. This is because I try to list customers .List<Customer>() but the transformer returns only entities of the last join added. E.g. in the case above, the entity with alias "comt" is returned when doing .List() instead of .List(). If I would switch last join with the join alias "cty", then the transformer returns a list of cities only... Anyone knows how I can return a clean list of customers in this case?

    Read the article

  • Why does a non-constant offsetof expression work?

    - by Chris J. Kiick
    Why does this work: #include <sys/types.h> #include <stdio.h> #include <stddef.h> typedef struct x { int a; int b[128]; } x_t; int function(int i) { size_t a; a = offsetof(x_t, b[i]); return a; } int main(int argc, char **argv) { printf("%d\n", function(atoi(argv[1]))); } If I remember the definition of offsetof correctly, it's a compile time construct. Using 'i' as the array index results in a non-constant expression. I don't understand how the compiler can evaluate the expression at compile time. Why isn't this flagged as an error?

    Read the article

  • Objective-c when to release objects

    - by Chris
    -(IBAction)registerUpdate:(id)sender { HTTPRequest* request = [[HTTPRequest alloc] initWithUrl:@"http://www.yahoo.com" delegate:self]; [request doRequest]; } The HTTPRequest makes an asynchronous request and calls the onHTTPResponse method in the current class. My question is do I have to release request? My guess is that I'm supposed to make it an instance variable? [NSString stringWithFormat:@"Data received: %@", [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]]; How would I release that string object, or should I assign it to a variable?

    Read the article

< Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >