tag:blogger.com,1999:blog-80596932451084823342024-02-06T20:01:30.183-08:00majestic railsBlogging @ Ruby on Rails and related resourcesmanohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-8059693245108482334.post-68279768164443429062012-02-13T23:23:00.000-08:002012-02-13T23:23:05.557-08:00ERROR: ActiveRecord oracle_enhanced adapter could not load ruby-oci8 library. Please install ruby-oci8 gem.If you are facing an error on ubuntu while connecting oracle even though you have installed ruby-oci8 and activerecord-oracle_enhanced_adapter you need install following library.<br />
<br />
Problem:<br />
<br />
ERROR: ActiveRecord oracle_enhanced adapter could not load ruby-oci8 library. Please install ruby-oci8 gem.<br />
<br />
Solution:<br />
sudo apt-get install libaio1<br />
<br />
<br />
I hope this should work for you.manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com2tag:blogger.com,1999:blog-8059693245108482334.post-84340282436335025592011-09-10T03:38:00.000-07:002011-09-10T03:39:20.305-07:00installing mysql gem on ubuntu + ERROR: Error installing mysqlIf you are facing below issue while installing mysql gem on ubuntu then you need to install 'libmysqlclient-dev' library.<br />
<br />
manohar@manohar-Inspiron-1525:~$ gem install mysql<br />
Building native extensions. This could take a while...<br />
ERROR: Error installing mysql:<br />
ERROR: Failed to build gem native extension.<br />
<br />
/home/manohar/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb<br />
checking for mysql_query() in -lmysqlclient... no<br />
checking for main() in -lm... yes<br />
checking for mysql_query() in -lmysqlclient... no<br />
checking for main() in -lz... yes<br />
checking for mysql_query() in -lmysqlclient... no<br />
checking for main() in -lsocket... no<br />
checking for mysql_query() in -lmysqlclient... no<br />
checking for main() in -lnsl... yes<br />
checking for mysql_query() in -lmysqlclient... no<br />
checking for main() in -lmygcc... no<br />
checking for mysql_query() in -lmysqlclient... no<br />
*** extconf.rb failed ***<br />
Could not create Makefile due to some reason, probably lack of<br />
necessary libraries and/or headers. Check the mkmf.log file for more<br />
details. You may need configuration options.<br />
<br />
Provided configuration options:<br />
--with-opt-dir<br />
--without-opt-dir<br />
--with-opt-include<br />
--without-opt-include=${opt-dir}/include<br />
--with-opt-lib<br />
--without-opt-lib=${opt-dir}/lib<br />
--with-make-prog<br />
--without-make-prog<br />
--srcdir=.<br />
--curdir<br />
--ruby=/home/manohar/.rvm/rubies/ruby-1.9.2-p290/bin/ruby<br />
--with-mysql-config<br />
--without-mysql-config<br />
--with-mysql-dir<br />
--without-mysql-dir<br />
--with-mysql-include<br />
--without-mysql-include=${mysql-dir}/include<br />
--with-mysql-lib<br />
--without-mysql-lib=${mysql-dir}/lib<br />
--with-mysqlclientlib<br />
--without-mysqlclientlib<br />
--with-mlib<br />
--without-mlib<br />
--with-mysqlclientlib<br />
--without-mysqlclientlib<br />
--with-zlib<br />
--without-zlib<br />
--with-mysqlclientlib<br />
--without-mysqlclientlib<br />
--with-socketlib<br />
--without-socketlib<br />
--with-mysqlclientlib<br />
--without-mysqlclientlib<br />
--with-nsllib<br />
--without-nsllib<br />
--with-mysqlclientlib<br />
--without-mysqlclientlib<br />
--with-mygcclib<br />
--without-mygcclib<br />
--with-mysqlclientlib<br />
--without-mysqlclientlib<br />
<br />
Use below command to resolve above issue-<br />
<br />
manohar@manohar-Inspiron-1525:~$ sudo apt-get install libmysqlclient-devmanohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-19084752713815521862011-08-17T09:22:00.000-07:002012-02-13T00:54:32.109-08:00Ruby on Rails Development Platform in EnterpriseRuby on Rails is growing in enterprises in India, but they are still lagging with popular development platforms like Mac or linux. As it's difficult for them to afford Mac and they cannot use Linux based Operating Systems (OS) on host machines due to security constraints or to use some windows based apps. So I decided to use Virtual Machine on my Windows based Host System. <br />
<br />
Here is configuration of my host system:<br />
Processor: Intel Core 2 Duo CPU, RAM: 2GB, Operating System: Windows 7 Enterprise<br />
<br />
Now To use Ubuntu (Linux based OS) with above configuration, follow below steps-<br />
<br />
1. <a href="http://www.vmware.com/products/player/faqs.html">Download </a>and Install VMWare Player which is free for personal non-commercial use. VMware Player is only distributable with written permission from VMware. So don't share the exe/setup, download it separately. <br />
<br />
2. <a href="http://www.ubuntu.com/download/ubuntu/download">Download </a>ISO of Ubuntu.<br />
<br />
3. Create a New Virtual Machine for Ubuntu using VMware Player. Just follow 'Next' Its simple. It takes default 512 MB of RAM but I did allocate 896 MB of RAM as I had 2 GB of RAM. (It might install required files.) <br />
<br />
Now you have Ubuntu ready on your windows based system. To install Ruby and Rails using RVM please follow below steps-<br />
<br />
1. To install RVM you need git. Run below command to install git-<br />
ubuntu@ubuntu:~$ sudo apt-get install git<br />
And then follow installation steps for RVM <a href="http://beginrescueend.com/rvm/install/">here</a>.<br />
OR<br />
Run below command in terminal-<br />
<pre class="code">ubuntu@ubuntu:~$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)</pre>And then follow steps mentioned in output of above command to update .bashrc.<br />
<br />
2. After installing RVM successfully follow below steps to install ruby and rails. Steps mentioned below are used to avoid the issue mentioned <a href="http://mrails.blogspot.com/2011/07/no-such-file-to-load-zlib.html">here</a>.<br />
ubuntu@ubuntu:~$ rvm pkg install zlib<br />
ubuntu@ubuntu:~$ rvm pkg install openssl<br />
ubuntu@ubuntu:~$ rvm install 1.8.7 -C --with-openssl-dir=$rvm_path/usr --with-zlib-dir=$rvm_path/usr<br />
<br />
3. Create new gemset using rvm.<br />
ubuntu@ubuntu:~$ rvm gemset create rails_3<br />
<br />
4. Check available version of ruby and gemset.<br />
ubuntu@ubuntu:~$ rvm list<br />
ubuntu@ubuntu:~$ rvm gemset list<br />
<br />
5. Set default versions of Ruby and Rails using rvm. I am using ruby-1.8.7-p352@rails_3 as I have installed ruby 1.8.7 and created gemset named as rails_3.<br />
ubuntu@ubuntu:~$ rvm use --default ruby-1.8.7-p352@rails_3<br />
<br />
6. Now you can install rails.<br />
ubuntu@ubuntu:~$ gem install rails<br />
<br />
You are ready with ruby and rails, Now you need database. You can simply install mysql or postgresql using apt-get install command or from ubuntu software center. <br />
<br />
I wanted to use Oracle but I didn't install it on my ubuntu system (virtual machine) as it's running less than 1 GB RAM which is kind of minimum requirement for oracle database. And I have already installed Oracle XE on my host system so I am going to use it using Host IP address in my database.yml of rails app.<br />
<br />
To use oracle I need to install ruby-oci8 and activerecord-oracle_enhanced-adapter gems.<br />
<br />
1. Follow steps <a href="http://ruby-oci8.rubyforge.org/en/InstallForInstantClient.html">here </a>to install ruby-oci8 using InstantClient.<br />
<br />
2. If you are facing any issues to install gem ruby-oci8, you have to set path for LD_LIBRARY_PATH in your .bashrc. Eg: export LD_LIBRARY_PATH="/opt/oracle/instantclient_11_2"<br />
<br />
Apart from these you have to install few required libraries and application like tortoisesvn, NetBeans(IDE) etc. Currently I am using Ubuntu just by using 896MB of RAM and it works fine.<br />
<br />
Few things to remember while using this combination-<br />
<br />
1. Increase RAM size allocated from 512MB, if you are going to use NetBeans as it takes bit lot memory.<br />
<br />
2. Increase number of Processors to 2 if you have core 2 Duo, Default its set to only 1. It really helps.<br />
<br />
3. From Virtual Machine Settings -> Hardware -> CD/DVD Device, dis-select 'Connect at power on' check box as you may not have CD-ROM available. <br />
<br />
4. CTRL+G is used to enter into Virtual Machine and CTRL+ALT get out of it. <br />
CTRL+ALT+DELETE call is taken by both Virtual Machine and host system. So make sure you will be using host system if you want to lock it.<br />
<br />
5. Add terminal in SYSTEM->PREFERENCES->KEYBORAD SHORTCUTS. <br />
You can use- Name: CTRL+ALT_DELETE and Command: gnome-editor <br />
<br />
6. If you want to have shared folder between host system and virtual system, refer the article <a href="http://martin-fleming.co.uk/2011/02/shared-folders-on-ubuntu-server-virtual-machine-in-vmware-player/">here</a> to update Virtual Machine Tools first and then you can simply add folders from Virtual Machine Settings -> Options -> Shared Folders. You will get them in /mnt/hgfs<br />
<br />
Note: I was using a network where I was able to download all required software.manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com6tag:blogger.com,1999:blog-8059693245108482334.post-14475260248832201892011-07-30T06:39:00.000-07:002011-08-19T02:54:25.286-07:00no such file to load -- zlibIf you have installed rvm and then ruby and now facing below issue while installing rails-<br />
manohar@manohar-Inspiron-1525:~$ gem install rails<br />
<div>ERROR: Loading command: install (LoadError)</div><div>no such file to load -- zlib</div>ERROR: While executing gem ... (NameError)<br />
uninitialized constant Gem::Commands::InstallCommand<br />
<br />
Below steps should fix your problem as it worked for me.<br />
<br />
$ rvm pkg install zlib<br />
$ rvm remove 1.9.2<br />
$ rvm install 1.9.2 --with-zlib-dir=$rvm_path/usr<br />
<br />
<br />
HEROKU:<br />
<br />
If you need to use you might face below problem after installing heroku gem and running heroku commands:<br />
<br />
<pre class="lang-rb prettyprint"><code><span class="str">no such file to load -- net/https.</span></code></pre><pre class="lang-rb prettyprint"><code><span class="str">Try running apt-get install libopenssl-ruby (LoadError)</span></code></pre><pre class="lang-rb prettyprint"><code><span class="str">Below steps will work:</span></code></pre><pre class="lang-rb prettyprint"><code><span class="str"> </span></code></pre><pre class="lang-rb prettyprint"><code><span class="pln">$ rvm remove </span><span class="lit">1.9</span><span class="pun">.</span><span class="lit">2</span><span class="pln"> </span></code></pre><pre class="lang-rb prettyprint"><code><span class="pln">$ rvm pkg install openssl
$ rvm install </span><span class="lit">1.9</span><span class="pun">.</span><span class="lit">2</span><span class="pln"> </span><span class="pun">-</span><span class="pln">C </span><span class="pun">--</span><span class="pln">with</span><span class="pun">-</span><span class="pln">openssl</span><span class="pun">-</span><span class="pln">dir</span><span class="pun">=</span><span class="pln">$rvm_path</span><span class="pun"></span><span class="pln"></span><span class="pun">/</span><span class="pln">usr</span></code><code></code></pre><pre class="lang-rb prettyprint"><code><span class="str"></span></code> </pre>And to resolve both zlib and libopenssl problem use below steps:<br />
<br />
<pre class="lang-rb prettyprint"><code><span class="pln">$ rvm remove </span><span class="lit">1.9</span><span class="pun">.</span><span class="lit">2 </span></code></pre><pre class="lang-rb prettyprint"><code><span class="lit">$ rvm pkg install zlib</span></code></pre><pre class="lang-rb prettyprint"><code><span class="pln">$ rvm pkg install openssl</span></code></pre><pre class="lang-rb prettyprint"><code><span class="pln">$ rvm install </span><span class="lit">1.9</span><span class="pun">.</span><span class="lit">2</span><span class="pln"> </span><span class="pun">-</span><span class="pln">C </span><span class="pun">--</span><span class="pln">with</span><span class="pun">-</span><span class="pln">openssl</span><span class="pun">-</span><span class="pln">dir</span><span class="pun">=</span><span class="pln">$rvm_path</span><span class="pun"></span><span class="pln"></span><span class="pun">/</span><span class="pln">usr</span></code><code><span class="str"> </span></code> --with-zlib-dir=$rvm_path/usr</pre>manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-72604008732620772912011-06-12T10:31:00.000-07:002011-06-12T10:31:23.591-07:00meta-design patterns<ul><li>Separate out the things that change from those that stay the same.</li>
<li>Program to an interface, not an implementation.</li>
<li>Prefer composition over inheritance.</li>
<li>Delegate, delegate, delegate.</li>
</ul>manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-20768263560366022982011-06-09T06:18:00.000-07:002011-06-09T06:25:06.896-07:00big fan of Yehuda's open source contributions<div class="info">Yehuda Katz is a member of the <a href="http://www.sproutcore.com/">SproutCore</a>, <a href="http://rubyonrails.org/">Ruby on Rails</a> and<a href="http://jquery.com/"> jQuery</a> Core Teams; during the daytime, he works as an architect at Strobe. Yehuda is the co-author of the best-selling "jQuery in Action", the upcoming "Rails 3 in Action", and is a contributor to "Ruby in Practice". He spends most of his time hacking on open source - his main projects, along with others, like Thor, Handlebars and Janus - or traveling the world doing evangelism work. He blogs at <a href="http://www.yehudakatz.com/"> yehudakatz.com</a> and can be found on Twitter as <a href="http://twitter.com/#%21/wycats"> @wycats.</a></div><div class="info">And I am huge fan of his open source contributions, they could be from server side or client side or any other library and I had wish to have a snap with this great contributor which I completed in <a href="http://rubyconfindia.org/2011/">RubyConf India 2011</a>.</div><div class="info"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkBnZXXNhEhXzGi3b7mGjz1-GjIqRAx_wzssgtMwGAFxYOfBi0NpEGCsinoj1Kv_zZSo6TUrrz31mWlSMpwQPph9zQ79yImcWzQ53p4IA6s4nCkkMJFEKUuITpxvKdVDEAM_pV4FWRGGdl/s1600/DSC02231.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkBnZXXNhEhXzGi3b7mGjz1-GjIqRAx_wzssgtMwGAFxYOfBi0NpEGCsinoj1Kv_zZSo6TUrrz31mWlSMpwQPph9zQ79yImcWzQ53p4IA6s4nCkkMJFEKUuITpxvKdVDEAM_pV4FWRGGdl/s400/DSC02231.jpg" width="400" /></a></div><div class="info"><br />
</div><div class="info"><br />
</div><div class="info"> </div><div class="info"></div>manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-11849664658337085492011-05-23T11:33:00.000-07:002011-05-23T11:34:28.447-07:00Exception in thread "main" java.lang.NoClassDefFoundError + running sunspot:solr:run on windowsWhile running "sunspot:solr:run" on Windows ["sunspot:solr:run" works with windows otherwise use "sunspot:solr:start"] if you are receiving error like - <br />
<pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: </code></pre><pre><code>'-Djava/util/logging/config/file=C:/DOCUME~1/pli/LOCALS~1/Temp/</code></pre><pre><code>logging/properties20100617-11284-furc4v-0'
Caused by: java.lang.ClassNotFoundException:</code></pre><pre><code>'-Djava.util.logging.config.file=C:.DOCUME~1.pli.LOCALS~1.Temp.</code></pre><pre><code>logging.properties20100617-11284-furc4v-0'
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: </code></pre><pre><code>'-Djava.util.logging.config.file=C:/DOCUME~1/pli/LOCALS~1/Temp/</code></pre><pre><code>logging.properties20100617-11284-furc4v-0'.</code></pre><pre style="font-family: inherit;"><code> Program will exit.</code> </pre><pre style="font-family: inherit;">Please change line no. 74 in server.rb from lib of sunspot gem, </pre><pre style="font-family: inherit;">"exec(Escape.shell_command(command))" </pre><pre style="font-family: inherit;">with "exec(Escape.shell_command(command).gsub("'",'"'))"</pre><pre style="font-family: inherit;">For details refer <a href="http://outoftime.lighthouseapp.com/projects/20339/tickets/84-sunspot-solr-run-doesnt-start-on-windows">source.</a></pre><pre></pre>manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com3tag:blogger.com,1999:blog-8059693245108482334.post-9508217509528888952011-05-09T15:13:00.000-07:002011-08-23T03:34:19.826-07:00quickbooks integration in rails appBy the end of this post you will be able to integrate your Web Hosted Application with QuickBooks Online Edition. You will understand below points.<br />
<br />
<b>Objectives:</b><br />
<b>1. Establish a communications channel with QuickBooks</b><br />
<b>2. Build a set of request messages</b><br />
<b>3. Send the request messages set to QuickBooks </b><br />
<b>4. Check the status codes & data in the response message set received from QuickBooks </b><br />
<b>5. Close the communications channel with QuickBooks</b><br />
<br />
<br />
The Basic Communication Model is shown in Fig. 1<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmbN4u4XBmL6mzZMP-U1dzdlH4JT8elIYtuIrKoTKadAQrgZ1eWlpzaxn0Nb_7RKl-2s2Aw0xmjXvxM3J6wEjYcj0MQTWKV1NqW3PjNL9pTe9YO8y2R3dt0Eocfqr0gBMwsD6MCKs8v3jx/s1600/quickbook.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="100" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmbN4u4XBmL6mzZMP-U1dzdlH4JT8elIYtuIrKoTKadAQrgZ1eWlpzaxn0Nb_7RKl-2s2Aw0xmjXvxM3J6wEjYcj0MQTWKV1NqW3PjNL9pTe9YO8y2R3dt0Eocfqr0gBMwsD6MCKs8v3jx/s400/quickbook.JPG" width="400" /></a></div><br />
Fig. 1<br />
<br />
Terminologies from Fig. 1<br />
• Developer Application => Rails App<br />
• Request => Https request generated using QBXML<br />
• Response => Response over https in QBXML format.<br />
• Company Owner’s Authorization => Authorization process for security purpose explained in detail in part-1. i.e. Establish a communications channel with QuickBooks<br />
• Request Processor => Its nothing but a QBXML parser which process request from developer application and response from QuickBooks and sent in QBXML format to Developer application.<br />
• QuickBooks => QuickBooks Account.<br />
<br />
<br />
Now step by step:<br />
<br />
<b>1. Establish a communications channel with QuickBooks</b><br />
<br />
Steps to establish connection between developer application and QuickBooks.<br />
1. Obtain a test QBOE (QuickBooks Online Edition) account from IDN for testing during development. These are available to paid memberships and participants in the NFR program.<br />
<br />
Purchase an account from QuickBooks<br />
As the quickbooks doesn’t support Multitenant platform, so the process is defined in step-7 for connecting specific account with specific company if you have multitenant rails application.<br />
<br />
2. Register your application with IDN (Register your app at <a href="http://appreg.intuit.com/">appreg.intuit.com</a>)<br />
<br />
It’s an IDN Gateway Application Registration which is required to generate an Unique ID which is later used in https requests. You need to register valid https url of rails application with IDN.<br />
URL: https://app_url<br />
APPLICATION ID: Unique App Id generated- You will have some unique id generated eg: 169442259<br />
Please make sure you have valid https ceritificate for the same url. Otherwise redirect it using proxies.<br />
<br />
It also asks for some basic URLs which QuickBooks uses for further reference.<br />
<br />
Subscribe URL: https://app_url/quickbooks/subscribe<br />
Usually connection ticket is returned in this action when connection to QuickBooks account is created for first time with Rails App.<br />
Change URL: https://app_url/quickbooks/change<br />
Cancel URL: https://app_url/quickbooks/cancel<br />
Login URL: https://app_url/login<br />
<br />
3. Obtain a server certificate from a supported root certificate authority. This will be your https certificate. <br />
<br />
<br />
4. Obtain a client certificate by generating a certificate signing request (CSR) and use the <a href="http://appreg.intuit.com/">appreg.intuit.com</a> site to get it signed by Intuit.<br />
a) Obtain a client certificate by generating a certificate signing request (CSR):<br />
i. Generate a new key:<br />
ii. $ openssl genrsa -out idn.key 1024<br />
iii. Generate CSR:<br />
iv. $ openssl req -new -key idn.key -out idn-foo.csr<br />
v. IMPORTANT: Common Name (Your Name) needs to be EXACTLY <br />
vi. your.url(THIS MUST BE AN IP ADDRESS OF YOUR HOSTED APP SERVER):your.application.name<br />
b) Get CSR signed at <a href="http://appreg.intuit.com/">appreg.intuit.com</a><br />
Go to site, copy and paste CSR text and sign that bad boy!<br />
c) Create PEM<br />
The signing process will return a certificate. Copy the certificate to a text file and name it qboe-cert.pem. Now open the key you used to generate the CSR and paste that into the same text file above the certificate.<br />
<br />
<br />
5. Understand and follow the QBOE security requirements for hosted web applications.<br />
<br />
Your hosted web application (Developer Application) needs a server certificate in order to receive callbacks from QBOE. Your hosted web application also needs a client certificate signed by Intuit in order to POST QBOE requests to QBOE. (You need register your application with IDN before you can generate your certificate signing request.)<br />
<br />
6 .In your code, using SSL, implement the presentation of the client certificate to be used when posting to QBOE.<br />
The Intuit-signed client certificate must be presented to QBOE at every POST to QBOE sites. You have to use SSL at your web server in conjunction with the client certificate. The client certificate is presented using “pem” feature of httparty gem. <br />
<br />
require 'httparty'<br />
<br />
<br />
class Qboe<br />
include HTTParty<br />
base_uri 'https://webapps.quickbooks.com/j/AppGateway'<br />
format :xml<br />
headers 'Content-Type' => 'application/x-qbxml'<br />
pem File.read("#{RAILS_ROOT}/qboe-cert.pem")<br />
end<br />
<br />
7. In your code, prompt your customer to grant a connection ticket authorizing your application to access the QBOE Company. Respond by sending the customer to the QBOE login page to get a connection ticket. QBOE POSTs the connection ticket back to the application subscription URL you specified when you registered your application. Handle this POST at that URL and store the connection ticket securely.<br />
<br />
Sending the User to QBOE to Create a Connection Ticket<br />
In your main form displayed in the user’s web browser, provide a means for the customer to start the authorization process, for example, a Subscribe button. Whatever the means, respond to the customer’s action by sending the customer to the QBOE login page at the following URL:<br />
<m:smallfrac m:val="off"> <m:dispdef> <m:lmargin m:val="0"> <m:rmargin m:val="0"> <m:defjc m:val="centerGroup"> <m:wrapindent m:val="1440"> <m:intlim m:val="subSup"> <m:narylim m:val="undOvr"> </m:narylim></m:intlim> </m:wrapindent> </m:defjc></m:rmargin></m:lmargin></m:dispdef></m:smallfrac><br />
<div class="MsoNormalCxSpFirst" style="line-height: 150%; margin: 0in 0in 0.0001pt 31.5pt;">for production QBOE:<span style="line-height: 150%;"> </span></div><div class="MsoNormalCxSpMiddle" style="line-height: 150%; margin: 0in 0in 0.0001pt 31.5pt;"><span style="line-height: 150%;">https://login.quickbooks.com/j/qbn/sdkapp/confirm?appid=<myappid>&serviceid=2004&appdata=<myappdata></myappdata></myappid></span></div><br />
<m:smallfrac m:val="off"> <m:dispdef> <m:lmargin m:val="0"> <m:rmargin m:val="0"> <m:defjc m:val="centerGroup"> <m:wrapindent m:val="1440"> <m:intlim m:val="subSup"> <m:narylim m:val="undOvr"> </m:narylim></m:intlim> </m:wrapindent><span style="font-family: "Arial","sans-serif"; font-size: 10pt; line-height: 115%;">Appdata = > company id (It is not required or mandatory but </span>preferred to use if you have multitenant application.) <myappid><myappdata><br />
</myappdata></myappid></m:defjc></m:rmargin></m:lmargin></m:dispdef></m:smallfrac><br />
<myappid><myappdata>After your application gets the POST from QBOE, you need to extract the connection ticket<br />
from the POST in subscribe action.<br />
<br />
8. In your code, implement session ticket handling code. That is, prior to sending QBOE requests for a particular customer, get a session ticket by sending a SignonMsgsRq containing a SignonAppCertRq with that customer’s connection ticket. You’ll POST this to the QBOE data exchange URL to get the session ticket in the Signon AppCertRs response.<br />
</myappdata></myappid><br />
<myappid><myappdata></myappdata></myappid><br />
<myappid><myappdata>Eg: session.erb </myappdata></myappid><br />
<?xml version="1.0"?><br />
<?qbxml version="6.0"?><br />
<QBXML><br />
<SignonMsgsRq><br />
<SignonAppCertRq><br />
<ClientDateTime><%=today%></ClientDateTime><br />
<ApplicationLogin><%=APPLICATION_LOGIN%></ApplicationLogin><br />
<ConnectionTicket><%=CONNECTION_TICKET%></ConnectionTicket><br />
<Language>English</Language><br />
<AppID><%=APPLICATION_ID%></AppID><br />
<AppVer>1</AppVer><br />
</SignonAppCertRq><br />
</SignonMsgsRq><br />
</QBXML><br />
<br />
APPLICATION_LOGIN = 'app_url'<br />
CONNECTION_TICKET = 'TGT-68-wltE9aMgPpzDAC46PJwZvQ' <br />
APPLICATION_ID = '169442259'<br />
<br />
def self.get_session_ticket<br />
today = Time.now.strftime("%Y-%m-%d")<br />
xml_to_send = ERB.new(get_file_as_string("lib/quickbooks/session.erb")).result(binding)<br />
result = post('/', :body => xml_to_send )<br />
result["QBXML"]["SignonMsgsRs"]["SignonAppCertRs"]["SessionTicket"]<br />
end<br />
<br />
<div class="MsoNormalCxSpMiddle" style="line-height: 150%; margin-bottom: 0.0001pt;"><br />
</div><div class="MsoNormalCxSpMiddle" style="line-height: 150%; margin: 0in 0in 0.0001pt 0.5in;"> Response text:</div><div class="MsoNormalCxSpMiddle" style="line-height: 150%; margin: 0in 0in 0.0001pt 0.5in;"><br />
</div><div class="MsoNormalCxSpMiddle" style="line-height: 150%; margin: 0in 0in 0.0001pt 0.5in;"><span style="line-height: 150%;">{ "QBXML"=> { "SignonMsgsRs"=> { "</span>SignonAppCertRs<span style="line-height: 150%;">"=> {"ServerDateTime"=>"2010-03-17T05:29:26", "SessionTicket"=>"V1-211-BN1A_Bt_lRGjZQRgHeVIFQ:169714916", "statusSeverity"=>"INFO", "statusCode"=>"0" } } } }</span></div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM_68h1IPL0yuTdclAwWfnTTYruZlftHU2COH2n931hzOR5Z1bqz3OBFMC_M7PbVFuSwjTBfbIVPk3W4fJ4s8M8eSBzEuP5RzDmMDjd_nlGHjF-71HUqZ2B3TDN8rgn6bmI6P98u7A8byc/s1600/quickbook.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br />
</a></div><myappid><myappdata><b>2. Build a set of request messages</b><br />
Below example explains a request created to create an invoice in QuickBooks.<br />
</myappdata></myappid><myappid><myappdata><?xml version="1.0"?><br />
<?qbxml version="6.0"?><br />
<QBXML><br />
<SignonMsgsRq><br />
<SignonTicketRq><br />
<ClientDateTime><%= today %></ClientDateTime><br />
<SessionTicket><%= session %></SessionTicket><br />
<Language>English</Language><br />
<AppID><%= APPLICATION_ID %></AppID><br />
<AppVer>1</AppVer><br />
</SignonTicketRq><br />
</SignonMsgsRq><br />
<QBXMLMsgsRq onError="continueOnError"><br />
<InvoiceAddRq><br />
<InvoiceAdd defMacro="TxnID:1234"><!-- required --><br />
<CustomerRef> <!-- required --><br />
<ListID>4</ListID><br />
</CustomerRef><br />
<TxnDate>2010-10-10</TxnDate><br />
<!-- BEGIN OR --><br />
<InvoiceLineAdd > <!-- optional --><br />
<ItemRef> <!-- optional --><br />
<FullName >Hours</FullName> <!-- optional --><br />
</ItemRef><br />
<Desc >Its added from rails app.</Desc> <!-- optional --><br />
<Quantity >2</Quantity> <!-- optional --><br />
<!-- BEGIN OR --><br />
<Rate >111</Rate> <!-- optional --><br />
<Amount >101.00</Amount> <!-- optional --><br />
<ServiceDate>2010-10-10</ServiceDate><br />
</InvoiceLineAdd><br />
<!-- OR --><br />
<!-- END OR --><br />
</InvoiceAdd><br />
</InvoiceAddRq><br />
</QBXMLMsgsRq><br />
</QBXML><br />
<br />
Following Fields of Rails App are mapped with QuickBooks Invoice using QBXML.<br />
Rails App (Eg. Time/Expense Field Names) QuickBooks Invoice Field Names<br />
Contact/Matter Contact (Full Name) => Client Name/Bill To<br />
Time Entry Date/Expense Entry => Date Service Date<br />
Activity Type/Expense Type => Product/Service<br />
Description => Description<br />
Duration (Hrs) => Qty<br />
Rate/hr ($) => Rate<br />
Final Bill Amount => Amount<br />
<br />
Actual Mapping in QBXML for expense entry in invoice is explained below. <br />
QBXML:<br />
<InvoiceAddRq><br />
<InvoiceAdd defMacro="TxnID:1234"><br />
<CustomerRef> <br />
<ListID>4</ListID><br />
</CustomerRef><br />
<TxnDate>2010-10-10</TxnDate><br />
<InvoiceLineAdd > <br />
<ItemRef> <br />
<FullName >Fax</FullName><br />
</ItemRef><br />
<Desc >Fax to eric</Desc> <br />
<Amount >101.00</Amount> <br />
<ServiceDate>2010-10-10</ServiceDate><br />
</InvoiceLineAdd><br />
</InvoiceAddRq><br />
<br />
<invoiceaddrq><br />
Eg: To add a client name in QuickBooks invoice we need to send ListID in QBXML request. ListID is acquired by executing a query to QuickBooks, Contact Full Name is the parameter passed to query.<br />
<b> 3. Send the request messages set to QuickBooks</b><br />
It’s done using “post” method from http arty gem.<br />
<b>4. Check the status codes & data in the response message set received from QuickBooks</b><br />
Usually below set of parameters values exists in every request and response which we need to consider for every request and specifically for responses. <br />
<br />
Attributes in Request and Response Messages<br />
</invoiceaddrq></myappdata></myappid><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM_68h1IPL0yuTdclAwWfnTTYruZlftHU2COH2n931hzOR5Z1bqz3OBFMC_M7PbVFuSwjTBfbIVPk3W4fJ4s8M8eSBzEuP5RzDmMDjd_nlGHjF-71HUqZ2B3TDN8rgn6bmI6P98u7A8byc/s1600/quickbook.JPG" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM_68h1IPL0yuTdclAwWfnTTYruZlftHU2COH2n931hzOR5Z1bqz3OBFMC_M7PbVFuSwjTBfbIVPk3W4fJ4s8M8eSBzEuP5RzDmMDjd_nlGHjF-71HUqZ2B3TDN8rgn6bmI6P98u7A8byc/s400/quickbook.JPG" width="380" /></a><br />
<myappid><myappdata><invoiceaddrq> <b>5. Close the communications channel with QuickBooks</b><br />
Basically it not compulsory or needed while accessing QuickBooks Online Edition from Web Hosted application.<br />
<br />
Tools & Software: Development Environment<br />
<br />
QuickBooks SDK 8.0 <br />
QBXML Version 6.0<br />
Ruby 1.8.6<br />
Rails 2.3.5<br />
Net Beans IDE 6.7<br />
Gems: Http arty 0.5.2<br />
<br />
References<br />
1. Intuit QuickBooks SDK Technical Overview<br />
2. Intuit QuickBooks SDK Programmer’s Guide<br />
3. Onscreen Reference(OSR)<br />
4. Web site for the Intuit Developer Network (IDN): http://developer.intuit.com<br />
5. Blog: <a href="http://jnylund.typepad.com/joels_blog/2010/02/quickbooks-online-integration-from-ruby-on-rails-the-easy-way.html">http://jnylund.typepad.com/joels_blog/2010/02/quickbooks-online-integration-from-ruby-on-rails-the-easy-way.html</a><br />
6. Blog: <a href="http://www.depixelate.com/2007/05/03/rails-and-quickbooks-online-integration-part-1/">http://www.depixelate.com/2007/05/03/rails-and-quickbooks-online-integration-part-1/</a><br />
7. <a href="http://www.servicesidekick.com/">http://www.servicesidekick.com/</a> (Quickbooks Integration)</invoiceaddrq></myappdata></myappid>manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com2tag:blogger.com,1999:blog-8059693245108482334.post-34227794841500554882011-05-09T13:21:00.000-07:002011-05-13T18:24:02.908-07:00points to remember while adding bundler to old rails appsPoints to remember while adding bundler to Rails < 3.x.x applications- When I had modified an application based rails 2.3.4 for bundler, it has taken my time to make it work as i forgot below points.<br />
1. Please check if someone had made any changes inside plugins/gems which you have mentioned in gem file now.<br />
2. Please note of gems if you are mentioning them :groups as they are not available to other groups. eg. Gems mentioned in :groups => :test are not available to :group => :development. Eg: if you run rake tasks which uses gem libraries in development and gems are mentioned in :tests group, it will give you errors for required gems.<br />
3. Also make sure about gems and plugins versions which are being used in app and you mentioned Gemfile.<br />
<br />
<br />
I hope it might save your time.manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-77809319028447413612011-05-09T13:04:00.000-07:002011-05-09T15:14:05.568-07:00installation guidesThese are links/resources i referred for respective software installations.<br />
<a href="http://www.splinedancer.com/memcached-win32/"><br />
memcached for Windows</a><br />
<a href="http://almamunbd.blogspot.com/2009/06/how-to-install-phymyadmin-on-centos-53.html">How to install PhyMyAdmin on Centos 5.3</a><br />
<a href="http://rmagick.rubyforge.org/install-linux.html">Installing RMagick on Linux, *BSD, or Cygwin systems<br />
</a>manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-63991242892184257302009-10-04T23:46:00.000-07:002011-05-09T13:04:58.582-07:00ruby and rails resourcesRuby<br />
<br />
<a href="http://www.ruby-lang.org/en/">Ruby-Language</a><br />
<a href="http://ruby-doc.org/">Ruby Documentation</a><br />
<a href="http://rubycentral.org/">Ruby Support</a><br />
<br />
Magazines:<br />
<br />
<a href="http://therubyist.com/">The Rubyist</a><br />
<a href="http://railsmagazine.com/">Rails Magazine</a><br />
<br />
Code and Style:<br />
<br />
<a href="http://www.artima.com/rubycs">Code and Style</a><br />
<br />
Projects:<br />
<br />
<a href="http://rubyforge.org/projects/rubygems">RubyGems</a><br />
<a href="http://rubyforge.org/projects/rake">Rake</a><br />
<br />
News:<br />
<a href="http://rubyflow.com/">Ruby Flow</a><br />
<a href="http://www.rubyinside.com/">Ruby Inside</a><br />
<a href="http://railsinside.com/">Rails Inside</a><br />
<br />
Videos:<br />
<a href="http://railscasts.com/">Rails Casts</a><br />
<a href="http://www.rubypulse.com/">Ruby Libraries</a><br />
<br />
Blogs:<br />
<a href="http://pragdave.pragprog.com/">Dave Thomas</a><br />
<a href="http://chadfowler.com/">Chad Fowler</a><br />
<a href="http://onestepback.org/">Jim Weirich</a><br />
<a href="http://weblog.jamisbuck.org/">Jamis Buck</a><br />
<a href="http://blog.talbott.ws/">Nathaniel Talbott</a><br />
<a href="http://blog.grayproductions.net/">http://blog.grayproductions.net/</a><br />
<a href="http://tim.theenchanter.com/">http://tim.theenchanter.com/</a><br />
<a href="http://www.randquist.us/blog/">http://www.randquist.us/blog/</a><br />
<a href="http://yehudakatz.com/">http://yehudakatz.com/</a><br />
<a href="http://atmos.org/">http://atmos.org/</a><br />
<a href="http://squeejee.com/blog">http://squeejee.com/blog</a><br />
<a href="http://blog.herdingtigers.com/">http://blog.herdingtigers.com/</a><br />
<a href="http://www.copiousfreetime.org/">http://www.copiousfreetime.org/</a><br />
<a href="http://blog.josephwilk.net/">http://blog.josephwilk.net/</a><br />
<a href="http://evan.tiggerpalace.com/">http://evan.tiggerpalace.com/</a><br />
<a href="http://satishtalim.com/">http://satishtalim.com/</a><br />
<a href="http://martinfowler.com/">http://martinfowler.com/</a><br />
<a href="http://www.chadfowler.com/">http://www.chadfowler.com/</a><br />
<a href="http://tomcopeland.blogs.com/">http://tomcopeland.blogs.com/</a><br />
<a href="http://richkilmer.blogs.com/">http://richkilmer.blogs.com/</a><br />
<a href="http://jamesgolick.com/">James Golick</a><br />
<a href="http://www.skorks.com/">http://www.skorks.com/</a><br />
<a href="http://blogs.thoughtworks.com/">http://blogs.thoughtworks.com/</a><br />
<a href="http://testing.thoughtworks.com/">http://testing.thoughtworks.com/</a><br />
<a href="http://agileassessments.thoughtworks.com/">http://agileassessments.thoughtworks.com/</a>manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-383872523976987632009-09-02T05:22:00.000-07:002011-05-09T13:07:13.640-07:00adding ruby gem sourcesIf you are getting an error like -<br />
<br />
ERROR: could not find gem GEM_NAME locally or in a repository<br />
<br />
then probably you might have missed the gem source if the name of gem is correct.<br />
<br />
You can add a gem source link using command-<br />
gem sources -a source_link<br />
<br />
To view existing gem sources-<br />
gem sources<br />
<br />
Few gems sources-<br />
<a href="http://gems.rubyforge.org/">http://gems.rubyforge.org/</a><br />
<a href="http://gems.github.com">http://gems.github.com</a>manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-10185670054765432722009-08-31T02:46:00.000-07:002011-05-09T13:04:10.409-07:00installing memcached on CentOSHow to install memcached on CentOS<br />
<br />
This is a step by step guide to installing memcached from source on CentOS. The version of CentOS that I am using is CentOS release 5.2 (Final); to find what version you are using:<br />
<br />
cat /etc/redhat-release<br />
<br />
First, install the dependency libevent:<br />
<br />
cd /usr/local/src<br />
curl -O http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz<br />
tar xzvf libevent-1.4.9-stable.tar.gz <br />
cd libevent-1.4.9-stable<br />
./configure --prefix=/usr/local<br />
make<br />
make install<br />
<br />
Next, install memcached:<br />
<br />
cd /usr/local/src<br />
curl -O http://www.danga.com/memcached/dist/memcached-1.2.6.tar.gz<br />
tar xzvf memcached-1.2.6.tar.gz<br />
cd memcached-1.2.6<br />
LDFLAGS='-Wl,--rpath /usr/local/lib' ./configure --prefix=/usr/local<br />
make <br />
make install<br />
<br />
Verify that memcached starts:<br />
<br />
memcached -u root -d <br />
<br />
If there were no errors, make sure it is running:<br />
<br />
ps aux | grep memcached<br />
<br />
And finally, to stop memcached:<br />
<br />
pkill memcached<br />
<br />
These instructions prevent the following errors:<br />
<br />
memcached: error while loading shared libraries: libevent-1.4.so.2: <br />
cannot open shared object file: No such file or directory<br />
configure: error: libevent is required<br />
If it's already installed, specify its path using --with-libevent=/dir/manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-44772011930404628992009-08-29T00:43:00.000-07:002011-05-09T13:08:11.139-07:00top ten useful linux commands<h2>1. List command</h2><p class="box">ls -a<br />
// lists all<br />
ls -l<br />
// lists all files including hidden files like .htaccess<br />
ls -l | more<br />
// shows in paged format with pipe</p><h2>2. Untarring the uploaded tar.gz files</h2><p>This command is the most important command and often regularly used to uncompress files..</p><p class="box">tar -xzf filename.tar.g</p><p><strong>How to dump/Import tar.gz (zipped) file into MySQL database </strong></p><p>SSH command to restore/import gzipped large databases to mysql on the fly with just one single command. This is so useful as large databases can only be imported to mysql this way! Remember to upload the database dump before you issue this command </p><p class="box">gunzip <> </p><h2>3. Installing packages</h2><p>Installing softwares in linux the most basic and you will need to know this command very well .</p><p class="box">yum install<br />
// for centos and redhat<br />
apt-get install<br />
// for debian/ubuntu</p><h2>4. To look for memory usage</h2><p class="box">top<br />
// shows the memory, cpu load and other processes running<br />
free<br />
// shows the memory usage of linux</p><h2>5. To see the disk usage.</h2><p class="box">df -h<br />
// shows the disk usage and outputs the disk usage left</p><h2>6. To view running processes</h2><p class="box">ps aux<br />
// shows the running processes and its ID. You can use this ID to kill the process later.</p><p class="box">ps aux | grep "process_name" [eg. ruby script/server]<br />
</p><p class="box">//To see specific process</p><p class="box">kill -9 pid</p><p class="box">// to kill the process<br />
</p><h2>7. Deleting all files within a folder</h2><p>This perhaps is one of the most sought after command to<strong> delete all subfiles and subfolders</strong> in linux with just one command in a fly.</p><p class="box">rm -Rf /my/path<br />
// this deletes all files. so be careful!</p><h2>8. Edit a file in easy way!</h2><p>I love nano command. Its just so easy to edit a file with menu options and save changes. You can easily search for specific text inside the file with the nano editor.</p><p class="box">nano /file/path<br />
// text editor to edit files</p><h2>9. Changing Permissions and Ownership</h2><p>whats there in linux without permissions and ownership</p><p class="box">chmod -R 755 /folder/path<br />
// this recursively changes all files and folders of the path.<br />
chown pbu /file/name<br />
//changes the ownership of filename<br />
chgrp mygrp /file/name<br />
//changes the group to new one</p><p>If you dont know how to interpret the 755 or number like permissions here is an easy way to remember<br />
Ex: 755 means rwxr-xr-x<br />
7 -> rwx (for owner)<br />
5 -> r-x (non writable for group)<br />
5 -> r-x (non writable for world)<br />
First we consider '7' in 755 as it is made up of 3 bit binary. To construct 7 we need to construct 111(which is 4+2+1 in decimal).<br />
5 -> 101 ( which is 4+0+1)<br />
5 -> 101 (which is 4+0+1)<br />
Remember 755 is the decimal of the binary and it is always made up of 4+2+1.</p><h2>10. To find out what ports are open</h2><p>Finding which ports are open and closed are so important in terms of security point of your server. You might want to close unwanted services using different ports.</p><p class="box">netstat -nap --tcp<br />
// lists connections and what ports are open.<br />
OR<br />
nmap fuser localhost<br />
// easy command</p><p>Install firewall to block unwanted ports running on your PC or in server.</p><h1>FAQs</h1><p><strong>How do i change root password?</strong><br />
Just login as root or su root and type passwd, you will be asked for new password.</p><p class="box">> passwd<br />
// Be CAREFUL! If you forget your new password, you will lock yourself</p><p>I am installing a firewall in my linux server? How do i know which ports to block and to open?<br />
When installing firewall be sure to block all unwanted open ports. A comprehensive collection of ports and services run at that port can be found here<br />
Here is the short of ports which needs to be kept open for listening.</p><p><strong>Common ports</strong><br />
<span class="box">21 => FTP<br />
22 => SSH<br />
25 => SMTP Mail Transfer<br />
43 => WHOIS service<br />
53 => name server (DNS)<br />
80 => HTTP (Web server)<br />
110 => POP protocol (for email)<br />
143 => IMAP Protocol (for email)<br />
443 => SSL for HTTP</span></p><p><br />
<span class="box">Cpanel => 2077,2078,2082,2083,2086,2087,2089,2095,2096,3306, 6666.<br />
Plesk => 8443<br />
Webmin => 10000</span></p><p>If you have root permissions, you can login to your server control panel like this...</p><p class="box">https://ipaddress:2087/<br />
// for cpanel<br />
https://ipaddress:8443/<br />
// for plesk</p><p>Hope my ports compilation should be helpful for beginners who use linux.</p>manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-75785084838214745152009-08-29T00:35:00.000-07:002011-05-09T15:25:03.894-07:00investigating port on Windows XP and Linux<h1><span style="font-size: large;">How to Investigate a port in Windows XP</span></h1>If you find anything suspicious going on in your computer, you can investigate a port in your PC with windows xp task manager program. Many worms, viruses and trojans mailiciously download harmful scripts to your computer using different ports that you may not know. The best way to protect your PC from such worms and trojans is by using a firewall. You can use <a href="http://www.mysql-apache-php.com/www.personalfirewall.comodo.com" target="_blank">comodo firewall </a>which can be downloaded free of charge.<br />
<br />
<br />
To investigate a port and see what programs are using, can be done easily in 2 steps<br />
1. Go to Start > Run > command<br />
2. At the command prompt type <b>netstat -noa</b><br />
<img alt="Investigate port in windows xp" height="132" src="http://www.mysql-apache-php.com/netstat.JPG" width="400" /><br />
3. Look for connections with LISTENING and ESTABLISHED. Note that port numbers will be identified in the form of <b> 127.0.0.1<span style="color: blue;">:</span><span style="color: red;">1092 (IP address followed by colon is the port number).</span> In this case 1092 is the port.</b><br />
4. Note the PID (process id) for that port and this process id corresponds to program using it.<br />
5. Next we will find out that PID with windows task manager program. <br />
6. Go to ALT+CTRL+DEL then press <b>task manager</b> button. You will see the processes listed and the memory. <br />
<b>Note: By default with task manager it will not show the PID of the processes. You have to enable it from the options menu.</b><br />
<b><img height="447" src="http://www.mysql-apache-php.com/taskmgr.JPG" width="395" /></b><br />
Should you find the running process to be suspicious just end the process. <br />
<b>Tip:</b> Use a firewall like <b><a href="http://www.zonealarm.com/" target="_blank">ZoneAlarm</a></b> or <a href="http://www.personalfirewall.comodo.com/" target="_blank"><b>Comodo Firewall</b></a> (both are free) to block suspicious programs running on your PC.<br />
<h1><span style="font-size: large;">How to Investigate a Port in Linux</span></h1>It is very easy to investigate a port and kill that process in your linux server or box. <br />
<ul><li>First find the ports that are active and listening to.</li>
<li>Note the port and the process ID (PID)</li>
<li>Find which processes is running based on that PID</li>
<li>If you find anything suspicious, kill that process.</li>
</ul><div class="box">netstat -nap<br />
// lists both TCP and UDP connections (listening and established)</div><img alt="Netstat - Investigate suspicious port Linux " height="117" src="http://www.mysql-apache-php.com/netstat-linux.JPG" width="400" /><br />
<div class="box">ps <processid><br />
// this command tells which program is running this process id<br />
pidof <processid><br />
// alternate command</processid></processid></div>If you find this running program or process suspicious like trojan or worm, kill the process<br />
<div class="box">kill <processid></processid></div><div class="box"><br />
</div><div class="box">I got this over http://www.mysql-apache-php.com/investigate-port.htm I kept it over my blog to share as well for my knowledge management.</div>manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-4114265125225989672009-08-28T00:31:00.000-07:002011-05-09T13:09:54.232-07:00the very most important - how to search on google<a href="http://www.google.com/support/websearch/bin/answer.py?hl=en&answer=134479">Basic search tips</a><br />
<a href="http://www.google.com/support/websearch/bin/answer.py?answer=136861">More search tips</a>manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-71602358301223650252009-08-27T23:59:00.000-07:002011-05-09T13:11:17.881-07:00using rails environment specific commandsIt's for you only if are new to RoR, as you may get confused, Bcoz they all come in different shapes and sizes.<br />
<br />
For mongrel/Else<br />
<pre>mongrel_rails start -e production/ ruby script/server -e production
</pre><br />
For rake command:<br />
<pre>rake [task] RAILS_ENV=production</pre><br />
For ruby console:<br />
<pre>ruby script/console production</pre>manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0tag:blogger.com,1999:blog-8059693245108482334.post-10551838810979209232009-08-25T23:36:00.000-07:002011-05-09T13:14:39.642-07:00why rails is majestic rails?* Ruby on Rails includes features that help in increasing developer productivity. Some of the main features include the following:<br />
<br />
<br />
*<span style="font-style: italic;"> MVC/AGILE architecture:</span> Ruby on Rails is based on the MVC (Model View Controller) architecture that enables the data to be separated from presentation. It's an agile web development framework.<br />
<br />
* <span style="font-style: italic;">Database Access Library:</span> Ruby on Rails includes a database access library - Active Record - that simplifies data handling in databases. Active Record automatically maps tables to classes and rows to objects.<br />
<br />
* <span style="font-style: italic;">Libraries for common tasks:</span> Ruby on Rails includes a host of libraries that simplify the coding of common programming tasks such as form validations, sessions management, etc.<br />
<br />
*<span style="font-style: italic;"> AJAX Library:</span> An extensive library of AJAX functions is provided in the Rails framework. Ruby code can be used to generate AJAX code. The associated java scripting required for AJX gets generated automatically.<br />
<br />
* <span style="font-style: italic;">Convention over configuration:</span> Ruby on Rails does not have any XML configuration files. It includes simple programming conventions that can be used to specify the configuration parameters.<br />
<br />
* <span style="font-style: italic;">Customized URL:</span> Custom or Search Engine Friendly URLs can be developed using the Ruby on Rails framework.<br />
<br />
* <span style="font-style: italic;">Debugging:</span> Detailed error logs are provided, making it easier to debug applications.<br />
<br />
* <span style="font-style: italic;">Components:</span> Components can be used to store reusable code. Components can be included to modularize templates.<br />
<br />
* <span style="font-style: italic;">DRY:</span> Don't Repeat Yourself. You will get it when you actually write the rails code.manohar amrutkarhttp://www.blogger.com/profile/00041949577214855951noreply@blogger.com0