Month: December 2015

多git帐号的SSH key切换

1.同一台电脑可以有2个git账号(不同网站的) 首先不同网站,当然可以使用同一个邮箱,比如我的github,gitlab,bitbucket的账号都是gotodiscuss[at]gmail.com 这时候不用担心密钥的问题,因为这些网站push pull 认证的唯一性的是邮箱 比如我的windows 上 2个账号一个gitlab 一个github (用的都是id_rsa) host github hostname github.com Port 22 host gitlab.ikeepstudying.com hostname gitlab.ikeepstudying.com Port 65095 不需要指定key的位置。因为默认读… Read More

Cookie禁用了,Session还能用吗?

Cookie与Session,一般认为是两个独立的东西,Session采用的是在服务器端保持状态的方案,而Cookie采用的是在客户端保持状态的方案。 Cookie分为两种,一种可以叫做session cookie,浏览器关闭就会丢失,一种可以叫做persistent cookie,就是我们通常意义上所说的cookie,通常服务器端的session是借助于seesion cookie来和客户端交互的。 针对php,如果客户端关闭cookie,我们怎么办? 1. 设置php.ini配置文件中的“session.use_trans_sid = 1”,或者编译时打开打开了“–enable-trans-si… Read More

Magento: 无法登录后台 Can’t login to admin panel

This tutorial shows how to resolve the Magento admin panel login issue. It’s a common issue: you are trying to login to the Magento admin panel, typed your username and password, clicked Login button and nothing happens. The page refreshes and that’s all. No error or any other messages. This is caused by the cookies issue. In

Linux视频转换: 如何利用HandBrake将DVD光碟转成各式影片档

之前本站已经有写过关于Handbrake的教学: 如何将租回来的DVD转成电脑可播放的影片档 ,不过因为那篇教学比较旧了,而且新版的Handbrake也有些改变,甚至为了转档效率,目前Handbrake还把给Intel机种和PPC机种用的版本分开。 另外,也有很多朋友有这样的需求,需要将DVD影片转成在iPod、iPod Touch、iPhone上面观看,所以本篇教学目的就是更新一下之前的教学流程,并且善用Handbrake已经设定好的各式影片的预设值,这样的话,整个转档的流程,相信会更加愉快的~ 那就开始吧~ 下载HandBrake 首先请您先去下载最新版本的HandBrake来安装,连结到HandBra… Read More

Linux 视频转换: DVD AVI 转 MP4 – HandBrake – Copy a DVD AVI to MP4 or MKV file

For the impatient: the short version … For those that are impatient and more experienced, you can follow the following steps quickly. For beginners I recommend to continue reading the following paragraphs which explain a little bit more about what’s happening. Install HandBrake. Install codecs and libdvdcss (see below). Start HandBrake. Insert DVD.… Read More

Git远程操作详解

Git是目前最流行的版本管理系统,学会Git几乎成了开发者的必备技能。 Git有很多优势,其中之一就是远程操作非常简便。本文详细介绍5个Git命令,它们的概念和用法,理解了这些内容,你就会完全掌握Git远程操作。 git clone git remote git fetch git pull git push 本文针对初级用户,从最简单的讲起,但是需要读者对Git的基本用法有所了解。同时,本文覆盖了上面5个命令的几乎所有的常用用法,所以对于熟练用户也有参考价值。 一、git clone 远程操作的第一步,通常是从远程主机克隆一个版本库,这时就要用到git clone命令。 $ git clone <版本库的网址> 比如,克… Read More

Magento: Mage::getResourceModel, Mage::getModel 和 Mage::getSingleton() 的区别 when to use Mage::getResourceModel, Mage::getModel and Mage::getSingleton()

Perfect differece with example for getsingleton and getmodel. Mage::getSingleton() Mage::getSingleton() will first check if the same class instance exists or not in the memory. If the instance exists then it will return the same object from the memory. So Mage::getSingleton() is faster than Mage::getModel(). Example $product1 = Mage::getSingleto… Read More

Magento: 获取客户信息 Get Customer’s Full Name, First Name, Last Name and Email Address

1.  获取已登录客户信息 // Check if any customer is logged in or not if (Mage::getSingleton('customer/session')->isLoggedIn()) { // Load the customer's data $customer = Mage::getSingleton('customer/session')->getCustomer(); $customer->getPrefix(); $customer->getName(); // Full Name $customer->getFirstname(); // First Name $cu… Read More

Magento: 获取商店名称及邮件地址 Get Store Email Addresses

General Contact /* Sender Name */ Mage::getStoreConfig('trans_email/ident_general/name'); /* Sender Email */ Mage::getStoreConfig('trans_email/ident_general/email'); Sales Representative /* Sender Name */ Mage::getStoreConfig('trans_email/ident_sales/name'); /* Sender Email */ Mage::getStoreConfig('trans_email/ident_sales… Read More

Magento: 客户登陆验证 How magento store password and validate password

Magento uses MD5 and salt algorithems to store password for customer as well admin user. How magento create encrypted password Magento create encrypted password with, Mage::getModel('core/encryption')->decrypt($password); Here is the logic of decrypt($password) function, $password = "12345678"; $salt = "at"; $encyPasswod = md5($salt.$pa… Read More

用ssh反向连接访问内网主机 ( 实例使用autossh隧道实现mysql的同步 )

一、准备知识 什么是autossh? 假设有两台主机: A主机为外网,B主机为内网 通常来说外网主机A是无法直接连接到内网主机B的,这时如果要实现A主机通过ssh控制B主机,通常来说有两种方法: 1.端口映射: 将B主机的ssh端口映射到B的外网ip,当然这要通过设置防火墙来实现 2.ssh的反向连接: B主机通过ssh连接到A主机,并在A主机上打开一个端口进行监听。这时如果A主机连接本机的这个端口就可以实现控制B主机 ssh -NfR 1111:localhost:2222 user1@外网主机A -p 22 2222为A主机在B打开的监听端口,1111为A主机本地的端口,这时访问B主机的2222端口就映射在A主机的11… Read More

100 个免费翻墙工具

请问你有用过多少种翻墙工具? 我有用过好几打,包括不同的代理、SSH、VPN 等等,这些翻墙工具都有可能随时被墙,所以,多多益善。 以下是我曾经用过现在也有部分在用的 100 个免费翻墙工具及其使用方法: 一、在线代理网站 (66) 在线代理网站的最大好处是你不需要下载安装任何的软件,最不好的地方就是弹窗广告很烦人: 1、Aniscartujo.com 这个 Aniscartujo 在线代理适用于电脑和手机。 2、Free Web Proxy Free Web Proxy 可以观看 YouTube 视频并将它们下载为 MP4 文件。 3、Daveproxy 不能看 YouTube 视频。 4、TryCatchMe 不能看 YouTube 视频。 5、Sur… Read More