置顶随笔

[置顶]关于 Jquery getJSON方法的一点心得

摘要: 最近需要做一个纯静态html的网站,所以数据交互ajax必不可少,于是选择Jquery,本地调试一切正常,但是,上了服务器之后就有问题了。首先在FF上面出现这个错误:Error: [Exception... "Access to restricted URI denied"code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)"locat...阅读全文

posted @ 2008-12-11 16:45 Kevin Shi 阅读(13522) 评论(12) 编辑

2011年11月24日

Chromebook 终于出来了,还是Samsung的

Samsung Chromebook series 5
Buy Samsung Chromebook

The best web experience available...
Introducing the Samsung Chromebook Series 5

Boot up in ten seconds and enjoy a full day of surfing, streaming and working online on just one charge, with the Samsung Chromebook Series 5. This stunning and super-light Chromebook offers truly the best web experience available in any laptop.

Chrome logo

Online in seconds

Boot up and be online in less than 10 seconds with the Samsung Chromebook, or simply open the lid for instant restart from sleep mode.

Safe surfing

Fully optimised for the web, the Chrome operating system has integrated connectivity, advanced security and automatic updates for a faster, simpler and more secure online experience. Websites load quickly and smoothly while your apps, documents and settings are stored safely in the cloud.

app store

App-friendly

Enhance your online experience with Chrome Web Store by creating shortcuts to instantly launch your favourite apps. Thousands of popular apps include mail, news, documents, calendars, maps, games, photo management and heaps more!

  • Angry Birds
  • Games
  • Free
  • Gmail
  • Productivity
  • Free
  • Google Books
  • Education
  • Free
  • Google Docs
  • Productivity
  • Free
  • Google Talk
  • Social
  • Free
  • Google Maps
  • Utilities
  • Free
  • Tweet Deck
  • News & Weather
  • Free
  • Google Calendar
  • Utilities
  • Free
  • YouTube
  • Entertainment
  • Free
  • Picasa
  • Utilities
  • Free

Stay powered

Samsung’s intelligent battery charging technology enables the Chromebook battery to keep 80% of its original capacity for up to 1,000 recharges – more than 3 x longer than a typical battery!

Super-bright display

The anti-reflective SuperBright 12.1” LED Backlit display produces images that are up to 40% brighter than normal laptops – so you can enjoy the web for longer without straining your eyes, even outdoors.

chromebooks
Chromebook keyboard

Superior keyboard

Equipped with a dedicated search key, a new row of web-enabled keys and a comfortable, full-size layout, the Chromebook offers comfort and convenience in its unique design.

Thin and light design

Weighing only 1.48kg / 3.3lbs and just 19.9mm / 0.78inch thick, the ultra compact design provides maximum portability without compromising on functionality and optimal performance.

slimline samsung chromebook Pre order Samsung Chromebook

posted @ 2011-11-24 16:00 Kevin Shi 阅读(72) 评论(0) 编辑

2009年3月24日

都是 Thumbs.db 惹的祸

 为了在图片列表中能够根据图片的长宽自动缩放而得到较高质量的thumbnail,如下图:

 

我采取了下面的方法进行缩放:

Code

 

在本地调试一切正常,传到服务器上面,部分的图片报这个错误:

 

初遇此错误,出于对自己写的代码的不放心,检查了无数遍,一无所获;实在无路可走的时候只能瞎走了,于是首先想到的就是 反编译System.Drawing.Image类,看看到底是什么地方的内存溢出,于是安装QFE,在VS2008下面对Framework进行调试,无果,因为本地测试根本没有办法重现错误!

于是抱着试试看的心理,Google “System.OutOfMemoryException: Out of memory.”居然发现N个倒霉蛋和我一样的境遇,都是图像处理导致的内存溢出,只是由于 System.Drawing.Image.FromFile 这个方法造成内存溢出的并不多见,终于,让我发现了下面的文章:

http://weblogs.asp.net/plip/archive/2006/08/04/Image.FromFile_280022002E002E002E0022002900_-and-System.OutOfMemoryException.aspx

“I found out what it was - I'd not limited the file types that my folder search was performing, so it was also picking up the Windows XP automatically generated Thumbs.db, when it loaded that the above exception occurred.
Just thought this might help others out.”

于是恍然大悟,发现自己release的时候确实将repository的图像文件都发布出去了,于是乎Thumbs.db 也被跟着部署到了server上面。所以导致了这样的错误。

于是远程将repository 目录下的Thumbs.db删除,问题便得以解决。

关于 Thumbs.db,园子里有一些文章可以作为参考:

1, GIS的学习  http://www.cnblogs.com/zhangjun1130/archive/2009/01/14/1375836.html

2, 灵感之源 http://www.cnblogs.com/unruledboy/archive/2005/11/06/thumbsdbviewer.html


posted @ 2009-03-24 14:36 Kevin Shi 阅读(1681) 评论(8) 编辑

2008年12月11日

关于 Jquery getJSON方法的一点心得

最近需要做一个纯静态html的网站,所以数据交互ajax必不可少,于是选择Jquery,本地调试一切正常,但是,上了服务器之后就有问题了。

首先在FF上面出现这个错误:

Error: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "http://localhost:1234/JavaScript/JQurey/jquery-1.2.6.min.js Line: 28"]

IE下面呢倒是可以通过,但是会出现下面这个警告信息:

点完Yes之后是可以得到效果的。但是这样对于网站的客户来说,实在是很糟糕的体验。

于是google Access to restricted URI denied”,发现问题出在Cross-Domain上面,看了Jquery的开发资料得知,从1.2版本开始使用 jQuery.getJSON(url,[data],[callback]) 来进行跨域提交,参考如下:

As of jQuery 1.2, you can load JSON data located on another domain if you specify a JSONP callback, which can be done like so: "myurl?callback=?". jQuery automatically replaces the ? with the correct method name to call, calling your specified callback.

看了上面 JSONP的链接,几乎一无所获,按照其要求我加上了?callback=?",还是取不到任何数据,我的JS代码如下:


Code

但是始终得不到数据,断点设到data.name一行,从来没有被执行过。于是,开始考察jsoncallback=?,发现这个其实是有值的,只是自己一直没有handle(其实是因为自己不知道怎么样handlegoogle很久,几乎没有找到任何直接使用ashx来处理remote json的例子),但是搜到一篇元老级的文章,是一篇专门介绍jquery ajax的文章,上面说需要将jsoncallback的值传回来,原来如此,于是就将ashx的方法修改了一下,几经转折,终于调试出来下面的代码:


Code

其中,JsonObjectCollection 类要引用using System.Net.Json;JSON官方网站推荐的一个dll,我没有用JSON.Net,是因为我是2.0的,于是我使用这个,感觉也很不错。使用这个的好处是对于html代码的处理,因为json是通过“”传递数据的,但是html中也是含有“”的,如果直接手动拼写,会很麻烦。

这个ashx执行的结果如下:

jsonXXXXXXXXXXXXXX?

 

 

其中 jsonXXXXXXXXXXXXXX 就是context.Request.QueryString["jsoncallback"] 的值。

在页面当中的效果如下:

登陆之后的结果如下:

下面的那个cart也是通过相同的效果做出来的。



 下面是按照回复做出来的demo,我把System.Net.Json也放进去了。

 /Files/mygift/demo.zip

版权声明:本文原创发表于博客园,作者为Kevin Shi
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则视为侵权。

posted @ 2008-12-11 16:45 Kevin Shi 阅读(13522) 评论(12) 编辑

2008年6月27日

Downloader

A small tool for betty to download pictures from a website, using some code from codeproject, 5 hours.

1, Read the excel file to get the urls(page) and the file names.
2, Download every page.
3, Find the file I want in each web page.
4, Download the file and save to the folder.


posted @ 2008-06-27 18:01 Kevin Shi 阅读(53) 评论(0) 编辑

2008年6月26日

About System.Web.UI.Design

This namespace will not be found in vs2008 if u don't add System.Design as the reference

posted @ 2008-06-26 13:45 Kevin Shi 阅读(92) 评论(0) 编辑

导航

<2012年2月>
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910

公告

昵称:Kevin Shi
园龄:3年7个月
粉丝:0
关注:0

搜索

 
 

常用链接

随笔档案

最新评论