Search Results

Search found 3111 results on 125 pages for 'labeled statements'.

Page 83/125 | < Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >

  • R: How to separate character output in a loop?

    - by John
    I'm blanking on the best way to paste a list of strings together to go into an SQL statement... I'm having trouble with the separator bar | printing at the beginning when I don't want it to: foo = "blah" paste_all_together = NULL for (n in 1:4) { paste_together = paste(foo ,sep = "") paste_all_together = paste(paste_all_together, paste_together, sep = "|") } > paste_all_together [1] "|blah|blah|blah|blah" I just want it to print out "blah|blah|blah|blah". Do I need a nested loop, or is there a better itterator in R for doing this? Or perhaps a better way to input SQL statements?

    Read the article

  • find all occurrences of comparison with == in visual studio

    - by Emiswelt
    Hi there I made the mistake of using == for comparing IP addresses instead of using the equals() method of the IPAddress class in C#, which will result in the comparison of references instead of values. Since the solution I am currently working on is very large for a one-man project ( 100.000 lines of source code), I am very sure that I still have some of these wrong statements in my code. Is there any possibility to tell Visual Studio to find all occurrences of == operations on a specific class for me, so that I can find and clean up the bugged comparisons? with best regards, emi

    Read the article

  • Stop MSVC++ debug errors from blocking the current process?

    - by Mike Arthur
    Any failed ASSERT statements on Windows cause the below debug message to appear and freeze the applications execution. I realise this is expected behaviour but it is running periodically on a headless machine so prevent the unit tests from failing, instead waiting on user input indefinitely. Is there s a registry key or compiler flag I can use to prevent this message box from requesting user input whilst still allowing the test to fail under ASSERT? Basically, I want to do this without modifying any code, just changing compiler or Windows options. Thanks!

    Read the article

  • what is wrong with my create table SQL?

    - by George2
    Hello everyone, I am using SQL Server 2008 management studio to execute the following SQL statements, and here is the related error message from SQL Server management studio. Any ideas what is wrong? SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO Create TABLE [dbo].[BatchStatus]( [BatchID] [uniqueidentifier] NOT NULL CONSTRAINT [PK_BatchStatus_ID], [BatchStatus] [int] NULL, CONSTRAINT [PK_BatchStatus_ID] PRIMARY KEY CLUSTERED ( [BatchID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO Msg 102, Level 15, State 1, Line 3 Incorrect syntax near ','. Msg 319, Level 15, State 1, Line 8 Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon. thanks in advance, George

    Read the article

  • Using the "IN" clause with a comma delimited string from the output of a replace() function in Oracle SQL

    - by Thomas
    Hi All, I have an comma delimited string which I want to use in an "IN" clause of the statement. eg: 100,101,102 Since In and "IN" clause I have to quote the individial strings, I use a replace function: eg: select ''''||replace('100,101,102',',',''', ''')||'''' from dual; The above query works, however, when I try to use the output of the above as an input to the "IN" clause, it returns no data. I am restricted by only SQL statements, so I cannot use PL/SQL code. Kindly help. eg: select * from employee where employee_number in ( select ''''||replace('100,101,102',',',''', ''')||'''' from dual); The above does not work. Please let me know what I am missing.

    Read the article

  • Updating a database periodically with Java

    - by MSR
    I would like to perform updates to a MySQL database using two separate classes (that do different things) -- one doing so every 10 seconds, and the second every minute. I have a few gaps in my Java knowledge and I'm wondering what the best way to achieve it is. Importantly, if connectivity to the database is lost, I need reconnection attempts to occur indefinitely, and I'm guessing the use of Prepared Statements will make queries more efficient. Should the connection to the database be left open all the time or closed between the updates being run? Maybe I also need to think about clearing objects/resources out of memory if the class instances are going to be run indefinitely.

    Read the article

  • Write a recursive function in C that converts a number into a string

    - by user3501779
    I'm studying software engineering, and came across this exercise: it asks to write a recursive function in C language that receives a positive integer and an empty string, and "translates" the number into a string. Meaning that after calling the function, the string we sent would contain the number but as a string of its digits. I wrote this function, but when I tried printing the string, it did print the number I sent, but in reverse. This is the function: void strnum(int n, char *str) { if(n) { strnum(n/10, str+1); *str = n%10 + '0'; } } For example, I sent the number 123 on function call, and the output was 321 instead of 123. I also tried exchanging the two lines within the if statement, and it still does the same. I can't figure out what I did wrong. Can someone help please? NOTE: Use of while and for loop statements is not allowed for the exercise.

    Read the article

  • Is there a way to specify java annotations in antlr grammar files?

    - by Steve B.
    I'm looking for a way to include a few additional strings in output .java files generated from antlr. Is there a comprehensive listing of available directives? For example, given parser output like this: package com.foo.bar; //<-- this can be generated with @header { .... } //antlr generated import org.antlr.runtime.*; ... //<-- is there a way to generate anything here? public class MyParser { //<--- or here? public void f1(){ ... } } Is there a way to generate strings that appear after the import statements (e.g. class-level annotations) or possibly method annotations?

    Read the article

  • Suggestions on including free database products to include in an application - SQL Server Express or

    - by superartsy
    I am working on an enterprise level product that is designed around SQL Server Express and specifically its features (views, concurrent users, stored procedures, CASE and IF statements). Though we don't use any advanced SQL Server features, the database size limit of 4GB in the Express edition may up being a limitation. A work-around is that customers can move to more full-featured versions of SQL Server. The problem is that SQL Server Express deployment is not easy, and the installer size is huge. This is a major drawback for someone looking to try our product. You don't want end-users to not buy a product because the download is huge. Does anyone have any recommendations of a database that has a smaller footprint but all the features of Express and which can be migrated to express?

    Read the article

  • Setting a property from one collection to another collection

    - by ooo
    I have two colluections List<Application> myApps; List<Application> yourApps; These lists have overlapping overlapping data but they are coming from different sources and each source has some missing field data. Application object has a property called Description Both collections have a unique field called Key i want to see if there is a LINQ solution to: Loop through all applications in myApps and look at the key and see if that existing in yourApps. If it does, i want to take the description property from that application in yourApps and set the description property on the application on myApps to that same value i wanted to see if there was any slick way using lambda expressions (instead of having to have loops and a number of if statements.)

    Read the article

  • c++ Mixing printf, cout with wprintf, wcout

    - by Bo Jensen
    I know you should not mix printing with printf,cout and wprintf,wcout, but have a hard time finding a good answer why and if it is possible to get round it. The problem is I use a external library that prints with printf and my own uses wcout. If I do a simple example it works fine, but from my full application it simply does not print the printf statements. If this is really a limitation, then there would be many libraries out there which can not work together with wide printing applications. Any insight on this is more than welcome.

    Read the article

  • Running sql scripts against an attached database?

    - by Will
    I've got an MDF attached to an instance of Sql Server 2008 Express, and I need to run some sql scripts against it to generate tables, indexes, etc. But I can't figure out how to get this to work. If I load the scripts in Visual Studio, it only allows me to connect to the server and run it against a database. I can't choose a different provider (Microsoft Sql Server Database File), so I can't select my MDF. This leaves me the only option of running the script as individual queries, but that won't work as it appears it doesn't support TSQL CREATE statements. How can I run my sql script against an attached database?

    Read the article

  • What is the role of `while`-loops in computation expressions in F#?

    - by MizardX
    If you define a While method of the builder-object, you can use while-loops in your computation expressions. The signature of the While method is: member b.While (predicate:unit->bool, body:M<'a>) : M<'a> For comparison, the signature of the For method is: member b.For (items:seq<'a>, body:unit->M<'a>) : M<'a> You should notice that, in the While-method, the body is a simple type, and not a function as in the For method. You can embed some other statements, like let and function-calls inside your computation-expressions, but those can impossibly execute in a while-loop more than once. builder { while foo() do printfn "step" yield bar() } Why is the while-loop not executed more than once, but merely repeated? Why the significant difference from for-loops? Better yet, is there some intended strategy for using while-loops in computation-expressions?

    Read the article

  • Update someones birthday with javascript

    - by user2768038
    So far the only mathematical way I can think of doing it is this: var age = 18 var today = new Date(); var myDate = new Date(); myDate.setFullYear(2013,3,13); /* My birthday is april 13th */ var y = (today - myDate); var days = ( y / (1000*60*60*24)); if(days >= 360){ var age = age +1; } if(days >= 720){ var age = age +1; } //etc...... document.write(age); Is there a better way of doing the if statements? so that I don't have to write one out for every year? I can't think!

    Read the article

  • semicolon in C++?

    - by SysAdmin
    Here is the question Is "missing semicolon" error really required? why not treat it as a warning? Why I am asking this stupid question? When I compile this code int f = 1 int h=2; the compiler intelligently tells me that where I am missing it. but to me its like - "If you know it, just treat it as if its there and go ahead. (Later I can fix the warning) int sdf = 1,df=2; sdf=1 df =2 even for this code it behaves the same. i.e even if multiple statements (without ;) are in the same line, the compiler knows. So, why not just remove this requirement? why not behave like python,vb etc

    Read the article

  • can I put the break on the same line

    - by brett
    I have a switch statement that has over 300 case statements. case 'hello': { $say = 'some text'; } break; case 'hi': { $say = 'some text'; } break; Why is it that the break is always on a separate line? Is this required? Is there anything syntactically incorrect about me doing this: case 'hello': { $say = 'some text'; } break; case 'hi': { $say = 'some text'; } break;

    Read the article

  • C++ runtime, display exception message

    - by aaa
    hello. I am using gcc on linux to compile C++ code. There are some exceptions which should not be handled and should close program. However, I would like to be able to display exception string: For example: throw std::runtime_error(" message"); does not display message, only type of error. I would like to display messages as well. Is there way to do it? it is a library, I really do not want to put catch statements and let library user decide. However, right now library user is fortran, which does not allow to handle exceptions. in principle, I can put handlers in wrapper code, but rather not to if there is a way around Thanks

    Read the article

  • Change Text on Landscape mode with Java Code and not XML (Android)

    - by Chowza
    I wrote my layout entirely in java code because it was just more convenient. (I had a lot of textViews and using for statements were more convenient). However, my TextViews require the day of the week and in portrait mode, I would like to cut the day of the week to a short form. For example, I want "Sunday" to show "Sun" for portrait mode, but "Sunday" for landscape mode. I understand how to do this in XML files, but how do I do it in code? I.e. sample code: LinearLayout parent = new LinearLayout(getApplicationContext()); parent.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)); TextView example = new TextView; example.setLayoutParams(mparams); example.setText("Sunday"); //<--make this "Sun" when in portrait but "Sunday" in landscape parent.addView(example);

    Read the article

  • What types of conditions can be used for conditional compilation in C++?

    - by user1002288
    This is an exam question for C++: Which of the following statements accurately describe the condition that can be used for conditional compilation in C++? A. The condition can depend on the value of environment variables. B. The condition can depend on the value of any const variables. C. The condition can depend on the value of program variables. D. The condition can use the sizeof() operator to make decision about compiler-dependent operations based on the size of standard data type. E. The condition must evaluate to either a 0 or 1 during preprocessing. I think the answer is E. Is this correct?

    Read the article

  • Amazon SimpleDB - Is there a way to list all Attributes in a Domain?

    - by beer-drinker
    Hi, I'm using C# and the AWSSDK library form Amazon to test a few things in SimpleDB. All going well so far. However, I am trying to come up with a neat way of retrieving all Attributes that are applicable to a Domain. This is proving to be tricky without having to retrieve an Item, and obviously I can get the list of attributes then. But what if I have 100,000 Items in a Domain. Let's say the first 70,000 Items in a "Person" Domain have: FirstName, LastName, Address And then I hit a Item that has FirstName, LastName, Address, Phone And then I hit another Item around the 80,000 mark which has: FirstName, LastName, Email, Phone In the above example, for the Person Domain, how would I get a list that contains: FirstName, LastName, Address, Email, Phone ...without performing a ridiculous number of select statements? Many thanks!

    Read the article

  • If statement in MySQL query with PHP

    - by user1104854
    Is it possible to use an if statement in a MySQL query in a similar what I'm showing? I want to grab some information for upcoming events(not ones with previous dates). ini_set('date.timezone', 'America/New_York'); $timestamp = date('m/d/Y'); $sql = "select eventID,eventTitle,eventDate from events where eventLocationID = $locationID ORDER BY eventDate DESC IF(eventDate > $timestamp) "; I really want to avoid doing post-query if statements that will only print if it's after today's date because I run it through a pagination function, and I'd really prefer to avoid tinkering with that.

    Read the article

  • What is XML good for and when should i be using it?

    - by Haroldo
    I'm curious, I've been developing pretty powerful websites/web apps, and I've never learnt XML, even odder I've never really felt the need to. It's not like Curl or Prepared Statements where before knowing what they did and how they worked I had a feeling 'there's got to be an easier way to do this!' or 'there's got to be something designed for this!'. Currently I work with MySQL and JSON and I don't have this feeling of 'I need to learn that' (XML), this must be wrong! I'm really interested to hear some compelling arguments for XML, and learn about things which it can do beter than JSON or MySQL (or some other aspect of web dev) and when i should be using it!

    Read the article

  • How do I add on multiple $_POST['row'] and variables?

    - by Ralph The Mouf
    I am struggling to find out the syntactically correct way in which to add on more variables and rows to these statements: /* WANT TO ADD ON FIVE MORE $_POST[''] */ if(isset($_POST['check_prof']) && $_POST['check_prof'] == 'checked') { $check_prof = "checked"; }else{ $check_prof = "unchecked"; } /* SAME HERE, WANT TO ADD THE OTHER FIVE IN HERE AS WELL */ $query = "UPDATE `Users` SET `check_prof` = '" . $check_prof . "' WHERE `id` = '" . $auth->id . "' LIMIT 1"; mysql_query($query,$connection); $auth->refresh(); }

    Read the article

  • Why Does try ... catch Blocks Require Braces?

    - by Bidou
    Hello. While in other statements like if ... else you can avoid braces if there is only one instruction in a block, you cannot do that with try ... catch blocks: the compiler doesn't buy it. For instance: try do_something_risky(); catch (...) std::cerr << "Blast!" << std::endl; With the code above, g++ simply says it expects a '{' before do_something_risky(). Why this difference of behavior between try ... catch and, say, if ... else ? Thanks!

    Read the article

  • mysql_real_escape_string & slashes (again, oh yes)

    - by Fizzadar
    Righto, firstly magic quotes & runtime are disabled correctly in php.ini, and confirmed by phpinfo(). PHP version: 5.3.4 MySQL version: 5.1.52 I'm only use mysql_real_escape_string on the data, after htmlspecialchars and a trim, that's all the data cleaning on the variable. Yet, when I submit a single quote, the slash remains in the database. When running mysql_query I'm using "' . $var . '", although in the past this hasn't changed anything (could be due to the double quotes?). Any ideas? and please don't tell me about PDO/prepared statements, I'm aware of them and I have my reasons for doing it this way. Thanks!

    Read the article

< Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >