Free Code Camp: Building with React and Redux

About two weeks ago I decided to tackle the React Projects on Free Code Camp. In doing so I met and worked through a few challenges that I want to remember:

First, I had to learn React. The truth is that I had not spent any time on my programming projects since I left my job at the University in January. The good news it that picking up JS again was like riding a bicycle, difficult to forget. Since Free Code Camp has not yet released their React curriculum, I spent some of my Thanksgiving holiday working through the free React course by Tyler McGinnis at reacttraining.com. After completing the course I built my first two React projects:

See the Pen React Markdown Previewer by Nate Gay (@nateinaction) on CodePen.

See the Pen React FCC Leaderboard by Nate Gay (@nateinaction) on CodePen.

The second challenge I encountered was managing state in apps as they grew in complexity. As I began building the third FCC React project (a project to store recipes) I found that managing individual component state and passing props became a little confusing and the code started looking more spaghetti-like. At this point, I decided to investigate the Redux library to help manage application state.

The third challenge was actually learning Redux. To learn Redux I settled on working through the official guide which is very well done but takes on an order that may seem strange to someone new to the library. The Redux guide starts by showing how to build actions, then reducers, then creating the store and finally integrating with React. I felt like the guide skipped over a basic explanation for the order so I will give one here: “Forget about React for a minute and build a working version of your application logic entirely in Redux. As you follow this guide you will first build the actions which tell Redux to modify application state then you will build reducers that actually do the modification and return the new state of the application. You should then be able to create the store and test your application logic through declarative dispatch calls with responses returned by the console. Finally, we will integrate your Redux application logic with React.”

Without this simple explanation, I suffered through a crisis of confidence after my first day reading the docs, building and playing with the example application. I still felt like I didn’t understand why I would build an app in this way and that I did not yet have enough knowledge to integrate it into my half-built Recipes App. After complaining a little to my fiancé I decided to sit down with a clean slate and try to build all of the behavior of my recipes app in Redux. After a little trial and error, it became pretty easy to work in Redux since I was getting constant feedback about my application state from my dispatch statements in the console. By the end of the night, I had my first Redux application.

The next day it took only a few hours to integrate my Redux Recipes app with the React components I had already made. Here is the result:

See the Pen FCC React-Redux-LocalStorage Recipes by Nate Gay (@nateinaction) on CodePen.

The Pope is Coming!

The Pope will be arriving in Ecuador in less than a week and the excitement is almost tangible. It seems like everyone in Ecuador is talking about the visit especially about which days they will have off of work! The Pope will be visiting Ecuador’s largest city of Guayaquil and then spending two days in Quito where he’ll give mass at the old airport, now called Bicentennial Park.

I too am excited to watch the flurry caused by Pope Francisco’s visit although I’ve been told to expect internet outages… Yuck! One phenomenon that has really gripped me has been the onslaught of songs welcoming the Pope to Ecuador. Every night the local news broadcasts a new artist performing another take on what is quickly becoming an old classic, “Bienvenido Papa Francisco.”

[youtube https://youtu.be/qLkC8Geb5Rc ]

Another interesting occurrence has been the use of Pope Francisco’s visit by the Ecuadorian government to promote their political agenda. Television advertisements featuring the Pope often appear next to quoted phrases about social equality. One example being used in ads is the phrase “Debe exigirse la redistribución de la riqueza” or “The redistribution of wealth should be required.” This phrase echoes the government’s current political battle in raising taxes on inheritance and real estate sales.

I prefer this government promotion welcoming Pope Fransisco to “the country that loves life!”

Government poster for the Pope in Ecuador

A Community in Mourning

When I first heard that three students had been murdered in Chapel Hill on Tuesday night I only connected with the tragedy through my personal relationship with the town (I lived there for several years and some of my family still lives there), frustration from what I assumed was a faith-targeted crime, and sadness at their violent deaths. It was not until the following day that I learned that all three students had attended my university. Two were NC State alumni and one was a sophomore in the College of Design.

On Thursday evening, I found my way to the center of campus life, the brickyard, where our Muslim Students’ Association had organized a candlelight vigil. The area was already filled with people because I was running late and the darkness that preceded the setting sun made it difficult to pick out my girlfriend from the crowd. When I caught up with her she told me that I had just missed the call to prayer. She described the call as being “intense and exotic” with a serene backdrop of leaves blowing in the breeze as the color faded from the sky. It was her first time hearing a muezzin reciting a call to prayer and I think for many present it may have been cause for a similar sense of awe.

Standing in a gathering of several hundred, I was struck most by the deafening silence. No one spoke during the prayer nor afterward. One speaker after another entered and exited the stage without sound or movement from the crowd. The Chancellor, the Governor, the Student Body President, the Vice Provost all spoke and gave their condolences but the huddled masses showed no sign of breaking the silence.

Then the mood changed. When Deah’s older brother Farris came to the microphone, the chilling winter wind faded from conscious thought and the crowd held up their lit cell phones in support. He spoke of his faith that all three were in a better place and of the incredible journey that transpired after their deaths. I was, at first, taken aback by his mention of their deaths led to this “amazing experience” but then I realized why I was there.

Both my girlfriend and I wanted to share our love and support for our grieving friends and for the targeted minority within our community. This is what he was referring to: thousands attended the vigil in Chapel Hill the night before, thousands attended the funeral, and hundreds within our own community showed up to carry on the legacy of support. If we, as a community can aid in the grieving process then I feel compelled to be a part of that. When Farris exited the stage he did so to a large supportive applause.

One of the most powerful moments during the vigil was when Deah’s older sister Suzanne Barakat spoke. She described herself as an alumni of UNC and a Tar Heel. Normally such an admission would draw jeers from State students but not tonight; respectful silence persisted. Suzanne then raised her hand and made the Wolfpack sign.

Suzanne Barakat giving wolfpack sign

The community responded in kind. She also excited to applause.

Wolpack giving the pack sign

I did not know Deah, Yusor, or Razan but I know that their deaths led to a beautiful communal gathering in support of their grieving friends, family, and the campus-wide Muslim community. I am proud of my Wolfpack today.

Photo credit: NC State and WNCN

Je ne suis pas Charlie

It is not my intention to distance myself from the peaceful Parisian protests against extremism. Instead I wish to put forward my objections to the response cover printed by Charlie Hebdo.

Earlier this month members of a radical Islam sect attacked the office of the satire magazine Charlie Hebdo. The gunmen killed 11 people and caused injury to 11 more. Afterward, nearly 4 million people marched in Paris to uphold values such as national unity and freedom of speech. Many held signs containing a slogan of unity with the satirical magazine “Je suis Charlie.”

Je suis Charlie march

Following the attack, the publication took the opportunity, not to align with the message of freedom and hope offered by demonstrators but rather to further insult followers of Islam. The cover, as seen above, features the Prophet Muhammed crying with a message saying that all is forgiven.

I support the message of forgiveness but not the method. Depicting the Prophet Mohammed on the cover misses the point of the international outrage. The outrage centered around a disgust toward the shooting deaths in Paris. Charlie Hebdo had the option to aid in the discussion by picking a cover image that displayed the same expression of unity as seen in the march.

Instead of providing a sense of community for all who abhor violence the cover insults a single group of people, Muslims. Free speech is an integral part of a free society but the cover unfairly targets a single community in a hurtful way. As satire, the cover has succeeded in sparking conversation on topics such as radical Islam and freedom of speech but ultimately it spreads a message of hate and further deepens the rift between devout Muslims and religious tolerance. Je ne suis pas Charlie.

The Great Power Veto Must Go!

Security Council Chamber

The UN Security Council met for the first time on January 17th, 1946 with an unequal amount of power in the hands of the P-5 nations: the United States, Great Britain, France, the Union of Soviet Socialist Republics, and China. In its earliest meetings, UN member states raised questions concerning the misuse of the veto power by way of the “double veto.” Additionally, member states began to eye with suspicion whether the Security Council was able to act on their primary responsibility of international peace and security without first considering the political interests of the P-5 members. Finally, the Security Council drew ire from member states over the reservation of the veto power for only the permanent five nations which precluded equality of the Council’s members in the decision making process. Today, as the Security Council adapts to face modern threats, their method of voting ought to also adapt to the modern realities of globalization; the Great Power veto must go.

During its first decade, the Security Council faced an unforeseen failure of its voting method. The Yalta voting formula, which had been agreed upon by the three allied leaders Stalin, Roosevelt, and Churchill at the conference in Crimea near the end of World War II, provided a veto power held by the permanent five members on substantive issues. As early as September 1950 the Security Council began addressing the voting failure which came to be known as the “double veto.” (Rudzinski 443) A “double veto” occurs when a permanent member calls for a substantive vote on whether or not a previous procedural vote was indeed procedural. By vetoing this subsequent vote, the original procedural vote becomes substantive and therefore any vetoes by a permanent member would block the action even if it had passed as a procedural motion. (Rudzinski 448) The Council addressed the issue of the “double veto” in its 506th meeting where the Formosa precedent was devised which allows the sitting president of the Council to decide if there is sufficient doubt in whether a question is procedural before allowing it to become a substantive action. (Rudzinski 454-455) This precedent still relies wholly on the whims and political persuasions of the sitting president. (Rudzinski 461) In this sense, the problem of the “double veto” was never resolved, it was only bandaged to allow the Council to continue functioning without voting reform.

As peacekeeping is considered a substantive issue, it requires the consent of the P-5 nations. Any single veto can prevent the creation of a peacekeeping force and thus stop the Security Council from aiding in the prevention or pacification of conflict. The blocking of such resolutions prevents the Council from fulfilling its primary responsibility as written in article twenty-four paragraph one of the UN Charter: the maintenance of peace and international security. Instead of acting in the interest of their primary responsibility, the Security Council often acts as a chess board for superpowers attempting to expand their geopolitical influence. (Gagnon 812) This ongoing exclusive political game hampers the original intent of the Council and thus often renders it ineffective in achieving its primary responsibility. Without reforming the Yalta voting formula, obstruction of the Council’s responsibility to international peace and security will continue unabated.

In the 2000s the Security Council has found itself facing a familiar foe, the UN Charter. The fairness of permanent seats on the Council are again in doubt and member states are scrutinizing the Charter for answers. The veto power, reserved for use by only the five great powers, seems to be directly in conflict with article two paragraph one of the UN Charter which reads “the Organization is based on the principle of the sovereign equality of all its Members.” Even with active discussions on veto power reform, member states have been unable to agree on what the exact problem is and how to resolve it. Developing nations dispute the Council’s unsatisfactory geographic representation while economic powers claim the rights to permanent seats for paying comparatively large dues over smaller member states. (Gareth 9) Additional concern has been voiced due to the authoritarian nature of the Council’s newfound legislative powers. (Talmon 177) The uneven and exclusionary voting formula employed by the Security Council undermines the powerful ideals of sovereign equality so touted by the UN Charter, this duplicity should be reason enough to reform the Council’s method of voting.

Tasked to prevent future large scale conflicts, the Security Council is perhaps the most important body within the United Nations. Although the Council has functioned for sixty-eight years, it has done so with a flawed and elitist voting model. The world at large relies on the Security Council to uphold its responsibility of ushering in an era of peace and stability. This reliance comes at a great cost to UN member nations, the cost of unavoidable authoritarianism at the highest levels of governance. The United Nations was built on the premise of egalitarianism between sovereign member states and it’s time that the Security Council adopts a reformed voting formula which reflects this reality.

Sources:

  • Gagnon, Mona Harrington. “Peace Forces and the Veto: The Relevance of Consent.” International Organization 21.04 (1967): 812-36. Print.
  • Rudzinski, A. W. “The So-Called Double Veto: Some Changes in the Voting Practice of the Security Council.” American Journal of International Law 45 (1951): 443-61. ProQuest. Web. 14 Apr. 2014.
  • Talmon, Stefan. “The Security Council as World Legislature.” The American Journal of International Law 99.1 (2005): 175. Print.
  • “Top Table Trouble.” The World Today 61.8/9 (2005): 8-9. JSTOR. Web. 14 Apr. 2014.

McCain on Ukraine

I believe Senator McCain (R-AZ) has given an excellent analysis of possible US military and economic posturing in response to the Russian intervention in Ukraine. Russia is pushing for a referendum to be held on March 16th to determine whether the Autonomous Republic of Crimea should rejoin the Russian Federation. Crimea serves as a strategic naval outpost for Russia as it allows for access to the Black Sea and the greater Mediterranean.

A Country on Fire

In January 2011 Al Jazeera streamed a live feed from Tahrir Square in Cairo. I watched day after nail biting day as the turmoil unfolded. Tonight, I’ve become fixed on a live video feed from the Kiev. Esprero TV has brought us onto the frontline of the protestors at Independence Square. A fire fueled by trash, discarded clothing, and molotov cocktails draws the line separating riot police from activists.

CNN is reporting 21 deaths today in Kiev, I hope that a peace is reached quickly and that it is more lasting than in Egypt.

A Long Way Home

In the Spring of 2009 I was traveling with my older brother through western Europe. We had stopped in Venice and had planned to continue our journey through Southern Italy followed by a sea voyage to Greece. One of our sisters flew in to join us on our Italian escapade and so it was to be the three of us together for the next several weeks. However, the day before we were to disembark I decided on a whim to change the plan. I called my parents back in the States and informed them that I would instead be traveling to Greece by way of the Balkans and that I would be going alone.

Traveling with my parents as a child exposed me to countless foreign cultures and I learned early not to fear the unknown but to explore it. Perhaps it was this early exposure which led me to think western Europe mundane. Train hopping through western European nations seemed to be the norm for most young travelers. Seeing the Colosseum in Rome or relaxing for a few days in Santorini was to be had by those looking for an unforgettable vacation. And, in that sense, continuing the trip with my siblings sounded appealing enough. In truth though, I longed for something else, for something different – I longed for an unforgettable adventure.

Venice train station at sunset

Some of the most memorable moments of my trip throughout western Europe happened aboard a train; the trip East would prove to be no different. Leaving the Cathedrals and oil slick waters of Venice behind, I snagged a ticket on the first train headed to Zagreb. I had never ridden in a sleeper car before and I expected to be quickly lulled to sleep by the constant thumping of the track below me. That said, I never made it to sleep, instead I partied the night away with a handful of other backpackers who were headed for the beaches of Dubrovnik. We traded stories, read palms, sang songs, and drank all night long in the luxury of the marble floored dining car.

We arrived at Zagreb early, the sun was just cresting the horizon as we pulled into the station. All of the vendors were closed and my late night companions collapsed on the empty benches around the eerily deserted station. When the stalls did finally open, I was ripely ready for breakfast. A merchant obliged to take my euros for the purchase of some fruit and happily returned my change in the form of Croatian kuna. I learned that I had some time before the train to Sarajevo was to depart so, for the next couple hours, I walked around the city of Zagreb. It saddens me that I did not spend more time there as I discovered Zagreb to be a beautiful city.

Panorama of Zagreb

When I made my way back to the station shortly before 9am, I walked past several vendors and salivated at the thought of eating. At the time, I refrained from buying more food because I only had a few kuna left and I expected that more reasonable prices awaited me in the food car on my next train. As I stepped onto the train and began to look around, I realized that there was no dining car to be found. My plan to eat had been dashed and I was famished when I felt the thumping return, we had left Zagreb. Damn.

A Response to Obama’s Address to the Nation on Syria

President Obama Addresses the Nation

I have just been scolded by our Commander in Chief because I hold the desire for a diplomatic outcome in regard to the use of chemical weapons by the Assad regime in Syria. A bold but sincere speech on the evening of September 10th was an extension of President Obama’s personal thoughts that warfare can be both ethical and necessary if the cause is just.

The president challenged members of congress and the American public to watch videos of the attack and then take a stance on whether a US military strike in Syria would be an appropriate response. For me, these videos of dead men, women, and children are not new and not shocking. More than 100,000 Syrians have died in their civil war and videos of the turmoil have been readily available in human rights related social news and media outlets for years. How are the sarin gas deaths of August 21st more deserving of an international response than all of the atrocities committed in the past two years?

The president stated that the use of chemical weapons had changed the game and threatened international security requiring a military response. He asserted that future dictators would take a lack of military intervention as a sign that it is acceptable to gas their citizens. This is inconsistent with the overwhelming decline of worldwide chemical weapons arsenals in the last 100 years. The president himself stressed that 189 governments, sovereign over 98 percent of humanity, have signed the UN Chemical Weapons Convention and agree not to use chemical weapons. Further, the Organization for the Prohibition of Chemical Weapons has reported that in the last 15 years more than 80 percent of the world’s stockpiled chemical agents have been verifiably destroyed. This means that President Obama’s pronouncement that chemical weapons use will increase is in direct conflict with the progress reaped from peaceful international cooperation.

Now that a peaceful resolution has been proposed by Russia and Syria has voiced amiability in making concessions, the argument in support of military intervention has lost it’s tongue. That said, it is the opinion of this citizen that world peace was once again threatened by the military might of a US oligarchy. The president alone has the power to conduct unilateral warfare without resolution from the security council and limited to no congressional oversight. To realize the dream of a more secure and peaceful world the US itself must make concessions. We need to reign in the control of our military beyond the direction of one person within the executive branch. We should also dampen the ability of our military, without international consensus, to conduct foreign strikes in the absence of a direct and imminent threat.

Sources: OPCW Demilitarization report, Transcript of President Obama’s speech

In the Shadow of Pichincha

Quito lies on the eastern edge of Pichincha, one of many active volcanos in the region. Pichincha’s highest peak reaches almost 15,700 ft. Oddly enough, there’s an amusement park at it’s base appropriately titled VulQano Park. Adjacent to the amusement park is the TelefériQo, a cable car which takes you just 2,700 ft from the summit. That’s where I went last Saturday.

Katrin and I took a taxi for $4 up to the park and found it to be mostly abandoned. The rides surely drew a crowd but there were many deserted buildings which seemingly had lost their purpose since the area opened in 2005. It was odd to see signs worn from disuse indicating the direction to discotecas, restaurants, bars, stores, and museums all of which were empty and overgrown.

Abandoned buildings at Quito's TelefériQo

These decaying facilities surrounded others which had been well kept. The building selling tickets for the TelefériQo, for example, was beautiful with floor to ceiling windows and marble floors. I’m sorry that I didn’t get a picture of it although I know I’ll be heading back there to summit Pichincha sometime during my stay. The view from the lookout areas at the top of the TelefériQo were phenomenal, I recommend spending the $8.50 to ride to the top. It is one of the most beautiful places I have ever visited.

While on top of the mountain I walked up a dirt path and found two llamas laying down minding their own business. Looking up, I saw a sign hanging on a nearby shrub which read “Pictures with llamas with hat 50¢.” My first thought was “YES! I ABSOLUTELY WANT TO TAKE PICTURES WITH LLAMAS WEARING HATS!” You can imagine my disappointment when the girl put the hat on me instead. Although, I still consider it a justified expense.

They should have been wearing hats...

The rest of the week has been pretty interesting as well. On Monday, the folks from Vida Verde took Katrin, James (a student from the UK) and me to the Centro Historico district in Quito. We toured the area with many beautiful colonial era Spanish buildings and churches. Then, around 11am, we watched the changing of the guard at the center of governance, el Palacio de Carondelet.

The changing of guards is a 45 minutes ceremony with a full brass band accompaniment. It occurs every Monday at 11am and is normally attended by the President, Rafael Correa. This week the Vice President, Lenín Moreno, took his place as it was his last week in office. Soldiers in full dress uniforms with spurs on their boots marched holding spears tipped with Ecuadorian flags. School children from the primary, middle, and high school grades were selected to attend and sat in front of all the action. I enjoyed seeing this ceremony and I’m hoping to sneak back on another day to see President Correa. I appreciate Vida Verde taking us on these outings around the city without any extra expense or planning on my part.

Ceremony at el Palacio de Carondelet

Every week at Vida Verde the school pairs you with a different teacher. At first I was not excited for the transition, I had enjoyed working with Hipatia, but in the end I think such a simple change helped further improve my Spanish. This week I worked with Elena, her style was very different from Hipatia’s. Hipatia made me speak and we would converse for much of the class whereas Elena talked my ears off. At the beginning of the week I had trouble comprehending the quickness of her speaking but by the end of class today I felt like we were speaking together rather well. I’m starting to work at the A2 level and everyday I am noticing an improvement in my ability to speak and understand.

Tomorrow is a national holiday marking the Battle of Pichincha. The battle captured the city of Quito from Spanish rule in 1822. There are no classes tomorrow so Katrin and I are headed to Baños for the weekend. It should be fun!