tag:blogger.com,1999:blog-25087112787520784342024-03-18T15:17:09.367+05:30Mahboob's JournalExistential Thoughts, Experiential Inferences and (Occasional) Whacky Connectionsmahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.comBlogger113125tag:blogger.com,1999:blog-2508711278752078434.post-41123092504409983572020-05-20T01:48:00.001+05:302020-11-23T00:25:26.722+05:30News Clippings, 11-May-2020 to 17-May-2020<div dir="ltr" style="font-family: Georgia; font-size:18px;text-align: justify;" trbidi="on">
11-May-2020<br/>
Did India miss a trick in testing? [Mint]<br/>
Countries with relatively high testing rates had to impose fewer lockdown restrictions, and have been able to open up far more quicker than India.<br/>
<br/>
KCR-chaired meet favours controlled farming [The Hindu]<br/>
Denial of Rythu Bandhu, MSP to farmers not raising crops suggested by government mooted<br/>
https://www.thehindu.com/news/cities/Hyderabad/kcr-chaired-meet-favours-controlled-farming/article31552943.ece<br/>
<br/>
Plasma therapy trials from today [The Hindu]<br/>
15 people, who recovered from COVID, ready to donate their plasma<br/>
<br/>
<a name='more'></a>
NIV develops test to detect antibodies [The Hindu]<br/>
Indigenous ELISA test will be used to screen 30,000 samples from 75 COVID-19 hotspot districts.<br/>
<br/>
Venture Capital Fund for Scheduled Casts (SC) / Backward Classes (BC) [The Hindu]<br/>
Govt. advertisement<br/>
<br/>
The epidemic and ensuring safety in courts [The Hindu]<br/>
Suitable measures must be put in place for conducting proceeding after the lockdown is lifted.<br/>
<br/>
The trends shaping the post-COVID-19 world [The Hindu]<br/>
Six geopolitical lines will define the contours of the emerging global order<br/>
<br/><br/>
12-May-2020<br/>
White-collar jobs : That Sinking Feeling [Mint]<br/>
As the pain from covid-19 intensifies, the higher layers of India's job pyramid are facing the heat<br/>
<br/>
Labour law reform experiments that could show us a path ahead [Mint]<br/>
Changes in labour rules by some states could help us understand how to improve policy elsewhere<br/>
<br/>
Legal but not appropriate [The Hindu]<br/>
Far-reaching changes have been made to labour laws without scrutiny by the legislature<br/>
<br/>
Equal freedom and forced labout [The Hindu]<br/>
The steps being taken by States, under the cover of COVID-19, of removing labour laws are grossly unconstitutional<br/>
<br/>
Playing out live, a narrative of discrimination [The Hindu]<br/>
The war on the pandemic is turning out to be an undeclared war against the workers of India, especially Adivasis.<br/>
<br/>
Anutpaadaka Vyayaale Asalu Chetu [Andhra Jyothi]<br/>
<br/>
Naannaku Cheppadaaniki Bathroom Lo Rehearsals Chesaa [Andhra Jyothi]<br/>
<br/>
13-May-2020<br/>
Reaffirm cooperative federalism [The Hindu]<br/>
Responding effectively to the pandemic requires the Centre to view he States as equals<br/>
<br/>
Lockdown sees spurt in domestic violence cases [The Hindu]<br/>
72% of complaints at Sakhi One Stop Centres pertains to harassment<br/>
<br/>
COVID-19 and the path ahead [The Hindu]<br/>
India needs to blend acute disaster management strategies with longer-term public health measures<br/>
<br/>
Data Point: Massive job losses [The Hindu]<br/>
<br/>
Getting cash transfers out of a JAM [The Hindu]<br/>
For effective cash relief in response to the COVID-19 crisis, the government must think beyond the Jan Dhan Yojana<br/>
<br/>
Riding roughshod over State governments [The Hindu]<br/>
Guidelines issued by the Centre to the States under the Disaster Management Act are unconstitutional<br/>
<br/>
Why Labour Law Rejig Is No Reform [Mint]<br/>
In the race to replace China as the new factory hub, will India's workers lose even basic protections?<br/>
<br/>
Maa NeeLLu maa hakku [Andhra Jyothi]<br/>
Aa merake Pothireddupaadu vadda kattukuntunnaam. Maake parimithulu vidhinchaalanukuntunnara?<br/>
<br/>
Maro jala poraataniki samsiddhamavudham [Andhra Jyothi]<br/>
<br/>
Akka nunchi amma nayyaanu [Andhra Jyothi]<br/>
<br/>
14-May-2020<br/>
Provide income support, restore jobs [The Hindu]<br/>
On the contrary, scrapping labor laws will only reduce wages, lower earnings and reduce consumer demand.<br/>
<br/>
A plan to revive a broken economy [The Hindu]<br/>
There are clear, implementable steps that Centre can take in fiscal terms to revive the economy and support livelihoods<br/>
<br/>
15-May-2020<br/>
Ad in The Hindu<br/>
Nenu Vinnanu.. Nenu Unnanu<br/>
YSR Rythu Bharosa - PM Kisan Scheme<br/>
<br/>
Are India's labour laws too restrictive? [The Hindu]<br/>
For employers, availability of skilled workforce and worker-management ties are more vital.<br/>
<br/>
How India Binges On Its Booze Economy [Mint]<br/>
An average Indian drinks 5.7 litres of alcohol a year and states earn over Re 2 tn. Covid may make the attraction stronger<br/>
<br/>
States cannot be left to the Centre's mercy [The Hindu]<br/>
Not only are the States not paid what is due to them, they have also lost the powers to raise their own sales tax revenues<br/>
<br/>
Stop the return to laissez-faire [The Hindu]<br/>
Labour laws are civilisational goal and cannot be trumped on the excuse of a pandemic<br/>
<br/>
What the worlk looks like Post Lockdown [Mint]<br/>
<br/>
Vrutthi Naipunyale Jeevana Sopaanalu [Andhra Jyothi]<br/>
<br/>
Sathyaanantara Kaalam Lo Satyam [Andhra Jyothi]<br/>
<br/>
16-May-2020<br/>
How a market turned into a COVID-19 hotspot [The Hindu]<br/>
The Tamil Nadu government's decision to keep the crowded Koyambedu market open during the lockdown has proved costly.<br/>
<br/>
Golden Graf [Andhra Jyothi]<br/>
<br/>
17-May-2020<br/>
Aiming to achieve herd immunity naturally is 'dangerous', WHO warns [The Hindu]<br/>
<br/>
Centre asks KRMB to stop AP's Krishna diversion plans [The Hindu]<br/>
River board told to convene a meet at the earliest, plans Apex Council meet too<br/>
<br/>
Quiz [The Hindu]<br/>
Jala Raajakeeyam [Andhra Jyothi]<br/>
Burma Lo O Telugu Magaadu [Andhra Jyothi]<br/>
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com1tag:blogger.com,1999:blog-2508711278752078434.post-6469133408285567572020-03-08T02:19:00.002+05:302021-02-17T08:34:13.293+05:30Post-truth politics and why the antidote isn’t simply ‘fact-checking’ and truth<div dir="ltr" style="font-family: Georgia; font-size:18px;text-align: justify;" trbidi="on">
<figure>
<img src="https://images.theconversation.com/files/198936/original/file-20171213-10621-1fs8079.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=400&fit=clip" />
<figcaption>
Donald Trump posts a link to his very own ‘Real News Update’ on Facebook.
<span class="attribution"><a class="source" href="https://www.facebook.com/DonaldTrump/">Donald J. Trump/Facebook</a></span>
</figcaption>
</figure>
<span><a href="https://theconversation.com/profiles/john-keane-267">John Keane</a>, <em><a href="https://theconversation.com/institutions/university-of-sydney-841">University of Sydney</a></em></span>
<p><em>This article is part of the <a href="https://theconversation.com/au/topics/revolutions-and-counter-revolutions-49124">Revolutions and Counter Revolutions</a> series, curated by <a href="https://theconversation.com/au/topics/democracy-futures">Democracy Futures</a>as a <a href="http://sydneydemocracynetwork.org/democracy-futures/">joint global initiative</a> between the <a href="http://sydneydemocracynetwork.org/">Sydney Democracy Network</a> and The Conversation. The project aims to stimulate fresh thinking about the many challenges facing democracies in the 21st century.</em></p>
<p><em>It is also part of an <a href="https://theconversation.com/au/topics/post-truth-initiative-38606">ongoing series</a> from the <a href="https://posttruthinitiative.org/">Post-Truth Initiative</a>, a Strategic Research Excellence Initiative at the University of Sydney.</em></p>
<p><em>This essay is much longer than most Conversation articles, so will take some time to read. Enjoy!</em></p>
<hr>
<p>We live in an unfinished revolutionary age of communicative abundance. Networked digital machines and information flows are slowly but surely shaping practically every institution in which we live our daily lives. </p>
<p>For the first time in history, thanks to built-in cheap microprocessors, these algorithmic devices and information systems integrate texts, sounds and images in compact, easily storable, reproducible and portable digital form. </p>
<a name='more'></a>
<p>Communicative abundance enables messages to be sent and received through multiple user points, in chosen time, real or delayed, within global networks that are affordable and accessible to billions of people.</p>
<p>My book <a href="http://www.johnkeane.net/portfolio_page/democracy-and-media-decadence/">Democracy and Media Decadence</a> probed the contours of this revolution. It showed why new information platforms, robust muckraking and cross-border publics are among the exciting social and political trends of our time. It proposed that the unfinished revolution is dogged by politically threatening contradictions and decadent counter-trends. The drift toward a world of “post-truth” politics is among these troubling trends.</p>
<p>What exactly is meant by the term post-truth? Paradoxically, post-truth is among the most-talked-about yet least-well-defined meme words of our time. Most observers in the English-speaking world cite the 2016 Word of the Year Oxford English Dictionaries <a href="https://en.oxforddictionaries.com/word-of-the-year/word-of-the-year-2016">entry</a>: post-truth is the public burial of “objective facts” by an avalanche of media “appeals to emotion and personal belief”.</p>
<p>In China and in the Spanish-speaking world, respectively, commonplace talk of <em>hòu zhēnxiāng</em> and <em>posverdad</em> pushes in this direction. The <a href="http://www.spiegel.de/kultur/gesellschaft/wort-des-jahres-2016-postfaktisch-gekuert-a-1125124.html">popularity of the German <em>postfaktisch</em></a> (post-factual) usage captures much the same meaning. Selected as word of the year by the German language society Gesellschaft für deutsche Sprache (GfdS), it refers to the growing tendency of “political and social discussions” to be dominated by “emotions instead of facts”. </p>
<p>The GfdS adds:</p>
<blockquote>
<p>Ever greater sections of the population are ready to ignore facts, and even to accept obvious lies willingly. Not the claim to truth, but the expression of the ‘felt truth’ leads to success in the ‘post-factual age’.</p>
</blockquote>
<h2>Post-truth communication</h2>
<p>A catchword that has gone viral so quickly surely deserves careful attention and crisper definition, especially if we are not to be thrown off balance by a global phenomenon that sets out to do precisely that. </p>
<p>We can say that “post-truth” is not simply the opposite of truth, however that is defined; it is more complicated. It is better described as an omnibus term, a word for communication comprising a salmagundi or assemblage of different but interconnected phenomena. </p>
<p>Its troubling potency in public life flows from its hybrid qualities, its combination of different elements in ways that defy expectations and confuse its recipients.</p>
<p>Post-truth has recombinant qualities. For a start, it is a type of communication that includes old-fashioned lying, where speakers say things about themselves and their world that are at odds with impressions and convictions that they harbour in their mind’s eye. </p>
<p>Liars attempt alchemy: when someone tells lies they wilfully say things they “know” not to be true, for effect. An example is when Donald Trump claims there was never a <a href="http://www.factcheck.org/2016/06/trumps-dubious-drought-claims/">drought in California</a>, or that during his inauguration the <a href="http://www.independent.co.uk/news/world/americas/donald-trump-us-president-false-claims-inauguration-white-house-sean-spicer-kellyanen-conway-press-a7541171.html">weather cleared</a>, when actually light rain fell throughout his address.</p>
<figure>
<iframe width="440" height="260" src="https://www.youtube.com/embed/fqIhkiaxRas?wmode=transparent&start=0" frameborder="0" allowfullscreen></iframe>
<figcaption><span class="caption">‘The truth is it stopped immediately, it was amazing.’</span></figcaption>
</figure>
<p>Post-truth also includes forms of public discourse commonly called bullshit. It comprises communication that displaces and nullifies concerns about veracity. Bullshit is hot air talk, verbal excrement that lacks nutrient. It is shooting off at the mouth, backed by the presumption that it is acceptable to others in the conversation.</p>
<p>Post-truth depends as well on buffoonery, bits and pieces of colourful communication designed to attract and distract public attention and to interrupt the background noise of conventional politics and public life. The bric-a-brac component of post-truth includes nonsense moments, jokes and boasting. It embraces clever quips, pedantry and wilful exaggerations (like Marine Le Pen’s description of the European Union as “<a href="https://www.theguardian.com/world/2017/mar/15/marine-le-pen-nigel-farage-britain-france-leave-eu-front-national">a huge prison</a>”).</p>
<p>There is plenty of rough speech. The contrast with the honey words and smiles of Bill Clinton, Felipe González, Tony Blair and other politicians from yesteryear is striking. The grotesquerie comes in abundance. Geert Wilders specialises in causing trouble, as when he dubs mosques “<a href="https://www.theguardian.com/commentisfree/2017/mar/17/dutch-greenleft-party-populism-rightwing-jesse-klaver">palaces of hatred</a>”.</p>
<p>Disturbingly, there’s abundant talk of the importance of “truth”, by which is usually meant utterances whose veracity is self-confirming, thus proving that truth can attract rogues. There is dog-whistling. There is plain bad taste, as when a newly elected president enters the Houston Astrodome, crammed with traumatised homeless people who have narrowly survived a hurricane, and says: “<a href="https://www.vox.com/policy-and-politics/2017/8/29/16222404/trump-crowd-hurricane-harvey-victims">Thanks for coming</a>.”</p>
<p>Hair-splitting and wilfully setting things aside are common. The Israeli consul-general in New York, Dani Dayan, does this well, but the genius of evasion is surely <a href="https://www.youtube.com/watch?v=fkY5seB0nFM">Zoltán Kovács</a>, the Orbán government’s spokesman. When subjected to forensic questioning by reporters about Hungary’s imprisonment and brutal maltreatment of refugees and operations by vigilante citizens’ “hunter patrol” border forces, he likes to say:</p>
<blockquote>
<p>What you are trying to portray here is non-existent, a gross simplification. Next question. </p>
</blockquote>
<p>And that’s that.</p>
<h2>Engineered silence</h2>
<p>The silencing is not incidental. Post-truth performances feed on their production of silence. They remind us, in the <a href="https://books.google.com.au/books?id=aGn7zu22oloC&pg=PA77&dq=Man+and+people++stupendous+reality+that+is+language&hl=en&sa=X&ved=0ahUKEwie9rbb1bjZAhVFmZQKHZvaAs8Q6AEIJzAA#v=onepage&q=Man%20and%20people%20%20stupendous%20reality%20that%20is%20language&f=false">words of Spanish philosopher José Ortega y Gasset</a>, that:</p>
<blockquote>
<p>… the stupendous reality that is language cannot be understood unless we begin by observing that speech consists above all in silences.</p>
</blockquote>
<p>The proponents of post-truth communication relish things unsaid. Their bluff and bluster is designed not only to attract public attention. </p>
<p>It simultaneously hides from public attention things (such as growing inequalities of wealth, the militarisation of democracy and the accelerating death of non-human species) that it doesn’t want others to notice, or that potentially arouse suspicions of the style and substance of post-truth politics. </p>
<p>This engendered silence is not just the aftermath or “leftover” of post-truth communication. Every moment of post-truth communication using words backed by signs and text is actively shaped by what is unsaid, or what is not sayable. </p>
<p>The communicative performances of the post-truth champions are thus the marginalia of silence: mere foam and waves on its deep waters. </p>
<p>That is why the current hyper-concentration of journalists and other public commentators on “breaking news” stories about “fake news”, “alternative facts” and missing “evidence” is so potentially misleading. </p>
<p>Their fetish of breaking news turns them unwittingly into the poodles of post-truth and its silence about things less immediate and less obvious, deeper institutional trends, “slower” events marked by punctuated rhythms.</p>
<h2>Vaudeville and gaslighting</h2>
<p>Treating post-truth as a species of pugnacious politics dressed in a coat of many colours, as a bricolage of lies, bullshit, buffoonery and silence, helps us grasp its vaudeville quality. </p>
<p>When thought of as a public performance led by a cast of politicians, journalists, public relations agencies, think tanks and other players, post-truth is an updated, state-of-the-art political equivalent of early 20th-century vaudeville performances. </p>
<p>Old-fashioned vaudeville featured strongmen and singers, dancers and drummers, minstrels and magicians, acrobats and athletes, comedians and circus animals. It was a show. Post-truth is equally a show. Directed against conventional styles of performance, it is an orchestrated public spectacle designed to invite and entertain millions of people.</p>
<p>But post-truth is much more than entertainment, or the “<a href="http://www.columbia.edu/itc/journalism/j6075/edit/boor.html">art of contrivance</a>” or the “<a href="https://mitpress.mit.edu/books/society-spectacle">dictatorship of illusion</a>” mediated by the production and passive consumption of commodities. </p>
<p>While the genealogy of post-truth is partly traceable to the world of corporate advertising and market-driven entertainment, it has thoroughly political qualities. In the hands of the powerful, or those bent on climbing the ladders of power over others, the post-truth phenomenon functions as a new weapon of political manipulation. </p>
<p>Post-truth is not only about winning votes, siding with friends, or dealing with political foes. It has more sinister effects. It is a gaslighting exercise.</p>
<figure class="align-center ">
<img alt="" src="https://images.theconversation.com/files/198937/original/file-20171213-10594-16scxt.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=300&fit=clip" srcset="https://images.theconversation.com/files/198937/original/file-20171213-10594-16scxt.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=400&h=901&fit=clip&dpr=1 600w, https://images.theconversation.com/files/198937/original/file-20171213-10594-16scxt.jpg?ixlib=rb-1.1.0&q=30&auto=format&w=400&h=901&fit=clip&dpr=2 1200w, https://images.theconversation.com/files/198937/original/file-20171213-10594-16scxt.jpg?ixlib=rb-1.1.0&q=15&auto=format&w=400&h=901&fit=clip&dpr=3 1800w, https://images.theconversation.com/files/198937/original/file-20171213-10594-16scxt.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=4504&h=1132&fit=clip&dpr=1 754w, https://images.theconversation.com/files/198937/original/file-20171213-10594-16scxt.jpg?ixlib=rb-1.1.0&q=30&auto=format&w=450&h=1132&fit=clip&dpr=2 1508w, https://images.theconversation.com/files/198937/original/file-20171213-10594-16scxt.jpg?ixlib=rb-1.1.0&q=15&auto=format&w=450&h=1132&fit=clip&dpr=3 2262w" sizes="(min-width: 1466px) 754px, (max-width: 599px) 100vw, (min-width: 600px) 600px, 237px">
<figcaption>
<span class="caption">‘Strange drama of a captive sweetheart!’</span>
<span class="attribution"><span class="source">Wikipedia Commons</span></span>
</figcaption>
</figure>
<p>Drawn from George Cukor’s award-winning <a href="https://en.wikipedia.org/wiki/Gaslight_(1944_film)">Gaslight</a>, starring Ingrid Bergman and Charles Boyer, the term gaslighting is here defined as a weapon of the will to power. It is the organised effort by public figures to mess with citizens’ identities, to deploy lies, bullshit, buffoonery and silence for the purpose of sowing seeds of doubt and confusion among subjects. </p>
<p>Gaslighting is typically a preferred tactic of narcissistic and aggressive personalities bent on doing whatever it takes to gain and maintain a position of advantage over others. </p>
<p>Their point is to disorient and destabilise people. They want to harness people’s self-doubts, ruin their capacity for seeing the world ironically, destroy their capacity for making judgements, in order to drive them durably into submission.</p>
<p>When (for instance) gaslighters say something, only later to say that they never said such a thing and that they would never have never dreamed of saying such a thing, their aim is gradually to turn citizens into mere playthings of power.</p>
<p>When that happens, the victims of gaslighting no longer trust their own judgements. They buy into the tactics of the manipulator. Not knowing what to believe, they give up, shrug their shoulders and fall by default under the spell of the gaslighter.</p>
<p>Consider the double act of Philippines President Rodrigo Duterte and his former right-hand gaslighter, Ernesto Abella, in the sequence of events triggered by the murder (in November 2016) of Rolando Espinosa, the elected mayor of Albuera, an island community some 575 kilometres from Manila. </p>
<p>When asked by journalists to explain what had happened, Duterte reportedly <a href="http://www.smh.com.au/world/war-on-drugs-philippine-president-duterte-warns-mayors-will-be-shot-20170112-gtpzsr.html">said</a>: </p>
<blockquote>
<p>He was killed in a very [questionable way], but I don’t care. The policemen said he resisted arrest. Then I will stick with the story of the police because [they are] under me.</p>
</blockquote>
<p>Espinosa was in fact shot in detention, inside a police cell.</p>
<p>Duterte continued:</p>
<blockquote>
<p>I might go down in history as the butcher. It’s up to you. </p>
</blockquote>
<p>And then: </p>
<blockquote>
<p>Since I have nothing to show, I just use extrajudicial killing. [That’s because] I have no credentials to boast about.</p>
</blockquote>
<p>The intended meaning of these utterances (to put things mildly) was oracular, so mystifyingly opaque that they served as the cue for Abella to strut his stuff: to go on air and to say that this or that never happened, that Duterte never said what people heard him say, that Bisaya-speaking Duterte got lost in translation when speaking in Tagalog, to affirm at Malacañang press conferences that his intentions are good and that he is utterly sincere, whereas his enemies are wilful dissemblers, fools and toads. </p>
<p>Abella insisted he provided not “crumbs”, but “meat, deboned”. Armed with his favourite phrases, “let’s just say” and “let’s put it this way”, he described his job as “completing the sentences” of his leader, to “impart his true intentions”. </p>
<p>In this murder case, Abella <a href="http://newsinfo.inquirer.net/861267/abella-kill-order-just-dutertes-messaging-style">said</a>, “it is … a matter of the leadership style and the messaging style of the president”. He added:</p>
<blockquote>
<p>This is his messaging style to underline his intention. He is serious about it [the drug menace]. However, it’s just meant to underline his seriousness in making sure that nobody is corrupt and involved in criminality.</p>
</blockquote>
<h2>What makes post-truth different from the past?</h2>
<p>The meandering rhetoric is designed to bewitch and beguile, which is why the critics of post-truth are sounding alarms and issuing stern warnings about the dangerous charms of the vaudeville show of political mendacity, nonsense, buffoonery and silence. </p>
<p>They emphasise that political lying and bad manners spiced with talk of “fake news” and “alternative facts” are sinister, a frontal challenge to the basic democratic norms of open and plural communication among citizens. </p>
<p>Complaints against post-truth are often robust, loud and couched in high moral tones. Post-truth is said to be the beginning of the end of politics as we’ve known it in existing democracies. </p>
<p>There is talk of an emergent “post-truth era”. More than a few critics warn that the spread of post-truth is the harbinger of a new “totalitarianism”. Others speak of populist dictatorship or “fascism-lite” government.</p>
<p>The descriptors are questionable, and display little understanding of the historical originality of the present drift towards government by gaslighting. Politics as the art of evasion, befuddlement and engineered public silence isn’t new. Lying in politics is an ancient art. Think of Plato’s noble lie, or Machiavelli’s recommendation that a successful prince must be “<a href="http://www.constitution.org/mac/prince18.htm">a great pretender and dissembler</a>”, or Harry Truman’s <a href="https://books.google.com.au/books?id=F_m5LlaJvZcC&q=no-good+lying+bastard#v=snippet&q=no-good%20lying%20bastard&f=false">description of Richard Nixon</a> as:</p>
<blockquote>
<p>… a no good, lying bastard. He can lie out of both sides of his mouth at the same time, and if he ever caught himself telling the truth, he’d lie just to keep his hand in.</p>
</blockquote>
<figure class="align-center ">
<img alt="" src="https://images.theconversation.com/files/198938/original/file-20171213-10605-1sesgzk.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=754&fit=clip" srcset="https://images.theconversation.com/files/198938/original/file-20171213-10605-1sesgzk.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=600&h=300&fit=crop&dpr=1 600w, https://images.theconversation.com/files/198938/original/file-20171213-10605-1sesgzk.jpg?ixlib=rb-1.1.0&q=30&auto=format&w=600&h=300&fit=crop&dpr=2 1200w, https://images.theconversation.com/files/198938/original/file-20171213-10605-1sesgzk.jpg?ixlib=rb-1.1.0&q=15&auto=format&w=600&h=300&fit=crop&dpr=3 1800w, https://images.theconversation.com/files/198938/original/file-20171213-10605-1sesgzk.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=754&h=377&fit=crop&dpr=1 754w, https://images.theconversation.com/files/198938/original/file-20171213-10605-1sesgzk.jpg?ixlib=rb-1.1.0&q=30&auto=format&w=754&h=377&fit=crop&dpr=2 1508w, https://images.theconversation.com/files/198938/original/file-20171213-10605-1sesgzk.jpg?ixlib=rb-1.1.0&q=15&auto=format&w=754&h=377&fit=crop&dpr=3 2262w" sizes="(min-width: 1466px) 754px, (max-width: 599px) 100vw, (min-width: 600px) 600px, 237px">
<figcaption>
<span class="caption">Lying in politics isn’t new, but digital media decadence is.</span>
<span class="attribution"><span class="source">Thomas Cizauskas/flickr</span></span>
</figcaption>
</figure>
<p>Some things don’t change. Still, there are several things that are unusual about the <a href="http://edition.cnn.com/2017/01/10/opinions/donald-trump-is-gaslighting-america-ghitis/">gaslighting</a> trends of our time. Each is bound up with the unfinished communications revolution.</p>
<p>The digital merging and melding of text, sound and image, the advent of cheap copying and the growing ease of networked information spreading across vast distances in real time are powerful drivers of post-truth decadence. </p>
<p>New techniques and tools of communication are its condition of possibility; they enable its production, rapid circulation and absorption into the body politics of democracies, and well beyond. </p>
<p>Think of photoshopped materials and mashups, web applications and pages that recycle content from more than one source to create a single new service displayed in a single graphical interface. Trump’s first campaign <a href="http://www.politifact.com/truth-o-meter/statements/2016/jan/04/donald-trump/donald-trumps-first-tv-ad-shows-migrants-southern-/">advertisement</a> showed migrants allegedly crossing the Mexican border; in fact, it was an image of migrants crossing from Morocco to Melilla in North Africa. </p>
<p>Then consider impostor news sites (using URLs such as abc.com.co) and fantasy news sites, such as <a href="https://www.buzzfeed.com/craigsilverman/the-strangest-fake-news-empire?utm_term=.cyXWR7EMr#.igVXGQ6WR">WTOE 5 News</a>, which created the “Pope Francis Shocks World, Endorses Trump for President” <a href="https://web.archive.org/web/20161115024211/http:/wtoe5news.com/us-election/pope-francis-shocks-world-endorses-donald-trump-for-president-releases-statement/">story</a>, built using such tools as <a href="http://www.wired.co.uk/article/clone-zone-tricks-internet-users">Clone Zone</a> and <a href="https://nowthisnews.com/">NowThis</a>.</p>
<p>Ponder shareable made-up news platforms (<a href="https://www.wired.com/2017/02/veles-macedonia-fake-news/">Macedonian teenagers</a> making money, Christian fundamentalists peddling the Spirit), meme launch pads (Twitter and Facebook) and parody accounts (<a href="https://www.theonion.com/">The Onion</a>, “America’s Finest News Source”). </p>
<p>There are also the devoted fanzine platforms that specialise in hailing heroes and trolling opponents, the platforms that sit for the first time in the White House press briefing room, platforms such as <a href="http://www.thegatewaypundit.com/">Gateway Pundit</a>, <a href="http://www.oann.com/">One American News Network</a>, <a href="https://www.newsmax.com/">Newsmax</a>, <a href="http://www.lifezette.com/">LifeZette</a> and the <a href="http://dailycaller.com/">Daily Caller</a>.</p>
<p>Some say none of this is new. From the outset, they insist, daily newspapers printed gossip, rumours and lies. <a href="http://www.slate.com/articles/arts/history/2013/10/orson_welles_war_of_the_worlds_panic_myth_the_infamous_radio_broadcast_did.html">Orson Welles</a> proved that radio could produce scams. Television was a state weapon for mass-producing fabricated illusions; and so on. </p>
<p>But the sceptics underestimate the multiple ways in which, in matters of truth and post-truth, the communications revolution is marked by novel dynamics that are producing novel effects. </p>
<p>Most obviously, the digital communications revolution tends to undermine space-time barriers so that the raw material of lies, bullshit, buffoonery and silence produced by gaslighters develops long global legs. </p>
<p>Post-truth spreads; it knows no borders. So, for instance, many Muslims living in countries as far apart as Britain, Pakistan and Indonesia understand that they are among the targets of the project of attacking “fake news” and making America great again.</p>
<p>There’s something else that’s new: post-truth discourse penetrates so deeply into our daily lives that what is commonly called the private sphere ceases to be private. It’s no longer a safe haven or a zone of counter-balance, in the way (say) it functioned as the point of resistance against total power in the age of the typewriter or in George Orwell’s 1984, where Winston was still able to retreat to a corner table to scribble, out of sight of Big Brother. </p>
<p>The colonisation of daily life by the so-called <a href="https://theconversation.com/is-someone-watching-you-online-the-security-risks-of-the-internet-of-things-55701">Internet of Things</a>, digital robots that collect and spread information, guarantees that the geographic footprint of post-truth is vast and potentially total.</p>
<p>There’s yet another novelty of our period: the production and diffusion of post-truth communication by populist leaders, political parties and governments. The historical record shows that our times are no exception to the old rule that populism is a recurrent <a href="https://theconversation.com/the-pathologies-of-populism-82593">autoimmune disease</a> of democracy. </p>
<p>The present-day political irruption of populism is fuelled by the institutional decay of electoral democracy, combined with growing public dissatisfaction with politicians, political parties and “politics”.</p>
<p>Reinforced by the failure of democratic institutions to respond effectively to anti-democratic challenges such as the growing influence of cross-border corporate power, worsening social inequality and the dark money poisoning of elections, the decadence is proving to be a lavish gift to leaders, parties and governments peddling the mantra of “the sovereign people”.</p>
<figure class="align-center ">
<img alt="" src="https://images.theconversation.com/files/198939/original/file-20171213-10605-9qk044.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=754&fit=clip" srcset="https://images.theconversation.com/files/198939/original/file-20171213-10605-9qk044.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=600&h=400&fit=crop&dpr=1 600w, https://images.theconversation.com/files/198939/original/file-20171213-10605-9qk044.jpg?ixlib=rb-1.1.0&q=30&auto=format&w=600&h=400&fit=crop&dpr=2 1200w, https://images.theconversation.com/files/198939/original/file-20171213-10605-9qk044.jpg?ixlib=rb-1.1.0&q=15&auto=format&w=600&h=400&fit=crop&dpr=3 1800w, https://images.theconversation.com/files/198939/original/file-20171213-10605-9qk044.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=754&h=503&fit=crop&dpr=1 754w, https://images.theconversation.com/files/198939/original/file-20171213-10605-9qk044.jpg?ixlib=rb-1.1.0&q=30&auto=format&w=754&h=503&fit=crop&dpr=2 1508w, https://images.theconversation.com/files/198939/original/file-20171213-10605-9qk044.jpg?ixlib=rb-1.1.0&q=15&auto=format&w=754&h=503&fit=crop&dpr=3 2262w" sizes="(min-width: 1466px) 754px, (max-width: 599px) 100vw, (min-width: 600px) 600px, 237px">
<figcaption>
<span class="caption">Viktor Orbán, prime minister of Hungary and oversized vaudeville character.</span>
<span class="attribution"><span class="source">EU2017EE Estonian Presidency Follow/flickr</span></span>
</figcaption>
</figure>
<p>Populist figures otherwise as different as Viktor Orbán, Norbert Hofer and Recep Tayyip Erdoğan are oversized vaudeville characters. They are merchants of post-truth, exploiters of trust and confidence artists who take advantage of the communications revolution. </p>
<p>They stir up multimedia excitement by calling for a public revolt by millions of people who feel annoyed, powerless and no longer “held” (<a href="https://en.wikipedia.org/wiki/Donald_Winnicott">D.W. Winnicott</a>) in the arms of society: people who are so frustrated or humiliated that they are willing to lash out in support of demagogues promising them dignity and a better future.</p>
<p>Some people fall for the promises not because they “naturally” crave leaders, or yield to the inherited “<a href="https://thefunambulist.net/history/foucault-episode-2-do-not-become-emamored-of-power">fascism in us all</a>”. Among the strangest and most puzzling features of the post-truth phenomenon is the way it attracts people into voluntary servitude because it raises their hopes and expectations of betterment.</p>
<h2>Truth is the answer? Don’t believe it</h2>
<p>The most surprising long-term effect of communicative abundance and the spread of post-truth is arguably their reinforcement of the modern questioning and rejection of arrogant beliefs in truth. </p>
<p>The possibility that post-truth politics is party to the “<a href="https://cup.columbia.edu/book/a-farewell-to-truth/9780231153096">farewell to truth</a>” is poorly understood, especially by critics of post-truth, who invariably rally to the cause of what they casually call truth.</p>
<p>Although the term is usually left undefined, their attachment to truth helps explain why many academics, journalists and public commentators typically accuse the “postmodernism” of recent decades of being the unwitting accomplice or active foot servant of post-truth politics.</p>
<p>They are convinced that the “relativism” of the postmodernists unhelpfully adds to the confusion surrounding “truth” based on “evidence” and “facts”. What is now urgently needed, they say, is the recovery of truth.</p>
<p>But what is truth? Truth is the antidote to post-truth, they reply. It is observable. Truth is saying or writing or visualising, somehow depicting things that correspond to “reality”.</p>
<p>The champions of truth understood as adequation sometimes cite the Polish-American mathematician <a href="https://plato.stanford.edu/entries/tarski-truth/">Alfred Tarski</a>, who famously put things this way: the proposition that “snow is white” (“p”) is true if and only if snow is white (“p is true if and only if p”). It’s seeing language as a conveyor belt, as a medium for recording a “reality” that is external to the observer. </p>
<p>Tough versions of the orthodoxy insist that evidence is evidence, reality is real and “<a href="https://en.wikipedia.org/wiki/Brute_fact">brute facts</a>” exist independently of anyone’s attitude toward them.</p>
<p>It’s not only philosophers who speak in this fashion. Journalists, lawyers, more than a few academics, plenty of environmental activists and data scientists are in the truth trade. </p>
<p>Believers in truth, a word that is usually left undefined, they have a habit of supposing that reality is all around them, out there, within arm’s reach or just beyond arm’s length, graspable and catchable through redescription, for instance in the form of data. </p>
<p>Such conceptions of “<a href="https://scienceobjectivity.weebly.com/max-weber-and-objectivity-in-the-social-sciences.html">objectivity</a>” fail to rethink the whole idea of truth as a necessary condition of ridding the world of post-truth decadence. Their failure to cast doubt simultaneously upon both post-truth and truth, to see them as partners rather than as opponents, ignores the need for a new geography and history of truth.</p>
<figure class="align-center ">
<img alt="" src="https://images.theconversation.com/files/198948/original/file-20171213-10602-1f3pzj3.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=754&fit=clip" srcset="https://images.theconversation.com/files/198948/original/file-20171213-10602-1f3pzj3.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=600&h=373&fit=crop&dpr=1 600w, https://images.theconversation.com/files/198948/original/file-20171213-10602-1f3pzj3.jpg?ixlib=rb-1.1.0&q=30&auto=format&w=600&h=373&fit=crop&dpr=2 1200w, https://images.theconversation.com/files/198948/original/file-20171213-10602-1f3pzj3.jpg?ixlib=rb-1.1.0&q=15&auto=format&w=600&h=373&fit=crop&dpr=3 1800w, https://images.theconversation.com/files/198948/original/file-20171213-10602-1f3pzj3.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=754&h=468&fit=crop&dpr=1 754w, https://images.theconversation.com/files/198948/original/file-20171213-10602-1f3pzj3.jpg?ixlib=rb-1.1.0&q=30&auto=format&w=754&h=468&fit=crop&dpr=2 1508w, https://images.theconversation.com/files/198948/original/file-20171213-10602-1f3pzj3.jpg?ixlib=rb-1.1.0&q=15&auto=format&w=754&h=468&fit=crop&dpr=3 2262w" sizes="(min-width: 1466px) 754px, (max-width: 599px) 100vw, (min-width: 600px) 600px, 237px">
<figcaption>
<span class="caption">Truth comes at a price. But if you’re lucky it’s 60% off.</span>
<span class="attribution"><span class="source">The New York Times</span></span>
</figcaption>
</figure>
<h2>Truth varies through space and time</h2>
<p>The geography of truth highlights the spatial dimensions of truth-seeking and attempts to live the truth. What counts as truth varies from place to place. </p>
<p>The French Renaissance writer Montaigne famously said that what is truth on one side of the Pyrenees is falsehood on the other side. Foucault repeats the point in his account of the birth of truth-telling (<em>le dire vrai</em>) within clinics and prisons. </p>
<p>Scholarly studies of the way cities (Escuela de Salamanca, Chicago School of Economics, Copenhagen School) have shaped what counts as knowledge push in the same direction.</p>
<p>The geography of truth equally matters within any given society, at any given time. The Pitjantjatjara peoples of central Australia still today use a family of terms like <em>mula</em> and <em>mula-mulani</em> and <em>mulapa</em> to refer to a “true story” that is inscribed with both connotations of “a long time” and calls for agreement between story tellers and listeners. </p>
<p>When Pitjantjatjara peoples speak of truth, they understand they are engaged in efforts to convince others of the rightness of their tradition. They recognise what mainstream white society usually forgets: that truth and trust are twins. </p>
<p>A new geography of truth would also note that there are spaces of life that either have little or nothing to do with truth, or where references to truth are simply out of place (Bertolt Brecht once remarked that if someone stood up in front of a group of strikers and said 2+2=4 they would no doubt be jeered), or where telling the truth has dangerous consequences, as when a Rohingya father lies to a Myanmar army patrol hunting women to rape by telling them on his doorstep he has no daughters.</p>
<p>What counts as truth varies not only through space but also through time. Truth has a controversial history; truth has never straightforwardly been truth. There is a history of truth that shows that what counts as truth varies through time, but also (the corollary) that what is today taken as truth has not always been so. </p>
<p>Ancient Greek understandings of truth as <em>aletheia</em>, a difficult word variously translated as “disclosure” or “un-concealedness”, are evidently different than Christian understandings of “the way and the truth and the life” (John 14:6) and the imperative to tell the truth, shame the devil. </p>
<p>The early modern European period was marked by bitter struggles over the meaning of religious “truth”, calls for religious toleration and the deployment, by believers in truth, of such tactics of deception as occultism, the Catholic doctrine of mental reservation and Protestant casuistry. </p>
<p>The public controversies about truth among Christians encompassed Luther’s explosive, influential attack on popery as the sole interpreter of scripture in <a href="http://www.intratext.com/ixt/ENG0081/">An Open Letter to the Christian Nobility of the German Nation Concerning the Reform of the Christian Estate</a> (1520). They extended to <a href="http://www.oxfordscholarship.com/view/10.1093/0195144945.001.0001/acprof-9780195144949">Lessing’s recommendation</a> that we should thank God that we don’t know the truth (“<em>Sage jeder, was ihm Wahrheit dünkt, und die Wahrheit selbst sei Gott empfohlen</em>” [“Let each person say what s/he deems truth, and let truth itself be commended unto God”]); and <a href="https://theconversation.com/why-read-tocquevilles-democracy-in-america-40802">Tocqueville’s observation</a> that the modern democratic revolution powerfully calls into question so-called public truths about the “natural” inferiority of slaves and women.</p>
<h2>Democracy doubts both post-truth and ‘the truth’</h2>
<p>The public sense that truth claims are contestable and mutable interpretations is undoubtedly bolstered by the multi-media communications revolution, and by the advent of new forms of <a href="https://theconversation.com/the-origins-of-monitory-democracy-9752">monitory democracy</a> featuring a plethora of mediated platforms where power is publicly interrogated and chastened.</p>
<p>Monitory democracy promotes the growth of public spaces where uncertainty, doubt, scepticism, irony and modesty in the face of arbitrary power are nurtured. </p>
<p>Wittgenstein’s recommendation that saying “I know” should be banned so that people would be required to say “I believe I know” makes good sense under these conditions. We could say that post-truth politics is the dark and messy side of an unfinished quantum shift in support of the pluralisation of people’s lived perceptions of the world.</p>
<p>Yes, talk of truth is not disappearing, or dead. Just as unbelievers continue to say “Lord help us” and “Jesus Christ”, and despite Copernicus people still speak of the setting sun, so the language of truth lives on in people’s lives.</p>
<p>Yet nowadays tropes like “<a href="http://www.ushistory.org/declaration/document/">We hold these truths to be self-evident</a>” arouse public suspicions. The truth is out that truth has many faces. </p>
<p>What counts as “truthful information” is less and less understood by wise citizens as “hard facts” or as indisputable “evidence” or as chunks of “reality” to be mined from television and radio programs, or from newspapers, digital platforms and “expert” authorities. </p>
<p>In the age of communicative abundance and monitory democracy, “reality” is multiple and mutable. “Reality”, including the lies and buffoonery and other forms of gaslighting peddled by the powerful, comes to be understood as always “reported reality”, as “reality” produced by some for others – in other words, as messages that are shaped and reshaped and reshaped again in the process of transmission and reception.</p>
<div data-react-class="Tweet" data-react-props='{"tweetId":"881281755017355264"}'></div>
<p>This disenchantment of truth has everything to do with democracy. Considered as a universal norm liberated from metaphysical foundations, as a whole way of life committed to the defence of complex equality, freedom and difference, democracy in monitory form is the guardian of a plurality of lived interpretations of life. </p>
<p>The radical originality of monitory democracy is its defiant insistence that peoples’ lives are never simply given, that all things human are built on the shifting sands of space-time, and that no person or group, no matter how much “truth” or power they presently enjoy or want to claim, can be trusted permanently, in any given context, to govern other people’s lives.</p>
<p>Democracy is thus the best human weapon so far invented for guarding against the “<a href="https://en.wikipedia.org/wiki/Thinking,_Fast_and_Slow">illusions of certainty</a>” and breaking up truth-camouflaged monopolies of power, wherever they operate. Democracy is not a True and Right norm. Just the reverse: the norm of monitory democracy is aware of its own and others’ limits, knows that it doesn’t know everything, and understands that democracy has no meta-historical guarantees. That is why it does not suffer truth-telling dogmatists and fools gladly. </p>
<p>Democracy is a living reminder that truths are never self-evident, and that what counts as truth is a matter of interpretation. Recognising that in political life “<a href="https://idanlandau.files.wordpress.com/2014/12/arendt-truth-and-politics.pdf">truth has a despotic character</a>”, democracy stands for a world beyond truth and post-truth. </p>
<p>This is not because all women and men are “naturally” created equal. Rather, it’s because democracy supposes that no man or woman is good enough to claim they know the truth and to rule permanently over their fellows and the earthly habitats in which they dwell.</p>
<hr>
<p><em>You can read other articles in the series <a href="https://theconversation.com/au/topics/revolutions-and-counter-revolutions-49124">here</a>.</em></p>
<p><em>The theme of truth, post-truth and the unfinished communications revolution is further explored in a recently published thepaper.cn interview, <a href="http://www.thepaper.cn/newsDetail_forward_1910750">The Revival of Truth Isn’t the Remedy for Post-Truth</a> (available only in Chinese).</em><!-- Below is The Conversation's page counter tag. Please DO NOT REMOVE. --><img src="https://counter.theconversation.com/content/87364/count.gif?distributor=republish-lightbox-basic" alt="The Conversation" width="1" height="1" style="border: none !important; box-shadow: none !important; margin: 0 !important; max-height: 1px !important; max-width: 1px !important; min-height: 1px !important; min-width: 1px !important; opacity: 0 !important; outline: none !important; padding: 0 !important; text-shadow: none !important" /><!-- End of code. If you don't see any code above, please get new code from the Advanced tab after you click the republish button. The page counter does not collect any personal data. More info: http://theconversation.com/republishing-guidelines --></p>
<p><span><a href="https://theconversation.com/profiles/john-keane-267">John Keane</a>, Professor of Politics, <em><a href="https://theconversation.com/institutions/university-of-sydney-841">University of Sydney</a></em></span></p>
<p>This article is republished from <a href="http://theconversation.com">The Conversation</a> under a Creative Commons license. Read the <a href="https://theconversation.com/post-truth-politics-and-why-the-antidote-isnt-simply-fact-checking-and-truth-87364">original article</a>.</p>
<br /></div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com0tag:blogger.com,1999:blog-2508711278752078434.post-3722359227403697432019-12-22T22:28:00.001+05:302020-05-20T01:51:34.489+05:30Politcial Economy Musings, 21-Dec-2019<div dir="ltr" style="font-size:18px; font-family: Georgia; text-align: justify;" trbidi="on">
<i>Originally posted on <a href="https://www.facebook.com/mahboob.hussain.33/posts/3503096256374943"><u>Facebook</u></a></i><br/><br/>
So far, the Congress party has not clearly stated that it is against NRC. But things may change as an interesting Monday is ahead, when the Jharkhand results will be declared.<br/><br/>
<a name='more'></a>
You know the state is not going the BJP way if hours before the exit poll results are out, RSS member & veteran of the original NDTV psephology gang Seshadri Chari writes in The Print that Jharkhand can be a rude shock to the BJP. The RSS must have surmised Jharkhand is lost.<br/><br/>
As the evening grew, India Today - Axis exit polls* clearly put JMM-Congress+ (UPA) alliance coming to power there. After the accuracies in their recent predictions, one would give a lot of weightage to their findings.<br/><br/>
But still, one has to wait till Monday. It ain't over until it's over.<br/><br/>
A day before, Prashant Kishor told in Hindustan Times & NDTV interviews that Congress has not taken a clear stand against NRC so far. If you want to oppose the NRC, say so and make your position clear, he said.<br/><br/>
But it sounded like, hey Congress if you want to put any chance of fight in 2024, you need me and for that you got to be clear cut against NRC. He's putting his side of the deal, presumably confident that he would be able to help both Mamta and Kejriwal retain Bengal & Delhi.<br/><br/>
Insofar as Narendra Modi & Amit Shah are concerned, they would be advised and perhaps would follow it, to back off a bit on the NRC. By all means go ahead with it, but let's make it the main election issue of 2024. If BJP wins, you go full blast on NRC as soon as you come to power in 2024. There's no loss in prestige and stature if you currently put a small pause on a policy goal and get the focus back on to the economy.<br/><br/>
<a href="https://time.com/5753624/india-narendra-modi-nationalism/">https://time.com/5753624/india-narendra-modi-nationalism/</a><br/>
*<a href="https://www.indiatoday.in/elections/jharkhand-assembly-election/story/jharkhand-exit-polls-result-2019-live-updates-india-today-bjp-congress-jmm-1630141-2019-12-20">https://www.indiatoday.in/elections/jharkhand-assembly-election/story/jharkhand-exit-polls-result-2019-live-updates-india-today-bjp-congress-jmm-1630141-2019-12-20</a>
<br /></div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com0tag:blogger.com,1999:blog-2508711278752078434.post-5047415327298028712019-08-01T23:58:00.000+05:302020-05-20T01:53:51.760+05:30WhatsApp played a big role in the Nigerian election. Not all of it was bad<div dir="ltr" style="font-family:'Georgia'; font-size:1.15em; text-align: justify;" trbidi="on">
<figure>
<img src="https://images.theconversation.com/files/286006/original/file-20190729-43126-gyl24z.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=600&fit=clip" />
<figcaption>
Supporters of Nigeria’s All Progressives Congress presidential candidate, President Muhammadu Buhari, at a rally earlier this year.
<span class="attribution"><span class="source"> EPA-EFE/Stringer</span></span>
</figcaption>
</figure>
<span><a href="https://theconversation.com/profiles/nic-cheeseman-180800">Nic Cheeseman</a>, <em><a href="http://theconversation.com/institutions/university-of-birmingham-1138">University of Birmingham</a></em></span>
<p>There is growing concern about the potential for the message and media sharing platform WhatsApp to undermine democracy in a number of countries across the world including <a href="http://theconversation.com/whatsapp-skewed-brazilian-election-proving-social-medias-danger-to-democracy-106476">Brazil</a> and <a href="https://www.theguardian.com/commentisfree/2019/may/13/big-tech-whatsapp-democracy-india">India</a>. </p>
<a name='more'></a>
<p>Because WhatsApp is encrypted – and so offers users far greater protection from prosecution than Twitter or Facebook – it has become particularly notorious for spreading “fake news”. </p>
<p>This is a major concern in Africa, where WhatsApp is the most <a href="https://qz.com/africa/1206935/whatsapp-is-the-most-popular-messaging-app-in-africa/">popular messaging app in 40 countries</a>. This is due to its low cost and the ability to easily share messages with both individuals and groups. </p>
<p>But is this really how WhatApp is used? And if it is, to what extent does this compromise the quality of elections? </p>
<p>A joint team from the Centre for Democracy and Development (Nigeria) and the University of Birmingham (UK) has spent the last few months researching the impact of WhatsApp on the 2019 Nigerian elections held in May. </p>
<p>Their <a href="https://www.cddwestafrica.org/wp-content/uploads/2019/07/WHATSAPP-NIGERIA-ELECTION-2019.pdf">report</a> comes to conclusions that are both troubling, as well as encouraging. </p>
<p>The research reveals that the platform was used to mislead voters in increasingly sophisticated ways. But it also shows that Whatsapp strengthened democracy in other areas.</p>
<h4>Misinformation and disinformation</h4>
<p>The term “<a href="http://blogs.royalsociety.org/publishing/ignorance-can-be-fatal-countering-the-crisis-in-fake-news-and-fake-science/">fake news</a> has become widely used over the past few years. However, it is problematic because it lumps together very different kinds of information and behaviour. For example, we need to separate out deliberate attempts to mislead others by creating false stories (disinformation) from the innocent sharing of made up stories by people who believe it to be true (misinformation).</p>
<p>The 2019 Nigerian elections saw both disinformation and misinformation. We studied this by conducting 46 interviews in the states of Abuja, Oyo and Kano, as well as seven focus groups and a survey of 1,005 people.</p>
<p>During the course of conducting the research candidates consistently told us that they predominantly used WhatsApp to share information about their qualities and campaign pledges. But many WhatsApp users said that at a high proportion of the messages they received were designed to undermine a rival leader’s reputation – to "decampaign” them.</p>
<p>There were some high profile examples of disinformation. The most notorious story circulated on social media was that the president had died while undergoing medical treatment outside of the country, and had <a href="https://www.bbc.co.uk/news/world-africa-46424562">been replaced by a clone from Sudan</a>. </p>
<p>Other fabricated communications were less outlandish but no less significant. Many ordinary citizens shared these messages, in some cases because they knew they were false and wanted to amplify their impact, but in many cases because they thought they were true.</p>
<p>The most effective decampaigning strategies were those that shared messages that resonated with individuals because they contained an element of the truth, or played on recent experiences. </p>
<h4>WhatsApp takes over</h4>
<p>The political influence of WhatsApp has expanded rapidly in line with its growing penetration. As a result, it has become part of the fabric of election campaigns and is now a key mechanism through which political leaders seek to communicate with their campaign teams and supporters. </p>
<p>Fully 91% of the people we interviewed were active WhatsApp users; as one person put it:</p>
<blockquote>
<p>I use WhatsApp more than I use the toilet.</p>
</blockquote>
<p>In Nigeria, election candidates were already using the platform to <a href="https://www.academia.edu/32414216/The_Impact_of_Social_Media_during_the_2015_Nigerian_General_Elections">push messages in 2015</a>. But the people we interviewed agreed that the <a href="https://www.washingtonpost.com/news/monkey-cage/wp/2019/02/15/its-nigerias-first-whatsapp-election-heres-what-were-learning-about-how-fake-news-spreads/">2019 elections</a> saw a significant step up in terms of how the leading parties organised their social media strategy.</p>
<p>Politically, WhatsApp was used in an increasingly sophisticated way at the presidential level. In 2019, the two main presidential candidates – President Muhammadu Buhari and opposition leader Atiku Abubakar – both had dedicated teams pushing out messages over social media: the <a href="https://www.youtube.com/watch?v=6B-DqX1o370">Buhari New Media Centre</a> and <a href="https://www.atikulatedyouthforce.com/membership">Atikulated Youth Force</a>. By forming hundreds of Whatsapp groups of 256 members, these organisations could send messages to tens of thousands of people at the touch of a button.</p>
<p>Buhari’s effort was better funded and particularly impressive. It established a network of local and regional representatives connected to a “central command” in Abuja. This enabled the campaign to rapidly send messages from the national to the local level, while also responding to hostile messages and rumours shared by its rivals.</p>
<p>While those in power typically had more money to invest in their campaigns, many opposition leaders pointed out that in important ways WhatsApp had created a more level political playing field. Those who had been involved in politics for some time explained that “fake news” was nothing new in Nigeria, but that in the past it was sometimes impossible to counteract these messages because there was no way to get airtime on government aligned radio. </p>
<p>WhatsApp had changed this situation. Opposition leaders now have a cheap way of fighting back. It has also been used to coordinate anti-corruption campaigns and election observation, strengthening democracy. </p>
<h4>Evolution or revolution?</h4>
<p>It’s also important not to overstate the significance of WhatsApp. Things look very different below the national level, for example, where campaign structures were less developed and a significant proportion of activity remained informal.</p>
<p>We found that while candidates for Governor and Member of Parliament did set up WhatsApp groups, they were much less organised. In many cases, candidates relied on existing networks and social influencers to get the message out.</p>
<p>Candidates were also keen to stress that while they used WhatsApp during their campaigns, they did not rely on it. Voters expect to see their leaders on the ground, and expected them to provide a range of services for the community. Advertising good deeds over WhatsApp could help a leader get credit, but only if they had fulfilled their responsibilities in the first place.</p>
<p>In other words, WhatsApp can amplify and complement a candidate’s ground campaign. But it cannot replace it.</p>
<h4>Throwing out the water but keeping the baby</h4>
<p>These findings suggest that solutions to the power of social media platforms like WhatsApp isn’t to ban them, or to allow governments to censor them. This would merely exaggerate the vast advantages of incumbency that ruling parties already enjoy. </p>
<p>A better solution would be to promote <a href="https://www.edweek.org/ew/articles/2016/11/09/what-is-digital-literacy.html">digital literacy</a>, develop <a href="http://www.comminit.com/democracy-governance/content/guidelines-development-social-media-code-conduct-elections">social media codes of conduct</a> around elections, and empower WhatsApp uses to control which groups they are added to, and what information they receive.</p>
<p><em>The research was conducted, and publications authored by, Jamie Hitchen, Idayat Hassan, Jonathan Fisher and Nic Cheeseman.</em><!-- Below is The Conversation's page counter tag. Please DO NOT REMOVE. --><img src="https://counter.theconversation.com/content/121064/count.gif?distributor=republish-lightbox-basic" alt="The Conversation" width="1" height="1" style="border: none !important; box-shadow: none !important; margin: 0 !important; max-height: 1px !important; max-width: 1px !important; min-height: 1px !important; min-width: 1px !important; opacity: 0 !important; outline: none !important; padding: 0 !important; text-shadow: none !important" /><!-- End of code. If you don't see any code above, please get new code from the Advanced tab after you click the republish button. The page counter does not collect any personal data. More info: http://theconversation.com/republishing-guidelines --></p>
<p><span><a href="https://theconversation.com/profiles/nic-cheeseman-180800">Nic Cheeseman</a>, Professor of Democracy, <em><a href="http://theconversation.com/institutions/university-of-birmingham-1138">University of Birmingham</a></em></span></p>
<p>This article is republished from <a href="http://theconversation.com">The Conversation</a> under a Creative Commons license. Read the <a href="https://theconversation.com/whatsapp-played-a-big-role-in-the-nigerian-election-not-all-of-it-was-bad-121064">original article</a>.</p>
<br /></div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com1tag:blogger.com,1999:blog-2508711278752078434.post-52255993772082125632019-07-31T01:25:00.001+05:302020-05-20T01:54:27.884+05:30Are Robots Coming for Our Jobs? Careful, It's a Trick Question<div dir="ltr" style="font-family: Georgia; font-size:18px;text-align: justify;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgysXLmiZ6NI5c8Bxj4J2n_6lnsf-XmvRMIR61tFsn6ocfO2ATU4EOQUvrPTCp_S_jzNxpAtWYeBfgTWZTj4ZSObh0cBhnvyDkGnxYmxaZxq8Olh_6G3pAl8L1A5wOOXh0P1z23N4KEG78M/s1600/automation-retro-robot-toys-shutterstock-175821860.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgysXLmiZ6NI5c8Bxj4J2n_6lnsf-XmvRMIR61tFsn6ocfO2ATU4EOQUvrPTCp_S_jzNxpAtWYeBfgTWZTj4ZSObh0cBhnvyDkGnxYmxaZxq8Olh_6G3pAl8L1A5wOOXh0P1z23N4KEG78M/s400/automation-retro-robot-toys-shutterstock-175821860.jpg" width="400" height="225" data-original-width="1408" data-original-height="792" /></a></div>
<!-- <h1>Are Robots Coming for Our Jobs? Careful, It’s a Trick Question</h1> -->
<p>By <a href="https://singularityhub.com/author/vbatesramirez/" title="Posts by Vanessa Bates Ramirez" class="author url fn" rel="author">Vanessa Bates Ramirez</a></p>
<iframe src="https://singularityhub.com/distribution-tracker.php?source_title=Are+Robots+Coming+for+Our+Jobs%3F+Careful%2C+It%26%238217%3Bs+a+Trick+Question&source_url=https%3A%2F%2Fsingularityhub.com%2F2019%2F07%2F22%2Fwill-robots-take-our-jobs-careful-its-a-trick-question%2F" frameborder="0" scrolling="no" width="1" height="1" style="border:none"></iframe>The robots are coming, and they’ll probably take your job when they get here.<br/><br/>
Oh wait—have you heard that recently? As recently as, say, yesterday? In the news, or from a coworker, or in a sinister dystopian movie, maybe?<br/><br/>
Sounding the alarm about job losses to automation has become commonplace—in fact, it’s more of a nonstop siren these days. Multiple <a href="https://qz.com/1536793/your-guide-to-the-2020-democratic-presidential-candidates/">Democratic presidential candidates</a> are featuring their plans to combat Big Tech and solve technological unemployment as talking points of their campaigns. Dread of a robot-dominated future is mounting.<br/><br/>
<a name='more'></a>
One of the most widely-referenced and panic-inducing figures on the topic came from a 2013 paper by two Oxford economists, Michael Osborne and Carl Benedikt Frey. Their research found that up to 47 percent of American jobs were at risk of being automated by the mid-2030s. According to <em><a href="https://www.economist.com/business/2019/06/27/will-a-robot-really-take-your-job">The Economist</a></em>, the paper has been cited in over 4,000 articles, unnerving workers in all sectors of the economy and justifying catastrophic outlooks.<br/><br/>
But last month Frey, a Swedish economic historian, published a book called <u><em><a href="https://amzn.to/2Y4CzYq">The Technology Trap: Capital, Labor and Power in the Age of Automation</a></em></u> that aims to dispel some of the hysteria the paper raised. Not only must the 47 percent figure be deconstructed in a more nuanced manner, he says, but the public’s acceptance of or resistance to technological advancement could play a major role in <a href="https://singularityhub.com/2019/01/01/ai-will-create-millions-more-jobs-than-it-will-destroy-heres-how/">job creation</a>.<br/><br/>
<h3>What the Paper Said</h3>
The research underlying the 2013 paper, aptly titled “<a href="https://www.oxfordmartin.ox.ac.uk/downloads/academic/future-of-employment.pdf">The Future of Employment</a>,” aimed to quantify how progress in tech could impact jobs. The authors classified 702 occupations using a machine learning algorithm.<br/><br/>
To train the algorithm, they chose 70 jobs whose computerization label they felt confident about—such as delivery drivers, maids, civil engineering technicians, sheet metal workers, and utility meter readers—and labeled them as automatable or non-automatable. For each job, they considered the question, “Can the tasks of this job be sufficiently specified, conditional on the availability of big data, to be performed by state-of-the-art computer-controlled equipment?”<br/><br/>
The authors noted that automation will depend partly on engineers overcoming computerization “bottlenecks” in increasingly complex areas, starting with perception and manipulation, then moving to creative intelligence, and finally tackling social intelligence.<br/><br/>
Unsurprisingly, jobs requiring creative and social intelligence were deemed least likely to be automated: recreational therapists, mechanic and repair supervisors, and emergency management directors topped the list—no robot will be stealing their jobs anytime soon. Dentists, dietitians, and elementary school teachers can settle in for the long haul, too.<br/><br/>
On the other end of the spectrum—or in this case, the long, long list—some of the jobs most susceptible to automation were insurance underwriters, telemarketers, tax preparers, and sports officials like referees.<br/><br/>
Taken as a whole, the authors found 47 percent of US employment at risk of being disrupted by automation.<br/><br/>
But let’s consider that wording. It doesn’t say 47 percent of jobs <em>will</em> be automated. It says 47 out of every 100 jobs could conceivably be done by computers one day in the future if a bunch of massive engineering challenges get solved, not to mention if regulations and public opposition don’t get in the way.<br/><br/>
<h3>The Technology Trap</h3>
Throughout history, technology has always <a href="https://singularityhub.com/2019/02/13/ai-wont-create-a-skills-gap-heres-what-will-happen-instead/">created more jobs</a> than it has destroyed.<br/><br/>
To use a generic but straightforward metaphor: if the economy is a pie, tech allocates more slices to some people and fewer slices to others in the short term. But in the long term, new technologies always make the whole pie bigger, thus there’s more to go around.<br/><br/>
Need a concrete, recent example? Look at mobile phone usage in developing countries. A 10 percent increase in cell phone ownership among <a href="https://singularityhub.com/2018/05/06/leapfrogging-tech-is-changing-millions-of-lives-heres-how/">citizens of developing countries</a> can boost <a href="https://www.economist.com/special-report/2017/11/10/beefing-up-mobile-phone-and-internet-penetration-in-africa">per capita GDP growth</a> by about 1 percent per year. Adding mobile internet to the equation nudges growth up even more.<br/><br/>
Farmers in Kenya and shopkeepers in India aren’t as well-off as the Silicon Valley engineers who designed their phones—but they’re certainly more well-off than they were before. <a href="https://singularityhub.com/2018/01/02/will-the-world-ever-be-free-of-extreme-poverty/">Absolute poverty rates</a> around the world have fallen faster in the past 30 years than at any other time on record.<br/><br/>
An example perhaps closer to home is the advent of the internet. Millions of people are now employed as web designers, software engineers, data scientists, and IT technicians—but just 30 years ago, these jobs scarcely existed.<br/><br/>
Failing to manage the short-term consequences of new tech, though, results in slower adoption of it, meaning the pie stays smaller and the economy fails to live up to its productive potential.<br/><br/>
British economic historian Robert Allen coined the term "<a href="https://www.economics.ox.ac.uk/department-of-economics-discussion-paper-series/engel-s-pause-a-pessimist-s-guide-to-the-british-industrial-revolution">Engels' Pause</a>" for the time it takes for worker skills to catch up to new technology; output rises, prices drop, and demand increases, but workers’ wages stagnate. It’s here that unrest can start to fester, and opposition to technology can become pervasive.<br/><br/>
If tech ups inequality in the short term but levels it out in the long term, what kind of short-term damage control can cushion the blows? How do we keep inequality from getting so pronounced that it causes a backlash, and a corresponding backslide in policy?<br/><br/>
These are the questions Frey examines in <a href="https://amzn.to/2Y4CzYq"><u><em>The Technology Trap</em></u></a>. An anti-tech backlash, he argues, is the trap we should be trying to avoid.<br/><br/>
The US, along with other countries around the world, may be teetering on the edge of this trap. Economic disparities have become more pronounced, with those at the top of corporate ladders raking in the money while much of the workforce sees no difference in earnings. These disparities (along with the technologies themselves) have fed into political polarization and helped fuel a rise in identity politics, nationalism, and the election of strongmen.<br/><br/>
<h3>What Can Be Done</h3>
Despite these trends, Frey believes we should embrace the automation age, not resist it. If history can be trusted to repeat itself, even a takeover of 47 percent of American jobs by machines wouldn’t be a portent of doom. On the contrary, it would signal coming growth of the proverbial economic pie.<br/><br/>
Opponents argue that despite historical examples, this time will be different. The Industrial Revolution, it’s been said, was nothing compared to the economic and social overhaul AI and robots are already visiting on our lives. The sheer scale and speed of change make this time more ominous than all the periods of change that came before it.<br/><br/>
That might be true—but probably not. Electricity, steam power, and the assembly line were a pretty big deal when they came along and disrupted the status quo.<br/><br/>
What is different about this time, Frey points out, is our ability to foresee the pitfalls of change and do what we can to prevent them. This includes specific measures to help the most vulnerable through the transition, as well as promoting a general attitude of openness rather than one of fear.<br/><br/>
Most directly, Frey suggests, companies could offer some form of wage insurance to displaced workers, and governments could incentivize work and reduce inequality through income tax credits. Cities could align their zoning laws with the housing needs of prospective workers in areas where new jobs spring up.<br/><br/>
Taking a longer view, <a href="https://singularityhub.com/2018/09/20/reimagining-education-in-the-exponential-age/">schools and universities</a> will need to overhaul their curricula in a way that prepares students for careers in a computerized world, as well as supporting retraining and adaptability.<br/><br/>
One of Frey’s most salient points is that our attitudes and actions toward technology can play a pivotal role in how it impacts us. A lot of stock has been put into Frey and Osborne’s prediction of 47 percent automation. But if Frey’s book gets even half the attention the paper got, it should serve to quell some of our fears around a bleak machine-dominated future.<br/><br/>
The robots cometh—but they mean no harm.<br/><br/>
</div>
<em>Image Credit: <a href="https://www.shutterstock.com/image-photo/retro-robot-toys-175821860">charles taylor</a> / <a href="https://www.shutterstock.com/">Shutterstock.com</a></em>
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.<div typeof="cc:Work" xmlns:dct="http://purl.org/dc/terms/" xmlns:cc="http://creativecommons.org/ns#">
<p>This article <a href="https://singularityhub.com/2019/07/22/will-robots-take-our-jobs-careful-its-a-trick-question/">originally appeared</a> on <a property="dct:title" href="https://singularityhub.com" target="_blank">Singularity Hub</a>, a publication of <a href="https://su.org/" target="_blank">Singularity University</a>.</p></div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com1tag:blogger.com,1999:blog-2508711278752078434.post-87086654838324775672019-07-26T12:54:00.000+05:302020-05-20T01:54:48.657+05:30How ad hominem arguments can demolish appeals to authority<div dir="ltr" style="font-family: Georgia; font-size:18px;text-align: justify;" trbidi="on">
<p> -- Moti Mizrahi</p>
<blockquote>‘In logic, inconsistency is the cardinal sin, and consistency the first of the virtues.’<br>Patrick Shaw, <em>Logic and Its Limits</em> (1981)</blockquote>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-6JR2mYUUvfLM1fQeTwLxO3UVc6fBjfb8YkiIhJrlGHBYiW3cICYfwhTcOPBlNjF6cS66YG6GrW6egaYaE8uGZ1d-IsH4AIyxT3_QVjwCnWcc6npQ22hqxmR97jcoUJTyZBzB1wMvOCJ1/s1600/idea_sized-lance-shields-201702984_a003320b19_o+%25281%2529.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-6JR2mYUUvfLM1fQeTwLxO3UVc6fBjfb8YkiIhJrlGHBYiW3cICYfwhTcOPBlNjF6cS66YG6GrW6egaYaE8uGZ1d-IsH4AIyxT3_QVjwCnWcc6npQ22hqxmR97jcoUJTyZBzB1wMvOCJ1/s320/idea_sized-lance-shields-201702984_a003320b19_o+%25281%2529.jpg" width="320" height="192" data-original-width="1400" data-original-height="840" /></a></div>
<p>In 2018, the US Surgeon General declared e-cigarette use among young people an epidemic in the United States. As a result, parents were encouraged to talk with their children about smoking. One of the Surgeon General’s tips for parents is to ‘set a positive example by being tobacco-free’. But what if parents are smokers, too? What if children respond to their parents’ plea to refrain from smoking by saying: ‘You use tobacco, so why shouldn’t I?’</p><p>This retort is an example of <em>ad hominem</em> argumentation. <a name='more'></a> Arguments against the person are attempts to undermine what someone says, not by engaging with what is said but by casting aspersions on the person who says it. For example, the child’s retort is directed at the parents, in light of their failure to set a positive example, not at their parents’ concerns about smoking.</p><p>The popular view in the media is that <em>ad hominem</em> attacks are bad arguments. According to the Urban Dictionary site: ‘<em>Ad hominems</em> are used by immature and/or unintelligent people because they are unable to counter their opponent using logic and intelligence.’ But isn’t this definition itself an <em>ad hominem</em> attack on those who make <em>ad hominem</em> arguments? Contrary to the popular view, I <a href="https://philpapers.org/rec/MIZTMA" target="_blank">think</a> that we sometimes have good reasons to argue against the person. In other words, <em>ad hominem</em> arguments can be good arguments, especially when they are construed as rebuttals to appeals to authority.</p><p>We often seek the advice of authority figures, such as medical doctors, religious leaders and political leaders. To seek and follow the advice of authorities is a matter of practical reasoning, which is reasoning about whether actions are prudent or imprudent. Once we receive advice from authorities, it seems that refusing to follow such advice would be imprudent. If my doctor gives me a diagnosis and prescribes medication, it would be imprudent to ignore her diagnosis and refuse to take the medication.</p><p>Now, are there circumstances in which it <em>wouldn’t</em> be imprudent to refuse to listen to authorities and follow their advice? Yes: these circumstances occur when an authority is guilty of <em>practical inconsistency</em>, that is, they don’t practise what they preach. Consider the case of Lee Jang-rim, a religious authority in South Korea, who told his followers that the world would end on 28 October 1992. Based on his doomsday prediction, many of his followers left their jobs, sold their homes and gave away their assets to his church; they also left their families, believing that they’d be lifted to Heaven before pestilence swept Earth. It then turned out that Lee Jang-rim had $800,000 worth of bonds, which weren’t expected to mature until after the date on which he preached that the world would end.</p><p>Before they gave away their life savings to Lee Jang-rim, his followers could have reasoned as follows: </p><ol><li>As a religious authority, Lee Jang-rim says that we should make preparations, such as give away assets, before the world ends in 1992.</li><li>But Lee Jang-rim is not preparing for the end times (he has $800,000 worth of bonds that are not expected to mature until after 1992).</li><li>Lee Jang-rim’s advice regarding the end times is inconsistent with his actions.</li><li>Lee Jang-rim’s status as a religious authority, especially on matters pertaining to the end times, has been undermined.</li><li>Therefore, it wouldn’t be imprudent to refuse to follow Lee Jang-rim’s advice.</li></ol><p>This is an <em>ad hominem</em> argument, since the attack is directed against the person, not his advice. The premises of this argument (1-4) cite the fact that the authority’s actions are inconsistent with his advice as evidence for the conclusion (5) that refusing to follow his advice wouldn’t be imprudent. After all, he isn’t following his own advice. If Lee Jang-rim’s followers were to argue in this way, they would have not only argued legitimately but also saved themselves plenty of misery.</p><p>When an appeal to authority is made, it’s reasonable to respond by pointing out that the authority appealed to is acting in a manner that is inconsistent with her advice. Such practical inconsistency provides a good reason to think that refusing to follow the authority’s advice wouldn’t be imprudent. It’s important to note that this sort of <em>ad hominem</em> argumentation is legitimate only as a rebuttal to appeals to authority. If we want to know whether we should give away our assets in preparation for the end times, and the only reason we have for doing so is the advice of the religious authority Lee Jang-rim, then, given the practical inconsistency between his advice and his actions, we actually don’t have a good reason to give away our assets in preparation for the end times. To put it another way, suppose someone says: ‘You should get ready for the end times,’ and we ask: ‘Why?’ The reply ‘Because Lee Jang-rim says so’ wouldn’t be a compelling response, since we could point out that his advice is inconsistent with his actions.</p><p><span class="ld-dropcap">I</span>t’s also important to note that this sort of <em>ad hominem</em> argumentation is <em>defeasible</em>, that is, it can be defeated by other considerations, since there might be other reasons why an authority’s advice should be followed anyway, even if the authority is guilty of practical inconsistency. For example, in 2017 the Italian actress and filmmaker Asia Argento was one of the first women to accuse the US film producer Harvey Weinstein of sexual assault. She became a prominent figure in the #MeToo movement and an advocate for victims of sexual assault, preaching that we should listen to survivors of sexual assault and believe their stories. Subsequently, <em>The New York Times</em> revealed that: ‘Argento quietly arranged to pay $380,000 to her own accuser: Jimmy Bennett, a young actor and rock musician who said she had sexually assaulted him in a California hotel room years earlier.’</p><p>Clearly, Argento’s actions are inconsistent with her message as a leader in the #MeToo movement, which is why it would be legitimate to make the following <em>ad hominem</em> argument against her:</p><ol><li>As an authority on surviving sexual assault, Argento says that we should listen to survivors and believe their stories.</li><li>But Argento is not listening to survivors (she paid to silence her own accuser).</li><li>Argento’s advice on how to treat survivors is inconsistent with her actions.</li><li>Argento’s status as an authority on surviving sexual assault, especially on matters pertaining to the treatment of survivors, has been undermined.</li><li>Therefore, it wouldn’t be imprudent to refuse to follow Argento’s advice.</li></ol><p>Of course, there are good reasons to listen to survivors of sexual assault and believe their stories. So we should always think about the advice itself and whether there are good reasons to follow it independently of what an authority says we should do. However, if we are urged to follow the advice of authority figures solely on the grounds that they are authorities, then acting in a manner that is inconsistent with their own advice would undermine their status as authorities, and thereby give us good reasons to think that refusing to follow their advice wouldn’t be imprudent.</p><p>If I’m right, rebellious children are on firm ground <em>argumentatively</em> when they challenge their parents’ advice on smoking with ‘You use tobacco, so why shouldn’t I?’ By being smokers themselves, and thus failing to set a positive example, the parents have undermined their status as authorities whose advice should be followed. Given this practical inconsistency, it wouldn’t be imprudent for children to refuse to follow their parents’ advice to stop smoking. Of course, there are other good reasons why children shouldn’t smoke. But because their parents say so probably isn’t one of them.</p>
<hr/>
<p><img src='https://metrics.aeon.co/count/2336b086-e475-441b-a504-7add723deee7.gif' alt='Aeon counter – do not remove' width='1' height='1' />This article was originally published at <a href='https://aeon.co?utm_campaign=republished-article' target='_blank'>Aeon</a> and has been republished under Creative Commons.<br/>
Read the original publication <a href="https://aeon.co/ideas/how-ad-hominem-arguments-can-demolish-appeals-to-authority"><u>here</u></a></p>
<br /></div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com0tag:blogger.com,1999:blog-2508711278752078434.post-11433512183503174302019-02-10T11:11:00.001+05:302020-05-20T01:55:30.215+05:30Programming on Windows<div dir="ltr" style="font-family: Georgia; font-size:18px;text-align: justify;" trbidi="on">
During the last four years, until the early part of 2018, I worked on a MacBook. Sometime in the second quarter of last year, I shifted to a Windows 10 laptop. The transition has been quite smooth and delightful.
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6oWQadCv-JlUWKEixWsybmgeeFGmwp80oh6H3wRclB3r6cf8_AQxo6-9koVRJVqocDjUEnFF-aoQZVmYikM-W92jOGoctwxBpwzEZk-MBcDPgI2yMklY7yoPn9YNAEWWXXsRsadh7iWsl/s1600/IMG_20181009_135646.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6oWQadCv-JlUWKEixWsybmgeeFGmwp80oh6H3wRclB3r6cf8_AQxo6-9koVRJVqocDjUEnFF-aoQZVmYikM-W92jOGoctwxBpwzEZk-MBcDPgI2yMklY7yoPn9YNAEWWXXsRsadh7iWsl/s320/IMG_20181009_135646.jpg" width="320" height="304" data-original-width="1600" data-original-height="1518" /></a></div>
<br/><br/>
There were two Rails applications that I had to write and maintain. The first application, let's call it webapp-1, was coded by me in 2016 using Ruby 2.3.1 p112 and Rails 4.2.6. The second application, hereafter referred to as webapp-2, is a new application that I had to write from scratch, so I chose the latest versions: Ruby 2.5.3, Rails 5.2.1.
<br/><br/>
For both these applications, the database was MySQL, and I decided to install the latest version, i.e., 8 running on Windows. The MySQL installer tools make the installation and configuration very easy and I could bring up MySQL quickly.
<br/><br/>
I started setting up the Rails environment for webapp-2 first. The installation program for windows that I downloaded was rubyinstaller-devkit-2.5.3-1-x64.exe. I ran it, selected MSYS2 and MINGW development toolchain option and the installation went through smoothly. I installed rails gem with the following command
<br/>
<span style="background-color:lightgreen;">> gem install rails --version 5.2.1</span>
<br/><br/>
But then, when I started the rails server, I ran into a library issue. In the browser, I accessed localhost:3000 and I got a nasty looking error:
<br/>
<span style="background-color:lightyellow;">Authentication plugin 'caching_sha2_password' cannot be loaded: The specified module could not be found.</span>
<a name='more'></a>
<br/><br/>
I had installed MySQL with SHA-256 password encryption option. The mysql2 gem on Windows does not have the required plugin. This problem could be resolved by switching to mysql_native_password. For this, I needed to do two steps: a) change the value of default_authentication_plugin to mysql_native_password in the file my.ini. b) In MySQL Workbench, run the command - ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'my_password';
<br/><br/>
But then I thought what's the point of using the latest version of MySQL but not its latest security feature? I raised an <a href="https://github.com/brianmario/mysql2/issues/1015">issue</a><sup>1</sup> on github. But then, I realized that the gem wouldn't be updated soon and also came to understand that the mysql2 gem on Linux did not have this issue. So, what to do?
<br/><br/>
It was time for Ubuntu on Windows.
<br/><br/>
I found an <a href="https://gorails.com/setup/windows/10">article</a><sup>2</sup> explaining how to installing Rails on Ubuntu on Windows. Though this article instructs to start with Developer mode in Windows settings, I didn't have to do that. Ubuntu is now an app on the Microsoft store and you just have to install that app.
<br/><br/>
In the past, I'd used rvm (on my Ubuntu Linux personal laptop) to manage my Rails versions. Therefore, I tried installing rvm first. However, I ran into a couple of errors and I switched to installing rbenv which is recommended by the article. Thereafter, the process went without a hitch.
<br/><br/>
The summary of my current programming environment is: I start MySQL on Windows. My code is in a folder called "Code" in the D drive and I edit the source code as Windows files in my IDE. In the Ubuntu console, my folder is accessible as /mnt/d/Code. I go to my project folder and run <span style="background-color:lightgray;">rails server</span> to start my application.
<br/><br/>
Well, I have captured the series of commands and some notes of the whole installation process, in the following gist:
<br/>
<script src="https://gist.github.com/mh-github/6549d17fece34b2dee816dfaa45298e7.js"></script>
<br/>
Windows has some pretty good package managers. I use Chocolatey. In fact, it was one of the first programs I'd installed after I got my laptop. After installing it, it was pretty much choco install this and choco install that to get most of the tools I need.
<br/><br/>
My most frequently used tool set on Windows consists of: Outlook, Chrome, Trello, Evernote, Notepad++, Eclipse (for Java programming), VS Code (for all other programming languages), Write!, FileZilla, Cmder and Ubuntu. Apart from these, I love the Win key-D combination to go straight to the Desktop, Fn-F11 is really not quite the same thing. Anything I need is available with just the Win key, there is no need for the extra tap on the space bar.
<br/><br/>
I am loving programming on Windows and wish to have a productive year ahead. Yeah I know it's a bit late, but might as well better late than never: here's wishing you all a prosperous and productive 2019. Happy New Year !
<br/><br/>
References:<br/>
<ol>
<li>https://github.com/brianmario/mysql2/issues/1015</li>
<li>https://gorails.com/setup/windows/10</li>
</ol>
<br />
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com2tag:blogger.com,1999:blog-2508711278752078434.post-83202742749542906992017-10-27T18:58:00.000+05:302020-05-20T01:56:28.072+05:30Easy Image Slider<div dir="ltr" style="background:#fff; font-family:Georgia; font-size: 18px; text-align: justify;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW6xbrJ__zEjL6e-zlMzwsOPDEnEfqS1QY87bkbPIBwJnW0NCrVpOCoPq70uQVFQWYByQIY-yHAkr6FY2716GsTT3-e6PnHblN7eCld3rho2pMk5ciUpf8hWJlblv2Mkp23BNH1Fl0uznJ/s1600/Screenshot+from+2017-10-27+18-46-16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW6xbrJ__zEjL6e-zlMzwsOPDEnEfqS1QY87bkbPIBwJnW0NCrVpOCoPq70uQVFQWYByQIY-yHAkr6FY2716GsTT3-e6PnHblN7eCld3rho2pMk5ciUpf8hWJlblv2Mkp23BNH1Fl0uznJ/s400/Screenshot+from+2017-10-27+18-46-16.png" width="400" height="299" data-original-width="1229" data-original-height="918" /></a></div>
I needed a image slider for one of my web pages. The bootstrap template that I was using also provided a slider component but needed a lot of tweaking to suit my page.<br><br>
When I googled, I chanced upon <a href="http://imageslidermaker.com/"><u>imageslidermaker.com</u></a>. It was simple and very easy to use. All you need to do is select the slider configuration on the screen and with one click, the site will generate the css, js and html files that you can download as a zip file.<br><br>
The generated slider code stands on its own and does not intrude into the existing style, script and mark up code. You can easily customize the css. For example, I made my own style for the image caption as given below:
<script language='javascript' type='text/javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.stripBrs = false;
SyntaxHighlighter.all();
</script>
<pre class="brush:java">
#my-slider .ism-caption-3 {
font-size: 1.75em;
font-family: sans-serif;
position: absolute; top: 20%;
left: 10%;
border-radius: 4px;
border: none;
color: #FFFFFF;
text-align: left;
}
</pre>
Try it, you will like it.
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com38tag:blogger.com,1999:blog-2508711278752078434.post-18416154896583839222017-09-29T19:54:00.000+05:302020-05-20T01:57:25.041+05:30Daughters Of India<div dir="ltr" style="font-family: Georgia; font-size:18px;text-align: justify;" trbidi="on">
This post is not about feminist movements in India or any such similar topic; rather it's about using Python code for applying basic NLP (Natural Language Processing) techniques on tweets.<br><br>
<a name='more'></a>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4900Ne8QojM72uoGT46PIZTC0-lt7EjaVD1PbwdomsyU2gw25z39fU3Hh_X5m6_VqsQXRfKHgwLrIP04p5OOINFzC5_2lvuN_rdoS8C5zBkB5HZMffsyM8F16g20czdt_FyQtnhYwL0nY/s1600/daughters-of-india.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4900Ne8QojM72uoGT46PIZTC0-lt7EjaVD1PbwdomsyU2gw25z39fU3Hh_X5m6_VqsQXRfKHgwLrIP04p5OOINFzC5_2lvuN_rdoS8C5zBkB5HZMffsyM8F16g20czdt_FyQtnhYwL0nY/s400/daughters-of-india.jpg" width="400" height="300" data-original-width="720" data-original-height="540" /></a></div>
The four twitter users whose tweets I analysed are: Nidhi Razdan, Rupa Subramanya, Shubhrastha, and Rana Ayyub. They are the very few media persons whom I like to hear or read, for I find them insightful and interesting while presenting their information and arguments. The rest, or most of the other journalists are either not insightful or boring. In terms of political inclinations, Nidhi and Rana are at the left of centre whereas Rupa and Shubhrastha are to the right.<br><br>
The analysis has a limited purpose; it's intended to put a set of numbers around tweets, sort of getting a basic quantified view of these journalists' tweets.<br><br>
By "basic" NLP, I mean applying the following techniques:<br>
<b>Word Density</b>: This is the simplest one that calculates 'words' per tweet.<br>
<b>Lexical Diversity</b>: This is an interesting statistic, which the author Russel explains, "is defined as the number of unique words divided by the number of total words in a corpus; by definition, a lexical diversity of 1.0 would mean that all words in a corpus were unique, while a lexical diversity that approaches a 0.0 implies more duplicate words.<br>
In the Twitter sphere, lexical diversity might be interpreted in a similar fashion if comparing two Twitter users, but it might also suggest a lot about the relative diversity of overall content being discussed, as might be the case with someone who talks only about technology versus someone who talks about a much wider range of topics."[1]<br>
<b>Top Words</b>: The top words that were most frequently used. My program prints the top five.<br>
<b>Popularity</b>: This is the sum of the number of retweets and likes got by a tweet. My program prints the top 5.<br>
<b>Sentiment</b>: A piece of text can be classified as positive, neutral or negative. My program calculates the number and percentage of positive, neutral and negative tweets.<br>
<b>Clustering</b>: Clustering is a way of dividing a bunch of entities into a fixed number of groups that are not previously determined and are formed organically as we process the data. I used K-means clustering algorithm, which is an unsupervised machine learning algorithm that divides 'n' datapoints into 'K' clusters based on some measure of similarity. My program uses K=5, thus it divides the tweets into five clusters (topics) and prints 10 words from each cluster as an indicative example.<br><br>
I wrote the code in Python. The program has a few helper functions that are used by the more functional routines:<br>
<b>clean_text_and_tokenize</b>: This function takes a line (string) as input, cleans it and returns the words as a list. The cleaning process consists of: removing hyperlinks, punctuation marks, removing stop words and lemmatizing the remaining words. Stop words are words like a, an that we don't want to be part of the analysis. Lemmatizing is the process of replacing a word by its base word.<br>
<b>clean_tweet</b>: This function takes a line(string), gets the clean words by calling clean_text_and_tokenize and returns a string by joining the cleaned words.<br>
<b>getCleanedWords</b>: This function takes a list of lines (strings), cleans each line and retruns all words from all the lines.<br><br>
The key functional routines are:<br>
<b>lexical_diversity</b>: This function takes a list of words, and returns the number of unique words divided by the total number of words.<br>
<b>average_words</b>: This function takes an array of strings, splits them into words and returns words per string value.<br>
<b>top_words</b>: This function takes in a list of words, stores the frequency of each word and returns the most frequently used words. If the 'top' number is not passed as argument, it defaults to five.<br>
<b>popular_tweets</b>: This function adds the retweet count and like count of every tweet to calculate its popularity. It uses a priority queue to identify the most popular tweets. If the 'top' number is not passed as argument, it defaults to five.<br>
<b>sentiment_analysis_basic</b>: This function uses the sentiment method of TextBlob library to calculate the polarity of a tweet. The tweet is classified as positive, neutral or negative depending on the value of polarity being greater than, equal to, or less than zero.<br>
<b>clusterTweetsKmeans</b>: This function uses the gensim library to create a model of vectors from the cleaned tweets. After training the model, it invokes KMeans routine of the sklearn library. Tweets are clustered into six topics.<br><br>
The code is available on my github repository <a target="_blank" href="https://github.com/mh-github/python-misc"><u>python-misc</u></a>. The input to the program is a file named <twitter_user>.csv. This file has to be generated first by running the excellent program Exporter.py available in the github repository GetOldTweets-python. The ultra-cool feature of this module is that you don't have to register an app on twitter.com and use the authorization tokens and passwords in the code.<br><br>
For this article, I have fetched tweets from 01-Jan-2015 to 25-Sep-2017. To get the tweets csv file of @Nidhi, the command is:<br>
<div style="background-color:#b0e0e6;">
$ python Exporter.py --Nidhi --since 2015-01-01 --until 2017-09-25
</div>
<br>
Exporter.py creates a file with name output_got.csv which I renamed to Nidhi.csv. Command to rum my program is:<br>
<div style="background-color:#b0e0e6;">
$ python tweets_analysis Nidhi
</div>
<br>
The program opens the csv file and reads all the records into a list of strings. It skips the first line as it is the header. It then calls the functional routines one by one. The output generated for running with Nidhi.csv is:<br>
Total no. of tweets: 3120<br>
Average Number of words per tweet = 10.4330128205<br>
Lexical diversity = 0.252425418385<br>
<pre>
+---------------+
| Words | Count |
+-------+-------+
| thank | 320 |
| india | 162 |
| say | 124 |
| yes | 109 |
| also | 101 |
+-------+-------+
</pre>
Printing top 5 tweets<br>
1. I don't know who killed Gauri Lankesh. But I do see who is celebrating her death and vilifying her.<br>
Popularity = 17679<br>
Link = https://twitter.com/Nidhi/status/905431561985773570<br>
-------------------<br>
2. A message to those in the media who are still independent and do their job by fearlessly asking questions. We won't be intimidated https:// twitter.com/pti_news/statu s/871593196953849856 …<br>
Popularity = 10653<br>
Link = https://twitter.com/Nidhi/status/871595543041941504<br>
-------------------<br>
3. It's now fairly clear demonetisation was a purely political move. Brilliant actually. Economy got hit but hey, U.P. was won<br>
Popularity = 9018<br>
Link = https://twitter.com/Nidhi/status/902877626334756864<br>
-------------------<br>
4. Hello people, Ramdev is not buying NDTV. Thank you<br>
Popularity = 8892<br>
Link = https://twitter.com/Nidhi/status/871640633663905793<br>
-------------------<br>
5. Honoured to present my book 'Left,Right &Centre,The Idea of India' to the President @RashtrapatiBhvn @PenguinIndia pic.twitter.com/m6MrQHmhNr<br>
Popularity = 7233<br>
Link = https://twitter.com/Nidhi/status/886984933507448833<br>
-------------------<br><br>
No. of positive tweets = 1043 Percentage = 33.4294871795<br>
No. of neutral tweets = 1616 Percentage = 51.7948717949<br>
No. of negative tweets = 461 Percentage = 14.7756410256<br><br>
Topic 1 has words: income tax department sends notice harsh mander institute via httweets<br>
Topic 2 has words: anyone bjp condemned language today actually first one anything else<br>
Topic 3 has words: wonder took long life short live fruit covered story well<br>
Topic 4 has words: lol sigh never according yes saying mention press cog corner<br>
Topic 5 has words: hiv but thank actually thank thank sephora actually french thank<br><br>
I have captured the output of the runs against the four files in the following Google sheet:<br>
<a href="https://docs.google.com/spreadsheets/d/1I-qQFOykHfr3mWIhX1F8uYmTW0gbuyMbMEMSM3qjxpg/edit?usp=sharing" target="_blank">tweet_analysis output</a><br>
For your ready reference here is a screenshot:<br><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe0Tm4dmjVuqzaDOgswRdEfIRBR5wHLdRyT5JgrMt57HYjYDEkPaxFznOHgK_DsKrK9ThPuNDJhzEURQRpE4z6dUfDGV9MY-0-Xf2YZzRcw6_oxnmLIo7ZzindkS3H9w-0m6GEE38_FmFS/s1600/Screenshot+from+2017-09-29+20-50-32.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe0Tm4dmjVuqzaDOgswRdEfIRBR5wHLdRyT5JgrMt57HYjYDEkPaxFznOHgK_DsKrK9ThPuNDJhzEURQRpE4z6dUfDGV9MY-0-Xf2YZzRcw6_oxnmLIo7ZzindkS3H9w-0m6GEE38_FmFS/s400/Screenshot+from+2017-09-29+20-50-32.png" width="400" height="auto" data-original-width="1539" data-original-height="554" /></a></div>
Some observations<br>
Rupa is the most prolific averaging about 45 tweets per day, whereas the most popular tweet is from Nidhi Razdan. Shubhrastha uses the most words per tweet amongst the four. The highest lexical diversity is from Nidhi indicative of a larger vocabulary knowledge. Rupa's LD value is very low probably because the denominator (number of tweets) is very high. The highest positive sentiment is from Rupa and the highest negative sentiment is from Shubhrastha, both right-leaning. Sentiment neutrality is the lowest in Rupa's tweets indicative of her taking a stand most of the time.<br><br>
Program improvement & enhancement<br>
For lexical diversity calculation we should perhaps consider equal number of tweets.<br>
Sentiment analysis can be done with a more advanced algorithm like Naive Bayes; that would require a corpus of pre-classified tweets, the training data as it is technically called, preferably from Indian users.<br>
Once we have a larger dataset of twitter analyses, this program could be used to classify a twitter user's political orientation as left, centre or right by analysing their tweets. This could be done either with comparing his/her tweets with a political-ideology corpus or measuring similarity with one of the already analysed twitter user.<br>
Just showing the words in a cluster is not meaningful. I need to experiment with the number of clusters and analyse the cluster again separately to derive some semantic meaning. Topic clustering can be also done with a probabilistic algorithm like LDA.<br><br>
Reference:<br>
Mining the Social Web, 2nd Edition by Matthew Russel. O'Reilly Publications.
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com2tag:blogger.com,1999:blog-2508711278752078434.post-43214861725717005552017-09-08T18:38:00.001+05:302020-05-20T01:57:38.391+05:30Ideas From Another Field<div dir="ltr" style="font-family: Georgia; font-size:18px;text-align: justify;" trbidi="on">
Applying concepts from one field or a book in another field has been a common pattern in modern technological development. The spirit of antifragile, a recently coined word, has found its way in the implementation of microservices. In the quest to make software programs antifragile, the way forward is to build intelligence into them. A couple of other examples are: i) The law of diminishing returns from economics which applied to parallel computing becomes Amdahl's Law. ii) I surmise that the Agile board in the Scrum methodology is the application of the Hawthorne Effect. Cross-pollination of ideas is one of the mechanisms of innovation. And, as we found out recently, learning transfer is the way Elon Musk follows to become such a prolific technocrat and businessman.<br>
My essay ends here.<br>
<a name='more'></a>
The following part is just a series of quotes that I have stringed together; the quotes and my brief notes elaborate the summary given in the paragraph above. So if you are interested in the details, read on.<hr/><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTZV7ywPlJgTUFvUl3QKWWd59nCZ_NBgjcMHAs_V06sWUBjDbtnNpfCCAy7jNO3PxvJNtLR0GT_q8gg_L-qhK_Evj2S4thhT3zc1Dt5uDU0ZmU9w-04LSbEvCet4rLr6n7V9so1dhWOZ2p/s1600/applying-ideas.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTZV7ywPlJgTUFvUl3QKWWd59nCZ_NBgjcMHAs_V06sWUBjDbtnNpfCCAy7jNO3PxvJNtLR0GT_q8gg_L-qhK_Evj2S4thhT3zc1Dt5uDU0ZmU9w-04LSbEvCet4rLr6n7V9so1dhWOZ2p/s320/applying-ideas.jpg" width="320" height="240" data-original-width="720" data-original-height="540" /></a></div><br/>
It was a very interesting moment for me when I bumped into antifragility while I was reading up on microservices. In his book <i>Antifragile: Things That Gain From Disorder</i> Nassim Taleb defined his concept as: "Antifragility is beyond resilience or robustness. The resilient resists shocks and stays the same; the antifragile gets better. This property is behind everything that has changed with time."<br><br>
Adrian Cockcroft elaborated on this definition while applying it to micoservices. "The point of antifragility is that you always want a bit of stress in your system to make it stronger."<br>
Source: <a target="_blank" href="https://www.safaribooksonline.com/library/view/microservice-architecture/9781491956328/ch04.html">https://goo.gl/jz3Wun</a><br><br>
At Netflix, they built a Simian Army that actually tests systems running in production. One of them is Chaos Monkey. As the Netflix blog states: <br>
Chaos Monkey is "a tool that randomly disables our production instances to make sure we can survive this common type of failure without any customer impact. The name comes from the idea of unleashing a wild monkey with a weapon in your data center (or cloud region) to randomly shoot down instances and chew through cables — all the while we continue serving our customers without interruption. By running Chaos Monkey in the middle of a business day, in a carefully monitored environment with engineers standing by to address any problems, we can still learn the lessons about the weaknesses of our system, and build automatic recovery mechanisms to deal with them. So next time an instance fails at 3 am on a Sunday, we won’t even notice."<br>
Source: <a target="_blank" href="https://medium.com/netflix-techblog/the-netflix-simian-army-16e57fbab116">https://goo.gl/ZQt99d</a><br><br>
Bilgrin Ibryam compares and contrasts antifragile system from fragile systems and suggests things that need to be in place in order to build antifragile software:<br>
"A fragile system is difficult to modify, and cannot cope with a changing environment. Even if it provides some value when used in a stable non changing environment, when faced with further stress and change, it quickly turns into a liability. Many organisations have applications (mainframes for example) which are impossible to change, very expensive to maintain, but still running on high cost as they are very critical to the business.<br>
An antifragile system is created with change in mind and it feeds from stress and change. It is much harder to create such a system (it is not a software system but a social-technical system) but once it is in place, it drives the business based on change, and even creates the change.<br>
But once you put an appropriate organizational structure, the right tools and culture in place, then you can start gaining from change. Then you can afford having Friday Hackathons, then you can start exploring open source projects and start contributing to them, then you can start open sourcing your internal projects and benefit from a community, and generally be the change itself. And why not the Netflix or the Amazon of tomorrow."<br>
Source: <a target="_blank" href="https://developers.redhat.com/blog/2016/07/20/from-fragile-to-antifragile-software/">https://goo.gl/psrjP6</a> <br><br>
Extending this idea further, Vivek Juneja posits about the future: "The future is to allow the applications to be able decide for themselves in dealing with failure, chaos and uncertainty. This requires us to build intelligence back into the system that is ever growing and continually learning about its surrounding. That will make systems to be self-aware and truly anti-fragile."<br>
Source: <a target="_blank" href="https://thenewstack.io/monitoring-microservices-self-healing-and-the-connection-to-antifragile-systems/">https://goo.gl/9NYcGy</a> <br><br>
This method of injecting ideas from other fields can be seen in Amdahl's Law.<br>
In economics, the law of diminishing returns states that "in all productive processes, adding more of one factor of production, while holding all others constant, will at some point yield lower incremental per-unit returns."<br>
Source: <a target="_blank" href="https://en.wikipedia.org/wiki/Diminishing_returns">https://en.wikipedia.org/wiki/Diminishing_returns</a> <br><br>
When applied to parallel computing, the law of diminishing returns becomes Amdahl's Law:<br>
"Amdahl’s law is a formula used to find the maximum improvement possible by improving a particular part of a system. In parallel computing, Amdahl's law is mainly used to predict the theoretical maximum speedup for program processing using multiple processors. It is named after Gene Amdahl, a computer architect from IBM and the Amdahl Corporation. This term is also known as Amdahl’s argument."<br>
Source: <a target="_blank" href="https://www.techopedia.com/definition/17035/amdahls-law">https://goo.gl/FN2fQf</a><br><br>
To explain the law in other words: "The incremental improvement in speedup gained by an additional improvement in the performance of just a portion of the computation diminishes as improvements are added. An important corollary of Amdahl's Law is that if an enhancement is only usable for a fraction of a task, we can't speed up the task by more than the reciprocal of 1 minus that fraction."<br>
Source: Computer Architecture: A Quantitative Approach by John Hennesy & David Patterson. Published by Morgan Kaufmann. A preview is available at — <a target="_blank" href="https://books.google.co.in/books?id=v3-1hVwHnHwC&pg=PA47&lpg=PA47">https://goo.gl/dfTZNw</a><br><br>
More specifically, this law "is used to predict the theoretical maximum speed up of program processing using multiple processors."<br>
The formula is:<br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOTT_bc6yojkK6666e1nh81LLpI1BIpq8aAnl3UFp6uSyIAFo_PAm8XIQ8hU2v2WahKWdJ4e2E_VWt7Dag22WR93jParyeuIvK1kJoAFM_jNQ2uU_ACQJNUuKdBmT-Q3MXDI7QKriONf6S/s1600/Screenshot+from+2017-09-08+17-54-05.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOTT_bc6yojkK6666e1nh81LLpI1BIpq8aAnl3UFp6uSyIAFo_PAm8XIQ8hU2v2WahKWdJ4e2E_VWt7Dag22WR93jParyeuIvK1kJoAFM_jNQ2uU_ACQJNUuKdBmT-Q3MXDI7QKriONf6S/s400/Screenshot+from+2017-09-08+17-54-05.png" width="400" height="140" data-original-width="1528" data-original-height="533" /></a></div>
Source: <a target="_blank" href="https://en.wikipedia.org/wiki/Amdahl's_law">https://en.wikipedia.org/wiki/Amdahl's_law</a> <br><br>
Here's another example. I surmise that the Agile Card in Scrum, is a way of implementing the Hawthorne Effect which is:<br>
"The Hawthorne experiments were originally designed by the National Research Council to study the effect of shop-floor lighting on worker productivity at a telephone parts factory in Hawthorne. However, the researchers were perplexed to find that productivity improved not just when the lighting was improved, but also when the lighting was diminished. Productivity improved whenever changes were made in other variables such as working hours and rest breaks. The researchers concluded that the workers’ productivity was not being affected by the changes in working conditions, but rather by the fact that someone was concerned enough about their working conditions to conduct an experiment on it."<br>
Source: <a target="_blank" href="http://www.investopedia.com/terms/h/hawthorne-effect.asp#ixzz4rPXjCkA9">https://goo.gl/hhaPcy</a> <br><br>
The basic of all human emotions is insecurity. Feeling important is the first defense against insecurity. Now whether the sense of importance comes from within or outside, the impact of someone noticing our work goes a long way to add to the feeling of being important. In the field of agile software development, and in particular in Scrum, an important tool is used: the Agile board which is shown below:<br><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://realtimeboard.com/blog/wp-content/uploads/2016/02/agile-board.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://realtimeboard.com/blog/wp-content/uploads/2016/02/agile-board.png" width="400" height="246" data-original-width="800" data-original-height="492" /></a></div>
In my view, the Agile board is an example of applying the Hawthorne Effect in software development.<br><br>
This pattern of applying ideas and concepts from one field in another, which can be termed cross-pollination, is one of the ways to innovate. In his book <i>The Ten Faces of Innovation</i>, Tom Kelley discusses various personas that innovate. One of them is the Cross-Pollinator.<br><br>
He describes: "The Cross-Pollinator draws associations and connections between seemingly unrelated ideas or concepts to break new ground. Cross-pollinators can create something new and better through the unexpected juxtaposition of seemingly unrelated ideas or concepts. They often innovate by discovering a clever solution in one context or industry, then translating it successfully to another. For example, it was a Cross-Pollinator who transplanted the idea of a piano keyboard from the musical world to create early manual typewriters in the business world, which of course evolved step by step into the electronic keyboards we all use today.<br>
Orville and Wilbur Wright cross-pollinated materials and mechanisms from the emerging bicycle industry to build their first powered aircraft."<br>
Source: The Ten Faces of Innovation by Tom Kelley with Jonathan Littman. 2007. Published by Profile Books.<br><br>
Elon Musk's entire knowledge acquisition methodology is a form of cross-pollination, called learning transfer.
Entrepreneur & author Michael Simmons describes:<br>
'Starting from his early teenage years, Musk would read through two books per day in various disciplines according to his brother, Kimbal Musk. To put that context, if you read one book a month, Musk would read 60 times as many books as you.<br>
Musk is also good at a very specific type of learning that most others aren’t even aware of — learning transfer.
Learning transfer is taking what we learn in one context and applying it to another. It can be taking a kernel of what we learn in school or in a book and applying it to the “real world.” It can also be taking what we learn in one industry and applying it to another.'<br>
Source: <a target="_blank" href="https://medium.com/@michaeldsimmons/how-elon-musk-learns-faster-and-better-than-everyone-else-a010a4f586ef">https://goo.gl/CdZKox</a><br><br>
So, the next time you come across a seminar on cognitive psychology or a book on marine biology, it would be worthwhile to attend the seminar or read the book.
<br />
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com13tag:blogger.com,1999:blog-2508711278752078434.post-40609156573370389942017-08-11T23:37:00.000+05:302020-05-20T01:58:18.954+05:30I Dare You Not To Fall In Love<div dir="ltr" style="font-family: Georgia; font-size:18px;text-align: justify;" trbidi="on">
On the best part of using Ruby on Rails for software development, thus spake its creator David Hansson:
<blockquote>
<i>You get to use Ruby, which, even in a world that has rediscovered the benefits of functional programming and immutability, remains the most extraordinarily beautiful and luxurious language I’ve yet to encounter. Just look at some code. I dare you not to fall in love.</i><sup>[1]</sup></blockquote>
Well, this is my exact opinion of Ruby, my most favourite programming language but I couldn't have articulated it any better than Hansson.<br/><br/>
<a name='more'></a>
Beauty, simplicity and aesthetics were not the main considerations in choosing Rails for my current project. I am part of a SMB that's into industrial manufacturing and services, in which the IT department is even smaller. So, strictly speaking, though I don't work in a startup, I work in a startup mode.<br/><br/>
During the course of discussions on building a web application, I got a poser: can you make it at the lowest cost possible? My salary is a sunk cost, so the lowest marginal cost would be zero by developing the application myself. My incoming skill set when I joined the company was Java and Meteor, which was what the management knew. I said, yes I can, but the technology will be Ruby on Rails. Which technology I use was not a concern of the business so long as the application worked and was reasonably performant.<br/><br/>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgegxPSTdNqevTnxLFnnsJ9xk3LIXGDjdG4sU9ed52H_t5_Q9JkS3UrYAlrOPJbRkn1gHbdWIGnvGGd6CtSFq8fi7QUPKxxfjo80l0bZtuGDWgIXwDZSXyONu0ykvr7y2BZCzPb2woryu-9/s1600/rails-dare-3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgegxPSTdNqevTnxLFnnsJ9xk3LIXGDjdG4sU9ed52H_t5_Q9JkS3UrYAlrOPJbRkn1gHbdWIGnvGGd6CtSFq8fi7QUPKxxfjo80l0bZtuGDWgIXwDZSXyONu0ykvr7y2BZCzPb2woryu-9/s320/rails-dare-3.jpg" width="450" height="auto" data-original-width="1323" data-original-height="992" /></a></div>
<br/>
A full-stack programmer needs a full-stack framework, or a near-full stack framework. Meteor comes with MongoDb under the hood, so it's a full-stack framework whereas Rails does not come with a built-in database, so it's a near-full-stack framework. But if we leave the database part out, as Hansson stated, "Rails is full-stack by default. We have a pragmatic, full-stack answer that could be formulated based on that ideology that still offers amazing productivity from the second you run the rails new command."<sup>[1]</sup>.<br/><br/>
Thus I switched from a person who used to split time 80% - 20% between supervision and coding to the exact reverse: 80% of the time on software development and 20% of the time on management. I ploughed on as a full stack developer hitting at the keyboard for most part of the day, with me in the avatar of requirements gatherer, coder and tester all rolled into one. A person with 25 years experience and coding may be a rarity in my city, but I am not alone in the world.<sup>[2]</sup><br/><br/>
The application, an employee and customer engagement portal, is live and it could not have happened without Rails. The functionality I put in is: security layer with encrypted passwords, forgot password, role based access, authority based email notifications for approvals, paginated views, dynamically growing tables, pdf / Excel documents, bulk-emails, file uploads / downloads — all around the business logic, departmental workflows and management reports.<br/><br/>
Along the way, I captured my learnings in applying Rails and shared them on my blog; these posts were re-published by DZone:<br/>
<table style="border:1px solid black;">
<thead>
<tr>
<th style="border:1px solid black; background-color:#BDB76B; color:white;">Title</th>
<th style="border:1px solid black; background-color:#BDB76B; color:white;">Blog Link</th>
<th style="border:1px solid black; background-color:#BDB76B; color:white;">DZone Link</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border:1px solid red;">Practical Rails : Adding a bootstrap theme</td>
<td style="border:1px solid red;"><a target="_blank" href="http://mh-journal.blogspot.in/2016/04/practical-rails-adding-bootstrap-theme.html">http://mh-journal.blogspot.in/2016/04/practical-rails-adding-bootstrap-theme.html</a></td>
<td style="border:1px solid red;"><a target="_blank" href="https://dzone.com/articles/practical-rails-adding-a-bootstrap-theme">https://dzone.com/articles/practical-rails-adding-a-bootstrap-theme</a></td>
</tr>
<tr>
<td style="border:1px solid red;">Steps And Commands For RoR Application Deployment On Linode Server</td>
<td style="border:1px solid red;"><a target="_blank" href="http://mh-journal.blogspot.in/2016/10/steps-and-commands-for-ror-application.html">http://mh-journal.blogspot.in/2016/10/steps-and-commands-for-ror-application.html</a></td>
<td style="border:1px solid red;"><a target="_blank" href="https://dzone.com/articles/steps-and-commands-for-ror-application-deployment">https://dzone.com/articles/steps-and-commands-for-ror-application-deployment</a></td>
</tr>
<tr>
<td style="border:1px solid red;">Applied Rails : Variable Rows For Child Records</td>
<td style="border:1px solid red;"><a target="_blank" href="http://mh-journal.blogspot.in/2017/02/applied-rails-variable-rows-for-child.html">http://mh-journal.blogspot.in/2017/02/applied-rails-variable-rows-for-child.html</a></td>
<td style="border:1px solid red;"><a target="_blank" href="https://dzone.com/articles/applied-rails-variable-rows-for-child-records">https://dzone.com/articles/applied-rails-variable-rows-for-child-records</a></td>
</tr>
<tr>
<td style="border:1px solid red;">Applied Rails : Customizable Text</td>
<td style="border:1px solid red;"><a target="_blank" href="http://mh-journal.blogspot.in/2017/03/applied-rails-customizable-text.html">http://mh-journal.blogspot.in/2017/03/applied-rails-customizable-text.html</a></td>
<td style="border:1px solid red;"><a target="_blank" href="https://dzone.com/articles/applied-rails-customizable-text">https://dzone.com/articles/applied-rails-customizable-text</a></td>
</tr>
<tr>
<td style="border:1px solid red;">Applied Rails: Bulleted Text With Prawn</td>
<td style="border:1px solid red;"><a target="_blank" href="http://mh-journal.blogspot.in/2017/03/applied-rails-bulleted-text-with-prawn.html">http://mh-journal.blogspot.in/2017/03/applied-rails-bulleted-text-with-prawn.html</a></td>
<td style="border:1px solid red;"><a target="_blank" href="https://dzone.com/articles/applied-rails-bulleted-text-with-prawn">https://dzone.com/articles/applied-rails-bulleted-text-with-prawn</a></td>
</tr>
<tr>
<td style="border:1px solid red;">Applied Rails: An Algorithmic Perspective</td>
<td style="border:1px solid red;"><a target="_blank" href="http://mh-journal.blogspot.in/2017/04/applied-rails-algorithmic-perspective.html">http://mh-journal.blogspot.in/2017/04/applied-rails-algorithmic-perspective.html</a></td>
<td style="border:1px solid red;"><a target="_blank" href="https://dzone.com/articles/applied-rails-an-algorithmic-perspective">https://dzone.com/articles/applied-rails-an-algorithmic-perspective</a></td>
</tr>
<tr>
<td style="border:1px solid red;">Applied Rails: Gems I use</td>
<td style="border:1px solid red;"><a target="_blank" href="http://mh-journal.blogspot.in/2017/06/applied-rails-gems-i-use.html">http://mh-journal.blogspot.in/2017/06/applied-rails-gems-i-use.html</a></td>
<td style="border:1px solid red;"><a target="_blank" href="https://dzone.com/articles/applied-rails-gems-i-use">https://dzone.com/articles/applied-rails-gems-i-use</a></td>
</tr>
</tbody>
</table>
<br/><br/>
If working with Ruby is the best part of using Rails, the second best part is the Ruby community. Remember, I had no architects and software engineers in my team. Online articles and forums were my only recourse if I got stuck. I always found helpful tutorials or answers to my questions. There is a certain down-to-earth and friendly attitude that I felt from the Ruby community.<br/><br/>
No wonder the community has a value system that takes forward the full ideology of Rails enunciated in the nine pillars of <a href="http://rubyonrails.org/doctrine/">The Rails Doctrine</a><sup>[3]</sup>:<br/>
<ol>
<li>Optimize for programmer happiness</li>
<li>Convention over Configuration</li>
<li>The menu is omakase</li>
<li>No one paradigm</li>
<li>Exalt beautiful code</li>
<li>Provide sharp knives</li>
<li>Value integrated systems</li>
<li>Progress over stability</li>
<li>Push up a big tent</li>
</ol>
Alhough the bulk of my career was with large applications and teams, over the last three years, I have worked with companies and projects that can be described as startups / startup mode / small-team companies. When some asks my opinion on technology choice, I suggest as a first cut:<br/>
<table style="border:1px solid black;">
<thead>
<tr>
<th style="border:1px solid black; background-color:#BDB76B; color:white;">Stage</th>
<th style="border:1px solid black; background-color:#BDB76B; color:white;">Framework</th>
<th style="border:1px solid black; background-color:#BDB76B; color:white;">Language</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border:1px solid red;">Startups, mobile device focus or build MVP to get funding</td>
<td style="border:1px solid red;">Meteor</td>
<td style="border:1px solid red;">JavaScript</td>
</tr>
<tr>
<td style="border:1px solid red;">Startups without mobile device focus or early stage companies</td>
<td style="border:1px solid red;">Rails</td>
<td style="border:1px solid red;">Ruby</td>
</tr>
<tr>
<td style="border:1px solid red;">Funded projects</td>
<td style="text-align:left; border:1px solid red;">Spring and Hibernate</td>
<td style="text-align:left; border:1px solid red;">Java</td>
</tr>
<tr>
<td style="border:1px solid red;">Established companies with massive scale</td>
<td style="border:1px solid red;">Polyglot Programming</td>
<td style="border:1px solid red;">Java coexisting with Scala, Node.js, Python</td>
</tr>
</tbody>
</table>
<br/>
When I look back I feel satisfied at what I could deliver. Based on my experience, it seems to me that the third row in the above table can be eliminated and the stage merged with the second. That is, enterprise application development should happen in Rails rather than Java, notwithstanding the immense appeal of Spring Boot. Of course, this is my opinion based on my experience and influenced by the local ecosystem. One thing I can say emphatically is that Rails brings high productivity with small teams, in other words, lower costs.<br/><br/>
<hr/>
References:<br/>
[1] <a target="_blank" href="https://www.quora.com/What-makes-Rails-a-framework-worth-learning-in-2017/answer/David-Heinemeier-Hansson">https://www.quora.com/What-makes-Rails-a-framework-worth-learning-in-2017/answer/David-Heinemeier-Hansson</a><br/>
[2] <a target="_blank" href="https://belitsoft.com/php-development-services/top-software-developers-after-40-50-and-60">https://belitsoft.com/php-development-services/top-software-developers-after-40-50-and-60</a><br/>
[3] <a target="_blank" href="http://rubyonrails.org/doctrine/">http://rubyonrails.org/doctrine/</a>
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com6tag:blogger.com,1999:blog-2508711278752078434.post-1090391776863676912017-06-02T18:46:00.003+05:302017-09-08T18:47:47.971+05:30Applied Rails : Gems I Use<div dir="ltr" style="font-size: 18px; text-align: justify;" trbidi="on">
In this article, I discuss key gems that I have used in my Rails application. For each gem, I state what it is used for, a brief description of how I used it and the code snippet(s) pertaining to my use case.<br><br>
<a name='more'></a>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWmtVvn1yuYA0VfsJzhW-5p8Uc91J4CzTiesML_yTObNRylMIMtzxKleJtpWsBXp034J9J_Qs82Ew1mUHvYgHdloHy8KWkNoRZ-O8UJaTZtyMZcxRbjHbxiKgERg4pxSe-M7HnAdMBtaI-/s1600/rails-gems-blog.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWmtVvn1yuYA0VfsJzhW-5p8Uc91J4CzTiesML_yTObNRylMIMtzxKleJtpWsBXp034J9J_Qs82Ew1mUHvYgHdloHy8KWkNoRZ-O8UJaTZtyMZcxRbjHbxiKgERg4pxSe-M7HnAdMBtaI-/s320/rails-gems-blog.jpg" width="320" height="240" data-original-width="720" data-original-height="540" /></a></div>
<b>devise</b><br>
I use the devise gem for user authentication. It has 10 modules: Database Authenticatable, Omniauthable, Confirmable, Recoverable, Registerable, Rememberable, Trackable, Timeoutable, Validatable, and Lockable. The cool thing is you can use only the modules that you want.<br><br>
<b>cancan</b><br>
I use the cancan gem for user authorization. All I had to do was run a simple command and override the initialize method in the User class.<br>
In the following code snippet, users in role commercial_officer are allowed to execute the claimsForChecking action in the ExpensesClaim class.
<script src="https://gist.github.com/mh-github/60fa22be8fa1b80d589e9f3f50910d51.js"></script>
A caveat: cancan is no longer supported, and if you are starting afresh, you got to use cancancan.<br><br>
<b>role_model</b><br>
I use the role_model gem to provide role based access. The cool thing about it is that you can control the roles by just altering a number in the database table. Let's say you have six roles: guest, executive, manager, sales, cxo, admin. Since it works on bit mask, each of the role gets the value of 2<sup>n</sup> where n ranges 0 to total number of roles minus 1. In the six roles I mentioned, guest gets 1 and admin gets 32. So if a CXO also has a sales role, give her record's roles_mask column a value of 8 + 16 = 24 in the database.<br><br>
In the following code snippet, a user is given their role at the time of user creation. The set_roles_mask method takes the email used for registration, checks if the email is present in the Employees master table and if yes, sets the Users table roles_mask to the value in the Employees table. If the user is not an employee the user is given a roles_mask of 1 (guest).
<script src="https://gist.github.com/mh-github/79253859adf755e47001813288921224.js"></script>
The checking code in the UI layer looks like the following code; here only some users (either in the CXO role or those in the Bulk_email_team) are given access to a particular menu item in the navigation bar.
<script src="https://gist.github.com/mh-github/4cfd566aa87cb891b94231d592e819d8.js"></script>
With the combination of devise, cancan and role_model you will have a robust production-ready security layer for your application, all with a few lines of code. Java developers who use Spring frameworks will be surprised at the level of functionality that we achieve with a few lines of code in Rails. This, despite Spring Boot.<br><br>
<b>prawn</b><br>
I use the prawn gem for generating pdf documents. It provides most of the features I require. For bulleted text with proper alignment, I had to write a small function that prints asterisks in the first column. See an earlier blog post of mine[1] post for more details.<br><br>
<b>prawn-table</b><br>
I use the prawn-table gem for displaying content in tables inside pdf documents.<br>
In the following code snippet, I check whether there is enough space on the page to render the table. If not, I display the table on a new page.
<script src="https://gist.github.com/mh-github/3da56eb6df8a0b0d4bdef741f51c0727.js"></script>
<b>fiscali</b><br>
I use the fiscali gem for date calculations based on fiscal year.<br><br>
In the following code snippet, first the time zone is set to India. If the user did not enter a starting date, the beginning of the Indian financial year (1st April) is taken. If the user did not enter a end date, today's date is taken as the end date. Using the two dates, records created in the table between the start date and end date are fetched.<br><br>
config/initializers/fiscali.rb
<script src="https://gist.github.com/mh-github/f20cf68d92085ee295fcbcaeed23440c.js"></script>
Code in controller
<script src="https://gist.github.com/mh-github/f1df3b017f8397eb37ab943813b5ace7.js"></script>
<b>date_validator</b><br>
Data entered by users in the browser screens (HTML forms) is validated in the model classes. the date_validator gem eases the validation of date rules.<br><br>
In the following code snippet, I validate that a travel record should be in the past or on today. First I check that there is an end date, it is after or on the start date and it is today or before. The start date has to be in the past or on today. But the nice trick here is, there is no validation code for the travel start date because the two validation rules of the end date automatically take care of it.
<script src="https://gist.github.com/mh-github/b0384aa39a325123b6b2c7e4dd92c2c8.js"></script>
The Rails data validation approach is explained as: "Nothing to do with our application comes out of the database or gets stored into the database that doesn't get first go through the model. This makes models and ideal place to put validations: it doesn't matter whether the data comes from a form or from some programmatic manipulation in our application. If a model checks it before writing to the database, then the database will be protected from bad data."[2]<br><br>
<b>wice_grid</b><br>
I use the wice_grid gem to filter tabular data. You can also sort the data.<br><br>
The following code snippet displays Offers in a wice grid and allows user to filter on the customer name. It even pulls the associated records from the customer and employee tables. The simplicity of Rails is evident in the link_to 'view or edit' the offer entity.
<script src="https://gist.github.com/mh-github/65f083297f44af689532ff71a67850f7.js"></script>
<b>paperclip</b><br>
I use paperclip gem for attaching uploaded files to a particular entity. The use cases I have tackled using this gem are: 1) Allow the user too select from a pre-loaded set of documents. 2) Allow the user to upload any random file. Code snippets for these use cases are given below:
<script src="https://gist.github.com/mh-github/f1d0a66f3f3edd509394bfff24e5d202.js"></script>
<b>Kaminari</b><br>
I use the Kaminari gem when I have to display paginated data.<br><br>
The following code snippet shows employee records in a paginated HTML table.
<script src="https://gist.github.com/mh-github/5a1aa2e64b58d17b5b3656f5ae5ca068.js"></script>
<b>axlsx_rails</b><br>
I use the axlsx_rails gem to generate Microsoft Excel files.
The following code snippet generates a xlsx file of customer, their location and contacts at each location. The header row having cells with blue fill.
<script src="https://gist.github.com/mh-github/d5b12334886b664833d7810d0d6411a3.js"></script>
<b>custom_error_message</b><br>
I use the custom_error_message gem for customizing my error message not to have the attribute name prefixed.<br><br>
This plugin uses the carat (^) to omit the name of the attribute from error messages. Here's an example:
<script src="https://gist.github.com/mh-github/59ff0f60ccfdc8e14d6b561280a62315.js"></script>
<b>
select2-rails</b><br>
I use the select2-rails gem for selecting entries in ajax style from a drop-down.
The following code shows how users select employee email ids from a select drop down and they get shortened list with each letter they enter.
<script src="https://gist.github.com/mh-github/4ffa2e4137a0c933db92abd4fd7559c4.js"></script>
The extraordinary simplicity of Ruby and the amazing functionality offered by its gems make working with Ruby on Rails a pleasure. To quote David Hansson, the creator of Ruby on Rails[3]:
<blockquote><i>...two basic tenets of Rails appeal in 2017: 1) We have a unique ideological foundation that’s still controversial today and offers the same benefits against the mainstream choices as it did 13 years ago, 2) We have a pragmatic, full-stack answer that could be formulated based on that ideology that still offers amazing productivity from the second you run the rails new command.<br>
Oh, and on top of all that, I’ve saved the cherry for last. You get to use Ruby, which, even in a world that has rediscovered the benefits of functional programming and immutability, remains the most extraordinarily beautiful and luxurious language I’ve yet to encounter. Just look at some code. I dare you not to fall in love.</i></blockquote>
<u>References:</u><br>
[1] <a href="http://mh-journal.blogspot.in/2017/03/applied-rails-bulleted-text-with-prawn.html">http://mh-journal.blogspot.in/2017/03/applied-rails-bulleted-text-with-prawn.html</a><br>
[2] Agile Web Development with Rails4 by Sam Ruby, Dave Thomas, David Heinemeier Hansson. 2013, The Pragmatic Programmers, LLC.<br>
[3] <a href="https://www.quora.com/What-makes-Rails-a-framework-worth-learning-in-2017">https://www.quora.com/What-makes-Rails-a-framework-worth-learning-in-2017</a><br>
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com3tag:blogger.com,1999:blog-2508711278752078434.post-61865893682267905072017-05-12T17:42:00.000+05:302020-05-20T01:59:35.713+05:30Book Review : The Rise Of The Robots<div dir="ltr" style="font-family: Georgia; font-size:18px;text-align: justify;" trbidi="on">
The technology world faces new trends frequently. New technologies typically promise to get things done faster, reduce costs, and open new market segments, thus improving the financials of a lot of firms. From Service-oriented Architecture to mobile and cloud computing, all of them stake their claim to deliver these benefits.<br><br>
However, the advent of Artificial Intelligence (AI) will impact the world economy in a way that no technology in the past was able to. This is the core thesis of Martin Ford’s 2015 book, 'The Rise of the Robots', sub-titled 'Technology and the Threat of Mass Unemployment.' If AI can unleash a tsunami of unemployment, how should America deal with it?<br><br>
<a name='more'></a>
Quite unexpectedly, Ford proposes Universal Basic Income (UBI) as the solution. In doing so, he ventures into economics, quite unusual for a book on technology. It is this mix of technology and economics is what make the book such a heady read.<br><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr5gk0TChQIWoJvxtOmeg7QzRdR1MvFwY3bSKGyMqW4Qhld506pM2W7eTRADyaLJbNHx5ly7nT81yBoWWFU-Lt2-m-CZL4bkyCJpyNVU4HVCNrP43IBurOabE_gust9_-SBHa-VfFZ2URB/s1600/riseoftherobotsreview-blog.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr5gk0TChQIWoJvxtOmeg7QzRdR1MvFwY3bSKGyMqW4Qhld506pM2W7eTRADyaLJbNHx5ly7nT81yBoWWFU-Lt2-m-CZL4bkyCJpyNVU4HVCNrP43IBurOabE_gust9_-SBHa-VfFZ2URB/s320/riseoftherobotsreview-blog.jpg" width="450" /></a></div>
<br/>
The word Robots in the book title is an euphemism for AI, which is the actual technology wave coming up. In fact, Robotics is a subset of AI. As Stuart Russel & Peter Norvig state in their most popular university level text book, <i>Artificial Intelligence: A Modern Approach</i> [1] : "Robots are physical agents that perform tasks by manipulating the physical world. To do so, they are equipped with effectors such as legs, wheels, joints, and grippers. Effectors have a single purpose: to assert physical forces on the environment. Robots are also equipped with sensors, which allow them to perceive their environment. Present day robotics employs a diverse set of sensors, including cameras and lasers to measure the environment, and gyroscopes and accelerometers to measure the robot's own motion."<br><br>
So I guess Robots was used in the title because human jobs being snatched away by robots is the most visible and physical manifestation of AI. Secondly, the word makes the title catchy and appeal to a wider audience. The Rise of Artificial Intelligence wouldn't work that well.<br><br>
The key point though, is that robots will do jobs that were previously done by humans. "A computer doesn't need to replicate the entire spectrum of your intellectual capability in order to displace you from your job; it only needs to do the specific things you are paid to," Ford writes. So, jobs that were previously done by humans and which were thought to be not doable by robots will also be taken away.<br><br>
The unprecedented disruptive force of Information Technology will put even white-collar jobs at risk. No field will remain unaffected. The book takes us through the impact on higher education and health care, and then through future technologies and industries.<br><br>
The one sector that may see a milder impact of AI and robots is health care. Ford writes: "Given that truly capable and autonomous elderly-care robots are unlikely to emerge in the near future, it might seem reasonable to expect that the looming shortage of nursing home workers and home health aids will, to a significant extent, offset any technology-driven job losses that will occur in other sectors of the economy". Problem is that these jobs are not enough to match the likely unemployment numbers. In addition, "these jobs are low-paying and not particularly suitable for a large fraction of the population."<br><br>
Throughout the book, Ford uses a lot of data drawn from diverse resources to back up his statements. In some cases, data are shown to illustrate that a certain trend has started. However, the hallmark of the book is it does not drown you in complex mathematics or jargon, and is written in a clear and lucid style well suited for the general audience.<br><br>
<b>Strengths</b><br>
The book is sort of a primer for a variety of topics: Big Data, machine learning, nanotechnology, to mention a few. Martin provides a brief history of the development of these technologies. So, if you want to catch up on important topical technology subjects, this book is for you.<br><br>
Despite being a reader of so many magazines and newspapers I encountered a lot of products, some of which I was not aware of, and others whom I had heard but not known them in sufficient detail - Kinect, Baxter, Roomba, Goggles, Stuxnet, Quill, StatsMonkey, WorkFusion, IBM Watson, Sankai etc. As I relished the reading with details of these products, there were quite a few 'wow' moments. Writing all the 'wow' sections would take a lot of space, so I'd just mention a couple:<br>
<blockquote>
"Aramco, the Saudi national oil company, for example, maintains a massive computing center where powerful supercomputers are instrumental in maintaining the flow of oil. Many people might be surprised to learn that one of the most important ramifications of Moore's Law has been the fact that, at least so far, world energy supplies have kept pace with surging demand." [pg 70]
</blockquote>
<blockquote>
"In 2009, for example, a company called Spread Networks spent as much as $200 million to lay down a new fiber-optic cable link stretching 825 miles in a straight line from Chicago to New York. The company operated in stealth mode so as not to alert the competition even as it blasted its way through the Allegheny Mountains. When the new fiber-optic path came online, it suffered a speed advantage of perhaps three or four thousandths of a second compared with existing communications routes. That was enough to allow any algorithmic trading systems employing the new route to effectively dominate their competition. Wall Street firms, faced with algorithmic decimation, lined up to lease bandwidths -- reportedly at a cost as much as ten times that of the original, slower cable." [pg 116]
</blockquote>
But, are these the ones what caused my peak interest? No, as undoubtedly the most fascinating one, the super-wow section of the book was chapter 9, Super-Intelligence and the Singularity. To express pithily, Singularity is the technology tipping point.<br><br>
Ford discusses the concept of a truly intelligent computer system, one that has human level intelligence, traces the origin of the term Singularity and explains in detail the ideas of Ray Kurzweil. He also draws attention to the dubious side of Singularians and some members of the scientific community. Examples are immortality, digitally simulated actors, overwhelming first-mover advantage to some firms making them uncatchable by their competitors, and so on.<br><br>
The one personality that caught me totally off-guard was Hayek. As I mentioned earlier, the book's rather surprising conclusion is that UBI should be implemented to deal with the rise of the robots. If that conclusion was so novel to me, the fact there is a Hayekian basis for supporting UBI was an eye-opener, which in itself was worth the price of the book.<br><br>
Friedrich Hayek is the neo-liberal champion of decentralized power and a staunch advocate of the competitive market system with freely adjusting prices. Hayek is well known only for his ideas on free trade and minimum governance. Ford quotes from Hayek's book <i>Law, Legislation and Liberty</i>: "The assurance of a certain minimum income for everyone, or a sort of floor for himself, appears not only to be a wholly legitimate protection against a risk common to all, but a necessary part of the Great Society in which the individual no longer has specific claims on the members of the particular small group into which he was born".<br><br>
Ford further adds that, "the conservative argument for a basic income centers on the fact that it provides a safety net coupled with individual freedom of choice." Thus, the root support for UBI comes from Hayek. Well, if I hadn't read this book, I would probably not known about Law, Legislation and Liberty and would have never would have got to know free-market economists' viewpoint of supporting the concept.<br><br>
Ford elucidates how UBI can be paid for. He suggests "limiting eligibility for the basic income to citizens and perhaps by means-testing it against earned income beyond a certain point," economic gains from a "consistent flow of purchasing power streaming to consumers", reform environmental taxes and making the tax system more progressive. As with other parts, the exposition here too is complete and comprehensive without any gaps.<br><br>
<b>Weaknesses</b><br>
Ford refers to Moore's Law a few times and uses it to illustrate how computers have gotten ever faster and will continue to do so. For example: "...even without accounting for likely future improvements in their designs, machine learning systems powered by deep learning networks are virtually certain to see continued dramatic progress simply as a result of Moore's Law [pg 95 ]" and "once AGI is achieved, Moore's Law alone would likely soon produce a computer that exceeded human intellectual capability [pg 228 ]." But, is it still valid?<br><br>
Moore's Law is what came out of a 1965 article authored by Gordon Moore in which he observed & predicted that the number of components on an integrated circuit doubled every year. The prediction held good till 1975 for transistors. Subsequently chip manufacturers kept up with Moore's Law regarding the doubling part but for various things and slightly longer duration than one year.<br><br>
Last year, Moore's Law was officially pronounced dead. As official as being headlined in an MIT Review article, Moore’s Law Is Dead. Now What? [2]. My point here is, when Ford wrote the book, he did not foresee that Moore's Law will gone so soon and he uses it as a warrant in his arguments.<br><br>
By no means, we should foresee that computing speeds would slow down. The quest for achieving faster computing per space unit will continue, and this will happen with forays into non-silicon non-Neumann computing architectures. The growth will be in non-Moore rates and we don't know yet what they would be [3].<br><br>
Ford discusses IT outsourcing in depth. I was left wondering whether his explanation of off-shoring suffers from the broken window paradox. This is one part of the book that I had my misgivings on.<br><br>
The argument goes like this: In general, outsourcing is part of free trade and comparative advantage. But IT outsourcing is different as its benefits are one-sided. Hence, with regard to IT outsourcing economic principles should not be followed, and some form of protectionism is called for [4].<br><br>
In support of his proposition, he quotes Alan Binder, former vice chairman of the Federal Reserve’s Board of Governors: 'I do believe that the gains garnered by firms by I.T. outsourcing will help them invest in next generation technologies, focus on high-end jobs to be sourced by hires from local market and increase customer engagement by providing 24 x 7 support. These benefits have to be considered but not dismissed in that "measures in the aggregate and glosses over the highly disproportionate impact that offshoring has on the groups of people."' Today, when we are facing ban and reduction of the H1B visa programme by the Trump administration, our policy makers and opinion influencers should be cognizant of conservatives' support to limited protectionism, as applied to I.T. outsourcing.<br><br>
As is my instinct, I do have to do at least one nitpick when I read a book. Here is a sentence on page 110: "If there is one myth regarding computer technology that ought to be swept into the dustbin it is the pervasive believe that computers can do only what they are specifically programmed to do." 'Believe' in this sentence should be 'belief.'<br><br>
<b>Conclusion</b><br>
The most important impact the book had on me was that it alerted me to the AI coverage in media and blogs and made it easier to follow and understand the AI implementations in different domains. Some of the more eyebrow-raising news items have been:
<ul>
<li>Bill Gates’s statement that companies using robots should pay a robot tax. [5]</li>
<li>You might be able to marry a robot by 2050. [6]</li>
<li>Soon cyborg brothels and holiday resorts providing sex robots will open soon. [7]</li>
</ul>
In conclusion, I will leave with a quote from the book: 'Continued progress depends on a vibrant market for future innovations -- and that, in turn, requires a reasonable distribution of purchasing power.' This one sentence captures the techno-economic essence of the book. Whether your interest lies on the technology side or you veer towards economics, it's a fascinating, knowledgful and thought-provoking joy ride.<br><br>
<b>References</b><br>
[1] Third Edition, Pearson India Education Services Pvt Ltd. 2015, Chapter 25, Robotics.<br>
[2] <a href="https://www.technologyreview.com/s/601441/moores-law-is-dead-now-what">https://www.technologyreview.com/s/601441/moores-law-is-dead-now-what</a><br>
[3] <a href="http://rodneybrooks.com/the-end-of-moores-law/">http://rodneybrooks.com/the-end-of-moores-law/</a><br>
[4] <a href="https://goo.gl/ss9SeN">https://goo.gl/ss9SeN</a><br>
[5] <a href="https://qz.com/911968/bill-gates-the-robot-that-takes-your-job-should-pay-taxes/">https://qz.com/911968/bill-gates-the-robot-that-takes-your-job-should-pay-taxes/</a><br>
[6] <a href="http://www.dailystar.co.uk/news/latest-news/590606/Sex-robot-holidays-brothels-prostitutes-escorts-sex-workers-employees-tourists-worldwide">http://www.dailystar.co.uk/news/latest-news/590606/Sex-robot-holidays-brothels-prostitutes-escorts-sex-workers-employees-tourists-worldwide</a><br>
[7] <a href="https://www.forbes.com/sites/ceciliarodriguez/2017/02/28/sex-dolls-brothel-opens-in-spain-and-many-predict-sex-robots-tourism-soon-to-follow/#776696d74ece">https://www.forbes.com/sites/ceciliarodriguez/2017/02/28/sex-dolls-brothel-opens-in-spain-and-many-predict-sex-robots-tourism-soon-to-follow/#776696d74ece</a><br>
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com4tag:blogger.com,1999:blog-2508711278752078434.post-1729708596523775832017-04-14T16:47:00.000+05:302017-05-12T17:42:25.084+05:30Applied Rails: An Algorithmic Perspective<div dir="ltr" style="font-size: 18px; text-align: justify;" trbidi="on">
The Human Resources manager informed that employees working in the corporate headquarters (CHQ) will have the second and fourth Saturday of the month off. This affected the leave balance calculation method in my Rails application. If a CHQ employee applies for leave and a second or fourth Saturday falls in between the start date and end date, they should not be deducted a leave.<br><br>
I was already using the Rails date library. Given a date, I could get the beginning of the month and end of the month in which the date occurred. Before I could figure out how to proceed with this info, I went to stackoverflow.com and put up a question[1].<br><br>
<a name='more'></a>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHQXG5sIXMI8NlE-Y5w0GvWy8umL3296LJj4reAlqN7gxf35839DIpfxtbJKcuL8jvU1538CWUVDeMVWKR_ow_SZwL5z-7msAmOZzaGfUGUN-Zo8cYbrpGvk7GdrJU3IXIeLmJoRTmuR15/s1600/2nd-4th-saturday-blog.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHQXG5sIXMI8NlE-Y5w0GvWy8umL3296LJj4reAlqN7gxf35839DIpfxtbJKcuL8jvU1538CWUVDeMVWKR_ow_SZwL5z-7msAmOZzaGfUGUN-Zo8cYbrpGvk7GdrJU3IXIeLmJoRTmuR15/s320/2nd-4th-saturday-blog.jpg" width="320" height="240" /></a></div><br>
Very quickly, in about 10 minutes or so, Andrey posted a solution. It traverses from the beginning of the month to the end of the month and saves the Saturdays' dates in an array. Then it checks if an array of the second and fourth Saturday dates includes the given date.<br>
<script src="https://gist.github.com/mh-github/64c32ef52f1f78221cf8eae9a04a3366.js"></script>
I was happy, I got a solution so quickly. Just a few minutes later, Reggie proposed an improvised solution. The second Saturday has to be in the day range 8-14, the fourth in the day range 22-28, and so he just checks if the given date is a Saturday and falls between the 8th and 14th or 22nd and 28th of the month.<br>
<script src="https://gist.github.com/mh-github/628c18a0f8c673a452d9ce00604def08.js"></script>
I thought I got a very good solution, so I can now use it. About half an hour later, Eric posted another solution that improvised upon the previous improved solution. He wrote:<br>
Days 1 to 7 are week 0<br>
Days 8 to 14 are week 1<br>
Days 15 to 21 are week 2<br>
Days 22 to 28 are week 3<br>
To get the week id, we can calculate (date.day-1)/7. Since the id is zero-based, the second and fourth Saturdays have an odd week id.<br>
<script src="https://gist.github.com/mh-github/51985d308caa3c48cbea5c4cd30ce08b.js"></script>
This was the best solution. After that I did not get any other solution. So I proceeded with using it.<br><br>
Later in the day, looking at these solutions, I noticed that the sequence we went through was as follows:<br>
First solution: Brute force, just loop through all the data set and find out which one satisfies the solution criteria.<br>
Second solution: Reduce the number of loops using elimination logic.<br>
Third solution: Use a formula that doesn't require to do any looping.<br><br>
Then it struck me that this is how algorithm design happens. You start with the brute-force method, then optimize the algorithm, then figure out a formula that will eliminate unnecessary steps. In many cases, the second step could be to pre-sort the data and use a data structure that does efficient operations.<br><br>
Thus, all in an hour's play with Rails, I journeyed through algorithm design while solving a real-world problem and even though it was a small one, it was an insightful experience for me.<br><br>
Reference<br>
[1] <a href="http://stackoverflow.com/questions/41997584">http://stackoverflow.com/questions/41997584</a>
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com5tag:blogger.com,1999:blog-2508711278752078434.post-39356470192541560082017-03-17T16:27:00.000+05:302017-04-14T16:47:46.538+05:30Applied Rails: Bulleted Text With Prawn<div dir="ltr" style="font-size: 18px; text-align: justify;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfR15GbrxUyQ3h8iun9nm04gLFJkWQ_gp77g-14UaoWtncUtShTYHXex-eAfu_BtozyNtOQjyjXahyOTIgv2Ma-W7N62cPfUo1Mwv_eB-3J1Jln6v-BmFaf7tSVgbTOymY0MpNmTxGiJjf/s1600/prawn-blog-image.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfR15GbrxUyQ3h8iun9nm04gLFJkWQ_gp77g-14UaoWtncUtShTYHXex-eAfu_BtozyNtOQjyjXahyOTIgv2Ma-W7N62cPfUo1Mwv_eB-3J1Jln6v-BmFaf7tSVgbTOymY0MpNmTxGiJjf/s320/prawn-blog-image.jpg" width="320" height="240" /></a></div>
I use the prawn gem to generate pdf documents in my Rails application. It has a drawback that it does not have built-in support for displaying bulleted text. So I wrote a simple function that took a string parameter and printed it with an indent and a leading asterisk.
<a name='more'></a>
<pre class="brush:rails">
def bullet_item string
indent 15, 0 do
text "* " + string, :align => :justify
end
end
</pre>
So you get output like:
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi42Eu67_8YRDFwXDlbprMDr5GDe2YZCAT3IljIlybEEBfpPUBvY_-b6wYHqggUXVLJ9fdw7GZQGB99n-CohGlQDLIPIJ9tLqqpefeFpZplZagN9Q4dkPdFh2uYOSLRxAsy-eBYksU7eYC9/s1600/prawn-bullet-list-output-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi42Eu67_8YRDFwXDlbprMDr5GDe2YZCAT3IljIlybEEBfpPUBvY_-b6wYHqggUXVLJ9fdw7GZQGB99n-CohGlQDLIPIJ9tLqqpefeFpZplZagN9Q4dkPdFh2uYOSLRxAsy-eBYksU7eYC9/s320/prawn-bullet-list-output-1.png" width="320" height="88" /></a></div>
<br>
But this solution had an issue if the sentences are long. The second line starts at same indent as the first line, that is, it gets aligned to the star. Users are familiar with Office documents in which the first line and second line of bulleted text start at the same indentation.<br><br>
See the following output:<br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw7SzIihn3GkJ5Cdh-pwZR_q-cr97lqihGFr93QHYAr-IkVI9DSqK098o2SrBxe3Lm3JHTj_DdmfUs997jEwIdXOGQ5w14khXqKuZh7Um1CrtLpnbtVUDbr2jOZ8XgtDHO2SrKZEAIv9Gl/s1600/prawn-bullet-list-output-1a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw7SzIihn3GkJ5Cdh-pwZR_q-cr97lqihGFr93QHYAr-IkVI9DSqK098o2SrBxe3Lm3JHTj_DdmfUs997jEwIdXOGQ5w14khXqKuZh7Um1CrtLpnbtVUDbr2jOZ8XgtDHO2SrKZEAIv9Gl/s320/prawn-bullet-list-output-1a.png" width="320" height="54" /></a></div>
<br>
To fix the problem, I split the string into two, as follows:<br>
<pre class="brush:rails">
def bullet_item_2 string
if string.length > 110
sub_str = string[85..string.length-1]
space_index = sub_str.index(' ')
str1 = string[0..85+space_index]
str2 = string[86+space_index..string.length-1]
indent 10, 0 do
text "* " + str1, :align => :justify
indent(9) {text str2, :align => :justify}
end
else
indent 10, 0 do
text "* " + string, :align => :justify
end
end
end
</pre>
In here, I split the string into two, if it is more than 110 characters long. I first get the index of the space character <i>after</i> the 85th character and use that position to split. I then print both the strings at the same indentation.<br><br>
The output looks like:
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifxkgvEfI9vFRMsXq4_86lFWH_x8nAQlcDulYNWf7AFR30xmY3kb_KuSOx1KOqQMD1RXrMNvr2afyanQm0rRRlatXZI9ustf6Fk7rIXV8oHMCk4qNSvxsFLxSuJ9088wuolbWDzVMHA-nk/s1600/prawn-bullet-list-output-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifxkgvEfI9vFRMsXq4_86lFWH_x8nAQlcDulYNWf7AFR30xmY3kb_KuSOx1KOqQMD1RXrMNvr2afyanQm0rRRlatXZI9ustf6Fk7rIXV8oHMCk4qNSvxsFLxSuJ9088wuolbWDzVMHA-nk/s400/prawn-bullet-list-output-2.png" width="400" height="59" /></a></div>
<br>
But the problem did not go away. I was told that some of the sentences could be really long, perhaps would span three or four lines. Here is such text, taken <a href="https://en.wikipedia.org/wiki/Welding_Procedure_Specification"><u>from Wikipedia</u></a>, that I will use to illustrate:
<blockquote><i>
A Welding Procedure Specification (WPS) is the formal written document describing welding procedures, which provides direction to the welder or welding operators for making sound and quality production welds as per the code requirements . The purpose of the document is to guide welders to the accepted procedures so that repeatable and trusted welding techniques are used. A WPS is developed for each material alloy and for each welding type used. Specific codes and/or engineering societies are often the driving force behind the development of a company's WPS. A WPS is supported by a Procedure Qualification Record (PQR or WPQR). A PQR is a record of a test weld performed and tested (more rigorously) to ensure that the procedure will produce a good weld. Individual welders are certified with a qualification test documented in a Welder Qualification Test Record (WQTR) that shows they have the understanding and demonstrated ability to work within the specified WPS.
</i></blockquote>
Back to the keyboard again I went, and came up with another solution, as given below:
<pre class="brush:rails">
def extractFirstPart(str)
return str if str.length < 110
substr = str[85..str.length-1]
space_index = substr.index(' ')
if space_index != nil
return str[0..85+space_index]
else
return str
end
end
def bullet_item_3 string
counter = 1
myStr = string.clone
while myStr.length > 0 do
str = extractFirstPart myStr
if counter == 1
indent 10, 0 do
text "* " + str, :align => :justify
end
else
indent(19) {text str, :align => :justify}
end
myStr.slice! str
counter += 1
end
end
</pre>
This time, I extracted sub-strings in a loop and printed them with indentation. The problem of any length string was solved, but not the text-alignment issue. This latest solution made the problem even worse, as lines were cut at the right end at different positions.<br><br>
This is how it looked like:<br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3Vn4wtkVYzE-A9GArvRUxpjq9RVGSqpF15Oz25PRWzoBYwi4JIff-FXtiYNug2TPoQycL4WNm-6NmY7EyKYSMN1cs1OUBKvyY50HvsOPGjc4Kk_Oc0Jdwj8B5kwfPxF2Y6KU6uv7C22E_/s1600/prawn-bullet-list-output-3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3Vn4wtkVYzE-A9GArvRUxpjq9RVGSqpF15Oz25PRWzoBYwi4JIff-FXtiYNug2TPoQycL4WNm-6NmY7EyKYSMN1cs1OUBKvyY50HvsOPGjc4Kk_Oc0Jdwj8B5kwfPxF2Y6KU6uv7C22E_/s320/prawn-bullet-list-output-3.png" width="320" height="123" /></a></div>
Finally, I realized that an aligned and justified bulleted text is nothing but a table without borders. We can have the asterisk in the first column and the text in the second column. Since the prawn table functions render text properly in the cells, this might work.<br>
<pre class="brush:rails">
def bullet_text_with_borderless_table data
bullet_data = []
data.each {|d| bullet_data << ["*", d]}
t = make_table bullet_data, {:cell_style => { :borders => [], :align => :justify, :padding => [0,10,0,0]}, header: true}
indent(20) {t.draw}
end
</pre>
And it worked..! Sometimes in programming life, dirty hacks are required to get clean output. Here is how my text gets displayed now:
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF22dxYqicxvKQwqnDkErS9mY6A-IACQBNifrBXK-MQsenXu3fgzG5mXKhcgRTkc1K24PbOkJuaMAfB8m-W5s9r-hs0taTAHHgRXIaB2OnxP40Nay_TF8UNQjWkk96QHsH4Res8Pgyv3g9/s1600/prawn-bullet-list-output-final.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF22dxYqicxvKQwqnDkErS9mY6A-IACQBNifrBXK-MQsenXu3fgzG5mXKhcgRTkc1K24PbOkJuaMAfB8m-W5s9r-hs0taTAHHgRXIaB2OnxP40Nay_TF8UNQjWkk96QHsH4Res8Pgyv3g9/s320/prawn-bullet-list-output-final.png" width="320" height="122" /></a></div>
Here is --> <a href="https://gist.github.com/mh-github/8736c86d28745332842540f6e89b1471"><u>the file</u></a> that has all three solutions. The output pdf is --> <a href="https://drive.google.com/open?id=0Bzt3t2QhYFDgVVFTNE1mMERmc00" target="_blank;"><u>here</u></a>.
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com1tag:blogger.com,1999:blog-2508711278752078434.post-61986192894401721622017-03-03T13:22:00.001+05:302017-03-17T16:27:39.256+05:30Applied Rails : Customizable Text<div dir="ltr" style="font-size: 18px;text-align: justify;" trbidi="on">
I got a requirement in my Rails application in which the user would add a set of "Terms & Conditions" in the Offer screen. These are typically standard, but the user should be able to customize the individual clauses. It sounded oxymoronic, but remembering Scott Meyers' words, "pretty this ain’t, but sometimes a programmer’s just gotta do what a programmer’s gotta do," I set out in right earnest to figure out what can be done.<br><br>
<a name='more'></a>
From the business analyst, I got the typical standard clauses. To illustrate, here is an example -- "Offer shall be valid for 45 days". My first response was that I should identify the parts that vary and take them as input data from the user.<br><br>
In many cases, the thing that varies was a number. Taking the data in the HTML form for these variables and displaying as inserts in constant text made sense. For the example I quoted above, I would take an input field of type number with name "validity" and insert as follows:<br>
<span style="background-color:#b0e0e6;display:table;margin:0 auto;">Offer shall be valid for <font style="color:red;"><%= @offer.validity %></font> days.</span>
<br>
There were only a few clauses initially. But then, their number started increasing. Also, they were being specified with more variable parts than just one and sometimes with non-numeric parts too.<br><br>
Further, in one meeting I was told that user may enter a totally new clause that is not part of the standard set. There was no question of identifying the part of the sentence that varies. The sentence itself would be new.<br><br>
I considered different ways of providing the feature, but they all seemed overkill. Finally, I narrowed down to a text box. I gave a set of standard clauses above the box with a note that users should copy - paste the clauses in to the text box.<br><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvir2ckn48iMlkzOvtit_2WYLv0UbNimQUx7a8G6x9ST6wyOpyKCiiyQFiP_2BSQLh18Ar006rrceK-Y0rZUQj7W5uS90bbJdxH_TwZ6DPvVnaDe-EtvcKsu9zyz0OlJrz0UQBfk55HXPh/s1600/customizable-text-screenshot.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvir2ckn48iMlkzOvtit_2WYLv0UbNimQUx7a8G6x9ST6wyOpyKCiiyQFiP_2BSQLh18Ar006rrceK-Y0rZUQj7W5uS90bbJdxH_TwZ6DPvVnaDe-EtvcKsu9zyz0OlJrz0UQBfk55HXPh/s640/customizable-text-screenshot.png" width="640" height="301" /></a></div>
<br>
This would not only allow them to change the variable parts, but also add new sentences. The text in the text box was saved in MySQL database in a column of type "text". In order to display the clauses separately, I just had to split on newline and print.<br><br>
<script src="https://gist.github.com/mh-github/f4aa596ffab0e7686c2d66fba43c8e6b.js"></script>
The business analyst accepted this solution. Problem solved. With a simple text box.<br><br>
<hr>
Ref<br>
[1] : Effective C++
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com0tag:blogger.com,1999:blog-2508711278752078434.post-80360409158128635042017-02-15T22:29:00.000+05:302017-03-03T13:23:16.724+05:30Applied Rails : Variable Rows For Child Records<div dir="ltr" style="text-align: justify;" trbidi="on">
<span style="color: #351c75; font-family: Helvetica; font-size: 17px;">
I got a requirement in my Rails application to give the user the ability to input a variable number of records with multiple fields. The fields were of text type as well as select comboboxes. These rows had to be saved to the database as child table rows.<br><br>
<a name='more'></a>
As is my inclination, I sought out to code it in raw HTML / JavaScript. Of course, I did google for readily available solutions, found some but ruled them out for different reasons. First step was to write a HTML file to achieve the desired functionality.<br><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZklwSRfoJpVwzoMfLAz7w6dWSERt5dW-Hl_l7SMM_NfBwhnC_ksRaE3v5aSWXFcrIyUpDYy0qEtIkeu8PhNMaJa3uFVnKVRzmR8BZICshu6XT1h7onsPA9OjsLBfKndvkP8eDuGUnPWxT/s1600/rails-dynamic-rows.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZklwSRfoJpVwzoMfLAz7w6dWSERt5dW-Hl_l7SMM_NfBwhnC_ksRaE3v5aSWXFcrIyUpDYy0qEtIkeu8PhNMaJa3uFVnKVRzmR8BZICshu6XT1h7onsPA9OjsLBfKndvkP8eDuGUnPWxT/s320/rails-dynamic-rows.jpg" width="400" height="400" /></a></div>
<br>
The first column in the table has a check box, the second column displays the row number and the remaining columns have other attributes. Below the table there are two buttons, one to add a row and another to delete a checked row. Each invokes a JavaScript function when clicked.<br><br>
The function to add a row, addScreenRow takes the table id as an argument. It takes the current row count of the table and increments by one to display for the new record. It inserts a new row with a call to insertRow and add child elements to the cells.<br><br>
Similarly, the function to delete a row, deleteScreenRow takes a table id as argument. First it gets the current row count of the table. It then loops through the rows, and if the checkbox is checked, it calls deleteRow on that row.<br><br>
The following html file illustrates the code and usage of these JavaScript functions.
<script src="https://gist.github.com/mh-github/07ec7817f71c42e074774d654f39dccd.js"></script>
We now tackle the latter part of the requirement. Our dynamic rows need to have comboboxes, which as given in <a href="https://en.wikipedia.org/wiki/Combo_box"><u>Wikipedia</u></a> are "a combination of a drop-down list or list box and a single-line editable textbox, allowing the user to either type a value directly or select a value from the list." To go with the spirit of my approach, I did not use library widgets.<br><br>
I found a very nice solution on stackoverflow.com question <a href="
http://stackoverflow.com/questions/264640/how-can-i-create-an-editable-dropdownlist-in-html"><u>264640</u></a>, in the answer given by Max. It is simplicity exemplified, where we get the combobox feature with a few lines of CSS and one line of JavaScript. The code is also available on <a href="http://jsfiddle.net/qymer2Lp/2/fiddle"><u>fiddle</u></a>.<br><br>
Plugging this into my HTML was quite easy. In the JavaScript, instead of just a text element, we need to add a div with a text element as well as a select element into the cell. That's it.
<script src="https://gist.github.com/mh-github/71b287522b2aaf62eb638bebf0b77886.js"></script>
Now on to the main task of providing this feature in a Rails app. Let's consider an order entry screen. Our models are <b>Order</b> and <b>LineItem</b>.<br><br>
An Order has many LineItems and a LineItem has item, quantity and gift wrap type as attributes. User enters item as text, quantity as a number and for the gift wrap type, can either select one of the dropdown values provided or enter a string as its value. The one to many relationship between Order and LineItem is expressed with has_many and belongs_to keywords in the model classes and with the foreign key in the database table.<br><br>
Code for achieving this is straightforward Rails:<br>
<i>order.rb</i>
<pre class="brush:rails">
class Order < ActiveRecord::Base
has_many :line_items
accepts_nested_attributes_for :line_items, allow_destroy: true
end
</pre>
<i>line_item.rb</i>
<pre class="brush:rails">
class LineItem < ActiveRecord::Base
belongs_to :order
end
</pre>
<i>migration file</i>
<pre class="brush:rails">
def change
add_reference :line_items, :order, index: true
add_foreign_key :line_items, :orders
end
</pre>
We make one key change from the basic HTML form that we saw above. The variables for each field have to be given the name of the database column. Rails will take care of doing the insert.<br><br>
The child records are nested attributes in the view, and are sent as hashes inside arrays of hashes. So the naming has to be done as shown below, inside backticks for JavaScript to evaluate the global row count variable
<pre class="brush:xml" style="background-color:#b0e0e6;">
element4.name = `order[line_items_attributes][${globalLineItemsRowCount-1}][quantity]`;
</pre>
For the update operation, we will go with a different form, _edit_form. We render it as a partial in the edit view file. This form is same as _form with a couple of changes.<br><br>
We use a variable to display the row number in the second column of the html table. We initialize its value to 1 and increment for each row. In the JavaScript part, we initialize the global row count to one more than the number of child records.<br>
<pre class="brush:rails">
var globalLineItemsRowCount = <%= @order.line_items.length+1 %>;
<% counter = 1 %>
<%= f.fields_for :line_items do |l| %>
<tr>
<td><input type="checkbox" name="chk"/></td>
<td> <%= counter %> </td>
<% counter += 1 %>
.............
</pre>
The next thing to take care of is the delete operations for the child rows. This occurs when the user deletes the rows from the edit screen. We do something extra for this in the update action.<br><br>
For deleted rows, the form parameters for the child rows will have only one member which is the id of the child record. So we check if a particular attribute parameter is of size one and has a 'id' value. If yes, we delete the child record by calling destroy.
<pre class="brush:rails">
if order_params[:line_items_attributes] != nil
order_params[:line_items_attributes].each do |la|
if la[1].length == 1 && la[1]['id'] != nil
@order.line_items.destroy(la[1]['id'])
end
end
end
</pre>
I have made a small project and put it on github. It's called mahrasa, short for Mahboob Rails Sample. Check out the code from <a href="https://github.com/mh-github/mahrasa"><u>https://github.com/mh-github/mahrasa</u></a>, to see more details that I could not accommodate in this article, play with it and let me know your feedback.
</span>
</div>mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com1tag:blogger.com,1999:blog-2508711278752078434.post-71095106450446384382017-01-11T18:26:00.000+05:302017-03-01T17:16:35.127+05:30Welcome 2017<div dir="ltr" style="text-align: justify;" trbidi="on">
<span style="color: #351c75; font-family: Helvetica; font-size: 17px;">
First blog post at the beginning of the year, as was last year's, is a quantified compilation of my personal activities outside of my day job.<br><br>
<a name='more'></a>
My digital presence stats at the beginning of 2016 were:
<div style="width: 700px; color: navy; background-color: lavender; border: 2px solid blue; padding: 5px;">
<pre>
Twitter -- 2695 tweets, following 16, followers 65
Facebook -- 936 friends, member of 40 groups
Blogger -- 129 posts
Github -- 3 repositories;
raygate = 560 KB, ruwi = 228 KB, gtdm-r = 35.46MB
total = 36.25 MB
Short Films -- Ray Mahruwi Productions = 11.
</pre>
</div>
<br>
As of beginning 2017 they are:
<div style="width: 700px; color: navy; background-color: pink; border: 2px solid blue; padding: 5px;">
<pre>
Twitter -- 2890 tweets, following 9, followers 76
Facebook -- 1285 friends, member of 57 groups
Blogger -- 135 posts
Github -- same as last year
Short Films -- Ray Mahruwi Productions = 13
</pre>
</div>
<br>
So I did a mere 195 tweets in the year, not even averaging one per day. I did a measly 6 blog posts, not even averaging one per month. Similarly I did not touch or add to my existing github repositories.<br><br>
Next activity of my interest is short films. Here are the views for 2015 and 2016:
<table style="border:1px solid black;">
<th style="border:1px solid black; background-color:#BDB76B; color:white;">Name</th>
<th style="border:1px solid black; background-color:#BDB76B; color:white;">Jan 2016</th>
<th style="border:1px solid black; background-color:#BDB76B; color:white;">Jan 2017</th>
<tr>
<td style="border:1px solid red;">Gamanam<br>(a film by Sudeep Kumar TG)</td>
<td style="border:1px solid red;"></td>
<td style="border:1px solid red;">3972</td>
</tr>
<tr>
<td style="border:1px solid red;">Anoohyam</td>
<td style="border:1px solid red;"></td>
<td style="border:1px solid red;">4413</td>
</tr>
<tr>
<td style="border:1px solid red;">Nannu Kshaminchu Mahatmaa</td>
<td style="border:1px solid red;">2747</td>
<td style="border:1px solid red;">4985</td>
</tr>
<tr>
<td style="border:1px solid red;">Malupu<br>(a film by Prabhakar Ellu)</td>
<td style="border:1px solid red;">5387</td>
<td style="border:1px solid red;">7335</td>
</tr><tr>
<td style="border:1px solid red;">Nava Bethalam</td>
<td style="border:1px solid red;">1874</td>
<td style="border:1px solid red;">2138</td>
</tr><tr>
<td style="border:1px solid red;">Manasa Ne Cheppe Maata Vinamma</td>
<td style="border:1px solid red;">26722</td>
<td style="border:1px solid red;">27823</td>
</tr><tr>
<td style="border:1px solid red;">The Upliftment</td>
<td style="border:1px solid red;">5378</td>
<td style="border:1px solid red;">13282</td>
</tr><tr>
<td style="border:1px solid red;">Ahana Kalyanam<br>(a film by Krishna Chaitanya Joshi)</td>
<td style="border:1px solid red;">51747</td>
<td style="border:1px solid red;">56767</td>
</tr><tr>
<td style="border:1px solid red;">Katha-Screenplay-Darsakathvam - MH (Appalraju Kadu)</td>
<td style="border:1px solid red;">573</td>
<td style="border:1px solid red;">631</td>
</tr><tr>
<td style="border:1px solid red;">Glamour</td>
<td style="border:1px solid red;">2027</td>
<td style="border:1px solid red;">2377</td>
</tr><tr>
<td style="border:1px solid red;">Aatmabhimanam - Idi andariki artham kaaka povachchu</td>
<td style="border:1px solid red;">210</td>
<td style="border:1px solid red;">215</td>
</tr><tr>
<td style="border:1px solid red;">Nirvana</td>
<td style="border:1px solid red;">1638</td>
<td style="border:1px solid red;">1747</td>
</tr><tr>
<td style="border:1px solid red;">Parody Video</td>
<td style="border:1px solid red;">2389</td>
<td style="border:1px solid red;">2455</td>
</tr>
<tr>
<td style="text-align:right; border:1px solid red;">Total</td>
<td style="border:1px solid red;">100692</td>
<td style="border:1px solid red;">128140</td>
</tr>
</table>
<br>
I made two shorts last year, Anoohyam and Gamanam (a film by Sudeep Kumar). A total of 27,448 views were added this year. In terms of views, the top three are : 1) Ahana Kalyanam 2) Manasaa Ne Chepee Maata Vinamma and 3) The Upliftment. In fact, in 2016, The Upliftment garnered the highest number of views, 7904. A pleasant surprise that! Gamanam was a bit of disappointment as we expected it to get a lot more views. We are discussing internally what we can do now to rectify the situation.<br><br>
Overall, the total count of 128140 is not a great number, but I take some satisfaction in the fact that these were obtained though I am not a full time film maker and I allocate only a small part of my time in the whole year to short films.<br><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJ94uaWkJ5gkNmw4VKTY5xqQD-dcUHxCR5L-QWDRaDaRr28iimrVT4K3pPeNlYZg1VBgmuK8iJ0_D-K4CLHIsKzg6o-E2ieAjS7meGNr08bCjuE1mCFx81RKKAiPHs4wvCSd24ygzN5BAA/s1600/2017-first-blog-post-img1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJ94uaWkJ5gkNmw4VKTY5xqQD-dcUHxCR5L-QWDRaDaRr28iimrVT4K3pPeNlYZg1VBgmuK8iJ0_D-K4CLHIsKzg6o-E2ieAjS7meGNr08bCjuE1mCFx81RKKAiPHs4wvCSd24ygzN5BAA/s320/2017-first-blog-post-img1.jpg" width="480" height="360" /></a></div>
<br>
On to books. From last year's reading list, I could do only David and Goliath, and Blink and The God of Small Things (re-reads). Of course there were books that were not in my reading list, but I happened to read them. They are: <i>Execution : The Discipline Of Getting Things Done</i>, <i>Everyone Has A Story</i>, <i>How To Read A Book</i>, <i>Defending The Undefendable</i> and<i> Economics In One Lesson</i>.<br><br>
From last year's unread books, I have droppped India Shastra by Shashi Tharoor, and have the following list for this year:
<ul>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">The Rise Of The Robots by Martin Ford</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">The Love That Feels Right by Ravinder Singh</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">Raising the Floor: How A Universal Basic Income Can Renew Our Economy and Rebuild The American Dream by Andy Stern & Lee Kravitz</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">A Fine Balance by Rohinton Mistry. (This one’s been pending for long).</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">Structure And Interpretation Of Computer Programs by Harold Abelson, Gerald Jay Sussman, Julie Sussman</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">The Mind’s I : Fantasies And Reflections On Self And Soul by Daniel C. Dennett and Douglas R. Hofstadter</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">I Am a Strange Loop : 0 by Douglas R. Hofstadter</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">I’m OK -- You’re OK by Thomas Harris. (re-read)</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">The Argumentative Indian by Amartya Sen</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">Autobiography Of A Mad Nation by Sriram Karri</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">From The Ruins Of Empire: The Revolt Against The West And The Remaking Of Asia by Pankaj Mishra</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">The Heart Goes Last by Margaret Atwood</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">The Silk Worm by Robert Galbraith</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">Indianomix by Vivek Dehejia and Rupa Subramanya</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">Think And Grow Rich by Napoleon Hill</li>
</ul>
I had read through a few pages of <i>Structure And Interpretation</i> as well as <i>The Mind's I</i>, but will get through them properly this time. Another point is that I have not included the Telugu books or programming / management books that I'd be reading. I am sure there will be more than a couple of them.<br><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj27wtaDF63HZ-Gu71-zo69PiG-6BsDhBWuwuVer0nPJ-0S3Q-6ePf6nIHZ_UFv9BXrjET6FAG9D_VzuR9gTROC0gYy_s44w7IGMrBy8IpreDOba0-DOGDp6xCazuo5liOe0SYzPr8h3-0E/s1600/2017-first-blog-post-img2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj27wtaDF63HZ-Gu71-zo69PiG-6BsDhBWuwuVer0nPJ-0S3Q-6ePf6nIHZ_UFv9BXrjET6FAG9D_VzuR9gTROC0gYy_s44w7IGMrBy8IpreDOba0-DOGDp6xCazuo5liOe0SYzPr8h3-0E/s320/2017-first-blog-post-img2.jpg" width="480" height="360" /></a></div>
<br>
There were two points of cheer during last year. One is the VRCE (now VNIT) silver jubilee reunion and the other is the meetup group Hyderabad Software Architects. I had devoted some amount of time for these events through the year. My facebook updates on them, here --> <a href="https://goo.gl/ENTBZL">https://goo.gl/ENTBZL</a> and here --> <a href="https://goo.gl/hwZNq2">https://goo.gl/hwZNq2</a>, give some elaboration. In addition, for the purpose of analysing and bringing home the various positive aspects of international cinema, Cinephile FILM Club was started.<br><br>
So, what's with going forward? I should do better in 2017 on all the above counts. That is, a minimum of 365 tweets, 12 blog posts, and two short films. There will be some output in fiction, but I wouldn't quantify it now. Regarding the reading list, all fifteen books should be very much doable.<br><br>
In closing, as I said on Facebook, a <a href="https://www.facebook.com/mahboob.hussain.33/posts/1478067435544512">happy Dangal new year*</a> to all of you.<br><br>
* https://www.facebook.com/mahboob.hussain.33/posts/1478067435544512
<hr/>
Pics courtesy :<br>
Stock Photos (<a href="https://stockphotos.io/">https://stockphotos.io/</a>) <br>
Death to Stock (<a href="https://www.instagram.com/deathtostock/">https://www.instagram.com/deathtostock/</a>)
</span>
</div>mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com0tag:blogger.com,1999:blog-2508711278752078434.post-40332185665203722142016-11-06T23:49:00.000+05:302017-01-11T18:26:52.365+05:30Book Review : Everyone Has A Story<div dir="ltr" style="text-align: justify;" trbidi="on">
<span style="color: #351c75; font-family: Helvetica; font-size: 17px;">
The novel 'Everyone Has a Story' by Savi Sharma is structured on the classic three acts of a romantic story: lady meets man, man goes away from lady and lady gets man back. Lady's goal is to become a writer.<br>
It was a breezy read for me and appealed to me as a record of the good-heartedness in people.<br><br>
<a name='more'></a>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG98DdSVtlJHcS3_uPcJCNFVnRuyiEiVsRXJNcbxuFKWfxYyuMB_lKnd5O2nUd2pCq8J4pId18LQI64KPofa27QQ1v5kEE3djuJ0nk73w88e5FeQnNohpku7TvW-Bra8sCWLZNdDy6JZxc/s1600/ehas.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG98DdSVtlJHcS3_uPcJCNFVnRuyiEiVsRXJNcbxuFKWfxYyuMB_lKnd5O2nUd2pCq8J4pId18LQI64KPofa27QQ1v5kEE3djuJ0nk73w88e5FeQnNohpku7TvW-Bra8sCWLZNdDy6JZxc/s320/ehas.png" width="248" height="320" /></a></div>
<b>The Good Parts</b><br>
I don't read romantic genre novels or chick lit. I picked EHAS because of the title, which has been a favorite phrase of mine for years now. Whenever I go out walking, or stop in my car at the signal, I take a look around, notice the people and think what events they have had that day, what experiences they could have gone through, and what are they looking forward to on that day. Just letting the imagination loose on such thoughts gives such a heady feeling. I would think, so many people, so many perturbations and if some one were documenting all that stuff, what a pile of writing we would have because every one has a story.<br><br>
Imagine my pleasant surprise when I read in the newspapers that a young author has written a novel with my favorite phrase as the title. Sometimes it so happens that people don't read books. The books get themselves read. Thus this book made it to my reading list.<br><br>
I have met young aspiring writers; quite often I happened to notice how loud-mouthed they are, trying to show off their cleverness and cuss words. That pompousness shows in their writing too. They tend to 'show-off' more than perform story telling in their work. You don't see such feigned ostentatiousness in Savi's writing and by implication I would conclude she is a simple demeanored person. Just as the bio on her <a href="http://savisharma.com/"><u>website</u></a> claims.<br><br>
The elements of story telling in EHAS are kept simple. Take the characterization for example. There isn't much detail on the character sketching. Absolutely zero scenes on the lead characters' professional life. Nor are there events pertaining to their families, save a call from an aunty of Vivaan. The city, Pune itself is kept very light in description. This is fine from the standpoint that it keeps the focus on the main flow of the story. On the flip side, it makes the characterization a bit shallow in that you never get to know enough of their backgrounds and their motivations.<br><br>
The font and the print quality are good. I liked the fact that the author and publisher paid attention to them as, these days I see many books in which these aspects are not upto the mark. As a not-so-young person, I didn't have to strain my eyes and facial muscles.<br><br>
This is not a work of literary fiction; in fact on the cover it says inspirational romance, whatever that means. Though I was not expecting some <a href="http://mh-journal.blogspot.in/2015/05/mesmerizing-words.html"><u>mesmerising</u></a> lines, and indeed there aren't any, I still found a couple of passages that are endearing :<br>
<blockquote>1.<br>
'Do you know the worst thing a man can do to a woman?'<br>
I shrugged. 'I am assuming it is being unfaithful.'<br>
'No, it is making her fall in love with you when you have no intention of loving her back.'<br><br>
2.<br>
'I want to meet people who are different from me, but people with whom I can still be the same. I want to see things with new eyes and listen with new years. I don't want to come home whole; instead I want to leave a piece of me in each place I have been. And thus, it would be an even exchange, as I take a piece of each place I visit.'<br><br>
</blockquote>
<b>Weaknesses</b><br>
There were three parts in EHAS that I felt were weak. Meaning they should be been more more relatable. Meaning they should have been more touching. Meaning they did not appeal to me.
<br><br>
<u>Why only this guy?</u><br>
The first unappealing part was the reason why Meera wanted to write Vivaan's story. Why this guy and why his story only? In her job she interacts "with different people from different places, each one having their own different stories" [pg 5]. She visits the cafe 'Coffee & Us' every weekend "listening to amazing authors." She even says, "My heart was aching to tell a beautiful story which would change people's lives." Reading these sentences, you would think that there would have been so many occasions to write about those different type of people, their different stories, there ambitions and fears, motivations and dreams. But she doesn't.<br><br>
She decides to write the story of a guy who comes to the book launch of an author named Arjun Mehra. The guy is Vivaan, an assistant branch manager at Citibank. Now she feels like writing his story. Why?<br><br>
Because he wants to travel. As Vivaan says, "I have money, status and success but I am still not sure what my purpose really is. I do know that there are days I want to escape the life I am living and grab my bags and just travel," [pg 10].<br><br>
When asked what he thinks he will find when he travels, he says, "There will be no one who will follow me around, demanding things from me. There will be no one pressurizing me to meet deadlines. Money comes with a price, and for me, the price is freedom and a real life. I hope someday I can make up mind to chase my dreams." This answer deeply impresses, inspires and intrigues Meera, and wants to learn more about him. Good for you Meera, but what about me, the reader?<br><br>
First of all, Vivaan comes off as an immature person who doesn't know his purpose in life. Secondly, the reason that he wants to escape from his day job and get away from it all is that there would be no work pressure and deadlines. Well, well, this is such a commonplace urban professional talk, that it barely comes off as impressive, inspiring or intriguing. Anyways, first pieces of work tend to have autobiographical elements, and I presume that what gets Savi interested is what is shown as for Meera. No problems. This is her first work. As authors write more, their characters would be more well-rounded and would be written keeping the readers in mind.<br><br>
<u>Old man in Paris</u><br>
The second unappealing part was the conversation with an old man in Paris. Vivaan is sitting on a bench in a park and eating, when an old man in a business suit starts a conversation. I have been to a host of different countries but old men in business suits never came out of the blue and inquired why I am in that country. When Vivaan does not reply, the old man persists to ask why he was in beautiful Paris. If I were in that situation, I would have got worried and called my friends or the police.<br><br>
In my experience, conversation ice-breakers between men happen differently. Of course strangers have talked to me. But, going into the love life and then lecturing on that subject! Difficult to happen. Politics, yes. Cars, oh sure 100% chances. But love? Not sure. And this....?
<blockquote>"Love is the strangest thing. When you have love, you will be over the moon and it will seem as if nothing can stop you. Love is something that opens your eyes to new discoveries, even in old places. You want to discover the wonders of the world all over again with the person who holds your heart in their own. When you lose it, all that once seemed to make the world around you will shatter." [pg 104]</blockquote>
Uh-ho, not going to happen in real life. Difficult for me to fathom such a conversation. I grit my teeth, suspended my disbeliefs and somehow got through that chapter.<br><br>
<u>Too sudden</u><br>
The third unappealing part was the way Vivaan decides to come back to Meera. What exactly makes him change his mind? Guy is separated from lady. He is travelling and thinking a lot about her. Absence makes the heart grow fonder. That we know, but is that all and a strong enough reason? He keeps thinking about her and realizes that he needed Meera in his life. Suddenly he realizes he doesn't care about travelling. No particular reason or heart-touching incident is shown. A weak turning point, I should say.<br><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdMdS8dEHj56FMKJ3RgrtiAdtgXA8GRsGXj2anGNxCoQR7Eh2gINGGyj75iCTpsUin-U10sS73Vi18Da9iXNDwEzbAK5GE0eyZZ4B8gf31i2Znn4Flde7GW_u1gHhnHC8PHU2xT3leYOyH/s1600/DeathtoStock_Creative+Community6.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdMdS8dEHj56FMKJ3RgrtiAdtgXA8GRsGXj2anGNxCoQR7Eh2gINGGyj75iCTpsUin-U10sS73Vi18Da9iXNDwEzbAK5GE0eyZZ4B8gf31i2Znn4Flde7GW_u1gHhnHC8PHU2xT3leYOyH/s320/DeathtoStock_Creative+Community6.jpg" width="320" height="213" /></a></div>
<u>A teary eyed woman.</u><br>
Somewhere along my reading, I realized that Meera constantly bursts into tears. It was a bit amusing to guess how long it would be before the tears flow again, and boy she doesn't delay. Look at the following lines:
<ul>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">I wanted to cry. [pg 31]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">My eyes started to fill with tears. [pg 44]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">... my eyes were filled with tears, [pg 51]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">I wiped my tears. [pg 57]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">I wanted to cry once again. [pg 59]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">Tears of happiness welled up in my eyes, [pg 63]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">'Thank you so much for such thoughtful gifts!' I said as tears of happiness formed in my eyes. [pg 65]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">'Come on Meera, don't cry,' Kabir said as he noticed my eyes begin to fill up, [pg 83]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">Many times I would read what I had written and cry. [pg 86]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">Tears began to form again... [pg 89]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">I conjured an image of my beloved Meera. She was sitting in her dark room, tears flowing hotly down her cheeks. [pg 107]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">She cried every single day after you left, Vivaan. [pg 127]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">Meera burst into tears and started leaving. [pg 131]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">I could see Meera break down, but I had to continue. [pg 134]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">Meera was now crying as hard as I was. [pg 136]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">Tears streaming down my face, I ran to my car. [pg 141]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">My tears started to flow again as the rain fell harder. [pg 142]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">There was my Meera, with tears in her eyes [pg 170]</li>
<li style="color: #351c75; font-family: Helvetica; font-size: 17px;">My eyes filled with happy tears. [pg 174]</li>
</ul>
<u>Nitpicking</u><br>
A few sentences should have been written better. They are:<br><br>
I watched the man walk away through the dusty window. [pg 16]<br>
My friend absently cleaned the counter between us. [pg 16]<br>
My voice was low, quiet. [pg 129]<br>
She looked up, stunned, and she wiped her tears. [pg 51]<br>
I got out of bed and dressed, actually looking forward to the day in front of me. I took a quick shower, truly looking at myself in the mirror... [pg 121]<br><br>
<u>A quaint old guy</u><br>
There is this old author Mr. Arjun Mehra, in whose book launch Meera sees Vivaan for the first time. This Mr. Mehra tells Meera: 'What's your story, young girl?' Addressing a 26-year old woman as a young girl is an irritating Indianism that I abhor people using. Then Mr. Mehra addresses Vivaan, who is the same age as Meera: 'Sir, what do you do for work? What's your story?' The lady is a young girl and the man is a 'Sir'. Damn. And oh yeah Mr. Mehra, women in Pune don't work?<br><br>
Later Mr. Mehra sends a letter to Meera in which he writes: "Remember that a great writer doesn't just put his heart into his book but his reader's too" [pg 64]. Damn damn. Women don't write books?<br><br>
My thought about him was: 'Sexist bastard, how come he is in this novel?' He maybe an aged person from different times, but if I were the author, I wouldn't let such people in my writing.<br><br>
<b>Finally</b><br>
To conclude, I should add that the three unappealing scenes or things I nitpicked on, in any way do not reduce my liking of the book. I can say that Savi Sharma is a promising author from whom we can expect lots of good work in the future.
</span>
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com1tag:blogger.com,1999:blog-2508711278752078434.post-10158629778785852582016-10-21T23:48:00.003+05:302016-11-07T18:02:25.093+05:30Steps And Commands For RoR Application Deployment On Linode Server<div dir="ltr" style="text-align: justify;" trbidi="on">
<span style="color: #351c75; font-family: Helvetica; font-size: 17px;">
I deployed my Ruby-on-Rails application on a cloud server.<br>
<br>
About a couple of years ago, I got into this practice of hosting my applications on the cloud. At that time AWS did not offer Ubuntu machines. I love Ubuntu so I did not go to AWS. I also have this feeling that access and deployment procedures on the biggies (AWS and Azure) are slightly more cumbersome than the not-so-biggies. Amongst these, Site5 is the cheapest but I don't get root access and was very disappointed with their lack of support. For $20 a month, I got a 4 GB RAM server on Linode compared to 2 GB RAM on Digital Ocean. Hence I went with Linode.<br>
<a name='more'></a>
<br>
I am the lone fella who designed and coded my application. Hence I have not yet started using a git server, either on-premise or cloud. Since my MacBook has Time Machine enabled on to my external hard disk, I get some sort of primitive version control. So my deployment procedure is to simply ftp my code to the server and restart the process. In this post I am sharing the steps and commands I followed.<br>
<br>
Of course, as the application and team size grow, a better methodology would be to put the code on git branch, merge into master, either pull or push it to the cloud server, build and start the server. These steps can be automated with the help of tools like Capistrano.<br>
<br>
My tech stack is Ruby, Rails, RVM, MySQL, Nginx and Phusion Passenger. The two articles that give all details are:
<div style="border: 2px solid purple;">
<ol>
<li><a href="https://gorails.com/deploy/ubuntu/16.04">https://gorails.com/deploy/ubuntu/16.04</a></li>
<li><a href="http://geekhmer.github.io/blog/2016/07/13/setup-and-deploy-ruby-on-rails-on-ubuntu-16-dot-04-or-latest/">http://geekhmer.github.io/blog/2016/07/13/setup-and-deploy-ruby-on-rails-on-ubuntu-16-dot-04-or-latest/</a></li>
</ol>
</div>
<br>
I had to do a few things and note a few other useful commands in addition to those given in these two articles. So, here we go.<br>
<br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR2UIjtlkId1wMJbiRpmJsWgeR-YD0yaKd8OUK4SbZ51CN9Hv6mVJ-SzrudFrQHdCj1aIHMvFLAaWp6LEJXdFtfXetDyJEt8wS15sG3FXdaxijL_UMmIlvfW71aixYg5Dm-az57Jl4Kq6k/s1600/DeathtoStock_Wired7.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR2UIjtlkId1wMJbiRpmJsWgeR-YD0yaKd8OUK4SbZ51CN9Hv6mVJ-SzrudFrQHdCj1aIHMvFLAaWp6LEJXdFtfXetDyJEt8wS15sG3FXdaxijL_UMmIlvfW71aixYg5Dm-az57Jl4Kq6k/s320/DeathtoStock_Wired7.jpg" width="450" height="300" /></a></div>
<br>
Remote login and create a user with name deploy<br>
$ ssh root@my_ipaddress<br>
--> Enter root password<br>
<br>
Create user<br>
$ sudo adduser deploy<br>
password : my_password<br>
$ sudo adduser deploy sudo<br>
$ exit<br>
<br>
<u>MacBook: setup ssh keys</u><br>
$ ssh-keygen -t rsa<br>
--> Press enter key<br>
--> Enter passphrase<br>
--> Enter same passphrase again<br>
<br>
$ ssh-copy-id deploy@my_ipaddress<br>
passphrase<br>
<br>
$ ssh deploy@my_ipaddress<br>
Enter passphrase<br>
Check Remember password in my keychain<br>
<br>
$ sudo apt-get update<br>
$ sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev<br>
<br>
$ sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev<br>
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3<br>
$ curl -sSL https://get.rvm.io | bash -s stable<br>
$ source ~/.rvm/scripts/rvm<br>
$ rvm install 2.3.1<br>
$ rvm use 2.3.1 --default<br>
$ ruby -v<br>
$ gem install bundler<br>
<br>
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7<br>
$ sudo apt-get install -y apt-transport-https ca-certificates<br>
$ sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list'<br>
$ sudo apt-get update<br>
$ sudo apt-get install -y nginx-extras passenger<br>
<br>
$ sudo apt-get install mysql-server mysql-client libmysqlclient-dev<br>
username: root<br>
password: my_password<br>
<br>
$ sudo vi /etc/nginx/sites-enabled/default<br>
-->
<pre class="brush:ruby">
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name my_ipaddress;
passenger_enabled on;
rails_env production;
root /home/deploy/myapp/public;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
</pre>
$ sudo vi /etc/nginx/nginx.conf<br>
--><br>
##<br>
# Phusion Passenger config<br>
##<br>
# Uncomment it if you installed passenger or passenger-enterprise<br>
##<br>
include /etc/nginx/passenger.conf;<br>
<br>
$ sudo mkdir myapp<br>
$ cd myapp<br>
<br>
<u>MacBook</u><br>
Code in local folder should have mail configuration.<br>
$ vi config/environments/production.rb
<pre class="brush:ruby">
config.action_mailer.default_url_options = {host: 'localhost', port: 80}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:authentication => :plain,
:address => "smtp.mailgun.org",
:port => 587,
:domain => "mail.mydomain.com",
:user_name => "postmaster@mail.mydomain.com",
:password => "my_encrypted_password",
:enable_starttls_auto => true
}
</pre>
Launch FileZilla<br>
Host : sftp://my_ipaddress -- Username: deploy -- Password: my_password<br>
ftp all folders in local app folder (except tmp) to server: /home/deploy/myapp<br>
<br>
<u>Cloud Server</u><br>
$ sudo service mysql start<br>
$ mysqladmin -u root -pmy_password variables | grep socket<br>
$ vi config/database.yml<br>
--> socket: /var/run/mysqld/mysqld.sock (output from the previous mysqladmin command)<br>
$ bundle install<br>
$ rake db:create RAILS_ENV=production<br>
$ rake db:migrate RAILS_ENV=production<br>
<br>
$ rake assets:precompile RAILS_ENV=production<br>
rake aborted!<br>
Devise.secret_key was not set. Please add the following to your Devise initializer:<br>
config.secret_key =<br>
horribly_long_encrypted_key<br>
<br>
$ vi config/initializers/devise.rb<br>
--><br>
config.secret_key = horribly_long_encrypted_key<br>
$ rake assets:precompile RAILS_ENV=production<br>
<br>
$ rake secret RAILS_ENV=production<br>
monstrous_long_encrypted_key<br>
$ vi config/secrets.yml<br>
--><br>
production:<br>
secret_key_base:<br>
monstrous_long_encrypted_key<br>
<br>
$ vi config/environments/production.rb<br>
-->
<pre class="brush:ruby">
# config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.serve_static_files = true
config.assets.digest = true
</pre>
$ sudo service nginx start<br>
<br>
<u>MacBook</u><br>
Open Chrome browser, url http://my_ipaddress<br>
<br>
<u>Post Script</u><br>
In case you want to do it all over again,<br>
login as root, stop nginx, delete user, purge nginx<br>
<br>
$ pgrep -u deploy<br>
$ ps -f --pid $(pgrep -u deploy)<br>
$ killall -9 -u deploy<br>
$ deluser --remove-home deploy<br>
<br>
$ sudo apt-get purge nginx-extras passenger<br>
$ sudo apt-get purge nginx-common<br>
$ sudo apt-get autoremove<br>
<br>
References for these additional steps:<br>
<div style="border: 2px solid purple;">
<ol>
<li><a href="http://www.tecmint.com/delete-remove-a-user-account-with-home-directory-in-linux/">http://www.tecmint.com/delete-remove-a-user-account-with-home-directory-in-linux/</a></li>
<li><a href="https://enriquemorenotent.com/removing-nginx-completely-from-ubuntu/">https://enriquemorenotent.com/removing-nginx-completely-from-ubuntu/</a></li>
<li><a href="http://askubuntu.com/questions/235347/what-is-the-best-way-to-uninstall-nginx">http://askubuntu.com/questions/235347/what-is-the-best-way-to-uninstall-nginx</a></li>
</ol>
</div>
</span>
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com1tag:blogger.com,1999:blog-2508711278752078434.post-49473797832332073242016-04-08T22:06:00.000+05:302016-10-22T02:34:33.806+05:30Practical Rails : Adding a bootstrap theme<div dir="ltr" style="text-align: justify;" trbidi="on">
<span style="color: #351c75; font-family: Helvetica; font-size: 17px;">
When you are trying to get your webapp prototype or MVP up and running, you wouldn't wait for your UI group to deliver their entire UI assets. <a href="https://wrapbootstrap.com/"><u>{wrap}bootstrap</u></a> is a good place to get bootstrap themes for less than $20. And who knows, the theme you select maybe good enough to go to production.<br><br>
In this post, I present the steps to plug a bootstrap theme into your Rails app.<br><br>
<a name='more'></a>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfnX2lMqJWFRQ14czhqWnuoP9AGjUSrSzP1pehd79GfUcA4qyFXJpVpQy1EqiKzLSQy-diAR0Q7FcxfqH5w02Xth5m65iSJiWpxmr6JlGew9XTWh4rlYF5B9krikSZXGrcD0krDk-zut80/s1600/wrapbootstrap-rails.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfnX2lMqJWFRQ14czhqWnuoP9AGjUSrSzP1pehd79GfUcA4qyFXJpVpQy1EqiKzLSQy-diAR0Q7FcxfqH5w02Xth5m65iSJiWpxmr6JlGew9XTWh4rlYF5B9krikSZXGrcD0krDk-zut80/s320/wrapbootstrap-rails.png" /></a></div>
Let's say your theme is my_theme. In vendor/assets, create a sub-directory 'my_theme' under each of fonts, images, javascripts, stylesheets directories.<br><br>
Copy the respective asset files to each of these sub-directories. So,<br>
all [*.eot, *.svg, *.ttf, *.woff, *.woff2] files go under fonts/my_theme,<br>
all [*.png *.jpg *.gif] files go under images/my_theme,<br>
all [*.js] files go under javascripts/my_theme, and<br>
all [*.css] files go under stylesheets/my_theme.<br><br>
You can do the above with the find command in your theme directory.<br>
<div style="background-color:#b0e0e6;">
find . -name "*.js" -exec cp {} path_to_my_project/vendor/assets/javascripts/my_theme \;
</div>
<br>
Please note the called css and js files in your index.html. Copy them in the <b>same order</b> to application.css and application.js.<br><br>
<u>app/assets/stylesheets/application.css</u>
<div style="background-color:#b0e0e6;">
*= require my_theme/bootstrap<br>
*= require my_theme/font-awesome<br>
*= require my_theme/fontello<br>
*= require my_theme/magnific-popup<br>
*= require my_theme/settings<br>
......<br>
......<br>
</div>
<br>
<u>app/assets/javascripts/applicaton.js</u>
<div style="background-color:#b0e0e6;">
//= require my_theme/jquery.min<br>
//= require my_theme/bootstrap.min<br>
//= require my_theme/modernizr<br>
//= require my_theme/jquery.themepunch.tools.min<br>
//= require my_theme/jquery.themepunch.revolution.min<br>
//= require my_theme/isotope.pkgd.min<br>
......<br>
......<br>
</div>
<br>
Put all assets in the assets pipeline.<br>
<u>config/initializers/assets.rb</u><br>
<div style="background-color:#b0e0e6;">
Rails.application.config.assets.precompile += %w( *.png *.gif *.jpg *.ico *.svg *.eot *.ttf *.woff *.woff2)
</div>
<br>
Change URLs in css files (bootstrap, fontello, font-awesome, settings, style etc.)<br>
from<br>
<div style="background-color:#ffc7c7;">
1. url('../fonts/glyphicons-halflings-regular.eot');<br>
2. url('../font/fontello.eot?46462644');<br>
3. background:url(../assets/shadow1.png)<br>
</div>
<br>
to look like<br>
<div style="background-color:#b0e0e6;">
1. url('/assets/my_theme/glyphicons-halflings-regular.eot');<br>
2. url('/assets/my_theme/fontello.eot?46462644');<br>
3. background:url(/assets/my_theme/shadow1.png)<br>
</div>
<br>
You are set!
</span>
</div>mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com1tag:blogger.com,1999:blog-2508711278752078434.post-40528455836372391502016-04-01T18:33:00.000+05:302016-04-08T22:06:29.373+05:30Hello World : Virgin Identifier<div dir="ltr" style="text-align: justify;" trbidi="on">
<span style="color: #351c75; font-family: Helvetica; font-size: 17px;">
On behalf of the Hyderabad Machine-language Engineers Network (HYMEN), I am extremely happy to announce that we have come out with a technology solution to identify whether a girl is a virgin or not. The name of our product is VirIde (pronounced We Ride), short for Virgin Identifier. It can be applied in a very discreet and non-intrusive way, and solves a huge problem burdening our society.<br><br>
It has been a very natural law through out human evolution that males have always wanted uninhibited fun in their pre-marital age, but display obsessive preference to virgins when they want to marry. How can one know whether a girl is virgin or not? There is no way to find out this fact without violating the legal, ethical, and probity standards of our age.<br><br>
<a name='more'></a>
We believed that this is an important problem to be solved. Hence we made use of the various tools of data sciences and machine learning algorithms and have come out with a unique solution that will be a game changer in human relations. The HYMEN data scientists collaborated with researchers from Indian Institute of Information Tecknology (IIIT), Hyderabad, Indian School of Business (ISB), Hyderabad and other reputed institutes in order to maintain the scientific accuracy of the product.<br><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6llmqh9qO81udhHt7K5-gCxpfq3OADvzA3Jh0gg0oy4b3fNCrVQUvkiFNaULqegyYALV6ymhmH4pzKnwNs8WYly0hjfM-X7fES7awkR41Ido0dfyUvG5sQbXresv8ro1833bII28XPsNv/s1600/img026.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6llmqh9qO81udhHt7K5-gCxpfq3OADvzA3Jh0gg0oy4b3fNCrVQUvkiFNaULqegyYALV6ymhmH4pzKnwNs8WYly0hjfM-X7fES7awkR41Ido0dfyUvG5sQbXresv8ro1833bII28XPsNv/s320/img026.jpg" /></a></div><br>
Our methodology is simple. It is based on the axiomatic concept that virgins walk in a certain way and non-virgins walk in a certain way. There are two major criteria of evaluation.<br><br>
The first criterion is the Buttock Sway Direction (BSD). The buttocks of virgins move predominantly in the forward - backward direction. For non-virgins, the buttocks movement is predominantly in the upward - downward direction. The critical factor to calculate here is the ratio of the forward-backward buttock displacement to the upward-downward buttock displacement. This is the FBUD ratio.<br><br>
In the second criterion, the measurement is on the side; it is the peak amplitude of the hip in the sideward direction when a woman walks. This displacement as a ratio of the single step distance (SDR) of the woman's walk is a constant for virgins and a different constant for non-virgins.<br><br>
We had invited volunteer women to take part in our project. They were confirmed virgins and non-virgins. The response to our invitations has been incredible and we are very pleased with the cooperation extended by our volunteers. We are very much indebted to these women who shed their inhibitions and took part in our game-changing project.<br><br>
In the evaluation, we made our volunteers walk and recorded their FBUDs and SDRs. For the second parameter, we took accurate measurements of the side sway of their kameez, skirt or tops when they walk and subtracted the thickness of the cloth to get the correct sideway displacement.<br><br>
We also correlated the data with various parameters like their age, height, weight etc. We now have a scientifically established training dataset of virgins and non-virgins with various virginity determining parameters.<br><br>
In the field of machine learning, classification algorithms are those that categorize an entity as one of two binary categories, as shown in the following diagram:<br><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIvOyZLhDtcrcTvKy6VEREfHiXfRCS73EniwKc2eS_ZOOaSmw9er6elPP01BP2YzPs6rvFHU9IAxEChQcbUWma_ImfkwvxldPLuZKh-RT830TR3eMZRekAFvEu96_IU0MNGIsKM8hK4u-l/s1600/Screen+Shot+2016-03-31+at+4.11.10+pm.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIvOyZLhDtcrcTvKy6VEREfHiXfRCS73EniwKc2eS_ZOOaSmw9er6elPP01BP2YzPs6rvFHU9IAxEChQcbUWma_ImfkwvxldPLuZKh-RT830TR3eMZRekAFvEu96_IU0MNGIsKM8hK4u-l/s320/Screen+Shot+2016-03-31+at+4.11.10+pm.png" /></a></div>
Given a woman's walking data, our solution applies the most appropriate classification algorithm to classify the woman as a virgin or non-virgin.<br><br>
How the classification algorithm is selected is the real core IP of this product. Our attorneys have applied for patenting the solution in all countries of the world. They are working round-the-clock to get the approvals expedited.<br><br>
Thereafter, we foresee a tremendous realization of value from VirIde and we are in the midst of discussions with venture capitalists. In the next few days, we will be announcing our Series-A round of funding. Please stay tuned for more updates on this.<br><br>
Future applications: The next phases of this technology evolution offer immense possibilities. We will have robots that can walk behind a woman, identify the required statistics and relay it back to our database. For those areas where robots are not feasible, we are also working on wearables like Google Glass, that will immediately inform you about a woman's virginity. This wearable project called VirIde Glass will involve real-time interactions of image processing, data science, mobile and cloud technologies.<br><br>
We have shared our solution with a few selected personalities here in Hyderabad. Our problem-solving attitude, technology approach and civilizational benefits have been applauded.<br>
Speaking about our project, technology evangelist and VP (Products) of Regress, Mr. Lamesh Joganathan, standing on a rock in LaMakaan in Banjara Hills, said "Hyderabad Startups Rock. This is a different kind of upstart compared to our startups. Hyderabad is a happening city, and I am happy that we use our hindsight to produce such path-breaking solutions."<br>
Journalist and author Mr. FreeRam Verri said, "I am an atheist, liberal and capitalist. These are the valves on which a modern economy is built. And this product is in tune with all those. I am of the firm belief that it increase the choices that people have. This is not a matter of objectification, but of objectivist epistemology. Ayn Rand would approve."<br><br>
Once again, we thank the HYMEN researchers, IIIT / ISB sceintists and our women volunteers for their tremendous contribution to our extremely scientific, innovative and game-changing product.
</span>
</div>mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com3tag:blogger.com,1999:blog-2508711278752078434.post-78969426161965718392016-01-08T16:27:00.000+05:302016-04-01T18:34:07.152+05:30A Ruby Program On Logistic Regression<div dir="ltr" style="text-align: justify;" trbidi="on">
<span style="color: #351c75; font-family: Helvetica; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; background-color: transparent;">
I wrote, rather translated, a small program in Ruby on logistic regression. There is a github repository "<a href="https://github.com/emaadmanzoor/python-ML-minimal/"><u>python-ML-minimal</u></a>" that has programs written for Prof. Andrew Ng's machine learning class assignments. The cool thing is they are written with only the core language features without any dependency on libraries.<br><br>
<a name='more'></a>
Good for learning and understanding basic concepts, but Python has a construct called list comprehension which looks like a reverse-for loop. This construct is not so easy when you are trying to read code and understand the logic behind the code. So I promptly translated one program, on <a href="https://github.com/emaadmanzoor/python-ML-minimal/blob/master/logistic-regression.py"><u>logistic regression</u></a>, into Ruby.<br><br>
Ruby isn't known as a primary language for math. But its functional syntax for operating on collections and ability to handle formatted files cleanly make it an elegant choice to understand what an algorithm is doing. Further in this particular program, I used straight forward loops and array appends in place of the Python list comprehensions, so double easying steps: no dependency on non-core libraries plus no list comprehensions.<br><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGZjMMR4ILgMGE7tCKkkyVCiNZxFbe7Kba9lJLXTy9ePcLl7DXMdnzvqfJzD4R0uRjou8wissQg-m1MiC6S7sgxgZKMcqCDS-FiDq8U1NnYzrIdHzkfnIRB5zBM08U0qsib_tow3J8Jn85/s1600/ruby-logistic-regression.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGZjMMR4ILgMGE7tCKkkyVCiNZxFbe7Kba9lJLXTy9ePcLl7DXMdnzvqfJzD4R0uRjou8wissQg-m1MiC6S7sgxgZKMcqCDS-FiDq8U1NnYzrIdHzkfnIRB5zBM08U0qsib_tow3J8Jn85/s320/ruby-logistic-regression.jpg" /></a></div>
<br>
But first a <a href="http://mh-journal.blogspot.in/2015/10/about-logistic-regression.html"><u>recap</u></a> : In logistic regression, you aim to classify an entity into one of two mutually-exclusive classes, such as spam / not-spam or sick / not-sick. Starting concept is the odds which is the ratio where the numerator is the probability of an event of interest and the denominator is 1 - probability of the event. You input the log of odds ratio to the logit function and you get a probability in the range 0 - 1. Using a threshold for probability, say 0.5, you do the classification.<br><br>
The data file required to run is “logistic_regression_data.txt“ and here are a sample few rows:<br>
<div style="background-color:#ffc7c7;">
34.62365962451697,78.0246928153624,0<br>
30.28671076822607,43.89499752400101,0<br>
35.84740876993872,72.90219802708364,0<br>
60.18259938620976,86.30855209546826,1<br>
79.0327360507101,75.3443764369103,1<br>
</div>
<br>
Each line is a training example. In machining learning, you have pre-classified data, which is called as training data, for some reason that I don’t know of. In my programmer-speak it is a "known" entity.<br><br>
The program reads the file line by line, splits each line and stores the fields upto the second last field as an array in x and the last field in the variable y. Then the x's are stored in another array m which thus has all the training examples, which in my programmer speak is the array of known entities. n is the number of features, which in my programmer speak is the number of attributes of each entity.<br><br>
The program then calls the function scalefeatures passing x,m,n as arguments. What does scalefeatures function do? It first calculates mean and standard deviation of the data. Then it does feature scaling a.k.a data normalization.<br><br>
You do data normalization when your range of values is too broad for different variables. For example, age will be two-digit numbers whereas salary can be five or six-digit numbers. Hence you bring them all to closer values by applying various normalization techniques, one of which is feature scaling that converts input data to standard scores.<br><br>
The remaining part of the program is expressed in three functions, each corresponding to a mathematical formula in the logistics regression <a href="http://www.holehouse.org/mlclass/06_Logistic_Regression.html"><u>lesson</u></a> as given below:<br>
<b>h_logistic_regression</b><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqZe4ntX_zpcDCxv8DQfHRMHMAZnocBF4QvPjN2qSl6aB506HX4R_-q3qxQ9a5v6ZkcTkiVbuPX1lhOB8_TK2BNJAkOdo443DqOaVZSUje25K886LMPQlvucvMRzg63AFsQSUVL-YdEGT0/s1600/h-theta.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqZe4ntX_zpcDCxv8DQfHRMHMAZnocBF4QvPjN2qSl6aB506HX4R_-q3qxQ9a5v6ZkcTkiVbuPX1lhOB8_TK2BNJAkOdo443DqOaVZSUje25K886LMPQlvucvMRzg63AFsQSUVL-YdEGT0/s320/h-theta.png" /></a></div>
<pre class="brush:ruby">
def h_logistic_regression(theta, x, n)
theta_t_x = 0
0.upto n do |i|
theta_t_x += theta[i] * x[i]
end
begin
k = 1.0 / (1 + Math.exp(-theta_t_x))
rescue
if theta_t_x > 10 ** 5
k = 1.0 / (1 + Math.exp(-100))
else
k = 1.0 / (1 + Math.exp(100))
end
end
if k == 1.0
k = 0.99999
end
return k
end
</pre>
<b>gradientdescent_logistic</b><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguX4_-xO60-gkUXOb6pzf4QYk2h-T1w28EzNrD8XeeTiexNHWGG26JfEvBeqTcDNJp0SyLySD4GQFyLA8TLjqB0TK9VQJBIkTKVmX83RddQ53BgwQIfnB8sT68zDRM1HuuEKltlCgmxveY/s1600/gradient-descent-logistic-regression.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguX4_-xO60-gkUXOb6pzf4QYk2h-T1w28EzNrD8XeeTiexNHWGG26JfEvBeqTcDNJp0SyLySD4GQFyLA8TLjqB0TK9VQJBIkTKVmX83RddQ53BgwQIfnB8sT68zDRM1HuuEKltlCgmxveY/s320/gradient-descent-logistic-regression.png" /></a></div>
<pre class="brush:ruby">
def gradientdescent_logistic(theta, x, y, m, n, alpha, iterations)
0.upto iterations-1 do |i|
thetatemp = theta.clone
0.upto n do |j|
summation = 0.0
0.upto m-1 do |k|
summation += (h_logistic_regression(theta, x[k], n) - y[k]) *
x[k][j]
end
thetatemp[j] = thetatemp[j] - alpha * summation / m
end
theta = thetatemp.clone
end
return theta
end
</pre>
<b>cost_logistic_regression</b><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhsZSi9XiPBEuMafACLMQmeXlKxkvRQRmuXA9VTT9gT2xHybyqJfpGqGgUpPMC0KLj0k9VzbrKocJgtXXHntOnAGIYU1UrSj37ZR09qEvdJ9X8IObHc6bOsyk_orfZFwzdomZcf6xd1YEt/s1600/logistic-regression-cost-function.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhsZSi9XiPBEuMafACLMQmeXlKxkvRQRmuXA9VTT9gT2xHybyqJfpGqGgUpPMC0KLj0k9VzbrKocJgtXXHntOnAGIYU1UrSj37ZR09qEvdJ9X8IObHc6bOsyk_orfZFwzdomZcf6xd1YEt/s320/logistic-regression-cost-function.png" /></a></div>
<pre class="brush:ruby">
def cost_logistic_regression(theta, x, y, m, n)
summation = 0.0
0.upto m-1 do |i|
summation += y[i] * Math.log(h_logistic_regression(theta, x[i], n)) +
(1 - y[i]) *
Math.log(1 - h_logistic_regression(theta, x[i], n))
end
return -summation / m
end
</pre>
The program starts with an initial array of \(\theta\)'s of 0's. It uses these to apply gradient descent algorithm for 4000 iterations to arrive at a final cost. It then prints the initial cost and final cost.<br><br>
Here's the full program:<br>
<script src="https://gist.github.com/mh-github/2d7dd736a2605685573a.js"></script>
You run it as:<br>
ruby logistic-regression.rb < logistic_regression_data.txt<br>
The data file is available -> <a href="https://gist.github.com/mh-github/f8c5c3538b203d44c3f8"><u>here</u></a>
</span>
</div>mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com0tag:blogger.com,1999:blog-2508711278752078434.post-47829003658795299402016-01-01T16:02:00.000+05:302016-01-08T16:28:18.614+05:30Welcome 2016<div dir="ltr" style="text-align: justify;" trbidi="on">
<span style="color: #351c75; font-family: Helvetica; font-size: 17px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; background-color: transparent;">
The first blog post of the new year is an exercise in quantifying my online presence last year. In January 2015, my stats were:
<div style="width: 700px; color: navy; background-color: lavender; border: 2px solid blue; padding: 5px;">
<pre>
Twitter -- 2440 tweets, following 15, 62 followers
Facebook -- 320 friends, member of 22 groups
Blogger -- 103 posts (including 40 in LiveJournal)
Github -- 2 repositories;
raygate = 560 KB, ruwi = 228 KB; total = 788 KB.
Short films -- Ray Mahruwi Productions = 7
</pre>
</div>
<a name='more'></a>
<br/>
Today they are:
<div style="width: 700px; color: navy; background-color: pink; border: 2px solid blue; padding: 5px;">
<pre>
Twitter -- 2695 tweets, following 16, 65 followers
Facebook -- 936 friends, member of 40 groups
Blogger -- 129 posts
Github -- 3 repositories;
raygate = 560 KB, ruwi = 228 KB, gtdm-r = 35.46MB
total = 36.25 MB
Short Films -- Ray Mahruwi Productions = 11.
</pre>
</div>
<br/>
For short films, I did not record the views count at the start of 2015. As of now, the views count is:<br>
<table style="border:1px solid black;">
<th style="border:1px solid black; background-color:#BDB76B; color:white;">Name</th>
<th style="border:1px solid black; background-color:#BDB76B; color:white;">Views</th>
<tr>
<td style="border:1px solid red;">Nannu Kshaminchu Mahatmaa</td> <td style="border:1px solid red;">2747</td>
<tr>
<td style="border:1px solid red;">Malupu</td> <td style="border:1px solid red;">5387</td>
<tr>
<td style="border:1px solid red;">Nava Bethalam</td> <td style="border:1px solid red;">1874</td>
<tr>
<td style="border:1px solid red;">Manasa Ne Cheppe Maata Vinamma</td> <td style="border:1px solid red;">26722</td>
<tr>
<td style="border:1px solid red;">The Upliftment</td> <td style="border:1px solid red;">5378</td>
<tr>
<td style="border:1px solid red;">Ahana Kalyanam</td> <td style="border:1px solid red;">51747</td>
<tr>
<td style="border:1px solid red;">Katha-Screenplay-Darsakathvam - MH (Appalraju Kadu)</td> <td style="border:1px solid red;">573</td>
<tr>
<td style="border:1px solid red;">Glamour</td> <td style="border:1px solid red;">2027</td>
<tr>
<td style="border:1px solid red;">Aatmabhimanam - Idi andariki artham kaaka povachchu</td> <td style="border:1px solid red;">210</td>
<tr>
<td style="border:1px solid red;">Nirvana</td> <td style="border:1px solid red;">1638</td>
<tr>
<td style="border:1px solid red;">Parody Video</td> <td style="border:1px solid red;">2389</td>
</table>
Total = 100692<br><br>
The 100K+ views are for <i>all</i> short films, those that I produced and directed as well as those that I only produced. This number would be a good one for comparing this year's indulgence in shorts.<br><br>
I made a book reading list in July last year. It was:<br>
1. India Shastra : Reflections on the Nation in our Time by Shashi Tharoor.<br>
2. David and Goliath by Malcolm Gladwell. This one recommended by Kal.<br>
3. A Fine Balance by Rohinton Mistry. This one’s been pending for long.<br>
4. Structure and Interpretation of Computer Programs by Harold Abelson, Gerald Jay Sussman, Julie Sussman.<br>
5. The Mind’s I : Fantasies and Reflections on Self and Soul by Daniel C. Dennett and Douglas R. Hofstadter.<br>
6. I am a Strange Loop : 0 by Douglas R. Hofstadter.<br>
Rereads<br>
7. I’m OK -- You’re OK by Thomas Harris.<br>
8. Blink by Malcolm Gladwell.<br>
9. The God of Small Things by Arundhati Roy.<br>
10. The Argumentative Indian by Amartya Sen.<br><br>
What did I actually accomplish? Dismal. Could read only David and Goliath, and am half way through Blink. So, no new list for this year. The same list continues with the following additions:<br>
<ul>
<li>Autobiography of a Mad Nation - Sriram Karri</li>
<li>From the Ruins of Empire: The Revolt Against the West and the Remaking of Asia - Pankaj Mishra</li>
<li>The Heart Goes Last -- Margaret Atwood</li>
<li>The Silk Worm -- Robert Galbraith</li>
</ul>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcv8RD20Anrs38G3io6Ak7n12ANcPdBjHhA9yVjL0VglMFjImHd6b3ZGWp5jkF8CEWlw-pj-7gv8WffogLN3IffLzXtgq8r-Ejphyphenhyphen33g0ZueE81KP3DBQtxmN8LXnGrQ7YO4xkKax3DFj3/s1600/first-blog-post-2016.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcv8RD20Anrs38G3io6Ak7n12ANcPdBjHhA9yVjL0VglMFjImHd6b3ZGWp5jkF8CEWlw-pj-7gv8WffogLN3IffLzXtgq8r-Ejphyphenhyphen33g0ZueE81KP3DBQtxmN8LXnGrQ7YO4xkKax3DFj3/s320/first-blog-post-2016.png" /></a></div><br/>
To take stock: my web presence grew but not at the rate I had wanted it to be. Professionally and personally, I have gone through a lot in these 365 days than the previous thousand perhaps. Double disappointments happened: be it startups or short films. Two in each space did not work out the way I thought they would. My reading was dismal.<br><br>
So what I need to do is clear: be more active on Twitter, be diligent in my reading, and put out a lot more code on github.<br><br>
But I can take some amount of satisfaction from the 26 blog posts, 4 short films and ~600 new Facebook friends. Along the way I became a DZone MVB (Most Valuable Blogger) and two of my blog posts were re-published on that site.<br><br>
Going into the new year, two values I sincerely hope to live by are --<br>
a) detachment : Things won't happen as you want them to be, things will happen as they are supposed to be. Just remember, the Almighty has better plans for you than you have for yourself.<br>
b) focus : Do one thing and do it well. Bring things to a logical conclusion and it doesn't matter even if you are going slowly as long as you are going in the right direction.<br><br>
A Happy 2016 to all of you.
</span>
</div>
mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com0tag:blogger.com,1999:blog-2508711278752078434.post-13863423802735695042015-12-04T23:39:00.000+05:302016-01-01T16:03:28.773+05:30Program For Linear Regression With Gradient Descent<div dir="ltr" style="text-align: justify;" trbidi="on">
<span style="color: #351c75; font-family: Helvetica; font-size: 17px;">
I took a Python program that applies gradient descent to linear regression and converted it to Ruby. But first, a recap: we use linear regression to do numeric prediction.<br><br>
<a name='more'></a>
If x is an input (independent) variable and y is an output (dependent) variable, we come up with an initial formula (equation) that shows the mathematical relation between them.<br><br>
Next we take each value of x and calculate the value of y using our initial equation. The difference between the calculated value of y and the actual y value corresponding to the x value is the error. The error values are summed up by which we arrive at another equation. We minimize this equation using the gradient descent algorithm so that we come up with the best fit equation.<br><br>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXu0nAUchtmVOyr-UOUb8GWa9oZxaP2EXvAJdOWdkZ_KUbEVYWemAPwWNmbEhybzk6HGP7n-SGKsN4c1sY7smzpkRQgkJTZCXCANo712vcU-4t5rKFEYgHYocB-pIvEuYKLnxhYIeLS8Z7/s1600/gradient-descent-for-linear-regression.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXu0nAUchtmVOyr-UOUb8GWa9oZxaP2EXvAJdOWdkZ_KUbEVYWemAPwWNmbEhybzk6HGP7n-SGKsN4c1sY7smzpkRQgkJTZCXCANo712vcU-4t5rKFEYgHYocB-pIvEuYKLnxhYIeLS8Z7/s320/gradient-descent-for-linear-regression.jpeg" /></a></div>
<br>
When I was searching the web on this topic, I came across this page “<a href="http://spin.atomicobject.com/2014/06/24/gradient-descent-linear-regression/"><u>An Introduction to Gradient Descent and Linear Regression</u></a>” by Matt Nedrich in which he presents a Python example. The program finds the best fit line for a given data set of x and y values. Good catch for me. For practice, I took Matt’s program and re-wrote it in Ruby.<br><br>
I liked Matt’s blog article, so I am giving parts of it below but with my Ruby snippets.
<blockquote>To compute error for a given line, we’ll iterate through each (x, y) point in our data set and sum the square distances between each point’s y value and the candidate line’s y value (computed at mx + b).</blockquote>
<blockquote>Formally, this error function will look like:</blockquote>
$$Error_(m,b) = \frac{1}{N}\sum_{i=1}^N(y_i - (mx_i + b ))^2$$
<div style="background-color:#b0e0e6;">
<pre class="brush:ruby">
0.upto points.length-1 do |i|
x = points[i][0]
y = points[i][1]
totalError += (y - (m * x + b)) ** 2
end
return totalError / points.length
</pre>
</div>
<blockquote>If we minimize this function, we will get the best line for our data. Since our error function consists of two parameters (m and b) we can visualize it as a two-dimensional surface.</blockquote>
<blockquote>When we run gradient descent search, we will start from some location on this surface and move downhill to find the line with the lowest error. To run gradient descent on this error function, we first need to compute its gradient. The gradient will act like a compass and always point us downhill.</blockquote>
<blockquote>To compute it, we will need to differentiate our error function. Since our function is defined by two parameters (m and b), we will need to compute a partial derivative for each. The derivatives work out to be:</blockquote>
$$\frac{\partial}{\partial m} = \frac{2}{N}\sum_{i=1}^N - x_i(y_i - (mx_i + b))$$
$$\frac{\partial}{\partial b} = \frac{2}{N}\sum_{i=1}^N - (y_i - (mx_i + b))$$
<div style="background-color:#b0e0e6;">
<pre class="brush:ruby">
0.upto points.length-1 do |i|
x = points[i][0]
y = points[i][1]
m_gradient += -(2/n) * x * (y - ((m_current * x) + b_current))
b_gradient += -(2/n) * (y - ((m_current * x) + b_current))
end
new_m = m_current - (learningRate * m_gradient)
new_b = b_current - (learningRate * b_gradient)
</pre>
</div>
Finally, we come to the complete program:
<script src="https://gist.github.com/mh-github/a9852d1c20facc79fcce.js"></script>
The file "data.cv" required to run this program is available at this -> <a href="http://www.mediafire.com/view/a76zi2n0397bbun/data.csv"><u>link</u></a>.
</span>
</div>mahboobhttp://www.blogger.com/profile/18319583318928079433noreply@blogger.com3