Search Results

Search found 8286 results on 332 pages for 'defined'.

Page 189/332 | < Previous Page | 185 186 187 188 189 190 191 192 193 194 195 196  | Next Page >

  • SQL Function for On Balance Volume (Financial Query)

    - by CraigJSte
    I would like to create a function for On Balance Volume (SQL Function). This is too complex of a calculation for met to figure out but here is the outline of the User Defined Table Function. If someone could help me to fill in the blanks I would appreciate it. Craig CREATE FUNCTION [dbo].[GetStdDev3] (@TKR VARCHAR(10)) RETURNS @results TABLE ( dayno SMALLINT IDENTITY(1,1) PRIMARY KEY , [date] DATETIME , [obv] FLOAT ) AS BEGIN DECLARE @rowcount SMALLINT INSERT @results ([date], [obv]) // CREATE A FUNCTION FOR ON BALANCE VOLUME // On Balance Volume is the Summ of Volume for Total Periods // OBV = 1000 at Period = 0 // OBV = OBV Previous + Previous Volume if Close Previous Close // OBV = OBV Previous - Previous Volume if Close < Previous Close // OBV = OBV Previous if Close = Previous Close // The actual Value of OBV is not important so to keep the ratio low we reduce the // Total Value of Tickers by 1/10th or 1/100th // For Value of Volume = Volume * .01 if Volume < 999 // For Value of Volume = Volume * .001 If Volume = 999 FROM Tickers RETURN END This is the Tickers table [dbo].[Tickers]( [ticker] [varchar](10) NULL, [date] [datetime] NULL, [high] [float] NULL, [low] [float] NULL, [open] [float] NULL, [close] [float] NULL, [volume] [float] NULL, [time] [datetime] NULL, [change] [float] NULL )

    Read the article

  • Custom setter methods in Core-Data

    - by andrewebling
    I need to write a custom setter method for a field (we'll call it foo) in my subclass of NSManagedObject. foo is defined in the data model and Xcode has autogenerated @property and @dynamic fields in the .h and .m files respectively. If I write my setter like this: - (void)setFoo: (NSObject *)inFoo { [super setFoo: inFoo]; [self updateStuff]; } then I get a compiler warning on the call to super. Alternatively, if I do this: - (void)setFoo: (NSObject *)inFoo { [super setValue: inFoo forKey: inFoo]; [self updateStuff]; } then I end up in an infinite loop. So what's the correct approach to write a custom setter for a subclass of NSManagedObject?

    Read the article

  • Problem accessing base member in derived constructor

    - by LeopardSkinPillBoxHat
    Given the following classes: class Foo { struct BarBC { protected: BarBC(uint32_t aKey) : mKey(aKey) mOtherKey(0) public: const uint32_t mKey; const uint32_t mOtherKey; }; struct Bar : public BarBC { Bar(uint32_t aKey, uint32_t aOtherKey) : BarBC(aKey), mOtherKey(aOtherKey) // Compile error here }; }; I am getting a compilation error at the point indicated: error: class `Foo::Bar' does not have any field named `mOtherKey'. Can anyone explain this? I suspect it's a syntactical problem due to my Bar class being defined within the Foo class, but can't seem to find a way around it. This is simple public inheritance, so mOtherKey should be accessible from the Bar constructor. Right? Or is it something to do with the fact that mOtherKey is const and I have already initialised it to 0 in the BarBC constructor?

    Read the article

  • should variable be retained or not? iphone-sdk

    - by psebos
    Hi, in the following piece of code I got from a book. The NSString *pPath which is defined in the class as an instance variable. @interface MainViewController : UIViewController { NSString *pPath; } In the implementation after being set it is being retained. I assume that with the assignment the object is automatically retained (because it is an NSString) and there is no need to additionally retain it. - (void) initPrefsFilePath { NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; pPath = [documentsDirectory stringByAppendingPathComponent: @"flippingprefs.plist"]; [pPath retain]; }

    Read the article

  • Using JavaScript to render HTML; nothing appearing but values will alert

    - by Jack Roscoe
    Hi, I'm taking some information from some variables I have already defined outside this function to create a html svg text box. Here is the function which is causing me trouble: RenderTextBox:function() { alert('this.x: ' + this.x); alert('this.y: ' + this.y); this.textBox = paper.text(this.x, this.y, this.htmlTextBox); } The alerts works prefectly, and prompt me with the values expected. However, the final line which is supposed to create the text box puts them nowhere to be seen. Does anybody know why? If I replace 'this.x, this.y..' with numerical values in the final line of the function, the text box is placed correctly. It's only when I use the 'this.x' and 'this.y' that I have issues.

    Read the article

  • How do you debug c/c++ source code in linux using emacs?

    - by vmihai
    Hello all, I am using emacs and autotools, to write and compile c/c++ sources on linux. I am using gdb via GUD in emacs. I have defined for convenience: F7:compile, F10:gud-next, F11:gud-step, F5:gud-cont, F9:gud-tbreak, F8:gud-until, F4:gud-print. I am mainly interested in debugging c/c++ source code on linux from emacs and I would like to get the most gdb can give. Unfortunately I am using only F4 which prints the variable under cursor. So my question is how do you guys debug the source code ? What programs do you use ? What key bindings (functionality) do you use mostly ? What do you need the debugger to do for you ? If you do weird stuff it doesn't matter. I would like to know everything to boost my speed a bit here. Thanks in advance. Mihai

    Read the article

  • group_concat on an empty join in MySQL

    - by Yossarian
    Hello, I've got the following problem: I have two tables: (simplified) +--------+ +-----------+ | User | | Role | +--------+ +-----------+ | ID<PK> | | ID <PK> | +--------+ | Name | +-----------+ and M:N relationship between them +-------------+ | User_Role | +-------------+ | User<FK> | | Role<FK> | +-------------+ I need to create a view, which selects me: User, and in one column, all of his Roles (this is done by group_concat). I've tried following: SELECT u.*, group_concat(r.Name separator ',') as Roles FROM User u LEFT JOIN User_Role ur ON ur.User=u.ID LEFT JOIN Role r ON ur.Role=r.ID GROUP BY u.ID; However, this works for an user with some defined roles. Users without role aren't returned. How can I modify the statement, to return me User with empty string in Roles column when User doesn't have any Role? Explanation: I'm passing the SQL data directly to a grid, which then formats itself, and it is easier for me to create slow and complicated view, than to format it in my code. I'm using MySQL

    Read the article

  • Does django take SCRIPT_NAME into account when using the default LOGIN_URL

    - by DanJ
    Hi, I'm using Django 1.0.2 and trying to figure out how to get the @login_required working correctly. When I use the built-in server it redirects to the default login_url, or my LOGIN_URL as defined in settings.py as expected. What is not clear to me is how to deploy to the server where my site is not at the root. In my templates I use the url template tag, and in the views I can access request.META['SCRIPT_NAME'], but for some reason it doesn't seem to apply to the LOGIN_URL used. What am I missing? Thanks.

    Read the article

  • silverlight adding single prism command delegate to a list of items in xaml

    - by bobwah
    I'm building a menu using Prism (using a trtelerik tree view with hierarchy data templates but hopefully the details don't matter) and I'm trying to set up a Click.Command on each menu items bindings that will all call the same delegate command which is defined in the view model. The menu is built up out of items which I don't really want to put any references to the command in. How do I bind the command to each of these items in xaml? I've looked around and it looks like in WPF I could use a relative source binding and find ancestors but there doesn't seem to be a way of doing this in silverlight. Can I setup the delegate as a static resource somehow? I don't think I can create a static resource to the view model as this uses Unity to resolve paramters to it's constructor.

    Read the article

  • mapping list of different types implementing same function?

    - by sisif
    I want to apply a function to every element in a list (map) but the elements may have different types but all implement the same function (here "putOut") like an interface. However I cannot create a list of this "interface" type (here "Outputable"). How do I map a list of different types implementing the same function? main :: IO () main = do map putOut lst putStrLn "end" where lst :: [Outputable] -- ERROR: Class "Outputable" used as a type lst = [(Out1 1),(Out2 1 2)] class Outputable a where putOut :: a -> IO () -- user defined: data Out1 = Out1 Int deriving (Show) data Out2 = Out2 Int deriving (Show) instance Outputable Out1 where putOut out1 = putStrLn $ show out1 instance Outputable Out2 where putOut out2 = putStrLn $ show out2 I cannot define it this way: data Out = Out1 Int | Out2 Int Int putOut Out1 = ... putOut Out2 = ... because this is a library and users should be able to extend Out with their own types

    Read the article

  • Send copy of class to view class so it can render him? ( iPhone )

    - by Johannes Jensen
    I'm making a game for the iPhone, and I have a class called Robot. Then I have a class called View, which renders everything. I want to send a copy of my Robot, which I defined in my ViewController, and I send it to gameView (which is View *gameView), like this: robot = [Robot new]; [gameView setRobot: [robot copy]]; I tried to make a copy but that didn't work, I could also do it with a pointer to Robot (&robot) but sometimes it just crashes ? I tried this in my View.h @interface definition: @property (copy) Robot* robot; but I get the error /RobotsAdventure/Classes/View.h:24: error: setter '-robot' argument type does not match property type :/ Help? I'm pretty new at this, heh.

    Read the article

  • How can I return something other than an enum from an NServiceBus endpoint exposed as a WCF service?

    - by Todd Stout
    I have a service exposed as WCF via NServiceBus. Ultimately, I'd like to call to this service from silverlight. My WCF Service Interface looks like this: [ServiceContract] public interface ISettingsService { [OperationContract(Action = "http://tempuri.org/IWcfServiceOf_RequestSettingsMessage_SettingsResponseMessage/Process", ReplyAction = "http://tempuri.org/IWcfServiceOf_RequestSettingsMessage_SettingsResponseMessage/ProcessResponse") ] SettingsResponseMessage FetchSettings(RequestSettingsMessage request); } My NSB WCF service is defined as: public class CoreService : WcfService<RequestSettingsMessage, SettingsResponseMessage> { } When I invoke the FetchSettings method on the service, I get an exception: System.TypeInitializationException: The type initializer for 'NServiceBus.WcfSer vice`2' threw an exception. ---- System.InvalidOperationException: Centerlink.Services.Core.Msg.Settings.SettingsResponseMessage must be an enum representing error codes returned by the server. It seems that the WcfService< class is restricting the return type of a WCF method to be an enum. How can I have my service return something other than an enum? Do I need to create a custom implementation of NServiceBus.WcfService<?

    Read the article

  • c++ function overloading, making fwrite/fread act like PHP versions

    - by Newbie
    I'm used to the PHP fwrite/fread parameter orders, and i want to make them the same in C++ too. I want it to work with char and string types, and also any data type i put in it (only if length is defined). I am total noob on c++, this is what i made so far: size_t fwrite(FILE *fp, const std::string buf, const size_t len = SIZE_MAX){ if(len == SIZE_MAX){ return fwrite(buf.c_str(), 1, buf.length(), fp); }else{ return fwrite(buf.c_str(), 1, len, fp); } } size_t fwrite(FILE *fp, const void *buf, const size_t len = SIZE_MAX){ if(len == SIZE_MAX){ return fwrite((const char *)buf, 1, strlen((const char *)buf), fp); }else{ return fwrite(buf, 1, len, fp); } } Should this work just fine? And how should this be done if i wanted to do it the absolutely best possible way?

    Read the article

  • Pointer to a C++ class member function as a global function's parameter?

    - by marcin1400
    I have got a problem with calling a global function, which takes a pointer to a function as a parameter. Here is the declaration of the global function: int lmdif ( minpack_func_mn fcn, void *p, int m, int n, double *x, double *fvec, double ftol) The "minpack_func_mn" symbol is a typedef for a pointer to a function, defined as: typedef int (*minpack_func_mn)(void *p, int m, int n, const double *x, double *fvec, int iflag ); I want to call the "lmdif" function with a pointer to a function which is a member of a class I created, and here is the declaration of this class function: int LT_Calibrator::fcn(void *p, int m, int n, const double *x, double *fvec,int iflag) I am calling a global function like this: info=lmdif(&LT_Calibrator::fcn, 0, m, n, x, fvec, ftol) Unfortunately, I get a compiler error, which says: "error C2664: 'lmdif' : cannot convert parameter 1 from 'int (__thiscall LT_Calibrator::* )(void *,int,int,const double *,double *,int)' to 'minpack_func_mn' 1 There is no context in which this conversion is possible" Is there any way to solve that problem?

    Read the article

  • NHibernate Many-to-many with a boolean flag on the association table

    - by Nigel
    Hi I am doing some work on an application that uses an existing schema that cannot be altered. Whilst writing my NHibernate mappings I encountered a strange many-to-many relationship. The relationship is defined in the standard way as in this question with the addition of a boolean flag on the association table that signifies if the relationship is legal. This seems somewhat redundant but as I say, cannot be changed. Is it possible to define this relationship in Nhibernate without resorting to using a third class to represent the association? Perhaps by applying a filter? Many thanks.

    Read the article

  • How to generate a .po file?

    - by tobefound
    On Windows using WAMPserver (Apache, MySql, Php) I have the following: //test.php if (!defined('LC_MESSAGES')) define('LC_MESSAGES', 6); $lang = "sv"; putenv("LANG=$lang"); setlocale(LC_ALL, $lang); $domain = "messages"; bindtextdomain($domain, "./locale"); textdomain($domain); echo _("This is a string"); It works fine, i.e. it outputs "This is a string" which means I have gettext correctly setup up. But HOW in the world do I create a .po-file? I downloaded POEdit but I can't see how to make this happen with that software. ANy help is greatly appreciated!

    Read the article

  • Subdividing 3D mesh into arbitrarily sized pieces

    - by Groky
    I have a mesh defined by 4 points in 3D space. I need an algorithm which will subdivide that mesh into subdivisions of an arbitrary horizontal and vertical size. If the subdivision size isn't an exact divisor of the mesh size, the edge pieces will be smaller. All of the subdivision algorithms I've found only subdivide meshes into exact powers of 2. Does anyone know of one that can do what I want? Failing that, my thoughts about a possible implementation is to rotate the mesh so that it is flat on the Z axis, subdivide in 2D and then translate back into 3D. That's because my mind finds 3D hard ;) Any better suggestions? Using C# if that makes any difference.

    Read the article

  • pointer delegate in STL set.

    - by ananth
    hi. Im kinda stuck with using a set with a pointer delegate. my code is as follows: void Graph::addNodes (NodeSet& nodes) { for (NodeSet::iterator pos = nodes.begin(); pos != nodes.end(); ++pos) { addNode(*pos); } } Here NodeSet is defined as: typedef std::set NodeSet; The above piece of code works perfectly on my windows machine, but when i run the same piece of code on a MAC, it gives me the following error: no matching function for call to 'Graph::addNode(const boost::shared_ptr&)' FYI, Node_ptr is of type: typedef boost::shared_ptr Node_ptr; can somebody plz tell me why this is happening?

    Read the article

  • Java Webservice with generic methods

    - by danby
    Hi, I was wondering if it is possible to make a generic webservice method in java like this: @WebMethod public <T extends Foo> void testGeneric(T data){ However when I try to consume this with a Java client I get an error stating: [ERROR] Schema descriptor {http://####/}testGeneric in message part "parameters" is not defined and could not be bound to Java. I know it is possible to make a method that takes a parameter such as List and this generates correctly using JAX-WS. I don't mind if there is a solution that means I am tied to using only a particular technology. Thanks, Dan.

    Read the article

  • Select records from XML column (SQL Server 2005) based on node order

    - by jdoe
    I have a column in a SQL Server 2005 table defined as an XML column. Is there a way to select records from this table based on the order of two nodes in that column? For example, we have the following structure in our XML: <item> <latitude/> <longitude/> </item> I want to see if there are any records that have latitude/longitude in the opposite order i.e. <longitude/> then <latitude/>. I've tried some XPath expressions but with no luck.

    Read the article

  • JVM specification and Java compiler code useful for SCJP preparation ?

    - by BenoitParis
    I'm preparing the SCJP exam with the almost official study book ("SCJP Sun Certified Programmer for Java 6 Exam 310-065") I understand that Java programming is writting code that fulfills a certain high-level contract; So that Java can stay platform-independent. However, I have trouble understanding and remembering things when it comes to highly specific SCJP items (and they are numerous) The book stays high-level and does not provide examples of how one compiler would handle things. This is the same thing for runtime issues (JVM level): things are too much abstract for me. Rules often seems arbitrary and therefore, with no well defined purpose, are difficult to remember. Or maybe it's that sometimes I just don't get the underlying purpose. And here is the question: Would a JVM specification and/or some java compiler code help in preparing the SCJP? Have you had the need for such material or is the book sufficient enough? Also, please share the resources you used, apart from the book.

    Read the article

  • How to determine MIME Type set by htaccess in PHP

    - by Ed Marty
    I have a .htaccess file set up to define specific MIME types in directory root/a/b/, and all of the files are in the same directory. I have a php file that wants to serve those files, in directory root/c/, and needs to determine the content-type as defined by the .htaccess file. Is there any way to do this? PHP version is 5.1.6. mime_content_type returns text/plain, and I'd rather not try to parse the .htaccess file manually. I can move the file if necessary.

    Read the article

  • fast scrolling background

    - by Andre
    i want a game that scrolls the background in a similar way to a UItableView. I solved it with a timer that moves the background up and brings another copy of the same picture up if (bg1.center.y <= - self.view.bounds.size.height/2 ) { bg1.center = CGPointMake(bg1.center.x, 690); } if (bg2.center.y <= - self.view.bounds.size.height/2 ) { bg2.center = CGPointMake(bg2.center.x, 690); bg1.center = CGPointMake(bg1.center.x, bg1.center.y - movement); bg2.center = CGPointMake(bg2.center.x, bg2.center.y - movement); But the faster i move the pictures the more problems occur: There are appearing gaps between the backgrounds and they are getting biggiger the faster i move them! movement is defined by the speed of swiping over the screen Any idea to solve that?

    Read the article

  • django: Selecting questions that was not asked

    - by Oleg Tarasenko
    Hi, I am creating small django application which holds some few questions (and answers for them) What I want to do is to show user random question, but only from those which was not solved by him yet. I wonder how to do this. For now, I defined user profile model this way: class UserProfile(models.Model): rank = models.IntegerField(default = 1) solvedQ = models.ManyToManyField(Question) user = models.ForeignKey(User, unique=True) So solved problems are added this way: if user.is_authenticated(): profile = user.get_profile() profile.rank += 1 profile.solvedQ.add(Question.objects.get(id=id)) Now if the view must show random question, but not from already solved list... Is there a good way to intersect Questions and solvedQuestions.... so question is chosen from the unsolved list?

    Read the article

  • Dreamweaver recordset filter - Display all records as default

    - by Drew
    I am trying to create a simple search form to filter the results in the dynamic table. The search form is on the same pages as the results and posts to itself. I get the search string from the post variable. It is working, but I can't figure out how to set the default value to display all results. Dreamweaver automatically sets the default value to -1, and therefore no results are displayed on the initial load. How do I change this to display ALL records as default and the filter only if there is search string defined.

    Read the article

< Previous Page | 185 186 187 188 189 190 191 192 193 194 195 196  | Next Page >