Search Results

Search found 763 results on 31 pages for 'union'.

Page 23/31 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • How do I dynamically define an instance variable?

    - by Moses
    Hi everyone, I have two classes (class1 and class2) that just store data, no methods. I have a third class that has an instance variable that, depending on some user input, will be set to one of the two classes. So, in the third class I declare the variable generically as NSObject *aClass; and during runtime set it to whatever it should be. aClass = [[Class1 alloc] init]; // or aClass = [[Class2 alloc] init]; However, when I try to access fields from aClass NSString *str = aClass.field1; It gives me the error: request for member 'field1' in something not a structure or a union. Field1 is declared in both class1 and class2. When I try to cast aClass aClass = (Class1 *) aClass; it gives the same error. What am I doing wrong, is there a better way to do this?

    Read the article

  • Allocation Target of std::aligned_storage (stack or heap?)

    - by Zenikoder
    I've been trying to get my head around the TR1 addition known as aligned_storage. Whilst reading the following documents N2165, N3190 and N2140 I can't for the life of me see a statement where it clearly describes stack or heap nature of the memory being used. I've had a look at the implementation provided by msvc2010, boost and gcc they all provide a stack based solution centered around the use of a union. In short: Is the memory type (stack or heap) used by aligned_storage implementation defined or is it always meant to be stack based? and, What the is the specific document that defines/determines that?

    Read the article

  • Constructing a function call in C

    - by 0x6adb015
    Given that I have a pointer to a function (provided by dlsym() for example) and a linked list of typed arguments, how can I construct a C function call with those arguments? Example: struct param { enum type { INT32, INT64, STRING, BOOL } type; union { int i32; long long i64; char *str; bool b; } value; struct param *next; }; int call_this(int (*function)(), struct param *args) { int result; /* magic here that calls function(), which has a prototype of f(int, long long, char *, bool); , when args consist of a linked list of INT32, INT64, STRING, BOOL types. */ return result; } The OS is Linux. I would like the solution to be portable across MIPS, PPC and x86 (all 32 bits) architecture, using GCC as the compiler. Thanks!

    Read the article

  • F#: Can't hide a type abbreviation in a signature? Why not?

    - by Nels Beckman
    In F#, I'd like to have what I see as a fairly standard Abstract Datatype: // in ADT.fsi module ADT type my_Type // in ADT.fs module ADT type my_Type = int In other words, code inside the module knows that my_Type is an int, but code outside does not. However, F# seems to have a restriction where type abbreviations specifically cannot be hidden by a signature. This code gives a compiler error, and the restriction is described here. If my_Type were instead a discriminated union, then there is no compiler error. My question is, why the restriction? I seem to remember being able to do this in SML and Ocaml, and furthermore, isn't this a pretty standard thing to do when creating an abstract datatype? Thanks

    Read the article

  • Use content of fieldnames in query..

    - by rokdd
    Hi, i have three mysql tables: Table 456 id | binder | property1 1 | b | hello 2 | b | goodbye 3 | a | bonjour Table binder id | binder | tableid1 | tableid2 1 | a | 23 | 456 2 | b | 21 | 456 3 | c | 45 | 42 Table 21 id | property1 | data.. 1 | goodbye | data about goodbye.. 2 | ciao | data about ciao.. So first i want to select in binder the binder i need to get the tablesname where data is stored. So i need to select table by a fieldname in this case the fieldname is tableid1 and would have the content 21 so that i have to look in 21. AND it should be property 1 from table 456 and table 21 the same... i am using php and already tried with union and subquerys but it seems that i am to silly to prepare such query!

    Read the article

  • Recursive CTE with alternating tables

    - by SOfanatic
    I've created a SQL fiddle here. Basically, I have 3 tables BaseTable, Files, and a LinkingTable. The Files table has 3 columns: PK, BaseTableId, RecursiveId (ChildId). What I want to do is find all the children given a BaseTableId (i.e., ParentId). The tricky part is that the way the children are found works like this: Take ParentId 1 and use that to look up a FileId in the Files table, then use that FileId to look for a ChildId in the LinkingTable, if that record exists then use the RecursiveId in the LinkingTable to look for the next FileId in the Files table and so on. This is my CTE so far: with CTE as ( select lt.FileId, lt.RecursiveId, 0 as [level], bt.BaseTableId from BaseTable bt join Files f on bt.BaseTableId = f.BaseTableId join LinkingTable lt on f.FileId = lt.FileId where bt.BaseTableId = @Id UNION ALL select rlt.FileId, rlt.RecursiveId, [level] + 1 as [level], CTE.BaseTableId from CTE --??? and this is where I get lost ... ) A correct output for BaseTableId = 1, should be: FileId|RecursiveId|level|BaseTableId 1 1 0 1 3 2 1 1 4 3 2 1

    Read the article

  • How can I join this 2 queries?(A select query with join and An unpivot query)

    - by MANG KANOR
    Here are my two queries SELECT EWND.Position, NKey = CASE WHEN ISNULL(Translation.Name, '') = '' THEN EWND.Name ELSE Translation.Name END, Unit = EW_N_DEF.Units FROM EWND INNER JOIN EW_N_DEF ON EW_N_DEF.Nutr_No = EWND.Nutr_No LEFT JOIN Translation ON Translation.CodeMain = EWND.Nutr_no WHERE Translation.CodeTrans = 1 ORDER BY EWND.Position And this is the unpivot one SELECT * FROM (SELECT N1,N2,N3,N4,N5,N6,N7,N8,N9,N10,N11,N12,N13,N14,N15,N16,N17,N18,N19,N20,N21,N22,N23,N24,N25,N26,N27,N28,N29,N30,N31,N32,N33,N34 FROM EWNVal WHERE Code=6035) Test UNPIVOT (Value FOR NUTCODE IN (N1,N2,N3,N4,N5,N6,N7,N8,N9,N10,N11,N12,N13,N14,N15,N16,N17,N18,N19,N20,N21,N22,N23,N24,N25,N26,N27,N28,N29,N30,N31,N32,N33,N34) )AS test Both Queries put out same number of rows but not columns, Is it possible to join this two? I tried the union but it has problems that I cant solve Thanks in advance!

    Read the article

  • Concatenating Strings in Obj C

    - by eco_bach
    Hi It seems that Objective C jumps thru hoops to make seemingly simple tasks extremely difficult. I simply need to create a sequence of strings, image1.jpg, image2.jpg, etc etc ie in a loop var imgString:String='image'+i+'.jpg; I assume a best practice is to use a NSMutableString with appendString method? What am I doing wrong?? NSMutableString *imgString; for(int i=1;i<=NUMIMAGES;i++){ imgString.appendString(@"image"+i+@".jpg"); } I get the following error error: request for member 'appendString' in something not a structure or union

    Read the article

  • How to read changed values with native query during one transaction? (Spring and JPA)

    - by knarf1983
    We have container transaction with Spring and JPA (Hibernate). I need to make an update on a table to "flag" some rows via native statements. Then we insert some rows via EntityManager from JPATemplate to this table. After that, we need to calculate changes in the table via native statement (with Oracle's union and minus, complex groups...) I see that changes from step 1 and 2 are not commited and thats why the statement from 3 fails. I already tried with transaction propagation REQUIRES_NEW, EntityManager.flush... Didn't work. 1) update SOMETABLE acolumn = somevalue (native) 2) persist some values into SOMETABLE (via entity manager) 3) select values from SOMETABLE Is there a possibility to read the changes from step 1 and 2 in step 3?

    Read the article

  • How to dynamically write the query in SQL Server 2008?

    - by user1237131
    How to write the dynamically the below query? Table empid designation interestes 1 developer,tester cricket,chess 1 developer chess 1 techlead cricket Condition: IF empid = 1 AND (designation LIKE '%developer%' OR designationLIKE '%techlead%') OR (interests LIKE '%cricket%'). How to write the above query dynamically if designations need to send more than 2,and also same on interstes . please tell me ... EDIT stored procedure code: ALTER PROCEDURE [dbo].[usp_GetDevices] @id INT, @designation NVARCHAR (MAX) AS BEGIN declare @idsplat varchar(MAX) set @idsplat = @UserIds create table #u1 (id1 varchar(MAX)) set @idsplat = 'insert #u1 select ' + replace(@idsplat, ',', ' union select ') exec(@idsplat) Select id FROM dbo.DevicesList WHERE id=@id AND designation IN (select id1 from #u1) END

    Read the article

  • SQL Server 2008 Delete Records from Self-Referencing Table in correct order

    - by KTrace
    I need to delete a sub set of records from a self-referencing table in SQL Server 2008. I am trying to do the following but it is does not like the order by. WITH SelfReferencingTable (ID, depth) AS ( SELECT id, 0 as [depth] FROM dbo.Table WHERE parentItemID IS NULL AND [t].ColumnA = '123' UNION ALL SELECT [t].ID, [srt].[depth] + 1 FROM dbo.Table t INNER JOIN SelfReferencingTable srt ON [t].parentItemID = [srt].id WHERE [t].ColumnA = '123' ) DELETE y FROM dbo.Table y JOIN SelfReferencingTable x on x.ID = y.id ORDER BY x.depth DESC Any ideas why this isn't working?

    Read the article

  • Separating merged array of arithmetic and geometric series

    - by user1814037
    My friend asked me an interseting question. Given an array of positive integers in increasing order. Seperate them in two series, an arithmetic sequence and geometric sequence. The given array is such that a solution do exist. The union of numbers of the two sequence must be the given array. Both series can have common elements i.e. series need not to be disjoint. The ratio of the geometric series can be fractional. Example: Given series : 2,4,6,8,10,12,25 AP: 2,4,6,8,10,12 GP: 4,10,25 I tried taking few examples but could not reach a general way. Even tried some graph implementation by introducing edges if they follow a particular sequence but could not reach solution.

    Read the article

  • How to use pointers and pointer aritmetic

    - by booby
    : error C2064: term does not evaluate to a function taking 1 arguments : error C2227: left of '-name' must point to class/struct/union/generic type how do i fix this so this error doesn't happen for(int index = 0; index < (numStudents); index++) { if (student(index + 1)->score >= 90 ) student(index + 1)->grade = 'A'; else if (student(index + 1)->score >= 80 ) student(index + 1)->grade = 'B'; else if (student(index + 1)->score >= 70 ) student(index + 1)->grade = 'C'; else if (student(index + 1)->score >= 60 ) student(index + 1)->grade = 'D'; else student(index + 1)->grade = 'F'; }

    Read the article

  • C struct print, decode this code?

    - by pauliwago
    I am in the process of studying for a test, and I'm trying to work through some practice problems. I've been working on this a while now..but can't figure it out. Please take a look at the code fragment: union { int i; short x; unsigned short u; float f; } testout; testout.i=0xC0208000; Before I ask the question, can someone please explain to me how the above code works?? My guess is that testout.i=0xC0208000 puts either an int, short, unsigned short, or float and puts the result in that address. (?) The question is what prints out if we write printf("%d", testout.x)? I know we should expect digits....but I have no idea where they are getting the digits from....there is no output. Any explanation would be greatly appreciated. Thanks!

    Read the article

  • How to implement a set ?

    - by nomemory
    I want to implement a Set in C. Is it OK to use a linked list, when creating the SET, or should I use another approach ? How do you usually implement your own set (if needed). NOTE: If I use the Linked List approach, I will probably have the following complexities for my operations: init : O(1); destroy: O(n); insert: O(n); remove: O(n); union: O(n*m); intersection: O(n*m); difference: O(n*m); ismember: O(n); issubset: O(n*m); setisequal: O(n*m); O(n*m) seems may be a little to big especially for huge data... Is there a way to implement my Set more efficient ?

    Read the article

  • Get recursive data with sql server

    - by user228777
    I am trying to get recursive data. Following code returns all parents on the top and then the children. I would like to get data Parent 1 – his children then parent 2 - his children then parent3 – his children. How do I do this? USE Subscriber GO WITH Parent (ParentId, Id, Name,subscriberID) AS ( -- Anchor member definition SELECT A.ParentId,A.id, A.name,A.SubscriberId FROM Subscriber.Budget.SubscriberCategory AS A WHERE ParentId IS NULL UNION ALL -- Recursive member definition SELECT B.ParentId, B.id, B.name,B.SubscriberId FROM Subscriber.Budget.SubscriberCategory AS B INNER JOIN Parent AS P ON B.ParentId = P.Id ) -- Statement that executes the CTE SELECT parentId, id, name FROM Parent where subscriberID = '1C18093B-5031-42E4-9251-CEF69114365F' GO

    Read the article

  • Customers and suppliers database design issue

    - by hectorsq
    I am developing a web application in which I will have customers and suppliers. Initially I thought on using a Customers table and a Suppliers table. Then when I was thinking on bank transactions, I noticed that each transaction needs to refer to a customer or a supplier, so I thought on using a single table named Business in which I will save both customers and suppliers. If I use Customers and Suppliers tables when I want to list the bank transactions I will have to search in both tables to get the company name. If I use a Businesses table I will have to use a business type column, and have the union of possible fields for all businesses types. Any suggestions on the design?

    Read the article

  • Wpf Window resizes when computer is locked.

    - by Chris
    I have a Window set to the height and width of my monitors: var r = System.Drawing.Rectangle.Union( System.Windows.Forms.Screen.AllScreens[0].Bounds, System.Windows.Forms.Screen.AllScreens[1].Bounds ); Height = r.Height; Width = r.Width; This is all fine until I Lock my computer (WIN+L), when I come back the window has resized itself to be on one monitor only. What I want to do is prevent the decrease in size, as I'm drawing on a canvas on the second monitor, and when the resize occurs, this is all lost.. Any thoughts on how I can prevent this? Cheers!

    Read the article

  • what's the name of this language that description another language syntax?

    - by Boolean
    for example: <SELECT statement> ::= [WITH <common_table_expression> [,...n]] <query_expression> [ ORDER BY { order_by_expression | column_position [ ASC | DESC ] } [ ,...n ] ] [ COMPUTE { { AVG | COUNT | MAX | MIN | SUM } ( expression ) } [ ,...n ] [ BY expression [ ,...n ] ] ] [ <FOR Clause>] [ OPTION ( <query_hint> [ ,...n ] ) ] <query_expression> ::= { <query_specification> | ( <query_expression> ) } [ { UNION [ ALL ] | EXCEPT | INTERSECT } <query_specification> | ( <query_expression> ) [...n ] ] <query_specification> ::= SELECT [ ALL | DISTINCT ] [TOP expression [PERCENT] [ WITH TIES ] ] < select_list > [ INTO new_table ] [ FROM { <table_source> } [ ,...n ] ] [ WHERE <search_condition> ] [ <GROUP BY> ] [ HAVING < search_condition > ] whats the language called?

    Read the article

  • Creating a multi-row "table" as part of a SELECT

    - by Chad Birch
    I'm not really sure how to describe my question (thus the awful title), but it's related to this recent question. The problem would be easily solved if there was some way for me to create a "table" with 4 rows as part of my SELECT (to use with NOT IN or MINUS). What I mean is, I can do this: SELECT 1, 2, 3, 4; And will receive one row from the database: | 1 | 2 | 3 | 4 | But is there any way to receive the following (without using UNION, I don't really want a query that's potentially thousands of lines long with a long list)? | 1 | | 2 | | 3 | | 4 |

    Read the article

  • Weakly connected balanced digraph

    - by user1074557
    How can I prove that if a balanced digraph is weakly connected, then it is also strongly connected? (balanced digraph means that for every node, it's indegree and outdegree is the same and weakly connected means the non-directed version of this graph is connected). What I can think of so far is: if the graph is balanced, it means it is a union of directed cycles. So if I remove any cycle, it will stay balanced. Also each vertex in the cycle has one edge coming into it and one edge leading out of it.. Then I guess I need to use some contradiction or induction to prove that the graph is strongly connected.. That's where I confused.

    Read the article

  • how to select all the data from many tables?

    - by Syom
    how to select all the data from many tables? i try `"SELECT * FROM `table1`, `table2`"` , but result none understandable for me. it returns only some rows from table1, and 3 times all the data from table2. i've red one same question here, but don't understand the answer. so could you help me? thanks in advance. update: when i try (SELECT * FROM `videos`) UNION (SELECT * FROM `users`) it returns #1222 - The used SELECT statements have a different number of columns

    Read the article

  • finding elements in python association lists efficiently

    - by user248237
    I have a set of lists that look like this: conditions = [ ["condition1", ["sample1", "sample2", "sample3"]], ["condition2", ["sample4", "sample5", "sample6"], ...] how can I do the following things efficiently and elegantly in Python? Find all the elements in a certain condition? e.g. get all the samples in condition2. Right now I can do: for cond in conditions: cond_name, samples = cond if cond_name == requested_cond: return samples but that's clunky. Find the ordered union of a list of conditions? E.g. ordered_union(["condition1", "condition2"], conditions) should return: ["sample1", "sample2", "sample3", "sample4", "sample5", "sample6"] How can I do this efficiently in Python? There are probably clever one liners?

    Read the article

  • Why is [date] + [time] non-deterministic in SQL Server 2008?

    - by John Gietzen
    I'm trying to do the following for my IIS logs table: ALTER TABLE [W3CLog] ADD [LogTime] AS [date] + ([time] - '1900-01-01') PERSISTED However, SQL Server 2008 tells me: Computed column 'LogTime' in table 'W3CLog' cannot be persisted because the column is non-deterministic. The table has this definition: CREATE TABLE [dbo].[W3CLog]( [Id] [bigint] IDENTITY(1,1) NOT NULL, ... [date] [datetime] NULL, [time] [datetime] NULL, ... ) Why is that non-deterministic? I really need to index that field. The table currently has 1598170 rows, and it is a pain to query if we can't do an index seek on the full time. Since this is being UNION'd with some other log formats, we can't very easily just use the two columns separately.

    Read the article

  • SP: Random Records, Fave Record, Plus Known Record, NO repetition.

    - by Munklefish
    Hi, Thanks to help from a lot of you guys ive been given the following code which works great. However ive realised ive missed an important bit of info out of the question and so have reposted here (with updated code) to clarify. The following code gets 5 random records from a table plus a further single record based on the users favourite as identified in a second table: CREATE PROCEDURE web.getRandomCharities ( @tmp_ID bigint --members ID ) AS BEGIN WITH q AS ( SELECT TOP 5 * FROM TBL_CHARITIES WHERE cha_Active = 'TRUE' AND cha_Key != '1' ORDER BY NEWID() ) SELECT * FROM q UNION ALL SELECT TOP 1 * FROM ( SELECT * FROM TBL_CHARITIES WHERE TBL_CHARITIES.cha_Key IN ( SELECT members_Favourite FROM TBL_MEMBERS WHERE members_Id = @tmp_ID ) EXCEPT SELECT * FROM q ) tc END However, i realised i also need to include the record where "cha_Key == '1'" if it isnt the same as the record returned in the second SELECT statement in the code shown above. HOpe that makes sense? THANKS!!!

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >