Lately i started working on some applications on ANDROID and i was facinated with the design & features ANDROID provides. For those who have not yet started on ANDROID i have created a presentation that may help.
Things to know for effective coding
Why Git Why Not SVN? Security The key difference between the two systems seems to be the model itself. Where Subversion offers a centralized model, Git provides a decentralized model. At the risk of over simplification, this means that Git offers each developer their very own, fully autonomous copy of the entire repository....
Fast-track your Web apps with Ruby on Rails Fast-track your Web apps with Ruby on Rails Ruby on Rails is a recent entry into the world of Web application development that is rapidly gaining mindshare, even while still in beta versions. Rails succeeds by automating the creation of the most common types of Web applications while not straightjacketing...
Mutable and Immutable Objects Mutable objects : 1)Mutable objects are objects whose state can change. 2)In Ruby, Mutability is a property of an instance. 3)Any instance can become immutable by calling the "freeze". Immutable objects : 1)Immutable objects are objects whose state never changes after creation. 2)Immutable...
Code Analyzers for PHP Code analyser functions:- Checks code for error Checks code for syntax Show linkages between various modules Detects code duplication Doxygen Doxygen can be configured to render nice inheritance graphs with graphviz. It can help you in three ways: It can generate an on-line...
PHP forAndroid.apk HOWTO install and test The video shows how to install PHP on Amdroid and start building your PHP apps for Android PHPforAndroid.apk HOWTO install and test from irontec on Vimeo.
Posted (Amit) in Android on 06-03-2013
Lately i started working on some applications on ANDROID and i was facinated with the design & features ANDROID provides. For those who have not yet started on ANDROID i have created a presentation that may help.
Posted (Amit) in General on 16-12-2012
Posted (Amit) in General on 09-09-2012
Posted (Amit) in General on 19-08-2011
Security
The key difference between the two systems seems to be the model itself. Where Subversion offers a centralized model, Git provides a decentralized model. At the risk of over simplification, this means that Git offers each developer their very own, fully autonomous copy of the entire repository. With Subversion, each developer has their own working copy, but commits changes to a single, central repository.
Speed
Since each developer has a local copy of the entire repository, fundamental actions like diff, commit, etc. are all local. That’s always going to be faster. Fast is good.That said, server interaction with Subversion isn’t exactly excessive. Developers work in local working directories and only interact with the server in short time.
Smaller Space Requirement
A Subversion working directory contains two copies of the entire code base. One that is actually being worked on and another tucked away in the .svn directory. Repository required ~12Gb of storage in Subversion and ~420Mb in Git.
Key’s for Branches
1. Creating branches in Git is a lot easier than doing this in SVN.
2. When merging the branch back, SVN didn’t know where that branch started. Git keeps track where branches come from. So when creating a branch, merging back is very simple.
3. When merging the branch back, each change was recorded back as the user who did the merge By the Git where as SVN doesn’t. Git keeps commit messages intact, when merging.
Posted (Amit) in Featured, Ruby on Rails on 28-06-2011
Fast-track your Web apps with Ruby on Rails
Posted (Amit) in General on 28-06-2011
Posted (Amit) in Ruby on Rails on 28-06-2011
To delete a particular record we will go for delete or destroy methods.But according to the names both looks very similar, but the functionality wise both are different. so lets check the difference between delete and destroy methods in Active Record.
Now first check what the delete method will do:
Delete method deletes the row with a primary key matching the id argument, using a SQL DELETE statement, and returns the number of rows deleted. Active Record objects are not instantiated, so the object‘s callbacks are not executed, including any :dependent association options or Observer methods.
You can delete multiple rows at once by passing an Array of ids.
It is much faster than the destroy method, skipping callbacks might bypass business logic in your application that makes the function to work fast.
example:
Delete a single row
user.delete(1)
Delete multiple rows
user.delete([2,3,4])
Destroy method:
The destroy method makes the SQL call to the database and destroys the row in the table that contains it. It does still allow you to manipulate the object in the application as long as it’s still in scope (i.e) the callbacks and
filters are allowed even after destroying the object.
example :
Destroy a single object
User.destroy(1)
Destroy multiple objects
users= [1,2,3]
User.destroy(users)
Posted (Amit) in Ruby on Rails on 28-06-2011
Rails 3:
Rails is a framework to develop web applications in Ruby. And the web application in Rails will be simpler and faster than in other languages. As, rails is an opinionated software, in the development process of an application, rails will do assumptions about our requirements and will generate the required code for the application at various stages, with a little interaction of the developer for few specifications.
Rails has a philosophy includes the following:
1) DRY: (Don't Repeat Yourself)
In rails, it suggests that writing the same code again and again for several times is not a good process. Instead of writing the same code again and again, we can partition that particular part of code in to a seperate block or function or something else and can reuse it whenever and wherever we need it in the current application.
2) Convention over Configuration:
In rails, almost the process of development will be done using the conventions instead of a * configuration settings for our application. If we follow the conventions (guidelines of rails) in development process, everything will be taken care by rails about our application.
3) REST: (Representational State Transfer)
In rails, REST will have two main features. They are:
a) Using resource identifiers like URLs to represent the resources of our application.
b) Transferring the representations of the state of a particular resource among system components.
REST will be useful for routing in our applications for the specification of path for a particular resource. And REST consists of HTTP verbose for our application like:
a) POST b) GET c) PUT d) DELETE.
MVC architecture:
The MVC architecture in Rails application has:
1) Model:
Model will consist of the data about our applications and is used to manipulate the content of models (tables). It will contain the validations, rules and set of guidelines to manipulate our models.
2) View:
View will consist of the templates of html pages, which will be visible for public/user. It will purely concentrate on the representation of data our application.
3) Controller:
Controller is the thing which will have the control over both Model and View. The Controller will receive the requests from the user (from views) and will send that request to respective model to have the information, and will pass the data to the users in form of a view.
The representation of MVC Architecture will be as follows:
View————————–Controller———————–Model
(User interface)————–(Controllers)——————(Databases)
Posted (Amit) in Featured, Ruby on Rails on 28-06-2011
Mutable objects :
1)Mutable objects are objects whose state can change.
2)In Ruby, Mutability is a property of an instance.
3)Any instance can become immutable by calling the "freeze".
Immutable objects :
1)Immutable objects are objects whose state never changes after creation.
2)Immutable objects are thread-safe(A piece of code is called as thread-safe ,if it functions correctly during simultaneous execution by multiple threads).
Freezing Objects:
1:The freeze method in class Object prevents you from changing an object, effectively turning an object into a constant.
2:After we freeze an object, an attempt to modify the freezed object, results in TypeError.
3: freeze operates on an object reference, not on a variable.
4:This means that any operation resulting in a new object.
Example:
str = 'A simple string. '
str.freeze
begin
str << 'An attempt to modify.'
rescue => err
puts "#{err.class} #{err}"
end
# The output is – TypeError can't modify frozen string
Amit Yadav is Stephen Fry proof thanks to caching by WP Super Cache