Wireframe.cc
Easel
PowerMockup
Jumpchart
Axure
Thursday, 4 September 2014
Monday, 1 September 2014
Generate or use generated graph inside pdf (prawn gem)
List of gems available for graph generation inside pdf or after generation can be
shown
inside pdf. By using cron job can frequently clean the directory to avoid memory problem.
prawn-graph - https://github.com/HHRy/prawn-graph/
gruff - https://github.com/topfunky/gruff
prawn_charts - https://github.com/MrPowers/prawn_charts
Using GChart with Prawn - http://pagodaworks.com/2013/10/16/using-gchart-with-prawn/
Prawn::Graph - Simple Graphing for Prawn
(http://ryanstenhouse.eu/projects/2010/02/12/prawn-graphs-simple-graphing-for-prawn/)
(http://www.ruby-doc.org/gems/docs/p/prawn-graph-0.0.4/index.html)
Wednesday, 27 August 2014
Web development discussion,ror question and answers
server question and answers
1.difference between application server and web server
ruby questions and answers
1.difference between module an class
You might also use a module when you have shared methods across multiple apps.
¦ class ¦ module ¦
¦---------------+------------------------------------+-----------------------------------------------------------------------¦
¦ instantiation ¦ can be instantiated ¦ can't be ¦
¦ usage ¦ object creation ¦ mixin facility. provide a namespace. ¦
¦ superclass ¦ module ¦ object ¦
¦ consists of ¦ methods, constants and variables ¦ methods, constants and classes ¦
¦ methods ¦ class methods, instance methods ¦ module methods, instance methods ¦
¦ inheritance ¦ inherits behavior and can ¦ No inheritance ¦
¦ ¦ be base for inheritance ¦ ¦
¦ inclusion ¦ can't be included ¦ can be included in classes/modules by using the include command ¦
¦ ¦ ¦ (includes all instance methods as instance methods in class/module) ¦
¦ extension ¦ can not extend with extend command ¦ module can extend instance by using extend command (extends given ¦
¦ ¦ (only with inheritance) ¦ instance with singleton methods from module) ¦
+----------------------------------------------------------------------------------------------------------------------------+
Classes are simply like Java classes.
Modules are like Java static classes. Think about Math class in Java. You don't instantiate it, and you reuse the methods in the static class (eg. Math.random()).
2.return types in ruby method
1. default return last value
2. explicitly value can also be returned.
3. only one return statement can be used
4. with one return statement multiple values can be sent.
3.class level methods and object methods
(www.railstips.org/blog/archives/2009/05/11/class-and-instance-methods-in-ruby/)
Class and Instance Methods in Ruby
Class methods are methods that are called on a class and instance methods are methods that are called on an instance of a class. Here is a quick example and then we’ll go into a bit more detail.
class Foo
def self.bar
puts 'class method'
end
def baz
puts 'instance method'
end
end
Foo.bar # => "class method"
Foo.baz # => NoMethodError: undefined method ‘baz’ for Foo:Class
Foo.new.baz # => instance method
Foo.new.bar # => NoMethodError: undefined method ‘bar’ for #<Foo:0x1e820>
See the difference? bar is a class method, so calling bar on the Foo class works fine. baz is an instance method, so calling baz on the Foo class raises a NoMethodError. Then, on the next couple lines, we call both methods on an instance of Foo (Foo.new).
Now that we have a base, let’s show a few of the ways you can create class and instance methods and examples of what they would be used for.
Class Methods
Ruby is very flexible and as such it allows several ways to define a class method. The following is a sample of the most commonly used ways.
# Way 1
class Foo
def self.bar
puts 'class method'
end
end
Foo.bar # "class method"
# Way 2
class Foo
class << self
def bar
puts 'class method'
end
end
end
Foo.bar # "class method"
# Way 3
class Foo; end
def Foo.bar
puts 'class method'
end
Foo.bar # "class method"
The first way is my preference. When I see self.method_name it is immediately apparent to me that this is a class method. A lot of people use way #2 and it is pretty heavily used in Rails.
There is nothing wrong with it, but when you have a class with a lot of class methods in a class << self block, it can be hard to tell if the method is a class or instance method because it is defined the same (def bar). If this doesn’t make sense, feel free to use it for a while and you’ll probably run into what I’m talking about.
Way 3 is not that common as far as I have seen and is more often a way to quickly add methods on the fly to a class. These are not the only three ways to define class methods, but they seem to be the ones that I see the most.
So when would you use a class method? Class methods are for anything that does not deal with an individual instance of a class. ActiveRecord::Base#find is one example. If you look in ActiveRecord::Base, you’ll see something like this:
module ActiveRecord
class Base
# some stuff
class << self
def find(...)
# blah
end
end
end
end
Looks familiar, eh? Some other uses of class methods in Rails are validations and associations in ActiveRecord and before/after/around filters in ActionPack. The way this works is something like this (simplified for clarity):
module ActiveRecord
class Base
def self.validates_presence_of(...)
# make sure present
end
end
end
class Foo < ActiveRecord::Base
validates_presence_of :bar
end
When you say validates_presence_of, the class method in AR::Base is what gets called.
Instance Methods
Enough about class methods, lets move on. Instance methods are a bit more simple. Here are a few common ways that instance methods are defined.
# Way 1
class Foo
def baz
puts 'instance method'
end
end
Foo.new.baz # "instance method"
# Way 2
class Foo
attr_accessor :baz
end
foo = Foo.new
foo.baz = 'instance method'
puts foo.baz
# Way 3
class Foo; end
foo = Foo.new
def foo.bar
puts 'instance method'
end
Foo.new.baz # "instance method"
The key difference is instance methods only work with an instance and thus you have to create a new instance to use them (Foo.new). Again, there are more ways to define instance methods than this, especially if you look into meta programming.
So what are some examples uses of instance methods in Rails, to give you a better idea? Ever do a find in a destroy action and then call destroy on the found instance? destroy is an instance method.
class FoosController < ActionController
def destroy
foo = Foo.find(params[:id])
foo.destroy
redirect_to foos_url
end
end
So are save and update_attributes, which you have definitely used before if you’ve done any Rails.
foo = Foo.new(:title => 'Bar')
foo.save # is an instance method
4.how to tranafer values between methods
(http://praaveenvr.blogspot.in/2014/03/ruby-on-rails-how-to-pass-variable.html)
If you want to share the value across the methods of a same controller instance then, declare an instance variable:
class BarsController < UsersController
before_filter :init_foo_list
def method1
render :method2
end
def method2
@foo_list.each do | item|
# do something
end
end
def init_foo_list
@foo_list ||= ['Money', 'Animals', 'Ummagumma']
end
end
If you want to share the value across two controllers withn a session, then:
class BarsController < UsersController
before_filter :init_foo_list
def method1
render :controller => "FoosController",
:action => "method2"
end
def init_foo_list
params[:shared_param__] ||= ['Money', 'Animals', 'Ummagumma']
end
end
class FoosController < UsersController
def method2
params[:shared_param__].eachdo | item|
# do something
end
end 2.return types
end
5.Abstract classes & Interfaces
There is no concept of abstract class and interface in ruby.
Another way to look at this issue is to think
of static typing as working like an aristocracy: Statically typed languages are constantly asking about your parent or grandparent, or perhaps, in the case of Java-style interfaces, your aunts and uncles. In a statically typed language, an objects family tree matters deeply. Dynamically typed languages, by contrast, are meritocracies:Types, Safety, and Flexibility
They are concerned with which methods you have, rather than where those methods came from. Dynamically typed languages rarely ask about an objects ancestry; instead, they simply say, I dont care who you are related to, Mac. All I want to know is what you can do.
6.why ruby doesn't support multiple inheritance?
7. Multiple inheritance in ruby
Both Java and Ruby doesn't support multiple inheritance. Where in Ruby we can achieve multiple inheritance by including multiple modules. this concept is called mixin.
8.keywords in ruby
The keywords are not objects but defined in the parser which can be found in parse.y in the Ruby source. Here's the relevant part from that file:
reswords : keyword__LINE__ | keyword__FILE__ | keyword__ENCODING__ | keyword_BEGIN | keyword_END | keyword_alias | keyword_and | keyword_begin | keyword_break | keyword_case | keyword_class | keyword_def | keyword_defined | keyword_do | keyword_else | keyword_elsif | keyword_end | keyword_ensure | keyword_false | keyword_for | keyword_in | keyword_module | keyword_next | keyword_nil | keyword_not | keyword_or | keyword_redo | keyword_rescue | keyword_retry | keyword_return | keyword_self | keyword_super | keyword_then | keyword_true | keyword_undef | keyword_when | keyword_yield | keyword_if | keyword_unless | keyword_while | keyword_until ;
9.difference between each and map
each simply iterates over the given enumerable, running the block for each value. It discards the return value of the block, and each simply returns the original object it was called on:
[1, 2, 3].each do |i| i + 1 end # => [1, 2, 3]
This is simply a nicer, more universal way of doing a traditional iterating for loop, and each is muchpreferred over for loops in Ruby (in fact, I don't think I've ever used a for loop in Ruby).
map, however, sets the current element being iterated over to the return value of the block, and then returns a new object with those changes:
[1, 2, 3].map do |i| i + 1 end # => [2, 3, 4]
So it "maps" each element to a new one using the block given, hence the name "map".
10.mixins
1.Inside module creating object methods and this module is inherited(multiple inherited) by other classes.
2.So this module is available as class to the other class.
3. Module allowing other class to access its object method.
4. This is the reason behind the name 'mixins'
5.mixture of module,class,object method
11.Difference between render and redirect_to
(http://stackoverflow.com/questions/7493767/are-redirect-to-and-render-exchangeable)
12.difference between require an include
(http://ionrails.com/2009/09/19/ruby_require-vs-load-vs-include-vs-extend/)
The require statement is similar to the include statement of C and C++ and the import statement of Java. If a third program wants to use any defined module, it can simply load the module files using the Ruby require statement:
ex:
require "Week"
class Decade
include Week no_of_yrs=10 def no_of_months puts Week::FIRST_DAY number=10*12 puts number end
end
d1=Decade.new puts Week::FIRST_DAY Week.weeks_in_month Week.weeks_in_year d1.no_of_months
13.module inside the class an class inside the module
14.relationships in sql
15.relationships in mongodb
16.difference between mongodb and mongoid/mango mapper
17. Agile development
1.pair programming
2.knowledge transfer
3.code re-factoring
4.daily stand up meets
5.no overtime
6.Continuous integration
7.story based or module based work(some times order of work/task execution)
8.User stories and users choosing a deck for next release
9.Small releases
10.Coding standards
11.Continuous iterations
12.test driven development
13.extreme programming
14.Tests first when find bugs
15. UML based approach
Scrum: A key principle of Scrum is its recognition that during a project the customers can change their minds about what they want and need (often called requirements churn), and that unpredictable challenges cannot be easily addressed in a traditional predictive or planned manner. As such, Scrum adopts an empirical approach—accepting that the problem cannot be fully understood or defined, focusing instead on maximizing the team's ability to deliver quickly and respond to emerging requirements.
the top 10 most effective agile practices (as reported by respondents) were:
Continuous Integration
Daily Stand Up Meeting
Developer TDD
Iteration Planning
Code Refactoring
Retrospectives
Pair Programming
Active Stakeholder Participation
Potentially Shippable Software
Burndown Tracking
Nobody used pair programming except in panic situations (major bug fix in zero time), managers still just don't buy into the idea at all - and I'm talking AT ALL, which is a shame as I quite like it. User stories and users choosing a deck for next release - doesn't really work unless the users really really buy in, which I've not seen yet. Users in my area always say that everything is of top importance, they cannot live without any of it. I personally just rephrase into "what order should I personally work on these tasks in your opinion?".
Test driven dev - very little of this happens, but a lot of unit tests get written (after the code does though), so a near miss imho
Continuous integration - this is highly dependent on the team, in last 5 years all my teams had it, but it often lapsed (broken build) for days/weeks at a time before it got attention. A lot of people still don't buy into this.
Refactoring often - this is actually getting some serious buy-in. Refactoring is a skill that if you don't have is likely to be a serious problem.
Small releases - this (in my work) is generally the norm anyway, although probably being done
Coding standards - yes
Collective code ownership - blame is still pretty much rife, and often a "bad" module never really gets fixed cos the coder that produced it just fixes and fixes it till it "works".
No overtime - nearly, but highly dependent on the team lead - I've seen the worst stuff (death marches) going on within a few feet of my team...
Tests first when find bugs - this happens in my experience. Is a very good thing.
18. ORM
ORM is Object Relational Mapper. It means you don't have to manually call the database yourself; the ORM handles it for you.
Ruby on Rails uses one called ActiveRecord, and it's a really good one.
ORM allows you to do things such as:
User.find(50).contacts
Instead of manually writing a SELECT statement with JOINs, WHEREs, etc.
ex : JAVA
(http://stackoverflow.com/questions/7493767/are-redirect-to-and-render-exchangeable)
19. when,where to use object,class variables?
http://rubymonk.com/learning/books/4-ruby-primer-ascent/chapters/45-more-classes/lessons/113-class-variables
class Planet
@@planets_count = 0
def initialize(name)
@name = name
@@planets_count += 1
end
def self.planets_count
@@planets_count
end
end
Planet.new("earth"); Planet.new("uranus")
p Planet.planets_count
stdout:
2
class ApplicationConfiguration
@@configuration = {}
def self.set(property, value)
@@configuration[property] = value
end
def self.get(property)
@@configuration[property]
end
end
class ERPApplicationConfiguration < ApplicationConfiguration
end
class WebApplicationConfiguration < ApplicationConfiguration
end
ERPApplicationConfiguration.set("name", "ERP Application")
WebApplicationConfiguration.set("name", "Web Application")
p ERPApplicationConfiguration.get("name")
p WebApplicationConfiguration.get("name")
p ApplicationConfiguration.get("name")
stdout:
"Web Application"
"Web Application"
"Web Application"
class Foo
@foo_count = 0
def self.increment_counter
@foo_count += 1
end
def self.current_count
@foo_count
end
end
class Bar < Foo
@foo_count = 100
end
Foo.increment_counter
Bar.increment_counter
p Foo.current_count
p Bar.current_count
stdout:
1
101
20. modules
a.Modules provide a namespace
b.Modules implement the mixin facility.
namespace :
module Trig
PI = 3.141592654
def Trig.sin(x)
# ..
end
def Trig.cos(x)
# ..
end
end
module Action
VERY_BAD = 0
BAD = 1
def Action.sin(badness)
# ...
end
end
require "trig" require "action"
y = Trig.sin(Trig::PI/4) wrongdoing = Action.sin(Action::VERY_BAD)
mixin
21.Why Ruby Does Not Support Method Overloading?
There may be only one method with given name in Ruby class. If several methods with the same name defined in the class - the latest overwrites previous definitions.
However, you may emulate methods overloading like this:
class Person
def print_details(*args)
case args.size
when 1 "Hey My Name is #{args[0]}" when 2 "Hey My Name is #{args[0]} and #{args[1]}" end
end end
22. access specifiers in ruby
23.difference symbol ans string
Rails questions and answers
1.Difference between plugin and gem
2.Defference between gem in vender/gems and gems
3.rake routes GET POST DELETE (HTTP request method)?
(HTTP request method)?
GET
POST
PATCH ( previous versions of Rails used PUT in place of PATCH)
DELETE
The hypertext transfer protocol (HTTP) defines the basic operations GET, POST, PATCH, andDELETE. These refer to operations between a client computer (typically running a web browser such as Firefox or Safari) and a server (typically running a web server such as Apache or Nginx). (It’s important to understand that, when developing Rails applications on a local computer, the client and server are the same physical machine, but in general they are different.) An emphasis on HTTP verbs is typical of web frameworks (including Rails) influenced by the REST architecture, which we saw briefly inChapter 2 and will start learning about more in Chapter 7.
GET is the most common HTTP operation, used for reading data on the web; it just means “get a page”, and every time you visit a site like google.com or wikipedia.org your browser is submitting aGET request. POST is the next most common operation; it is the request sent by your browser when you submit a form. In Rails applications, POST requests are typically used for creating things
4.difference between erb and html, purpose of erb?
ERb is the primary template system for including dynamic content in web pages
5.The asset pipeline(refer http://ruby.railstutorial.org/ chapter-5)
Manifest files
Preprocessor engines
6.alternative for javascript,css,html (coffee script,sass,erb)
7.things to follow in ROR
(reference 12factor.net)
a. MVC
b. when to use what (javascript,css,html or coffeescript,sass,erb)
c. separation between styles,script and erb.
d. time delay between between activerecord and mysql(type of db we use).
e.should follow http request method(get,post,patch,delete)
8. x.min.js will make any sense because pre-processor engines default remove unwanted spaces.
9.Difference between .js and min.js
jquery.js = Pretty and easy to read :) Read this one.
jquery.min.js = Looks like jibberish! But has a smaller file size. Put this one on your site.
Both are the same in functionality. The difference is only in whether it's formatted nicely for readability or compactly for smaller file size.
Specifically, the second one is minified, a process which involves removing unnecessary whitespace and shortening variable names. Both contribute to making the code much harder to read: the removal of whitespace removes line breaks and spaces messing up the formatting, and the shortening of variable names (including some function names) replaces the original variable names with meaningless letters.
All this is done in such a way that it doesn't affect the way the code behaves when run, in any way. Notably, the replacement/shortening of variable and function names is only done to names that appear in a local scope where it won't interfere with any other code in other scripts.
10.unobtrusive JS
The benefits of unobtrusive JavaScript won’t really appear until our web application has a lot more JavaScript in it as then the advantages of having all of the scripts in a separate file and being able to remove duplication begin to show themselves.
11. difference between include, load, require, extend
12. metaprogramming
13. difference bwtwen render and redirect
14 about mongo db
15. sql database modeling
16. about scrum
17. custom routes(http://guides.rubyonrails.org/routing.html#naming-routes)
18. ORM
19.What Is the Difference Between a Block, a Proc, and a Lambda in Ruby?
20.http://awaxman11.github.io/blog/2013/08/05/what-is-the-difference-between-a-block/
Wednesday, 20 August 2014
freelancers directory
Curated Matching Services
Managed clubs that vet both freelancers and client projects.
10x Management
Concept Cupboard
YunoJuno
Crew
WorkMob
Codeable
OnSite
Coding Cupboard
ProtoExchang
Hopwork
Envato Studio
Toptal
Hillgate
WriterAccess
WorkFu
Folyo
Coworks
MyStaffNow
Towoglo
Working Not Working
matchist
gun.io
Freelance Job Boards
Forums where clients post jobs and freelancers can respond.
Freelancers.net
Djangogigs
HN Hiring
GetACoder
Programming Bids
Major Marketplaces
The biggest sites for bidding for work – many jobs and millions of users.
WorkMarket
Freelancer.com
PeoplePerHour
Guru
Elance
oDesk
reference : http://www.lancelist.com/
Discussion about CI+CD+Code Metrics ruby on rails application
https://www.linkedin.com/groupItem?view=&gid=120725&type=member&item=5898059890714234881&commentID=5908096653742587904&report%2Esuccess=8ULbKyXO6NDvmoK7o030UNOYGZKrvdhBhypZ_w8EpQrrQI-BBjkmxwkEOwBjLE28YyDIxcyEO7_TA_giuRN#commentID_5908096653742587904
Tuesday, 19 August 2014
Ruby on Rails environment settings
rvm(ruby version manager)
RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.
gemset
RVM gives you compartmentalized independent ruby setups. This means that ruby, gems and irb are all separate and self-contained - from the system, and from each other.
Instructions for initial setup (RVM, gemset)
step 1
sudo apt-get install curl
step 2
\curl -L https://get.rvm.io | bash -s stable
step 3
source ~/.rvm/scripts/rvm
step 4
rvm requirements
step 5
rvm install ruby / rvm install ruby -v 1.9.3
get into rails project directory
step 6
rvm use 1.9.3 (select ruby version)
step 7
rvm gemset create gemset_name
step 8
rvm gemset use gemset_name
step 9
bundle install
(install rails through gem. ex : gem install rails -v '3.2')
once setup is done, follow instructions to select already created gemset.
get into rails project directory
rvm list (shows different ruby version installed)
rvm use ruby_version (ex: rvm use 1.9.3)
rvm gemset list (shows list of gemset created )
rvm gemset use gemset_name (ex: rvm use app)
start installing gems......
now can able to have project specific gems
rvmrc
There are 3 types of rvmrc files: system, user, and project.
System (/etc/rvmrc)
The system rvmrc file is loaded before RVM initializes and before the user's ~/.rvmrc. /etc/rvmrc settings are applied to all users on the system.
User ($HOME/.rvmrc)
The users rvmrc file overwrites settings in /etc/rvmrc and is loaded before RVM initializes. $HOME/.rvmrc settings are applied only for the user belonging to $HOME.
Project (project_directory/.rvmrc)
The project .rvmrc file is different than the system & user. System & user rvmrc files are meant for altering the settings and behavior of RVM as a whole. The project rvmrc files are intended to be used to setup your project's ruby environment when you switch to the project root directory.
As of RVM 1.8.0, after a survey where greater than 80% of respondants wanted the feature on by default, automatic loading of project .rvmrc files is opt-out by default (therefore on).
Instructions for rvmrc (project_directory/.rvmrc)
a. create .rvmrc file in project directory
b. add rvm_version@gemset_name in .rvmrc file. ex: rvm ruby-1.8.7-head@test
Sunday, 27 July 2014
Blogs for rails with ajax
http://www.reinteractive.net/posts/34-ruby-on-rails-3-2-blog-in-15-minutes-step-by-step-part-2
http://carmennorahgraydean.blogspot.in/2012/10/rails-328-ajax-super-basic-example.html
http://twocentstudios.com/blog/2012/11/15/simple-ajax-comments-with-rails/
http://www.alfajango.com/blog/rails-3-remote-links-and-forms-data-type-with-jquery/
http://sonijigaurav.blogspot.in/2012/05/jquery-autocomplete-in-rails-32-and.html
http://richonrails.com/articles/basic-ajax-in-ruby-on-rails#.U9DrPNtOARg
http://code.tutsplus.com/tutorials/using-unobtrusive-javascript-and-ajax-with-rails-3--net-15243
Wednesday, 23 July 2014
The Web Platform Podcast
Reference:
https://www.linkedin.com/groups/Web-Platform-Podcast-Episode-1-120725.S.5895523959436247044?view=&item=5895523959436247044&type=member&gid=120725&trk=eml-b2_anet_digest-group_discussions-2-grouppost-disc-0&midToken=AQG9Gz0Dg5g6Qw&fromEmail=fromEmail&ut=0HL6r7UhdyBSk1
Episode 1: RubyNation & Ruby's Cultural Impact
http://thewebplatform.today/rubynation-rubys-cultural-impact
Episode 2:
Prototyping with Purpose
http://thewebplatform.today/prototyping-with-purpose
Tuesday, 22 July 2014
gems for ruby on rails web applications
credits goes to link (http://www.linkedin.com/groups/15-best-gems-ruby-on-120725.S.5891190483421519872?trk=eml-b2_anet_digest-group_discussions-2-grouppost-disc-0&gid=120725&view=&midToken=AQG9Gz0Dg5g6Qw&ut=3AVUJM0hpuBCk1&item=5891190483421519872&type=member&fromEmail=fromEmail)
Devise (https://rubygems.org/gems/devise): Since some years ago, it represents the authentication mechanism preferred by all Rails developers. Powerful, flexible, allows to integrate with OAuth authentication systems with a minimal effort.
Haml (https://rubygems.org/gems/haml): Allows you to write valid XHTML concisely. The learning curve is relatively short.
Gritter (https://rubygems.org/gems/gritter): After years of flash messages in the classic div in the page, we moved to Growl like notifications. Thanks to these pop-ups, we can show our flash messages in any page in a completely non-invasive and elegant way.
Cells (https://rubygems.org/gems/cells): Cells can really keep our controllers very skinny. We use it to represent and caching some boxes, like “recommended items”, “top users” and so on. I really like Cells over the use of helpers.
FriendlyId (https://rubygems.org/gems/friendly_id): A perfect gem to make our url seo friendly.
SimpleForm (https://rubygems.org/gems/simple_form): We use it primarily for its excellent integration with Bootstrap and for its ease of use.
Paperclip (https://rubygems.org/gems/paperclip): Despite the years, it still remains the reference point for attachments management .
Kaminari (https://rubygems.org/gems/kaminari): Useful gem to manage paginated collections .
Cancan (https://rubygems.org/gems/cancan): Our choice to manage permissions. We never have had the need to use some other solution .
Resque (https://rubygems.org/gems/resque) or Delayed Job (https://rubygems.org/gems/delayed_job): Both are valuable supports to manage background processes. If you do not have enough resources to set up a Redis server, we recommend Delayed Job.
Sunspot (https://rubygems.org/gems/sunspot): After a brief period with thinking_sphinx, we have moved to this very powerful indexing engine. Thanks to Solr, we can easily implement geolocated full text searches. The only problem is that you need to configure a dedicated Tomcat server. If you do not have these resources, we recommend using pg_search (https://rubygems.org/gems/pg_search) with a Postgres database or the old but still valid meta_search (http://rubygems.org/gems/meta_search) .
ActiveAdmin (https://rubygems.org/gems/activeadmin): When it is necessary to set up a back office administration in a short time, here is the right gem. Powerful, fairly customizable, ideal for simple administration interfaces.
Letter opener (https://rubygems.org/gems/letter_opener): Useful to test sending emails simply by opening them in a browser window .
RSpec (https://rubygems.org/gems/rspec): A perfect gem to test our models in a BDD way.
Capybara (https://rubygems.org/gems/capybara) : In addition to unit test the models, we like to create a suite of acceptance tests. Capybara allows you to test all the application’s user stories relatively quickly.
Haml (https://rubygems.org/gems/haml): Allows you to write valid XHTML concisely. The learning curve is relatively short.
Gritter (https://rubygems.org/gems/gritter): After years of flash messages in the classic div in the page, we moved to Growl like notifications. Thanks to these pop-ups, we can show our flash messages in any page in a completely non-invasive and elegant way.
Cells (https://rubygems.org/gems/cells): Cells can really keep our controllers very skinny. We use it to represent and caching some boxes, like “recommended items”, “top users” and so on. I really like Cells over the use of helpers.
FriendlyId (https://rubygems.org/gems/friendly_id): A perfect gem to make our url seo friendly.
SimpleForm (https://rubygems.org/gems/simple_form): We use it primarily for its excellent integration with Bootstrap and for its ease of use.
Paperclip (https://rubygems.org/gems/paperclip): Despite the years, it still remains the reference point for attachments management .
Kaminari (https://rubygems.org/gems/kaminari): Useful gem to manage paginated collections .
Cancan (https://rubygems.org/gems/cancan): Our choice to manage permissions. We never have had the need to use some other solution .
Resque (https://rubygems.org/gems/resque) or Delayed Job (https://rubygems.org/gems/delayed_job): Both are valuable supports to manage background processes. If you do not have enough resources to set up a Redis server, we recommend Delayed Job.
Sunspot (https://rubygems.org/gems/sunspot): After a brief period with thinking_sphinx, we have moved to this very powerful indexing engine. Thanks to Solr, we can easily implement geolocated full text searches. The only problem is that you need to configure a dedicated Tomcat server. If you do not have these resources, we recommend using pg_search (https://rubygems.org/gems/pg_search) with a Postgres database or the old but still valid meta_search (http://rubygems.org/gems/meta_search) .
ActiveAdmin (https://rubygems.org/gems/activeadmin): When it is necessary to set up a back office administration in a short time, here is the right gem. Powerful, fairly customizable, ideal for simple administration interfaces.
Letter opener (https://rubygems.org/gems/letter_opener): Useful to test sending emails simply by opening them in a browser window .
RSpec (https://rubygems.org/gems/rspec): A perfect gem to test our models in a BDD way.
Capybara (https://rubygems.org/gems/capybara) : In addition to unit test the models, we like to create a suite of acceptance tests. Capybara allows you to test all the application’s user stories relatively quickly.
Links:
http://tenmiles.com/blog/2012/06/25-ruby-on-rails-gems-for-rapid-prototyping/
http://blog.teamtreehouse.com/10-must-have-ruby-gems
http://www.intridea.com/blog/2011/5/13/rails3-gems
http://girders.org/blog/2011/06/02/rails31-application-architecture/
Tuesday, 15 July 2014
learn html,css,rails,javascript,jquery online
1.codepen.io
2.http://www.codeschool.com/
3.http://www.lynda.com
4.http://www.codecademy.com/tracks/php
5.http://www.sitepoint.com/
6.http://teamtreehouse.com
7.https://tutsplus.com/
8.https://www.learnstreet.com/lessons/study/ruby#get-hint (rails)
9.http://tutorials.jumpstartlab.com/(rails)
10 http://tutorials.jumpstartlab.com/paths/advanced_rails_five_day.html
ruby gems for cron job
1.gem Whenever
2.gem Craken
3.gem delayed_job (longer job)
4.gem Rufus scheduler
5.gem backgroundrb (run scheduled tasks as well as tasks that take too long for the normal client/server relationship)
6. gem resque-scheduler
7. rake approach
8. gem daemons
whenever
http://subhashmohan.wordpress.com/2010/03/27/rails-crontab-with-whenever-gem/
http://dzoba.com/162/
https://shellycloud.com/documentation/running_periodic_tasks
http://learnaholic.me/2012/10/10/backing-up-postgresql-with-backup-and-whatever-gems/
http://ruthienachmany.github.io/blog/2013/08/10/sidekiq-redis-cron-jobs/
http://blog.wyeworks.com/2009/8/10/scheduling/
http://rubydoc.info/github/javan/whenever/frames (HHH)
http://eewang.github.io/blog/2013/03/12/how-to-schedule-tasks-using-whenever/(HHH)
http://stackoverflow.com/questions/285717/a-cron-job-for-rails-best-practices(HHH)
Monday, 14 July 2014
Get start with MEAN stack(expressjs, mongodb, nodejs)
Installation
http://thecodebarbarian.wordpress.com/2013/07/22/introduction-to-the-mean-stack-part-one-setting-up-your-tools/
Express with mongodb
http://pixelhandler.com/posts/develop-a-restful-api-using-nodejs-with-express-and-mongoose
http://scotch.io/tutorials/javascript/build-a-restful-api-using-node-and-express-4
http://backbonetutorials.com/nodejs-restify-mongodb-mongoose/
http://webapplog.com/express-js-and-mongoose-example-building-hackhall/
http://blog.ijasoneverett.com/2013/11/getting-started-with-mongoose-and-node-js-a-sample-comments-system/
http://theholmesoffice.com/node-js-express-and-mongoose/
simple html form which captures Name, Email, Address and call javascript . The javascript program should validate, and php to store the information in the database(mysql).
<html>
<head>
<script>
function validation()
{
// name
var a = document.form.name.value;
if (a == "")
{
alert("Please Enter Your name");
document.form.name.focus();
return false;
}
if ((a.length < 5) || (a.length > 15))
{
alert("Your Character must be 5 to 15 Character");
document.form.name.focus();
return false;
}
if (!isNaN(a))
{
alert("Please Enter Only Characters");
document.form.name.select();
return false;
}
//email
var b = document.form.email.value;
if(b == "")
{
alert("Please Enter Your email");
document.form.email.focus();
return false;
}
if(b)
{
filter = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (!filter.test(b))
{
alert("Please enter valid email");
return false;
}
}
// address
var c = document.form.address.value;
if(c == "")
{
alert("Please Enter Your address");
document.form.address.focus();
return false;
}
if ((c.length < 5) || (c.length > 15))
{
alert("Your Character must be 5 to 15 Character");
document.form.address.focus();
return false;
}
}
</script>
<title>Simple Form</title>
</head>
<body>
<form action="<?php $_PHP_SELF ?>" method="post" name="form" onsubmit="return validation()">
Name:<input type="text" name="name"/><br>
Email:<input type="text" name="email"/><br>
Address:<input type="text" name="address"/><br>
<input type="submit" value="Submit"/>
</form>
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$address = $_POST['address'];
if ($name == '' || $email == ''|| $address == '')
{
echo 'plz fill the required field';
}else {
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'root';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
$sql = 'INSERT INTO persons '.
'(name, email, address) '.
"VALUES ('$name', '$email', '$address')";
mysql_select_db('phpform');
if(!empty($name))
{
$retval = mysql_query($sql, $conn);
if(! $retval )
{
die('Could not enter data: ' . mysql_error());
}
echo "Entered data successfully\n";
}
mysql_close($conn);
}
?>
</body>
</html>
Simple html form which captures Name, Email, Address, posts to a php program. The PHP program will validate, and store the information in the database.
<!DOCTYPE HTML>
<html>
<head>
<style>
.error {
color: #FF0000;
}
</style>
</head>
<body>
<?php
$nameErr = $emailErr = $addrErr = "";
$name = $email = $address = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["name"])) {
$nameErr = "Name is required";
} else {
$name = test_input($_POST["name"]);
if (!preg_match("/^[a-zA-Z ]*$/", $name)) {
$nameErr = "Only letters and white space allowed";
}
}
if (empty($_POST["email"])) {
$emailErr = "Email is required";
} else {
$email = test_input($_POST["email"]);
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) {
$emailErr = "Invalid email format";
}
}
if (empty($_POST["address"])) {
$addrErr = "Address is required";
} else {
$address = test_input($_POST["address"]);
}
}
function test_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
//db side
if ($name == '' || $email == '' || $address == '') {
echo 'plz fill the required field';
} else {
$dbhost = 'localhost:3036';
$dbuser = '*****';
$dbpass = '*****';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if (!$conn) {
die('Could not connect: ' . mysql_error());
}
$sql = 'INSERT INTO persons ' .
'(name, email, address) ' .
"VALUES ('$name', '$email', '$address')";
mysql_select_db('phpform');
if (!empty($name)) {
$retval = mysql_query($sql, $conn);
if (!$retval) {
die('Could not enter data: ' . mysql_error());
}
echo "Entered data successfully\n";
}
mysql_close($conn);
}
?>
<h2>PHP Form Validation Example</h2>
<p><span class="error">* required field.</span></p>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
Name: <input type="text" name="name" value="<?php echo $name; ?>">
<span class="error">* <?php echo $nameErr; ?></span>
<br><br>
E-mail: <input type="text" name="email" value="<?php echo $email; ?>">
<span class="error">* <?php echo $emailErr; ?></span>
<br><br>
Address: <input type="text" name="address" value="<?php echo $address; ?>">
<span class="error">* <?php echo $addrErr; ?></span>
<br><br>
<input type="submit" name="submit" value="Submit">
</form>
<?php
echo "<h2>Your Input:</h2>";
echo $name;
echo "<br>";
echo $email;
echo "<br>";
echo $address;
?>
</body>
</html>
php program which reads the contents of the file and then print the Number of words, Number of chars, Number of spaces, Number of special chars, Number of digits.
<?php
$datas = (file("test.txt"));
$word_count = 0;
$character_count = 0;
$spaces_count = 0;
$splchars_count = 0;
$digits_count = 0;
foreach ($datas as $array => $data) {
//word count
$word_count += str_word_count($data);
//character count
$character_count += strlen($data);
//spl character count
$spl = str_split($data);
foreach ($spl as $bit) {
if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $bit)) {
$splchars_count += 1;
}
}
//numbers count
$num = str_split($data);
foreach ($num as $bit) {
if (preg_match('!\d+!', $bit)) {
$digits_count += 1;
}
}
}
$spaces_count = $word_count - 1;
$character_count -= $spaces_count;
echo 'word_count = ' . $word_count;
echo '--';
echo 'character_count = ' . $character_count;
echo '--';
echo 'spaces_count = ' . $spaces_count;
echo '--';
echo 'special_chara_count = ' . $splchars_count;
echo '--';
echo 'digits_count = ' . $digits_count;
?>
Thursday, 10 July 2014
links to start with drupal
first read
https://www.drupal.org/node/877140
https://www.drupal.org/videocasts
http://codekarate.com/blog/best-way-learn-drupal
drupal instellation
https://help.ubuntu.com/community/Drupal
tutorial
http://ilovedrupal.com/videos/1/learn-drupal-7-one-hour-installing-acquia-drupal-part-28
http://drupalize.me/series/site-building-drupal-7-series
http://codekarate.com/blog/best-way-learn-drupal
http://friendlymachine.net/
videos
http://drupalcamp24x7.org/
http://nodeone.se/en/four-weeks-of-drupal (complete reference)
http://drupalonlinetraining.com/
http://www.youtube.com/user/learnbythedrop
http://blip.tv/learnbythedrop
E-Books
http://www.amazon.com/Pro-Drupal-Development-John-VanDyk/dp/1590597559
http://www.scribd.com/doc/79121057/Building-Your-Blog-With-Drupal-7
http://www.scribd.com/doc/2473970/Beginners-Guide-to-Drupal
Rails useful blogs
1.(url : http://sreeharikmarar.blogspot.in/
url : http://techazzist.wordpress.com/)
2.http://anilpunjabi.tumblr.com/
3. http://makandracards.com
4. http://marklunds.com
5. http://blog.joshsoftware.com/
6. Railscasts
7. http://rubylearning.com/blog/
8. http://weblog.jamisbuck.org/
9. http://m.onkey.org/
10.http://pivotallabs.com/community/blogs/ (H)
11. http://asciicasts.com/
12.http://www.edgerails.info/
13. http://www.allerin.com/blog/
14. http://www.railstips.org/
15. http://www.rubyinside.com/archives
16.http://jeffkreeftmeijer.com/
17 http://stackoverflow.com/questions/505678/what-are-the-best-ruby-or-rails-blogs
18. http://rorguide.blogspot.in/
19.http://ryanbigg.com/
20.http://www.planetrubyonrails.com/pages/channels
21.http://www.railstips.org/
22.http://technews-homepage.com/
23.http://rubyshow.com/
24.http://www.rubyflow.com/
25.https://shellycloud.com/
26.http://railsrumble.com/
27.http://www.rubyinside.com
28.http://www.toranbillups.com
29.http://larsgebhardt.de/
30.http://www.opinionatedprogrammer.com
31.http://www.42.mach7x.com/
32.http://deepakrip007.wordpress.com/
33.
http://12factor.net/
Links to get start with android
http://developer.android.com/tools/workflow/index.html
http://androidprogrammingstuff.blogspot.in/2012/08/execution-flow-of-android-application.html
http://pivotal.github.io/robolectric/
http://www.vogella.com/articles/Android/article.html
http://cleancodedevelopment-qualityseal.blogspot.com/2012/12/first-android-app-step-by-step.html
http://www.bogotobogo.com/Android/android11JUnitTest.php
for webservice
http://www.techrepublic.com/blog/app-builder/calling-restful-services-from-your-android-app/1076
Subscribe to:
Posts (Atom)