Wednesday 22nd of May 2013

logo

CodeFire Blog
Link Joomla Blogs/Articles with Google plus profile PDF Print E-mail
User Rating: / 3
PoorBest 
Search Engine Optimization
Written by Pranjal Srivastava   
Wednesday, 20 March 2013 06:47

 

We have created a Joomla plugin that will help you easily link Google plus profile with Joomla Blogs or articles. All you have to do is install the plugin from Joomla plugin page and follow the basic steps as mentioned on the page. Some of the important steps are:

1. First of all you will need a Google+ profile. If you don’t have one this is a good time to create one!

2. Then while you are setting up Contact profile in Joomla, ensure that you enter correct Google+ profile url in Web URL field as displayed in below image

 

3. Do add link of your site under “Contributor to” section of Google+ profile (under edit profile) as displayed in below image

 

4. After you have done all this, and enabled the plugin. You can immediately test whether integration with Google+ and Google Search is working or not by going to  http://www.google.com/webmasters/tools/richsnippets Enter the url of your page and if the result shows image of the author as displayed below, then the integration is working just fine. 

 

Now it is just a matter of time before your image starts appearing on Google search. Some times you may need to add a new Article / blog to your site so that google can crawl the site for the search index to get updated and new results to start showing up.

 

 

 
Setup SSL certificate on Amazon EC2 PDF Print E-mail
User Rating: / 4
PoorBest 
Technology
Written by Pranjal Srivastava   
Thursday, 06 December 2012 14:27

 

I am using unbuntu based EC2 instance so commands are specific to that but the steps are mostly generic and will apply to most linux distributions.

There are basically 4 steps for this:

1.  Create CSR 

I basically used OpenSSL to generate CSR as it is installed by default in ubuntu. You can go to https://www.digicert.com/easy-csr/openssl.htm to get the command to generate CSR. Once you have the command login to your EC2 instance via ssh. And run the command. It will create 2 files, namely www_domain_com.csr and  www_domain_com.key  [in this case I am generating certificate for www]

 

2.  Buy SSL certificate

Once you have the CRS ready you need to buy the certificate. This should generally be quick. I generally use godaddy as they offer huge discounts ;). Once you have bought the certificates you will get domain.com.crt file. Please retain the key file that you generated inthe CSR process (step 1).

 

3.  Enable HTTPS support on Apache

a. Run the command “sudo a2enmod ssl” to enable mod_ssl. 

b. Then run the “sudo a2ensite default-ssl” to configure Apache2 for HTTPS. 

c. After you have done this restart Apache “sudo /etc/init.d/apache2 restart”. 

The HTTPS support on apache should work now. One important point to note here (this wasted a lot of my time Cry, you need to open port 443 on AWS console from the Security group for this server. Though we have not installed the certificate yet, but just test the site with HTTPS to ensure that you are able to access the server. Now you should be able to access the site on HTTPS. 

 

4. Install the certificate 

Now you have both key and certificate files ready and Apache already is enabled to support HTTPS. So let’s go ahead and install the newly got certificate files. For this you need to copy the .key file (that got generated while creating CSR) to /etc/ssl/private/ and certificate file to /etc/ssl/certs/. Then open the file /etc/apache2/sites-available/default-ssl and search SSLCertificateFile and SSLCertificateKeyFile. Change these paths to the actual certificate and key paths and restart the Apache server.

Now you are all set!Cool


 

 
Optimizing the URLs using slugs PDF Print E-mail
User Rating: / 5
PoorBest 
Search Engine Optimization
Written by Pranjal Srivastava   
Sunday, 02 December 2012 08:59

 

If you are using the URLs such as http://domainname/index.php?pid=12&uid=821 they do serve the purpose of opening the correct page however they do not provide any information to the user as to what page they are going to see and what they should expect on this page. Also, as we all know the URLs are also very useful for search engine optimizations, so unless the URL conveys complete information it is not of much use.

So in the above case let’s assume that pid represents the page (for example user’s profile page) that needs to be opened and uid represents the user’s id whose information will be displayed on this page, if we change the URL to something like http://domainname/userprofile/firstname-lastname

 

(Be aware google treats dash and underscore differently in the URL and dashes are better) then it conveys a lot of meaning to the end user and also is meaningful for search engines. However one point to note above is that a URL needs to be unique and in the above URL there is no element that makes it unique. So we need to insert another element that is unique in the above url. Generally each of the resource has an id associated with it, so that can be used to make a unique url something like http://domainname/userprofile/821/firstname-lastname

Now to achieve this change in URL all you have to do is map pid=12 with userprofile using htaccess rules and use the unique id to render the page. Also, you would want to create a utility function that will generate the user profile URLs. Within this function you can encapsulate the logic of URL creation, whether it is as simple as concatenating two fields or using a new table column as slug.

 

 
Google’s suggestion on using dashes and underscores PDF Print E-mail
Search Engine Optimization
Written by Anjali   
Sunday, 02 September 2012 00:00

 

If you have a URL such as http://domainname/page/info1-info2 dashes (-) are then translated by google as spaces so the above “info1-info2” becomes “info1  info2” however if you are using “info1_info2” it translates to “info1info2”.

So if you are deciding on the URL scheme it is better to use dash rather than underscores however as per Matt in this video it is not worth the effort to change the existing urls which have underscores to dashes.

 

 

 
Data scraping using cURL in PHP PDF Print E-mail
User Rating: / 28
PoorBest 
Technology
Written by Pranjal Srivastava   
Friday, 01 July 2011 15:23

(Please ensure that you are a genuine user of the site, and site allows you to do some automation and does not consider it as hacking attempt)

Data scraping

Let’s assume that the task for the day is to pull some data out of a site (eg. download a csv file) programmatically where data is behind a login. We shall use PHP/cURL for this automation. I am not going to be talking about cURL or any basic technical details associated with it. So please do not treat this as tutorial for learning cURL J. I am only going to talk about high level process to be followed and some gotchas that could make your life difficult in this process.

First step: You will need to login to the site using cURL. Inspect the login form using a tool such as Firebug or view source to see what all fields are being sent and what is the endpoint of the request. You will need all this information to send login request to the site using cURL. In fact, make a small HTML version of form (using code from the site) on local machine and try and login with that. If it works part of the job is done.

Another point that could be very helpful here is, if the form uses POST request convert that to GET and send the request to a local url to see what all parameters are passed. Sometimes there could be some hidden variables which are not very easy to track. Now inspect the query string from the GET request and create a url for cURL POST based on this string. One important point while writing login request is not to forget saving the cookie. So set the option CURLOPT_COOKIEFILE with filename. Also, you could get the filename using $tmp_fname = tempnam("/tmp", "COOKIE"); to make it platform independent (windows, Linux, Mac)

Every site comes with its own site of rules for login but broadly keeping above points in mind you should be able to login to any site using cURL.

 

Second Step: After login the next step is to get the file and save it on disk. If the site URL is simple (non dynamic) then there is no problem just invoke a simple GET request for that URL with cURL and save it to disk. However if the URL for the file is dynamic then you need to fetch the page which has the link, search for the link in the page of that text (knowledge of REGEX would come handy here) and get the dynamic URL. And then invoke cURL again on the dynamic URL to get the data. One point to keep in mind in case you are dealing with dynamic URL is that when you get the string for URL in php variables if there is any & it gets converted to & so if you directly invoke the url to get the data it will not work. Use htmlspecialchars_decode to get actual URL and you should be able to save the data.

 

 

 

 

 
Open Source option (Gammu) to connect your Phone PDF Print E-mail
Technology
Written by Pranjal Srivastava   
Sunday, 26 June 2011 12:25
I started this experiment to be able to test the integration of a web based (PHP) application and SMS using a phone connected to machine on which web server is running. 
Gammu seems to be a good open source option to setup PC to phone connection. Gammu comes with multiple utilities such as Wammu (which adds UI based interface to this).  Since I was looking specifically for SMS based options, there is a utility called gammu-smsd which comes bundled with Gammu which runs as daemon and can be used to integrate incoming and outgoing SMS.  It comes with multiple options for integration such as file based integration, SQL (MySQL, PostgreSQL, SOL Lite) based integrations. 
While trying Gammu or gammu-smsd one of the first things to so it set up configuration file so that these applications can connect with Phone and if needed DB (which was true in our case). Config file follows ini file pattern and all the options are very well explained at gammu-config , for gammu-smsd config options look at gammu-smsd config. After going through these links I created a simple config file 
 
---------------------------------
[gammu]
device = com3:
connection = at115200
[smsd]
Service = sql
Driver = native_mysql
PIN = 1234
LogFile = c:\syslog
User = root
Password = password
PC = localhost
Database = sms  
----------------------------------------
 
  I connected my Nokia 5800 using Bluetooth with my windows based machine. Com3 was the port on which my phone was connected. After setting up the config file I tried the information command from command line and got following output
 
 
So that means the connection was established.  After this the next step I tried was connecting gammu-smsd. Gammu comes with db schema for creating database so that gammu-smsd can connect with it. The schema is located in source code under folder 
Gammu-1.29.0-Windows\Gammu-1.29.0-Windows\share\doc\gammu\examples\sql
 
I created the db named smsd and imported the tables and ran the command to connect gammu-smsd and got error
 
 
 

I thought I had setup the DB etc correctly but it was somehow looking foe sms database and not smsd (Initially I had set ‘smsd’ as database name in config file). So it seems there is a bug in version 1.29.0 that it always looks for sms named database. Realizing this I modified the DB name and modified the config file and then the gammu-smsd ran successfully.
It seems that gammu is not able to send SMS using Nokia 5800 Express music since I got following output 
 
 
 

 Same is reported on Gammu site as well (Nokia 5800).   I think I will have to get hold of a supported phone to test outgoing and incoming messages. 
Gammu also comes with PHP classe gammu, which has wrapper to send and other functions exposed by gammu which can easily be used to integrate with PHP. 
So it seems very much possible to be able to create a web based application that can send SMS using a GSM phone connected via Gammu. 

 
Adding custom Facebook tab PDF Print E-mail
Technology
Written by Pranjal Srivastava   
Friday, 24 June 2011 12:34
CodeFire Facebook page

 

Facebook gives you a functionality to add facebook applications as tabs on your existing pages. Also there are (programmatic) ways to be able to find out if users have liked your page or not. This functionality can very well be used to 'entice' users to like your pages. We have added a "Welcome" tab to our Facebook page. Do take a look at the same and let us know what you think about it. This application is completely CMS driven, so you can change what displays on the pages without knowing any HTML. If you like the application and want to know more about it mail us at fbapp (at) codefire.in

 
Google Panda Update 2.2 is live (16 June 2011) PDF Print E-mail
Search Engine Optimization
Written by Pranjal Srivastava   
Friday, 17 June 2011 00:00
What is Google Panda
 
Google panda is basically a new algorithm announced by Google. Its aim is to fight against content farms (duplicate content website).
Google started rolling out its Panda update initially in February in the US and later in April it reached a few other regions. The Google Panda update was made to reduce the amount of spam within the Google search results

Google panda is not a complete overhaul of the ranking algorithm but is a value that feeds into the overall Google algorithm. If it helps consider it as if every site is given a PandaRank score. Those low in Panda come through OK; those high get hammered.
Google Panda


The Panda Ranking Factor
 
Rather than being a change to the overall ranking algorithm, Panda is more a new ranking factor that has been added into the algorithm

Panda is a filter that Google has designed to spot what it believes are low-quality pages. Have too many low-quality pages, and Panda effectively flags your entire site. If you have a high Panda rank that doesn’t mean that your entire site is out of Google. But what it does is adds a penalty to help ensure only the better ones make it into Google’s top results.


Conclusion
 
Google keeps making small algorithm changes all the time, which can cause sites to fall (and rise) in rankings independently of Panda. It also keeps updating factors that feed into the overall algorithm, such as PageRank scores, on an irregular basis. Those updates can impact rankings independently of Panda. So far, Google has confirmed when major Panda factor updates have been released. If you saw a traffic drop during one of these times, there’s a good chance you have a Panda-related problem.


 
CodeFire Technologies Blog PDF Print E-mail
CodeFire News
Written by Pranjal Srivastava   
Wednesday, 15 June 2011 00:00
This is the place where we will be keeping track of latest in technology, update the latest from the company and more. So stay tuned...
 



 Copyright © 2010 CodeFire Technologies Pvt Ltd All Rights Reserved.