Search Results

Search found 11178 results on 448 pages for 'syntax checking'.

Page 50/448 | < Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >

  • Access outer class from inner class: Why is it done this way?

    - by Vuntic
    So most of us know how to access an outer class from an inner class. Searches with those words give oodles of answered questions on that topic. But what I want to know is why the syntax is the way it is. Example: public class A { private class B { public void c() {A.this.d();} } public void d() {System.out.println("You've called d()! Go, you!");} } Why is it A.this.d()? It looks like this is a static field of class A, but... * am confused * Forgive me if this is a repeat; like I said, searches with those words give how-answers.

    Read the article

  • Ternary Operators in JavaScript Without an "Else"

    - by Oscar Godson
    I've been using them forever, and I love them. To me they see cleaner and i can scan faster, but ever since I've been using them i've always had to put null in the else conditions that don't have anything. Is there anyway around it? E.g. condition ? x=true : null ; basically, is there a way to do: condition ? x=true; Now it shows up as a syntax error...

    Read the article

  • why am i getting an error SyntaxError : invalid syntax for this code

    - by eragon1189
    This is a code in python which calculates f (x) =? ((-1)*x)/(x*x+n*n) n from 1 to infinite.... correct to 0.0001, for the range 1 < x < 100 in steps of 0.1.But i am getting an syntax error,as i am new to programming in python... from scipy import * from matplotlib.pyplot import * x=arange(0.1,100,0.1) f=zeros(len(x)) s=-1 for n in range (1,10000): t=s*x/(x*x+n*n) f +=t s =-s if max(abs(t))< 1e-4 break for xx in c_[x,f]: print "%f %f" % (xx[0],xx[1])

    Read the article

  • C++ operator[] syntax.

    - by Lanissum
    Just a quick syntax question. I'm writing a map class (for school). If I define the following operator overload: template<typename Key, typename Val> class Map {... Val* operator[](Key k); What happens when a user writes: Map<int,int> myMap; map[10] = 3; Doing something like that will only overwrite a temporary copy of the [null] pointer at Key k. Is it even possible to do: map[10] = 3; printf("%i\n", map[10]); with the same operator overload?

    Read the article

  • JQuery code does not work not understanding the markup

    - by Andrae Browne
    I am trying to make a simple animation using JQuery. I have tried adding the script externally(external file) and internally(within script tags). I have testing if the page is recognizing the script using the alert function, but the script is not executing. I am thinking that is has something to do with the syntax. $("#container5").hover(function() { //hover in $(#container5).animate({ height: "250", width: "250", left: "-=50", top: "-=50", }, "fast"); }, function() { //hover out $(#container5).animate({ height: "200", width: "200", left: "+=50", top: "+=50", }, "fast"); } })(jQuery);

    Read the article

  • Why is Python 3.1 throwing a SyntaxError when printing after loop?

    - by bubersson
    Hi, I'm trying to run this snippet in Python 3.1 console and I'm getting SyntaxError: >>> while True: ... a=5 ... if a<6: ... break ... print("hello") File "<stdin>", line 5 print("hello") ^ SyntaxError: invalid syntax >>> (This is just shortened code to make a point.) Am I missing something? Is there some other Magic I don't know about? Thanks for your help (since this is my first StackOverflow question and I'm not a native English speaker)

    Read the article

  • Why is Python 3.1 throwing a SyntaxError when printing after loop? [resolved]

    - by bubersson
    Hi, I'm trying to run this snippet in Python 3.1 console and I'm getting SyntaxError: >>> while True: ... a=5 ... if a<6: ... break ... print("hello") File "<stdin>", line 5 print("hello") ^ SyntaxError: invalid syntax >>> (This is just shortened code to make a point.) Am I missing something? Is there some other Magic I don't know about? Thanks for your help (since this is my first StackOverflow question and I'm not a native English speaker)

    Read the article

  • Use of 'standalone parentheses'

    - by zaf
    I just answered a question where I advised removing parentheses around a statement and was asked why, to which I had no answer when I realised that it caused no errors/warnings. I could only cite bad practice. But maybe I'm the one missing something... I did my own tests: (print('!')); // Outputs '!' ((print('!!'))); // Outputs '!!' (1); // No output (qwerty); // No output (1==2); // No output (1=2); // Syntax error // etc... Can someone shed some light on whats going on and of what use are 'standalone parentheses'?

    Read the article

  • correct mysql syntax error

    - by user2981651
    please could someone tell me the problem with this syntax because mysql 5.5.32 keeps tell me about an error CREATE TABLE `clients` ( `ID` tinyint(11) NOT NULL auto_increment, `title` varchar(10) NOT NULL default '', `firstName` varchar(30) NOT NULL default '', `lastName` varchar(30) NOT NULL default '', `address1` varchar(100) NOT NULL default '', `address2` varchar(100) NOT NULL default '', `town` varchar(100) NOT NULL default '', `province` varchar(100) NOT NULL default '', `country` varchar(40) NOT NULL default '', `postCode` varchar(20) NOT NULL default '', `telephone` varchar(20) NOT NULL default '', `email` varchar(100) NOT NULL default '', `cardNo` varchar(16) NOT NULL default '0000-00-00', `expiryDate` date NOT NULL default '0000-00-00', PRIMARY KEY (`ID`) ) TYPE=MyISAM COMMENT='customer table' AUTO_INCREMENT=1 ;

    Read the article

  • Know if a variable is a native object in javascript

    - by mck89
    Hi, is there a way to know if a variable passed into a function is a native object? I mean, i have a function that requires only native objects as arguments, for every other type of variable it throws an error. So: func(Array); //works func(String); //works func(Date); //works func(Object); //works ... func([]); //Throwr error func({}); //Throws error I want to know if there's a way to distinguish between native objects and everything else.

    Read the article

  • Spell check in django template pages

    - by Hulk
    All, Is there any tool to do a UI spell check .I use a linux box here and also use django frame work. SO in the html pages if any spell check is to be made ignoring html tags and template tags.How should this be done. Thanks..

    Read the article

  • How Can I Check an Object to See its Type and Return A Casted Object

    - by Russ Bradberry
    I have method to which I pass an object. In this method I check it's type and depending on the type I do something with it and return a Long. I have tried every which way I can think of to do this and I always get several compiler errors telling me it expects a certain object but gets another. Can someone please explain to me what I am doing wrong and guide me in the right direction? What I have tried thus far is below: override def getInteger(obj:Object) = { if (obj.isInstanceOf[Object]) null else if (obj.isInstanceOf[Number]) (obj:Number).longValue() else if (obj.isInstanceOf[Boolean]) if (obj:Boolean) 1 else 0 else if (obj.isInstanceOf[String]) if ((obj:String).length == 0 | (obj:String) == "null") null else try { Long.parse(obj:String) } catch { case e: Exception => throw new ValueConverterException("value \"" + obj.toString() + "\" of type " + obj.getClass().getName() + " is not convertible to Long") } }

    Read the article

  • how to check if there is a division by zero in c

    - by user244775
    #include<stdio.h> void function(int); int main() { int x; printf("Enter x:"); scanf("%d", &x); function(x); return 0; } void function(int x) { float fx; fx=10/x; if(10 is divided by zero)// I dont know what to put here please help printf("division by zero is not allowed"); else printf("f(x) is: %.5f",fx); }

    Read the article

  • Is unnecessary error handling recommended in business logic? eg. Null check/Percentage limit check etc

    - by novice_at_work
    We usually put unnecessary checks in our business logic to avoid failures. Eg. 1. public ObjectABC funcABC(){ ObjectABC obj = new ObjectABC; .......... .......... //its never set to null here. .......... return obj; } ObjectABC o = funABC(); if(o!=null){ //do something } Why do we need this null check if we are sure that it will never be null? Is it a good practice or not? 2. int pplReached = funA(..,..,..); int totalPpl = funB(..,..,..); funA() just puts a few more restriction over result of funB(). Double percentage = (totalPpl==0||totalPpl<pplReached) ? 0.0 : pplReached/totalPpl; Do we again need this check? The questions is: Aren't we swallowing some fundamental issue by putting such checks? Issues which should be shown ideally, are avoided by putting these checks. What is the recommended way?

    Read the article

  • How to do 404 link testing through selenium rc for complete website?

    - by user1726460
    How can i verify a complete website's link(mostly links that are redirecting to 404 page) by using selenium Rc. Previously i tried to do this thong by using xenu and web link validator but in there results most of the links are showing 500 internal serevr error.and for the pages they are showing 500 internal server error the pages actuallt don't exists in the web site. So what is the concept if we can crawl through the website using selenium rc.?

    Read the article

  • What is the term(s) used to describe programming language syntax?

    - by Mr Roys
    Is there an exact/correct term to describe this difference between the syntax/constructs of programming langauges e.g VB6 with its (if ... else ... endif) and C# with its curly braces for conditional statements. I'm using VB6 syntax and C# as examples since I'm more familiar with their syntax. For example, Visual Basic 6's syntax uses a more verbose, natural language like structure. If (id = 0) Then id = MyObject.Add(Me) Else Call MyObject.Update(Me) End If while C# has more concise syntax like: if (id == 0) { id = MyObject.Add(this); } else { MyObject.Update(this); } Conciseness? Natural languageness? Or is there a more "scientific" word for describing syntax?

    Read the article

  • ActionScript Parameter Filtering

    - by TheDarkIn1978
    i'm setting up a custom class that accepts some Number parameters, but i need to limit those parameters and would like to know the best way of doing so. currently, i'm simply calling if statements, and throwing an error if the number is above or below what's accepted. for example, there is a parameter that accepts and angle, but only between 0 and 90. in the case i've typed it as a uint so now i only have to check to see if it's above 90. there's also a parameter Number typed parameter that only accepts values between the range of 0.0 and 1.0. is my method of using if statements and throwing erros the usual way of filtering parameters?

    Read the article

  • Login verification always this same redirect

    - by user1738013
    This is my code: session_helper if ( ! function_exists('is_login')) { function is_login() { $CI =& get_instance(); $is_logged_in = $CI->session->userdata('is_logged_in'); if (!isset($is_logged_in) || $is_logged_in != TRUE) { redirect('login'); } } } check_login <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Check_login extends CI_Controller { function __construct() { parent::__construct(); $this->is_logged_in(); } function is_logged_in() { $this->load->helper('session_helper'); $this->load->helper('url'); is_login(); } } When I induction this function: Every time is induction redirect('login'); Where is my problem?

    Read the article

  • I just started learning the syntax of c++. What now? [closed]

    - by user73924
    I more or less know the syntax of C++, but when I start to write a program, I have nothing to write, I am blank. The thing is I knew the syntax of C as well and I didn't know how to write programs in that either. Though I could understand the written answers of almost anything. So, my question here is how do I start writing my own programs or how do I put my thoughts on any program using any programming language?

    Read the article

  • nconf nagios config no services defined

    - by user1508056
    I've setup Nagios core on OSX 10.7 server via macports fine. It seems to load fine and the sample config files all copied over to /opt/local/etc/nagios/objects/ fine and are specified correctly in the nagios.cfg file. I then installed nconf manually and got it running without much fight. Then I clicked on "Generate Nagios config" in nconf and get 1 warning and 4 errors. When I expand the error box here what I see: Nagios Core 3.5.0 Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors Copyright (c) 1999-2009 Ethan Galstad Last Modified: 03-15-2013 License: GPL Website: http://www.nagios.org Reading configuration data... Read main config file okay... Read object config files okay... Running pre-flight check on configuration data... Checking services... Error: There are no services defined! Checked 0 services. Checking hosts... Error: There are no hosts defined! Checked 0 hosts. Checking host groups... Checked 0 host groups. Checking service groups... Checked 0 service groups. Checking contacts... Error: There are no contacts defined! Checked 0 contacts. Checking contact groups... Checked 0 contact groups. Checking service escalations... Checked 0 service escalations. Checking service dependencies... Checked 0 service dependencies. Checking host escalations... Checked 0 host escalations. Checking host dependencies... Checked 0 host dependencies. Checking commands... Checked 0 commands. Checking time periods... Checked 0 time periods. Checking for circular paths between hosts... Checking for circular host and service dependencies... Checking global event handlers... Checking obsessive compulsive processor commands... Checking misc settings... Warning: Nothing specified for illegal_macro_output_chars variable! Total Warnings: 1 Total Errors: 3 I've tried several different things (played with cache settings, changed file permissions/ownership, edited some config files manually, etc.) but nothing gets me past this step. The thing is, when I run 'sudo nagios -v /opt/local/etc/nagios/nagios.cfg' the output shows it is reading a number of services, a localhost, and a contact in the .cfg files...so I'm pretty confident those are ok and the problem is nconf isnt reading the correct .cfg files or something like that. Any ideas what to double check? I did lots of googling and found nothing on this specific issue--so either I'm special (I'm not) or am overlooking something really simple. The path to nagios binary is listed as /opt/local/bin/nagios, if that matters. Also, all the nagios files are owned by nagios:nagios, wheras nconf files are owned by user, with only the directories/files specified in the nconf docs belonging to the _www user and/or group (things like output, temp, config, etc.). Thanks.

    Read the article

  • error C2146: syntax error : missing ';' before identifier 'vertices'

    - by numerical25
    I would usually search for this error. But in VS C++ Express, this error comes up for just about every mistake you do. Any how I recieve this error below error C2146: syntax error : missing ';' before identifier 'vertices' everytime I add the following code at the top of my document // Create vertex buffer SimpleVertex vertices[] = { D3DXVECTOR3( 0.0f, 0.5f, 0.5f ), D3DXVECTOR3( 0.5f, -0.5f, 0.5f ), D3DXVECTOR3( -0.5f, -0.5f, 0.5f ), }; below is the code in it's entirety. Cant figure out whats wrong. thanks // include the basic windows header file #include "D3Dapp.h" class MyGame: public D3Dapp { public: bool Init3d(); }; MyGame game; // Create vertex buffer SimpleVertex vertices[] = { D3DXVECTOR3( 0.0f, 0.5f, 0.5f ), D3DXVECTOR3( 0.5f, -0.5f, 0.5f ), D3DXVECTOR3( -0.5f, -0.5f, 0.5f ), }; // the entry point for any Windows program int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { game.InitWindow(hInstance , nCmdShow); return game.Run(); } bool MyGame::Init3d() { D3Dapp::Init3d(); return true; }

    Read the article

  • jQuery fn.extend ({bla: function(){}} vs. jQuery.fn.bla

    - by tixrus
    OK I think I get http://stackoverflow.com/questions/1991126/difference-jquery-extend-and-jquery-fn-extend in that the general extend can extend any object, and that fn.extend is for plugin functions that can be invoked straight off the jquery object with some internal jquery voodoo. So it appears one would invoke them differently. If you use general extend to extend object obj by adding function y, then the method would attach to that object, obj.y() but if you use fn.extend then they are attach straight to the jquery object $.y().... Have I got that correct yes or no and if no what do I have wrong in my understanding? Now MY question: The book I am reading advocates using jQuery.fn.extend ({a: function(){}, b: function(){}}); syntax but in the docs it says jQuery.fn.a (function(){}); and I guess if you wanted b as well it would be jQuery.fn.b (function(){}); Are these functionally and performance-wise equivalent and if not what is the difference? Thank you very much. I am digging jQuery!

    Read the article

  • Language Tricks to Shorten My Java Code?

    - by yar
    I am currently rediscovering Java (working with Ruby a lot recently), and I love the compilation-time checking of everything. It makes refactoring so easy. However, I miss playing fast-and-loose with types to do an each loop. This is my worst code. Is this as short as it can be? I have a collection called looperTracks, which has instances that implement Looper. I don't want to modify that collection, but I want to iterate through its members PLUS the this (which also implements Looper). List<Looper> allLoopers = new ArrayList<Looper>(looperTracks.length + 1); for (LooperTrack track : looperTracks) { allLoopers.add(track); } allLoopers.add(this); for (Looper looper : allLoopers) { // Finally! I have a looper I'm particularly concerned about any features that are new to Java from 1.5 on that I may have missed. For this question I am not asking about JRuby nor Groovy, though I know that they would work for this. Edit: Sorry (too much Ruby!)... looperTracks is of type LooperTrack[] and LooperTrack implements Looper.

    Read the article

  • Function syntax puzzler in scalaz

    - by oxbow_lakes
    Following watching Nick Partidge's presentation on deriving scalaz, I got to looking at this example, which is just awesome: import scalaz._ import Scalaz._ def even(x: Int) : Validation[NonEmptyList[String], Int] = if (x % 2 ==0) x.success else "not even: %d".format(x).wrapNel.fail println( even(3) <|*|> even(5) ) //prints: Failure(NonEmptyList(not even: 3, not even: 5)) I was trying to understand what the <|*|> method was doing, here is the source code: def <|*|>[B](b: M[B])(implicit t: Functor[M], a: Apply[M]): M[(A, B)] = <**>(b, (_: A, _: B)) OK, that is fairly confusing (!) - but it references the <**> method, which is declared thus: def <**>[B, C](b: M[B], z: (A, B) => C)(implicit t: Functor[M], a: Apply[M]): M[C] = a(t.fmap(value, z.curried), b) So I have a few questions: How come the method appears to take a monad of one type parameter (M[B]) but can get passed a Validation (which has two type paremeters)? How does the syntax (_: A, _: B) define the function (A, B) => C which the 2nd method expects? It doesn't even define an output via =>

    Read the article

< Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >