Sunday, September 21, 2014

How to use Flag Icons

Other Day I was facing problem in showing Flag icons against the country names. From where I should get all the icons and also I need to add all those icons on the images folder.

Then I found out a very cool way. CSS-SPRITES..
In this you download a single image to browser and based on pixel's shows the image.

Flag sprite can we obtained from following link Flag-Sprite

Wednesday, September 17, 2014

Meet a new Deadly UI framework

I was just trying to find out a alternative of Twitter Bootstrap. I then stumbled on Semantic-UI.

Semantic comes out with flying colors when I wrote a simple web-app with it. If this is properly supported , it will be a game-changer in how HTML/CSS is written.

Testing Webpages with AJAX requests locally

There can be cases where you might need to test the web-pages locally within your source tree and without deploying on web server.

Recently I faced a situation where I have to test my AngularJS App where I am using partials(templates). Partials are loaded through AJAX. If I tried to open the page in browser ,it stops me giving the Cross-Origin exception.

However there’s a simpler and lightweight solution for the lazy ones. You can use Python’s SimpleHTTPServer. It comes already bundled with python so you don’t need to install or configure anything at all!
So cd to your project directory, for instance
  • cd /home/erick/mysuperproject and then simply use
  • python -m SimpleHTTPServer And that’s it, you’ll see this message in your terminal
  • Serving HTTP on 0.0.0.0 port 8000 ... So now you can go back to your browser and visit http://0.0.0.0:8000 with all your directory files served there. You can configure the port and other things, just see the documentation. But this simply trick works for me when I’m in a rush to test a new library or work out a new idea.

Thursday, August 14, 2014

BitBucket V/S GitHUb

Read following link for better information:

http://www.infoworld.com/d/application-development/bitbucket-vs-github-which-project-host-has-the-most-22706

Ruby/Rails installation on Windows 64 bit platform

Need to tread carefully if you want to install Ruby 2.0 on Windows 64 bit. Read the Ruby Installer download page carefully and pick up the correct packages.

http://rubyinstaller.org/downloads/

Need to be careful on the DevKit you choose to install with Ruby Verison.

I successfully tested with following

Wednesday, August 13, 2014

How to Install Ruby/ROR on RHEL

Step 1 Install RVM
Install latest stable version of RVM on your system using following command. This command will automatically download all required files and install on your system.
# curl -L get.rvm.io | bash -s stable
Step 2: Setup RVM Environment
RVM provides a shell script to setup system environment before installing Ruby. Use below command to setup rvm environment.
# source /etc/profile.d/rvm.sh
Step 3: Install Ruby
After completing setup of RVM environment, lets install Ruby language using following command.
# rvm install 2.1.2
[Sample Output]
ruby-2.1.2 - #removing src/ruby-2.1.2..
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/6/i386/ruby-2.1.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.1.2, this may take a while depending on your cpu(s)...
ruby-2.1.2 - #downloading ruby-2.1.2, this may take a while depending on your connection...
ruby-2.1.2 - #extracting ruby-2.1.2 to /usr/local/rvm/src/ruby-2.1.2...
ruby-2.1.2 - #configuring.....................................................
ruby-2.1.2 - #post-configuration.
ruby-2.1.2 - #compiling....................................................................................
ruby-2.1.2 - #installing................................
ruby-2.1.2 - #making binaries executable..
Rubygems 2.2.2 already available in installed ruby, skipping installation, use --force to reinstall.
ruby-2.1.2 - #gemset created /usr/local/rvm/gems/ruby-2.1.2@global
ruby-2.1.2 - #importing gemset /usr/local/rvm/gemsets/global.gems.............................................................
ruby-2.1.2 - #generating global wrappers.........
ruby-2.1.2 - #gemset created /usr/local/rvm/gems/ruby-2.1.2
ruby-2.1.2 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.1.2 - #generating default wrappers.........
ruby-2.1.2 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.1.2 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
Step 4: Setup Default Ruby Version
Use rvm command to setup default ruby version to be used by applications.
# rvm use 2.1.2 --default

Using /usr/local/rvm/gems/ruby-2.1.2
Step 5: Check Current Ruby Version.
Using following command you can check the current ruby version is used.
# ruby --version

ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux]
Step 6: Install Rails.
Using following command you can check the current ruby version is used.
# gems install rails

Tuesday, May 20, 2014

Bug in Android Webview and Tomcat

Recently while working on a Android Web-App with Tomcat as a back-end , I discovered a bug in the CORS handling of Tomcat.

Please see the discussion of it on following links

StackOverflow
Tomcat Forums




Friday, April 25, 2014

Allow AJAX call from Android webview,

settings.setAllowFileAccessFromFileURLs(true);

What is CORS..

https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials

How to enable Chrome remote debugging from Web View

Configure WebViews for debugging

The Enable USB web debugging setting in Chrome doesn't affect WebViews. To debug the contents of your WebView, you need to enable it programmatically from within your application by calling setWebContentsDebuggingEnabled, a static method on the WebView class.

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    WebView.setWebContentsDebuggingEnabled(true);
}


This setting applies to all of the application's WebViews. Note that web debugging is not affected by the state of the debuggable flag in the application's manifest. If you want to enable web debugging only when debuggable is true, test the flag at runtime.


if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    if ( 0 != ( getApplcationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE ) ) {
        WebView.setWebContentsDebuggingEnabled(true);
    }
}