implementation

Things to consider when choosing new technology or software in enterprise

27 Feb , 2015  

There are few things that we can use as standar for choosing or adopting new technology in our company.

The List

We gave each team a list of features to look for in their assigned templating solution. The idea was to fill out a score, from one (poor) to five (excellent), for each item:

  1. DRY: how DRY is the the technology? is there support for code-reuse and partials?
  2. i18n: is there support for translations and multiple languages?
  3. Hot reload: are changes visible immediately or is there a compile/deploy cycle?
  4. Performance: how long does it take to render in the browser and server?
  5. Ramp-up time: how is the learning curve?
  6. Ramped-up productivity: once you’ve ramped-up, how fast can you build things?
  7. Server/client support: can support both client-side and server-side?
  8. Community: is there an active community using this project? Can you google issues?
  9. Library agnostic: are there dependencies on other libraries?
  10. Testable: how hard is it to write unit and integration tests?
  11. Debuggable: is it possible to step through the code while it’s running to track down errors?
  12. Editor support: is there an editor with auto-complete, syntax highlighting, error checking, etc?
  13. Maturity: is this a relatively stable project or still experimenting and churning?
  14. Documentation: how is the documentation?
  15. Code documentation: do the software encourage/require documentation/comments?

#inspired by https://engineering.linkedin.com/frontend/client-side-templating-throwdown-mustache-handlebars-dustjs-and-more

implementation

Implementation of User-Defined data using Struct in C++

20 Nov , 2012  

There are two kind group of data type that needed to reserve amount memory, primitive data and user-defined data. Primitive data just like Int (4 byte), Char (1 byte), Double (8 byte) and so on. But what about we construct our custom data types, like a new data type that contains Int and Char? Then this is called user-defined data.

Basically, we just gathering two or more primitive data into one new data type. For instance, first we have Customer and Grade variable:

1
2
int customer;
string address;

More…

,

implementation

How to doing memory debugging and profiling in C with Valgrind

12 Aug , 2012  

When we playing with C, memory debugging and profiling is a basic need to “break” and doing “analysis” to our C program. Valgrind is a good tools to help us doing memory debugging and profiling. In this case, I use Ubuntu 12.04.

First, we need to install Valgrind by :

1
sudo apt-get install valgrind

Next, let me create some a basic example, format-input.c :

1
2
3
4
5
6
7
8
9
10
#include <stdio.h>

int main(int argc, char *argv[]) {
    int apartment = 3;
    int storey;

    printf("My Apartment number is n");
    printf("My Apartment storey is %dn", storey);
    return 0;
}

In this code, you will see that apartment variable is unused and storey doesn’t have any value. When you doing :

1
2
make format-input
./format-input

You will see result :

1
2
My Apartment number is
My Apartment storey is 0

Definitely we see there two mistaken here but C compiler showing a good result. Well, we can doing deep analysis using Valgrind by :

1
valgrind ./format-input

And you will see the result :

The bottom line here is whatever you’re running your C program, better check with Valgrind to see if everything is goes right 🙂

Fixing the source :

1
2
3
4
5
6
7
8
9
10
#include <stdio.h>

int main(int argc, char *argv[]) {
    int apartment = 3;
    int storey = 33;

    printf("My Apartment number is %dn", apartment);
    printf("My Apartment storey is %dn", storey);
    return 0;
}

And Valgrind result are :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
==8443== Memcheck, a memory error detector
==8443== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==8443== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==8443== Command: ./formating-input
==8443==
My Apartment number is 3
My Apartment storey is 33
==8443==
==8443== HEAP SUMMARY:
==8443==     in use at exit: 0 bytes in 0 blocks
==8443==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==8443==
==8443== All heap blocks were freed -- no leaks are possible
==8443==
==8443== For counts of detected and suppressed errors, rerun with: -v
==8443== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

,

implementation

Using SublimeText for compiling and runing individual cpp files

22 Jul , 2012  

I prefer using SublimeText 2 for running individual files rather Eclipse. It’s pretty easy and quick. First, you need to download SublimeText 2 and install it your system.

Then second step, make sure you have G++ already installed in your system.

Ready to go? First, let we create some helloworld.cpp files from SublimeText 2:

1
2
3
4
5
6
7
#include <iostream>
using namespace std;

int main() {
    cout << "Hello wolrd!";
    return 0;
}

Then go to Tools -> Build System -> C++.

All you need are ” CTRL+B ” to build and “CTRL + SHIFT + B” to run individual files.
Easy isn’t ?