TIP : Showing login failure message in devise views in rails

While working with devise gem, I need to show the failure messages like “Invalid username / password” (As shown in the below image) when user enters a wrong username/password. I have added the flash massage to show the error as shown in below code in app/view/devise/sessions/new

Hope this helps

Read More

Tip : Making email as optional (not mandatory) field in devise in Rails

This situation arises, when we need to login through a different unique key other than email and wanted email to be optional in the entry form. Prerequisites Make sure in config/initializers/devise.rb to set the config.authentication_keys to some other field (not email, which is default) in devise.rb

Now, let’s do In the model rb (user.rb

Read More

Multiple Submit buttons in a single view in Rails

While working in an assignment, I have to dealt with view where I have to re-send the verification code form the same view in which I have to accept the verification code. As shown in the image, “Confirm” and “Resend code” both are 2 submit buttons. I need to resend another code from the same

Read More

[Fixed] CSS loading issue after fixing ExecJS::ProgramError in page

I have manage to fix my ExecJS::ProgramError as mentioned in my last post.

The error got disappeared as soon as I change the “application” to “default”. But the issue I faced now is, my app is unable to locate and load the CSS and JS. None of the styles got loaded.

I tried to inspect the issue. Looked into the source rendered in the browser by choosing the “view source” option.


From the source it looks like the app is trying to locate the default.css and default.js, which is not present.

Fix I followed

Read More

Fixing ExecJS::ProgramError in page

How I got the issue Created a new project in rails $ rails new StaticPageDemo Added static_page controller to it with home action $ rails generate controller static_page home Ran the server $ rails server Got this error while tried to access the page in http://localhost:3000/static_page/home Solution After some search in Google, I got a

Read More

A Factory Design Pattern Example

What is a Factory Design Pattern ?

This is a creational design pattern. It encapsulate the object creation logic from the user by creating a logical separation between the object creation and use.

How we will do it ?

We will gather and create a family of classes having almost similar features. Then we will create a factory class to create and return the desired objects.

Let me do it…

We will consider creating documents in this example.

As a first step let us create an interface and call it as iDocument

We will create classes for separate documents and inherit them from iDocument

Read More

Creating a custom alert view in Android using C#

As mentioned in my earlier post, we can use the default AlertDialog class to display the alerts of screen by setting different properties and methods of it. But still there sounds like, we may need dialogs on screen which would be needed to be customized. They can be accept user inputs, can display an arranged info of an user etc.

How to do it ?

We will follow few simple steps

  • Create a custom view
  • Render the custom view in AlertDialog

Create a custom view

Let’s add a new layout to the project under Resources > layout.

Read More

Quick Tips : Displaying an Alert in Android using MonoDroid

Displaying an informational alert on screen

Let’s just display a quick informative popup, which will only display an alert on screen with a title and a message in it. It actually gets closed when the back button get touched.


Let’s display the OK and Cancel button

We will add OK and Canel button. On click of the buttons, it will display a quick Toast message on screen in order
to differentiate which button is clicked.

Read More

More data in a row : Android Listview using Xamarin

What do you want ?

I just wanted to add a date along with the each place of earthquake that is in the list in my previous blog.

We can use any of the way, like ListActivity or adding a ListView control to the Layout. Here I am going to do it with the ListView control.

Steps to do it

Pretty simple steps.

  • Add a Listview to the layout
  • Create a class or dictionary to contain the custom list of data
  • Customize the Adapter to contain the custom data
  • Use the custom Adapter instead of the default Adapter

Read More

A simple way to show listview in Android using Xamarin

Ways to do it

There are basically 2 ways to do it in Android.

  • Using the Listview control
  • Using the ListActivity

By using ListActivity

In this way we don’t need to define any Listview in our AXML page. Just few lines of code will do it.

Read More

1 2 3
%d bloggers like this: