01
writing algorithm by assembly,but the bug...
now,it runs normaly,but how to print the answer?
succeeded !!!
begin socket programming!
#include <stdio.h> #include <string.h> #include <sys/socket.h> #include <stdlib.h> #include <arpa/inet.h> #include <netinet/in.h> int main(int argc, char **argv) { int sockfd, len; struct sockaddr_in dest; sockfd = socket(AF_INET, SOCK_STREAM, ); printf("socket created.\n"); dest.sin_family = AF_INET; dest.sin_port = htons(atoi(argv[])); inet_aton(argv[], (struct in_addr *) &dest.sin_addr.s_addr); connect(sockfd, (struct sockaddr *) &dest, sizeof(dest)); printf("server connected\n"); ; }
http://blog.csdn.net/a_ran/article/details/41871437
/** * client program of chat * by localhost pur whoami Atum * 0ct 5 2016 * version 1.0 **/ #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <stdlib.h> #include <arpa/inet.h> #include <netinet/in.h> #include <errno.h> #include <netdb.h> #include <net/if.h> #include <sys/ioctl.h> #include <sys/types.h> #define MAXBUF 1024 #define MAC_SIZE 18 #define IP_SIZE 16 // get ip by domain int get_ip_by_domain(const char *domain, char *ip) { char **pptr; struct hostent *hptr; hptr = gethostbyname(domain); if(NULL == hptr) { printf("gethostbyname error for host:%s/n", domain); ; } for(pptr = hptr->h_addr_list ; *pptr != NULL; pptr++) { if (NULL != inet_ntop(hptr->h_addrtype, *pptr, ip, IP_SIZE) ) { ; // 只获取第一个 ip } } ; } int main(int argc, char **argv) { int sockfd, len; struct sockaddr_in dest; ]; //1.create socket object )) < ) { perror("socket"); exit(errno); } printf("socket created.\n"); //set dest 0 bzero(&dest, sizeof(dest)); //address protocal dest.sin_family = AF_INET; //the port of server dest.sin_port = htons(atoi(argv[])); char ip[IP_SIZE]; get_ip_by_domain(argv[], ip); //get the ip of server ) { perror(argv[]); exit(errno); } //connect the server ) { perror("connect"); exit(errno); } printf("server connected\n"); printf("pls send message to send:"); fgets(buffer,MAXBUF,stdin); send(sockfd,buffer,strlen(buffer) - , ); ; }
Oct 8,9
7 days' vacation has ended.Continue my boring working life. Oct 8 I am very busy.Kept working until 23 o'clock.
Oct 9,I learned github's BRANCH and FORK. prepared for the teamwork of my project.
Oct 10-13
These days I worked with some fucking silly people to do my project.It's very difficult. spent much of my time.Fuck their mums.
Oct 14
Today,morning conference,project manager told me to complete the work of file_mount_and_tmpfiledelete_of_eds_install today.That made me nervous.But jut working as well as chatting with friends,I did it. hehe. It is all by my skill.
Install mysql on my linux,just three commands.then continue my web project.
Install NASM.
Continue my own Os stein.
Oct 16
Dissolve that fucking stupid "team", Let those pigs go to eat shit ! !
Oct 17
Write some easy python functions at work.
Rename my project, now it's called Ciel. means sky.
Learn about how to use python extending C.
21o'clock, went home. install tkinter on my Linux.
Then I rent a server with 78RMB for a month.
18
this error:
And begin to set my java web on the server.
I found that mysql and java are already installed on this debian linux.
but there is something wrong.
because nginx?
19
I found that my tomcat ran failed.Because the port has been used.8005,8080,8009.
After the tomcat inited successfully,I couldn't see my web page from the external network either.
because nginx?
finally I reinstall the os using ubuntu.
but the user is called 'ubuntu' not 'root'. And it caused some problems......
20
lucky night.
Unable to add the resource at [/WEB-INF/lib/spring-aop-3.2.2.RELEASE.jar] to the cache because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache
10-23
解放自己的思想,做真正的强者。不要去在乎弱者的看法与评论,轻蔑是对弱者最大的礼貌。
真正的强者,不会感到忧愁,苦恼,孤独。强力意志给予他生命的热忱。从不怀疑自己。从不低下骄傲的头。
让强力意志深入自己的肉体,骨骼,灵魂。作一个吟诗的屠夫,魔鬼。
成为狼,成为鹰。在高寒的雪原,苍空奔袭,飞翔。
java, html/css, javascript, Linux, socket programming, 设计模式
目前,项目实践:java web > socket编程 > 自制操作系统
24
最近战略调整,开始向实用的技术:java,web,sql之类的技术倾斜。具体措施就是,每天至少两个小时学习关键技术,剩余时间可以按照兴趣来学,目前来看linux一类的都算是“兴趣”。
今天花了2-3小时学习关键技术,内容:复习前端html,css。服务器部署成功最简单servlet。日向blog部署有关键进展,将之前友好的错误页面改掉,得以返回错误信息。明天继续看。
服务器部署web
25
7:00,向服务器继续发起冲锋。
Negative value (-2) passed to setFirstResult
查看服务器mysql下表,除了小写字母开头的表,还有一份大写字母开头的表。但后者是空的。所以我把后者删掉了。
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
数据库访问异常,再看下面还有一条报错,说找不到db_blog.Article这个表。将表名改了之后。。
这条原因应该也简单,当初文章在windows服务器下的路径,在linux下当然找不到了。
所以把Aticle这个表清掉,又回到了起点:Negative value (-2) passed to setFirstResult。
mdzz
之后我发现,其实是程序代码逻辑问题。没有对article表为空的情况作判断。产生了负数,这是jpa不能接受的。
在公司复习css、javascript、一些linux命令。价值至少1个半小时关键技术学习。
解决了之前那个数据库表问题,接下来是jstl标签问题。
26
早上,解决了jstl标签问题,之前myeclipse下做这个项目时候大概是由于导入了JAVA EE的library的缘故。而通过eclipse打war包时是没有这个library的(myeclipse无法打包)。解决办法就是添加jstl对应的两个jar包。The absolute uri: http:// java.sun.com /jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
上班一直有事,写python代码,类似功能写过很多,没时间学习。
回来后解决接下来的问题,就是把spring的xml里配置的mysql地址,从localhost改为服务器的ip。
现在服务器的web已经可以顺利访问了。只剩一个问题……登录验证码显示失败。这个还没什么头绪。
27
开始思考怎么美化前端,在公司看了些CSS教程,做了简单实验,基本有头绪了。
回家实践,除了合适背景图片还没找对,大致不差。
28
这一次找对了不错的图片,另外灵机一动,加入文章背景半透明效果,再加上文艺的主页标题(《死亡诗社》台词),看起来效果很不错。
加入新页面,重新部署服务器,显示这个错:
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection 问题在于property name="url" value="jdbc:mysql://http://123.207.230.31/db_blog"应该写成:jdbc:mysql://localhost/db_blog其实一开始就是这样写的,囧。。。。。。
29-30
开始困惑于验证码无法显示问题。
30成功定位了验证码无法显示问题:这个awt在linux无法随意使用啊。毕竟是图形的库,有兼容问题。
索性换个验证码方式好了??
感觉又一次遇到麻烦了。