Skip to content

Yelpshop's SEO Way – Earn Money

Jessica SEO Learning and Trying to Earn Money

Archive

Category: Free

Reporting Your Results

This is arguably the most important part of your SEO campaign! Keep an eye on your website’s organic traffic and mark any upward trends. Can this be attributed back to your link building campaign? If so, this is no time to be shy.

Best of luck!

The Budget is Set

So let’s imagine your client or boss (if you’re in-house) has promised to commit some time and money into a link building campaign. Huzzah! Finding yourself in a position to invest in SEO both financially and resourcefully is a great place to be, and these opportunities don’t grow on trees. So it’s tremendously important that this sum of money (and time) is invested wisely and provides a return, or else that “crazy SEO wizardry” might never make its way into the company budget again.

So how best to go about spending this money? That, of course, depends on a lot. There are different kinds of link building strategies for different kinds of businesses in different stages of their SEO development. Answering some of the following questions may help with the “Who am I?” questions your website is surely asking itself (your-site.com/existential-crisis).

  1. Have we done any link building in the past? In other words, how low are the “low hanging fruit”?
  2. What is a reasonable goal here? Increasing overall domain authority and maybe increasing long tail traffic? Or boosting a specific page in the SERPs?
  3. How does the competition stack up? How much work needs to be done to overtake the competition?

Directory Submissions

We COULD invest $2,000 pretty easily with directory submissions and it wouldn’t have to take anymore than 5 hours. The better strategy would be to invest a bit more time into the research phase before throwing $2,000 into a bunch of spammy directories.

Some of the big paid directories are a given; Yahoo!, Best of the Web, Business.com and JoeAnt have established themselves as strong, link juice-passing options. Assuming our web site is not found in any of these directories we’re looking at almost $800 already, and that isn’t considering the annual renewal cost of most of these top-tier directories. This leaves us with around $1000 for submissions to niche and local directories that are deemed worthwhile; Rand discussed the litmus test for identifying these worthwhile directories in a recent Whiteboard Friday.

Who should do it?

In most cases, anyone that is not currently listed in the top-tier directories should make the investment. You do NOT want to be submitting to directories if your site is of low quality, as your site could be declined and you won’t get that money back.

Investing in directories is a good idea early, but I wouldn’t suggest shelling out $2,000 in directories and declaring “mission accomplished”. The better plan would to be to submit to paid directories slowly over the course of a few months, supplementing directory submissions with some more creative link building strategies. Also, don’t forget that a sudden spike in backlinks followed by a lull of no new links is sure to set off a red flag or two.

Outreach (PR for links)

Outreach can be an inexpensive undertaking in terms of cash spent, but the real cost is in the time it takes to do it right. Commissioning under-worked call center staff or interns to call or email relevant site owners can be a great use of “found” time to generate links, but they’ll still need some guidance. I find its a great idea to craft a quick “SEO 101″ document, including bits about how search engines value links, anchor text, and other best practices. You might do well to give a primer on how to quickly evaluate a potential linking partner (say, only target sites with a domain authority over 55?), so your minions don’t go wasting their time on spammy worthless links.

Where outreach can get costly is in offering products, discounts, or other financial incentives to acquire links. Of course, we’re getting a bit close to grey-hat SEO here, but is there really anything wrong with offering free product samples to generate interest? I suppose the white-hat method of product samples/discounts/etc. is to not require a link back, but if you ask me this is where the whole distinction gets kind of silly.

Your odds of acquiring links through outreach get a lot better when samples or other incentives are involved. B2B? No problem. Incentives could include a free trial, a demo or white paper. If you do your homework, you’ll know who to approach to make sure your not just giving away hundreds of dollars of product without any hope of acquiring new customers.

Your overall outreach costs could get a bit fuzzy, and measuring a return will require some serious tracking in most cases. Some tracking ideas include:

  • Utilizing separate coupon codes for every outreach target
  • Sending visitors to a mini-site, landing page, or tracking URL
  • Making use of custom variables in Google Analytics to track the long term value of the campaign

Who should do it?

There’s not much of a disadvantage in spreading the good word of your company around via public relations, so really every business should do it. Your SEO mileage may vary, however, if your business’s website is not finished, a complete mess, or an otherwise unattractive linking partner. No matter how attractive your pitch, no one will want to link to a one-page or “coming soon” site.

No matter what, you’ll want to make sure you’ve got all your tracking ducks in a row, so that you can report good things to the big boss (wo)man.

Buying Links

Buying links is sort of like the elephant in the room. In one hand, we have 2,000 dollars, in the other, we have a mouse that can easily point its way off to a link broker network. We can spend 10 hours max and lock down $2,000 worth of links and have them all live by COB. Do those links lead to better rankings? They might. BUT! The likelihood of these links ceasing to pass value in the near future is extremely high.

Who should do it?

Almost no one. Investing $2,000 into paid links, especially from a link broker, is not liable to provide a long-term return on that investment. While I agree with Rand in his post about the somewhat discouraging amount of webspam making its way into the index, the optimist in me is hoping Google’s just working on some super spam detector and soon all the white-hats will be rewarded.

Linkbait/viral marketing

Call it what you will, but the name of the game here is content. Whether its a blog post, an infographic, a widget, a video, a funny 404 page, a comic, and so on, if its done well, there’s no greater way to invest in link building.

There are tons of great examples of linkbait that have cost less than $2,000, but the most recent campaign that went hot was the whiteboard HOPA girl. After conceptualizing the project, theChive put out a job listing for a “girl next door” model at a rate of $400 per day. Even if the shoot took 2 days, theChive probably paid no more than $1,000 to make it happen.

Who should do it?

Most anyone. With a great idea, $2,000 is plenty of money to build some great links via content marketing. Of course, the important part is the great idea. This is where your 60 hour allotment of time may come in handy for brainstorming. If the idea can’t be executed in-house, tap your network for a good resource to help, or use services like oDesk, guru, and eLance to find a freelancer.

One caveat here is that your link building campaign can only go as far as your (social) network will take it. Before hitting “publish”, make sure you’ve got a good seed of retweeters, rebloggers, and likers standing by.

Post to Twitter

Copy 一向是中国人的强项。腾讯的成功向我们证明了,Copy不是注定失败,小公司的Copy也许也能成就一帆大事业。

Google的成功让很多人都眼红,做为80年代的中国学生,大多数都习惯用Google(至少我本人就是)。

Baidu的中国暂时还是占据着大部分的人群。让我们看看Baidu统计与CNZZ统计横向评测。

流量统计作为互联网站点最基础的数据分析工具,几乎与每个站长、互联网从业者相关。在互联网这个没有硝烟的战场上,流量统计工具就像打仗用的武器。能否选好适合自己的武器、用好武器,很大程度上决定了我们的胜败。

  今天我们就来说说百度在今年新推出的免费流量统计工具:百度统计,与之对比的是统计工具:CNZZ(含全景统计和广告统计)。今天我们来横向测评下这两款武器。

  一、基本的统计数据指标

  数据指标是一切数据的基础,反映了流量分析的广度:

  CNZZ各个报告的指标,如下:

  1.时段分析:PV,独立访客,IP,人均浏览次数、新独立访客、人均浏览次数

  2.搜索引擎、搜索词:搜索次数、关键词个数、独立访客、IP、人均搜索次数

  3.来路页面、域名:来访次数、独立访客、IP、新独立访客、新访客浏览次数、站内总浏览次数

  4.受访域名、页面:浏览次数、独立访客、IP、人均浏览次数、平均停留时间、跳出率、进入次数、离开次数

  5.地域、浏览器等:浏览次数、独立访客、IP、人均浏览次数、平均停留时间

  百度统计各个报告的指标,如下:

  1.趋势分析(时段分析)、来源类型、搜索引擎、搜索词、推介网站、地域、浏览器等系统环境报告:浏览量、访问次数、访客数、新访客数、IP数、跳出率、平均访问时长、平均访问页数、转化次数、转化率

  2.最常访问、入口页面、退出页面报告:浏览量、入口页次数、退出页次数、平均停留时长、退出率

  3.还有一类专门针对百度推广的,指标除了1)所列的指标以外,还包括:点击、消费、平均点击价格、平均转化成本、收益、利润、投资回报率

  点评:

  1、CNZZ各个不同的报告提供的指标有一定差异,有针对性,不过比较混乱,体系不够清晰。

  2、百度统计各个报告的指标设立的较有章法,各个最细的报告上都提供了完整的网站流量和质量评价指标,但有点过于严谨,不过数据也算完整齐全。

  3、在PV,UV,IP这些基本的统计指标上,百度统计和CNZZ没什么明显差异,而在流量质量评价方面,百度统计采用了基于Session的统计方法,这点是比较科学的。

  二、数据统计的维度

  有指标,还不行,还要看可以从哪些角度来拆分数据。这决定了数据的深度:

  CNZZ的统计维度基本上都是一维的,有少许两维交叉:

  1、一维:时间(按天、按小时)、搜索引擎、关键词、来路域名、来路页面、来路分类、受访域名、受访页面、、浏览器、分辨率、操作系统、语言、终端类型、插件安装、回头率、访问深度

  2、二维:搜索引擎×搜索词、地区×网络接入商

  百度统计除了各种一维统计以外,还提供了一些多维交叉分析:

  1、一维:时间(按天、按小时)、搜索引擎、搜索词、推介网站、推介网页、来源类型、地域、、页面分析、地域、浏览器、操作系统、屏幕分辨率、屏幕颜色、flash版本、是否支持java、语言、是否支持cookie、网络服务提供商

  2、二维及多维:搜索引擎×搜索词、时间(按小时)×(来源类型、搜索引擎×搜索词、推介网站)×地域

  点评:

  1、CNZZ数据维度简单,提供的地区×网络接入商比较实用,但比较难做深入的分析。

  2、百度统计提供的数据维度非常丰富,特别是时间×来源×地域的组合,可以定位到某一个外链分小时的流量变化,帮助很大,当然,系统上手难一点。

  三、实时网站流量统计

  不少草根站长都有盯着数据的习惯。看看这方面分别满足的如何:

  CNZZ:

  1、最近15分钟每分钟的PV和IP数、总的PV,总的IP数

  2、最近15分钟的访客访问记录

  百度统计:

  1、最近30分钟每分钟的PV和独立访客数

  2、最近500条的访客访问记录

  点评:

  1、百度统计的访客访问记录,帮我把用户的访问过程都排列好了,而不像CNZZ是按照IP找,大家都知道一个网吧里出来的都是一个IP,查出来的访问记录那叫一个乱;

  2、百度统计没有cnzz那个最近15分钟的数据, 不过它的最近30分钟的Flash会自动刷新,这点还算方便

  四、易用性和可用性

  1、易用性方面:

  CNZZ:界面上广告比较多,但是大家都习惯了,操作起来比较简单。

  百度统计:界面简洁,非常清新,没有广告,报告中的折线图、饼图Flash漂亮,尤其是概况页那个分小时的对比图。

  2、可用性方面:

  CNZZ:中午的时候数据比较难查出来,偶尔还出点小问题。

  百度统计:查询速度挺快的,也较稳定,数据的存储量还挺大的

  点评:

  1、CNZZ要挣钱,肯定得有广告,不过这都还好,关键是偶尔出点问题这一点还是挺让人抓狂的。

  2、百度毕竟有很多服务器,带宽也大,所以易用性和可用性方面,百度统计胜出。

  五、高级分析和增值功能

  这方面,内容很多,一般小站点用不到,可以说日IP小于100的不用往下看了,简单做了列举,有兴趣的朋友可以自己比较:

  CNZZ:

  升降榜:用于追查流量变化原因的功能,提供了关键词、来路、受访页面三个维度的分析

  站内搜索:就是使用之后,在你的网站上增加一个浮出层,提示用户还搜索过什么词来到你的网站,吸引用户点击,但是看起来用的人并不多,可能是对大多数网站用户来说是一个干扰。

  短信报警:可以设置流量超过或低于一定值,就发短信预警

  广告统计功能(广告统计):可以设定某个特定来源点击过来的URL,统计特定来源流量,或者设定页面上广告位点走之后的链接,统计页面链接被点击的次数

  转化分析(全景统计):这个是收费的,可以设置一个用户浏览过程,看用户在每一个步骤上的流失率

  点击链接图(全景统计):可以分析页面上各个链接的点击次数

  页面访问轨迹(全景统计):可以分析带来流量的页面和带去流量的页面

  行业分析:链向CNZZ的行业分析站点

  站长工具:链向CNZZ的站长工具页

  百度统计:

  升降榜:同样用户分析流量变化的原因,提供了搜索引擎、搜索词、推介网站、推介网页、来源类型等多个维度的变化分析

  子目录:可以设定对部分页面做单独的分析,而且针对设定的页面集合做全套的数据分析。

  指定广告跟踪:可以设定在页面URL中设定多个参数,分析制定来源的流量,用户广告分析

  百度推广流量分析:与百度推广密切结合,能够准确分析百度推广的流量情况

  事件分析:在后台设置,不需要修改前台代码,即可统计页面上的各种控件被点击的次数

  转化分析:可以设定一个目标和步骤,能够分析各个来源的用户到达目标的次数,以及在实现目标各个步骤上的流失情况。

  页面上下游:可以对设定的页面,分析其上游、下游页面的关系;

  整合百度指数:在搜索词报告里,可以直接点击查看这个词的百度指数;

  整合相关搜索词:在搜索词报告里,可以直接点击查看与这个词相关的10个热门搜索词;

  搜索来路URL:在搜索此报告里了,可以查看每个搜索词对应的搜索URL;

  百度风云榜:链接到百度风云榜

  百度收录量查询:传闻要出,提供最准确、最权威的百度收录量数据,

  热力图(开发中):提供鼠标在页面上点击的位置和链接。

  点评:

  1、百度是站长无法忽视的重要流量入口,百度统计一旦利用起这一点优势,将非常可怕;

  2、百度统计的收录量查询、热力图都是非常值得期待的功能;

  3、广告分析方面,百度统计把来路广告和去向广告都整合了在一起,而CNZZ则分布在好几个系统中,所以百度统计这方面的用户体验较好;

  4、百度统计子目录的分析非常灵活,CNZZ没有类似功能,这一点我的朋友们反映挺多的;

  5、CNZZ有短信预警这种功能,这个挺不错的,百度的系统稳定速度快却没有这个功能,还是要好好改进下的。

  总结:

  1、往深了看,从百度统计的整个分析指标和分析维度架构(基于Session而不是基于PV,从一开始就以流量质量评估为切入点)就可以看出来,它的志向是蛮高远的,不是想做一个简单的流量统计工具,而是一个流量分析和优化工具。事实上,国外的流量分析早就进入了网站分析的时代,用户吸引和用户保持并重早已是共识,而国内还相对落后很多。近年来,随着越来越多的大企业开始重视网站分析,WAW活动的开展,一批独立博客的兴起,越来越多的人也接触和认识了网站分析。所以说百度还是比较高明的,瞄准了这个市场,同时催熟这个市场。

  2、CNZZ目前还没有什么清晰的盈利模式,而且CNZZ的整个分析结构决定了,它是第一代以PV为统计单元的流量统计工具。目前有很强大的用户习惯和用户基础,不过技术和需求的潮流是不可逆转的,关键是看谁可以尽快找到市场的爆破点。

  3、从武器角度打个比方来说明现在的形势,CNZZ就好比是一个刀,已经被磨得很锋利了,而百度统计则颇有一些枪的意味,并且正在被不断升级,如果配上百度输送的子弹,估计也小觑不得。

  来源:朱韫晖投稿,作者电子邮箱:pkuzyh(at)pku.edu.cn

Post to Twitter

周二,7月27日,做地铁看报时,读到关于计算机世界评论腾讯的问题。我没有读过计算机世界写的原文。但大致的内容报上还是略有写到。

当时我就和朋友说,这是个说不清的问题。看事的角度不一样,结果就不一样。

当时有一句话很有道理:大公司创造新的东西,其他人模仿,互联网本身就是这样。

其他人模仿成功,不代表他就是不好,他的成功一定有他的原因,以及一小部分的创新等。

最新一期计算机世界的封面报道是《“狗日的”腾讯》,看上去很生猛。用Keso的话说,就是起了个极具轰动效应的名字,但“实际上这篇报道也没写出什么新东西,不过是把互联网行业流传已久的‘全民公敌’的说法,给具体化了一下,迎合了一把所谓的‘民意’,属于比较讨巧的报道。”

不过关注点不在报道是否讨巧,而在于腾讯的创新问题,这让我想起了智猪博弈。智猪博弈是一个著名的纳什均衡例子:猪圈有大猪小猪,任一猪可选耗2份 体力踩食槽踏板,放出10份饲料。小猪踩,可食1份,大猪得食9份。大猪踩,可食7份,小猪得食3份。问大猪小猪各应采取何策略?

答案是:小猪选择等待,让大猪去按控制按钮,而自己选择“坐船”(或称为搭便车)。因为——

  • 当小猪踩动踏板时,大猪会在小猪跑到食槽之前会吃光绝大部分食物,除减去劳动耗费,小猪净亏损1个单位,大猪净得9个单位;
  • 若是大猪踩动了踏板,则有机会在小猪吃完落下的食物之前跑到食槽,争吃到半数以上的残羹,小猪净得3个单位,大猪净得5个单位。

于是我们看到一个现象:大猪忙不迭地踩了踏板后,赶忙跑回抢食物,而小猪则静候在食槽边“坐船”、“捡漏儿”。如此往复。

“小猪躺着大猪跑”的现象是由于故事中的游戏规则所导致的。规则的核心指标是:每次落下的食物数量和踏板与投食口之间的距离。

  • 方案一:减量方案。投食仅原来的一半分量。结果是小猪大猪都不去踩踏板了。谁踩谁吃不到。
  • 方案二:增量方案。投食为原来的一倍分量。结果是小猪、大猪都会去踩踏板。谁想吃,谁就会去踩踏板。谁踩都有足够的吃。
  • 方案三:减量加移位方案。投食仅原来的一半分量,但同时将投食口移到踏板附近。结果呢,小猪和大猪都在拼命地抢着踩踏板。等待者不得食,而多劳者多得。每次的收获刚好消费完。

微软中国的刘润对智猪博弈增加了一个注解: 小公司如小猪。的确,在游戏的最开始,一定会有敏感的小猪发现会带来食物的踏板机关,于是第一轮是小猪去踩踏板,或者大猪小猪一起踩。等到聪明的小猪发现 原来博弈的结果注定亏损,于是进入第二轮——“小猪躺着大猪跑”。等到游戏规则改变,不思进取的小猪突然发现“等待者不得食”,这时的破口大骂多半因为失 去第三轮资格的愤怒。

其实创新问题,说到底是创新的成本问题,无关是疼讯还是痒讯。创新也犹如踩踏板,无论腾讯还是其他大小公司都在计算成本。踩了踏板却没抢到多少食物的小猪,如果大骂大猪抢食,明显是智慧不足导致的恼羞成怒。大连做电子商务的Leon liu说了一句话很实在:“你知道腾讯的核心优势是什么吗?有人说是模仿,有人说是创新,腾讯人自己的回答是:耐心。”腾讯最核心的竞争力是耐心,懂得在合适的时间推出合适的产品。

我们总在崇拜国外的互联网生态环境比较好,那是因为他们的游戏规则已经更接近方案二或方案三了。事实上,《“狗日的”腾讯》并非谩骂,尾声的一句话说到了关键:“腾讯庞大的身躯,依然潜伏着诸多暗流”。腾讯本身被很多东西裹挟,鸭梨很大,而且也意识到自己的危机。是啊,有智慧的猪都知道:当踏板与投食口间距较远,小猪策略的收益比最高。

可是,但凡是有别的办法,谁又愿意做大猪呢?(作者:Lorna)

以上文章引自:http://lazylorna.com/archives/1658

本人相当的欣赏大猪小猪的例子。发人深思~!

Post to Twitter

If you are working on Shopping Website, you should notice this, and check out what do they have to have the success, as well as why don’t you so success on online shopping Website.
And all the data is from Chinese not international.
No1. 糯米网 www.nuomi.com RMB 724,800,000
No2. 美团 www.meituan.com RMB 618,400,000
No3. F团爱赴网 www.ftuan.com RMB 349,400,000
No4. 满座网 www.manzuo.com RMB 309,600,000
No5. 爱帮网 tuan.aibang.com RMB 306,500,000
No6. 36团 www.36tuan.com RMB 281,800,000
No7. 拉手 www.lashou.com RMB 216,000,000
No8. 可可团 www.cocotuan.com RMB 193,800,000
No9. Yoka优享网 tuan.yoka.com RMB 170,900,000
No10. 团宝 www.groupon.cn RMB 147,900,000

Post to Twitter

How in you are? How many popular website you know?
Come and see top 50 popular websites. If you are interesting try to browser them and figure out how many y ou know and love.
1.古歌 Google.com www.google.com
2.亚苦 Yahoo.com www.yahoo.com
3.有图标哦 Youtube.com www.youtube.com
4.直播 Live.com www.live.com
5.非死不可 Facebook.com www.facebook.com
6.没商量 Msn.com www.msn.com
7.危机 Wikipedia.org www.wikipedia.org
8.不咯咯咯人 Blogger.com www.blogger.com
9.没意思扒车 Myspace.com www.myspace.com
10.咔虎 Yahoo.co.jp www.yahoo.co.jp
11.拜读 Baidu.com www.baidu.com
12.印歌 Google.co.in www.google.co.in
13.德歌 Google.de www.google.de
14.软微 Microsoft.com www.microsoft.com
15.快分享 Rapidshare.com www.rapidshare.com
16.翘翘 Qq.com www.qq.com
17.法歌 Google.fr www.google.fr
18.性浪 Sina.com.cn www.sina.com.cn
19.恶霸呀 Ebay.com www.ebay.com
20.付出 Fc2.com www.fc2.com
21. 嗨5 Hi5.com www.hi5.com
22.英歌 Google.co.uk www.google.co.uk
23.算点 Doubleclick.com www.doubleclick.com
24. 我来点评了 WordPress.com www.wordpress.com
25.中歌 Google.cn www.google.cn
26.鹅油 Mail.ru www.mail.ru
27.出来告诉你 Craigslist.org www.craigslist.org
28.巴歌 Google.com.br www.google.com.br
29.鹅友 Vkontakte.ru www.vkontakte.ru
30.懊恼 Aol.com www.aol.com
31.鹅狐 Yandex.ru www.yandex.ru
32.意歌 Google.it www.google.it
33.富力城客人 Flickr.com www.flickr.com
34.阿妈种 Amazon.com www.amazon.com
35.日歌 Google.co.jp www.google.co.jp
36.西歌 Google.es www.google.es
37.掏宝 Taobao.com www.taobao.com
38怕佛陀哦不错课题 Photobucket.com www.photobucket.com
39 巴友 Orkut.com.br www.orkut.com.br
40.墨歌 Google.com.mx www.google.com.mx
41.影库 Imdb.com www.imdb.com
42.鹅非死不可 Odnoklassniki.ru www.odnoklassniki.ru
43.够哦 Go.com www.go.com
44.易忘 163.com www.163.com
45.不保存 Bbc.co.uk www.bbc.co.uk
46.啊帅哥 Ask.com www.ask.com
47.友邦 Youporn.com www.youporn.com
48.天石 Skyrock.com www.skyrock.com
49.破烂来副本 Pornhub.com www.pornhub.com
50.友斯特朗 Friendster.com www.friendster.com

Post to Twitter

I want to know Perl for a long time. As I know, it’s the earlier and powerful language. I don’t want to master it, just you know, know some thing about it to open my eyes to more web design language. So this article is good for me, basic knowledge.

Abstract

Learning how to program can be difficult and is, perhaps, best done by reading well-written programs. Perl is a powerful programming language that is well known in its community for the development of security tools. A programming language is normally compiled, but Perl, the Practical Extraction and Report Language, is interpreted by using the Perl interpreter. Perl has many unique characteristics: anyone who has ever been involved with programming languages has dealt with variables. Variables, a data-type that are normally declared prior to being initialized (or assigned a value), do not have to be declared in Perl. Perl is an object-oriented, high-level programming language, meaning that its classes are the abstraction. The object members, whose name reflects a type that names the class, are concretely defined. A class is instantiated, meaning that the use of a library-defined class is used for an instance of its use. In Perl these are called Modules. The object members comprise the class and define the methods and the data members worked on by those methods. Perl is unique in that rather than declaring exactly what type of data we use (an integer, a character, a string of a characters, a type of arithmetical and or logical unit of measurement), we just define the data as a scalar, an array, or an associative array (a hash). Perl has many built-in functions and mechanisms that empower it, and to use any of those (such as the built-in cryptography), you must first understand how these data types work. So we will go by example, and see how far of an understanding we can get. There are a plethora of downloadable Perl scripts at the script repository at technet.microsoft.com.

So How Do I Start?

The Perl interpreter can be downloaded at www.perl.org or http://www.activestate, amongst others. When installed, you can set the environmental variables for its path by using this command (we assume a Win32, or Microsoft Windows, command prompt):

C:\Scripts\> set PATH=%PATH%;.;C:\Perl\bin

When we set the path, the command “perl”, which is used to interpret a perl script, can be used anywhere in the command line. Before beginning, however, we should define a few terms. Perl can be written using 7-bit ASCII. One keyboard character is considered 8 bits, or one byte. When there is data compression, however, the printed character is actually 7 bits. But Perl can also be written using Unicode, in which the characters are two bytes. But what does that actually mean? Well, the Java language was developed to use two byte characters during a time in the world’s computing industry when global translations were necessary. Different characters, particularly those of the Arabic and Far Eastern nations, did not translate into a simple byte character. Making the characters into Unicode, or UTF-8 (any variation of the two byte encoding scheme), enabled those translations, and in most cases, the conversion is automatic.

Perl has commands, such as perldoc, pod2html, etc which are used to read the generated site information and pod documents. For instance:

C:\> perldoc  Perl.pm
will open the document with the .pm file extension.
Pod2html will take a .pod document and convert into an HTML web page.

A Perl Script Walkthrough

Here is an example of a Perl script. It will appear strange, because the techniques we are going to learn are not defined, but they will come into sharper focus:

print "What is your name? ";
chomp($name = ); # Program waits for user input from keyboard
print "Hello, $name, do you want to learn Perl right now? ";
chomp($response = );
$response=lc($response); # response is converted to lowercase
if($response eq "yes" or $response eq "y"){
print "Good Decision! We'll start with this example.\n";
}
else{
print "O.K. Try again later.\n";
}
$now = localtime; # Use a Perl function to get the date and time
print "$name, you ran this script on $now.\n";

We’ll name this script Script1.pl. First, notice the .pl file extension. Now we run the script on the command line. We first notice that the script is asking for user input (making the script “interactive”):

c:\Scripts>perl Script1.pl
What is your name? Joe
Hello, Joe, do you want to learn Perl right now? yes
Good Decision! We'll start with this example.
Joe, you ran this script on Mon Jul  5 19:44:09 2010.

Perl statements are always terminated with a semi-colon. The hash mark # indicates the writer’s comment, and is overlooked by the interpreter. We use the “print” function, but notice that there is no newline escape sequence. A computer’s screen on a command line has a cursor blinking to indicate where the next sentence is going to occur. If the cursor has reached the edge of the screen, or if the user has hit the Enter (return) key, then the cursor drops down one line and goes to the far left. This is called Carriage Return-Line Feed. In programming languages like C however, an escape sequence like “\n” are used:

Perl statements are always terminated with a semi-colon. The hash mark # indicates the writer’s comment, and is overlooked by the interpreter. We use the “print” function, but notice that there is no newline escape sequence. A computer’s screen on a command line has a cursor blinking to indicate where the next sentence is going to occur. If the cursor has reached the edge of the screen, or if the user has hit the Enter (return) key, then the cursor drops down one line and goes to the far left. This is called Carriage Return-Line Feed. In programming languages like C however, an escape sequence like “\n” are used:

“Hello, what is your name?\n” # this prints “Hello, what is your name?” on the screen. We do not need to use this escape sequence, here because many times in Perl you can manipulate strings by using functions like chop() and/or chomp().

Note:

Most computer programming languages will contain three file handles. They are called Standard Input, Standard Output, and Standard Error. A file handle is merely a reference to a file in order to open that file. Standard input (STDIN) means any user input mechanism: the keyboard, the mouse, etc. Standard output means how the computer’s information is outputted to the user: the console screen, a printer, sent to a database, etc. Standard error is not in the scope of this topic.

Now consider this brief snippet:

C:\> print “Enter your name:”  ;
        $name = <> ;
        print “Enter your age: “  ;
        $age = <>;
        print “$name”;
        print “$age”;

The output will be:

Enter your name:  Joe
Enter your age: 44
Joe
44

Now it is time to introduce scalars, one of the three data-types used in Perl.

Scalars

The snippet print “Hello, World\n” will print Hello, World to the screen, or standard output. The word print calls the print function, which takes the text from within the quotes and displays it on the screen. As we have seen, the \n symbolizes a new line or the carriage return. Now we introduce a scalar:

$myscalar = ‘Hello, World\n’
print  “$myscalar” ;  # prints the value of $myscalar

Scalars are declared by using the $ symbol followed by the variable name. The first line feeds the text within the quotes into the scalar, whose name is $myscalar. So why did I use single quotes in the first line and double quotes in the second line? Because Perl performs variable interpolation within double quotes—this means that it replaces the variable name with the value of the variable. This will become clear in the following examples:

$myscalar = ‘Hello\n’ ;
# variable $myscalar has the value Hello\n
print  ‘$myscalar’  ;
#because I used single quotes there is no variable interpolation.

The output will be:

$myscalar

The following is an example of variable interpolation:

$myscalar = ‘Hello’ ;
print  “$myscalar”

The output will be:

Hello

This is the difference between single and double quotes. Getting user input is performed by using the diamond operator, <>. It basically grabs input from the user (standard input) to make a program more interactive. Consider the following example:

print ‘Enter your name:’ ;
$username = <> ;  # the user will enter a text which will be fed into the scalar
print “Hi, $username” ;
The output will be:
Enter your name:  Dave
Hi Dave

The program will print the text “Enter your name:” on the screen and will wait for user input. The text entered by the user will be fed into the scalar $username. Then the program will print Hi, followed by the text entered by the user. Now consider the following code:

print  “Enter your name:” ;
$name = <>;
Print “Enter your age:” ;
$age = <>;
print “$name”  ;
print “$age”;
The output will be:
Enter your name:  Joe
Enter your age: 44
Joe
44

But why did Perl print Joe and 44 on separate lines? There was no newline in the program (\n) character in the program. What happened is that when the user was given an input prompt, he needs to enter some input. Perl keeps on accepting input from the user until the cursor drops down and goes to the far left (the user provides the ending operator – a carriage return or Enter). When the user an ending operator, Perl stops taking user input and assigns the entered data input by the user to the variable specified, including the carriage return. This means that the value of the scalar $name is Joe, followed by the carriage-return, or \n. When we print the scalar $name, the value of $name is printed, followed by a carriage return, or \n. to avoid this problem, we use chop() or chomp(). The difference between these two functions will become clearer with the following example:

$variable = “Dave”;
chop($variable);
print $variable
The output will be:
Dav

In this example:

$variable = “Dave”
chomp($variable);
print $variable ;
The output will be:
Dave

The difference between chop() and chomp() is that chop() will remove the last character of the string irrespective of what it is, whereas chomp() will remove the last character only if it is a newline character (\n). So if we put these facts together, we can write a Perl script that is a little more complicated:

 print "Hello there, and what is your name? ";
 $name = ;
 print "$name is a very high class name.\n";
 chop($name); # Removes the last character no matter what it is.
 print "$name is a very high class name.\n\n";
 chop($name);
 print "$name has been chopped a little too much.\n";
 print "What is your age? ";
 chomp($age=); # Removes the last character if
# it is the newline.
 chomp($age); # The last character is not removed
# unless a newline.
 print "For $age, you look so young!\n";

So far we can see that Perl is a free form language, meaning you can place statements anywhere on the line of even cross lines. Whitespace refers to tabs, spaces, and newlines. So we know that the newline is represented as “\n” and must be enclosed in quotes. Whitespace is used to delimit words. Any number of blank spaces is allowed between symbols and words. Whitespace enclosed in single or double quotes is preserved; otherwise, it is ignored. The following expressions are the same:

5+4*2 is the same as 5 + 4 * 2;

And both of the following statements are correct even though the output will show that the whitespace is preserved when quoted:

print "This is a Perl statement.";
print "This
is
also
a Perl
statement.";

The output will be:

This is a Perl statement. This
is
also
a Perl
statement.

Keep in mind that unlike a UNIX shell, a Win32 DOS prompt shell has its own way of parsing the command line. Since most of your programming will be done in script files, you will seldom need to worry about the shell’s interaction, but when a script interfaces with the operating system, problems will occur unless you are aware of what commands you have and how executes them on your behalf. For instance, assume we understand how to use perl modules–the downloadable modules and the built-in modules that come with a solid perl interpreter download. Consider this next script:

 use File::Find;
 use Win32::File;
# Works on both FAT and NTFS file systems.
 &File::Find::find(\&wanted,"C:\\program files", "C:\\windows");
 sub wanted{
 (Win32::File::GetAttributes($_,$attr)) &&
($attr & DIRECTORY) &&
print "$File::Find::name\n";
}

So how do we use the Win32 command line? This script will interface with the file system and output the contents of a directory in hierarchal form. We simply use notepad or type C:\> type con > ThisScript.pl

Here is where there is no cursor, just a blank screen, so copy and paste the script onto screen, press Control-Z, and you’ll be back at the command prompt. The output will be:

C:\program files
C:\program files/Adobe
C:\program files/Adobe/Acrobat_com
C:\program files/Adobe/Acrobat_com/locale
C:\program files/Adobe/Acrobat_com/locale/de_DE
C:\program files/Adobe/Acrobat_com/locale/de_DE/landingPages
C:\program files/Adobe/Acrobat_com/locale/de_DE/landingPages/images
C:\program files/Adobe/Acrobat_com/locale/en_GB
C:\program files/Adobe/Acrobat_com/locale/en_US
C:\program files/Adobe/Acrobat_com/META-INF
   and  so on ….
C:\windows/winsxs/x86_wwf-system.workflow.componentmodel_31bf3856ad364e35_6.0.6002.18005_none_8dcf92850b377416
C:\windows/winsxs/x86_wwf-system.workflow.runtime_31bf3856ad364e35_6.0.6002.18005_none_670656a59d28c52a
C:\windows/winsxs/x86_xcbda.inf.resources_31bf3856ad364e35_6.0.6001.18000_en-us_f5090c76a778b031
C:\windows/winsxs/x86_xnacc.inf.resources_31bf3856ad364e35_6.0.6001.18000_en-us_8f20a3842ebca522C:\windows\..etc

What happened here? The File::Find module is loaded from the standard Perl library. The first argument to find() is a reference to a subroutine called wanted followed by two directories to be found. The wanted function will check that each name is a directory and list the full pathname of all subdirectories found. $_ is assigned the name of the current directory in the search.

End Note: Conditional Statements

Like the C language, Perl will perform an action if some condition is true. IF some condition is true, THEN do this. If it is not, then do that. Also, take care to note that the operators that are used on numbers work differently than on strings. Consider the following example:

print "Enter your Name:";
$name = <>;
chomp $name ;
if ( $name eq 'Harry') {
print "Hi Harry";
}
else {
print "You do not have permission to use this computer";
}
Enter your Name: John
You  do not have permission to use this computer

The while loop not only can be used to repeat a code snippet, but it also allows us to validate the user input and perform a predefined task according to the result of the validation. In this manner, the while loop repeats a block of code as long as the condition is true. The first example will show its basic use, and the second will exemplify an infinite loop (a continuing execution because the condition is true):

while ($count < 10) {
$count += 2;
print "count is now $count\n"; # Gives values 2 4 6 8 10
}

And the output is:

count is now 2
count is now 4
count is now 6
count is now 8
count is now 10

The next example is used to validate user input, but creates an infinite loop. Just press Control-C to get out of the loop:

print 'Username:' ;
$user = <>;
chomp $user;
while ( $user eq "admin" ) {
print "System info goes here:";
}

And the output is:

ere:System info goes here:System info goes here:System info goes here:System inf
o goes here:System info goes here:System info goes here:System info goes here:Sy
stem info goes here:System info goes here:System info goes here:System info goes
 here:System info goes here:System info goes here:System info goes here:System i
nfo goes here:System info goes here:System info goes here:System info goes here:
System info goes here:System info goes here:System info goes here:System info go
es here:System info goes here:System info goes here:System info goes here:System
 info goes here:System info goes here:System info goes here:System info goes her
e:System info goes here:System info goes here:System info goes here:System info
goes here:System info goes here:System info goes here:System info goes here:Syst
em info goes here:System info goes here:System info goes here:System info goes h
ere:System info goes here:System info goes here:System info goes here:System inf
o goes here:System info goes here:System info goes here:System info goes here:Sy
stem info goes here:System info goes here:System info goes here:System info goes
here:System info goes here:System info goes here:System info goes here:System i
nfo goes here:System info goes here:System info goes here:System info goes here:

Arrays

This next program introduces arrays. The opendir function opens the directory structure and assigns it to DIR, the directory file handle. The ..(parent) directory is opened for reading. The readdir function assigns all the rest of the entries in the directory to the array @parentfiles. The closedir function closes the directory. The files are printed (or inside to system, written to the screen) in the order they are stored in the directory structure. This may not be same as using the dir command in DOS:

 opendir(DIR, "C:\\Windows") || die "Can't open: $!\n";
 # Open parent directory
 @parentfiles=readdir(DIR);
 # Gets a list of the directory contents
 closedir(DIR); # Closes the filehandle
 foreach $file ( @parentfiles )
 # Prints each element of the array
 {
 print "$file\n"; }

The output is as expected:

.
..
AppPatch
assembly
bfsvc.exe
Boot
bootstat.dat
Branding
Cursors
Debug
DigitalLocker
Downloaded Program Files
DPINST.LOG
DtcInstall.log
en-US
explorer.exe
Fonts
fveupdate.exe
Globalization
Help
HelpPane.exe
hh.exe
ie8_main.log
iis7.log
IME
inf
Installer
L2Schemas
LiveKernelReports
Logs
Media
mib.bin
Microsoft.NET
and  so on ..
SHELLNEW
SoftwareDistribution
Speech
SysMsiCache
system
system.ini
System32
tapi
Tasks
Temp
tracing
TSSysprep.log
Users
etc . . .

Why did we use the @ mark? Because we used the second type of data type. If scalars are singular, then lists and arrays are plural. A list is an ordered collection of scalars. An array is a variable that contains the list. In Perl, sometimes these two terms are used interchangeably. However, the list is the data, and the array is the variable. You can a list value that isn’t an array, but every array holds a list. Note the figure below. Each element of an array or list is a separate scalar variable with an independent scalar value. These values are ordered—that is, they have a particular sequence from the first to the last element. The elements of an array or list are indexed by small integers starting at zero and counting by ones, so the first element of any array or list is always element zero.

When you have a collection of similar data elements, it is easier to use an array than to create a separate variable for each of the elements. The array name allows you to associate a single variable name with a list of data elements. Each of the elements in the list is referenced by its name and a subscript (also called an index). Perl, unlike C-like languages and managed code, doesn’t check whether the elements of an array are of the same data type. They can be a mix of numbers and strings. To Perl, an array is a named list containing an ordered set of scalars. The name of the array starts with a @ sign. The subscript follows the array name and is enclosed in square brackets ([]). Subscripts are simply integers and start at zero. So let’s examine this script:

@grades = (90,89,78,100,87);
print "The original array is: @grades\n";
print "The number of the last index is $#grades\n";
print "The array is truncated to 4 elements: @grades\n";
@grades=();
print "The array is completely truncated: @grades\n";

The output will be:

The original array is: 90 89 78 100 87
The number of the last index is 4
The array is truncated to 4 elements: 90 89 78 100 87
The array is completely truncated:

The array @grades is assigned a list of five numbers. We get the subscript (index) value of the last element in the array. The last subscript in the array has been shorted to 3 (recall an array is usually denoted by brackets [] and, again, is initialized to zero: [4] is 0 1 2 3). Using an empty list causes the array to be truncated to an empty list. Since an array starts counting with zero, the first element is referred to zero. This example should make this clearer. It is meant to output clearly, so it uses the newline:

@array1 = ('I am first', 'I am second', 'I am third', 'I am fourth');
$var1=$array1[0];
$var2=$array1[1];
$var3=$array1[2];
$var4=$array1[3];
print "$var1\n";
print "$var2\n";
print "$var3\n";
print "$var4\n";

And the output will be:

I am first
I am second
I am third
I am fourth

Let’s look at another example. Here the @names array is initialized with three strings: John, Joe, and Jake. The entire array is printed to standard output (STDOUT). The space between the elements is not printed. Each element of the array is printed, starting with an index number zero. The scalar variable $number is assigned the array @names. The value assigned is the number of elements in the array @names. The number of elements in the array @names is printed:

# Populating an array and printing its values
 @names=('John', 'Joe', 'Jake'); # @names=qw/John Joe Jake/;
 print @names, "\n"; # prints without the separator
 print "Hi $names[0], $names[1], and $names[2]!\n";
 $number=@names; # The scalar is assigned the number
 # of elements in the array
 print "There are $number elements in the \@names array.\n";
 print "The last element of the array is $names[$number - 1].\n";
 print "The last element of the array is $names[$#names].\n";
# Remember, the array index starts at zero!!
 @fruit = qw(apples pears peaches plums);
 print "The first element of the \@fruit array is $fruit[0];
the second element is $fruit[1].\n";
print "Starting at the end of the array; @fruit[-1, -3]\n";

The output will be:

JohnJoeJake
Hi John, Joe, and Jake!
There are 3 elements in the @names array.
The last element of the array is Jake.
The last element of the array is Jake.
The first element of the @fruit array is apples;
the second element is pears.
Starting at the end of the array; plums pears

A Brief Look at WMI

Window Management Instrumentation is hierarchy of namespaces and is used mainly as a tool to empower VBScripts. Information about the state of a system, its page file size, it memory utilization (both virtual and physical), cpu usage, IP settings, etc. The perl script below returns the name and product code of binary information (such as bitmaps, icons, executable files, and so on) used by a Windows Installer application. It was fetched from TechNet and is available at Activestate. Notice that the scalar is set to a method that has the \root\cimv2\ namespace. This variable is made to form a collection of (items) objects, as is standard for any Windows programming. To run this program using an ActiveState interpreter, you must first install the Win32:OLE module:

 c:\Perl\> ppm install Win32::OLE

Now the module will execute its routines within the program:

use Win32::OLE('in');
use constant wbemFlagReturnImmediately => 0x10;
use constant wbemFlagForwardOnly => 0x20;

$computer = ".";
$objWMIService = Win32::OLE->GetObject
    ("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n";
$colItems = $objWMIService->ExecQuery
    ("SELECT * FROM Win32_Binary","WQL",wbemFlagReturnImmediately | wbemFlagForwardOnly);

foreach my $objItem (in $colItems)
{
      print "Caption: $objItem->{Caption}\n";
      print "Data: $objItem->{Data}\n";
      print "Description: $objItem->{Description}\n";
      print "Name: $objItem->{Name}\n";
      print "Product Code: $objItem->{ProductCode}\n";
      print "Setting ID: $objItem->{SettingID}\n";
      print "\n";
}

And the output is:

Caption: AbortMsiCA.dll
Data:
Description: AbortMsiCA.dll
Name: AbortMsiCA.dll
Product Code: {90120000-00A1-0409-0000-0000000FF1CE}
Setting ID: 

Caption: BIN_File_46001
Data:
Description: BIN_File_46001
Name: BIN_File_46001
Product Code: {90120000-00A1-0409-0000-0000000FF1CE}
Setting ID: 

Caption: BIN_File_107602
Data:
Description: BIN_File_107602
Name: BIN_File_107602
Product Code: {90120000-00A1-0409-0000-0000000FF1CE}
Setting ID: 

Caption: BIN_File_46002
Data:
Description: BIN_File_46002
Name: BIN_File_46002
Product Code: {90120000-00A1-0409-0000-0000000FF1CE}
Setting ID: 

Caption: OCFXCA
Data:
Description: OCFXCA
Name: OCFXCA
Product Code: {90120000-00A1-0409-0000-0000000FF1CE}
Setting ID:
and so on . . .

Arrays Continued

Multidimensional arrays are sometimes called tables, or matrices. They consist of rows and columns and can be represented with multiple subscripts. In a two-dimensional array, the first subscript represents the row, and the second subscript represents the column. In Perl, each row in a two-dimensional array is enclosed in square brackets. The row is an unnamed list. An unnamed list is called an anonymous array and contains its own elements. The arrow operator, also called an infix operator, can be used to get the individual elements of an array. There is an implied –> between adjacent brackets. Consider the following example. The array @matrix is assigned four unnamed, or anonymous, arrays. Each of the arrays has three values. The addresses of the four anonymous arrays are printed. To access the individual elements of an anonymous array, double subscripts or the arrow operator must be used. The first element of the first anonymous array in the @matrix array is printed. The –> is called the arrow, or infix, operator. It is used to dereference array and hash references. $matrix[0][0] or $matrix[0]–>[0] is the first element of the first row, where subscripts start at zero. The second row, first element of the @matrix, is printed. $matrix[1]–>[0] is another way to say $matrix[1][0]. The outer for loop will iterate through each of the rows, starting at row zero. After the first iteration of the loop, the second for loop is entered. The inner for loop iterates faster than the outer loop. Each element of a row is printed, and then control returns to the outer for loop. Next, print each element in the matrix. The first index represents the row, and the second index represents the column.

@matrix=( [ 3 , 4, 10 ], # Each row is an unnamed list
[ 2, 7, 12 ],
[ 0, 3, 4 ],
[ 6, 5, 9 ],
) ;
 print "@matrix\n";
 print "Row 0, column 0 is $matrix[0][0].\n";
# can also be written - $matrix[0]->[0]
 print "Row 1, column 0 is $matrix[1][0].\n";
# can also be written - $matrix[1]->[0]
 for($i=0; $i < 4; $i++){
 for($x=0; $x < 3; $x++){
print "$matrix[$i][$x] ";
}
print "\n";
}

The output will be:

ARRAY(0x1b6f5c) ARRAY(0x1b6e3c) ARRAY(0x23b064c) ARRAY(0x23b07fc)
Row 0, column 0 is 3.
Row 1, column 0 is 2.
3 4 10
2 7 12
0 3 4
6 5 9

Hashes

An associative array, more commonly called a hash, consists of one or more pairs of scalars—strings, numbers, or Booleans. The first set of scalars is associated with the second set of scalars. The first string in the pair of strings is called the key, and the second string is called the value. Whereas arrays are ordered lists with numeric indices starting at 0, hashes are unordered lists with string indices randomly distributed. The output to console will not usually appear as you have typed it. Hashes, then, are defined as an unordered list of key/value pairs, similar to a table where the keys are on the left-hand side and the values associated with those keys are on the right-hand side. The name of the hash is preceded by the %. Notice that this hash uses parenthesis:

% pet = ( "Name" => "Sneaky",
"Type" => "Cat",
"Owner" => "Carol",
"Color" => "yellow",);

Accessing the elements of a hash requires understanding accessing the elements of an array. This means that we must understand the functions used when working with arrays. Examine the following code. A hash slice is a list of hash keys whose corresponding values are assigned to another list of keys. The list consists of the hash name preceded by the @ symbol. The list of hash keys is enclosed in curly braces:

# Hash slices
 %officer= ("NAME"=> "John Doe",
"SSN" => "510-22-3456",
"DOB" => "05/19/66"
);
 @info=qw(Marine Captain 50000);
@officer{'BRANCH', 'TITLE', 'SALARY'}=@info;
# This is a hash slice
 @sliceinfo=@officer{'NAME','BRANCH','TITLE'};
# This is also a hash slice
 print "The new values from the hash slice are: @sliceinfo\n\n";
print "The hash now looks like this:\n";
 foreach $key ('NAME', 'SSN', 'DOB', 'BRANCH', 'TITLE', 'SALARY'){
 printf "Key: %-10sValue: %-15s\n", $key, $officer{$key};
}

And the output is:

Key: NAME      Value: John Doe
Key: SSN       Value: 510-22-3456
Key: DOB       Value: 05/19/66
Key: BRANCH    Value: Marine
Key: TITLE     Value: Captain
Key: SALARY    Value: 50000

In conclusion, know that there are tools you can download on the internet in order to turn Perl scripts into Windows executables. Perl is also powerful in graphics and developing desktop applications. This article is solely meant to be a reference for one who wants to know a little of the Perl basics, programming experience or not, and has been referenced from Ankit Farad’s book “The Unofficial Guide to Ethical Hacking”, and “Programming Perl”, by Larry Wall, Tom Christiansen & Jon Orwant.
It’s the article from code from codeproject.com. hope you enjoy it.

Post to Twitter

JQuery is one of the most popular language in Web design. In my experient, I use JQuery to solve some data update without changing url (jump). It just use as JavaScript.

This article is how to enhance form input fields with JQuery. I think it’s helpful and easy. Try it by yourself.

jQuery makes it easy to spice up our search bars and form input fields with simple touches that really enhances the user’s experience. Let’s look at how jQuery can be used to show/hide a default value inside a field and provide visual user feedback when the field is selected.

View the demo

View the demo

The example we’ll be creating features a simple search bar and icon which appears grey as standard but turns to a cool blue when focused. By default the input displays the words I’m looking for…, which disappears when the field is selected.

Why not CSS?

Similar effects could be created purely with CSS. There’s the pseudo :focus selector which allows us to add special styling to elements when they have the user’s attention. Plus, the default input value could be added as a background image, which is then removed also using the :focus selector. But there’s two small problems; firstly the :focus selector isn’t supported by Internet Explorer, and secondly there’s no way of ensuring the default value doesn’t reappear once the user has entered their own information within the input field. This is where jQuery takes over to provide a complete solution that’s compatible with all browsers.

Creating the search form

Let’s create our sample form design. We’ll concentrate more on the front-end design of HTML, CSS and Javascript rather than make the form fully functioning, so to start we need a basic HTML structure:

<form action="" method="get">
	<fieldset>
		<input type="text" id="searchbar" />
		<input type="submit" value="Search" id="searchbtn" />
	</fieldset>
</form>

Just like all forms on the web, our simple search bar is created using a <form> element. Inside this is a <fieldset> to contain our two input fields. The first is a text input with an ID of searchbar, which will be the field the user enters their query into. The second is a submit input element with an ID of searchbtn, which has a value attribute of “Search” to give a descriptive purpose to the button. Our final design will render this input as a magnifying glass icon which replaces the text for a more visual clue.

#searchbar {
	width: 425px;
	float: left; padding: 20px 150px 20px 40px;
	background: #ededed url(bar-bg.png) repeat-x;
	border: 3px solid #c7c7c7;
	border-radius: 100px; -moz-border-radius: 100px; -webkit-border-radius: 100px;
	font: italic 54px Georgia; color: #898989;
	outline: none; /*Remove Chrome and Safari glows on focus*/
}

The whole form can then be styled up with some simple CSS. The search bar is given a specific width of 425px, along with some padding around the edges. This padding adds 20px to the top and bottom, 40px to the left and a large 150px on the right (to accommodate the button). A thin repeating gradient graphic is added to as a background-image and a grey border added to the outside. border-radius is used to round off the edges of the search bar for supporting browsers, otherwise it will appear rectangular. The text inside the field is then set up as 54px Georgia in Italic, with a grey colouring. The final line of outline: none; simply removes the default glow that appears on focus in Safari and Chrome.

#searchbar.active {
	background: #ebf3fc url(bar-bg-active.png) repeat-x;
	border: 3px solid #abd2ff;
}

The search bar is then given some styling for when the class of active is used. This will be added by jQuery later, which leaves it to the CSS to change the background-image to a blue gradient and a light blue border.

#searchbtn {
	width: 67px; height: 70px; float: left; margin: 18px 0 0 -115px;
	background: url(search.png); text-indent: -9999px;
	padding: 0 0 0 67px; /*IE fix*/
	cursor: pointer;
}
	#searchbtn:hover {
		background-position: 0 -70px;
	}

The button appears as an image based icon, so a specific width and height is added. The button is floated alongside the bar, then margin is used to move it into place 18px from the top to align it vertically, and -115px from the left to pull it back to sit inside the search bar. The icon is added as a background-image and text-indent used to shift the default value text off-screen. Internet Explorer doesn’t like this technique, so padding can be used as well. To ensure the user’s mouse displays the appropriate cursor as feedback that the element can be clicked, cursor:pointer; displays the typical hand icon. As an extra visual clue the search icon changes colour by altering the background-position of the sprite graphic when the user hovers over it.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript"></script>

The search form looks and works fine so far, but without the fancy jQuery effects. The library is linked from inside the HTML document, then the document is prepared for our own bit of Javascript. Every jQuery command is contained within the same syntax, which basically says “When the document is ready, run this function.”

$(document).ready(function() {
	$("#searchbar").attr("value", "I'm looking for...");

	var text = "I'm looking for...";

	$("#searchbar").focus(function() {
		$(this).addClass("active");
		if($(this).attr("value") == text) $(this).attr("value", "");
	});

	$("#searchbar").blur(function() {
		$(this).removeClass("active");
		if($(this).attr("value") == "") $(this).attr("value", text);
	});
});

The first line of our jQuery takes the #searchbar and adds the words “I’m looking for…” inside the value attribute using the .attr() method. Next, a variable named text is set, which is used along with the code that adjusts the input text of focus. Two functions are then added to the search bar; .focus() for when the input is selected, and .blur() when it is deselected. The class of active we set up in the CSS is added or removed on focus and blur, then jQuery checks the status of the value text. If the searchbar’s value is the same as the variable of ‘text’, then the value should be changed to nothing (“ ”). When the input is deselected, if the value is blank, the value should revert back to the ‘text’ variable, otherwise the value that the user has manually entered will remain. This prevents the value from clearing out the user’s query and switching back to “I’m looking for…” when the input is deselected.

View the demo

These techniques don’t have to be reserved for search bars, the same effect can be used on any input field to create super cool sign up or contact forms.

This article is from Line25. hope it’s useful for you.

Post to Twitter

I am bloging now, but I really don’t know how exactly to run and build a perfect blog for me and other readers.
But I know I would love to do my best to improve my blog to meet readers needs. I know I would love to do everything to try to improve my blog’s quality. I know I would love to try and try again to run and build a good blog by myself.
I am working hard for it.
Now the first thing I think I need to do is read more more good blog to see how do they build their blog.

You can see these codes in the foot:
<script type=”text/javascript”>// <![CDATA[
try {
var pageTracker = _gat._getTracker("
Code-Site");
pageTracker._trackPageview();
} catch(err) {}
swfobject.registerObject("FlashID");
// ]]></script>

Today when I was reading others’ blog I try to see theirs code then I found there are many blog use Google Analytics for WordPress. This plugin adds pageTracker undefined for admin. Only one problem the webpage doesn’t load the ga.js but the filter which adds javascript:pageTracker around the outbound links still applies, thus cause the problem.
This is what I found these days and share it with you.
Maybe you know it eariler or later, no matter what, you can try to run and build your blog better now with Google Aanlytics for wordpress.

Could you tell me what this code used for?

<script type=”text/javascript”>// <![CDATA[
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
// ]]></script>

Post to Twitter

I have a great interesting in Web Design as well as Program. So I am thinking which way I should choose to learn better in my future, especially I am facing to find a job after graduation.

I always read others articles about web design and program language develop.

Some of them just introduce simple and some a really good and worth for trying.

This article is about Web design in 2010. You should read it, and think about the CSS3 and more feature of your website if you are working or learning how to design a good and character web.

Purists will say that great design is timeless. Yes, in an ideal world, we should ignore trends.

Pragmatically speaking, though, there is a lot of value in monitoring and incorporating design trends, especially with regard to websites.

Let’s face it: the web changes at a rapid pace. Unlike in other media, design trends on the web are not just driven by aesthetics.

Technology is changing that can drastically alter the capabilities of the medium.

In 2010, we’re seeing designers continuing to push the boundaries of web design, setting the following clear trends…

CSS3 Techniques

Not sure you can take advantage of CSS3 yet? Think again. Web pioneers such as Andy Clarke and Jeremy Keith have long preached about “progressive enhancement” in web design.

Progressive enhancement is about designing websites so that they are usable on older browsers, while being “enhanced” for users who commit to the latest technology.

Designing in this camp lets you take advantage of CSS3 properties such as rounded corners, border backgrounds and text and box shadows. Users on modern browsers will see the nicer version, and those on older technology (cough ¦ IE6 ¦ cough) will see the basic version.

CSS3 Animation

Animation on the web has gone through many stages. Initially, we could only animate with GIF image files. Then, we were pretty much limited to Flash. Now, we can select from Flash, Silverlight, GIF, JavaScript and even CSS3. Subtle animation can be memorable, and CSS3 makes it lightweight and easy.

Rounded Corners

The Web 2.0 style of 2005 and 2006 made rounded corners popular, to the point of being annoying. At the time, creating them was difficult. There was no set way to create truly rounded corners. Instead they were simulated with CSS, JavaScript hacks and image files.

CSS3 now allows us to generate rounded corners directly in the browser, making them not only easier to create but also much more efficient, because the user doesn’t have to download additional images or JavaScript files.

Designers are increasingly taking advantage of this new browser capability in 2010.

Box and Text Shadows

Using shadows to create a sense of depth has been done (and sometimes overdone) since the earliest days of the web. But it was not always practical. To add shadows to text, you had to use images, which increased loading time and made maintenance more difficult. Box shadows required several images and CSS tricks like “sliding doors.”

CSS3 has highly customizable shadow capabilities, which allow for a wide range of creative effects, including not only drop shadows but inner shadows, too. Creative designers have already been using these CSS3 effects to simulate both embossed and imprinted effects.

RGBa and Opacity

For years, working with opacity and transparency on the web was near impossible. You had three choices: simulate transparency using flat images, deal with PNG’s cross-browser incompatibilities, or struggle with CSS’ basic transparency selectors and filters.

CSS3 gives designers much better consistency and freedom in using opacity with the RGBa property. While you can take advantage of transparency in countless ways, one area that it has helped particularly is with complex backgrounds overlaid with semi-transparent colors. Previously, this effect was impractical or impossible to create without resorting to complex PNG images.

Mobile-Compatible Design

The mobile web has given millions of users the ability to check their bank account while waiting in line, look up the latest scores on the subway and update their Twitter status while driving. (Which one of these is a dangerous habit?) And the mobile web continues to grow rapidly.

We have gotten to the point that every company has to consider whether their website will be used on the go, and if so how. Innovative companies have already invested heavily in useful and user-friendly mobile versions of their websites.

Creativity

The explosive growth in use of social media is proof that people want to connect and share things they are passionate about.

In the design field, we have seen large growth in the sharing and browsing of other people’s work. As designers, we are now bombarded by everyone else’s creativity. Not only does this raise the standard of quality of design, but it encourages ideas to be shared, which contributes to a culture of creativity and innovation.

Clean Illustrations

If you’re like me, you grew up watching Disney movies, admiring all the effort that went into creating each frame of animation. We are well past the days when illustration was done in ink and markers, and this evolution in tools has led to some very creative approaches to design.

Many designers are learning that smooth, clean, crisp illustrations create a distinctive feel that can’t be replicated by photography or simple clip art. The result is a wide range of professionally illustrated designs that are engaging and inviting.

Textured Backgrounds

Textured backgrounds are nothing new on the web. But this technique has seen an interesting variation in the last few months. I refer to it as “micro-textures”which are subtle, barely noticeable textures in the background.

Thumbnails

You may be saying, “Thumbnails have been around since the dawn of the web. How is this a trend?” True, they have always been used, but only very simply. You would have a thumbnail that you could click on to get a bigger image. It did the job but was boring.

In the last few months, designers have started asking, “How can we make thumbnails more exciting?” This has led to an upswing in thumbnails that are both clever and usable.

Watercolor

As the web evolves, we are seeing more designers being inspired by a variety of sources and media. No surprise that the fine arts are among these sources.

One of the styles that has emerged is the simulation of watercolors. The soft elegant look of this style is distinct and calming.

Handwriting

Handwritten and script fonts are abused the most. For this reason, many designers steer clear of both types either out of disgust or because of a fear of looking amateurish. But lately, many designers have found that, when used properly, the handwritten style conveys a sense of craft and planning. Used in the right context, it is a powerful way to communicate.

Social Media

With people spending more time on Facebook than Google now, no wonder designers are looking for innovative ways to integrate social media on their websites.

Some designers have gone so far as to publish their content on social media networks and then use their websites to aggregate it.

It is safe to say that as 2010 progresses, we will see more designers find creative ways to integrate social media onto their websites in order to better engage users.

Fixed Elements

Now that browsers better support the position: fixed element, we are seeing cleverer uses of it.

There are plenty of situations in which a fixed element (such as persistent navigation) could serve the owner’s business objectives and make the website more usable.

Fixed elements are memorable and enhance the user experience. They have countless creative uses, and we will continue to see designers take advantage of them.

This guest post is a collaboration between the good folks at Web Hosting Search and designer and developer Ross Johnson. Check out Web Hosting Search for proper web hosting and 3point7designs for more web design awesomeness by Ross

CSS3 技术

不确定你可以利用CSS3吗?再想想。网络先锋如Andy Clarke 和 Jeremy Keith一直提倡网页设计要“逐步加强”。

逐步增强是指在网站设计师时要兼顾到旧版浏览器的可用性,而“增强”则是针对喜欢最新技术的用户。

在这样的设计阵营,你利用可以尽情利用CSS3属性的优势,如圆角,边框背景和文本框阴影。新版浏览器用户会看到一个很好的版本,并且对旧版本用户( IE6同学,我就不每次都点名了)将看到较为基本的版本。

CSS3 动画
在网络上动画经历了很多阶段。起初,我们只能用GIF动画图片。然后,我们又几乎限于Flash。现在,我们可以选择的有 Flash,Silverlight,以及GIF,JavaScript和甚至乎CSS3。CSS3更轻量,更易用,可创造令人难忘的微妙的动画。

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译
圆角
在2005年和2006年的Web 2.0风格,使得圆角大受欢迎,恼人的问题是,在当时要实现这些可不容易。有没有固定可行的方法来建立真正的圆角。退而求其次的,大多都是利用 CSS,JavaScript和图像来模拟。

现在CSS3允许浏览器直接生成圆角,不仅创建轻松,而且更有效率,因为用户不必下载额外的图片或JavaScript文件。

2010年,设计师正越来越多地利用浏览器的这些新功能优势。

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译
图框和文本阴影
在网络的早期,利用阴影创造一种立体感是早已有之(甚至有时是用过头了)。但其实并不总是那么好搞的,要给文本添加阴影,你得使用的图片,从而增加加载时 间,并且维护更加困难。框架阴影需要一些图片和CSS技巧,如“滑动门”。

CSS3具有阴影高度可定制的能力,这对于创新影响十分巨大,不仅包括阴影,还有内阴影。有创意设计师已经开始使用这些CSS3效果,模拟浮雕和压印的效 果。

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译
RGBa和半透明
多年来,使用不透明性和透明度,在网络上技术上是不可能的。你有三种选择:使用平面图像模拟的透明度,使用不能跨浏览器兼容的PNG格式,或者去折腾 CSS基本的透明选择器和滤镜。

CSS3使得设计师在使用RGBa不透明属性时,更加稳定和自由。你可以在很多方面利用半透明的优点,其中之一就是使用半透明的颜色叠加到复杂背景时起到 特别作用。之前,这种效果如果没有使用PNG是不切实际,也是不可能达到的。

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译
手机兼容设计
移动网络让成千上万的用户在排队等候(无事可做)时能够检查他们的银行帐户,在地铁里可以查看最新分数,在开车时更新自己的Twitter的情况(这是一 个危险的习惯?),移动网络正在茁壮成长。

据我们所知,很多公司都都在考虑他们的网站是否要加入移动网络,如果是的话又会怎么样。而创新公司则已经投入巨资在开发高效的用户友好的移动版本网站。

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译
创新
社交媒体使用率的爆炸性增长证明,人们对连接和共享东西总是热情有加的。

在设计领域,我们已经看浏览和分享别人作品的趋势正在增长。作为设计师,现在我们感受着别人创造力的冲击。这不仅提高了设计质量的标准,还鼓励了共享精 神,也促进了创造力和创新文化理念。
清新的插画
如果你像我一样,看着迪斯尼电影长大,你会欣赏动画里面每一帧的效果。我们早已淡忘了墨水和马克笔画插画的日子,工具的演变产生了一些非常有创意的方法去 实现设计。

很多设计师正在学习使用光滑,干爽,清晰的插图创建一个独特的感觉,这不是摄影或简单的剪贴画可以达到的。结果是出现了很多美丽动人富有吸引力的专业插画 设计。

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译
纹理背景
纹理图案背景在网络上没有什么新鲜的。但是,最近几个月这种技术已经出现了有趣的变化。我指的是“微型纹理”, 是微妙的,几乎不明显的背景纹理。

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译
缩略图
你可能会说,“缩略图从网络出世那天早就有了。怎样么会是趋势呢?”是的,它们一直被使用,但普遍很简单。有一个缩略图,点击一下就可以看得更大的图片。 需要的功能就是这样,不过很无聊。

在最近几个月,设计师们开始探讨,“怎样才能使缩略图更精彩?”这些探讨导致了缩略图在智能和可用性方面大大增强。

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译
水彩效果
随着网络的发展,我们看到越来越多的设计师正从各种媒体来源获取灵感。毫不奇怪,艺术就是来源于此。

最近出现风格之一是模拟水彩。这种轻柔优雅风格看起来总是那么清晰和平静。

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译
手写
手写字体和草稿字体一直滥用得很厉害。基于这个原因,许多设计师避开这两种类型,出于厌恶或者因为看起来很业余的感觉。不过最近,许多设计师都发现,如果 使用得当,手写风格可以传达手工艺和策划的意识。在结合上下文环境使用,会是一个功能强大的表达方式。

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译
社交媒体
现在人们在Facebook和Google上花更多的时间,设计师正用创新的方法来把社交媒体整合到网站上。

有些设计师竟然在社交媒体网络上发布内容,然后利用他们的网站聚合。

可以很有把握的说随着2010年的进一步发展,我们将看到更多的设计师创造性地整合社交媒体到网站,以更好的吸引用户。

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译
固定元素
现在,浏览器可以更好地支持元素position: fixed属性,我们看到这个属性的一些巧用。

很多情况下,固定的元素(如固定不动的导航条)可以为目标客户更好服务,网站也更加实用。

固定元素令人难忘且增强用户体验,有无数的创意用途,我们将会看到设计师利用这些优点。

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

2010网页设计趋势 MazingTech.Com翻译

那些流行趋势是你在追随的?还有其他什么样的新兴的趋势?欢迎讨论

The full article url:http://www.webdesignerdepot.com/2010/05/web-design-trends-for-2010/

Post to Twitter

Keep this in my blog just because I feel it’s interesting and you can try this API easy.

The world of web typography is advancing with leaps and bounds. Already we have the options of SiFR, Cufon, Typekit, @font-face and now, Google has introduced their own custom font service under the Google Font API. Let’s take a look at what the Google Font API is and how you can use it in your own web designs.

View the Google Font API demo

How it works

The Google Font API is basically a shortcut to manually using the CSS3 @font-face property. When you insert the Google code in your website, the Font API returns a stylesheet including an @font-face rule for your chosen font, it might look a little like this:

@font-face {
  font-family: 'Reenie Beanie';
  font-style: normal;
  font-weight: normal;
  src: local('Reenie Beanie'), url('http://themes.googleusercontent.com/font?kit=ljpKc6CdXusL1cnGUSamX_cCQibwlboQP4eCflnqtq0') format('truetype');
}

The difference is, Google will do all the hard work in getting the font to work in non-CSS3 browsers such as Internet Explorer.

Advantages

The Google Font API is one of the most easy to use custom web font solutions out there. With just a line of code you’re ready to import a range of custom fonts from the Google Font Direcory.

The Google Font API works like a charm in most browsers.

The Google Font Directory includes a range of tasteful and stylish fonts to choose from, as well as a selection of more decorative options.

All fonts are released under an Open Source license, so the Google Font API can be used in both your commercial and personal projects.

Text rendered using the Google Font API is still selectable, which is one drawback with some solutions like SiFR.

The Google Font API doesn’t rely on Javascript, so the customised fonts still show if the user has Javascript disabled.

Because the fonts are rendered with good old CSS, any additional styling such as the CSS3 text-shadow property can be added.

Disadvantages

Despite having a few nice options in the Font Directory, the choice is fairly limited. However you can tie the Google Font API with Typekit using Javascript and the WebFont loader to open up further font options.

Most browsers will load the rest of the page before rendering the font. This may leave a blank space, or the fallback option until the page has been completely downloaded.

It’s not supported on mobile browsers such as the iPhone, iPod or iPad webkit browser or Android.

Enough blabber, how do I use this thing?!

Google Font API directory

Head over to the Google Font Directory to browse the catalog and pick out the font of your desire. I’m going to use the IM Fell DW Pica SC variant of IM Fell and Reenie Beanie.

Google Font API code for IM Fell

Click the Get the code tab and copy the CSS stylesheet link.

<title>Custom Fonts using Google Fonts API</title>

<link href='http://fonts.googleapis.com/css?family=IM+Fell+DW+Pica+SC' rel='stylesheet' type='text/css'>

</head>

Paste the code in the head of your web page.

h2 {
	font-family: "IM Fell DW Pica SC", Georgia, Serif;
}

In your own CSS stylesheet, add the name of the font as specified by Google to your font stack in quotation marks. Follow this up with backup options.

View the Google Font API demo

This article is from http://line25.com/

Post to Twitter

Share this blog

Bookmark and Share