2019-09-29

Scrum guide

"Scrum is a framework for developing, delivering, and sustaining complex products." - from Scrum Guide.


Scrum guide

2012-09-13

Java annotations example

I've done some small-scale presenting about annotations in Java based on a simple use case in my company. I thought I would post it here for a greater audience.

Annotations in Java is a very powerful enhancement that can save a lot of time for developers and programmers. Basically, it enables programmers to avoid creating bunch of configurations based on XML, database records, etc. Instead they can annotate certain classes or fields to achieve different configurations. That is how now we don't declare our servlets in web.xml with its class and URL pattern; instead we annotate them by typing @WebServlet in the Java file.

OK, the use case: Let's assume that we are developing a tax processing program. We have an entity class called Citizen.java which looks something like following:


Let's also assume that our program shall be a pretty generic one where we can define our processing formulas. Let's say we define formulas and set its variables to Citizen class' fields. Say we have if (A < (new Date()).getTime()) { B; } else { 0-B/2; }.

Obviously, some of the fields are irrelevant for formula designing. So, we define an annotation and annotate those fields which are relevant.


and
We have also defined an attribute called name for the annotation so that it can be more readable.

Finally, what and why are doing it is that we are building drop-down menus for setting variables in each formula we define. We are not able to fetch those fields annotated with @Calculated to fill those drop-down menus.

The ways to using these kind of functionality are left for your imaginations.

Of course, using reflections in run-time may make your program run slower. However, you can always cache the annotated fields list in your favorite embedded key-value store database.

2012-08-07

Embedded key-store store database wrapping-up

In my last post, I have mentioned about what a key-value store database and little about Sleepycat. While Sleepycat is great, it needs some configuration before actually using it. For this reason, I have written an wrapper which stores only unicode-based strings as key and value. The code is given in the following Gist. The usage example has been given in the comment.

2012-06-30

Embedded, persistent key-store

One often needs an embedded, persistent, key-store database solution if he/she is developing a software which relies on configurations made upon deployment. I was that one yesterday, so I looked up on the Internet for a solution. The solution was, with no convincing reason, Berkeley DB Java Edition, Sleepy Cat to be specific.

So here is the code chunk that did the trick! For a developer of modern languages like Python, it seemed like a lot of work for simple tasks. However, if you wrap it with your own code it can be helpful in many ways.


2012-01-09

The Friendship of the Music: A review for Genghis Blues


The world as we know is full of inspirations, surprises and other amazing things with all its diversity. This diversity is its people who vary from the highlanders in the Andes, to the arctic Eskimos, from city dwellers of enormous metropolitan areas to Tuareg people in the Saharan desert. The greatest inspiration that is maybe music, a common thing that all different cultures in the world share. The inspiration for Paul Pena, a renowned jazz musician from the United States, was a practice of music from the nomadic people in the Central Asian Altai mountains. Called khoomei locally, this is a style of throat-singing in which the performer produces multiple tones simultaneously making a unique melody. As interesting as how it sounds is the journey and friendship formed when Paul Pena wanted to know better about what he heard on radio.

Khoomei, otherwise called overtone singing, is practiced by the nomadic people in Mongolia, Chinese Inner Mongolia and Russian Siberian republics like Tuva and Khakassia. It’s believed that khoomei was originated from nomadic herdsmen trying to emulate sounds of mountains, rivers, sand and wild animals. Mongolian nomads have a very different lifestyle which have great impact on khoomei. Mongolian plateau consists of steppes and Gobi desert that last thousands of kilometers where one may not find people for days. Altai ranges have steep mountains raising over the clouds. Herding domestic animals in the arid steppes and hunting games in enormous mountains can last days and sometimes months without seeing home. In such geography and condition, wilderness can be friend of people. Culturally tied to Mongolia, Tuva is a republic in Russian Federation. Tuva was an independent country in the first half of the 20-th century [1]. Afterwards it was incorporated into Russia. The people in Tuva share  lots of cultural elements with Mongolians.

Paul Pena, an American jazz singer accidentally catches khoomei on the radio, when he was surprised by what he was hearing. Excited, he goes to a local music store to look up what he has just listened where he finds out about khoomei performed by Tuvan artists. He wants to go further and make some studies. Apparently he gets along with an organization called Friends of Tuva which is a friendly community that gathers information about Tuva. Friends of Tuva was formed by Nobel laureate physicist Richard Feynman and friends [2]. After performing khoomei unofficially in a Tuvan event in America, Paul Pena was invited to Tuva by Kongar-Ool Ondar who is a throat-singing master in Tuva. After informing with letters, just after the USSR was split, the group of friends travel to Tuva in a very long trip. They get there to be welcomed very friendly by the Tuvan people and meet Kongar-Ool Ondar. The group get along very nicely with local people thus establishing friendships with the people. Furthermore, having learnt khoomei before going to Tuva, Paul Pena wins Tuvan national throat-singing competition called Kargyrgaa [3]. Paul Pena and Kongar-Ool Ondar perform famous jazz music and Tuvan music together with big smiles on both of their faces. The friendship was there to grow and last rest of the following years.

The world is a big... big place. There are thousands of different ethnic groups and hundreds of different cultures which can not be easily percieved by each other. But inspirations are always there to be found by some medium. In “Genghis Blues”, the music was the medium and it connected different cultures to create friendships among them.  It can be best summarized by Paul Pena in his letter which states, “Kongar-Ool and I have been working in the hope of promoting better understanding between people of different nationalities, races, beliefs, languages, and cultural and economic systems. I believe that in this work there can be found evidence that such understanding and cooperation can be realized.” [3]

References
  1. World at War timelines. http://www.schudak.de/timelines/tannutuva1911-1944.html retrieved Jan 03, 2012
  2. Friends of Tuva website. Frequently asked questions: http://www.fotuva.org/faq/part_1.html retrieved Jan 03, 2012
  3. A personal letter by Paul Pena in 1994. http://www.fotuva.org/gb/paul.html retrieved Jan 03, 2012

2011-03-21

Verilog ашиглан цуваа танигч хийсэн минь

Verilog хэрэглээд цуваа танигч хийснийгээ та бүхэнтэй хуваалцья гэж бодлоо. Электрон хэлхээ нь хир зай эзлэх вэ, хэлхээ их халах уу гэх мэт асуудлуудыг бодолцоогүйг анхаарна уу!

Энд цуваа танигчийгаа finite-state machine болон цуваа оролт, паралель гаралттай shift register ашиглан хийсэн юм.

Finite-state machine


`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Module Name:   fsm
// Tool versions: Xilinx ISE 12.1
// Description:
//                Sequence detector using FSM
//
//////////////////////////////////////////////////////////////////////////////////
module fsm(clk, reset, inp, outp);
  input clk;
  input reset;
  input inp;
  output outp;
 
  reg[2:0] state;
  reg outp;
 
  always @(posedge clk) // always trigger on clk
     begin
        if (reset)  // check if reset
           begin
              state <= 3'b000;                outp <= 1'b0;             end          else        // else update outp             begin                if (state == 3'b111 & inp == 1'b0)                   outp <= 1'b1;                else                   outp <= 1'b0;             end          case(state) // state transition          3'b000:             if (inp == 1'b1) state <= 3'b001;             else state <= 3'b000;          3'b001:             if (inp == 1'b0) state <= 3'b010;             else state <= 3'b000;          3'b010:             if (inp == 1'b0) state <= 3'b011;             else state <= 3'b000;          3'b011:             if (inp == 1'b1) state <= 3'b100;             else state <= 3'b000;          3'b100:             if (inp == 1'b0) state <= 3'b101;             else state <= 3'b000;          3'b101:             if (inp == 1'b1) state <= 3'b110;             else state <= 3'b000;          3'b110:             if (inp == 1'b1) state <= 3'b111;             else state <= 3'b000;          3'b111:             state <= 3'b000;          default:             state <= 3'b000;          endcase       end       endmodule 

Хэлхээ нь ийм болж байна:

Shift-register


`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Module Name:   shr
// Tool versions: Xilinx ISE 12.1
// Description: 
//                Sequence detector using shift register
//
//////////////////////////////////////////////////////////////////////////////////
module shr(clk, reset, inp, outp);
   input clk;
   input reset;
   input inp;
   output outp;
   
   reg[7:0] shr;
   reg outp;
   
   always @(posedge clk) // always trigger on clk
      begin
         if (reset)  // check if reset
            begin
               shr <= 8'b00000000;
               outp <= 1'b0;
            end
         else
            begin
               shr <= shr << 1;
               shr[0] <= inp;
               if (shr == 8'b10010110)
                  outp <= 1'b1;
               else
                  outp <= 1'b0;
            end
         
      end

endmodule

За тэгээд 2уланг нь доорх тест модулиар ажиллууллаа даа:


`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Module Name:   shr_test
// Tool versions: Xilinx ISE 12.1
// Description:
//                Verilog Test Fixture created by ISE for modules:
//                   shr
//
////////////////////////////////////////////////////////////////////////////////

module shr_test;

// Inputs
reg clk;
reg reset;
reg inp;

// Outputs
wire outp;

// Instantiate the Unit Under Test (UUT)
shr uut (
 .clk(clk),
 .reset(reset),
 .inp(inp),
 .outp(outp)
);

always #5 clk = ~clk;

initial begin
 // Initialize
 clk = 1;
 inp = 0;
 reset = 0;

 // reset=1 when clk rises and reset=0
 // in the next rise of clk
 #9 reset = 1;
 #3 reset = 0;

 // Stimulus
 #1 inp = 1;
 #10 inp = 0;
 #10 inp = 0;
 #10 inp = 1;
 #10 inp = 0;
 #10 inp = 1;
 #10 inp = 1;
 #10 inp = 0;
 #30
 $finish;
end
    
endmodule

За тэгсэн чинь доорх симуляцууд гараад ирлээ.

Finite-state machine

Shift register