localhost

CORS跨域请求

旧时模样 提交于 2019-12-04 13:11:08
CORS跨域请求 允许跨域请求 只需要在服务器设置响应头 Access-Control-Allow-Origin , 不然的话可以从服务器拿到响应,但是浏览器不会把这个响应显示出来。 (index):1 Access to XMLHttpRequest at 'http://localhost:9001/demo/name' from origin 'http://localhost:9002' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 方案: response.setHeader("Access-Control-Allow-Origin", "http://localhost:9002"); 请求响应中会携带:Access-Control-Allow-Origin: http://localhost:9002 访问成功,可以获取数据。 Access-Control-Allow-Origin: http://localhost:9002 Content-Length: 6 Content-Type: text/html;charset=UTF-8 Date: Fri, 01 Nov 2019 01:24

Not able to receive UDP/IPv6 packets on secondary interface

放肆的年华 提交于 2019-12-04 12:55:00
I have the following C code for UDP server which would bind to the ipv6 address of the secondary interface tap0. context_t * new_context(const struct sockaddr *listen_addr, size_t addr_size) { context_t *c = malloc( sizeof( context_t ) ); time_t now; int reuse = 1; if (!listen_addr) { fprintf(stderr, "no listen address specified\n"); return NULL; } srand( getpid() ^ time(&now) ); if ( !c ) { perror("init: malloc:"); return NULL; } memset(c, 0, sizeof( context_t ) ); c->sockfd = socket(listen_addr->sa_family, SOCK_DGRAM, 0); if ( c->sockfd < 0 ) { perror("new_context: socket"); goto onerror; }

php上传图片到mysql并显示

╄→尐↘猪︶ㄣ 提交于 2019-12-04 11:08:22
mysql可以直接保存二进制的数据,数据类型是blob。 通常在数据库中所使用的文本或整数类型的字段和需要用来保存图片的字段的不同之 处就在于两者所需要保存的数据量不同。MySQL数据库使用专门的字段来保存大容量的数据,数据 类型为BLOB。 MySQL数据库为BLOB做出的定义如下:BLOB数据类型是一种大型的二进制对象,可以保存可 变数量的数据。BLOB具有四种类型,分别是TINYBLOB,BLOB, MEDIUMBLOB 和LONGBLOB,区别在于各自所能够保存的最大数据长度不同 。 建立数据库 CREATE TABLE ccs_image ( id int(4) unsigned NOT NULL auto_increment, description varchar(250) default NULL, bin_data longblob, filename varchar(50) default NULL, filesize varchar(50) default NULL, filetype varchar(50) default NULL, PRIMARY KEY (id) ) 接着是上传文件的页面,upload.php,code如下: <HTML> <HEAD><TITLE>Store binary data into SQL Database</TITLE><

大数据-linux的常用命令

女生的网名这么多〃 提交于 2019-12-04 11:04:10
linux的常用命令 1.1 日常操作命令 查看当前所在的工作目录 pwd 查看当前系统的时间 date 查看有谁在线(哪些人登陆到了服务器) who 查看当前在线 last 查看最近的登陆历史记录 1.2 文件系统操作 查看文件 ls / 查看根目录下的子节点(文件夹和文件)信息 ls -al -a是显示隐藏文件 -l是以更详细的列表形式显示 ll 列表形式显示 ll –a 显示隐藏文件 切换目录 cd /home 创建文件夹 mkdir aaa 这是相对路径的写法 mkdir -p aaa/bbb/ccc 批量创建文件路径 mkdir /data 这是绝对路径的写法 删除文件夹 rmdir 可以删除空目录 rm -r aaa 可以把aaa整个文件夹及其中的所有子节点全部删除 rm -rf aaa 强制删除aaa 修改文件夹名称 mv aaa aa1 创建文件 touch fbb.txt 创建一个空文件 echo "hello fbb" > fbb.txt 利用重定向“>”的功能,将一条指令的输出结果写入到一个文件中,会覆盖原文件内容 echo "hello , liu yi fei " >> lyf.txt 将一条指令的输出结果追加到一个文件中,不会覆盖原文件内容 1.3 文件权限的操作 linux文件权限的描述格式解读 drwxr-xr-x (也可以用二进制表示 111

Apache ServiceComb Pack 微服务分布式数据最终一致性解决方案

有些话、适合烂在心里 提交于 2019-12-04 11:03:48
https://github.com/OpenSagas-csharp/servicecomb-pack-csharp Saga基本使用指南 使用前置条件说明 如果还有同学对Saga还不甚了解的同学,可以参考Saga官方中文地址 地址 ,同时可以参考此项目贡献者之一的 WithLin 的一篇中文说明文章,该地址如下: 地址 ,文章由浅入深的讲述了分布式事务在微服务场景下的重要性,以及Saga对分布式事务的大致实现方式和后续的思考 必须 你需要可用的一个本地或者远程的数据库(mysql或者postpresql)作为Saga持久化分布式事务事件的持久化存储,当然只要官方支持的Database Provider即可,具体idea数据库配置如下图,注意数据库的名字与您真实数据库名一致 必须 成功启动alpha-server,导致环境搭建以及部署颇为麻烦,后期官方将会提供image上传docker hub提供给大家使用,启动成功参考下图 可选 同时saga提供了UI可视化界面,直接idea中启动saga-web即可 支持docker-compose:根目录提供了一个dockercompose文件,只需要在工程的根目录下执行docker-compose up -d 即可,上面的操作可以给感兴趣的调试环境的搭建。 开始玩转分布式事务Saga 克隆当前项目

MAMP - Mac OS X

寵の児 提交于 2019-12-04 10:37:10
I have been using MAMP for sometime now on port 8888 so I visit website in the browser like so: http://localhost:8888/website However I have just installed a Wordpress Multisite and therefore want to switch to port 80 to allow me to visit the websites as normal and have sub directories e.g. http://website.co.uk , http://subdomain.website.co.uk I have setup the vhosts file within MAMP and changed the port to 80 in the MAMP preferences but ever since doing this MAMP will not start Apache. MySQL starts up fine but Apache fails to start. I have tried to start apache manually by running the

Java开发中解决Js的跨域问题

余生颓废 提交于 2019-12-04 09:35:37
主流方法有JSONP和CORS两种,这里记一下后者的方式,理论基础就是在请求的时候在http请求头中添加如下属性: //指定允许其他域名访问 Access-Control-Allow-Origin:http://localhost:8989 如果后端用Java开发,在返回请求中可以添加如下属性 1.在跨域问题中,如果不操作cookie,只需要在后端代码中添加如下代码就可以 response.setHeader("Access-Control-Allow-Origin", "http://localhost:8989"); //第二个参数的意思就是说是哪个地址访问,如果要通配全部,就使用*即可 虽然是加在了response中,但是HTTP是基于TCP(传输层协议)的应用层协议,每次请求的时候都会有“三次握手”的过程,所以添加在response中后,会在第一次请求中告知客户端可以请求。 如果是SpringMVC4.2以上版本的话,一个注解就可以搞定 @CrossOrigin(origins="http://localhost:8080") 这个注解就是对上边的代码的封装,源码如下: @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented public

InetAddress.getLocalHost() resolution on OSX Lion when offline

这一生的挚爱 提交于 2019-12-04 09:29:59
Is anyone having issues with Java's InetAddress.getLocalHost() resolution in Java with OSX Lion when working offline (i.e. not connected to internet)? It would appear that localhost:127.0.0.1 is not resolved at all: Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 at java.net.InetAddress.getLocalHost(InetAddress.java:1356) Nothing special in my /etc/hosts: ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost I suspect

Nod32 causing LocalHost (ASP.NET Development Server) “Connection Interrupted” Problem

假装没事ソ 提交于 2019-12-04 09:28:18
I'm quoting myself on a previous question I asked to further explain: "I'm trying to run a freshly created ASP.NET Website using C#, however when I do so it launches FireFox and attempts to connect to http://localhost:1295/WebSite1/Default.aspx (for example), but after about 10-15 seconds it displays a "Connection Interrupted - The connection to the server was reset while the page was loading." Error. This issue is also present with older ASP.NET C# pages/Web Services I've built in the past, nothing is actually running off the ASP.NET Development server." This is the problem that was occuring,

changing the name of localhost web app express?

你离开我真会死。 提交于 2019-12-04 09:06:07
I'm working on a project, and I NEED to change the name of the project from localhost:9000 to someothername:9000, this is in my development environment, not production. I was given the project files, and the person (who is no longer here) used express.js. I've searched and searched for the answer to this, but I cannot figure it out. So, is it possible to change the name of localhost:9000 to someothername:9000 using express.js or updating the gruntfile? I know that I can change the localhost settings on my computer, but I need for there to be an alias that occurs through the web application. I