Mittwoch, 6. Februar 2013

WordPress教程:支付宝集成思路及实现


如何在WordPress程序中集成支付宝是实现WordPress电子商务化必须要突破的一个瓶颈。WordPress有很多的电子商务类插件,像比较著名的WP e-Commerce等。但这些插件唯一的缺点就是不够本地化,不支持支付宝。
或许由于WordPress支付宝集成的商业应用价值比较高,很少有人愿意将相关经验免费分享出来。还有一般WP高手都比较低调,忙着赚钱去了。在网上搜集相关资料我一无所获,除了那篇被转载了几百遍的不知谁写的所谓教程。在这里就不给链接了,因为分不清谁是原创了已经。
先说明一下:本操作需要你对WordPress模板比较熟悉并且了解WordPress自定义域相关知识、懂一点HTML和CSS。
废话不说了,下面是详细步骤。
1、 首先你要是支付宝签约商家,并申请开通担保交易或者即时到账交易,(我申请的是即时到帐)申请一般有审核期,不过支付宝工作人员的办事效率还是很高的。
2、 申请通过后你将会获得一个支付宝安全校验码(key)和一个合作身份(Partner ID)。这里是官方帮助(图文)。这两个号码非常重要,下面会用得到。
3、 登陆支付宝账户商家服务页面下载集成技术文档。或者你也可以到支付宝论坛下载。(注意:下载PHP+utf8的)。
4、 接下来是参数配置,你只需要修改alipay_config.php这个文件即可。
//合作身份者ID,以2088开头的16位纯数字
$partner= "";
//安全检验码,以数字和字母组成的32位字符
$key = "";
//签约支付宝账号或卖家支付宝帐户
$seller_email= "";
//交易过程中服务器通知的页面 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
$notify_url= "http://www.yourdomain/alipay/notify_url.php";
//付完款后跳转的页面 要用 http://格式的完整路径,不允许加?id=123这类自定义参数
$return_url= "http://www.yourdomain/alipay/return_url.php";
//网站商品的展示地址,不允许加?id=123这类自定义参数
$show_url= "";
//收款方名称,如:公司名称、网站名称、收款人姓名等
$mainname= "";
5、 将修改后的文件上传至你网站的根目录,注意不要最好改变原有的目录结构和文件名称。快速付款入口模板文件(index.php)、图片、CSS样式文件夹 (images)无需上传。这两个文件可以集成到你的WordPress主题中。例如我是放在http://www.mydomain.com /alipay
6、 到这里其实万里长征已经走完第一步了,接下来就是将支付宝集成到你主题中想要的位置。比如单篇文章页面(single.php)。集成的总体思路就是利用 WordPress自定义域,将数值通过表单隐藏域或者URL参数用POST的方式传递给接口,并赋值给接口表单实现。这里有三个非常重要的参数:商品名 称、商品描述和商品价格。
WordPress集成支付宝参数一览表
注:表单name一项是支付宝官方提供的集成文件固有命名,一般不要改动。如果你水平很高例外。
7、 下面是一段代码具体示例,我把它集成到了单篇日志文件中。当然,你的WP主题最好有设计换门的商品页面模板,而不是和文章页面公用一个模板。


"  maxlength="200">
"/>
">

8、 到这里其实支付宝功能已经可以使用了。添加一篇新的文章,添加相应的自定义域,然后发布。看看是不是可以在线购买了已经?接下来就是一些美化的工作,如果你精通CSS,精通HTML表单设计,精通JQURY,可以让支付更美观更安全。
9、 如果你还有精力,可以考虑将支付宝集成功能做成插件,完善相关配置选项,实现WordPress后台订单查询及跟踪。这都是可以实现 的,WordPress完全有潜力打造成一个比ECSHOP或者SHOPEX还想打的在线网店,而且在搜索引擎优化方面的表现会比后两者更佳。

Donnerstag, 4. Oktober 2012

各大银行网银转账手续费一览表


各大银行网银转账手续费一览表



Samstag, 13. August 2011

Nero 10 注册

把文件解压,然后复制AdvrCntr5.dll到

C:\Program Files\Common Files\Nero\AdvrCntr5覆盖,

以管理员的身份运行AdvrCntrReg批处理文件,再把序列号:

9X13-0183-H4K2-CEE3-0UK4-UEXE-C100-00W0。

1K00-4166-99X9-2A6K-33E1-6M0A-8E0C。

KC00-9039-1983-284A-2A45-6MA6-EKMX

添加进去就可以了,经测试vista32,windows732上nero10白金版10.5 10.6都能破解而且非常稳定,成功不成功在这留个言,祝你好运!

压缩包下载:请阅读TXT文档

http://u.115.com/file/e6ucms0l#NERO_10_本机破解.rar

Mittwoch, 3. August 2011

如果把竞争对手的标志互换会是怎样?

Coca-Cola and Pepsi

Companies Swapped Logos

McDonalds and Burger King

McDonalds and Burger King

YouTube and Vimeo

YouTube and Vimeo

Ferrari and Ford

Ferrari and Ford

FedEx and UPS

FedEx and UPS

Google and Yahoo!

Google and Yahoo

Nikon and Canon

Nikon and Canon

Visa and Mastercard

Visa and Mastercard

Audi and BMW

Audi and BMW

Netflix and Hulu

Netflix and Hulu

Reddit and Digg

Reddit and Digg

Pizza Hut and Dominos

Pizza Hut and Dominos

Skype and Google Talk

Skype and Google Talk

Best Buy and Walmart

Best Buy and Walmart

iPhone and Android

iPhone and Android

Nike and Puma

Nike and Puma

Facebook and Twitter

Facebook and Twitter

Montag, 1. August 2011

Understanding the Git Workflow

If you don’t understand the motivation behind Git’s design, you’re in for a world of hurt. With enough flags you can force Git to act the way you think it should instead of the way it wants to. But that’s like using a screwdriver like a hammer; it gets the job done, but it’s done poorly, takes longer, and damages the screwdriver.

Consider how a common Git workflow falls apart.

Create a branch off Master, do work, and merge it back into Master when you’re done

Most of the time this behaves as you expect because Master changed since you branched. Then one day you merge a feature branch into Master, but Master hasn’t diverged. Instead of creating a merge commit, Git points Master to the latest commit on the feature branch, or “fast forwards.” (Diagram)

Unfortunately, your feature branch contained checkpoint commits, frequent commits that back up your work but captures the code in an unstable state. Now these commits are indistinguishable from Master’s stable commits. You could easily roll back into a disaster.

So you add a new rule: “When you merge in your feature branch, use –no-ff to force a new commit.” This gets the job done, and you move on.

Then one day you discover a critical bug in production, and you need to track down when it was introduced. You run bisect but keep landing on checkpoint commits. You give up and investigate by hand.

You narrow the bug to a single file. You run blame to see how it changed in the last 48 hours. You know it’s impossible, but blame reports the file hasn’t been touched in weeks. It turns out blame reports changes for the time of the initial commit, not when merged. Your first checkpoint commit modified this file weeks ago, but the change was merged in today.

The no-ff band-aid, broken bisect, and blame mysteries are all symptoms that you’re using a screwdriver as a hammer.

Rethinking Revision Control
Revision control exists for two reasons.

The first is to help the act of writing code. You need to sync changes with teammates, and regularly back up your work. Emailing zip files doesn’t scale.

The second reason is configuration management. This includes managing parallel lines of development, such as working on the next major version while applying the occasional bug fix to the existing version in production. Configuration management is also used to figure out when exactly something changed, an invaluable tool in diagnosing bugs.

Traditionally, these two reasons conflict.

When prototyping a feature, you should make regular checkpoint commits. However, these commits usually break the build.

In a perfect world, every change in your revision history is succinct and stable. There are no checkpoint commits that create line noise. There are no giant, 10,000 line commits. A clean history makes it easy to revert changes or cherry-pick them between branches. A clean history is easy to later inspect and analyze. However, maintaining a clean history would mean waiting to check in changes until they’re perfect.

So which approach do you choose? Regular commits, or a clean history?

If you’re hacking on a two man pre-launch startup, clean history buys you little. You can get away with committing everything to Master, and deploying whenever you feel like it.

As the consequences of change increase, be it a growing development team or the size of your user base, you need tools and techniques to keep things in check. This includes automated tests, code review, and a clean history.

Feature branches seem like a happy middle ground. They solve the basic problems of parallel development. You’re thinking of integration at the least important time, when you’re writing the code, but it will get you by for some time.

When your project scales large enough, the simple branch/commit/merge workflow falls apart. The time for duct-tape is over. You need a clean revision history.

Git is revolutionary because it gives you the best of both worlds. You can regularly check in changes while prototyping a solution but deliver a clean history when you’re finished. When this is your goal, Git’s defaults make a lot more sense.

The Workflow
Think of branches in two categories: public and private.

Public branches are the authoritative history of the project. In a public branch, every commit should be succinct, atomic, and have a well documented commit message. It should be as linear as possible. It should be immutable. Public branches include Master and release branches.

A private branch is for yourself. It’s your scratch paper while working out a problem.

It’s safest to keep private branches local. If you do need to push one, maybe to synchronize your work and home computers, tell your teammates that the branch you pushed is private so they don’t base work off of it.

You should never merge a private branch directly into a public branch with a vanilla merge. First, clean up your branch with tools like reset, rebase, squash merges, and commit amending.

Treat yourself as a writer and approach each commit as a chapter in a book. Writers don’t publish first drafts. Michael Crichton said, “Great books aren’t written– they’re rewritten.”

If you come from other systems, modifying history feels taboo. You’re conditioned that anything committed is written in stone. By that logic we should disable “undo” in our text editors.

Pragmatists care about changes until the changes become noise. For configuration management, we care about big-picture changes. Checkpoint commits are just a cloud-backed undo buffer.

If you treat your public history as pristine, fast-forward merges are not only safe but preferable. They keep revision history linear and easier to follow.

The only remaining argument for –no-ff is “documentation.” People may use merge commits to represent the last deployed version of production code. That’s an antipattern. Use tags.

Guidelines and Examples
I use three basic approaches depending on the size of my change, how long I’ve been working on it, and how far the branch has diverged.

Short lived work

The vast majority of the time, my cleanup is just a squash merge.

Imagine I create a feature branch and create a series of checkpoint commits over the next hour:

git checkout -b private_feature_branch
touch file1.txt
git add file1.txt
git commit -am "WIP"

When I’m done, instead of a vanilla git merge, I’ll run:

git checkout master
git merge --squash private_feature_branch
git commit -v

Then I spend a minute writing a detailed commit message.

Larger work

Sometimes a feature sprawls into a multi-day project, with dozens of small commits.

I decide my change should be broken into smaller changes, so squash is too blunt an instrument. (As a rule of thumb I ask, “Would this be easy to code review?”)

If my checkpoint commits followed a logical progression, I can use rebase’s Interactive Mode.

Interactive mode is powerful. You can use it to edit an old commits, split them up, reorder them, and in this case squash a few.

On my feature branch:

git rebase --interactive master

It then opens an editor with a list of commits. On each line is the operation to perform, the SHA1 of the commmit, and the current commit message. A legend is provided with a list of possible commands.

By default, each commit uses “pick,” which doesn’t modify the commit.

pick ccd6e62 Work on back button
pick 1c83feb Bug fixes
pick f9d0c33 Start work on toolbar

I change the operation to “squash,” which squashes the second commit into the first.

pick ccd6e62 Work on back button
squash 1c83feb Bug fixes
pick f9d0c33 Start work on toolbar

When I save and close, a new editor prompts me for the commit message of the combined commit, and then I’m done.

Declaring Branch Bankruptcy

Maybe my feature branch existed for a very long time, and I had to merge several branches into my feature branch to keep it up to date while I work. History is convoluted. It’s easiest to grab the raw diff create a clean branch.

git checkout master
git checkout -b cleaned_up_branch
git merge --squash
git reset

I now have a working directory full of my changes and none of the baggage from the previous branch. Now I manually add and commit my changes.

Summary
If you’re fighting Git’s defaults, ask why.

Treat public history as immutable, atomic, and easy to follow. Treat private history as disposable and malleable.

The intended workflow is:

Create a private branch off a public branch.
Regularly commit your work to this private branch.
Once your code is perfect, clean up its history.
Merge the cleaned-up branch back into the public branch.

“苹果树”: 苹果35年产品总览