Thursday, August 30, 2012

Linksys SPA2102-R and TP-Link problem

All of a sudden my VoIP phone stopped working. The SPA2102-R and the TP-Link TD-8816 stopped working. In summary, I had to call my ISP. They had to do something on their side. The TP-Link modem then started to work and I had Internet connection. But the SPA2102-R would not work. It had the gree power light flashing. The patter was 3 flashes: the 1st one longer followed by 2 short ones. And I couldn't figure out why on earth it would not connect to the modem. The main indication of the problem was that the LAN light of the modem was off, indicating that the modem and the VoIP adapter were not connected. I called my ISP/VoIP support. They thought that because the LAN light was not turning on that there was some sort of hardware problem with the network card of the VoIP adapter. And they shipped another adapter to me (4 more days without a phone!) The new adapter arrived today. I plugged it in and I got the exact same problem.
  I tried different things. I noticed that when I set a fixed IP on the modem and on the VoIP adapter, the light patter on the VoIP adapter changed to almost all lights red flashing. I'm so glad that Cisco doesn't have detailed explanation of what the flashing patterns really mean! So it appeared that the adapter was taking the network settings. I then configured my notebook to be a DHCP server. And I noticed that the light pattern changed (for better): the power green light was solid and the Internet light was flashing (or solid? I can't remember). That was a hint that the problem was not with the adapter, but some detail of the network driver/controller of the modem.
  So I left the option that should not have worked but worked at the end: I put the VoIP adapter behind my wireless router. And it worked! It didn't work months ago, because the firewall of the wireless router would block certain (SIP ?) ports. But it worked today (with some changes to the firewall).

Monday, August 13, 2012

Angry Words

Angry Words   - Gustavo Frederico
A Sermon at the Ottawa Mennonite Church,  12/Aug/2012

 As a lay person, it is a rare opportunity for me to preach. I preached for months at my previous church in Vanier, a Baptist church, during the period it had no pastor. The best homiletical advice I ever heard came from a pastor from South Africa, who said to me jokingly once that what a preacher says in up to 10 minutes comes from God. From 10 to 15 minutes comes from himself or herself. After 15 minutes it comes from the Devil.
 A brazilian theologian, Valdir Steuernagel, once said that theology is personal. That the story of the theologian is behind its theology-making. I am here giving a piece of myself away in a certain way, as I try to state something about all this mystery of the beyond.
 One of the characteristics of Anabaptism that I admire is its emphasis on conflict resolution. How do angry words relate to conflict? I believe they are directly related. Anger, in my mind, implies tension or disagreement. Often angry words precede or announce some violent action. And so one can make other questions: is not reacting with anger any better than acting with anger? Is there such a thing as ‘good conflict’? I believe there is such a thing as ‘good conflict’. Angry words may be understandable, desirable or necessary, depending on the context.
  In contrast with anger I see another reaction: silence. There is a dangerous interpretation of certain biblical passages as if they always prescribed silence and inaction. When someone is offended, hurt or disrespected, the person may choose not to react at all. That, however, could be a prescription for one to be torn from the inside. To be silent may also endorse the offensive acts. The person would be harmed from the outside and from the inside. There are many passages that will lead us not to be angry. Jesus said “blessed are the meek” [Matthew 5:5a]. And also “If anyone slaps you on the right cheek, turn to them the other cheek also.” [ Matthew 5:39 TNIV]. Isaiah describes the Messiah: “He was oppressed and afflicted, yet he did not open his mouth; he was led like a lamb to the slaughter, and as a sheep before its shearers is silent, so he did not open his mouth. “ [ Isaiah 53.7 TNIV] The poet in Lamentations 3 writes “When God makes us suffer, we should be alone, patient and in silence. When we are offended, we should not react, but endure all insults” [ Lamentations 3:28,30 Gustavo’s translation from Portuguese Bible ] But let’s think: the author of Lamentations writes 5 poems and prayers and tells us to suffer in silence? If we read a bit further on in the same chapter the author is already praying angrily: “Pay them back what they deserve, O Lord, for what their hands have done. Put a veil over their hearts, and may your curse be on them! Pursue them in anger and destroy them from under the heavens of the Lord.” [ Lamentations 3:64-66 TNIV ]
  Angry Jesus
  When looking at Jesus too, we should not just preconceive the simple ‘gentle’ Jesus who said ‘blessed are the meek’. We should also take an angry Jesus calling Herod a fox, which apparently was a great insult. We should also remember the angry Jesus who said to the religious leaders of his time “you blind guides!”, “you blind fools!”, “you hypocrites!”, “You snakes! You brood of vipers!” . Do you think they felt offended? Are you ok with such a Jesus? We should also take an angry Jesus expelling merchants and shoppers from the temple [ Matthew 11:12,13 ] Dr. Walter Wink explains that to “turn the other cheek” in that cultural context may be something different than what many think. At that time, a master would reprimand a slave with a slap of the right hand on his right cheek. When the offended person offered the left cheek, the offender would need to strike a peer not as a master, but as an equal person. It was an act of identifying an abuse and exposing it as such, without escalating violence.
     When I was a little boy, I heard about a christian man from my uncle, who is a Baptist pastor in Brazil. My uncle was describing how meek this brother was. As I was told, he was never heard to say anything bad to anyone. Once, however, when someone ‘pushed a button’, he said “You dumb!” And he immediately felt very guilty about his outburst of anger and later prayed to God for forgiveness. I didn’t get to know the man, but I think that these kinds of feelings need to get out of one’s chest for one’s own well-being. Inaction may be an attempt to suppress feelings. And that is not good. We should not simply take constant ‘inaction’ as a moral virtue.
 I cherish the moments when reality knocks at our door and we see things more clearly. And I suspect that is often what happens as angry words go out. We are confronted by the reality of failure, pain, suffering and injustice. There is something good when there is space for expressions of our human condition to come out. I like that kind of prayer: the breathing of the human condition.
   Grace and Human Condition
  In one perspective, it may be fine for the church at large to invite sinners to repent and to live up to ‘higher standards’ of morality. I believe, however, that there is a common problem that deserves some care. When such call for ‘higher standards of morality’ turns into a prescription to preconceived notions of behaviour that should turn the person into some sort of spiritual superhero, we tend to hide the not-so-beautiful aspects of our human condition. In other words, if the church only shows ‘good behaviour’, it will not open up space for our brokenness to appear. Is it better for our brokenness to appear or should we hide it? Peter Rollins wrote about it this way: “So what is the alternative to attempting to hold ethical principles? The answer is creating a space of grace in which we are invited to bring our darkness to the surface, to speak of it in an environment in which we will not be condemned or made to feel guilty, a community that will let us speak our anxieties and darkness without asking us to change. In short, a place where we can confront our humanity rather than running from it.” [A] There is an inherent problem when separations between ‘spiritual’ and ‘worldly’ or ‘sacred’ and ‘secular’ are held in tension against each other. If being more spiritual means to be less human, displays of humanity indeed will label the person as not-so-spiritual.
  God Happens Inside the Human Life
  In 2010, as some of you know, I and my family spent the year in Brazil. I got to know some families that lived around a garbage dump and worked recycling garbage. They were forcefully displaced to the middle of nowhere by the government in a scheme of corruption with the subsidy of the World Bank. Joaquim was a young man displaced at the time along with his family. They were members of an evangelical church of a large denomination. When Joaquim and others noticed that nothing would happen, they decided to do something. They sought the help of a small community association. They tried to speak to local politicians. They tried to contact the press. They found a pro bono lawyer. They even wrote an email in English to top bureaucrats of the World Bank. For some reason, the local church didn’t like what Joaquim did. He was disciplined, where he was suspended from his leadership role in the church, and his family was forbidden to take the holy communion. Eventually he and his family were invited to leave. They told him that he was trusting in the justice of men and not in God’s justice.
  Is God in control of History, are we in control of it or is it all random? If we simply said that “God is in control of History”, it would become difficult to understand how he could allow so much suffering. If we simply said that “we are in control of History” or that it is all random, we could imply that God was out of the loop and forego hope and meaning. The brazilian theologian Leonardo Boff wrote about  Bultmann and his disciples: “After Kant [...] we definitely should exclude any objectivity of God, even the denomination of spirit and person. God is not an object of knowledge nor does he simply exist like the other realities. He happens inside the human life. He is that happening that allows the love to appear and in which the evildoer and despaired receive hope and future. [...] God continues to accomplish a function: he is the symbol towards the behaviour that Christ required from all: unbounded love and disinterested obedience to the calls of unlimited reciprocity. Wherever that happens, God is present there.” The latin american theologian Juan Luis Segundo wrote “If each word of God does not refer to a human experience, it becomes like a message written in an unknown language” [ Segundo in “The Liberation of Theology” ]
 I, for instance, get angry when someone explains injustice as something natural. Specially when the weak and the poor are condemned to suffer just because they are who they are. The  man who created the International Monetary Fund policy of Brazil in the late 60s was called Roberto Campos. To justify his policy where brazilian companies had to pay lending rates 7 times higher than foreign companies, he said "Obviously the world is unequal. Some are born intelligent, some stupid. Some are born athletes, others crippled. The world is made up of small and large enterprises. Some die early, in the prime of life; others drag themselves criminally through a long useless existence. There is a basic fundamental inequality in human nature, in the condition of things. The mechanism of credit cannot escape this." In other words, the destiny of some is to suffer to feed the greed of a few extremely rich and that is written in the stars. In religious circles, words that spiritualize unjust human relations or words that resort to God to stigmatize “the least of these” are particularly dangerous. One of the most famous pastors in Brazil, Silas Malafaia, for example, said that poverty is the result of disobedience to the laws of God.
  If God happens inside the human life, prayers are a conversation with human life and its contexts. If God happens inside the human life, History is sacred. Specially the versions reported by “the least of these”. I tend to pay more attention to the conscience that ascribes to God and to ourselves at the same time the responsibility of our fate. With angry words it is easier to play the blame game with God than to take individual or collective responsibility for action or inaction.
  The Bible in One Hand, the Newspaper in the Other
  The siege of Jerusalem in 587 BC by the Babylonians contains very harsh images. When reading Lamentations, I can’t help but relate to some brazilian stories. Some of them may be too graphic to describe here. One of the readings that draws my attention in these texts is that they not only speak about suffering and angry words to myself as an individual, but they also allude to a big picture and how relationships among nations influence the lives of ordinary people. When I read that “We must buy the water we drink; our wood can be had only at a price” “We submitted to Egypt and Assyria to get enough bread” (v.4,6) I remember some friends of mine in Brazil that have to buy propane from the black market controlled by police. When I read “God knows when in this country the prisoners are massacred without compassion. God knows when human rights, which he himself gave to us, are disrespected. Yes, he knows when they twist the justice in a process” [ Lam 3.34-36 Gustavo’s translation from Portuguese Bible ] I remember the Carandiru massacre, where 111 prisoners were killed by police in Brazil in one day in 1992. The religious leaders of the days of Jeremiah were guilty of inviting people to resist the Babylonians, and that resulted in more deaths. They persecuted Jeremiah and tried to kill him lobbying the king. We read in Lamentations 4:13: “All this happened because of the sins and iniquities of your prophets and your priests, guilty of causing the death of innocent people” [ Gustavo’s translation from Portuguese Bible ] My angry words are not related to personal persecution, but they speak to the evangelical deputies in Brazilian congress, who recently voted against a bill to expropriate land where slave labour is found.
 The poems in Lamentations are not trying to explain or justify or help understand suffering. Instead, they depict conversations with God that look at reality and honestly struggle with the divine. We only cry because there is hope that there is someone listening.

Saturday, August 11, 2012

Detecting Repeating Decimals

class Program
        static string RepeatingPattern(int m, int n)
            int i = 0;
            int j = (int)Math.Log10(m);
            int r = 0;
            HashSet remainders = new HashSet();
            string outt = ( m < n ) ? "0." : "";
            int num = m;
            do {
                num = Int32.Parse(("" + num).Substring(i, j - i + 1));
                char o;

                if (num < n)
                    int sizeN = (int)Math.Log10(n);
                    int sizeNum = (int)Math.Log10(num);
                    int diff = sizeN - sizeNum;

                    num = num * ((int)Math.Pow(10, diff));
                    outt += new String('0', diff);
                    j = j + diff;

                    num *= 10;
                    outt = "" + (num / n) + ".";
                r = num % n;
                int d = num / n;
                num = r;
                i = 0;
                j = (int)Math.Log10(num);

                if (remainders.Contains(r))
                    outt += ("" + d);
            } while( r != 0);

            return outt;

        static void Main(string[] args)
            string r;
          //  RepeatingPattern(5, 74);
            // RepeatingPattern(1, 81);
            r= RepeatingPattern(1, 7);

           r = RepeatingPattern(22, 7);

            r = RepeatingPattern(1, 97);

Friday, August 03, 2012

Basic notions of Multi-Channel Commerce Server Foundation

·         Entities are units of data structures and are declared in MetadataDefinitions.xml with the CommerceEntity element.
·         Entities have relationships to other Entities. Relationships are declared with the Relationships element.
·         An operation acts on an entity to query, create, update or delete instances. Operations are processed by Foundation’s only service entry point: the ProcessRequest method.
·         An operation may have related operations. Related operations declare sub-operations to be applied to the relationships of the base entity. For example, there can be an update operation on a Basket with a related operation to create a line item.
·         An operation with its related operations may be conceived as a tree of operations to be executed by Foundation.
·         Given the main Entity of an operation, one finds exactly one operation sequence responsible for actually executing the requested operation. Operation sequences are declared in ChannelConfiguration.config. For example, the operation sequence responsible for Basket queries is declared in
·         An operation sequence is made of a sequence of Components. Components are units of execution. Components frequenty work with the Commerce Server Core API.
·         Components work to create the result of an operation sequence. The result of an operation sequence is one or more Entities, each with its relationships to other Entities.

Reference: Multi-Channel Commerce Foundation Introduction, in Commerce Server 2009 R2: 

Wednesday, August 01, 2012

Destined to be poor

Here is a fragment of the book "Open Veins of Latin America: Five Centuries of the Pillage of a Continent" by Eduardo Galeano:

"Testifying before the parliamentary commission on the denationalization of Brazilian industry, two government ministers admitted that indigenously owned factories had been put at a disadvantage by the Castelo Branco regime's measure permitting the direct inflow of external credit. They were referring to the famous Order 289 of early 1965, which allowed foreign concerns operating in Brazil to get loans from abroad at 7 or 8 percent interest, with a government-guaranteed exchange arrangement in case the cruzeiro was devalued. Brazilian concerns had to pay almost 50 percent interest on credits they obtained -- with difficulty -- at home. The inventor of the measure, Roberto Campos, offered this explanation; "Obviously the world is unequal. Some are born intelligent, some stupid. Some are born athletes, others crippled. The world is made up of small and large enterprises. Some die early, in the prime of life; others drag themselves criminally through a long useless existence. There is a basic fundamental inequality in human nature, in the condition of things. The mechanism of credit cannot escape this. To postulate that national enterprises must have the same access to foreign credit as foreign enterprises is simply to ignore the basic realities of economics . . ." [This testimony appeared in the report of a parliamentary commission investigating transactions between national and foreign enterprises, dated September 6, 1968. Soon afterward Campos published a curious interpretation of the Peruvian government's nationalist stance. According to him, the Velasco Alvarado government's expropriation or Standard Oil was no more than an "exhibition of masculinity." The only objective of nationalism, he wrote, is to satisfy the human being's primitive need for hate. However, he added that "pride does not generate investments or increase the flow of capital . . ."21] [241] According to this brief but meaty "Capitalist Manifesto," the law of the jungle is the natural code governing human life; injustice does not exist, for what we know as injustice is merely an expression of the cruel harmony of the universe: poor countries are poor because . . . they are poor; our fate is written in the stars and we are born only to fulfill it. Some are condemned to obey, others are appointed to command. Some put their necks out and others put on the rope. The author of this theory was the creator of International Monetary Fund policy in Brazil."