Search Results

Search found 470 results on 19 pages for 'scalar udf'.

Page 14/19 | < Previous Page | 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Simple vector program error

    - by Codeguru
    Hi iam new to c++ and iam trying out this vector program and i am getting the following error: error: conversion from test*' to non-scalar typetest' requested| Here is the code include include include include using namespace std; class test{ string s; vector <string> v; public: void read(){ ifstream in ("c://test.txt"); while(getline(in,s)) { v.push_back(s); } for(int i=0;i<v.size();i++) { cout<<v[i]<<"\n"; } } }; int main() { cout<<"Opening the file to read and displaying on the screen"< }

    Read the article

  • Maths: Determining angle in 3D space

    - by 742
    I hope this is the proper location to ask this question which is the same as this one, but expressed as pure math instead of graphically (at least I hope I translated the problem to math correctly). Considering: two vectors that are orthogonal: Up (ux, uy, uz) and Look (lx, ly, lz) a plane P which is perpendicular to Look (hence including Up) Y1 which is the projection of Y (vertical axis) along Look onto P Question: what is the value of the angle between Y1 and Up? As mathematicians will agree, this is a very basic question, but I've been scratching my head on walls now for at least two weeks without being able to visualize the solution... maybe now too old for finding solutions to school exercises. I'm looking for the scalar trigonometric solution, not a solution using a matrix. Thanks.

    Read the article

  • How do I return an empty result set from a procedure using T-SQL?

    - by Kivin
    I'm interested in returning an empty result set from SQL Server stored procedures in certain events. The intended behaviour is that a L2SQL DataContext.SPName().SingleOrDefault() will result in CLR null value. I'm presently using the following solution, but I'm unsure whether it would be considered bad practice, a performance hazard (I could not find one by reading the execution plan), or if there is simply a better way: SELECT * FROM [dbo].[TableName] WHERE 0 = 1; The execution plan is a constant scan with a trivial cost associated with it. The reason I am asking this instead of simply not running any SELECTs is because I'm concerned previous SELECT @scalar or SELECT INTO statements could cause unintended result sets to be served back to L2SQL. Am I worrying over nothing?

    Read the article

  • Continuous output in Neural Networks

    - by devoured elysium
    How can I set Neural Networks so they accept and output a continuous range of values instead of a discrete ones? From what I recall from doing a Neural Network class a couple of years ago, the activation function would be a sigmoid, which yields a value between 0 and 1. If I want my neural network to yield a real valued scalar, what should I do? I thought maybe if I wanted a value between 0 and 10 I could just multiply the value by 10? What if I have negative values? Is this what people usually do or is there any other way? What about the input? Thanks

    Read the article

  • 'Array of arrays' in matlab?

    - by waitinforatrain
    Hey, having a wee bit of trouble. Trying to assign a variable length 1d array to different values of an array, e.g. a(1) = [1, 0.13,0.52,0.3]; a(2) = [1, 0, .268]; However, I get the error: ??? In an assignment A(I) = B, the number of elements in B and I must be the same. Error in ==> lab2 at 15 a(1) = [1, 0.13,0.52,0.3]; I presume this means that it's expecting a scalar value instead of an array. Does anybody know how to assign the array to this value? I'd rather not define it directly as a 2d array as it is for are doing solutions to different problems in a loop Edit: Got it! a(1,1:4) = [1, 0.13,0.52,0.3]; a(2,1:3) = [1, 0, .268];

    Read the article

  • Fast dot product for a very special case

    - by psihodelia
    Given a vector X of size L, where every scalar element of X is from a binary set {0,1}, it is to find a dot product z=dot(X,Y) if vector Y of size L consists of the integer-valued elements. I suggest, there must exist a very fast way to do it. Let's say we have L=4; X[L]={1, 0, 0, 1}; Y[L]={-4, 2, 1, 0} and we have to find z=X[0]*Y[0] + X[1]*Y[1] + X[2]*Y[2] + X[3]*Y[3] (which in this case will give us -4). It is obvious that X can be represented using binary digits, e.g. an integer type int32 for L=32. Then, all what we have to do is to find a dot product of this integer with an array of 32 integers. Do you have any idea or suggestions how to do it very fast?

    Read the article

  • When does ref($variable) return 'IO'?

    - by Zaid
    Here's the relevant excerpt from the documentation of the ref function: The value returned depends on the type of thing the reference is a reference to. Builtin types include: SCALAR ARRAY HASH CODE REF GLOB LVALUE FORMAT IO VSTRING Regexp Based on this, I imagined that calling ref on a filehandle would return 'IO'. Surprisingly, it doesn't: use strict; use warnings; open my $fileHandle, '<', 'aValidFile'; close $fileHandle; print ref $fileHandle; # prints 'GLOB', not 'IO' perlref tries to explain why: It isn't possible to create a true reference to an IO handle (filehandle or dirhandle) using the backslash operator. The most you can get is a reference to a typeglob, which is actually a complete symbol table entry [...] However, you can still use type globs and globrefs as though they were IO handles. In what circumstances would ref return 'IO' then?

    Read the article

  • What is the magic behind perl read() function and buffer which is not a ref ?

    - by alex8657
    I do not get to understand how the Perl read($buf) function is able to modify the content of the $buf variable. $buf is not a reference, so the parameter is given by copy (from my c/c++ knowledge). So how come the $buf variable is modified in the caller ? Is it a tie variable or something ? The C documentation about setbuf is also quite elusive and unclear to me # Example 1 $buf=''; # It is a scalar, not a ref $bytes = $fh->read($buf); print $buf; # $buf was modified, what is the magic ? # Example 2 sub read_it { my $buf = shift; return $fh->read($buf); } my $buf; $bytes = read_it($buf); print $buf; # As expected, this scope $buf was not modified

    Read the article

  • jQuery.param() - doesn't serialize javascript Date objects?

    - by ehahn9
    jQuery.param({foo: 1}); // => "foo=1" - SUCCESS! jQuery.param({bar: new Date()}); // => "" - OUCH! There is no problem with encodeURIComponent(new Date()), which is what I would have thought param is calling for each member. Also, explicitly using "traditional" param (e.g. jQuery.param(xxx, true)) DOES serialize the date, but alas, that isn't of much help since my data structure isn't flat. Is this because typeof(Date) == "object" and param tries to descend into it to find scalar values? How might one realistically serialize an object that happens to have Date's in it for $.post() etc.?

    Read the article

  • Perl : localtime with print

    - by kiruthika
    Hi all, I have used the following statements to get the current time. print "$query executed successfully at ",localtime; print "$query executed successfully at ",(localtime); print "$query executed successfully at ".(localtime); Output executed successfully at 355516731103960 executed successfully at 355516731103960 executed successfully at Wed Apr 7 16:55:35 2010 The first two statements are not printing the current time in a date format. Third statement only giving the correct output in a date format. My understanding is the first one is returning a value in scalar context,so it is returning numbers. Then in the second print I used localtime in list context only,why it's also giving number output.

    Read the article

  • Transforming url with URI-module

    - by sid_com
    Do I gain something when I transform my $url like this: $url = URI-new( $url )? #!/usr/bin/env perl use warnings; use strict; use 5.012; use URI; use XML::LibXML; my $url = 'http://stackoverflow.com/'; $url = URI->new( $url ); my $doc = XML::LibXML->load_html( location => $url, recover => 2 ); my @nodes = $doc->getElementsByTagName( 'a' ); say scalar @nodes;

    Read the article

  • How do I pass (by value) a struct in Objective-C?

    - by Striker
    This one has been driving me mad! I have a struct: typedef struct{ int a; }myStruct; Then I have: myStruct tempStruct; I am trying to pass the struct to a class method whose implementation is: - (void) myFunc:(struct myStruct)oneOfMyStructs{}; I call the method like so: [myClass myFunc:(struct myStruct)tempStruct]; The compiler complains about "Conversion to non-scalar type requested." All I want to do is pass a struct into a class method, but the syntax has me a bit confused. I'm new to Objective-C. Please let me know if you can see where I'm going wrong. I've not been able to pass by reference either, so if you could help me out with that, that would be great! Thanks!

    Read the article

  • Aggregate functions in ANSI SQL

    - by morpheous
    I want to use multiple aggregate functions in a query. All the examples i have seem on aggregate functions however, are trivial. Typically, they are of the form: SELECT field1,agg_func1, agg_func2 GROUP BY SOME_COLUMNS HAVING agg_func1 OP SOME_SCALAR Where: OP: is a boolean operator (e.g. <, = etc) SOME_SCALAR: is a scalar (i.e. a constant number) What I want to know is if it is possible to write (IN ANSI SQL) queries like: SELECT field1,agg_func1, agg_func2, agg_func3 GROUP BY SOME_COLUMNS HAVING (agg_func1 OP1 agg_func2) OP2 (agg_func2 OP3 agg_func3) Where: OP[N] are boolean operators or ANSI SQL clause operators like 'BETWEEN', 'LIKE', 'IN' etc. Also, assuming this is possible (I have not seen any documentation saying otherwise) are there any efficiency/performance considerations (i.e. penalties) when the HAVING clause consists of a boolean expression combining the output of the aggregate functions - instead of the normal comparison of the output of the aggregate with a constant number (e.g. min('salary') 100 ) - which is often used in the most banal examples involving aggregate functions?

    Read the article

  • How can I convert a file full of unix time strings to human readable dates?

    - by skymook
    I am processing a file full of unix time strings. I want to convert them all to human readable. The file looks like so: 1153335401 1153448586 1153476729 1153494310 1153603662 1153640211 Here is the script: #! /bin/bash FILE="test.txt" cat $FILE | while read line; do perl -e 'print scalar(gmtime($line)), "\n"' done This is not working. The output I get is Thu Jan 1 00:00:00 1970 for every line. I think the line breaks are being picked up and that is why it is not working. Any ideas? I'm using Mac OSX is that makes any difference.

    Read the article

  • What do I gain by filtering URLs through Perl's URI module?

    - by sid_com
    Do I gain something when I transform my $url like this: $url = URI-new( $url )? #!/usr/bin/env perl use warnings; use strict; use 5.012; use URI; use XML::LibXML; my $url = 'http://stackoverflow.com/'; $url = URI->new( $url ); my $doc = XML::LibXML->load_html( location => $url, recover => 2 ); my @nodes = $doc->getElementsByTagName( 'a' ); say scalar @nodes;

    Read the article

  • Matlab - Propagate unit vectors on to the edge of shape boundaries

    - by Graham
    Hi I have a set of unit vectors which I want to propagate on to the edge of shape boundary defined by a binary image. The shape boundary is defined by a 1px wide white edge. I also have the coordinates of these points stored in a 2 row by n column matrix. The shape forms a concave boundary with no holes within itself made of around 2500 points. What would be the best method to do this? Are there some sort of ray tracing algorithms that could be used? Or would it be a case of taking the unit vector and multiplying it by a scalar and testing after multiplication if the end point of the vector is outside the shape boundary. When the end point of the unit vector is outside the shape, just find the point of intersection? Thank you very much in advance for any help!

    Read the article

  • processing a file full of unix time strings to human readble

    - by skymook
    I am processing a file full of unix time strings. I want to convert them all to human readable. The file looks like so: 1153335401 1153448586 1153476729 1153494310 1153603662 1153640211 Here is the script: #! /bin/bash FILE="test.txt" cat $FILE | while read line; do perl -e 'print scalar(gmtime($line)), "\n"' done This is not working. The output I get is Thu Jan 1 00:00:00 1970 for every line. I think the line breaks are being picked up and that is why it is not working. Any ideas? I'm using Mac OSX is that makes any difference.

    Read the article

  • using NEWSEQUENTIALID() with UPDATE Trigger

    - by Ram
    I am adding a new GUID/Uniqueidentifier column to my table. ALTER TABLE table_name ADD VersionNumber UNIQUEIDENTIFIER UNIQUE NOT NULL DEFAULT NEWSEQUENTIALID() GO And when ever a record is updated in the table, I would want to update this column "VersionNumber". So I create a new trigger CREATE TRIGGER [DBO].[TR_TABLE_NAMWE] ON [DBO].[TABLE_NAME] AFTER UPDATE AS BEGIN UPDATE TABLE_NAME SET VERSIONNUMBER=NEWSEQUENTIALID() FROM TABLE_NAME D JOIN INSERTED I ON D.ID=I.ID/* some ID which is used to join*/ END GO But just realized that NEWSEQUENTIALID() can only be used with CREATE TABLE or ALTER TABLE. I got this error The newsequentialid() built-in function can only be used in a DEFAULT expression for a column of type 'uniqueidentifier' in a CREATE TABLE or ALTER TABLE statement. It cannot be combined with other operators to form a complex scalar expression. Is there a workaround for this ? Edit1: Changing NEWSEQUENTIALID() to NEWID() in the trigger solves this, but I am indexing this column and using NEWID() would be sub-optimal

    Read the article

  • How to hash and check for equality of objects with circular references

    - by mfya
    I have a cyclic graph-like structure that is represented by Node objects. A Node is either a scalar value (leaf) or a list of n=1 Nodes (inner node). Because of the possible circular references, I cannot simply use a recursive HashCode() function, that combines the HashCode() of all child nodes: It would end up in an infinite recursion. While the HashCode() part seems at least to be doable by flagging and ignoring already visited nodes, I'm having some troubles to think of a working and efficient algorithm for Equals(). To my surprise I did not find any useful information about this, but I'm sure many smart people have thought about good ways to solve these problems...right? Example (python): A = [ 1, 2, None ]; A[2] = A B = [ 1, 2, None ]; B[2] = B A is equal to B, because it represents exactly the same graph. BTW. This question is not targeted to any specific language, but implementing hashCode() and equals() for the described Node object in Java would be a good practical example.

    Read the article

  • EntityFramework: using association or add property manualy

    - by dritterweg
    I'm starting to use Entity Framework. Let's say I have to Entity from my tables in DB. Here is the table schema Profiles ProfileId FirstName LastName Hobbies Id HobbyName OwnerId So one profile can have many hobbies. My Entity Framework: ProfileEntity ProfileId FirstName LastName Hobbies (collection of HobbyEntity) note: this created by the Association tool HobbyEntity Id HobbyName Owner (type of ProfileEntity) note: this created by the Association tool, for me this property is not important my question: should I use the "Association" tool to make the relationship between the two entities, which in result create a property of each entity (in ProfileEntity will create a HobbyEntity and vica versa) or should I not use the association and only add a scalar property manually such as List<HobbyEntity> in my ProfileEntity and OwnerId in HobbyEntity.

    Read the article

  • Query Execution Plan - When is the Where clause executed?

    - by Alex
    I have a query like this (created by LINQ): SELECT [t0].[Id], [t0].[CreationDate], [t0].[CreatorId] FROM [dbo].[DataFTS]('test', 100) AS [t0] WHERE [t0].[CreatorId] = 1 ORDER BY [t0].[RANK] DataFTS is a full-text search table valued function. The query execution plan looks like this: SELECT (0%) - Sort (23%) - Nested Loops (Inner Join) (1%) - Sort (Top N Sort) (25%) - Stream Aggregate (0%) - Stream Aggregate (0%) - Compute Scalar (0%) - Table Valued Function (FullTextMatch) (13%) | | - Clustered Index Seek (38%) Does this mean that the WHERE clause ([CreatorId] = 1) is executed prior to the TVF ( full text search) or after the full text search? Thank you.

    Read the article

  • Declare global variables for a batch of execution statements - sql server 2005

    - by Shrewd Demon
    hi, i have an SQL statement wherein i am trying to update the table on the client's machine. the sql statement is as follows: BEGIN TRANSACTION DECLARE @CreatedBy INT SELECT @CreatedBy = [User_Id] FROM Users WHERE UserName = 'Administrator' --//////////////////////////////////////////////////////////////////// --//////////////////////////////////////////////////////////////////// PRINT @CreatedBy --(Works fine here and shows me the output) PRINT N'Rebuilding [dbo].[Some_Master]' ALTER TABLE [dbo].[Some_Master] ADD [CreatedBy] [BIGINT] NULL, [Reason] [VARCHAR](200) NULL GO PRINT @CreatedBy --(does not work here and throws me an error) PRINT N'Updating data in [Some_Master] table' UPDATE Some_Master SET CreatedBy = @CreatedBy COMMIT TRANSACTION but i am getting the following error: Must declare the scalar variable "@CreatedBy". Now i have observed if i write the Print statement above the alter command it works fine and shows me its value, but if i try to print the value after the Alter command it throws me the error i specified above. I dont know why ?? please help! Thank you

    Read the article

  • jQuery selector to target any CSS name (of multiple present) starting with a prefix?

    - by John K
    I'm considering one selection statement that would target one of many css class names in a single class attribute value based on a string prefix. For example, I want any detail- prefixed class names to get targeted from the following sample links. <a href="eg.html" class="detail-1 pinkify another"> <a href="eg.html" class="something detail-55 minded"> <a href="eg.html" class="swing narrow detail-Z"> <a href="eg.html" class="swing narrow detail-Z detail-88 detail-A"> It's reminiscent of how [class|="detail"] prefix selector works on a scalar attribute value, and also of .hasClass(className), but my question needs both concepts applied simultaneously. Note: The detail- prefix won't necessarily be the first class name of the bunch.

    Read the article

  • Query to return substring from string in SQL Server

    - by Jowie
    I have a user defined function called Sync_CheckData under Scalar-valued functions in Microsoft SQL Server. What it actually does is to check the quantity of issued product and balance quantity are the same. If something is wrong, returns an ErrorStr nvarchar(255). Output Example: Balance Stock Error for Product ID : 4 From the above string, I want to get 4 so that later on I can SELECT the rows which is giving errors by using WHERE clause (WHERE Product_ID = 4). Which SQL function can I use to get the substring?

    Read the article

  • In Perl, is there a built in way to compare two arrays for equality?

    - by Bill
    I have two arrays of strings that I would like to compare for equality: my @array1 = ("part1", "part2", "part3", "part4"); my @array2 = ("part1", "PART2", "part3", "part4"); Is there a built-in way to compare arrays like there is for scalars? I tried: if (@array1 == @array2) {...} but it just evaluated each array in scalar context, and so compared the length of each array. I can roll my own function to do it, but it seems like such a low-level operation that there should be a built-in way to do it. Is there? Edit: sadly, I don't have access to 5.10+ or optional components.

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19  | Next Page >