Search Results

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

Page 55/448 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • Good code highlighting, syntax analysis and code assist editor on js.erb and css.erb files

    - by Pickachu
    I want to know if there is a good compatible api that supports erb and javascript highlighting. I've already tried Eclipse with Aptana RadRails. Perhaps I'm configuring something wrong, but it guesses that I'm using html.erb on both css.erb and js.erb files. I've tried too the Emacs with js2-mode, nXhtml and Rinari modes. Again, it works fine for html.erb, but it detects the css.erb and js.erb as html.erb files. Maybe it's possible to configure it to accept that files and be compatible.

    Read the article

  • error CS0133: Assigning the result of a function to a const in C#.net

    - by Greg
    Trying to tidy up scope and avoid possible multiple calls to RegisterWindowMessage. Currently have a class used once with the following member [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] static extern int RegisterWindowMessage(string lpString); private int m_message = RegisterWindowMessage("MY_MSG"); As we only have one instance this seems ok, but think it would be more tidy to use. With my basic C# understanding this should call RegisterWindowMessage and assign the result to int and not allow it to change. private const int message = RegisterWindowMessage("MY_MSG"); however attempting to do so leads to a error CS0133: The expression being assigned to 'someclass.messageEvent' must be constant so now I'm confused, does this mean the function was being assigned and called each time m_message was used previously, is there something else missing?

    Read the article

  • Boolean 'NOT' in T-SQL not working on 'bit' datatype?

    - by Joannes Vermorel
    Trying to perform a single boolean NOT operation, it appears that under MS SQL Server 2005, the following block does not work DECLARE @MyBoolean bit; SET @MyBoolean = 0; SET @MyBoolean = NOT @MyBoolean; SELECT @MyBoolean; Instead, I am getting more successful with DECLARE @MyBoolean bit; SET @MyBoolean = 0; SET @MyBoolean = 1 - @MyBoolean; SELECT @MyBoolean; Yet, this looks a bit a twisted way to express something as simple as a negation. Am I missing something?

    Read the article

  • Help with function in string

    - by draice
    I have a variable, emailBody, which is set to a string stored in a database emailBody = DLookup("emailBody", "listAdditions", "Id = " & itemType) The string icludes an IIf function (which includes a dlookup function). ?emailBody The new commodity is" & Iif(dlookup("IsVague", "CommodityType", "Description= " & newItem)="1", "vague.", "not vague.") How do I properly format the string so that the function will be evaluated and the result stored in the string?

    Read the article

  • Can somebody explain this Objective C method declaration syntax

    - by Doug R
    I'm working through an iPhone development book* without really knowing Objective C. For the most part I'm able to follow what's going on, but there are a few method declarations like the one below that I'm having a bit of trouble parsing. For example: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger) section { return [self.controllers count]; //controllers is an instance variable of type NSArray in this class } It looks this is a method called numberOfRowsInSection, and it returns an NSInteger, and takes an NSInteger as a parameter which is locally called 'section'. But I don't understand all the references to tableView, or why this takes a parameter when it is not used within the method. Can somebody clarify this? Thanks. *p. 258, Beginning iPhone 3 Development, by Mark and LaMarche, published by Apress

    Read the article

  • Why JavaScript Statement "ga = ga || []" Works?

    - by Morgan Cheng
    Below javascript statements will cause error, if ga is not declared. if (ga) { alert(ga); } The error is: ga is not defined It looks undeclared variable cannot be recognized in bool expression. So, why below statement works? var ga = ga || []; To me, the ga is treated as bool value before "||". If it is false, expression after "||" is assigned to final ga.

    Read the article

  • C#: Inheritence, Overriding, and Hiding

    - by Rosarch
    I'm having difficulty with an architectural decision for my C# XNA game. The basic entity in the world, such as a tree, zombie, or the player, is represented as a GameObject. Each GameObject is composed of at least a GameObjectController, GameObjectModel, and GameObjectView. These three are enough for simple entities, like inanimate trees or rocks. However, as I try to keep the functionality as factored out as possible, the inheritance begins to feel unwieldy. Syntactically, I'm not even sure how best to accomplish my goals. Here is the GameObjectController: public class GameObjectController { protected GameObjectModel model; protected GameObjectView view; public GameObjectController(GameObjectManager gameObjectManager) { this.gameObjectManager = gameObjectManager; model = new GameObjectModel(this); view = new GameObjectView(this); } public GameObjectManager GameObjectManager { get { return gameObjectManager; } } public virtual GameObjectView View { get { return view; } } public virtual GameObjectModel Model { get { return model; } } public virtual void Update(long tick) { } } I want to specify that each subclass of GameObjectController will have accessible at least a GameObjectView and GameObjectModel. If subclasses are fine using those classes, but perhaps are overriding for a more sophisticated Update() method, I don't want them to have to duplicate the code to produce those dependencies. So, the GameObjectController constructor sets those objects up. However, some objects do want to override the model and view. This is where the trouble comes in. Some objects need to fight, so they are CombatantGameObjects: public class CombatantGameObject : GameObjectController { protected new readonly CombatantGameModel model; public new virtual CombatantGameModel Model { get { return model; } } protected readonly CombatEngine combatEngine; public CombatantGameObject(GameObjectManager gameObjectManager, CombatEngine combatEngine) : base(gameObjectManager) { model = new CombatantGameModel(this); this.combatEngine = combatEngine; } public override void Update(long tick) { if (model.Health <= 0) { gameObjectManager.RemoveFromWorld(this); } base.Update(tick); } } Still pretty simple. Is my use of new to hide instance variables correct? Note that I'm assigning CombatantObjectController.model here, even though GameObjectController.Model was already set. And, combatants don't need any special view functionality, so they leave GameObjectController.View alone. Then I get down to the PlayerController, at which a bug is found. public class PlayerController : CombatantGameObject { private readonly IInputReader inputReader; private new readonly PlayerModel model; public new PlayerModel Model { get { return model; } } private float lastInventoryIndexAt; private float lastThrowAt; public PlayerController(GameObjectManager gameObjectManager, IInputReader inputReader, CombatEngine combatEngine) : base(gameObjectManager, combatEngine) { this.inputReader = inputReader; model = new PlayerModel(this); Model.Health = Constants.PLAYER_HEALTH; } public override void Update(long tick) { if (Model.Health <= 0) { gameObjectManager.RemoveFromWorld(this); for (int i = 0; i < 10; i++) { Debug.WriteLine("YOU DEAD SON!!!"); } return; } UpdateFromInput(tick); // .... } } The first time that this line is executed, I get a null reference exception: model.Body.ApplyImpulse(movementImpulse, model.Position); model.Position looks at model.Body, which is null. This is a function that initializes GameObjects before they are deployed into the world: public void Initialize(GameObjectController controller, IDictionary<string, string> data, WorldState worldState) { controller.View.read(data); controller.View.createSpriteAnimations(data, _assets); controller.Model.read(data); SetUpPhysics(controller, worldState, controller.Model.BoundingCircleRadius, Single.Parse(data["x"]), Single.Parse(data["y"]), bool.Parse(data["isBullet"])); } Every object is passed as a GameObjectController. Does that mean that if the object is really a PlayerController, controller.Model will refer to the base's GameObjectModel and not the PlayerController's overriden PlayerObjectModel?

    Read the article

  • Objective-C syntax

    - by mebFace
    I've been studying objective-c for a few days now. I keep coming across these two structures: NSString * somestring (NSString *) somestring I understand the first simply sets a pointer to an NSString object, but what does the second construct do, and when should I use it? What's the deal with the asterix marks? Sorry if this question doesn't make any sense, I am completely new to this language, and haven't even reached the level of asking proper questions. Main purpose -- I'm trying to decipher this method: -(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger) row forComponent: (NSInteger)component *Also, the classes I chose don't matter. *

    Read the article

  • javascript: why to "sign-prefix" a variable?

    - by harald
    hello, i'm currently looking at a little 3rd-party javascript library and i see a lot of "sign-prefixed" variables in it: function_call(+value); i know, that you can swap the sign, if you prefix a variable with '-', but why to prefix something with a '+' -- it doesn't do anything to the value, no? thanks in advance!

    Read the article

  • what is the jquery selector syntax to select this LI item

    - by Jonathan Lyon
    hi all I need to select each list item and change the background image of the parent div homepagecontainer but I can't even select the li element in my script. Here is the code: <div class="transparent" id="programmesbox"> <ul id="frontpage"> <?php query_posts('showposts=20&post_parent=7&post_type=page'); if (have_posts()) : while (have_posts()) : the_post(); ?> <li id="<?php the_id() ?>" ><a class="sprite" href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li> <?php endwhile; endif; ?> </ul> </div> I need to do something like this <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $('#frontpage li a').hover(function() { alert('here'); //CHANGE BACKGROUND IMAGE OF 'homepage_container' to different image depending on which list item is hovered over } ); </script> This is the URL of the site:- http://www.thebalancedbody.ca/ Thanks so much!! Jonathan

    Read the article

  • What Language Feature Can You Just Not Live Without?

    - by akdom
    I always miss python's built-in doc strings when working in other languages. I know this may seem odd, but it allows me to cut down significantly on excess comments while still providing a clean description of my code and any interfaces therein. What Language Feature Can You Just Not Live Without? If someone were building a new language and they asked you what one feature they absolutely must include, what would it be? This is getting kind of long, so I figured I'd do my best to summarize: Paraphrased to be language agnostic. If you know of a language which uses something mentioned, please at it in the parenthesis to the right of the feature. And if you have a better format for this list, by all means try it out (if it doesn't seem to work, I'll just roll back). Regular Expressions ~ torial (Perl) Garbage Collection ~ SaaS Developer (Python, Perl, Ruby, Java, .NET) Anonymous Functions ~ Vinko Vrsalovic (Lisp, Python) Arithmetic Operators ~ Jeremy Ross (Python, Perl, Ruby, Java, C#, Visual Basic, C, C++, Pascal, Smalltalk, etc.) Exception Handling ~ torial (Python, Java, .NET) Pass By Reference ~ Chris (Python) Unified String Format WalloWizard (C#) Generics ~ torial (Python, Java, C#) Integrated Query Equivalent to LINQ ~ Vyrotek (C#) Namespacing ~ Garry Shutler () Short Circuit Logic ~ Adam Bellaire ()

    Read the article

  • Syntax for specializing function templates

    - by FredOverflow
    Is there a difference between the following approaches? // approach 1 namespace std { template<> void swap<Foo>(Foo& x, Foo& y) // note the <Foo> { x.swap(y); } } // approach 2 namespace std { template<> void swap(Foo& x, Foo& y) { x.swap(y); } } I stumpled upon this when I tried to specialize swap for my own string type and noticed that swap<::string> doesn't work, but for a completely different reason :)

    Read the article

  • Drools Rules: How can I use a method on "when" section?

    - by manoelhc
    Hi, I need to execute a method on "when" section of a DSLR file and I´m not sure if it´s possible. Example: rule "WNPRules_10" when $reminder:Reminder(source == "HMI") $user:User(isInAgeRange("30-100")==true) Reminder(clickPercentual >= 10) User(haveAtLeastOptIns("1,2,3,4") == true) then $reminder.setPriority(1);update($reminder); end (note: isInAgeRange() and haveAtLeastOptIns() are methods of User) I tried with eval() and no errors appeared, but it didn´t execute. Like this: rule "WNPRules_10" when $reminder:Reminder(source == "HMI") $user:User(eval($user.isInAgeRange("30-100")==true)) Reminder(clickPercentual >= 10) User(eval($user.haveAtLeastOptIns("1,2,3,4") == true)) then $reminder.setPriority(1);update($reminder); end How can I resolve this problem?

    Read the article

  • create new db in mysql with php syntax

    - by Jacksta
    I am trying to create a new db called testDB2, below is my code. Once running the script all I am getting an error on line 7 Fatal error: Call to undefined function mysqlquery() in /home/admin/domains/domain.com.au/public_html/db_createdb.php on line 7 This is my code <? $sql = "CREATE database testDB2"; $connection = mysql_connect("localhost", "admin_user", "pass") or die(mysql_error()); $result = mysqlquery($sql, $connection) or die(mysql_error()); if ($result) { $msg = "<p>Databse has been created!</p>"; } ?> <HTML> <head> <title>Create MySQL database</title> </head> <body> <? echo "$msg"; ?> </body> </HTML>

    Read the article

  • JSF Deferred EL conditional syntax problem

    - by Mark Lewis
    Hello I can't find any resources which can answer why I'm getting an error with this: oncomplete="#{MyBacking.oError ? #{rich:component('oErrorPanel')}.show() : return false;}" in a richfaces a4j:commandButton. oError is referring to a method in my bean called isOError. I'm getting the error SEVERE: Servlet.service() for servlet Faces Servlet threw exception org.apache.el.parser.ParseException: Encountered " "?" "? "" at line 1, column 30. Was expecting one of: "}" ... "." ... ... I want to say 'if a method returns true, show modal panel A otherwise false'. Any help much appreciated.

    Read the article

  • Ruby on rails link_to syntax

    - by mizipzor
    After following a tutorial Ive found. Im now redoing it again, without the scaffolding part, to learn it better. However, editing my \app\views\home\index.html.erb to contain: <h1>Rails test project</h1> <%= link_to "my blog", posts_path> I get an error: undefined local variable or method `posts_path' for #<ActionView::Base:0x4e1d954> Before I did this, I ran rake db:create, defined a migration class and ran rake db:migrate, everything without a problem. So the database should contain a posts table. But that link_to command cant seem to find posts_path. That variable (or is it even a function?) is probably defined through the scaffold routine. My question now is; how do I do that manually myself, define posts_path?

    Read the article

  • Correct syntax for php inside a feed request

    - by Simon Hume
    Hi guys, I have a very basic query string which passes a ID to a receiving page. On that page, I need to dynamically call the YouTube API, giving my playlistID. I'm having to use PHP for this, and it's a little out of my comfort zone, so hopefully someone can wade in with a quick fix for me. Here is my variable $playlist; And I need to replace the 77DC230FBBCE4D58 below with that variable. $feedURL = 'http://gdata.youtube.com/feeds/api/playlists/77DC230FBBCE4D58?v=2'; Any help, as always, greatly appreciated!

    Read the article

  • Vim syntax highlighting: make region only match on one line

    - by sixtyfootersdude
    Hello I have defined a custom file type with these lines: syn region SubSubtitle start=+=+ end=+=+ highlight SubSubtitle ctermbg=black ctermfg=DarkGrey syn region Subtitle start=+==+ end=+==+ highlight Subtitle ctermbg=black ctermfg=DarkMagenta syn region Title start=+===+ end=+===+ highlight Title ctermbg=black ctermfg=yellow syn region MasterTitle start=+====+ end=+====+ highlight MasterTitle cterm=bold term=bold ctermbg=black ctermfg=LightBlue I enclose all of my headings in this kind of document like this: ==== Biggest Heading ==== // this will be bold and light blue ===Sub heading === // this will be yellow bla bla bla // this will be normally formatted However right now when ever I use an equals sign in my code it thinks that it is a title. Is there anyway that I can force a match to be only on one line?

    Read the article

  • unexpected T_TRY, expecting T_FUNCTION error message, not sure why ?

    - by Rachel
    I am getting unexpected T_TRY, expecting T_FUNCTION error message and am not sure as too why am getting that, can't we use try and catch block inside class like this: class Processor { protected $dao; protected $fin; try { public function __construct($file) { //Open File for parsing. $this->fin = fopen($file,'w+') or die('Cannot open file'); // Initialize the Repository DAO. $this->dao = new Dao('some name'); } public function initiateInserts() { while (($data=fgetcsv($this->fin,5000,";"))!==FALSE) { $initiate_inserts = $this->dao->initiateInserts($data); } } public function initiateCUpdates() { while (($data=fgetcsv($this->fin,5000,";"))!==FALSE) { $initiate_updates = $this->dao->initiateCUpdates($data); } } public function initiateExecuteIUpdates() { while (($data=fgetcsv($this->fin,5000,";"))!==FALSE) { $initiate_updates = $this->dao->initiateIUpdates($data); } } } catch (Exception $e) { } }

    Read the article

  • Automatic counter in Ruby for each?

    - by yar
    I know you Ruby people will laugh at my bad Ruby code: i=0 for blah in blahs puts i.to_s + " " + blah i+=1 end I want to use a for-each and a counter... is there a better way to do it? Note: I don't know if blahs is an array or a hash, but having to do blahs[i] wouldn't make it much sexier. Also I'd like to know how to write i++ in Ruby. Edit: Technically, Matt's and Squeegy's answer came in first, but I'm giving best answer to paradoja so spread around the points a bit on SO. Also his answer had the note about versions, which is still relevant (as long as my Ubuntu 8.04 is using Ruby 1.8.6). Edit: Should've used puts "#{i} #{blah}" which is a lot more succinct.

    Read the article

  • What does the >> symbol mean in Haskell.

    - by CharlesS
    I was reading the Guestbook example for Happstack and noticed the symbol which I didn't see before in the textbooks I studied to learn Haskell (for instance see line 23). What is it? Example I could not find it in Google because it ignores the totally (Bing does not but comes up with tons of non-related results). Thanks!

    Read the article

  • Parse tree and grammars information

    - by fuzzylogikk
    Do anyone know where to find good online resources with examples how to make grammars and parsetrees? Preferebly introductary materials. Info that is n00b friendly, haven't found anything good with google myself. edit: I'm thinking about theory, not a specific parser software.

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >