How do I check if a file exists in AWS S3 bucket using Rails3

Amazon_S3_Online_Service-123

Introduction

Amazon S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. While uploading a file to S3 we need to check whether the file exists to avoid any data duplication.

Steps to check the presence of a file

Step#1

Add the below in your gem file,

[sourcecode]gem ‘aws-s3′[/sourcecode]

Then run the bundle,

[sourcecode]bundle install[/sourcecode]

Step#2

Modify your model as,

[sourcecode]require ‘aws/s3’

def  is_file_exist?
AWS::S3::Base.establish_connection!( :access_key_id => ‘S3_KEY’, :secret_access_key => ‘S3_SECRET’)
return AWS::S3::S3Object.exists? attachment_id, “<YOUR_BUCKET_NAME>”
end[/sourcecode]

It is preferred to have the s3 credentials on the config folder and use it from the config file.

Step#3

Now modify your controller where you want to check the existence of the file,

[sourcecode]current_user.is_file_exist? #return true if exists[/sourcecode]

Easy method to avoid data redundancy in secured AWS S3.

Read Also: How to use Amazon S3 Bucket with Paperclip to store images in Rails3

I hope you find this useful. If you want to develop application in rails or want to deploy app in AWS cloud, then Andolasoft is the ideal and cost savvy option for you.  Have something to add to this topic? Share it in the comments.

AWS-Elastic Beanstalk VS Custom Environment Solution

Amazon_S3_Online_Service-123 (1)

AWS has a beautiful feature named Elastic Beanstalk to deploy application in AWS cloud with minimal knowledge on environment setup. Currently it supports Ruby, Java, Node.js, python and PHP applications. But the question is, “should we use Elastic Beanstalk for a low/ medium traffic application?

Advantage:

  • The Elastic Beanstalk is a fully automatic feature for application deployment and versioning
  • AWS has pre-setup templates that can be used like LAMP stack, Ruby Stack
  • Helps to provide single management interface to monitor the activity of your environments like EC2, ELB and S3

Disadvantage:

  • Since this does not support micro instance the cost of for Small instance or higher configuration instance to AWS is redundant
  • There are some limitations to customize the ELB after deployment.
  • AWS scales up and down the resources based on metrics. It supports Elastic Beanstalk on a single metric.
  • AutoScaling cannot be configured with CPU parameters and Network traffic.

Finally, it can be said that Elastic beanstalk is the best fit for application environments that require very little customization with heavy traffic. As it doesn’t support Micro instances, so it is advisable to use customizable environments for low traffic applications.

Top Reasons To Bring RoR Development On Board

ror411-123

Rails is an innovation in development framework.  It encompasses all the necessary elements to boost a web application’s performance. This framework is designed to address agile development and deliver productivity as well as flexibility to RoR developers. Developed using Ruby programming language, it has transformed the world of web development through its practical approach.

Ruby on Rails is built upon two programming philosophies

  • “Convention over Configuration”: Developers only need to write codes for the irregular or unconventional aspects of the web application.
  • “Don’t Repeat Yourself”: The data is stored in definite place. It saves time and reduces code

Advantages of Ruby on Rails

  • Faster Development: Rails framework enables the developers to write concise and clear syntax and produces fewer codes than its competitors. Therefore it requires less time to code and generates fewer errors. On the other hand it facilitates the programmers to maintain much less code. It is also enabled to integrate numerous tools to automate repetitive tasks such as managing database errors, creating forms etc. it simplifies development process because the language is lightweight and easily readable, almost like the natural language.
  • Increases productivity: Rails framework is specifically featured to reduce the development aspects of applications, instead leveraging creativity and uniqueness of the web application. It empowers productivity by eliminating repetitive programming codes.
  • Assists development of creative interfaces: Rails includes numerous integrations to enable developers in creating rich, intriguing user interfaces. Integrated JavaScript framework is easier to activate and features elements like apparition progressive, drag & drop and many more to ease the designing aspects of the application.
  • Model View Controller design pattern: Rails is developed on MVC architecture that separates the development logics from the presentation layer. It provides a well-structured application to the developers and the code is maintained in a logical and coherent manner.  It encourages abstraction in the application and enables the team to work on separate modules without depending on each other. It focuses on the features rather than minute details. Rails framework delivers ease of project development, conciseness and faster deployment of application.

Rails Development makes web app development easier because it involves less coding while implementing new changes and updates into the development process. It enables the organizations to meet all the business requirements within the budget and schedule.

SwiftKey has unveiled its version 4 keyboard app for Android devices

androidimg

To be completely honest, most android users are not satisfied with the android’s default keyboard. It can be fiddly for some users, who write languages other than English on a daily basis. After all it doesn’t cater to everyone’s typing style either. However “SwiftKey” has always proved to be the best keyboard app alternative for the android platform. This time the developers at SwiftKey have launched its version 4 for the android devices

One of the best features of this keyboard is its ability to gradually learn the user’s typing preferences. It studies how a user writes over time and generates predictive texts for him, which is surprisingly accurate and better than any other applications. SwiftKey has also included its swipe like feature called the SwiftKey Flow which lets the user type sentences without lifting finger from the mobile screen. SwiftKey now supports over 60 international languages.

Here are some of the most notable features in version 4 release:

  • SwiftKey Flow is a gesture typing feature that facilitates the users to write sentences simply by gliding over the keys. It also adds auto-correction ability as-well-as predicts the possible next words while typing.
  • It can also be blend with tap inputs and switching mid-word.
  • If the predicted word is correct then it can be inserted by simply lifting the finger off.
  • Flow through space lets the user type a complete sentence in one motion without lifting the finger, to give spaces between the words.
  • It supports word prediction for over 60 languages like Javanese, Sundanese, and Vietnamese etc with both auto-correction and word prediction abilities.
  • Easier correction and auto adaptability to users typing style.

According to reports Android application development with SwiftKey’s SDK now supports iOS, JVM, Linux, Mac OS-X, Windows, and C++ etc. SwiftKey had released its Flow feature in the last October and its Beta version was tested with a community of million users.  Being awarded numerous times for its keyboard application, it surely is one of the best android keyboard apps, plus it comes with a reasonable price.

Watch out for the latest Security Patch to deal authentication bypass for RoR

ror41Ruby on Rails framework developers have been continuously releasing security updates since the last two weeks. Its recent updates like 3.0.20 and 2.3.16 versions were to address the remote code execution vulnerability. This was the third security patch released this month. The developers have mentioned that the updates released are extremely important, and have advised the users of 3.0.x and 2.3.x rails framework to update as soon as possible.

The security update will fix the vulnerability in the Rails JSON code. That allowed the hackers to bypass authentication system and inject random SQL into the application database. It occasionally performed denial-of-service attack too. The rails developers have also pointed out that currently it supports only the 2.3.x, 3.1.x, and 3.2.x versions and might release an update for 3.0.x version.

Most recent vulnerability was identified as CVE-2013-0333, which was patched in the framework on 8th of Jan. The Ruby on Rails developers using Rails 2.3 and 3.0 are also advisable to install the new fixes even if they have installed the fix for CVE-2013-0156 earlier.

 

Brief Summery

  • Affected Versions are: 2.3.x, 3.0.x
  • Unaffected Versions are: 3.1.x, 3.2.x, and applications using yajl gem
  • Fixed Versions are: 3.0.20, 2.3.16

Mobile App Developers Directory For Developers And Project Listing

Many resources have revealed that the current era is the age of smart-phone industries. Consumers are looking for smart devices more than ever, and not just for the platform but because of a huge library of apps that can be installed on the device. So developing mobile applications for the devices has become the new challenge for the mobile app development industry. So companies are in continuous search for mobile app developers to build their application. But finding the right developers is not an easy task.

To get rid of this, Andolasoft has developed ‘Orangegigs’, a free mobile app developer directory, using Ruby on Rails. Objective is to meet the mobile app developers with mobile development companies. The website features simple functionalities with a fresh look and feel to the users.

Never miss an update from us. Join 10,000+ marketers and leaders.

Here the companies don’t have to register to post their requirements similarly the developers can apply for a job without being a member. Companies including individual recruiters across the globe can list their mobile development projects for different mobile platforms such as iPhone, iPad, Android, Blackberry, Windows phone and PhoneGap.

Mobile app developers can easily browse through the listed companies and contact them directly based on the location and the technology platform they work. The website is also integrated with popular social media plug-ins like facebook, twitter and Google+ to share their projects to the social networking sites. It includes couple of filters for location and platform. Also this filter helps to build SEO friendly URLs which are loved by crawlers.

With these feature-rich facilities orangegigs.com evolved into the most preferred mobile app developer directory among the companies. Wanna give it a try? Go ahead and do it at www.orangegigs.com