Federico Cargnelutti

Federico Cargnelutti

  • Intercepting class method invocations using metaclass programming in Python

    In Ruby, objects have a handy method called method_missing which allows one to handle method calls for methods that have not been defined. Most examples out there explain how to implement this in Python using __getattr__, however, none of them (honestly, none) explain how to intercept class method (@classmethod) invocations using __metaclass__. And this is…

    Read more: Intercepting class method invocations using metaclass programming in Python
    October 8, 2018
  • API Development Tips

    Organisations who are paying attention already know they need to have an open web API, and many already have under development or in the wild. Make sure you haven’t been caught by the pitfalls of many early API releases. Multiple points of failure: The 5 tips Test it all Plan for future versions Embrace standards…

    Read more: API Development Tips
    June 18, 2018
  • Collective Wisdom from the Experts

    I’ve finally had a chance to read a book I bought a while ago called “97 Things Every Software Architect Should Know – Collective Wisdom from the Experts“. Not the shortest title for a book, but very descriptive. I bought this book at the OSCON Conference in Portland last year. It’s an interesting book and…

    Read more: Collective Wisdom from the Experts
    June 6, 2018
  • How to create a Data Container Component in React

    One pattern I’ve used quite a lot while working with React at the BBC and Discovery Channel is the Data Container pattern. It became popular in the last couple of years thanks to libraries like Redux and Komposer. The idea is simple. When you build UI components in React you feed data into them via…

    Read more: How to create a Data Container Component in React
    March 24, 2018
  • How to pass variables to a Docker container when building a Node app

    Environment variables are declared with the ENV statement and are notated in the Dockerfile either with $VARIABLE_NAME or ${VARIABLE_NAME}. Passing variables at build-time The ENV instruction sets the environment variable to the value. The environment variables set using ENV will persist when a container is run from the resulting image. For example: The Dockerfile allows you to specify arguments…

    Read more: How to pass variables to a Docker container when building a Node app
    November 5, 2016
  • Website performance monitoring tool

    Monitoring systems allow you to monitor changes to your front-end code base over time, catching any regression issues and monitoring the ongoing effects of any performance optimisation changes. Easy to use dashboards are a must when it comes to monitoring the state of your web apps. Companies like Calibre or SpeedCurve offer this as a…

    Read more: Website performance monitoring tool
    August 1, 2016
  • Node.js: How to mock the imports of an ES6 module

    The package mock-require is useful if you want to mock require statements in Node.js. It has a simple API that allows you to mock anything, from a single exported function to a standard library. Here’s an example: app/config.js app/services/content.js test/services/content_spec.js

    Read more: Node.js: How to mock the imports of an ES6 module
    July 18, 2016
  • Recommender Systems: Content-based, Social recommendations and Collaborative filtering

    With the proliferation of video on-demand streaming services, viewers face a big challenge: finding content across multiple screens and apps. There may be quality information available online but it may be difficult to find. Traditionally, viewers resort to “app switching” which can be frustrating when it comes to finding quality content. With the emergence of…

    Read more: Recommender Systems: Content-based, Social recommendations and Collaborative filtering
    June 26, 2016
  • Geo Proximity Search: The Haversine Equation

    I’m working on a project that requires Geo proximity search. Basically, what I’m doing is plotting a radius around a point on a map, which is defined by the distance between two points on the map given their latitudes and longitudes. To achieve this I’m using the Haversine formula (spherical trigonometry). This equation is important…

    Read more: Geo Proximity Search: The Haversine Equation
    December 8, 2014
  • Installing multiple versions of Ruby using RVM

    Ruby Version Manager (RVM) is a tool that allows you to install multiple versions of Ruby and have multiple versions of the same interpreter. Very handy for those who have to maintain different applications using different versions of Ruby. To start, download RVM and install the latest stable version of Ruby: $ echo insecure >>…

    Read more: Installing multiple versions of Ruby using RVM
    August 26, 2014
  • MySQL Split String Function

    MySQL does not include a function to split a delimited string. However, it’s very easy to create your own function. Create function syntax A user-defined function is a way to extend MySQL with a new function that works like a native MySQL function. To create a function, you must have the INSERT privilege for the…

    Read more: MySQL Split String Function
    February 22, 2014
  • Software Architecture Document Guidelines

    Regardless of the development process that you use, a description of the software architecture can be essential for any project, big or small. If software architecture is about the structure of a system and is the vehicle for satisfying the requirements, then the software architecture document is a written description of this. The Software Architecture…

    Read more: Software Architecture Document Guidelines
    August 16, 2013
  • Check whether your web server is correctly configured

    Last year Zone-H reported a record number of 1.5 million websites defacements. 1 million of those websites where running Apache. When it comes to configuring a web server, some people tend to turn everything on by default. Developers are happy because the functionality that they wanted is available without any extra configuration, and there is…

    Read more: Check whether your web server is correctly configured
    December 11, 2011
  • OSCON 2010, The O’Reilly Open Source Convention

    A couple of weeks ago I attended the O’Reilly Open Source Convention (OSCON) in Portland. OSCON has hundreds of sessions and activities focused on all aspects of open source software. I met some great people, the talks were good and I saw some promising ideas and technologies. Workshops attended Android for Java Developers Marko Gargenta…

    Read more: OSCON 2010, The O’Reilly Open Source Convention
    August 9, 2010
  • Implementing Dynamic Finders and Parsing Method Expressions

    Most ORMs support the concept of dynamic finders. A dynamic finder looks like a normal method invocation, but the method itself doesn’t exist, instead, it’s generated dynamically and processed via another method at runtime. A good example of this is Ruby. When you invoke a method that doesn’t exist, it raises a NoMethodError exception, unless…

    Read more: Implementing Dynamic Finders and Parsing Method Expressions
    March 22, 2010
  • Command-line memcached stat reporter

    Nicholas Tang wrote a nice little perl script that shows a basic memcached top display for a list of servers. You can specify thresholds, for instance, and it’ll change color to red if you exceed the thresholds. You can also choose the refresh/sleep time, and whether to show immediate (per second) stats, or lifetime stats.…

    Read more: Command-line memcached stat reporter
    November 29, 2009
  • Database Replication Adapter for Zend Framework Applications

    Last updated: 21 Feb, 2010 Database replication is an option that allows the content of one database to be replicated to another database or databases, providing a mechanism to scale out the database. Scaling out the database allows more activities to be processed and more users to access the database by running multiple copies of…

    Read more: Database Replication Adapter for Zend Framework Applications
    October 2, 2009
  • Zend Framework DAL: DAOs and DataMappers

    A Data Access Layer (DAL) is the layer of your application that provides simplified access to data stored in persistent storage of some kind. For example, the DAL might return a reference to an object complete with its attributes instead of a row of fields from a database table. A Data Access Objects (DAO) is…

    Read more: Zend Framework DAL: DAOs and DataMappers
    September 19, 2009
  • Apache HTTP DoS tool released

    Yesterday an interesting HTTP DoS tool has been released. The tool performs a Denial of Service attack on Apache (and some other, see below) servers by exhausting available connections. While there are a lot of DoS tools available today, this one is particularly interesting because it holds the connection open while sending incomplete HTTP requests…

    Read more: Apache HTTP DoS tool released
    June 22, 2009
  • Java, C, Python and nested loops

    Java has no goto statement, to break or continue multiple-nested loop or switch constructs, Java programmers place labels on loop and switch constructs, and then break out of or continue to the block named by the label. The following example shows how to use java break statement to terminate the labeled loop: public class BreakLabel…

    Read more: Java, C, Python and nested loops
    June 16, 2009
1 2 3 … 6
Next Page→
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
 

Loading Comments...
 

    • Subscribe Subscribed
      • Federico Cargnelutti
      Join 1,419 other subscribers
    • Already have a WordPress.com account? Log in now.
    • Federico Cargnelutti
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar