sábado, 7 de julho de 2018

Using GPU processing to optimize your applications


Nowadays CPUs have a high processing capability, and you can benefit from its multiple cores by using parallelism to your applications. There are several frameworks that allow you to do this, like for example the Task Parallel Library (TPL)
But you can go further by using the GPU. General-purpose computing on graphics processing units (GPGPU) might be the solution if you need to perform very heavy processing. Just like your CPU might be a dual- or quad-core device, GPUs can host several hundred or thousand cores. You can use all this power to not only calculate graphics but also arithmetic operations.

To unleash all this power there are several frameworks:

However, if your working experience is mainly with high level programming languages, and you don't have much Algebra knowledge, you might find it quite complex to start on this world, and to identify how you can benefit from all this processing power.

There are several applications of this technology. It works the best performing simple operations, in big amounts of data, were all threads are performing the same operation. 

terça-feira, 17 de abril de 2018

CAKE! What is it?

Do you know what CAKE is? Not for eating :)


It allows to write build scripts in C#. Typically build configurations (from TFS, Team City, Jenkins, ...) are technology dependent and are not under source control. Not with CAKE.


Nice blog explaining its usage.
https://codeopinion.com/automating-builds-with-cake-c-make/

terça-feira, 27 de março de 2018

Why to use containers and Kubernetes?

I am sure you have been hearing a lot about containers and Kubernetes. But what are they? For what use? Can they really be used in production or are just a "toy"?
It happens that your can google it to learn more about it. Unfortunately most of the information you will find is quite abstract, or right away too technical, or is more like the slides of a manager of some consulting company that just wants to sell something to someone that just wants to buy something for the company they work for in order to justify a promotion because they will b able to make a nice presentation with some nice buzz words on it.

Scott Hanselman is great on making complex topics understandable. And here is a good example on containers.

Improving your drawing skills

I always struggle on expressing myself to drawing. Here is the prove :)

However there are people that do it quite nice and easy. I think I will try to lean from them.

quarta-feira, 21 de março de 2018

Are your test cases polluted with object instantiations?

You should consider using the builder pattern with the fluent syntax. A good example from the good google testing blog.

Company small = newCompany().setEmployees(2).setBoardMembers(2).build();

I have used it myself in a C# project and it is really useful as you ensure you build always valid objects, it has a high code reuse, and is very readable.
But of course there are some challenges, like what should be the default values of such objects? It is very difficult to achieve that your tests will not turn red when you modify one of this default values  under the hood (or like the British say, under the bonnet :) ).
Even thought the builder pattern is an alternative to the mother pattern at some point you will need some combination of both in order to create some quite different types of objects. Or... can it be that it is a code smell? That if this happens is because the production code is not respecting the single responsibility principle?
Also, in C# you achieve the builder pattern by using extension methods, that of course you will need to implement and maintain.

Nevertheless I highly recommend using this pattern in your tests. I know no better alternative.

quarta-feira, 14 de março de 2018

Is BDD simply about test automation?

I just found out that at some point in time I was a BDD pervert :)

I was reading a very useful article about the correct usage of BDD. Some anti-patterns are mentioned, and I found out I was falling in at least one of them: "Automation is a side benefit — not the reason to do BDD".

It happens that I was using Specflow, and thinking that just because of that reason I could say I was doing BDD. Wrong! Its clear that achieving a higher quota of automated tests is one of the benefits, but you don't have to automate all your scenarios.
Also the origin of the scenarios was not the best. The scenarios were sometimes scenarios written by the tester, from interpreting the requirements.
There were also some scenarios were coming from the product owner without much interaction with the team.
From the technology point of view, Specflow was sitting on top of our end-to-end testing infrastructure. If it is correct that is another discussion. 
BDD is much more than automating tests, it is about conversations between the "three amigos" (business, development, testing). They need to sit together from the beginning. You should go through concrete scenarios. This way you will clarify the expectations everyone has, uncover wrong assumptions, and hunt bugs even before they are born.

sexta-feira, 9 de março de 2018

Cucumber (Specflow in .net) vs. Robot Framewrok

In a previous blog I mentioned my finding on KDT (Keyword Driven Testing).

A famous framework is Robot Framework. I could avoid seeing its similarities with Specflow, but a little more complicated to integrate as you will my be introducing another programming language to your project. In Robot Framework you will be programming your keywords and functionalities in Python.

Well, I was not the first having this question. I could find a very nice answer to my questions.
Also a comparison.

quinta-feira, 8 de março de 2018

KDT (keyword driven testing)

Today I got to know the existence of KDT (keyword driven testing). Again from the Test Project blog. One of the frameworks that allows this in the Robot Framework.
As a previous user of Specflow I am not yet seing much benefit when comparing the two. More the complexity brought by adding a scripting language (Python for example) to define the keywords implementation.
But definitively I will check it further.

Is it worth to check "too green" automated tests

Its been quite a while since my last post... Let's try to reactivate this blog!

Just stepped into a test blog recently, Test Project. They have quite some interesting articles there including one about how to test tests. It is a little superficial, but just made me thought about "green tests". If there is a test that since years is being run on the build server, and never failed, is it a smell? Is it a useful test?
First I  would say it depends on how the automated testing infrastructure is setup. Let's say the developers must always run a suite of tests on their end (and they actually follow the process, or the tolls make them), then you cannot say that the test is "too green" in the build server, as the possible false assertion never reaches it. But if there is a Gated check in, or tests that are only run on the build server side, then it would be interesting to make some measurements to check when this tests last failed. I will give it a thought :)


sexta-feira, 26 de março de 2010

Utilitários - Utilizar o comando "dir" para criar listagens de ficheiros

Nunca precisaram de criar um ficheiro de texto com os ficheiros contidos por uma pasta? Então em vez de o fazer "à mão" poderão passar a fazê-lo da seguinte forma:

- abrir uma consola;
- entrar na pasta com os ficheiros;
- executar o comando:
dir /d /b > aMinhaListagem.txt

Será então criado um ficheiro com o nome aMinhaListagem.txt, contendo o nome dos ficheiros da pasta.
Para mais informação de como usar o comando dir:
http://www.computerhope.com/dirhlp.htm

quinta-feira, 25 de março de 2010

PL/SQL - Como obter os dados de um dicionário ordenados

Se quizerem obter os dados de um dicionário como o seguinte, basta que tenha o índice único, que ao fazer "instância do dicionário".FIRST irão obter o record mais "baixo".

TYPE a_places_i_lived IS TABLE OF VARCHAR2(50) 
INDEX BY VARCHAR2(10);

No link seguinte têm um exemplo completo.

DECLARE
-- Declare the table
   TYPE a_places_i_lived IS TABLE OF VARCHAR2 (50)
      INDEX BY VARCHAR2 (10);

--declare my table variable
   v_places_i_lived   a_places_i_lived;
-- Declare a temporary holding variable
   v_current          VARCHAR2 (10);
BEGIN
-- Initialize the array in unsorted order
   v_places_i_lived ('LA') := 'New Orleans';
   v_places_i_lived ('FL') := 'Tampa';
   v_places_i_lived ('TX') := 'San Antonio';
   v_places_i_lived ('CA') := 'Los Angeles';
   v_places_i_lived ('CT') := 'New Haven';

--starts from the end
   v_current := v_places_i_lived.LAST;

   LOOP
    -- Exit when we hit the bottom of the table
      EXIT WHEN v_current IS NULL;
    -- Print out
      DBMS_OUTPUT.put_line ('Index is: ' || v_current||' Value is: ' || v_places_i_lived (v_current));

-- delete the current
      v_places_i_lived.delete(v_current);
      v_current := v_places_i_lived.LAST;
   END LOOP;
END;

sábado, 20 de março de 2010

Utilitários - C# code Format

Ferramenta que permite formatar código C#, VB, HTML, XML, T-SQL ou MSH, para publicar em websites ou em blogs.

http://www.manoli.net/csharpformat/

sexta-feira, 19 de março de 2010

ASP.NET - Ciclo de vida das páginas

Artigo com o ciclo de vida das páginas ASP.NET, no primeiro carregamento, e quando é postback.

http://misfitgeek.com/blog/aspnet/unwinding-the-page-lifecycle-events/

PL/SQL - Criação e iteração de um array associativo



declare
    TYPE assoc_areaGeoTotal IS TABLE OF number INDEX BY varchar2(10);

    totaisGeograficos assoc_areaGeoTotal;
    pkArea number;
begin

    for r_area in (select * from t_fii_area_geografica_s order by nome)
    loop
    
        IF NOT totaisGeograficos.EXISTS(to_char(r_area.pk)) THEN
            totaisGeograficos(to_char(r_area.pk)) := 0;
        END IF;

        totaisGeograficos(to_char(r_area.pk)) := 88;
    end loop;

 pkArea := totaisGeograficos.first;
 while pkArea is not null loop
 
        dbms_output.put_line(pkArea ||':'||totaisGeograficos(pkArea));
  pkArea := totaisGeograficos.next(pkArea);
 end loop;
end;

O meu primeiro post

Sou um simples Engenheiro Informático a trabalhar como Analista/Programador à três anos. Tenho trabalho principalmente com tecnologias  Microsoft (.NET, SQL Server). Mas nos últimos tempos fui parar à banca, onde trabalho com Oracle PL/SQL.

O principal objectivo deste blog é servir como memória de curto/médio prazo das dificuldades que vou encontrando na implementação dos projectos em que estou envolvido.
Espero também ter a colaboração de amigos/colegas de profissão, que terão com certeza problemas semelhantes ao que já encontrei, e aos que vou encontrar.
Garantidamente muitos de vós irão encontrar problemas semelhantes aos que tive, e espero que esta memória escrita também vos possa ajudar.

Seguidores

Contribuidores