Klairvoyant infosolution's Blog

CSS Buttons

john

1) in css file

.button, .button:visited{
background: #222 url(overlay.png) repeat-x;
display: inline-block;
padding: 5px 10px 6px;
color: #fff;
text-decoration: none;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
border-bottom: 1px solid rgba(0,0,0,0.25);
position: relative;
cursor: pointer
}
.small.button, .small.button:visited{ font-size: 11px}
.button, .button:visited,.medium.button, .medium.button:visited
{
font-size: 13px;
font-weight: bold;
line-height: 1;
text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
}
.large.button, .large.button:visited
{
font-size: 14px;
padding: 8px 14px 9px;
}
.super.button, .super.button:visited
{
font-size: 34px;
padding: 8px 14px 9px;
}
.pink.button, .pink.button:visited{ background-color: #6b32b2; }
.pink.button:hover{ background-color: #44177c; }

2)
<a class=”super button pink”>Pink Button</a>
<a class=”large button...

Read more

Forms in rails, different ways

john

1) Method 1

a) input.html.erb

<form action=”/look/at”>
<input type=”text” name=’text1′>
<input type=”checkbox” name=”checkbox1″>
<input type=”radio” name=”radio1″ value=”red”>Red
<input type=”radio” name=”radio1″ value=”green”>Green
<input type=”radio” name=”radio1″ value=”blue”>Blue
<select name=”select1″>
<option value=’green’/> Green
<option value=’Blue’/> Blue
<option value=’Red’/> Red
<option value=’Orange’/> Orange
</select>
<select name=”select2[]” multiple size=”3″>
<option value=’AC’/> AC
<option value=’Music system’/> Music Syatem
<option value=’Heater’/> Heater
<option value=’auto...

Read more

Amazon Product Advertising API Interface in Rails

john

1) In gem file add the following and bundle it.

gem ‘amazon_product’

2)

configure the request object in controller

a) req = AmazonProduct['us']

b)req.configure do |c|
c.key    = ‘YOURKEY’
c.secret = ‘YOURSECREAT’
c.tag    = ‘YOURTAG’
end

get your key,secret etc…  from

https://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key

c) req << {
:operation    => ‘ItemSearch’,
:search_index => ‘All’,
:Keywords => ‘Book’,
:response_group => ['ItemAttributes','Images'],
:Version=> ‘2011-08-01′
}

3) get the results
@resp = req.get

code in view

<% @resp.each(‘Item’) do | item |%>
<%#*http://www.amazon.com/dp/<%= item['ASIN'] %>

<%g =item['MediumImage'].nil? %>

<% if g==false %>
<%item['MediumImage'].each  do | img|%>
<% if img[0]==”URL” %>
...

Read more

Paypal with rails-Using Active merchant

john

) gem install activemerchant

2) create two paypal test accounts 1)Business 2) personal

copy the following information which will be created while creating business account

API Username,API Password and Signature

location:- https://developer.paypal.com/

3) code the following in a ruby file ex “purchase.rb”

require “rubygems”
require “active_merchant”

ActiveMerchant::Billing::Base.mode=:test

gateway=ActiveMerchant::Billing::PaypalGateway.new(
:login=> “API username”,
:password=>”API Password”,
:signature=>”signature”
)
# here the credit card information of the personal test account

credit_card=ActiveMerchant::Billing::CreditCard.new(
:type=>”visa”,
:number=>”4582849457729927″,
:verification_value=>”000″,
:month=>01,
:year=>2013,
:first_name=>”John”,
:last_name=>”M V”
)
if credit_card.valid?
...

Read more

Open Source Ruby On Rails Applications

john
Read more

IDE for rails

john
Read more

mentioning version and database for rails new project

john

rails _3.0.8_ new myproject -d mysql

where  -d for mentioning what database we use

Read more

How to get data from heroku to your system

john

1) Install the latest heroku gem
2) Install taps gem

3) execute the command heroku db:pull

for more
1) http://devcenter.heroku.com/articles/taps
2)http://blog.heroku.com/archives/2009/3/18/push_and_pull_databases_to_and_from_heroku/

 

Read more

ERROR: Could not find a valid gem ‘1.2.3.’ (>= 0) in any repository

john

Install  as the following form

gem install rack –version=1.2.3.

where rack is the gem we want to install

 

Read more

activated rack ..., but your Gemfile requires rack ..... Consider using bundle exec. (Gem::LoadError)

john

When it says try using bundle exec… it means that you have to prefix the command with that

Example if  “cucumber features” display the error

“bundle exec cucumber features”

 

Read more

Document preparation tool in rails

john

rake doc:app  turn your “rdoc formatted” comments into properly formatted html

source

http://rdoc.sourceforge.net/

Also check the other option at

http://rdoc.sourceforge.net/rd/index.html

 

Read more

Rails Development - Usefull sites

john
Read more

FasterCSV

john

FasterCSV is intended as a replacement to Ruby‘s standard CSV library.

Installation
1) $ gem install fastercsv
2) add the following to gemfile
gem ‘fastercsv’

code sample

performancecsv=Array.new
FasterCSV.open(“./file.csv”, “w”) do |csv|
@studentdetails.each do | student |
performancecsv.push(“content1″)
………
…..
performancecsv.push(“content2″)
csv << performancecsv
performancecsv.clear
end  #each do
end # FasterCSV

Example code
2) https://github.com/JEG2/faster_csv/tree/master/examples

 

Read more

include and require in rails

john

require

The require keyword includes files in your include path (e.g., lib, your Ruby load path, and so on).

include

The include keyword mixes modules into classes, so it needs to be inside a class to be used.

Read more

passing variables to the partial in rails

john

There is a bit of magic involved in passing variables to the partial. Because the partial is named “person,” the main template will look for an instance variable @person, and pass it to the partial as a local variable, person. What if the instance variable doesn’t match the name of the partial? Then you’d explicitly pass it, like this: “person”, :locals => { :person => @scott } %>All the key/value pairs in the :locals hash will be made into local variables for the partial.

Read more

Rails Tools

john

cucumber- behavior driven development in rails

BDD focuses on obtaining a clear understanding of desired software behavior through discussion with stakeholders. It extends TDD by writing test cases in a natural language that non-programmers can read. Behavior-driven developers use their native language in combination with the ubiquitous language of domain driven design to describe the purpose and benefit of their code. This allows the developers to focus on why the code should be created, rather than the technical details, and minimizes translation between the technical language in which the code is written and the domain language spoken by the business, users, stakeholders, project management, etc.

HAML to HTML converter

http://haml-lang.com/try.html

HTML to HAML converter

http://html2haml.heroku.com/

CSS to SASS Converter

http://css2sass.heroku.com/

JavaScript to CoffeeScript Converter

http://js2coffee.org/

http://js2cs.nodejitsu.com/

Anemone

Anemone is a free, multi-threaded Ruby...

Read more

What is YAML?

john

YAML(YAML Ain’t Markup Language) is a human friendly data serialization standard for all programming languages.YAML support comes built in to the ruby language.ruby uses yaml in Fixtures and for the database description file.

YAML is an excellent choice for serializing your Ruby objects. Its brevity and readability give it the edge over both XML and Marshal, and with the addition of YAML Helper it becomes more flexible as well.In ruby every object automagically gets a to_yaml method that returns a string containing appropriate YAML markup.

References

http://rhnh.net/2006/06/25/yaml-tutorial

http://www.yaml.org/YAML_for_ruby.html

Read more

uu Decode function

john

function decode64(input) {

var keyStr = "ABCDEFGHIJKLMNOP" +
"QRSTUVWXYZabcdef" +
"ghijklmnopqrstuv" +
"wxyz0123456789+/" +
"=";

var output = "";

var chr1, chr2, chr3 = "";

var enc1, enc2, enc3, enc4 = "";

var i = 0;

// remove all characters that are not A-Z, a-z, 0-9, +, /, or =

var base64test = /[^A-Za-z0-9\+\/\=]/g;

if (base64test.exec(input)) {

alert("There were invalid base64 characters in the input text.\n" +

"Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\n" +

"Expect errors in decoding.");

}

input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

do {

enc1 = keyStr.indexOf(input.charAt(i++));

enc2 = keyStr.indexOf(input.charAt(i++));

enc3 = keyStr.indexOf(input.charAt(i++));

enc4 = keyStr.indexOf(input.charAt(i++));

chr1 = (enc1 << 2) | (enc2 >> 4);

chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);

chr3 = ((enc3 & 3) << 6) | enc4;

output = output + String.fromCharCode(chr1);

if (enc3 != 64) {

output = output + String.fromCharCode(chr2);

}

if...

Read more

Display TCX tracks using Google Maps API

john

This is the modified code which I fetch from the site

http://www.jacquet80.eu/blog/post/2011/02/Display-GPX-tracks-using-Google-Maps-API

The whole code

<!DOCTYPE html>

<!–

Demo put together by Christophe Jacquet in February 2011.
http://www.jacquet80.eu >

Use it and adapt it at your own will.

–>

<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″/>
<title>Google Map with GPX track</title>
<style type=”text/css”>
html, body, #map_canvas { width: 100%; height: 100%; margin: 0; padding: 0 }
</style>
<script type=”text/javascript” src=”http://maps.google.com/maps/api/js?sensor=false”></script&gt;
<script type=”text/javascript” src=”https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js”></script&gt;
<script type=”text/javascript”>
function...

Read more

google map – useful sites

john
Read more

How to make kml files from google map

john

1)   Get the map in google map.
2)   Click the Link to this page link.
3)   Copy the email/IM link.
4)   Paste link back into your browser address bar.
5)   Add &output=kml to the end of the url & hit enter/go.
6)   Save the kml wherever you wish.

source
http://www.gringod.com/2008/02/26/save-google-maps-driving-directions/

Read more

Google Map tools

john

1) convert kml files 

http://kmltools.nobletech.com/csv2kml 

2) To prase kml files

http://econym.org.uk/gmap/egeoxml.htm

Read more

kml tools

john
Read more

Not able to center the google map after resize.

john

1) store location in a global variable var location =  new google.maps.LatLng(info.latitude, info.longitude); loc=location; here “loc” is a global variable

2) call setCenter function with “loc” variable as shown below

function resizeMap() {

google.maps.event.trigger(map,’resize’); map.setZoom( map.getZoom() ); map.setCenter(loc);

}

Read more

Google Map tools

john
Read more

cloud hosting services

john

http://www.heroku.com/
https://www.engineyard.com/
http://www.linode.com/
http://www.rackspace.com/cloud/
http://aws.amazon.com/ec2/

 

Read more

responsive front-end framework

john

http://foundation.zurb.com/

http://getbootstrap.com/

Read more

useful sites

john

http://www.projectfedena.org/
http://plivo.com/
http://sugarjs.com/

Read more

Some open source enterprise search platform

john

http://www.elasticsearch.org/
http://lucene.apache.org/solr/
http://sphinxsearch.com/

Read more

group chat app

john

https://www.hipchat.com/

https://www.flowdock.com/
https://github.com/maccman/holla

Read more

Issue Tracking and Project Tracking Tools

john
Read more

Image creation

john
Read more

what is HTML5 Shiv ?

john
Read more

Time zone data

john
Read more

Free File hosting sites

john
Read more

cross browser test

john

Help to check your browser compatibility

www. crossbrowsertesting.com 

https://testingbot.com/

Read more

Less - The dynamic stylesheet language.

john

http://lesscss.org/

LESS extends CSS with dynamic behavior such as variables, mixins, operations and functions. LESS runs on both the client-side (Chrome, Safari, Firefox) and server-side, with Node.js and Rhino.

Tutorial

http://verekia.com/less-css/dont-read-less-css-tutorial-highly-addictive

Read more

Database Tools, Tutorials

john

pgAdmin III :- pgAdmin III is a comprehensive PostgreSQL database design and management system


PostgreSQL tutorials :- http://www.postgresql.org/docs/8.0/static/index.html


MySQL Workbench :-MySQL Workbench provides a graphical tool for working with MySQL Servers and databases


MySQL Administrator :- MySQL Administrator is a program for performing administrative operations, such as configuring your MySQL server, monitoring its status and performance, starting and stopping it, managing users and connections, performing backups, and a number of other administrative tasks.

Read more

Installing the JDK in debian

john

1) Download and Uncompressed the JDK file 


2) move the JDK directory to /usr/lib/jvm

Example
sudo mv ./jdk1.7.0_02  /usr/lib/jvm/jdk1.7.0

3) run

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1

4) Run

sudo update-alternatives --config java

Press enter to keep the current choice[*], or type selection number: 3


5) confirm the success of new installation 

java -version

6) Repeat the step 4 for:

sudo update-alternatives --config javac
sudo update-alternatives --config javaws

Read more

to draw chart

john

https://developers.google.com/chart/interactive/docs/gallery/linechart

Read more

To reduce javascript file size

john

http://fmarcia.info/jsmin/test.html

Read more

Jasmin BDD for Javascript

john

Link helpful to learn it

1) http://evanhahn.com/?p=181
2) https://github.com/pivotal/jasmine/wiki

Read more

Mobile web Development

john

Tools

1) PhoneGap:-Based on HTML and JavaScript.

http://phonegap.com/

2) jQuery Mobile:- Touch-Optimized Web Framework for Smartphones & Tablets 

http://jquerymobile.com/

Read more

Elance Tracker how to install in a 64 bit debian machine

john

1) Download  Adobe AIR 2.6.0 Linux   ( which is the last version available for Linux)
( http://airdownload.adobe.com/air/lin/download/2.6/AdobeAIRInstaller.bin )

2)  Make it executable  (chmod +x AdobeAIRInstaller.bin)

3)  run it with root previlage   (sudo ./AdobeAIRInstaller.bin)

4) download elance Tracker  for Linux

5) Force installation of elance Tracker:  (sudo dpkg -i --force-architecture TrackerSetup_v2.1.1.deb)

Read more

What is favicon?

john

A favicon is a graphic image associated with a particular Web page. Display them as a visual reminder of the Web site identity Format for the image you have chosen must be 16x16 pixels or 32x32 pixels, using either 8-bit or 24-bit colors. The format of the image must be one of PNG (a W3C standard), GIF, or ICO.

Read more

jQuery Plugin Sources

john
Read more

To move your WordPress blogs over to Blogger

john

This site help you in the process

http://wordpress2blogger.appspot.com/

Read more

Web feed management

john

FeedBurner is a web feed management provider

http://feedburner.google.com

Read more

To get clocks for your site

john

http://www.timeanddate.com/clocks/free.html

Read more