首页 文章 精选 留言 我的

精选列表

搜索[批量导入手机通讯录],共10010篇文章
优秀的个人博客,低调大师

利用Sqoop将MySQL数据导入Hive中

参考 http://www.cnblogs.com/iPeng0564/p/3215055.html http://www.tuicool.com/articles/j2yayyj http://blog.csdn.net/jxlhc09/article/details/16856873 1.list databases sqoop list-databases --connect jdbc:mysql://192.168.2.1:3306/ --username sqoop --password sqoop 2.用sqoop创建hive表 sqoop create-hive-table --connect jdbc:mysql://xx:3306/test?characterEncoding=UTF-8 --table employee --username root -password 'xx' --hive-database db_hive_edu 3.import数据 #sqoop import --connect jdbc:mysql://xx:3306/test?characterEncoding=UTF-8 --table employee --username root -password 'xx' --fields-terminated-by ',' --hive-import --hive-database db_hive_edu -m 1 --fields-terminated-by ',' 导致数据变成null sqoop import --connect jdbc:mysql://xx:3306/test?characterEncoding=UTF-8 --username root -password 'xx' --table employee --hive-import --hive-database db_hive_edu -m 1 截图 如果需要实时同步,不再手动,参考 利用Flume将MySQL表数据准实时抽取到HDFS - wzy0623的专栏 - 博客频道 - CSDN.NET 这才是最正确的解决方案 本文转自 liqius 51CTO博客,原文链接:http://blog.51cto.com/szgb17/1941914,如需转载请自行联系原作者

优秀的个人博客,低调大师

导入开源的文件云存储平台-Seafile

1 理论基础 1.1 简介 Seafile 是一个开源的文件云存储平台,更注重于隐私保护和对团队文件协作的支持。 Seafile 通过“资料库”来分类管理文件,每个资料库可单独同步,用户可加密资料库, 且密码不会保存在服务器端,所以即使是服务器管理员也无权访问你的文件。 Seafile 允许用户创建“群组”,在群组内同步文件、创建维基、发起讨论等,方便团队内协同工作 1.2 软件许可协议 Seafile 及其桌面、移动客户端遵循 GPLv3。 Seahub(Seafile 服务器的 web 端)遵循 Apache License。 1.3 部署的要求 要求安装以下组件: python 2.7 (从 Seafile 5.1 开始,python 版本最低要求为2.7) python-setuptools python-imaging python-mysqldb python-ldap python-urllib3 python-memcache (或者 python-memcached) 1.4 Seafile的系统架构 如上图所示,Seafile 包含以下系统组件: Seahub - 网站界面,供用户管理自己在服务器上的数据和账户信息。Seafile服务器通过"gunicorn"(一个轻量级的Python HTTP服务器)来提供网站支持。Seahub作为gunicorn的一个应用程序来运行。 Seafile server (seaf-server) - 数据服务进程, 处理原始文件的上传/下载/同步。 Ccnet server (ccnet-server) - 内部 RPC 服务进程,连接多个组件。 Controller - 监控 ccnet 和 seafile 进程,必要时会重启进程。 注: 所有 Seafile 服务都可以配置在 Nginx/Apache 后面,由 Nginx/Apache 提供标准的 http(s) 访问。 当用户通过 seahub 访问数据时,seahub 通过 ccnet 提供的内部 RPC 来从 seafile server 获取数据。 2 实践部分 2.1 环境信息 2.1.1 主机信息 hostname=seafile.cmdschool.org ip address=10.168.0.53 os type=CentOS Linux release 7.2 2.1.2 域名解析 配置dns解析或配置host解析,host解析配置如下(客户端和服务端): 1 vim /etc/hosts 加入如下内容: 1 10.168.0.53seafile.cmdschool.org 2.1.3 关闭selinux 1 2 setenforce0 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config 2.2 yum源和安装包 2.2.1 更新系统 1 yumupdate 2.2.2 数据库的安装 1 yum install -ymariadb-servermariadb-develmariadb 2.2.3 安装脚本运行环境 1 yum install -ypython-setuptoolspython-imagingpython-ldapMySQL-pythonpython-memcachedpython-urllib3 2.2.4 安装nginx 1 2 yum install -yhttp: //nginx .org /packages/centos/7/noarch/RPMS/nginx-release-centos-7-0 .el7.ngx.noarch.rpm yum install -ynginx 2.2.5 其他配置工具 1 yum install -ynet-toolsvimwgettree 2.4.6 下载安装包 1 2 cd ~ wgethttps: //bintray .com /artifact/download/seafile-org/seafile/seafile-server_5 .1.3_x86-64. tar .gz 2.3 配置数据库 2.3.1 启动数据库并配置数据库开机默认启动 1 2 systemctlstartmariadb systemctl enable mariadb 2.3.2 初始化数据库 1 mysql_secure_installation 向导如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 [...] Setrootpassword?[Y /n ]y Newpassword: Re-enternewpassword: Passwordupdatedsuccessfully! Reloadingprivilegetables.. ...Success! [...] Removeanonymous users ?[Y /n ]y ...Success! [...] Disallowrootloginremotely?[Y /n ]n ...skipping. [...] Remove test databaseandaccesstoit?[Y /n ]y -Dropping test database... ...Success! -Removingprivilegeson test database... ...Success! [...] Reloadprivilegetablesnow?[Y /n ]y ...Success! [...] 2.4 安装主程序 2.4.1建立目录结构 1 2 mkdir /home/cmdschool .org cp seafile-server_5.1.3_x86-64. tar .gz /home/cmdschool .org 2.4.2 解压并备份安装包 1 2 3 4 cd /home/cmdschool .org tar -xfseafile-server_5.1.3_x86-64. tar .gz mkdir installed mv seafile-server_5.1.3_x86-64. tar .gzinstalled/ 检查目录 1 2 cd /home/cmdschool .org tree-L2 显示如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 . ├──installed │└──seafile-server_5.1.3_x86-64. tar .gz └──seafile-server-5.1.3 ├──check_init_admin.py ├──reset-admin.sh ├──runtime ├──seaf- fsck .sh ├──seaf-fuse.sh ├──seaf-gc.sh ├──seafile ├──seafile.sh ├──seahub ├──seahub.sh ├──setup-seafile-mysql.py ├──setup-seafile-mysql.sh ├──setup-seafile.sh └──upgrade 6directories,11files 2.4.3 运行安装向导 1 2 cd seafile-server-5.1.3 . /setup-seafile-mysql .sh 显示如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 Checkingpythononthismachine... Checkingpythonmodule:setuptools...Done. Checkingpythonmodule:python-imaging...Done. Checkingpythonmodule:python-mysqldb...Done. ----------------------------------------------------------------- ThisscriptwillguideyoutosetupyourseafileserverusingMySQL. Makesureyouhave read seafileservermanualat https: //github .com /haiwen/seafile/wiki PressENTERto continue ----------------------------------------------------------------- Whatisthenameoftheserver?Itwillbedisplayedontheclient. 3-15lettersordigits [servername]seafile Whatistheipordomainoftheserver? Forexample:www.mycompany.com,192.168.1.101 [Thisserver'sipordomain]seafile.cmdschool.org Where do youwanttoputyourseafiledata? Pleaseuseavolumewithenough free space [default "/home/cmdschool.org/seafile-data" ] Whichport do youwanttouse for theseafilefileserver? [default "8082" ] ------------------------------------------------------- Pleasechooseawaytoinitializeseafiledatabases: ------------------------------------------------------- [1]Createnewccnet /seafile/seahub databases [2]Useexistingccnet /seafile/seahub databases [1or2]1 Whatisthehostofmysqlserver? [default "localhost" ] Whatistheportofmysqlserver? [default "3306" ] Whatisthepasswordofthemysqlrootuser? [rootpassword] verifyingpasswordofuserroot... done Enterthename for mysqluserofseafile.Itwouldbecreated if notexists. [default "root" ]seafile Enterthepassword for mysqluser "seafile" : [password for seafile] verifyingpasswordofuserseafile... done Enterthedatabasename for ccnet-server: [default "ccnet-db" ] Enterthedatabasename for seafile-server: [default "seafile-db" ] Enterthedatabasename for seahub: [default "seahub-db" ] --------------------------------- Thisisyourconfiguration --------------------------------- servername:seafile serverip /domain :seafile.cmdschool.org seafiledata dir : /home/cmdschool .org /seafile-data fileserverport:8082 database:createnew ccnetdatabase:ccnet-db seafiledatabase:seafile-db seahubdatabase:seahub-db databaseuser:seafile --------------------------------- PressENTERto continue ,orCtrl-Ctoabort --------------------------------- Generatingccnetconfiguration... done Successlycreateconfiguration dir /home/cmdschool .org /ccnet . Generatingseafileconfiguration... Done. done Generatingseahubconfiguration... ---------------------------------------- Nowcreatingseahubdatabasetables... ---------------------------------------- creatingseafile-server-latestsymboliclink... done ----------------------------------------------------------------- Yourseafileserverconfigurationhasbeenfinishedsuccessfully. ----------------------------------------------------------------- runseafileserver:. /seafile .sh{start|stop|restart} runseahubserver:. /seahub .sh{start<port>|stop|restart<port>} ----------------------------------------------------------------- Ifyouarebehindafirewall,remembertoallowinput /output ofthesetcpports: ----------------------------------------------------------------- portofseafilefileserver:8082 portofseahub:8000 Whenproblemsoccur,Referto https: //github .com /haiwen/seafile/wiki for information. 2.4.4 确认安装 1 2 cd /home/cmdschool .org tree-L2 显示如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 . ├──ccnet │├──mykey.peer │└──seafile.ini ├──conf │├──ccnet.conf │├──seafdav.conf │├──seafile.conf │└──seahub_settings.py ├──installed │└──seafile-server_5.1.3_x86-64. tar .gz ├──seafile-data │└──library-template ├──seafile-server-5.1.3 │├──check_init_admin.py │├──reset-admin.sh │├──runtime │├──seaf- fsck .sh │├──seaf-fuse.sh │├──seaf-gc.sh │├──seafile │├──seafile.sh │├──seahub │├──seahub.sh │├──setup-seafile-mysql.py │├──setup-seafile-mysql.sh │├──setup-seafile.sh │└──upgrade ├──seafile-server-latest->seafile-server-5.1.3 └──seahub-data └──avatars 13directories,17files 2.4.5 启动Seafile 1 /home/cmdschool .org /seafile-server-5 .1.3 /seafile .shstart 显示如下: 1 2 3 4 5 [06 /19/16 13:23:55].. /common/session .c(132):usingconfig file /home/cmdschool .org /conf/ccnet .conf Startingseafileserver,pleasewait... Seafileserverstarted Done. 2.4.6 启动Seahub 1 /home/cmdschool .org /seafile-server-5 .1.3 /seahub .shstart 向导如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 LC_ALLisnot set in ENV, set toen_US.UTF-8 Startingseahubatport8000... ---------------------------------------- It 'sthefirsttimeyoustarttheseafileserver.Nowlet' screatetheadminaccount ---------------------------------------- Whatistheemail for theadminaccount? [adminemail]will@cmdschool.org Whatisthepassword for theadminaccount? [adminpassword] Enterthepasswordagain: [adminpasswordagain] ---------------------------------------- Successfullycreatedseafileadmin ---------------------------------------- Seahubisstarted Done. 2.4.7 配置防护墙 1 2 3 4 firewall-cmd--permanent--add-port=8000 /tcp firewall-cmd--permanent--add-port=8082 /tcp firewall-cmd--reload firewall-cmd--list-all 2.4.8 浏览器测试 1 http: //seafile .cmdschool.org:8000 2.5 配置nginx的http代理 注:以下配置基于2.4章节 2.5.1 配置虚拟服务 1 vim /etc/nginx/conf .d /seafile .com 输入如下内容: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 erver{ listen80; server_nameseafile.cmdschool.org; proxy_set_headerX-Forwarded-For$remote_addr; location/{ fastcgi_pass127.0.0.1:8000; fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name; fastcgi_paramPATH_INFO$fastcgi_script_name; fastcgi_paramSERVER_PROTOCOL$server_protocol; fastcgi_paramQUERY_STRING$query_string; fastcgi_paramREQUEST_METHOD$request_method; fastcgi_paramCONTENT_TYPE$content_type; fastcgi_paramCONTENT_LENGTH$content_length; fastcgi_paramSERVER_ADDR$server_addr; fastcgi_paramSERVER_PORT$server_port; fastcgi_paramSERVER_NAME$server_name; fastcgi_paramREMOTE_ADDR$remote_addr; access_log /var/log/nginx/seahub .access.log; error_log /var/log/nginx/seahub .error.log; } location /seafhttp { rewrite^ /seafhttp (.*)$$1 break ; proxy_passhttp: //127 .0.0.1:8082; client_max_body_size0; proxy_connect_timeout36000s; proxy_read_timeout36000s; } location /media { root /home/cmdschool .org /seafile-server-latest/seahub ; } } 2.5.2 修改SERVICE_URL和FILE_SERVER_ROOT 界面中单击“系统管理”->“设置”修改如下参数为: 1 2 SERVICE_URL:http: //seafile .cmdschool.org FILE_SERVER_ROOT:http: //seafile .cmdschool.org /seafhttp 2.5.3 配置启动脚本 1 vim /home/cmdschool .org /seafile-server-5 .1.3 /seafiled .sh 修改启动参数如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 #!/bin/sh #请将user改为你的Linux用户名 user=seafile #请将script_dir改为你的Seafile文件安装路径 seafile_dir= /home/cmdschool .org script_path=${seafile_dir} /seafile-server-latest seafile_init_log=${seafile_dir} /logs/seafile .init.log seahub_init_log=${seafile_dir} /logs/seahub .init.log #若使用Nginx/Apache,请将其设置为true,否者为false fastcgi= true #fastcgi端口,默认为8000. fastcgi_port=8000 case "$1" in start) sudo -u${user}${script_path} /seafile .shstart>>${seafile_init_log} if [$fastcgi= true ]; then sudo -u${user}${script_path} /seahub .shstart-fastcgi${fastcgi_port}>>${seahub_init_log} else sudo -u${user}${script_path} /seahub .shstart>>${seahub_init_log} fi ;; restart) sudo -u${user}${script_path} /seafile .shrestart>>${seafile_init_log} if [$fastcgi= true ]; then sudo -u${user}${script_path} /seahub .shrestart-fastcgi${fastcgi_port}>>${seahub_init_log} else sudo -u${user}${script_path} /seahub .shrestart>>${seahub_init_log} fi ;; stop) sudo -u${user}${script_path} /seafile .sh$1>>${seafile_init_log} sudo -u${user}${script_path} /seahub .sh$1>>${seahub_init_log} ;; *) echo "Usage:/etc/init.d/seafile-server{start|stop|restart}" exit 1 ;; esac 2.5.4 添加执行用户和配置目录权限 1 2 3 useradd seafile-s /sbin/nologin -d /home/cmdschool .org/ chown -Rseafile:seafile /home/cmdschool .org/ chown -Rseafile:seafile /tmp/seahub_cache/ 2.5.5 配置启动服务 1 vim /lib/systemd/system/seafile .service 输入如下内容: 1 2 3 4 5 6 7 8 9 10 11 12 13 [Unit] Description=seafile After=mariadb.service [Service] Type=forking ExecStart= /home/cmdschool .org /seafile-server-5 .1.3 /seafiled .shstart ExecReload= /home/cmdschool .org /seafile-server-5 .1.3 /seafiled .shrestart ExecStop= /home/cmdschool .org /seafile-server-5 .1.3 /seafiled .shstop PrivateTmp= true [Install] WantedBy=multi-user.target 2.5.6 修改sudo 1 visudo 注释掉如下行: 1 Defaultsrequiretty 注:不修改可能使用systemctl命令启动服务时会出错 2.5.7 停止管理员身份运行的主程序 1 2 /home/cmdschool .org /seafile-server-5 .1.3 /seafile .shstop /home/cmdschool .org /seafile-server-5 .1.3 /seahub .shstop 2.5.8 测试服务并配置开机启动 1 2 3 4 5 systemctlstartseafile.service systemctlrestartseafile.service systemctlstopseafile.service systemctlstartseafile.service systemctl enable seafile.service 2.5.9 启动服务并配置开机启动 1 2 systemctlrestartnginx systemctl enable nginx 2.5.10 配置防火墙 1 2 3 4 5 firewall-cmd--permanent--remove-port=8000 /tcp firewall-cmd--permanent--remove-port=8082 /tcp firewall-cmd--permanent--add-servicehttp firewall-cmd--reload firewall-cmd--list-all 2.5.11 浏览器测试 1 http: //seafile .cmdschool.org 2.6 配置nginx的https代理 注:以下配置基于2.5章节 2.6.1 生成私钥 1 opensslgenrsa-outprivkey.pem2048 生成如下私钥: 1 privkey.pem 2.6.2 生成公钥 1 opensslreq-new-x509-keyprivkey.pem-outcacert.pem-days1095 向导如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Youareabouttobeaskedtoenterinformationthatwillbeincorporated intoyourcertificaterequest. WhatyouareabouttoenteriswhatiscalledaDistinguishedNameoraDN. Therearequiteafewfieldsbutyoucanleavesomeblank Forsomefieldstherewillbeadefaultvalue, Ifyouenter '.' ,thefieldwillbeleftblank. ----- CountryName(2lettercode)[XX]:CN StateorProvinceName(fullname)[]:GD LocalityName(eg,city)[DefaultCity]:DG OrganizationName(eg,company)[DefaultCompanyLtd]:cmdschool.org OrganizationalUnitName(eg,section)[]:it CommonName(eg,yournameoryourserver's hostname )[]:seafile.cmdschool.org EmailAddress[]:will@cmdschool.org 2.6.3 复制公钥和私钥到指定路径 1 cp cacert.pemprivkey.pem /etc/ssl/ 2.6.4 修改配置文件 1 vim /etc/nginx/conf .d /seafile .conf 修改配置文件如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 server{ listen80; server_nameseafile.cmdschool.org; rewrite^https: // $http_host$request_uri?permanent; #强制将http重定向到https } server{ listen443; sslon; ssl_certificate /etc/ssl/cacert .pem; #cacert.pem文件路径 ssl_certificate_key /etc/ssl/privkey .pem; #privkey.pem文件路径 server_nameseafile.cmdschool.org; proxy_set_headerX-Forwarded-For$remote_addr; location/{ fastcgi_pass127.0.0.1:8000; fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name; fastcgi_paramPATH_INFO$fastcgi_script_name; fastcgi_paramSERVER_PROTOCOL$server_protocol; fastcgi_paramQUERY_STRING$query_string; fastcgi_paramREQUEST_METHOD$request_method; fastcgi_paramCONTENT_TYPE$content_type; fastcgi_paramCONTENT_LENGTH$content_length; fastcgi_paramSERVER_ADDR$server_addr; fastcgi_paramSERVER_PORT$server_port; fastcgi_paramSERVER_NAME$server_name; fastcgi_paramHTTPSon; fastcgi_paramHTTP_SCHEMEhttps; access_log /var/log/nginx/seahub .access.log; error_log /var/log/nginx/seahub .error.log; } location /seafhttp { rewrite^ /seafhttp (.*)$$1 break ; proxy_passhttp: //127 .0.0.1:8082; client_max_body_size0; proxy_connect_timeout36000s; proxy_read_timeout36000s; } location /media { root /home/cmdschool .org /seafile-server-latest/seahub ; } } 2.6.5 修改SERVICE_URL和FILE_SERVER_ROOT 界面中单击“系统管理”->“设置”修改如下参数为: 1 2 SERVICE_URL:https: //seafile .cmdschool.org FILE_SERVER_ROOT:https: //seafile .cmdschool.org /seafhttp 2.6.7 重新启动服务 1 systemctlrestartseafile.service 2.6.8 配置防火墙 1 2 3 4 firewall-cmd--permanent--remove-servicehttp firewall-cmd--permanent--add-servicehttps firewall-cmd--reload firewall-cmd--list-all 2.6.9 浏览器测试 https://seafile.cmdschool.org 注:登录帐号和密码(详见2.4.6章节的配置向导生成) 本文转自 tanzhenchao 51CTO博客,原文链接:http://blog.51cto.com/cmdschool/1790806,如需转载请自行联系原作者

优秀的个人博客,低调大师

牛逼的OSQL----大数据导入

汇总篇:http://www.cnblogs.com/dunitian/p/4822808.html#tsql 上一篇:01.SQLServer性能优化之----强大的文件组----分盘存储http://www.cnblogs.com/dunitian/p/5276431.html 在执行SQL脚本的时候要是出现了这些情况我咋办呢? 步入正轨 应用场景:服务器升级,比如原来是2003的系统,现在换成2008或者2012,那么数据库升级了不止一个档次,咋办?分离附加,备份还原都有点悬了,那么就导出脚本呗(一般都是导出两份,一份是架构,一份是数据) 【应用场景二:类似于阿里云这些别人的服务器(说句傻叉的话,用户数据都不在你的手上你这公司基本上也就差不多了)】 演示一下数据导出的场景: 那么问题来了~~发生了这些错误肿么办?我们的sql脚本好几个G了,正常途径都没用啊??? 这里呢得引入一下OSQL,先看看帮助文档:osql -? 执行命令: osql -E -i C:\Users\DNT\Desktop\BigValues.sql-E 表示使用 Windows 身份验证 -i 表示执行输入文件里面的sql脚本 然后就这样慢慢的执行了,你直接挂服务器就好了,然后你就可以继续coding了(*^__^*) 02.SQLServer性能优化之---存储优化系列http://www.cnblogs.com/dunitian/p/6041745.html 本文转自毒逆天博客园博客,原文链接:http://www.cnblogs.com/dunitian/p/5276449.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

Android Studio 导入的项目编码错误问题

错误提示: Error:(4, 35) 閿欒: 缂栫爜UTF-8鐨勪笉鍙槧灏勫瓧绗? 解决方法: 1). 2). 的下面添加下面的一行语句: android{compileOptions.encoding="GBK"} 没有整理与归纳的知识,一文不值!高度概括与梳理的知识,才是自己真正的知识与技能。 永远不要让自己的自由、好奇、充满创造力的想法被现实的框架所束缚,让创造力自由成长吧! 多花时间,关心他(她)人,正如别人所关心你的。理想的腾飞与实现,没有别人的支持与帮助,是万万不能的。 本文转自wenglabs博客园博客,原文链接:http://www.cnblogs.com/arxive/p/7349915.html ,如需转载请自行联系原作者

优秀的个人博客,低调大师

VS源码文件导入Android工程 中文乱码

场景说明 目前Android版本的项目采用了jni的方式,实现大量的功能。一般情况下,在VS中开发完成功能,然后拷贝源码文件到Android工程中,添加源码文件,重新编译。编译出来的Android程序在运行中,会出现中文乱码。 解决过程: 1)查看到添加的源码文件是UTF-8编码 右击单个工程文件,选择Properties->Resource->Text file encoding->GBK/UTF-8 2)查看到已有的工程中的源码文件是GBK编码 3)强制将源码文件设置为GBK编码,所有的中文全部是乱码, 即使手动重新将中文乱码修改过来,编译运行程序还是乱码 解决方案: 先将Android目录中的源码文件设置为GBK编码,然后用VS打开已有的源码文件Ctrl+A,Ctrl+C进行全部拷贝,粘贴到Android的工程文件中。拷贝代码的过程中不会拷贝文件的编码格式,从而解决了问题 另外一种解决方案: 在VS中,打开需要转码的源码文件,点击文件,打开高级保存选项, 显示当前编码是UTF-8,在编码的下拉框中,选择简体中文(GB2312),点击确定, 这个时候拷贝的源码文件,添加到Android工程就不会出现中文乱码的情况 英文VS版本:file/advanced save options/unicode utf8 本文转自fengyuzaitu 51CTO博客,原文链接http://blog.51cto.com/fengyuzaitu/1675211:,如需转载请自行联系原作者

优秀的个人博客,低调大师

手机端问题

8、如何去除Android平台中对邮箱地址的识别 缓存控制 <metahttp-equiv="Cache-Control"content="no-cache"/> <metahttp-equiv="Cache-Control"content="max-age=300"/> 下面这行: <metahttp-equiv="Cache-Control"content="max-age=0"/> 与下面一行有相同的效果: <metahttp-equiv="Cache-Control"content="no-cache"/> 某些WAP浏览器不支持用<meta/>标签来控制缓存,但它们确实知道HTTP头"Cache-Control:no-cache"的意思.这种情况下,解决方案是在服务器端的HTTP响应中设置HTTP头. HTTP刷新 <metahttp-equiv="Cache-Control"content="no-cache"/> <metahttp-equiv="refresh"content="15"/> 注意的是这个XHTMLMP例子中需要<metahttp-equiv="Cache-Control" content="no-cache"/>.如果上述代码没被包含,WAP浏览器将仅仅显示缓存中的文档的复本, 而不需要每次刷新都连接服务器. <metahttp-equiv="refresh"content="15;URL=hello_world_example1.xhtml"/> 某些WAP浏览器是不支持HTTP刷新的.例如,HTTP刷新在Openwave移动浏览器6.2.2版上运行良好, 但在Nokia移动浏览器4.0版,SonyEricssonT610和T68i移动电话模拟器上是不起作用的. 注释 <metaname="author"content="mark"/> clearType字体 <METAHTTP-EQIV="cleartype"CONTENT="ON|OFF"> 定义页面尺寸 IE的使用:<METANAME="MobileOptimized"CONTENT="240"> google搜索中知道这个可以解决flash不能全屏的问题,自己没遇到过。 其他使用:<metaid="viewport"name="viewport"content="width=320;initial-scale=1.0;maximum-scale=1.0;user-scalable=0;"/> 看过iOSwebappAPI的同学都知道iOS提供了一个meta标签:用于禁用iOS对页面中电话号码的自动识 别。在iOS中是不自动识别邮件地址的,但在Android平台,它会自动检测邮件地址,当用户tou ch到这个邮件地址时,Android会弹出一个框提示用户发送邮件,如果你不想Android自动识别页面中 的邮件地址,你不妨加上这样一句meta标签在head中<metacontent="email=no"name="format-detec tion"/> 9、如何去除iOS和Android中的输入URL的控件条 你的老板或者PD或者交互设计师可能会要求你:能否让我们的webapp更加像nativeapp,我不想让用户 看见那个输入url的控件条? 答案是可以做到的。我们可以利用一句简单的javascript代码来实现这个效果 setTimeout(scrollTo,0,0,0); 请注意,这句代码必须放在window.onload里才能够正常的工作,而且你的当前文档的内容高度必 须是高于窗口的高度时,这句代码才能有效的执行。 10、如何禁止用户旋转设备 我曾经也想禁止用户旋转设备,也想实现像某些客户端那样:只能在肖像模式或景观模式下才能正 常运行。但现在我可以很负责任的告诉你:别想了!在移动版的webkit中做不到! 至少ApplewebappAPI已经说到了:我们为了让用户在safari中正常的浏览网页,我们必须保证 用户的设备处于任何一个方位时,safari都能够正常的显示网页内容(也就是自适应),所以我们 禁止开发者阻止浏览器的orientationchange事件,看来苹果公司的出发点是正确的,苹果确实不是一 般的苹果。iOS已经禁止开发者阻止orientationchange事件,那Android呢?对不起,我没有找到任何 资料说Android禁止开发者阻止浏览器orientationchange事件,但是在Android平台,确实也是阻止 不了的。 11、如何检测用户是通过主屏启动你的webapp 看过ApplewebappAPI的同学都知道iOS为safari提供了一个将当前页面添加主屏的功能,按下iphone ipodipodtouch底部工具中的小加号,或者ipad顶部左侧的小加号,就可以将当前的页面添加到设备 的主屏,在设备的主屏会自动增加一个当前页面的启动图标,点击该启动图标就可以快速、便捷的启动 你的webapp。从主屏启动的webapp和浏览器访问你的webapp最大的区别是它清除了浏览器上方和下方 的工具条,这样你的webapp就更加像是nativeapp了,还有一个区别是window对像中的navigator子对 象的一个standalone属性。iOS中浏览器直接访问站点时,navigator.standalone为false,从主屏启动 webapp时,navigator.standalone为true,我们可以通过navigator.standalone这个属性获知用户当前 是否是从主屏访问我们的webapp的。在Android中从来没有添加到主屏这回事! 12、如何关闭iOS中键盘自动大写 我们知道在iOS中,当虚拟键盘弹出时,默认情况下键盘是开启首字母大写的功能的,根据某些 业务场景,可能我们需要关闭这个功能,移动版本webkit为input元素提供了autocapitalize, 通过指定autocapitalize="off"来关闭键盘默认首字母大写。 13、iOS中如何彻底禁止用户在新窗口打开页面 有时我们可能需要禁止用户在新窗口打开页面,我们可以使用a标签的target="_self"来指定用户在新窗 口打开,或者target属性保持空,但是你会发现iOS的用户在这个链接的上方长按3秒钟后,iOS会弹出 一个列表按钮,用户通过这些按钮仍然可以在新窗口打开页面,这样的话,开发者指定的target属性就 失效了,但是可以通过指定当前元素的-webkit-touch-callout样式属性为none来禁止iOS弹出这些按钮 。这个技巧仅适用iOS对于Android平台则无效。 14、iOS中如何禁止用户保存图片\复制图片 我们在第13条技巧中提到元素的-webkit-touch-callout属性,同样为一个img标签指定-webkit-t ouch-callout:none,这样用户就无法保存\复制你的图片了。 15、iOS中如何禁止用户选中文字 我们通过指定文字标签的-webkit-user-select:none便可以禁止iOS用户选中文字。 16、iOS中如何获取滚动条的值 桌面浏览器中想要获取滚动条的值是通过document.scrollTop和document.scrollLeft得到的,但在iO S中你会发现这两个属性是未定义的,为什么呢?因为在iOS中没有滚动条的概念,在Android中通过 这两个属性可以正常获取到滚动条的值,那么在iOS中我们该如何获取滚动条的值呢? 通过window.scrollY和window.scrollX我们可以得到当前窗口的y轴和x轴滚动条的值。 17、如何解决盒子边框溢出 当你指定了一个块级元素时,并且为其定义了边框,设置了其宽度为100%。在移动设备开发过程中我 们通常会对文本框定义为宽度100%,将其定义为块级元素以实现全屏自适应的样式,但此时你会发现, 该元素的边框(左右)各1个像素会溢了文档,导致出现横向滚动条,为解决这一问题,我们可以为其添加 一个特殊的样式-webkit-box-sizing:border-box;用来指定该盒子的大小包括边框的宽度。 18、如何解决Android2.0以下平台中圆角的问题 如果大家够细心的话,在做wap站点开发时,大家应该会发现android2.0以下的平台中问题特别的多, 比如说边框圆角这个问题吧。在对一个元素定义圆角时,为完全兼容android2.0以下的平台,我们必 须要按照以下技巧来定义边框圆角:-webkit这个前缀必须要加上(在iOS中,你可以不加,但android中 一定要加);如果对针对边框做样式定义,比如border:1pxsolid#000;那么-webkit-border-radius这 属性必须要出现在border属性后。假如我们有这样的视觉元素,左上角和右上角是圆角时,我 们必须要先定义全局的(4个角的圆角值)-webkit-border-radius:5px;然后再依次的覆盖左下角和右下角 ,-webkit-border-bottom-left-radius:0;-webkit-border-bottom-right-border:0;否 则在android2.0以下的平台中将全部显示直角,还有记住!-webkit这个前缀一定要加上! 19、如何解决android平台中页面无法自适应 虽然你的html和css都是完全自适应的,但有一天如果你发现你的页面在android中显示的并不是自适 应的时候,首先请你确认你的head标签中是否包含以下meta标签:<metaname="viewport"content=" width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0;"/>如果有的话,那请 你再仔细的看清楚有没有这个属性的值width=device-width,如果没有请立即加上吧! 20、如何解决iOS4.3版本中safari对页面中5位数字的自动识别和自动添加样式 新的iOS系统也就是4.3版本,升级后对safari造成了一个bug:即使你添加了如下的meta标签,sa fari仍然会对页面中的5位连续的数字进行自动识别,并且将其重新渲染样式,也就是说 你的css对该标签是无效的。<metaname="format-detection"content="telphone=no"/>我们可以用 一个比较龌龊的办法来解决。比如说支付宝wap站点中显示金额的标签,我们都做了如下改写: <buttonclass="t-balance"style="background:none;padding:0;border:0;">95009.00</button> 本文转自Ansue 51CTO博客,原文链接:http://blog.51cto.com/ansue/1653511,如需转载请自行联系原作者

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册