Skip to main content

Posts

Twelve Ways to Make Code Suck Less

Here are the ways Reduce State and State Mutation. Do Tactical Code Reviews. Give Good Meaningful Names. Avoid Long Method Names. Comment Why, Not What. Apply Zinsser's Principle in writing. Prefer Clear code over Clever Code. Avoid Primitive Obsession. Program with intention Favour loose coupling Favour High Cohesion Schedule Time to lower technical debt These Points are taken from https://www.youtube.com/watch?v=nVZE53IYi4w
Recent posts

20 Extensions for VSCode For Node+Angular2 Development

Here is the list of Extensions which I found important and Interesting. The names are in the form of  Author.Name christian-kohler.npm-intellisense CoenraadS.bracket-pair-colorizer DavidAnson.vscode-markdownlint dbaeumer.jshint donjayamanne.githistory ecmel.vscode-html-css eg2.tslint eg2.vscode-npm-script fknop.vscode-npm formulahendry.auto-close-tag formulahendry.auto-rename-tag HookyQR.beautify humao.rest-client lonefy.vscode-JS-CSS-HTML-formatter mkaufman.HTMLHint msjsdiag.debugger-for-chrome prashaantt.node-tdd rbbit.typescript-hero robertohuertasm.vscode-icons Zignd.html-css-class-completion See the following link to quickly install these extensions. Here is the extension.json . https://code.visualstudio.com/docs/editor/extension-gallery#_workspace-recommended-extensions

OpenERP 7 on Ubuntu

install the following sudo apt-get install graphviz ghostscript postgresql-client python-dateutil python-feedparser python-matplotlib python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-imaging gcc python-dev mc bzr python-setuptools python-babel python-feedparser python-reportlab-accel python-zsi python-openssl python-egenix-mxdatetime python-jinja2 python-unittest2 python-mock python-docutils lptools make python-psutil python-paramiko poppler-utils python-pdftools antiword postgresql sudo -u postgres createuser -s openerp install using To install the Debian/Ubuntu package, add the following line to your /etc/apt/sources.list: deb http://nightly.odoo.com/7.0/nightly/deb/ ./ And type: sudo apt-get update sudo apt-get install openerp

10 Tips For Clean Code

#1: You're responsible for code quality. #2: Use meaningful names. #3: Write code that expresses intent. #4: Code should speak for itself. Less comments = less maintenance. #5: Leave the code better than you found it. #6: Single-responsibility code. i.e function does 1 thing well. Less arguments = better function. classes: most methods use most of the class' properties. #7: Tests (TDD). #8: Work on big picture skeleton, then fill in the details later (interface first, implementation later). #9: Independent components that can be used in different places.  #10: Master your craft. From https://www.youtube.com/watch?v=UjhX2sVf0eg

API-AI

Intents ------ ------ An intent defines how the bot should react to what the user says. An intent in your agent represents a mapping between what a user says and what action should be taken by your product. Every intent you create should correspond to one question. In the intents you will write all the different ways of how those questions may be phrased by your customers. Don’t worry, you won’t have to write all of them. API.AI is using machine learning to train your agent to understand a lot more variations based on the examples you provide in intents. User Says --------- We can have several 'User Says' for a single intent.So we have input many different variations in which the user can as for the same intent. The API.AI platform uses machine learning to train agents to understand more variations of these examples. Even with a small number of examples, the agent can understand a lot of variations. You can try it with this agent. The more examples you add, the better the agent

Python - Learning - Important point - p4 - Modules

Python has a way to put definitions in a file and use them in a script or in an interactive instance of the interpreter. Such a file is called a  module ; definitions from a module can be  imported  into other modules or into the  main  module (the collection of variables that you have access to in a script executed at the top level and in calculator mode). A module is a file containing Python definitions and statements. The file name is the module name with the suffix  .py  appended. Within a module, the module’s name (as a string) is available as the value of the global variable  __name__ .  A module can contain executable statements as well as function definitions. These statements are intended to initialize the module. They are executed only the  first  time the module name is encountered in an import statement.  [1]  (They are also run if the file is executed as a script.) Each module has its own private symbol table, which is used as the global symbol table by all functions defin

Python - Learning - Important point - p3

List Functions - list. append ( x ) - list. extend ( L ) - list. insert ( i ,  x ) - list. remove ( x ) - list. pop ( [ i ] ) - list. clear ( ) - list. index ( x ) - list. count ( x ) - list. sort ( key=None ,  reverse=False ) - list. reverse ( ) - list. copy ( ) It is also possible to use a list as a queue, where the first element added is the first element retrieved (“first-in, first-out”); however, lists are not efficient for this purpose. While appends and pops from the end of list are fast, doing inserts or pops from the beginning of a list is slow (because all of the other elements have to be shifted by one). To implement a queue, use  collections.deque  which was designed to have fast appends and pops from both ends. There is a way to remove an item from a list given its index instead of its value: the  del  statement. This differs from the  pop()  method which returns a value. The  del  statement can also be used to remove slices from a list or clear the entire list (which we d