在运行vagrant provision时经常会出现default:stdin:is not a tty的错误信息,但是对于运行结果没有影响,每次看到这个信息有点郁闷。
解决办法也很简单,只要在配置文件中增加一下内容就可以了
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
在运行vagrant provision时经常会出现default:stdin:is not a tty的错误信息,但是对于运行结果没有影响,每次看到这个信息有点郁闷。
解决办法也很简单,只要在配置文件中增加一下内容就可以了
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
昨天做项目时遇到一个问题,我在页面上定义的js方法,方法定义如下
<script type="application/javascript">
function callback(data){
alert(data);
}
</script>
然后在这个页面引入的js中调用此方法
callback("haha");
问题是在IE9及chrome 等高级浏览器下都能正常的工作,但是在IE8及以下浏览器下都提示未定义callback这个方法。折腾的好久,最后请教了同事,他说把type="application/javascript" 改成 type="text/javascript" 试试。结果还真的可以了……
好吧,百度了一下为什么,得到的原因大致如下:type="text/javascript" 是比较过时的写法,IETF 推荐的是 type="application/javascript",而比较古老的浏览器不认type="application/javascript",从而导致js不生效。
如果为了更好的兼容低端浏览器推荐使用type="text/javascript"
main 和 pay<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactoryBeanName" value="mainSqlSessionFactory"/>
<!-- Mapper接口所在包名,Spring会自动查找其下的Mapper -->
<property name="basePackage" value="com.loftor.mapper.main"/>
</bean>
Hashtable.h###根据记忆实现了C的链表基本操作
代码在:http://git.loftor.com/study/c.git/tree/List/List.cpp
// List.c: 主项目文件。
#include <stdio.h>
#include <stdlib.h>
/*双向节点定义*/
typedef struct Node
{
int value;
Node * next;
Node * prev;
} Node;
/*初始化链表*/
Node * createList(int first){
Node * node = (Node *)malloc(sizeof(Node));
node->value = first;
node->next = NULL;
node->prev = NULL;
return node;
}
bool isEmptyList(Node **pNode){
return (*pNode) == NULL;
}
/*指针重置到List头部*/
void resetHead(Node **pNode){
if (isEmptyList(pNode)){
(*pNode) = NULL;
}
else{
while ((*pNode)->prev != NULL)
{
(*pNode) = (*pNode)->prev;
}
}
}
/*指针重置到List头部*/
void resetTail(Node **pNode){
if (isEmptyList(pNode)){
(*pNode) = NULL;
}
else{
while ((*pNode)->next != NULL)
{
(*pNode) = (*pNode)->next;
}
}
}
/*返回List长度*/
int lengthList(Node **pNode){
resetHead(pNode);
int length = 0;
if (isEmptyList(pNode)){
return length;
}
while ((*pNode)->next != NULL)
{
length++;
(*pNode) = (*pNode)->next;
}
resetHead(pNode);
return length;
}
/*打印链表*/
void printfList(Node *pNode){
if (!isEmptyList(&pNode))
{
printf("%d\t", pNode->value);
while (pNode->next != NULL){
pNode = pNode->next;
printf("%d\t", pNode->value);
}
}
printf("\n");
}
/*左边压入一个*/
void leftPush(Node **pNode, int value){
Node * newNode = (Node *)malloc(sizeof(Node));
resetHead(pNode);
newNode->prev = NULL;
newNode->next = *pNode;
newNode->value = value;
if (!isEmptyList(pNode))
{
(*pNode)->prev = newNode;
}
*pNode = newNode;
}
/*右边压入一个*/
void rightPush(Node **pNode, int value){
Node * newNode = (Node *)malloc(sizeof(Node));
resetTail(pNode);
newNode->next = NULL;
newNode->prev = *pNode;
newNode->value = value;
if (!isEmptyList(pNode))
{
(*pNode)->next = newNode;
}
else{
*pNode = newNode;
}
resetHead(pNode);
}
/*从左边出一个*/
int leftPop(Node **pNode){
resetHead(pNode);
Node *tempNode = *pNode;
int value = tempNode->value;
(*pNode) = tempNode->next;
(*pNode)->prev = NULL;
free(tempNode);
return value;
}
/*从右边出一个*/
int rightPop(Node **pNode){
resetTail(pNode);
Node *tempNode = *pNode;
int value = tempNode->value;
(*pNode) = tempNode->prev;
(*pNode)->next = NULL;
resetHead(pNode);
free(tempNode);
return value;
}
/*删除指定节点*/
bool removeNode(Node **pNode, int index){
int length = lengthList(pNode);
if (length<index) //节点不存在
{
return false;
}
Node * tempNode = *pNode;
for (int i = 0; i < index; i++)
{
tempNode = tempNode->next;
}
if (tempNode->prev != NULL)
{
tempNode->prev->next = tempNode->next;
}
if (tempNode->next != NULL)
{
tempNode->next->prev = tempNode->prev;
}
free(tempNode);
return true;
}
/*销毁List*/
bool destroyList(Node **pNode){
resetHead(pNode);
if (pNode==NULL)
{
return true;
}
Node *head = (*pNode);
if (head->next == NULL)
{
free(head);
return true;
}
while ((*pNode)->next != NULL)
{
(*pNode) = (*pNode)->next;
free((*pNode)->prev);
}
*pNode = NULL;
return true;
}
int main()
{
//Node * list = createList(1);
Node * list = NULL;
rightPush(&list, 2);
rightPush(&list, 3);
rightPush(&list, 4);
rightPush(&list, 5);
rightPush(&list, 6);
rightPush(&list, 7);
leftPush(&list, 1);
removeNode(&list, 4);
printf("链表长度为:%d\n", lengthList(&list));
int value = leftPop(&list);
value = rightPop(&list);
printf("链表长度为:%d\n", lengthList(&list));
printfList(list);
destroyList(&list);
return 0;
}
在windows下面安装了git后,没有使用 git bash 去生成key时,可能会出现以下错误
Microsoft Windows [版本 6.3.9600]
(c) 2013 Microsoft Corporation。保留所有权利。
C:\Users\Loftor>ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (//.ssh/id_rsa):
Could not create directory '//.ssh': No such file or directory
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
open //.ssh/id_rsa failed: No such host or network path.
Saving the key failed: //.ssh/id_rsa.
C:\Users\Loftor>
这个错误的原因是我们没有配置环境变量HOME目录,从而找不到目录。
所以我们只要在环境变量中增加HOME就能解决问题了!~

C:\Users\Loftor>ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Loftor/.ssh/id_rsa):
Created directory '/c/Users/Loftor/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Loftor/.ssh/id_rsa.
Your public key has been saved in /c/Users/Loftor/.ssh/id_rsa.pub.
The key fingerprint is:
04:14:6f:66:3f:f5:71:d0:d7:36:82:c6:09:94:fe:45 Loftor@LOFTOR-PC
The key's randomart image is:
+--[ RSA 2048]----+
| .+..o+ o ...|
| o . = E o=|
| B . o o.+|
| = o . o o |
| S + . . |
| o |
| |
| |
| |
+-----------------+
C:\Users\Loftor>
alter添加,而且容易搞错。