Logo

Who is talking?

Archive

My First Impression at #inspect2013 - RubyMotion Conference

over 4 years ago | Amit Kumar: toamitkumar's Code Blog

The first RubyMotion Conference #inspect2013 happened in Brussels, Belgium. It was a very well organized conference, lots of talented people, awesome speakers, good food and yes ‘Belgian Beer’ One Man Army - Laurent Sansonetti Many thanks to Laurent Sansonetti (@lrz) for making it successful. The general gist of what happened there. Below are my observations and opinions. What I saw at #inspect2013 - RubyMotion conference? For people who don’t know about RubyMotion: - http://www.rubymotion.com/developer-center/ - http://rubysource.com/laurent-sansonetti-on-rubymotion-internals/ - http://motioncasts.tv/ - vimeo.com/61255647 Observations/Opinions: The Community: Community plays a very important role in the success of Open Source Software. Even though RM is licensed, it has blessings from Ruby Community. Rubyists (including me) who have tried Obj-C in the past have found it verbose and complex. We all embraced RubyMotion because of its simplicity and more important being a developer friendly language - Ruby. At the conference I saw a lot of seasoned Obj-C developers who had tried RM and loved it. Now, they are using it for full fledged production applications. One of the big reason for this is Cocoa-Pods. They can still use their legacy Obj-C code / project in new a RM application. The build system takes care of linking and tying them during compilation. No need to re-invent the wheel, utilize the investment people have already done in iOS world. This is an interesting phenomenon because this is going to push the toolchain to next level. Contribution: It is less than a year and the RM community has grown exponentially from few rubyists to thousands of iOS developers. There has been tremendous contribution by people to build ruby-motion gems/libraries/wrappers around verbose Obj-C code.The list is very big but I should definitely mention: rubymotion-wrappers.com A lot of talks at the conference were about these libraries and wrappers. Focus on testing: Ruby Community has successfully induced the importance of testing the code. Though RM comes bundled with a testing framework, its hard to do UI testing on iOS and Obj-C has suffered a lot because of this. At the same time, it is unusual that Rubyists would not explore options to test their code on iOS platform. In the conference I got to learn some awesome frameworks out of which ‘motion-calabash’ is really good. It gives you BDD style testing similar to what we are familiar in Ruby/Rails world - Cucumber. You should definitely checkout https://github.com/calabash/motion-calabash . A sample app The one thing I would like to explore is the possibility to test my HTML5 phone-gaped application using 'motion-calabash'. When I am developing for mobile platform I miss Chrome Developer Tools a lot. Not any more. It blew my mind to see the demo by Colin Gray (@colinta). Motion-Xray: An iOS Inspector that runs inside your app, so you can debug and analyze from your device in real-world situations. It is amazing, go check it out Broader Reach: I was completely stunned to see presentation in a technological event by a visually impaired (I don’t mean to hurt anyone. I had never seen such a thing happening and it was a complete jaw-drop for me). Let me introduce Austin Seraphin (http://behindthecurtain.us/about/) . He is an iOS developer and iOS Accessibility Expert. He explains how iPhone and Accessibility changed his life. A completely new perspective. His slides if you are interested - I would urge to have a look at them. Trend and My Reaction: Laurent was the last to present at the conference - a noble decision I would say. He talked about roadmap and the future of RubyMotion. I see a focus shift to make the toolchain more developer friendly. Some highlights: High-level debugging support: right now it uses GDB technology which is pretty low-level. Documentation: add more documentation to make it easier for newbies. I definitely feel RM is going to change the way we are used-to doing native iOS development. So, don’t delay, hack and be awesome. Finally, here is the presentation (Building Interactive Data Visualization Charts) @rubymotion conference: Please share your thoughts. Enjoy !

My GoGaRuCo Presentation and Video

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

The presentation: And the video:

Permission denied (publickey)

over 5 years ago | Amit Kumar: toamitkumar's Code Blog

Adding the SSH keys on your github site is the simple solution. I am using 3 github sites; - 1 external - 2 behind the firewall Each have their different email address for security reasons. So, quite often, I get this error - if I mess up things. I was looking for a solution so that you can create a public rsa file for each github site. The solution was to create config inside ~/.ssh directory. The file: Host User git Port 22 Hostname github-site1.com IdentityFile ~/.ssh/github_site1_id_rsa TCPKeepAlive yes IdentitiesOnly yes Hostname github-site2.com IdentityFile ~/.ssh/github_site2_id_rsa Hostname github-site3.com IdentityFile ~/.ssh/github_site3_id_rsa Bingo !! I am sure there are other better ways to solve this problem. I would appreciate comments.

Agility and Component Driven Development

over 5 years ago | Amit Kumar: toamitkumar's Code Blog

Agile development has become the backbone of modern software development process. In a nutshell, it can be defined as - iterative, self-evolving incremental development that demands high collaboration and flexibility to change . Component driven development on the other hand augments to building reusable and testable components that be plugged together to form application foundation for delivering business functionality. In our current engagement with Firm Account, they have started providing IT tools/solutions to their clients supplementing the strategic solutions they have been providing so far. They wanted to deliver the solution with rapid-prototyping and Challenges The challenge was to deliver the solution in quick 2-3 months iterative cycles. The working software was to be delivered and handed over to IT department of the client. This meant the software has to be of high quality and maintainable with least amount of support Approach Each application we were building had certain common components. For eg: - Authentication - Work flow process - Data upload process - Data crunching and cleansing - Data export - User Management with corporate level security - Background processing for data manipulation - etc. This problem can be easily solved with Service Oriented Design Pattern. But since most of the deliverables were ‘leave behind’, we started to observe an evolving pattern of Component Driven Development. There was two approach to establish a pool of commonly required components. 1. Staff a team that is responsible for building common components 2. 'Tax' teams to contribute 'components', if they use any from the components library. The first seems more common but does not align with the paradigm of Agile Software Development. One team should not be responsible for building and maintaining the software. Over time this leads to quality compromises and delays in deliverables. Extracting common components from existing applications and taxing teams (who want to use from pool) to contribute to common pool did the magic. Initially leap was a little difficult. It took sometime for us to institutionalize the mind-set of building component -based software that can be contributed back to pool. Once the team was adept with this working process, the pool expanded and became rich. Impact and Benefits Redundant work, development time: Developing every system from scratch means redundant development of many of these re-usable components. These can be shared shared across multiple applications reducing development time. Time to market: Each application goes through rigorous process of QA and Security Assurance. This meant a lot of time was wasted testing the components that can be built and tested once. Using re-usable components reduced the time to market by ~40%. Expertise sharing: Software reuse supports the sharing of knowledge naturally. This helps in learning from peers and improves the quality of deliverables Focus on solving the actual business problem: Teams can focus on solving the business problem rather than spending time building the components that are common Rapid prototyping support: Reusable components can provide an effective basis for quickly building a prototype of a software system. This provides the opportunity to get customer feedback early in the life cycle, thus supporting the conception of requirements. Maintenance costs: Fewer defects can occur when proven components have been used, and less of the software system must be maintained. High quality: Error fixes occur from reuse to reuse. This yields higher quality for a reused component that would be the case for a component that is developed and used only once. What do you think ?

Migrate from Blogger to Octopress: Step-by-Step Guide

over 5 years ago | Amit Kumar: toamitkumar's Code Blog

After procastinating for quite sometime, I finally decided to migrate from blogger to Octopress using Jeklly and likes. In this post, I have tried to compile the steps in detail. Export xml from blogger Go to settings page of your blogger and click the “Export blog”, link as shown in the image below. This will open a modal pop-up window. Click on the “Download blog” button to download an xml output of all your posts. Store the downloaded xml somewhere on your machine. In the next section, we will see how to convert the xml into htmls by a running a ruby script. (Note: You should have ruby installed on your machine to run this script). Run gem install nokogiri to install ruby xml parser. Run the script to create markdown files Run the script below: ruby blogger_import.rb downloaded_blogger.xml require 'rubygems' require 'nokogiri' require 'fileutils' require 'date' require 'uri' # usage: ruby import.rb my-blog.xml data = File.read ARGV[0] doc = Nokogiri::XML(data) @posts = {} @drafts = {} def add(node) id = node.search('id').first.content type = node.search('category').first.attr('term').split('#').last case type when 'post' if published?(node) @posts[id] = Post.new(node) else @drafts[id] = Post.new(node) end when 'comment' reply_to = node.children.find {|c| c.name == 'in-reply-to' } post_id = reply_to.attr('ref') #post_id = node.search('thr').first.attr('ref') @posts[post_id].add_comment(Comment.new(node)) when 'template', 'settings', 'page' else raise 'dunno '+type end end def published?(node) node.at_css('app|control app|draft', 'app' => 'http://purl.org/atom/app#').nil? end def write(post, path='_posts') puts "Post [#{post.title}] has #{post.comments.count} comments" puts "writing #{post.file_name}" File.open(File.join(path, post.file_name), 'w') do |file| file.write post.header file.write "\n\n" #file.write "<h1>{{ page.title }}</h1>\n" file.write "<div class='post'>\n" file.write post.content file.write "</div>\n" unless post.comments.empty? file.write "<h2>Comments</h2>\n" file.write "<div class='comments'>\n" post.comments.each do |comment| file.write "<div class='comment'>\n" file.write "<div class='author'>" file.write comment.author file.write "</div>\n" file.write "<div class='content'>\n" file.write comment.content file.write "</div>\n" file.write "</div>\n" end file.write "</div>\n" end end end class Post attr_reader :comments def initialize(node) @node = node @comments = [] end def add_comment(comment) @comments.unshift comment end def title @title ||= @node.at_css('title').content end def content @content ||= @node.at_css('content').content end def creation_date @creation_date ||= creation_datetime.strftime("%Y-%m-%d") end def creation_datetime @creation_datetime ||= Date.parse(@node.search('published').first.content) end def permalink return @permalink unless @permalink.nil? link_node = @node.at_css('link[rel=alternate]') @permalink = link_node && link_node.attr('href') end def param_name if permalink.nil? title.split(/[^a-zA-Z0-9]+/).join('-').downcase else File.basename(URI(permalink).path, '.*') end end def file_name %{#{creation_date}-#{param_name}.html} end def header [ '---', %{layout: post}, %{title: "#{title}"}, %{date: #{creation_datetime}}, %{comments: false}, categories, '---' ].compact.join("\n") end def categories terms = @node.search('category[scheme="http://www.blogger.com/atom/ns#"]') unless Array(terms).empty? [ 'categories:', terms.map{ |t| t.attr('term') && " - #{t.attr('term')}" }.compact.join("\n"), ].join("\n") end end end class Comment def initialize(node) @node = node end def author @node.search('author name').first.content end def content @node.search('content').first.content end end entries = {} doc.search('entry').each do |entry| add entry end puts "** Writing PUBLISHED posts" FileUtils.rm_rf('_posts') Dir.mkdir("_posts") unless File.directory?("_posts") @posts.each do |id, post| write post end puts "\n" puts "** Writing DRAFT posts" FileUtils.rm_rf('_drafts') Dir.mkdir("_drafts") unless File.directory?("_drafts") @drafts.each do |id, post| write post, '_drafts' end This will generate _posts and _drafts directories with all relevant posts in html format. Install & Configure Octopress Follow the step by step guide here to setup octopress on your local. I have used github pages to deploy the Octopress blog but there are other options as well. Alsobe sure to check the blog confirguration section. Integrate plugins Octopress has options to integrate with 3rd party plugins like: Disqus Github Twitter Sample _config.yml file which I used in this blog setup. # ----------------------- # # Main Configs # # ----------------------- # url: http://toamitkumar.github.com title: RubyizednRailified Blog subtitle: Ruby, Rails and others. author: Amit Kumar simple_search: http://google.com/search description: toamitkumar # Default date format is "ordinal" (resulting in "July 22nd 2007") # You can customize the format as defined in # http://www.ruby-doc.org/core-1.9.2/Time.html#method-i-strftime # Additionally, %o will give you the ordinal representation of the day date_format: "ordinal" # RSS / Email (optional) subscription links (change if using something like Feedburner) subscribe_rss: /atom.xml subscribe_email: # RSS feeds can list your email address if you like email: # ----------------------- # # Jekyll & Plugins # # ----------------------- # # If publishing to a subdirectory as in http://site.com/project set 'root: /project' root: / permalink: /blog/:year/:month/:day/:title/ source: source destination: public plugins: plugins code_dir: downloads/code category_dir: blog/categories markdown: rdiscount pygments: false # default python pygments have been replaced by pygments.rb paginate: 5 # Posts per page on the blog index pagination_dir: blog # Directory base for pagination URLs eg. /blog/page/2/ recent_posts: 5 # Posts in the sidebar Recent Posts section excerpt_link: "Read on &rarr;" # "Continue reading" link text at the bottom of excerpted articles titlecase: true # Converts page and post titles to titlecase # list each of the sidebar modules you want to include, in the order you want them to appear. # To add custom asides, create files in /source/_includes/custom/asides/ and add them to the list like 'custom/asides/custom_aside_name.html' default_asides: [asides/about.html, asides/coderwall.html, asides/recent_posts.html, asides/twitter.html, asides/delicious.html, asides/pinboard.html, asides/googleplus.html] # Each layout uses the default asides, but they can have their own asides instead. Simply uncomment the lines below # and add an array with the asides you want to use. # blog_index_asides: # post_asides: # page_asides: # ----------------------- # # 3rd Party Settings # # ----------------------- # # Github repositories github_user: github_repo_count: 0 github_show_profile_link: true github_skip_forks: true # Twitter twitter_user: toamit twitter_tweet_count: 4 twitter_show_replies: false twitter_follow_button: true twitter_show_follower_count: true twitter_tweet_button: true # Google +1 google_plus_one: false google_plus_one_size: medium # Google Plus Profile # Hidden: No visible button, just add author information to search results googleplus_user: googleplus_hidden: false # Pinboard pinboard_user: pinboard_count: 3 # Delicious delicious_user: delicious_count: 3 # Disqus Comments disqus_short_name: toamitkumar disqus_show_comment_count: true # Google Analytics google_analytics_tracking_id: # Facebook Like facebook_like: true # Coderwall achievements coderwall_user: toamitkumar coderwall_endorse_me: true Customizing and Theming The link gives details of customizing the navigation bar, color schemes etc. There are few themes which can be used to change the aesthetics of the page and layout. Flaunt your achievement badges from coderwall Coderwall is the online reputation system for developers. It exposes a simple JSON representation of every profile. The api can used to show off ‘achievemnt badges’. Add the below script to source/_includes/asides/coderwall.html and add asides/coderwall.html to your default_asides array in _config.yml file. {% if site.coderwall_user %} <section> <h1>Coderwall Badges</h1> <ul id="cw_badges"> <li class="loading">Status updating...</li> </ul> <p id="badges"></p> <script type="text/javascript"> function show_achievements(args) { var badges = args["data"]["badges"]; var achievements = ""; for (var i = 0; i < badges.length; i++) { var alt_text = badges[i]["name"]; var title_text = badges[i]["name"] + ' - ' + badges[i]["description"]; achievements += '<a href="http://coderwall.com/{{site.coderwall_user}}/"><img src="' + badges[i]["badge"] + '" width="48" height="48" alt="' + alt_text + '" title="' + title_text + '" style="margin-top: 7px;margin-right: 4px;"' + '"/></a>'; }; document.getElementById("cw_badges").style.display = "none"; document.getElementById("badges").innerHTML = achievements; } </script> <script src="http://coderwall.com/{{site.coderwall_user}}.json?callback=show_achievements"></script> {% if site.coderwall_endorse_me %} <p><a href="http://coderwall.com/{{site.coderwall_user}}"><img src="http://api.coderwall.com/{{site.coderwall_user}}/endorsecount.png" /></a></p> {% endif %} </section> {% endif %} Make sure you also add: coderwall_user: coderwall_endorse_me: true This will also add endorse me link to your blog as shown below: Set re-direction from blogger to new Octopress blog Follow the steps below to setup re-direct from blogger to this new site. Design -> Layout -> Edit HTML Find <head> tag Add the following line below the <head> tag as below: <meta http-equiv="refresh" content="0;url=http://url_of_your_new_site.com"/> Save the file You are done, blogger will redirect to your new site. Thats it !! Hope this helps in setting your blog site using Octopress.

Ruby and RoR Course with exercise

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

@engineyard and @pivotallabs release an excellent course material and exercise for Ruby and Ruby on Rails.It is one of the best I have seen so far. Quotes from the repo: ”This course teaches experienced developers Ruby and Ruby-on-Rails. It’s designed to be taught by a practicing rubyist and a teaching assistant. Both individuals must have expert understanding of Ruby, Rack and Ruby-on-Rails.” The list of contributors: https://github.com/generalassembly/ga-ruby-on-rails-for-devs/blob/master/CONTRIBUTORS.mdCourse is structured to cover all the platforms (Linux, Mac and yesss Windows). It starts with basics and covers some advanced development guidelines.An excellent presentation by @dblockdotorg: http://www.slideshare.net/dblockdotorg/crafting-a-rubyonrails-course-for-developersMore resources: http://code.dblock.org/crafting-a-ruby-on-rails-course-for-developersIt is CDE –> Community Driven Education :)

File download indicator in browser

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

For last few days I have been struggling with a requirement to show file download indicator. Here’s the requirement.Web page has a link “Download File”. On click of this link - a JSON post request is sent to the server. The server generates the files based on the JSON input and streams back with Content-Disposition “attachment” for the browser to download. There are several ways to visually indicate the click of the link:Normal form post - Create a dynamic form and post it. On the server-side make sure content disposition is set to attachment. When browser receives the response, it pops the “Open-Save-Cancel” dialogue box.            Cons:               - No control of the page response time, page dies in case of timeouts               - Page refreshes and the current context of the user is lostAjax post - Do an Ajax form post with JSON data. Download “waiting” indicator can be easily initiated with ”Ajax prefilter”. In the response from the server send back the URL to download. Remove the “waiting” indicator. Change the window location to the URL and let the browser do the rest.            Cons:               - Retain the file on the server and run a background cleanupIframe post (recommended solution) - Create a dynamic form and post (target of the form) it to an iframe. Disable the download link, show the “waiting” indicator. Start the timer and look for presence of a cookie. If the cookie is found, remove the indicator and enable the link. This requires some server side code as well: adding the cookie. The detailed sample code:                              The client side code:                            The server-side code:                           Cons:               - Server has to set an extra cookieThe third approach has helped in solving for the following:1. Submit a JSON request to the server2. Show/Hide a “waiting” indicator3. Controlling the timeouts and indicate the user of delays (if any)4. File download handleLet me know if there are other ways of making it work.

Invalid gemspec in” and 'Illformed requirement'

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

If you have to solve the problem:

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.

RSpec::Core::Configuration::MustBeConfiguredBeforeExampleGroupsError

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

Came across this weird error: This had happened because I had RSpec 1 way of including spec_helper (in old files):require File.expand_path(File.dirname(__FILE__) + ‘/../spec_helper’)And the other way (in my new files):require ‘spec_helper’Synching them fixed it :))

! No such app as radiant-cloud-8241. (Heruko)

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

While pushing my rails application on heroku I stumbled across a weird error.Here are the steps:To look into details of the error, lets dig deep. Below are the steps I followed to resolve the issue.

Big Data Enterprisey Analytics and Ruby

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

My Ruby Conf 2011 presentation:At speakerdeck:or at slideshare Ruby conf’11 View more presentations from toamitkumar

Building JS Org Chart

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

Just released code to create inverted Organization Chart –> library here Comments Amit Kumar yeah I know it was done genius like you :) climboid those charts look awesome! you guys must be geniuses

Stacked waterfall charts in highcharts

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

Check out how to generate stacked waterfall charts using highchart js library.

Waterfall chart with Line Connectors

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

Update: the chart extension has evolved to produce waterfall charts with bubbles superimposed:Just committed JS extension to create Waterfall chartsLook at here for details Comments Anonymous I just downloaded your extension fromhttps://github.com/toamitkumar/waterfall-charts/downloads and the example returns an errorMyLib.js:33 TypeError: 'undefined' is not a function (evaluating '$.lineConnector([[i+0.38, data[i].y], [i+0.62, data[i].y]])')I'm using safari 5.1.2. Thought I'd let you know.

Install rubygems without rdoc/ri

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

If you ever want to disable generating rdoc and ri when you install a ruby gem:Add this to your ~/.gemrc:install: –no-rdoc –no-riupdate: –no-rdoc –no-ri

Testing Extended Devise Controllers

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

Devise has become the de-facto library if you ever need Authentication. Tonnes of pluggable components which you can easily enable/disable.For our application we had to reset session and easiest and cleanest way to do was to extend the devise - SessionsController:For testing this piece:With smiling face I ran the spec buuuuuuttttttttttttttttt arrrrggghhhh:AbstractController::ActionNotFoundChecking the devise filters helped with some direction:Have fun !! Comments Amit Kumar Glad this helped you.. !! Shlomo Brilliant. Thanks.