40例响应式Web设计
响应式Web设计是在开发和设计网站过程中产生的一种方式,它的目的是让内容布局能随用户使用显示器的不同而变化。再明确点说,这种设计概念,就是让原本1292像素宽,4栏的内容,能够很好地显示在1025像素宽的用户屏幕上,同时还能自动简化成2栏。当然,让它很好的适应智能手机和其他种类电脑的屏幕也就成了水到渠成的事了。这种特殊的设计形式就被成为“响应式Web设计”。 响应式Web设计与传统的设计方式截然不同,开发人员(特别是新手)必须要理解它的优势和弊端。这篇文章正是为大家揭示一些实例的。(这里介绍一个叫“Media Queries”的网站,里面介绍了更多实例和演示) 数据表格是响应式Web设计的经典使用情景,实现它的想法与传统的设计理念有很大不同。数据表格默认很宽,当你要查看它全貌时,你得缩小表格,但这时字会变 的很小,很难去阅读。然而当你想看清楚上面的字时,就不得不再把表格放大,这时要查看完整表格就得横滚加纵滚。这么阅读表格也太KB了。或许重新格式化表格或以饼图形式展现是种解决方案。再不然,你可以弄一个迷你图,即使在窄屏幕里它也能适应。 响应式Web设计中的图像以流式图像为主,可以被上下文感知的图像所替代,这是一种更好的设计方式。这种技术的真正意义在于,能够让图像适应不同的屏幕分辨率,更大的或更小的。所以它与传统设计的理念和技术都有很大不同,合理使用会让你的网页化腐朽为神奇。 Mountain Dew 访问网站 AXT 访问网站 Rbma Radio 访问网站 Lotta Nieminen 访问网站 Berger & Fohr 访问网站 Cropp 访问网站 Stink Digital 访问网站 Hair Project 访问网站 Atlanta Ballet 访问网站 Google Cultural Institute 访问网站 Build Windows 访问网站 Enochs 访问网站 From The Front 访问网站 Sweet Hat Club 访问网站 Oliver Russel 访问网站 United Pixelworkers 访问网站 dConstruct 2012 访问网站 Food Sense 访问网站 Andersson-Wise Architecture 访问网站 TeeGallery 访问网站 Lynn and Tonic 访问网站 8Faces 访问网站 Sleepstreet 访问网站 ConvergeSE 2012 访问网站 Iwantedrock 访问网站 Abberdein 访问网站 Inspire Conference 访问网站 Design Week Portland 访问网站 […]
View DetailsDruapl7权威指南
第一部分 入门 第一章 ■■■ 建立一个drupal7站点 本杰明 梅兰肯 丹 哈基姆扎德 达妮 诺丁著 “好吧,我们能用艰难的方法完成这事,或者我们可以用Drupal的方法完成这事。” 弗莱斯特 玛斯(红茶菌) 本书通过介绍使用Drupal 7创建网站的所有各个方面的内容,将会使你在Drupal的学习中少走弯路:它将会涉及结构和配置,模块开发,前台开发,持续运行项目,以及贡献Drupal的代码,文档,还有社区等等。 在第一章中还有什么比创建一个完整的站点更好的方法开始呢?在27页中,你要每小时从零点走到60英里(或每小时100公里,视情况而定)。在后面的章节中,你要使用Views【视图】的动态页面添加涡轮增压器,主题化赛车的条纹;以及Jquery奖杯的获得者;你还要执行一些商业方面花哨的练习等等。 在整本书中,我们将设法引导你以Drupal的方法做事。从来就没有只有一种方法能达到目地,但是有些方法忽视乃至反对Drupal的产品。相比之 下,Drupal的方式在Drupal的优点基础上是任何方式无法相比的。(第8章讲述了其中的优点之--一个活跃的在课程中能够持续给你提供帮助的社 区。) 在本章中你要创建的这个站点会允许用户轻松地创建和分类内容。方案不是假设的。本书需要一个网站,而你正在创建它!你将要: […]
View DetailsTengine
Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。Tengine的性能和稳定性已经在大型的网站如淘宝网,天猫商城等得到了很好的检验。它的最终目标是打造一个高效、稳定、安全、易用的Web平台。 从2011年12月开始,Tengine成为一个开源项目。现在,它由Tengine团队开发和维护。Tengine团队的核心成员来自于淘宝、搜狗等互联网企业。 继承Nginx-1.2.3 的所有特性,100%兼容Nginx的配置;动态模块加载(DSO)支持。加入一个模块不再需要重新编译整个Tengine;输入过滤器机制支持。通过使用这种机制Web应用防火墙的编写更为方便;动态脚本语言Lua支持。扩展功能非常高效简单;支持管道(pipe)和syslog(本地和远端)形式的日志以及日志抽样;组合多个CSS、JavaScript文件的访问请求变成一个请求;可以对后端的服务器进行主动健康检查,根据服务器状态自动上线下线;自动根据CPU数目设置进程个数和绑定CPU亲缘性;监控系统的负载和资源占用从而对系统进行保护;显示对运维人员更友好的出错信息,便于定位出错机器;更强大的防攻击(访问速度限制)模块;更方便的命令行参数,如列出编译的模块列表、支持的指令等;可 以根据访问文件类型设置过期时间;
View DetailsMySql Error Code: 2006 – MySQL 服务器已离线
用SQLYog进行数据导入的时候出错:MySql Error Code: 2006 – MySQL 服务器已离线 解决: 1.在mysql的配置文件最后添加:max_allowed_packet = 100M 2.如果还不行,就再添加以下两行: interactive_timeout=28800000 wait_timeout=28800000
View DetailsGlobal中方法的说明
Application_Init:在每一个HttpApplication实例初始化的时候执行。 Application_Disposed:在每一个HttpApplication实例被销毁之前执行。 Application_Error:所有没有处理的错误都会导致这个方法的执行。 Application_Start:在程序初始化的时候执行。在Web应用程序的生命周期里就执行一次(自动的重新启动算另外一次生命周期),这里只能放一些公用的信息,比如HttpApplicationState。 Application_End:应用程序结束时,在最后一个HttpApplication销毁之后执行。对应Application_Start,在整个生命周期里面也是只执行一次。 执行顺序:Application_BeginRequest:BeginRequest是在收到Request时第一个触发的事件,这个方法自然就是第一个执行的了。 Application_AuthenticateRequest:当安全模块已经建立了当前用户的标识后执行。 Application_AuthorizeRequest:当安全模块已经验证了当前用户的授权时执行。 Application_ResolveRequestCache:当ASP.NET完成授权事件以使缓存模块从缓存中为请求提供服务时发生,从而跳过处理程序(页面或者是WebService)的执行。这样做可以改善网站的性能,这个事件还可以用来判断正文是不是从Cache中得到的。 Application_AcquireRequestState:当ASP.NET获取当前请求所关联的当前状态(如Session)时执行(真是拗口啊,msdn上就这样写的,我自己想不出什么好句子了)。 Application_PreRequestHandlerExecute:当ASP.Net即将把请求发送到处理程序对象(页面或者是WebService)之前执行。这个时候,Session就可以用了。 Application_PostRequestHandlerExecute:当处理程序对象(页面或者是WebService)工作完成之后执行。 Application_ReleaseRequestState:在ASP.NET执行完所有请求处理程序后执行。ReleaseRequestState事件将使当前状态数据被保存。 Application_UpdateRequestCache:在ASP.NET执行完处理程序后,为了后续的请求而更新响应缓存时执行。 Application_EndRequest:同上,EndRequest是在响应Request时最后一个触发的事件,这个方法自然就是最后一个执行的了。 另外两个: 这两个事件的顺序是无法确定的,按照MSDN的说法,它们随时都可能发生。 下面就按这个顺序来解释一下它们在Global.asax.cs中相应的事件处理方法的含义。 整理自:http://hi.baidu.com/czh8888/item/7371eea8ddcaaa9e151073df
View Details上班第二天,把gagamacth的功能浏览了一下,汗~
上班第三天,把gagamatch的功能粗略的看一遍,真汗啊,小问题太多了,用户体验就更不用说了。里面都是马甲会员,既然想做国际平台,就不要马甲嘛,要找对模式,而不是每个功能都要钱,这个受不了啊,伤不起。 技术就更不用说了,引用了十几个第三方的类库,那自己的代码在哪?就是用别人的类库和框架构建一切,这对于一个科技为主的公司可不行啊,没有核心技术怎么能行?! 其实中国的好多企业都是泊来品,没有核心技术,也谈不上核心竞争力。怎么发展进步呢? 太急功近利了,赚的永远都是小钱,更不会成功。
View DetailsC#使用ICSharpCode.SharpZipLib.dll压缩文件夹和文件
大家可以到http://www.icsharpcode.net/opensource/sharpziplib/ 下载SharpZiplib的最新版本,本文使用的版本为0.86.0.518,支持Zip, GZip, BZip2 和Tar格式,其实没啥好说的直接上代码
|
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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
/// <summary> /// Zip压缩与解压缩 /// </summary> public class ZipHelper { /// <summary> /// 压缩单个文件 /// </summary> /// <param name="fileToZip">要压缩的文件</param> /// <param name="zipedFile">压缩后的文件</param> /// <param name="compressionLevel">压缩等级</param> /// <param name="blockSize">每次写入大小</param> public static void ZipFile(string fileToZip, string zipedFile, int compressionLevel, int blockSize) { //如果文件没有找到,则报错 if (!System.IO.File.Exists(fileToZip)) { throw new System.IO.FileNotFoundException("指定要压缩的文件: " + fileToZip + " 不存在!"); } using (System.IO.FileStream ZipFile = System.IO.File.Create(zipedFile)) { using (ZipOutputStream ZipStream = new ZipOutputStream(ZipFile)) { using (System.IO.FileStream StreamToZip = new System.IO.FileStream(fileToZip, System.IO.FileMode.Open, System.IO.FileAccess.Read)) { string fileName = fileToZip.Substring(fileToZip.LastIndexOf("\\") + 1); ZipEntry ZipEntry = new ZipEntry(fileName); ZipStream.PutNextEntry(ZipEntry); ZipStream.SetLevel(compressionLevel); byte[] buffer = new byte[blockSize]; int sizeRead = 0; try { do { sizeRead = StreamToZip.Read(buffer, 0, buffer.Length); ZipStream.Write(buffer, 0, sizeRead); } while (sizeRead > 0); } catch (System.Exception ex) { throw ex; } StreamToZip.Close(); } ZipStream.Finish(); ZipStream.Close(); } ZipFile.Close(); } } /// <summary> /// 压缩单个文件 /// </summary> /// <param name="fileToZip">要进行压缩的文件名</param> /// <param name="zipedFile">压缩后生成的压缩文件名</param> public static void ZipFile(string fileToZip, string zipedFile) { //如果文件没有找到,则报错 if (!File.Exists(fileToZip)) { throw new System.IO.FileNotFoundException("指定要压缩的文件: " + fileToZip + " 不存在!"); } using (FileStream fs = File.OpenRead(fileToZip)) { byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); fs.Close(); using (FileStream ZipFile = File.Create(zipedFile)) { using (ZipOutputStream ZipStream = new ZipOutputStream(ZipFile)) { string fileName = fileToZip.Substring(fileToZip.LastIndexOf("\\") + 1); ZipEntry ZipEntry = new ZipEntry(fileName); ZipStream.PutNextEntry(ZipEntry); ZipStream.SetLevel(5); ZipStream.Write(buffer, 0, buffer.Length); ZipStream.Finish(); ZipStream.Close(); } } } } /// <summary> /// 压缩多层目录 /// </summary> /// <param name="strDirectory">The directory.</param> /// <param name="zipedFile">The ziped file.</param> public static void ZipFileDirectory(string strDirectory, string zipedFile) { using (System.IO.FileStream ZipFile = System.IO.File.Create(zipedFile)) { using (ZipOutputStream s = new ZipOutputStream(ZipFile)) { ZipSetp(strDirectory, s, ""); } } } /// <summary> /// 递归遍历目录 /// </summary> /// <param name="strDirectory">The directory.</param> /// <param name="s">The ZipOutputStream Object.</param> /// <param name="parentPath">The parent path.</param> private static void ZipSetp(string strDirectory, ZipOutputStream s, string parentPath) { if (strDirectory[strDirectory.Length - 1] != Path.DirectorySeparatorChar) { strDirectory += Path.DirectorySeparatorChar; } Crc32 crc = new Crc32(); string[] filenames = Directory.GetFileSystemEntries(strDirectory); foreach (string file in filenames)// 遍历所有的文件和目录 { if (Directory.Exists(file))// 先当作目录处理如果存在这个目录就递归Copy该目录下面的文件 { string pPath = parentPath; pPath += file.Substring(file.LastIndexOf("\\") + 1); pPath += "\\"; ZipSetp(file, s, pPath); } else // 否则直接压缩文件 { //打开压缩文件 using (FileStream fs = File.OpenRead(file)) { byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); string fileName = parentPath + file.Substring(file.LastIndexOf("\\") + 1); ZipEntry entry = new ZipEntry(fileName); entry.DateTime = DateTime.Now; entry.Size = fs.Length; fs.Close(); crc.Reset(); crc.Update(buffer); entry.Crc = crc.Value; s.PutNextEntry(entry); s.Write(buffer, 0, buffer.Length); } } } } /// <summary> /// 解压缩一个 zip 文件。 /// </summary> /// <param name="zipedFile">The ziped file.</param> /// <param name="strDirectory">The STR directory.</param> /// <param name="password">zip 文件的密码。</param> /// <param name="overWrite">是否覆盖已存在的文件。</param> public void UnZip(string zipedFile, string strDirectory, string password, bool overWrite) { if (strDirectory == "") strDirectory = Directory.GetCurrentDirectory(); if (!strDirectory.EndsWith("\\")) strDirectory = strDirectory + "\\"; using (ZipInputStream s = new ZipInputStream(File.OpenRead(zipedFile))) { s.Password = password; ZipEntry theEntry; while ((theEntry = s.GetNextEntry()) != null) { string directoryName = ""; string pathToZip = ""; pathToZip = theEntry.Name; if (pathToZip != "") directoryName = Path.GetDirectoryName(pathToZip) + "\\"; string fileName = Path.GetFileName(pathToZip); Directory.CreateDirectory(strDirectory + directoryName); if (fileName != "") { if ((File.Exists(strDirectory + directoryName + fileName) && overWrite) || (!File.Exists(strDirectory + directoryName + fileName))) { using (FileStream streamWriter = File.Create(strDirectory + directoryName + fileName)) { int size = 2048; byte[] data = new byte[2048]; while (true) { size = s.Read(data, 0, data.Length); if (size > 0) streamWriter.Write(data, 0, size); else break; } streamWriter.Close(); } } } } s.Close(); } } } |
代码来自网络,略作修改,修改为静态方法,修改文件夹递归压缩时的bug.. 转自:http://www.cnblogs.com/xuanye/archive/2011/10/19/2217211.html
View DetailsWPF控件库之Label
Label 控件通常在用户界面 (UI) 中提供信息。一直以来,Label 只包含文本,但由于 Windows Presentation Foundation (WPF) 附带的 Label 是一个 ContentControl,所以它可以包含文本或 UIElement。 Label 为快捷键提供功能性和可视化支持。它常用于实现对控件(如 TextBox)的快速键盘访问。若要为 Control 指定 Label,请将 Label..::.Target 属性设置为当用户按下快捷键时应获得焦点的控件。 下图演示了一个目标为 ComboBox 的 Label“主题”。当用户按下 Alt+T 时,ComboBox 将获得焦点。 示例 下面的示例演示如何创建一个 Label,该控件使用 AccessText 并且绑定到目标 TextBox。 示例 为标签添加文本换行 Label 控件不支持文本换行。如果您需要一个多次换行的标签,可以嵌套一个支持文本换行的元素,并将该元素放在标签内。下面的示例演示如何使用 TextBlock 创建一个进行多次文本换行的标签。 为标签添加访问键和文本换行 如果您需要一个具有访问键(助记键)的 Label,则可以使用 Label 中的 AccessText 元素。 Label、Button、RadioButton、CheckBox、MenuItem、TabItem、Expander 和 GroupBox 等控件具有默认的控件模板。这些模板包含一个 ContentPresenter。您可以为 ContentPresenter 设置的属性之一是 RecognizesAccessKey="true",您可以使用该属性为控件指定访问键。 下面的示例演示如何创建一个具有访问键并支持文本换行的 Label。为了实现文本换行,本示例设置了 TextWrapping 属性并使用下划线字符指定访问键。(紧跟下划线字符后面的字符就是访问键。)
View Details