Search Results

Search found 6988 results on 280 pages for 'if else statement'.

Page 138/280 | < Previous Page | 134 135 136 137 138 139 140 141 142 143 144 145  | Next Page >

  • Flexible array members in C - bad?

    - by Lionel
    I recently read that using flexible array members in C was poor software engineering practice. However, that statement was not backed by any argument. Is this an accepted fact? (Flexible array members are a C feature introduced in C99 whereby one can declare the last element to be an array of unspecified size. For example: ) struct header { size_t len; unsigned char data[]; };

    Read the article

  • Combine First, Middle Initial, Last name and Suffix in T-SQL (No extra spaces)

    - by Paul
    I'm trying not to reinvent the wheel here...I have these four fields [tbl_Contacts].[FirstName], [tbl_Contacts].[MiddleInitial], [tbl_Contacts].[LastName], [tbl_Contacts].[Suffix] And I want to create a FullName field in a view, but I can't have extra spaces if fields are blank...So I can't do FirstName + ' ' + MiddleInitial + ' ' + LastName + ' ' + Suffix...Because if there is no middle initial or suffix I'd have 2 extra spaces in the field. I think I need a Case statement, but I thought someone would have a handy method for this...Also, the middleinitial and suffix may be null.

    Read the article

  • Accress Parent Page's Viewstate in ASP.NET

    - by rachmos
    OK, I guess I'm missing something obvious here, but I still can't make it work... I have a page in ASP.NET. I have a nested class inside the page. I have a property in this nested class. How can I access the page's viewstate from the property's Set statement? Thanks!

    Read the article

  • Preprocessor #if directive

    - by Caslav
    I am writing a big code and I don't want it all to be in my main.c so I wrote a .inc file that has IF-ELSE statement with function and I was wondering can it be written like this: #if var==1 process(int a) { printf("Result is: %d",2*a); } #else process(int a) { printf("Result is: %d",10*a); } #endif I tried to compile it but it gives me errors or in best case it just goes on the first function process without checking the var variable (it is set to 0).

    Read the article

  • How to implement XXTEA in MySQL?

    - by user339229
    Anyone knows how to implement XXTEA in MySQL? For example - SELECT xxtea_encrypt('text here', 'key here'); possible implementation is by creating a FUNCTION in MySQL using CREATE FUNCTION statement, e.g. CREATE FUNCTION xxtea_encrypt XXTEA Procedures here... RETURN encrypted string Thanks & Best regards

    Read the article

  • Getting Two items from Same table in SELECT statment

    - by mouthpiec
    Hi, I an SQL SELECT statement I need to extract the name of two teams, taking both teams from the same table. Eg Below SELECT sport_activity_id, (team A), (team B), date, time FROM sportactivity, teams WHERE competition_id_fk = 2 For (team A) and (team B) I have an team_id, which is a FK for the table 'teams' Is it possible to get the following result from these tables by SQL? 1, Barcelona, Arsenal, 01/01/2000, 20:00 the two table are the following: table sportactivity sport_activity_id, home_team_fk, away_team_fk, competition_id_fk, date, time (tuple example) - 1, 33, 41, 5, 2010-04-14, 05:40:00 table teams team_id, team_name (tuple example) - 1, Algeria

    Read the article

  • How can I check for unused import in many Python files?

    - by Thierry Lam
    I remember when I was developing in C++ or Java, the compiler usually complains for unused methods, functions or imports. In my Django project, I have a bunch of Python files which have gone through a number of iterations. Some of those files have a few lines of import statement at the top of the page and some of those imports are not used anymore. Is there a way to locate those unused imports besides eyeballing each one of them in each file? All my imports are explicit, I don't usually write from blah import *

    Read the article

  • django update object

    - by John
    Hi, How do I run an update and select statement on the same queryset rather than having to do 2 querys, ones to select the object and one to update the object? the sql would be something like update my_table set field_1 = 'some value' where pk_field = some_value Thanks

    Read the article

  • IS ResultSet thread safe

    - by javatraniee
    Is ResultSet Thread safe? My question arises because in this i have used a different statement for each query i have delsared a ResultSet as an local variable but it gives me a error of Operation not allowed after ResultSet is closed. But my statements are working as i'm using the statements in insert and delete query.I have commented the ResultSet part and have not got the error !! The source code of my program can be referd to , in my earlier Question .

    Read the article

  • Catching TransactionRolledbackLocalException in Java

    - by user271858
    I receive javax.ejb.TransactionRolledbackLocalException in Websphere 7 from the container and I wonder how is it possible to catch this exception? I have a timeout set in Websphere and get this message after this time. I run session beans. I am trying to find what SQl statement was the cause of this exception. Where can i find that?

    Read the article

  • SQL Join only returning 1 row.

    - by kevin
    Not quite sure what I'm missing, but my SQL statement is only returning one row. SELECT tl.*, (tl.topic_total_rating/tl.topic_rates) as topic_rating, COUNT(pl.post_id) - 1 as reply_count, MIN(pl.post_time) AS topic_time, MAX(pl.post_time) AS topic_bump FROM topic_list tl JOIN post_list pl ON tl.topic_id=pl.post_parent WHERE tl.topic_board_link = %i AND topic_hidden != 1 ORDER BY %s I have two tables (post_list and topic_list), and post_list's post_parent links to a topic_list's topic_id. Instead of returning all the topics (where their board's topic_board_link is n), it only returns one topic.

    Read the article

  • mysql: managing memory usage

    - by every_answer_gets_a_point
    i am doing a delete with a LIKE statement my keybuffer is 25m, the sort buffer size is 256k the delete has been taking over 2 hours should i increase memory usage? there are about 50 megs of data in the table from which i am deleting, thats about 500,000 rows is there anything else i can do on the adminsitration size to speed up this delete?

    Read the article

  • MySQL Order By Problem, Why is 1000 being seen as Smaller than 2?

    - by Jack
    I have a strange problem, I am trying to order the output of a set of records by a field called displayOrder. Now even though record A has a displayOrder of 2 and record B has a displayOrder of 1000, record B still shows up before record A. Here's my select statement: SELECT * FROM items ORDER BY displayOrder ASC It works fine until I have a record greater than 9, then 10, 11, 12, etc are seen as smaller than 2, 3, 4 because they start with the number 1. Any way to fox this?

    Read the article

  • How do I combine two rows of same part, but add quantities?

    - by Tom
    I have table "PICKITEM" PARTID QTY A 1 A 3 B 11 C 8 D 5 D 3 I need a select statement that will return one line for like PARTIDs and add the qty field to together, yet also return the rest of the lines in the table as is PARTID QTY A 4 B 11 C 8 D 8 Probably a newb question, but I am new to SQL syntax and queries. Any help in getting me on the right path would be appreciated!

    Read the article

  • get index name within specific table name

    - by AmRoSH
    I need to check if this index not exist in specific table name not in all tables because this select statement select all indexes under this condition. IF NOT EXISTS (SELECT name from sysindexes WHERE name = 'IDX_InsuranceID') CREATE NONCLUSTERED INDEX [IDX_InsuranceID] ON [dbo].[QuoteInsurances] ( [InsuranceID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 80) ON [PRIMARY] GO Thanks,

    Read the article

< Previous Page | 134 135 136 137 138 139 140 141 142 143 144 145  | Next Page >