Usb modems performarnce in Pune.

I used so many GPRS services in pune.

I am really comfortable with that speed but When I used the Reliance broadband service I really got supprize about service of reliance netconnect.

What Reliance is providing is really good in service.
Many service providers are really saying they are going to provide us 120kbps browsing speed or downloading speed (like idea or tata and airtel, I really checked with speedometer).
they are speaking about speed about 230 kbps but they are providing to all people only 40 kbps browsering speed and they are offerering about 230 kbps in there broshers and that is absolutely wrong.

I really recommend reliance usb modem is providing is really good service in Pune.

Fetch the wordpress post paragraph number wise

In this article we given code for Fetch the wordpress post paragraph number wise. created One function for fetching the wordpress post as per p tag number.

Fetch the wordpress post paragraph number wise

# You can Use this function for showing

function paragraph_show($paragraph_number, $post_content){
$show_after_paragraph_tag = 1;
$paragraph_number= $paragraph_number - 1;
//echo $paragraph_number;
$content = apply_filters('the_content', $post_content);

if(substr_count($content, '

') > $show_after_paragraph_tag)
//echo substr_count($content, '

');

{
$contents = explode("

", $content);
$p_count = 0;
foreach($contents as $content)
{
//echo $p_count;
if($paragraph_number == $p_count){
echo $content;
}

$p_count++;
}
}
}

We can use this function like this.

In while loop you can use or paste following code

#This will show the first paragraph of post.
post_content);

Image upload issue in wordpress with nginx

Nginx server is used by wordpress itself. We solved Image upload issue in wordpress with nginx. you can use following code.

Image upload issue in wordpress with nginx

Please Use the following code:


location ~ ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
root /usr/share/nginx/html/wordpressmu;
rewrite ^/.*(/wp-admin/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
rewrite ^/.*(/wp-includes/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
rewrite ^/.*(/wp-content/themes/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
rewrite ^/.*(/wp-content/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
rewrite ^.*/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ /wordpress/wp-content/blogs.php?file=$1 last;

expires 10d;
break;
}

Nginx rule with image fix for multiple wordpress instance

I solved the issue with Wordprss and Images. If you want to host or install two instances on one domain in that senorio you can use following code. we given code for Nginx rule with image fix for multiple wordpress instance. you should use our code for fixing

Nginx rule with image fix for multiple wordpress instance

Please Use the following code;

location ~ ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
#images for wordpress instance one
if ($request_uri ~* /wordpress) {
set $set_root /usr/share/nginx/html/wordpress1;
}
#images for wordpress instance two
if ($request_uri ~* /moms) {
set $set_root /usr/share/nginx/html/wordpress2;
}

root $set_root;
rewrite ^/.*(/wp-admin/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
rewrite ^/.*(/wp-includes/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
rewrite ^/.*(/wp-content/themes/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;
rewrite ^/.*(/wp-content/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last; expires 10d;
break;
}

How to change the computer name in linux

Follow me if you want to change the computer name on Linux
[siwan@localhost ~]$ hostname siwan
hostname: you must be root to change the host name
[siwan@localhost ~]$ su
Password:
[root@localhost siwan]# hostname siwan
[root@localhost siwan]#

close the terminal or command prompt and start again

[siwan@siwan ~]$

your Pc name will be siwan

command : hostname your_desired_computer_name

How to host multiple rails site on Nginx

Nginx famous now. We given information for how to host multiple rails site on Nginx. we given the configuration code along with their detailed information.

How to host multiple rails site on Nginx

User following code in Nginx.conf file.. and paste into that file.
#vim /etc/nginx/nginx.conf


http {
include       /etc/nginx/mime.types;
default_type  application/octet-stream;
access_log  /var/log/nginx/access.log  main;
sendfile        on;

upstream mongrel_cluster_example1 {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
}

upstream mongrel_cluster_example2 {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}

# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;

server {
listen       80;
server_name  example1.com example2.net;
client_max_body_size 120M;

set $myroot /var/www/html;
if ($host ~* example1\.com$) {
set $myroot /home/example1/public;
}

if ($host ~* example2\.net$) {
set $myroot /home/example2/public;
}

root $myroot;

location ~* ^/(images|stylesheets|javascripts).+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
{
root $myroot;
}

location / {

if ($host ~* example1\.com$) {
proxy_pass      http://mongrel_cluster_example1;
} #if check for domain qa.teenangel ends here

if ($host ~* example2\.net$) {
root /home/rail_project/myproject/public;
proxy_pass      http://mongrel_cluster_example2;

} #if check for domain ends here

}

}

}

USA State list for Rails

Every time we need this migration script for our projects
Use following command for Model generate
[siwan@localhost siwan]$ ruby script/generate model UsStates
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/us_states.rb
create test/unit/us_states_test.rb
create test/fixtures/us_states.yml
exists db/migrate
create db/migrate/20091117115011_create_us_states.rb
[siwan@localhost siwan]$

Open the /db/migrate/20091117115011_create_us_states.rb file and paste following code:

class CreateUsStates ‘Alabama’, :abbreviation => ‘AL’
UsStates.create :name => ‘Alaska’, :abbreviation => ‘AK’
UsStates.create :name => ‘Arizona’, :abbreviation => ‘AZ’
UsStates.create :name => ‘Arkansas’, :abbreviation => ‘AR’
UsStates.create :name => ‘California’, :abbreviation => ‘CA’
UsStates.create :name => ‘Colorado’, :abbreviation => ‘CO’
UsStates.create :name => ‘Connecticut’, :abbreviation => ‘CT’
UsStates.create :name => ‘Delaware’, :abbreviation => ‘DE’
UsStates.create :name => ‘District of Columbia’, :abbreviation => ‘DC’
UsStates.create :name => ‘Florida’, :abbreviation => ‘FL’
UsStates.create :name => ‘Georgia’, :abbreviation => ‘GA’
UsStates.create :name => ‘Hawaii’, :abbreviation => ‘HI’
UsStates.create :name => ‘Idaho’, :abbreviation => ‘ID’
UsStates.create :name => ‘Illinois’, :abbreviation => ‘IL’
UsStates.create :name => ‘Indiana’, :abbreviation => ‘IN’
UsStates.create :name => ‘Iowa’, :abbreviation => ‘IA’
UsStates.create :name => ‘Kansas’, :abbreviation => ‘KS’
UsStates.create :name => ‘Kentucky’, :abbreviation => ‘KY’
UsStates.create :name => ‘Louisiana’, :abbreviation => ‘LA’
UsStates.create :name => ‘Maine’, :abbreviation => ‘ME’
UsStates.create :name => ‘Maryland’, :abbreviation => ‘MD’
UsStates.create :name => ‘Massachutsetts’, :abbreviation => ‘MA’
UsStates.create :name => ‘Michigan’, :abbreviation => ‘MI’
UsStates.create :name => ‘Minnesota’, :abbreviation => ‘MN’
UsStates.create :name => ‘Mississippi’, :abbreviation => ‘MS’
UsStates.create :name => ‘Missouri’, :abbreviation => ‘MO’
UsStates.create :name => ‘Montana’, :abbreviation => ‘MT’
UsStates.create :name => ‘Nebraska’, :abbreviation => ‘NE’
UsStates.create :name => ‘Nevada’, :abbreviation => ‘NV’
UsStates.create :name => ‘New Hampshire’, :abbreviation => ‘NH’
UsStates.create :name => ‘New Jersey’, :abbreviation => ‘NJ’
UsStates.create :name => ‘New Mexico’, :abbreviation => ‘NM’
UsStates.create :name => ‘New York’, :abbreviation => ‘NY’
UsStates.create :name => ‘North Carolina’, :abbreviation => ‘NC’
UsStates.create :name => ‘North Dakota’, :abbreviation => ‘ND’
UsStates.create :name => ‘Ohio’, :abbreviation => ‘OH’
UsStates.create :name => ‘Oklahoma’, :abbreviation => ‘OK’
UsStates.create :name => ‘Oregon’, :abbreviation => ‘OR’
UsStates.create :name => ‘Pennsylvania’, :abbreviation => ‘PA’
UsStates.create :name => ‘Rhode Island’, :abbreviation => ‘RI’
UsStates.create :name => ‘South Carolina’, :abbreviation => ‘SC’
UsStates.create :name => ‘South Dakota’, :abbreviation => ‘SD’
UsStates.create :name => ‘Tennessee’, :abbreviation => ‘TN’
UsStates.create :name => ‘Texas’, :abbreviation => ‘TX’
UsStates.create :name => ‘Utah’, :abbreviation => ‘UT’
UsStates.create :name => ‘Vermont’, :abbreviation => ‘VT’
UsStates.create :name => ‘Virginia’, :abbreviation => ‘VA’
UsStates.create :name => ‘Washington’, :abbreviation => ‘WA’
UsStates.create :name => ‘West Virginia’, :abbreviation => ‘WV’
UsStates.create :name => ‘Wisconsin’, :abbreviation => ‘WI’
UsStates.create :name => ‘Wyoming’, :abbreviation => ‘WY’

end

def self.down
drop_table :us_states
end
end

Goodlunk, This code will save your problem of fetching USA state names and abbreviations as per id

Check my controller code…Just put in your controller

@us_states = USStates.find(:all)

<% form_for :customer, @customer, :url => { :action => “new_application” } do |f| %>
<%= f.select :state_id,  @us_states.collect {|state| [ state.abbreviation, state.id ] } %>
<% end %>

Issue with installing the mysql gem: solved, how to install mysql gem without issue

When tried to install mysql gem I got following error
[root@localhost siwan]# sudo gem install mysql
Building native extensions. This could take a while…
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for mysql_ssl_set()… yes
checking for rb_str_set_len()… no
checking for rb_thread_start_timer()… yes
checking for mysql.h… no
checking for mysql/mysql.h… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/bin/ruby
–with-mysql-config
–without-mysql-config

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

To find the mysql path on machine used following command
[root@localhost siwan]# which mysql
/usr/bin/mysql

I tried following command:
[root@localhost siwan]# sudo gem install mysql — –with-mysql-dir=/usr/bin/mysql

I Got the same error

[root@localhost siwan]# sudo gem install mysql — –with-mysql-dir=/usr/bin/mysql
Building native extensions. This could take a while…
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for mysql_ssl_set()… yes
checking for rb_str_set_len()… no
checking for rb_thread_start_timer()… yes
checking for mysql.h… no
checking for mysql/mysql.h… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/bin/ruby
–with-mysql-config
–without-mysql-config

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
ERROR: could not find gem — locally or in a repository
ERROR: could not find gem –with-mysql-dir=/usr/bin/mysql locally or in a repository

Then I checked the mysql-devel
[root@localhost siwan]# yum list mysql-devel
Loaded plugins: refresh-packagekit
Available Packages
mysql-devel.i586 5.1.37-1.fc11 updates

Then I Installed the mysql-devel
[root@localhost siwan]# yum install mysql-devel
Installed:
mysql-devel.i586 0:5.1.37-1.fc11
Complete!

Then I tried the mysql Gem installing…..I am able to install the mysql gem…
[root@localhost siwan]# gem install mysql
Building native extensions. This could take a while…
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1…
Installing RDoc documentation for mysql-2.8.1…
[root@localhost siwan]#

Install mp3 player and vlc player on Fedora

Play mp3 songs in fedora linux
I am using the Fedora 11 and on that I am going to install the Fluendo MP3 plugin

Install mp3 player and vlc player on Fedora

If you want to install the Fluendo MP3 plugin on Fedora 8, 9, 10 or 11
Use same steps;

Download fluendo-codecs-mp3-7-1.i386.rpm file from here:

fluendo-codecs-mp3

Use following command:
[root@localhost siwan]# rpm -i fluendo-codecs-mp3-7-1.i386.rpm

How to install the Vlc player on Fedora 8, 9, 10 or 11
root@localhost siwan]#  su
[root@localhost siwan]#  rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
[root@localhost siwan]# yum install vlc
[root@localhost siwan]# yum install mozilla-vlc (optionnal)