my net house

WAHEGURU….!

Monthly Archives: March 2015

Anti-gravity and Python

Ok let’s talk about Anti-gravity thing. Yeah we can get that it is easy, But Easy-Difficult is a state of mind, Once in a life talking toΒ  a girl was difficult or speking English. πŸ˜€ πŸ˜€ hahhahaha, I love Evolution!

Ok what is Antigravity?

When someone wants to rise it is the force which pulls you back which could be named as C++, C, Or other great Languages which are written by great people for great peoples. But not Python! It is written by totally Cracked one who love to talk about “TROLLS” while having presentation. πŸ˜€

There is no use of theory without examples:

Ok I am sitting in front of metal-machine and time is 8:17 am and I want to make Great music beat. :-O

What to do now?

Google: Make music beat with python

Ok I got something which let me allow “import Music” [8:24] am

Things are downloading and I am going to do some regular tasks.

Ok things are downloaded: 9:00

ops I got too deep in documentations, Starting now: 9:14

##################Python code##################

from music import * # This defines analogy of anti-gravity

note = Note(C4, HN) # Got up from ground, It is difficult to get up when you start flying, πŸ™‚ πŸ™‚ πŸ™‚
Play.midi(note) # Enjoy flight

Please feel free to appreciate inside comments box. πŸ˜€

Stream editor commands

Played with srtream files for various things to be played:

sed -i s/<search-teaxt>/<replace with> filename

#when removing forward slashes from file:

sed -i /\\/// filename # we don’t have to replce anything so weΒ  are not writing it.

#put inverted comma in each line

#put inverted comma in each line
sed 's/.*/"&"/'



#without spaces
sed 's/ *\(.*\) *$/"\1"/'
#skip empty lines

sed 's/ *\(.*\) *$/"\1"/'












Google X or XGoogle

When I saw it I just exclaimed with joy. yeah I got thatΒ  What I was looking for.

We can call it Searching-Automation.

xgoogle is Python library which let you to use Google from your computer. Obviously google does not like it. So use it well. πŸ™‚ πŸ˜‰

For more information you can read the whole link here:http://www.catonmat.net/blog/python-library-for-google-search/

Or I will write 4 Python lines and you will get it. πŸ™‚

<code>

import xgoogle

Intial_search = GoogleSearch.search(“kulche chole bhtoore”)

results=Initial_search.get_results()

print results.url.encode(‘utf8’)

</code>

Please do comment and Go to provided link for more information.

SEO and Scrap[ing

There are many voices rise in your head when you for SEO optimization.

Like:

1. Which framework to use?

2. What kind of code has to be written?

3. Which tools are helpful for SEO?

4. What kind of system we need to deploy?

5. Which keywords are there?

6. How to check other similar websites having same content and also “shining” in the first page of the Google?

Many more things……..

IMHO there is only two things we have to take care.

1. Content.(Content is King!)

2. How to deploy it. (Some rules and regulations)

There is one thing that one need to know that Deployment of content can be “loosed string” but not Content!!

We are using Scrapy to get Idea that what kind of Content we need and for that we have to crawl a spider on various competitors web-pages and get data like “head” “title” “meta-tags””meta keywords” (some say it’s not important in these days and let thensay it. ;)) “meta description” “images and image-description” “back-links” “robot-control syntax”(robot.txt) “sitemap” “user-agents” At last but not the least <“CONTENT”>

But how and why we can scrap whole content of one website and how it will help us to SEOing?

Ans: We don’t need to scrap whole content. We just can study that content of Wesite to write our own.

There is a nice article for content Density.

http://usabilitygeek.com/content-density-importance-for-usability-and-seo/

In real Content searching for SEO could be endless but using a web-spider you can crawl many pages of your similar interests so you can get a great set of content and make one for yours.

Keep coming… πŸ™‚

Scrapy from beginners to Experts

Disclaimer: be aware of the fact that you can be blocked by a server or bring down a website by crawling through it too aggressively.

It is all about data Scraping.

Data Scraping?

Yeah! It is a kind of awesome thing to play with and I am Python fan. Python fan? πŸ˜› (Yeah because it is easy to use :D)

Ok let’s start Actual part:

$ sudo pip install scrapy

Ok that’s it.

$ scrapy startproject hello

The above command will create very nice project. That’s it. Now enjoy. πŸ™‚

<code>

hello/

	scrapy.cfg # the project configuration file

	hello/ # project module

		__init__.py

		items.py # items file

		pipelines.py # pipelines file

		settings.py # settings file

	spiders/ # all your spiders will be stored in this file


		__init__.py

</code>

Now you have to play with Python part according to your requirements so and that’s it. Bingo!

For more quick and detailed view please go for the following link:

http://davidwalsh.name/python-scrape

I would suggest for more and more description you have to write more more and more Python code and follow Official code:

http://doc.scrapy.org/en/latest/

%d bloggers like this: