Search Results

Search found 4835 results on 194 pages for 'coding hero'.

Page 20/194 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • YAML in TextMate, color coding wrong?

    - by Victor P
    Im using TextMate to create a YAML document, but the keys and the values have all the same color (brown). Would be more intuitive to have keys and values rendered in different colors, like HTML, CSS, etc Am I missing something? Thanks

    Read the article

  • hand coding a parser

    - by John Leidegren
    For all you compiler gurus, I wanna write a recursive descent parser and I wanna do it with just code. No generating lexers and parsers from some other grammar and don't tell me to read the dragon book, i'll come around to that eventually. I wanna get into the gritty details about implementing a lexer and parser for a reasonable simple langauge, say CSS. And I wanna do this right. This will probably end up being a series of questions but right now I'm starting with a lexer. Tokenization rules for CSS can be found here. I find my self writing code like this (hopefully you can infer the rest from this snippet): public CssToken ReadNext() { int val; while ((val = _reader.Read()) != -1) { var c = (char)val; switch (_stack.Top) { case ParserState.Init: if (c == ' ') { continue; // ignore } else if (c == '.') { _stack.Transition(ParserState.SubIdent, ParserState.Init); } break; case ParserState.SubIdent: if (c == '-') { _token.Append(c); } _stack.Transition(ParserState.SubNMBegin); break; What is this called? and how far off am I from something reasonable well understood? I'm trying to balence something which is fair in terms of efficiency and easy to work with, using a stack to implement some kind of state machine is working quite well, but I'm unsure how to continue like this. What I have is an input stream, from which I can read 1 character at a time. I don't do any look a head right now, I just read the character then depending on the current state try to do something with that. I'd really like to get into the mind set of writing reusable snippets of code. This Transition method is currently means to do that, it will pop the current state of the stack and then push the arguments in reverse order. That way, when I write Transition(ParserState.SubIdent, ParserState.Init) it will "call" a sub routine SubIdent which will, when complete, return to the Init state. The parser will be implemented in much the same way, currently, having everyhing in a single big method like this allows me to easily return a token when I found one, but it also forces me to keep everything in one single big method. Is there a nice way to split these tokenization rules into seperate methods? Any input/advice on the matter would be greatly appriciated!

    Read the article

  • Advice on coding Perl to work like PHP

    - by user272273
    I am first and foremost a perl coder, but like many, also code in PHP for client work, especially web apps. I am finding that I am duplicating a lot of my projects in the two languages, but using different paradigms (e.g. for handling cgi input and session data) or functions. What I would like to do is start to code my Perl in a way which is structured more like PHP, so that I a) am keeping one paradigm in my head b) can more quickly port over scripts from one to the other Specifically, I am asking if people could advise how you might do the following in perl? 1) Reproduce the functionality of $_SESSION, $_GET etc. e.g. by wrapping up the param() method of CGI.pm, a session library? 2) Templating library that is similar to PHP I am used to mixing my code and HTML in the PHP convention. e.g. i <h1>HTML Code here</h1> <? print "Hello World\b"; ?> Can anybody advise on which perl templating engine (and possibly configuration) will allow me to code similarly? 3) PHP function library Anybody know of a library for perl which reproduces a lot of the php inbuilt functions?

    Read the article

  • Visual Studio support for coding directly in *IL?

    - by jdk
    For the longest time I've been curious to code in Intermediate Language just as an academic endeavour and to gain a better understanding of what's "happening under the hood". Does anybody provide Visual Studio support for *IL in the form of: project templates, IntelliSense integration, and those kind of RAD features? Edits: I don't mean restricted to out of the box support. For example, I can download Visual Studio extensions to support Python, COBOL, etc. Want the same for *IL. There is a stand-alone Intermediate Assembler tool.

    Read the article

  • Following PHP coding of Wisdom

    - by justjoe
    i read some wisdom like this : Programmers are encouraged to be careful when using by-reference variables since they can negatively affect the readability and maintainability of the code. i make my own solution, such as give suffix such as _ref in every by-reference variables. so, if i have a variable named as $files_in_root, then i will add suffix and changes it name into $files_in_root_ref. As far my knowledge goes, this is a good solution. So, here come the question Is there any best-practice on choosing suffix for by-reference variable in PHP coder world ? Or do you have any ? In general, how do we sustain readability and maintainability on PHP project with more then 3000 line of code ? I hope PHP coder world has unwritten aggrement for first question, cause it will help spot a pattern on any source code.

    Read the article

  • Enforcing a coding template in the getters of a class in java

    - by Yoav Schwartz
    Hello, I want to make sure all getters of the classes in a certain package follow a given template. For example, all getters must be of the form: XXX getYYY(){ classLock.lock(); return YYY; finally{ classLock.unlock(); } } Basically, I want that my project will not compile/run unless all getters are of that form. What is the best way to do that? I would prefer a solution that can be used as an Eclipse plugin. Thanks, Yoav

    Read the article

  • Coding in Other (Spoken) Languages

    - by contagious
    Something i've always wondered, and I can't find any mention of it anywhere online. When a shop from, say Japan, writes code, would I be able to read it in english? Or do languages, like C, php, anything, have Japanese translations that they write? I guess what i'm asking is does every single coder in the world know enough english to use the exact same reserved words I do? Would this code: If (i < size){ switch case 1: print "hi there" default: print "no, thank you" } else { print "yes, thank you" } display the exact same as I'm seeing it right now in english, or would some other non-english-speaking person see the words "if", "switch", "case", "default", "print", and "else" in their native language? EDIT - yes, this is serious. I didn't know if different localiztions of a language have different keywords. or if there are even different localizations at all.

    Read the article

  • Version Control and Coding Formatting

    - by Martin Giffy D'Souza
    Hi, I'm currently part of the team implementing a new version control system (Subversion) within my organization. There's been a bit of a debate on how to handle code formatting and I'd like to get other peoples opinions and experiences on this topic. We currently have ~10 developers each using different tools (due to licensing and preference). Some of these tools have automatic code formatters and others don't. If we allow "blind" checkins the code will look drastically different each time someone does a check in. This will make things such as diffs and merges complicated. I've talked to several people and they've mentioned the following solutions: Use the same developer program with the same code formatter (not really an option due to licensing) Have a hook (either client or server side) which will automatically format the code before going into the repository Manually format the code. Regarding the 3rd point, the concept is to never auto-format the code and have some standards. Right now that seems to be what we're leaning towards. I'm a bit hesitant on that approach as it could lead to developers spending a lot of time manually formatting code. If anyone can please provide some their thoughts and experience on this that would be great. Thank you, Martin

    Read the article

  • Image coding library

    - by Dmitry
    Is there any good library for lossless image encoding/decoding that has compression rate more or less similar to PNG but decoding to raw RGB bitmap data would be much faster than PNG? Also alpha transparency is needed, but not essential because, alpha channel could be taken from separate image. Original problem lies in slowness of reading and decoding PNG files on iPhone using standard libraries. Obvious and the simples solution would have been storing raw RGB bitmap data, but then size of unpacked ipa is too large - 4 times larger than PNG files. So, I am trying to find some compromise solution.

    Read the article

  • Visual Studio support for coding in MSIL?

    - by jdk
    For the longest time I've been curious to code in Microsoft Intermediate Language (MSIL) just as an academic endeavour and to gain a better understanding of what's "happening under the hood". Is there any sort of Visual Studio support for this in the form of: project templates, IntelliSense integration, and those kind of RAD features?

    Read the article

  • Problems in php coding

    - by anwar
    Hi there everyone im new to PHP and Joomla and I have developed a component in Joomla but my code is giving me errors. I have tried to solve the problem but I’am unable to solve it. So can anyone suggest me what is the problem with my code? Thanks in advance. Here are my two files: 1st view.html.php defined('_JEXEC') or die('=;)'); jimport('joomla.application.component.view'); class namnamViewlistrestaurant extends JView { function display($tpl = null) { $item = 'item'; RestUser::RestrictDirectAccess(); //-- Custom css JHTML::stylesheet( 'style.css', 'components/com_namnam/assets/css/' ); $cuisine=Lookups::getLookup('cuisine'); $lists['cuisine'] = JHTML::_('select.genericlist', $cuisine, 'idcuisine[]', 'class="inputbox" size="7"', 'value', 'text', $item->idcuisine); $category=Lookups::getLookup('restcategory'); $lists['category'] = JHTML::_('select.genericlist', $category, 'idcategory[]', 'class="inputbox" multiple="multiple" size="7"', 'value', 'text', $item->idcategory); $items = & $this->get('Data'); $pagination =& $this->get('Pagination'); $lists = & $this->get('List'); $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); $this->assignRef('lists', $lists); parent::display($tpl); }//function }//class And 2nd is listrestaurant.php defined('_JEXEC') or die('=;)'); jimport('joomla.application.component.model'); class namnamModellistrestaurant extends JModel { var $_data; var $_total = null; var $_pagination = null; function __construct() { parent::__construct(); global $mainframe, $option; $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); $limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0); $this->setState('limit', $limit); $this->setState('limitstart', $limitstart); } function _buildQuery() { $where = array(); $where[]=" idowner=".RestUser::getUserID()." "; if ($this->search) { $where[] = 'LOWER(name) LIKE \''. $this->search. '\''; } $where =( count($where) ) ? ' WHERE ' . implode( ' AND ', $where ) : ''; $orderby = ''; #_ECR_MAT_FILTER_MODEL1_ if (($this->filter_order) && ($this->filter_order_Dir)) { $orderby = ' ORDER BY '. $this->filter_order .' '. $this->filter_order_Dir; } $this->_query = ' SELECT *' . ' FROM #__namnam_restaurants ' . $where . $orderby ; return $this->_query; } function getData() { if (empty($this->_data)) { $query = $this->_buildQuery(); $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); } return $this->_data; } function getList() { // table ordering $lists['order_Dir'] = $this->filter_order_Dir; $lists['order'] = $this->filter_order; // search filter $lists['search']= $this->search; return $lists; } function getTotal() { // Load the content if it doesn't already exist if (empty($this->_total)) { $query = $this->_buildQuery(); $this->_total = $this->_getListCount($query); } return $this->_total; } function getPagination() { // Load the content if it doesn't already exist if (empty($this->_pagination)) { jimport('joomla.html.pagination'); $this->_pagination = new JPagination($this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); } return $this->_pagination; } }//class And the errors are: Notice: Trying to get property of non-object in C:\wamp\www\namnam.com\components\com_namnam\views\listrestaurant\view.html.php on line 26 Notice: Trying to get property of non-object in C:\wamp\www\namnam.com\components\com_namnam\views\listrestaurant\view.html.php on line 29 Notice: Undefined property: namnamModellistrestaurant::$search in C:\wamp\www\namnam.com\components\com_namnam\models\listrestaurant.php on line 38 Notice: Undefined property: namnamModellistrestaurant::$filter_order in C:\wamp\www\namnam.com\components\com_namnam\models\listrestaurant.php on line 48 Notice: Undefined property: namnamModellistrestaurant::$search in C:\wamp\www\namnam.com\components\com_namnam\models\listrestaurant.php on line 38 Notice: Undefined property: namnamModellistrestaurant::$filter_order in C:\wamp\www\namnam.com\components\com_namnam\models\listrestaurant.php on line 48 Notice: Undefined property: namnamModellistrestaurant::$filter_order_Dir in C:\wamp\www\namnam.com\components\com_namnam\models\listrestaurant.php on line 76 Notice: Undefined property: namnamModellistrestaurant::$filter_order in C:\wamp\www\namnam.com\components\com_namnam\models\listrestaurant.php on line 77 Notice: Undefined property: namnamModellistrestaurant::$search in C:\wamp\www\namnam.com\components\com_namnam\models\listrestaurant.php on line 80

    Read the article

  • JQuery Coding Question?

    - by SLAPme
    I'm kind of new to JQuery i really don't know how to code in the .hide() so that it hides the following code from begin displayed until clicked <li>Changes saved!</li> and then have it fade in using the .fadeIn. Can some one show me how to code in the .hide() and .fadeIn correctly into my JQuery code? Here is the JQuery code. $(function() { $(".save-button").click(function() { $.post($("#contact-form").attr("action"), $("#contact-form").serialize(), function(html) { $("div.contact-info-form").html(html); $('#changes-saved').append('<li>Changes saved!</li>'); }); return false; // prevent normal submit }); });

    Read the article

  • InnoSetup Uninstall Ask Message - Pascal Coding

    - by ryu
    I have created an installer for some of my games and I want the uninstaller to ask me if I want to save my game files. Something like this: when I execute the uninstall.exe to ask me 'Do you want to keep all saved games?' YES or NO. If I hit YES my save files remain and my program files are uninstalled and if I hit NO my program files inclusive save files to be uninstalled. What is the PASCAL code for InnoSetup to do this? Thank you very much! Best regards, Ryan

    Read the article

  • JavaScript and PHP filename coding conventions

    - by Tower
    Hi, I would like to know the popular ways of naming files in JavaScript and PHP development. I am working on a JS+PHP system, and I do not know how to name my files. Currently I do for JS: framework/ framework/widget/ framework/widget/TextField.js (Framework.widget.TextField()) Framework.js (Framework()) So, my folders are lowercase and objects CamelCase, but what should I do when the folder/namespace requires more than one word? And what about PHP? jQuery seems to follow: jquery.js jquery.ui.js jquery.plugin-name.js so that it is jquery(\.[a-z0-9-])*\.js but ExtJS follows completely different approach. Douglas Crockford only gives us details about his preference for syntax conventions.

    Read the article

  • coding an array in a class library and make a call to it C#

    - by eddy
    I'm new to C#, so this may be a basic question. What I need to do is put an array such as the one below in a class library and then make a call to it. So I'd want the aproprate picture to appear via the class and this array. I know there's a much simpler way to make certain pictures appear, but this is a requirement for the project. It's an asp.NET website in C#. string[] PictureArray; PictureArray = new string[3]; PictureArray[0] = "~/pics/grl.jpg"; PictureArray[1] = "~/pics/pop.jpg"; PictureArray[2] = "~/pics/str.jpg"; PictureArray[3] = "~/pics/unk.jpg";

    Read the article

  • Insert coding query in yii

    - by nerd
    I need to auto insert the next orders_id into an Orders table in a database. orders_id is not the primary Key, and it does not auto-increment I need to query the database, find the last (highest) id value, increment 1, and insert it in Orders table in database. Actually, I have a shipping action which will provide address of shipping of orders. So as soon as the user fills address form and move to payments page, I want to simultaneously fill my Orders table by max(orders_id)+1. I have built relations between Address table and Orders table but my orders Table is not getting populated. Please detail me correct codes to implement it in my controller in Yii

    Read the article

  • Delphi 7: ADO, need basic coding example

    - by mawg
    I am a complete n00b here. Can someone please post some Delphi code to create a database add a simple table close the database then, later open a database read each table read each field of a given table perform a simple search Sorry to be so clueless. I did google, but didn't find a useful tutorial ...

    Read the article

  • Create UML diagrams after or before coding?

    - by ajsie
    I can clearly see the benefits of having UML diagrams showing your infrastructure of the application (class names, their members, how they communicate with each other etc). I'm starting a new project right now and have already structured the database (with visual paradigm). I want to use some design patterns to guide me how to code the classes. I wonder, should I code the classes first before I create UML diagram of it (maybe out of the code... seems possible) or should I first create UML diagram and then code (or generate code from the UML, seems possible that too). What are you experiences telling you is the best way?

    Read the article

  • coding in native language

    - by radi
    is it possible to someone to invent a new programming language in his native language , and if it possible how to do that and what the tools he need to write compiler for it . thanks .

    Read the article

  • How to apply coding methodologies and practices to non-coding work?

    - by Dan
    I can talk for hours about best-practice, source control, change management, feature tracking, development cycles and the lot, but most of what I've learnt or read seems to apply to nuts-and-bolts programming of compiled applications. You know, ASCII files that gets turned into 1s and 0s. How does one apply the same discipline and wisdom to working in environments that are point-and-click, config-centric. I'm thinking of CMSs and specifically, my current 9 to 5, SharePoint. Traditional practices of source control, dev-staging-production seem to break down since we're not working with code, and the live environment changes with user input. So to sum up a rather lengthy question, what works in a no-code environment?

    Read the article

  • PHP: Profiling code and strict environment ~ Improving my coding

    - by DavidYell
    I would like to update my local working environment to be stricter in an effort to improve my code. I know that my code is okay, but as with most things there is always room for improvement. I use XAMPP on my local machine, for simplicities sake Apache Friends XAMPP (Basic Package) version 1.7.2 So I've updated my php.ini : error_reporting to be E_ALL | E_STRICT to help with the code standard. I've also enabled the XDebug extension zend_extension = "C:\xampp\php\ext\php_xdebug.dll" which seems to be working, having tested some broken code and got the nice standard orange error notice. However, having read this question, http://stackoverflow.com/questions/133686/what-is-the-best-way-to-profile-php-code and enabled the profiler, I cannot seem to create a cachegrind file. Many of the guides that I've looked at seem to think you need to install XDebug in XAMPP which leads me to think they are out of date, as XDebug is bundled with XAMPP these days. So I would appreciate it if anyone can help point me in the right direction with both configuring XDebug to output grind files, and or just a great set of default settings for the XDebug config in XAMPP. Seems there is very little documentation to go on. If people have tips on integrating these tools with Netbeans, that would be awesomesauce. I'm happy to get suggestions on other things that I can do to help tighten up my php code, both syntactically and performance wise Thanks, and apologies for the rambling question(s)! Ninja edit I should menion that I'm using named vhosts as my Apache configuration, which I think is why running XDebug on port 9000 isn't working for me. I guess I'd need to edit my vhost to include port 9000

    Read the article

  • Coding the Python way

    - by Aaron Moodie
    I've just spent the last half semester at Uni learning python. I've really enjoyed it, and was hoping for a few tips on how to write more 'pythonic' code. This is the __init__ class from a recent assignment I did. At the time I wrote it, I was trying to work out how I could re-write this using lambdas, or in a neater, more efficient way, but ran out of time. def __init__(self, dir): def _read_files(_, dir, files): for file in files: if file == "classes.txt": class_list = readtable(dir+"/"+file) for item in class_list: Enrol.class_info_dict[item[0]] = item[1:] if item[1] in Enrol.classes_dict: Enrol.classes_dict[item[1]].append(item[0]) else: Enrol.classes_dict[item[1]] = [item[0]] elif file == "subjects.txt": subject_list = readtable(dir+"/"+file) for item in subject_list: Enrol.subjects_dict[item[0]] = item[1] elif file == "venues.txt": venue_list = readtable(dir+"/"+file) for item in venue_list: Enrol.venues_dict[item[0]] = item[1:] elif file.endswith('.roll'): roll_list = readlines(dir+"/"+file) file = os.path.splitext(file)[0] Enrol.class_roll_dict[file] = roll_list for item in roll_list: if item in Enrol.enrolled_dict: Enrol.enrolled_dict[item].append(file) else: Enrol.enrolled_dict[item] = [file] try: os.path.walk(dir, _read_files, None) except: print "There was a problem reading the directory" As you can see, it's a little bulky. If anyone has the time or inclination, I'd really appreciate a few tips on some python best-practices. Thanks.

    Read the article

  • java - coding errors causing endless loop

    - by Daniel Key
    Im attempting to write a program that takes a population's birthrate and deathrate and loops the annual population until it either reaches 0 or doubles. My problem it that it continuously loops an endless amount of illegible numbers and i cant fix it. please help. //***************************************** //This program displays loop statements //Written by: Daniel Kellogg //Last Edited: 9/28/12 //**************************************** import java.util.Scanner; public class Hwk6 { public static void main (String[] args) { int currentYear, currentPopulation; double birthRate, deathRate; Scanner stdin = new Scanner(System.in); System.out.println("\nPopulation Estimator\n"); System.out.println("Enter Year"); currentYear = stdin.nextInt(); System.out.println("Enter Current Population"); currentPopulation = stdin.nextInt(); System.out.println("Enter Birthrate of Population"); birthRate = stdin.nextDouble(); System.out.println("Enter Deathrate of Population"); deathRate = stdin.nextDouble(); int counter = currentPopulation; System.out.println("Population: "); while (currentPopulation != -1) while (counter < currentPopulation * 2) { System.out.print(counter + " "); counter = counter + (int)(counter * birthRate - counter * deathRate); } System.exit(0); } }

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >