Logo

Who is talking?

Archive

Infinity in technology

almost 6 years ago | Oscar Villirreal: Digital Caveman

Ray Kurzweil just faded out from my iPad as I was watching one of his lectures/speaches. He was talking as usual about how fast technology has evolved an will continue to evolve as time passes by. He also talked about the nature of technologies exponential growth and even game some insight into what the future […]

Rails upgrade from 3.0.7 to 3.1 and asset pipe-lining

almost 6 years ago | Gourav Tiwari: easy_software = Agile.find(ruby_on_rails)

Following my previous blog, I happen to work on another rails upgrade at the beginning of my new project. This time rails 3.0.7 to 3.1. I though, I should document these steps, as it might help myself or someone else in future.I googled and found a good discussion on stack-overflow. As Forrest Ye gave the right answer, I began the migration step by step, as it is written:"Edit Gemfile, change Rails gem versiongem 'rails', '3.1.0'Also adds new gems introduced in 3.1.0group :assets do  gem 'sass-rails', "~> 3.1.0"  gem 'coffee-rails', "~> 3.1.0"  gem 'uglifier'endgem 'jquery-rails'runbundle update railsThen run rake rails:update and resolve conflicts."I found few conflicts and before accepting them, I tried to understand:1. config/application.rb: I paid attention to:config.assets.enabled = trueconfig.assets.version = '1.0' which means you are enabling assets pipe-lining  which is one of the feature of rails 3.1, I accepted the changes.2. config/environments/development.rb:config.action_view.debug_rjs = truewhich has been deprecated, so this line should be deleted, if you are using rjs in views, debugging is not supported now.config.assets.compress = falsewhich means assets compression is off in development, I accepted the changes.config.assets.debug = trueit means, you can see the assets being loaded in logs. I accepted this change.3. config/environments/production.rbI saw again configuration related to asset pipeline:config.assets.compress = trueconfig.assets.compile = falseconfig.assets.digest = trueSimply, accept these changes.Once this is done, move all assets from public/images, public/javascripts, public/stylesheets to app/assets/ directory. Again, you have to make sure, that youInclude css/javascript links in your layout file like this<%= stylesheet_link_tag "application" %><%= javascript_include_tag "application" %>Again, it is important to understand the behavior of asset pipeline and how it works. For example, in application.js file, you will have://= require_tree .that means, all the files from assets/javascripts directory will be loaded automatically, as application is being loaded, in hierarchical format. If you do need js files in sequence, mention that above this line, e.g.://= require jquery //= require jquery_ujs//= require highcharts//= require_tree .Similarly you have application.css file, which will load assets in hierarchy, so override it if needed. One important thing I noticed is about images, which are embedded in stylesheets. I had stylesheet.css as:/**= require_self*= require_tree .*/#header { height:20px; }body {background-image:url(../images/mainBack.png) !important; background-repeat:repeat-x;} So, after moving images to app/assets/images directory, I have to remove the relative path of the image:body {background-image:url(mainBack.png) !important; background-repeat:repeat-x;}Similarly for all other styles and that is it!

Rails upgrade from 3.0.7 to 3.1 and asset pipe-lining

almost 6 years ago | Gourav Tiwari: easy_software = Agile.find(ruby_on_rails)

Following my previous blog, I happen to work on another rails upgrade at the beginning of my new project. This time rails 3.0.7 to 3.1. I though, I should document these steps, as it might help myself or someone else in future.I googled and found a good discussion on stack-overflow. As Forrest Ye gave the right answer, I began the migration step by step, as it is written:"Edit Gemfile, change Rails gem versiongem 'rails', '3.1.0'Also adds new gems introduced in 3.1.0group :assets do  gem 'sass-rails', "~> 3.1.0"  gem 'coffee-rails', "~> 3.1.0"  gem 'uglifier'endgem 'jquery-rails'runbundle update railsThen run rake rails:update and resolve conflicts."I found few conflicts and before accepting them, I tried to understand:1. config/application.rb: I paid attention to:config.assets.enabled = trueconfig.assets.version = '1.0' which means you are enabling assets pipe-lining  which is one of the feature of rails 3.1, I accepted the changes.2. config/environments/development.rb:config.action_view.debug_rjs = truewhich has been deprecated, so this line should be deleted, if you are using rjs in views, debugging is not supported now.config.assets.compress = falsewhich means assets compression is off in development, I accepted the changes.config.assets.debug = trueit means, you can see the assets being loaded in logs. I accepted this change.3. config/environments/production.rbI saw again configuration related to asset pipeline:config.assets.compress = trueconfig.assets.compile = falseconfig.assets.digest = trueSimply, accept these changes.Once this is done, move all assets from public/images, public/javascripts, public/stylesheets to app/assets/ directory. Again, you have to make sure, that youInclude css/javascript links in your layout file like this<%= stylesheet_link_tag "application" %><%= javascript_include_tag "application" %>Again, it is important to understand the behavior of asset pipeline and how it works. For example, in application.js file, you will have://= require_tree .that means, all the files from assets/javascripts directory will be loaded automatically, as application is being loaded, in hierarchical format. If you do need js files in sequence, mention that above this line, e.g.://= require jquery //= require jquery_ujs//= require highcharts//= require_tree .Similarly you have application.css file, which will load assets in hierarchy, so override it if needed. One important thing I noticed is about images, which are embedded in stylesheets. I had stylesheet.css as:/**= require_self*= require_tree .*/#header { height:20px; }body {background-image:url(../images/mainBack.png) !important; background-repeat:repeat-x;} So, after moving images to app/assets/images directory, I have to remove the relative path of the image:body {background-image:url(mainBack.png) !important; background-repeat:repeat-x;}Similarly for all other styles and that is it!

Spring Roo is amazing

almost 6 years ago | Subodh Gupta: Subodh's Blog

Developer spend 75% of their time working on boiler-plate code. Spring Roo do amazing job of doing that for you and gets you started really-2 fast. After that you can follow the application curve if writing the business logic. Why Roo?Define the class and its relation it will generate the DB using hibernate you can generate the controller's ( and UI) from the same classes with CURD operation supportedtest code is also gets generated code generated is clean and easy to modifydependency resolution happens through mavenonce you are done projects are eclipse readyeasy to get rid of metadata for production Other tools:I came across Grails but i needed a framework which will generate the java so roo was the better choice for meVideo helped me get started: http://s3.springsource.com/MRKT/roo/2010-01-Five_Minutes_Roo.mov

Other side of our Indian History

almost 6 years ago | Niranjan Sarade: InLoveWithNature

Sharing Last Speech by Nathuram Godse :-JANUARY 30th, 1949 - The Mahatma was assassinated by a man called Naturam Godse. After he shot him, instead of running away, he stood his ground and surrounded. He said, "No one should think that Gandhi was killed by a madman"One of the best speeches of All time, which is compared to Socrates's speech in his trial. The Judge was astonished by his speech and commented that if India had followed the Jury system of giving judgments, Godse would have been adjudicated as "Not Guilty" by the Jury, cause after the speech, the whole audience was in tears.This is the speech given by Nathuram Godse in the court in his last trial for the murder of Mahatma Gandhi."Born in a devotional Brahmin family, I instinctively came to revere Hindu religion, Hindu history and Hindu culture. I had, therefore, been intensely proud of Hinduism as a whole. As I grew up I developed a tendency to free thinking unfettered by any superstitious allegiance to any isms, political or religious. That is why I worked actively for the eradication of untouchability and the caste system based on birth alone. I openly joined anti-caste movements and maintained that all Hindus were of equal status as to rights, social and religious and should be considered high or low on merit alone and not through the accident of birth in a particular caste or profession. I used publicly to take part in organized anti-caste dinners in which thousands of Hindus, Brahmins, Kshatriyas, Vaisyas, Chamars and Bhangis participated. We broke the caste rules and dined in the company of each other.I have read the speeches and writings of Dadabhai Nairoji, Vivekanand, Gokhale, Tilak, along with the books of ancient and modern history of India and some prominent countries like England, France, America and' Russia. Moreover I studied the tenets of Socialism and Marxism. But above all I studied very closely whatever Veer Savarkar and Gandhiji had written and spoken, as to my mind these two ideologies have contributed more to the moulding of the thought and action of the Indian people during the last thirty years or so, than any other single factor has done.All this reading and thinking led me to believe it was my first duty to serve Hindudom and Hindus both as a patriot and as a world citizen. To secure the freedom and to safeguard the just interests of some thirty crores (300 million) of Hindus would automatically constitute the freedom and the well being of all India, one fifth of human race. This conviction led me naturally to devote myself to the Hindu Sanghtanist ideology and programme, which alone, I came to believe, could win and preserve the national independence of Hindustan, my Motherland, and enable her to render true service to humanity as well.Since the year 1920, that is, after the demise of Lokamanya Tilak, Gandhiji's influence in the Congress first increased and then became supreme. His activities for public awakening were phenomenal in their intensity and were reinforced by the slogan of truth and non-violence, which he paraded ostentatiously before the country. No sensible or enlightened person could object to those slogans. In fact there is nothing new or original in them. They are implicit in every constitutional public movement. But it is nothing but a mere dream if you imagine that the bulk of mankind is, or can ever become, capable of scrupulous adherence to these lofty principles in its normal life from day to day. In fact, honour, duty and love of one's own kith and kin and country might often compel us to disregard non-violence and to use force. I could never conceive that an armed resistance to an aggression is unjust. I would consider it a religious and moral duty to resist and, if possible, to overpower such an enemy by use of force. [In the Ramayana] Rama killed Ravana in a tumultuous fight and relieved Sita. [In the Mahabharata], Krishna killed Kansa to end his wickedness; and Arjuna had to fight and slay quite a number of his friends and relations including the revered Bhishma because the latter was on the side of the aggressor. It is my firm belief that in dubbing Rama, Krishna and Arjuna as guilty of violence, the Mahatma betrayed a total ignorance of the springs of human action.In more recent history, it was the heroic fight put up by Chhatrapati Shivaji that first checked and eventually destroyed the Muslim tyranny in India. It was absolutely essentially for Shivaji to overpower and kill an aggressive Afzal Khan, failing which he would have lost his own life. In condemning history's towering warriors like Shivaji, Rana Pratap and Guru Gobind Singh as misguided patriots, Gandhiji has merely exposed his self-conceit. He was, paradoxical, as it may appear, a violent pacifist who brought untold calamities on the country in the name of truth and non-violence, while Rana Pratap, Shivaji and the Guru will remain enshrined in the hearts of their countrymen forever for the freedom they brought to them.The accumulating provocation of thirty-two years, culminating in his last pro-Muslim fast, at last goaded me to the conclusion that the existence of Gandhi should be brought to an end immediately. Gandhi had done very well in South Africa to uphold the rights and well being of the Indian community there. But when he finally returned to India he developed a subjective mentality under which he alone was to be the final judge of what was right or wrong. If the country wanted his leadership, it had to accept his infallibility; if it did not, he would stand aloof from the Congress and carry on his own way. Against such an attitude there can be no halfway house. Either Congress had to surrender its will to his and had to be content with playing second fiddle to all his eccentricity, whimsicality, metaphysics and primitive vision, or it had to carry on without him. He alone was the Judge of everyone and everything; he was the master brain guiding the civil disobedience movement; no other could know the technique of that movement. He alone knew when to begin and when to withdraw it. The movement might succeed or fail, it might bring untold disaster and political reverses but that could make no difference to the Mahatma's infallibility. 'A Satyagrahi can never fail' was his formula for declaring his own infallibility and nobody except himself knew what a Satyagrahi is.Thus, the Mahatma became the judge and jury in his own cause. These childish insanities and obstinacies, coupled with a most severe austerity of life, ceaseless work and lofty character made Gandhi formidable and irresistible. Many people thought that his politics were irrational but they had either to withdraw from the Congress or place their intelligence at his feet to do with, as he liked. In a position of such absolute irresponsibility Gandhi was guilty of blunder after blunder, failure after failure, disaster after disaster.Gandhi's pro-Muslim policy is blatantly in his perverse attitude on the question of the national language of India. It is quite obvious that Hindi has the most prior claim to be accepted as the premier language. In the beginning of his career in India, Gandhi gave a great impetus to Hindi but as he found that the Muslims did not like it, he became a champion of what is called Hindustani. Everybody in India knows that there is no language called Hindustani; it has no grammar; it has no vocabulary. It is a mere dialect; it is spoken, but not written. It is a bastard tongue and crossbreed between Hindi and Urdu, and not even the Mahatma's sophistry could make it popular. But in his desire to please the Muslims he insisted that Hindustani alone should be the national language of India. His blind followers, of course, supported him and the so-called hybrid language began to be used. The charm and purity of the Hindi language was to be prostituted to please the Muslims. All his experiments were at the expense of the Hindus.From August 1946 onwards the private armies of the Muslim League began a massacre of the Hindus. The then Viceroy, Lord Wavell, though distressed at what was happening, would not use his powers under the Government of India Act of 1935 to prevent the rape, murder and arson. The Hindu blood began to flow from Bengal to Karachi with some retaliation by the Hindus. The Interim Government formed in September was sabotaged by its Muslim League members right from its inception, but the more they became disloyal and treasonable to the government of which they were a part, the greater was Gandhi's infatuation for them. Lord Wavell had to resign as he could not bring about a settlement and he was succeeded by Lord Mountbatten. King Log was followed by King Stork.The Congress, which had boasted of its nationalism and socialism, secretly accepted Pakistan literally at the point of the bayonet and abjectly surrendered to Jinnah. India was vivisected and one-third of the Indian territory became foreign land to us from August 15, 1947. Lord Mountbatten came to be described in Congress circles as the greatest Viceroy and Governor-General this country ever had. The official date for handing over power was fixed for June 30, 1948, but Mountbatten with his ruthless surgery gave us a gift of vivisected India ten months in advance. This is what Gandhi had achieved after thirty years of undisputed dictatorship and this is what Congress party calls 'freedom' and 'peaceful transfer of power'. The Hindu-Muslim unity bubble was finally burst and a theocratic state was established with the consent of Nehru and his crowd and they have called 'freedom won by them with sacrifice' - whose sacrifice? When top leaders of Congress, with the consent of Gandhi, divided and tore the country - which we consider a deity of worship - my mind was filled with direful anger.One of the conditions imposed by Gandhi for his breaking of the fast unto death related to the mosques in Delhi occupied by the Hindu refugees. But when Hindus in Pakistan were subjected to violent attacks he did not so much as utter a single word to protest and censure the Pakistan Government or the Muslims concerned. Gandhi was shrewd enough to know that while undertaking a fast unto death, had he imposed for its break some condition on the Muslims in Pakistan, there would have been found hardly any Muslims who could have shown some grief if the fast had ended in his death. It was for this reason that he purposely avoided imposing any condition on the Muslims. He was fully aware of from the experience that Jinnah was not at all perturbed or influenced by his fast and the Muslim League hardly attached any value to the inner voice of Gandhi.Gandhi is being referred to as the Father of the Nation. But if that is so, he had failed his paternal duty inasmuch as he has acted very treacherously to the nation by his consenting to the partitioning of it. I stoutly maintain that Gandhi has failed in his duty. He has proved to be the Father of Pakistan. His inner-voice, his spiritual power and his doctrine of non-violence of which so much is made of, all crumbled before Jinnah's iron will and proved to be powerless.Briefly speaking, I thought to myself and foresaw I shall be totally ruined, and the only thing I could expect from the people would be nothing but hatred and that I shall have lost all my honour, even more valuable than my life, if I were to kill Gandhiji. But at the same time I felt that the Indian politics in the absence of Gandhiji would surely be proved practical, able to retaliate, and would be powerful with armed forces. No doubt, my own future would be totally ruined, but the nation would be saved from the inroads of Pakistan. People may even call me and dub me as devoid of any sense or foolish, but the nation would be free to follow the course founded on the reason which I consider to be necessary for sound nation-building. After having fully considered the question, I took the final decision in the matter, but I did not speak about it to anyone whatsoever. I took courage in both my hands and I did fire the shots at Gandhiji on 30th January 1948, on the prayer-grounds of Birla House.I do say that my shots were fired at the person whose policy and action had brought rack and ruin and destruction to millions of Hindus. There was no legal machinery by which such an offender could be brought to book and for this reason I fired those fatal shots.I bear no ill will towards anyone individually but I do say that I had no respect for the present government owing to their policy, which was unfairly favourable towards the Muslims. But at the same time I could clearly see that the policy was entirely due to the presence of Gandhi. I have to say with great regret that Prime Minister Nehru quite forgets that his preachings and deeds are at times at variances with each other when he talks about India as a secular state in season and out of season, because it is significant to note that Nehru has played a leading role in the establishment of the theocratic state of Pakistan, and his job was made easier by Gandhi's persistent policy of appeasement towards the Muslims.I now stand before the court to accept the full share of my responsibility for what I have done and the judge would, of course, pass against me such orders of sentence as may be considered proper. But I would like to add that I do not desire any mercy to be shown to me, nor do I wish that anyone else should beg for mercy on my behalf. My confidence about the moral side of my action has not been shaken even by the criticism levelled against it on all sides. I have no doubt that honest writers of history will weigh my act and find the true value thereof some day in future."

Netbeans or Eclipse which one to choose

almost 6 years ago | Subodh Gupta: Subodh's Blog

There are so many articles on the web discussing this, what i am going to do is just briefly explain pros and cons of each which will help you choose better. Description Netbeans Eclipse Plugins It helps you extent the reach of your IDE to newer technologies without changing the IDE Good Good Code Refactor Reflects the change made in all the references Decent Good Getting Started Time it takes to get going on with your application Good Decent Enterprise Support Usage in big companies, spending effort in eclipse Decent Good Debugging Easy in which you can find a problem Decent Good UI Looks old Decent Good Spell Check Not Present Decent Code Generators Good Good Hope this will help you in making a choice.

Steve Jobs

almost 6 years ago | Niranjan Sarade: InLoveWithNature

I recently read one Marathi book - 'Steve Jobs:Ek Zapatlela Tantradnya (A Passionate Technologist)' written by Achyut Godbole and Atul Kahate. It's a brief biography of Steve Jobs - about his passion, life, attitude, innovations, revolutions and dreams.The authors have referred to some of the books including 'Steve Jobs: The Exclusive Biography' by Walter Isaacson for writing his biography in brief while touching some important aspects.I would like to mention one incident which I liked the most from this book. While Steve was viewing one printed circuit board of the earlier apple computer, he found that few circuit lines were not as straight as they should have been. So he immediately asked the engineers to change its design for making it perfect. His thinking was - 'Internal design beauty is as important as external design. We should strive for perfection.' From his quotes - 'Design is the fundamental soul of a man-made creation that ends up expressing itself in successive outer layers of the product or service. The iMac is not just the color or translucence or the shape of the shell. The essence of the iMac is to be the finest possible consumer computer in which each element plays together.'Really a lot of things to learn from him ! Hats off to you Steve !

First CXF-RS service with Tomcat web-container

almost 6 years ago | Subodh Gupta: Subodh's Blog

Looking to get started on CXF-RS, well that was what i was looking for and there are load of articles doing however none of them provide sufficient bullet points to make me understand how the control is following are how to debug the application if something is not working. Well that's what i am going to write here.Following are components you need to get started with first CXF-RS:TomcatEclipse (or some equivalent IDE)SpringCreate a dynamic web project in the eclipse (this is nothing but a simple web project which can deployed and can run when deployed in the web container like Tomcat).Keep your eye on the bold terms featuring in the files...Start will writing the web.xml descriptor file.<!--?xml version="1.0" encoding="ISO-8859-1"?--> <!-- Required for CXF Servlet --> contextConfigLocation WEB-INF/deploy-context.xml org.springframework.web.context.ContextLoaderListener <!-- Required for CXF Servlet initializer --> CXFServlet CXF Servlet org.apache.cxf.transport.servlet.CXFServlet 1 CXFServlet /* Second step is writing the deploy-context.xml and keep it in WEB-INF folder.<!--?xml version="1.0" encoding="UTF-8"?--> Java classes needed for the this:1. com.test.User.javaimport javax.xml.bind.annotation.XmlRootElement;@XmlRootElement(name = "user")public class User {    private Integer id;    private String  name;    public User() {    }    public User(Integer id, String name) {        this.id = id;        this.name = name;    }    public Integer getId() {        return id;    }    public void setId(Integer id) {        this.id = id;    }    public void setName(String name) {        this.name = name;    }    public String getName() {        return name;    }    @Override    public String toString() {        return String.format("{id=%s,name=%s}", id, name);    }}----------------------------------------------------------------------2. com.test.UserCollection.javaimport java.util.Collection;import javax.xml.bind.annotation.XmlElement;import javax.xml.bind.annotation.XmlElementWrapper;import javax.xml.bind.annotation.XmlRootElement;@XmlRootElementpublic class UserCollection {    private Collection users;    public UserCollection() {    }    public UserCollection(Collection users) {        this.users = users;    }    @XmlElement(name="user")    @XmlElementWrapper(name="users")    public Collection getUsers() {        return users;    }}------------------------------------------------------------------------------3. com.test.IService.javaimport javax.ws.rs.core.Response;public interface IService {    UserCollection getUsers();    User getCustomer(Integer id);    Response getBadRequest();}-----------------------------------------------------------------------------4. com.test.ServiceImpl import java.util.HashMap;import java.util.Map;import javax.ws.rs.GET;import javax.ws.rs.Path;import javax.ws.rs.PathParam;import javax.ws.rs.Produces;import javax.ws.rs.core.Response;import javax.ws.rs.core.Response.Status;@Path("/myservice/")@Produces("application/json")public class ServiceImpl implements IService { private static Map users = new HashMap(); static { users.put(1, new User(1, "foo")); users.put(2, new User(2, "bar")); users.put(3, new User(3, "baz")); } public ServiceImpl() { System.out.println("hello"); } @GET @Path("/users") public UserCollection getUsers() { return new UserCollection(users.values()); } @GET @Path("/user/{id}") public User getCustomer(@PathParam("id") Integer id) { return users.get(id); } @GET @Path("/users/bad") public Response getBadRequest() { return Response.status(Status.BAD_REQUEST).build(); }}That's it you are done. Your app structure would look similar to this:App--WEB-INF----lib----classes ----web.xml----deploy-context.xmlDeploy this app in the tomcat server and try hitting following urs:http://localhost:8080/TextCXF/hello/myservice/usershttp://localhost:8080/TextCXF/hello/myservice/user/1

Quality in Web Development

almost 6 years ago | Eduard Moldovan: eduardmoldovan.com - tech

I many times hear fellow developers say that this is only a admin, nobody is going to use it but us, or it is planned only for internal use.

sudo: cd: command not found

almost 6 years ago | Amit Kumar: RubyizednRailified

Ever tried this:Weird isn't it ?I checked the "/etc/sudoers" and everything looked normal:toamitkumar   ALL = (ALL) NOPASSWD: ALLI have sudo access - which means I have access to everything (thats what my understanding was)Well, I was wrong.After thinking for a while I felt - 'cd' is not a program, it is built-in for bash shell. So, I had to do:sudo -s or sudo su or sudo bashand then 'cd'.But be careful, that will open a shell for 'root' user.

HTML5 Geolocation

about 6 years ago | Eduard Moldovan: eduardmoldovan.com - tech

I am currently planning an experimental social network, where I needed geolocation. This way I came across this client side possibility, here is a simple example of it.

sudo: cd: command not found

about 6 years ago | Amit Kumar: toamitkumar's Code Blog

Ever tried this:Weird isn’t it ?I checked the “/etc/sudoers” and everything looked normal:toamitkumar   ALL = (ALL) NOPASSWD: ALLI have sudo access - which means I have access to everything (thats what my understanding was)Well, I was wrong.After thinking for a while I felt - ‘cd’ is not a program, it is built-in for bash shell. So, I had to do:sudo -s or sudo su or sudo bashand then ‘cd’.But be careful, that will open a shell for ‘root’ user.

How to start off the UI of your project

about 6 years ago | Oscar Villirreal: Digital Caveman

Back in the day one would have to create a series of fixed clases that would help you out through out the construction of your site. Classes that you now if chained with other clases would allow you to create very interesting and cool looking layouts. Today the answer is quite simple use html 5 […]